chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+137
View File
@@ -0,0 +1,137 @@
import type { UserFile } from '@/executor/types'
import type { LatexCompileParams, LatexCompileResponse } from '@/tools/latex/types'
import type { ToolConfig } from '@/tools/types'
export const latexCompileTool: ToolConfig<LatexCompileParams, LatexCompileResponse> = {
id: 'latex_compile',
name: 'LaTeX Compile',
description:
'Compile a LaTeX document into a PDF via the public LaTeX-on-HTTP service (latex.ytotech.com). Supports pdflatex, xelatex, lualatex, platex, uplatex, and context, plus supporting resources such as images, included .tex files, and bibliographies.',
version: '1.0.0',
params: {
content: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'LaTeX source of the main document, from \\documentclass to \\end{document}',
},
compiler: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'LaTeX compiler: pdflatex (default), xelatex, lualatex, platex, uplatex, or context',
},
fileName: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Name for the generated PDF file (default: document.pdf)',
},
resources: {
type: 'array',
required: false,
visibility: 'user-or-llm',
description:
'Supporting files for the compilation. Each entry has a "path" plus exactly one of "content" (plain text), "file" (base64), or "url" (remote file), e.g. [{"path": "refs.bib", "content": "..."}, {"path": "logo.png", "url": "https://..."}]',
items: {
type: 'object',
properties: {
path: { type: 'string', description: 'Relative path the file is available at' },
content: { type: 'string', description: 'Plain-text file content' },
file: { type: 'string', description: 'Base64-encoded file content' },
url: { type: 'string', description: 'URL the file is downloaded from' },
},
},
},
},
request: {
url: '/api/tools/latex',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (
params: LatexCompileParams & {
_context?: { workspaceId?: string; workflowId?: string; executionId?: string }
}
) => ({
content: params.content,
compiler: params.compiler,
fileName: params.fileName,
resources: params.resources,
workspaceId: params._context?.workspaceId,
workflowId: params._context?.workflowId,
executionId: params._context?.executionId,
}),
},
transformResponse: async (response: Response) => {
const data = (await response.json()) as {
error?: string
pdfFile?: UserFile
pdfUrl?: string
fileName?: string
compiler?: string
}
if (!response.ok || data.error) {
return {
success: false,
error: data.error || 'LaTeX compilation failed',
output: {
pdf: '',
pdfUrl: '',
fileName: '',
compiler: data.compiler || '',
},
}
}
const pdf =
data.pdfFile ||
(data.pdfUrl
? {
name: data.fileName || 'document.pdf',
url: data.pdfUrl,
mimeType: 'application/pdf',
}
: '')
if (!pdf) {
return {
success: false,
error: 'LaTeX compile response did not include a PDF',
output: {
pdf: '',
pdfUrl: '',
fileName: '',
compiler: data.compiler || '',
},
}
}
return {
success: true,
output: {
pdf,
pdfUrl: data.pdfUrl || '',
fileName: data.fileName || '',
compiler: data.compiler || '',
},
}
},
outputs: {
pdf: {
type: 'file',
description: 'Compiled PDF file',
fileConfig: { mimeType: 'application/pdf', extension: 'pdf' },
},
pdfUrl: { type: 'string', description: 'URL of the compiled PDF' },
fileName: { type: 'string', description: 'Name of the compiled PDF file' },
compiler: { type: 'string', description: 'LaTeX compiler used for the build' },
},
}
+116
View File
@@ -0,0 +1,116 @@
import type { LatexGetPackageParams, LatexGetPackageResponse } from '@/tools/latex/types'
import type { ToolConfig } from '@/tools/types'
export const latexGetPackageTool: ToolConfig<LatexGetPackageParams, LatexGetPackageResponse> = {
id: 'latex_get_package',
name: 'LaTeX Get Package',
description:
'Get details about a specific TeX Live package available to the LaTeX compiler, including whether it is installed, its description, license, and related packages.',
version: '1.0.0',
params: {
name: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Exact package name, e.g. amsmath, tikz, or biblatex',
},
},
request: {
url: (params) => `https://latex.ytotech.com/packages/${encodeURIComponent(params.name.trim())}`,
method: 'GET',
headers: () => ({
Accept: 'application/json',
}),
},
transformResponse: async (response: Response) => {
const data = (await response.json()) as {
error?: string
package?: {
package?: string
installed?: boolean
shortdesc?: string
longdesc?: string
category?: string
'cat-license'?: string
'cat-topics'?: string[]
'cat-related'?: string
'cat-contact-home'?: string
url_ctan?: string
}
}
const pkg = data.package
if (!response.ok || data.error || !pkg?.package) {
return {
success: false,
error:
data.error ||
(response.ok ? 'Package not found' : `LaTeX package lookup failed (${response.status})`),
output: {
package: {
name: '',
installed: false,
shortDescription: null,
longDescription: null,
category: null,
license: null,
topics: [],
relatedPackages: [],
homepage: null,
ctanUrl: null,
},
},
}
}
return {
success: true,
output: {
package: {
name: pkg.package,
installed: pkg.installed ?? false,
shortDescription: pkg.shortdesc ?? null,
longDescription: pkg.longdesc ?? null,
category: pkg.category ?? null,
license: pkg['cat-license'] ?? null,
topics: pkg['cat-topics'] ?? [],
relatedPackages: pkg['cat-related']
? pkg['cat-related'].split(/\s+/).filter(Boolean)
: [],
homepage: pkg['cat-contact-home'] ?? null,
ctanUrl: pkg.url_ctan ?? null,
},
},
}
},
outputs: {
package: {
type: 'json',
description: 'TeX Live package details',
properties: {
name: { type: 'string', description: 'Package name' },
installed: { type: 'boolean', description: 'Whether the package is installed' },
shortDescription: {
type: 'string',
description: 'One-line package description',
optional: true,
},
longDescription: {
type: 'string',
description: 'Full package description',
optional: true,
},
category: { type: 'string', description: 'Package category', optional: true },
license: { type: 'string', description: 'Package license identifier', optional: true },
topics: { type: 'array', description: 'CTAN topic tags' },
relatedPackages: { type: 'array', description: 'Names of related packages' },
homepage: { type: 'string', description: 'Package homepage URL', optional: true },
ctanUrl: { type: 'string', description: 'CTAN page for the package', optional: true },
},
},
},
}
+4
View File
@@ -0,0 +1,4 @@
export { latexCompileTool } from '@/tools/latex/compile'
export { latexGetPackageTool } from '@/tools/latex/get_package'
export { latexListFontsTool } from '@/tools/latex/list_fonts'
export { latexSearchPackagesTool } from '@/tools/latex/search_packages'
+102
View File
@@ -0,0 +1,102 @@
import type { LatexFont, LatexListFontsParams, LatexListFontsResponse } from '@/tools/latex/types'
import type { ToolConfig } from '@/tools/types'
const DEFAULT_MAX_RESULTS = 50
const MAX_RESULTS_LIMIT = 200
export const latexListFontsTool: ToolConfig<LatexListFontsParams, LatexListFontsResponse> = {
id: 'latex_list_fonts',
name: 'LaTeX List Fonts',
description:
'List the system fonts available to the LaTeX compiler, optionally filtered by name, e.g. to pick a font for xelatex or lualatex documents using fontspec.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter matched against font family and full font name, e.g. "Noto Serif"',
},
maxResults: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of fonts to return (default: 50, max: 200)',
},
},
request: {
url: 'https://latex.ytotech.com/fonts',
method: 'GET',
headers: () => ({
Accept: 'application/json',
}),
},
transformResponse: async (response: Response, params?: LatexListFontsParams) => {
const data = (await response.json()) as {
error?: string
fonts?: Array<{
family?: string
name?: string
styles?: string[]
}>
}
if (!response.ok || data.error) {
return {
success: false,
error: data.error || `LaTeX font listing failed (${response.status})`,
output: { fonts: [], totalMatches: 0 },
}
}
const query = (params?.query ?? '').trim().toLowerCase()
const matches = (data.fonts ?? []).filter((font) => {
if (!query) return true
return (
(font.family ?? '').toLowerCase().includes(query) ||
(font.name ?? '').toLowerCase().includes(query)
)
})
const requested = Math.trunc(Number(params?.maxResults))
const maxResults =
Number.isFinite(requested) && requested > 0
? Math.min(requested, MAX_RESULTS_LIMIT)
: DEFAULT_MAX_RESULTS
const fonts: LatexFont[] = matches.slice(0, maxResults).map((font) => ({
family: font.family ?? '',
name: font.name ?? '',
styles: font.styles ?? [],
}))
return {
success: true,
output: {
fonts,
totalMatches: matches.length,
},
}
},
outputs: {
fonts: {
type: 'array',
description: 'Fonts available to the LaTeX compiler',
items: {
type: 'object',
properties: {
family: { type: 'string', description: 'Font family name' },
name: { type: 'string', description: 'Full font name' },
styles: { type: 'array', description: 'Available styles, e.g. Bold or Italic' },
},
},
},
totalMatches: {
type: 'number',
description: 'Total number of fonts matching the filter, before truncation',
},
},
}
+118
View File
@@ -0,0 +1,118 @@
import type {
LatexPackageSummary,
LatexSearchPackagesParams,
LatexSearchPackagesResponse,
} from '@/tools/latex/types'
import type { ToolConfig } from '@/tools/types'
const DEFAULT_MAX_RESULTS = 25
const MAX_RESULTS_LIMIT = 100
export const latexSearchPackagesTool: ToolConfig<
LatexSearchPackagesParams,
LatexSearchPackagesResponse
> = {
id: 'latex_search_packages',
name: 'LaTeX Search Packages',
description:
'Search the TeX Live packages available to the LaTeX compiler by name or description, e.g. to check which packages can be used in a document.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Search terms matched against package names and descriptions',
},
maxResults: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of packages to return (default: 25, max: 100)',
},
},
request: {
url: 'https://latex.ytotech.com/packages',
method: 'GET',
headers: () => ({
Accept: 'application/json',
}),
},
transformResponse: async (response: Response, params?: LatexSearchPackagesParams) => {
const data = (await response.json()) as {
error?: string
packages?: Array<{
name?: string
shortdesc?: string
installed?: boolean
url_ctan?: string
}>
}
if (!response.ok || data.error) {
return {
success: false,
error: data.error || `LaTeX package search failed (${response.status})`,
output: { packages: [], totalMatches: 0 },
}
}
const query = (params?.query ?? '').trim().toLowerCase()
if (!query) {
return {
success: false,
error: 'Search query cannot be empty',
output: { packages: [], totalMatches: 0 },
}
}
const matches = (data.packages ?? []).filter(
(pkg) =>
(pkg.name ?? '').toLowerCase().includes(query) ||
(pkg.shortdesc ?? '').toLowerCase().includes(query)
)
const requested = Math.trunc(Number(params?.maxResults))
const maxResults =
Number.isFinite(requested) && requested > 0
? Math.min(requested, MAX_RESULTS_LIMIT)
: DEFAULT_MAX_RESULTS
const packages: LatexPackageSummary[] = matches.slice(0, maxResults).map((pkg) => ({
name: pkg.name ?? '',
shortDescription: pkg.shortdesc ?? null,
installed: pkg.installed ?? false,
ctanUrl: pkg.url_ctan ?? null,
}))
return {
success: true,
output: {
packages,
totalMatches: matches.length,
},
}
},
outputs: {
packages: {
type: 'array',
description: 'TeX Live packages matching the query',
items: {
type: 'object',
properties: {
name: { type: 'string', description: 'Package name' },
shortDescription: { type: 'string', description: 'One-line package description' },
installed: { type: 'boolean', description: 'Whether the package is installed' },
ctanUrl: { type: 'string', description: 'CTAN page for the package' },
},
},
},
totalMatches: {
type: 'number',
description: 'Total number of packages matching the query, before truncation',
},
},
}
+106
View File
@@ -0,0 +1,106 @@
import type { UserFile } from '@/executor/types'
import type { ToolResponse } from '@/tools/types'
export type LatexCompiler = 'pdflatex' | 'xelatex' | 'lualatex' | 'platex' | 'uplatex' | 'context'
/**
* Supporting file made available to the compiler alongside the main document.
* Exactly one of `content` (plain text), `file` (base64), or `url` (remote
* file) must be provided.
*/
export interface LatexResource {
path: string
content?: string
file?: string
url?: string
}
export interface LatexCompileParams {
content: string
compiler?: LatexCompiler
fileName?: string
resources?: LatexResource[]
}
/**
* Reference to the compiled PDF when no execution-file context is available;
* with execution context the output is a full {@link UserFile}.
*/
export interface LatexPdfReference {
name: string
url: string
mimeType: string
}
export interface LatexCompileResponse extends ToolResponse {
output: {
pdf: UserFile | LatexPdfReference | ''
pdfUrl: string
fileName: string
compiler: string
}
}
export interface LatexSearchPackagesParams {
query: string
maxResults?: number
}
export interface LatexPackageSummary {
name: string
shortDescription: string | null
installed: boolean
ctanUrl: string | null
}
export interface LatexSearchPackagesResponse extends ToolResponse {
output: {
packages: LatexPackageSummary[]
totalMatches: number
}
}
export interface LatexGetPackageParams {
name: string
}
export interface LatexGetPackageResponse extends ToolResponse {
output: {
package: {
name: string
installed: boolean
shortDescription: string | null
longDescription: string | null
category: string | null
license: string | null
topics: string[]
relatedPackages: string[]
homepage: string | null
ctanUrl: string | null
}
}
}
export interface LatexListFontsParams {
query?: string
maxResults?: number
}
export interface LatexFont {
family: string
name: string
styles: string[]
}
export interface LatexListFontsResponse extends ToolResponse {
output: {
fonts: LatexFont[]
totalMatches: number
}
}
export type LatexResponse =
| LatexCompileResponse
| LatexSearchPackagesResponse
| LatexGetPackageResponse
| LatexListFontsResponse