@agents24/cli 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/archive.ts","../src/package-source.ts","../src/remote.ts","../src/import-guards.ts"],"sourcesContent":["import { inflateRawSync, deflateRawSync } from \"node:zlib\";\n\nconst MAX_COMPRESSED = 5 * 1024 * 1024;\nconst MAX_UNCOMPRESSED = 10 * 1024 * 1024;\nconst MAX_FILE = 2 * 1024 * 1024;\nconst MAX_FILES = 512;\nconst MAX_DEPTH = 12;\n\nconst CRC_TABLE = Array.from({ length: 256 }, (_, start) => {\n let value = start;\n for (let bit = 0; bit < 8; bit += 1) {\n value = (value & 1) ? 0xedb88320 ^ (value >>> 1) : value >>> 1;\n }\n return value >>> 0;\n});\n\nfunction crc32(value: Uint8Array): number {\n let crc = 0xffffffff;\n for (const byte of value) crc = CRC_TABLE[(crc ^ byte) & 0xff] ^ (crc >>> 8);\n return (crc ^ 0xffffffff) >>> 0;\n}\n\nfunction safePath(raw: string): string {\n if (!raw || raw.startsWith(\"/\") || raw.includes(\"\\\\\")) throw new Error(\"Archive contains an unsafe path\");\n const parts = raw.split(\"/\");\n if (parts.some((part) => !part || part === \".\" || part === \"..\")) throw new Error(\"Archive contains an unsafe path\");\n if (parts.length > MAX_DEPTH) throw new Error(`Archive path exceeds depth ${MAX_DEPTH}: ${raw}`);\n if (/\\.(?:zip|tar|tgz|gz)$/i.test(raw)) throw new Error(`Nested archives are unsupported: ${raw}`);\n if (!/\\.(?:yaml|md)$/.test(raw) || raw.endsWith(\".yml\")) throw new Error(`Unsupported package file: ${raw}`);\n return raw;\n}\n\nfunction writeUInt32(value: number): Buffer {\n const result = Buffer.allocUnsafe(4);\n result.writeUInt32LE(value >>> 0);\n return result;\n}\n\nfunction writeUInt16(value: number): Buffer {\n const result = Buffer.allocUnsafe(2);\n result.writeUInt16LE(value);\n return result;\n}\n\nexport function packFiles(files: Map<string, string>): Uint8Array {\n if (files.size > MAX_FILES) throw new Error(\"Package exceeds the 512-file limit\");\n const localParts: Buffer[] = [];\n const centralParts: Buffer[] = [];\n let offset = 0;\n let total = 0;\n const normalized = new Set<string>();\n\n for (const [rawPath, text] of [...files.entries()].sort(([left], [right]) => left.localeCompare(right))) {\n const path = safePath(rawPath);\n const folded = path.toLocaleLowerCase(\"en-US\");\n if (normalized.has(folded)) throw new Error(`Package contains duplicate path: ${path}`);\n normalized.add(folded);\n const name = Buffer.from(path, \"utf8\");\n const content = Buffer.from(text, \"utf8\");\n if (content.byteLength > MAX_FILE) throw new Error(`Package file exceeds the 2 MiB limit: ${path}`);\n total += content.byteLength;\n if (total > MAX_UNCOMPRESSED) throw new Error(\"Package exceeds the 10 MiB uncompressed limit\");\n const compressed = deflateRawSync(content, { level: 9 });\n const checksum = crc32(content);\n const local = Buffer.concat([\n writeUInt32(0x04034b50),\n writeUInt16(20),\n writeUInt16(0x0800),\n writeUInt16(8),\n writeUInt16(0),\n writeUInt16(0x0021),\n writeUInt32(checksum),\n writeUInt32(compressed.byteLength),\n writeUInt32(content.byteLength),\n writeUInt16(name.byteLength),\n writeUInt16(0),\n name,\n compressed,\n ]);\n localParts.push(local);\n centralParts.push(Buffer.concat([\n writeUInt32(0x02014b50),\n writeUInt16(0x0314),\n writeUInt16(20),\n writeUInt16(0x0800),\n writeUInt16(8),\n writeUInt16(0),\n writeUInt16(0x0021),\n writeUInt32(checksum),\n writeUInt32(compressed.byteLength),\n writeUInt32(content.byteLength),\n writeUInt16(name.byteLength),\n writeUInt16(0),\n writeUInt16(0),\n writeUInt16(0),\n writeUInt16(0),\n writeUInt32(0o100644 << 16),\n writeUInt32(offset),\n name,\n ]));\n offset += local.byteLength;\n }\n\n const central = Buffer.concat(centralParts);\n const result = Buffer.concat([\n ...localParts,\n central,\n writeUInt32(0x06054b50),\n writeUInt16(0),\n writeUInt16(0),\n writeUInt16(files.size),\n writeUInt16(files.size),\n writeUInt32(central.byteLength),\n writeUInt32(offset),\n writeUInt16(0),\n ]);\n if (result.byteLength > MAX_COMPRESSED) throw new Error(\"Package exceeds the 5 MiB compressed limit\");\n return result;\n}\n\nfunction endOfCentralDirectory(data: Buffer): number {\n const minimum = Math.max(0, data.byteLength - 65557);\n for (let index = data.byteLength - 22; index >= minimum; index -= 1) {\n if (data.readUInt32LE(index) === 0x06054b50) return index;\n }\n throw new Error(\"Package must be a valid ZIP archive\");\n}\n\nexport function unpackFiles(value: Uint8Array): Map<string, string> {\n const data = Buffer.from(value);\n if (data.byteLength > MAX_COMPRESSED) throw new Error(\"Package exceeds the 5 MiB compressed limit\");\n const end = endOfCentralDirectory(data);\n const count = data.readUInt16LE(end + 10);\n const centralOffset = data.readUInt32LE(end + 16);\n if (count > MAX_FILES) throw new Error(\"Package exceeds the 512-file limit\");\n const files = new Map<string, string>();\n const normalized = new Set<string>();\n let cursor = centralOffset;\n let total = 0;\n\n for (let index = 0; index < count; index += 1) {\n if (data.readUInt32LE(cursor) !== 0x02014b50) throw new Error(\"Package central directory is invalid\");\n const method = data.readUInt16LE(cursor + 10);\n const expectedCrc = data.readUInt32LE(cursor + 16);\n const compressedSize = data.readUInt32LE(cursor + 20);\n const uncompressedSize = data.readUInt32LE(cursor + 24);\n const nameLength = data.readUInt16LE(cursor + 28);\n const extraLength = data.readUInt16LE(cursor + 30);\n const commentLength = data.readUInt16LE(cursor + 32);\n const externalAttributes = data.readUInt32LE(cursor + 38);\n const localOffset = data.readUInt32LE(cursor + 42);\n const path = safePath(data.subarray(cursor + 46, cursor + 46 + nameLength).toString(\"utf8\"));\n if ((externalAttributes >>> 16 & 0o170000) === 0o120000) throw new Error(`Package symlinks are unsupported: ${path}`);\n const folded = path.toLocaleLowerCase(\"en-US\");\n if (normalized.has(folded)) throw new Error(`Package contains duplicate path: ${path}`);\n normalized.add(folded);\n if (uncompressedSize > MAX_FILE) throw new Error(`Package file exceeds the 2 MiB limit: ${path}`);\n total += uncompressedSize;\n if (total > MAX_UNCOMPRESSED) throw new Error(\"Package exceeds the 10 MiB uncompressed limit\");\n if (data.readUInt32LE(localOffset) !== 0x04034b50) throw new Error(\"Package local header is invalid\");\n const localNameLength = data.readUInt16LE(localOffset + 26);\n const localExtraLength = data.readUInt16LE(localOffset + 28);\n const contentOffset = localOffset + 30 + localNameLength + localExtraLength;\n const compressed = data.subarray(contentOffset, contentOffset + compressedSize);\n let content: Buffer | null = null;\n try {\n content = method === 8\n ? inflateRawSync(compressed, { maxOutputLength: Math.min(MAX_FILE, uncompressedSize) + 1 })\n : method === 0 ? compressed : null;\n } catch {\n throw new Error(`Package file is invalid or exceeds its declared size: ${path}`);\n }\n if (!content || content.byteLength !== uncompressedSize || crc32(content) !== expectedCrc) {\n throw new Error(`Package file is invalid: ${path}`);\n }\n if (content.includes(0)) throw new Error(`Binary package file is unsupported: ${path}`);\n files.set(path, new TextDecoder(\"utf-8\", { fatal: true }).decode(content));\n cursor += 46 + nameLength + extraLength + commentLength;\n }\n if (!files.has(\"agents24.yaml\")) throw new Error(\"Package requires agents24.yaml at the archive root\");\n return files;\n}\n","import { lstat, mkdir, readFile, readdir, stat, writeFile } from \"node:fs/promises\";\nimport { readFileSync as readSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport Ajv2020 from \"ajv/dist/2020.js\";\nimport { parseDocument } from \"yaml\";\n\nimport { packFiles, unpackFiles } from \"./archive.js\";\n\nexport type Diagnostic = { severity: \"error\" | \"warning\"; code: string; path: string; message: string };\nexport type ValidationResult = {\n valid: boolean;\n package: Record<string, unknown>;\n resources: Array<Record<string, unknown>>;\n requirements: string[];\n diagnostics: Diagnostic[];\n files: Map<string, string>;\n};\n\nconst MANIFEST = \"agents24.yaml\";\nconst SYMBOL = /^\\$(workflows|rag|skills|models|stores|tools|toolsets|artifacts|integrations|secrets)\\.([a-z0-9]+(?:-[a-z0-9]+)*)$/;\nconst UUID = /\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b/i;\nconst URL_PATTERN = /\\b[A-Za-z][A-Za-z0-9+.-]*:\\/\\//;\nconst LOCAL = /^(workflows|agents|rag|skills|stores|files)\\/(?:[a-z0-9][a-z0-9-]*\\/)*[a-z0-9][a-z0-9-]*\\.(yaml|md)$/;\nconst SECRET_FIELDS = new Set([\"access_token\",\"api_key\",\"authorization\",\"bearer_token\",\"client_secret\",\"credential\",\"credentials\",\"fixed_account_connection_id\",\"oauth_client_id\",\"oauth_client_secret\",\"password\",\"private_key\",\"refresh_token\",\"secret_name\",\"secret_value\",\"static_bearer_token\",\"static_headers\",\"token\",\"url\",\"account_id\",\"organization_id\",\"project_id\",\"publication_state\",\"governance_policy\"]);\n\nfunction add(rows: Diagnostic[], severity: Diagnostic[\"severity\"], code: string, itemPath: string, message: string): void {\n rows.push({ severity, code, path: itemPath, message });\n}\nfunction slug(value: string): string {\n return value.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\").slice(0, 64) || \"agent\";\n}\nfunction parseYaml(text: string, itemPath: string, diagnostics: Diagnostic[]): Record<string, unknown> {\n const doc = parseDocument(text, { uniqueKeys: true });\n for (const error of doc.errors) add(diagnostics, \"error\", \"YAML_INVALID\", itemPath, error.message);\n if (doc.errors.length) return {};\n const value = doc.toJS({ maxAliasCount: 0 });\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n add(diagnostics, \"error\", \"YAML_INVALID\", itemPath, \"YAML source must contain a mapping\");\n return {};\n }\n return value as Record<string, unknown>;\n}\nfunction frontmatter(text: string, itemPath: string, diagnostics: Diagnostic[]): Record<string, unknown> {\n const match = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---(?:\\r?\\n|$)/.exec(text);\n if (!match) {\n add(diagnostics, \"error\", \"FRONTMATTER_REQUIRED\", itemPath, \"Markdown source requires YAML frontmatter\");\n return {};\n }\n return parseYaml(match[1], itemPath, diagnostics);\n}\nfunction markdownBody(text: string): string {\n const match = /^---\\r?\\n[\\s\\S]*?\\r?\\n---(?:\\r?\\n|$)([\\s\\S]*)$/.exec(text);\n return match?.[1] || \"\";\n}\nfunction schema(name: string): Record<string, unknown> {\n const location = new URL(`../generated/schemas/resource-package/1.0/${name}.schema.json`, import.meta.url);\n return JSON.parse(readSync(fileURLToPath(location), \"utf8\")) as Record<string, unknown>;\n}\nconst AjvConstructor = Ajv2020 as unknown as new (options: Record<string, unknown>) => {\n compile(schema: Record<string, unknown>): ((value: unknown) => boolean) & { errors?: Array<{ instancePath?: string; message?: string }> };\n};\nconst ajv = new AjvConstructor({ allErrors: true, strict: true, strictRequired: false });\nconst validators = Object.fromEntries([\"manifest\",\"workflow\",\"agent\",\"rag\",\"skill\",\"store\"].map((name) => [name, ajv.compile(schema(name))]));\n\nasync function directoryFiles(root: string): Promise<Map<string, string>> {\n const files = new Map<string, string>();\n let total = 0;\n async function visit(directory: string): Promise<void> {\n for (const entry of await readdir(directory, { withFileTypes: true })) {\n const absolute = path.join(directory, entry.name);\n const relative = path.relative(root, absolute).split(path.sep).join(\"/\");\n const metadata = await lstat(absolute);\n if (metadata.isSymbolicLink()) throw new Error(`Package symlinks are unsupported: ${relative}`);\n if (metadata.isDirectory()) { await visit(absolute); continue; }\n if (!metadata.isFile()) continue;\n if (relative.split(\"/\").length > 12) throw new Error(`Package path exceeds depth 12: ${relative}`);\n if (!/\\.(?:yaml|md)$/.test(relative) || relative.endsWith(\".yml\")) throw new Error(`Unsupported package file: ${relative}`);\n if (metadata.size > 2 * 1024 * 1024) throw new Error(`Package file exceeds the 2 MiB limit: ${relative}`);\n total += metadata.size;\n if (total > 10 * 1024 * 1024) throw new Error(\"Package exceeds the 10 MiB uncompressed limit\");\n const body = await readFile(absolute);\n if (body.includes(0)) throw new Error(`Binary package file is unsupported: ${relative}`);\n files.set(relative, new TextDecoder(\"utf-8\", { fatal: true }).decode(body));\n if (files.size > 512) throw new Error(\"Package exceeds the 512-file limit\");\n }\n }\n await visit(root);\n return files;\n}\nexport async function loadPackageFiles(input: string): Promise<Map<string, string>> {\n return (await stat(input)).isDirectory() ? directoryFiles(input) : unpackFiles(await readFile(input));\n}\nfunction validateSchema(kind: keyof typeof validators, value: Record<string, unknown>, itemPath: string, diagnostics: Diagnostic[]): void {\n const validate = validators[kind];\n if (validate(value)) return;\n for (const error of validate.errors || []) add(diagnostics, \"error\", \"SCHEMA_INVALID\", itemPath + (error.instancePath || \"\"), error.message || \"Schema validation failed\");\n}\nfunction resolve(source: string, target: string): string | null {\n if (!target || target.startsWith(\"/\") || target.includes(\"\\\\\")) return null;\n const value = path.posix.normalize(path.posix.join(path.posix.dirname(source), target));\n return value === \"..\" || value.startsWith(\"../\") || !LOCAL.test(value) ? null : value;\n}\nfunction walk(value: unknown, visit: (value: unknown, itemPath: string, key?: string) => void, itemPath = \"\", key?: string): void {\n visit(value, itemPath, key);\n if (Array.isArray(value)) value.forEach((item, index) => walk(item, visit, `${itemPath}/${index}`, key));\n else if (value && typeof value === \"object\") for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n walk(item, visit, `${itemPath}/${key}`, key);\n }\n}\n\nexport function validateFiles(files: Map<string, string>): ValidationResult {\n const diagnostics: Diagnostic[] = [];\n const manifest = parseYaml(files.get(MANIFEST) || \"\", MANIFEST, diagnostics);\n validateSchema(\"manifest\", manifest, MANIFEST, diagnostics);\n walk(manifest, (item, itemPath, key) => {\n if (key && SECRET_FIELDS.has(key.toLowerCase())) add(diagnostics, \"error\", \"FORBIDDEN_FIELD\", MANIFEST + itemPath, \"Secret and platform identity fields are forbidden\");\n if (typeof item === \"string\" && (UUID.test(item) || URL_PATTERN.test(item))) add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", MANIFEST + itemPath, \"Platform UUIDs and URLs are forbidden in source packages\");\n });\n const parsed = new Map<string, Record<string, unknown>>();\n const resources: Array<Record<string, unknown>> = [];\n for (const [filePath, text] of [...files].sort(([left],[right]) => left.localeCompare(right))) {\n if (filePath === MANIFEST) continue;\n let kind: \"workflow\"|\"agent\"|\"rag\"|\"skill\"|\"store\"|null = null;\n if (/^workflows\\/[a-z0-9][a-z0-9-]*\\.yaml$/.test(filePath)) kind = \"workflow\";\n else if (/^agents\\/[a-z0-9][a-z0-9-]*\\.md$/.test(filePath)) kind = \"agent\";\n else if (/^rag\\/[a-z0-9][a-z0-9-]*\\.yaml$/.test(filePath)) kind = \"rag\";\n else if (/^skills\\/[a-z0-9][a-z0-9-]*\\.md$/.test(filePath)) kind = \"skill\";\n else if (/^stores\\/[a-z0-9][a-z0-9-]*\\.yaml$/.test(filePath)) kind = \"store\";\n else if (/^files\\/.+\\.md$/.test(filePath)) { parsed.set(filePath, {}); continue; }\n if (!kind) { add(diagnostics, \"error\", \"UNKNOWN_FILE\", filePath, \"File is not in a canonical package directory\"); continue; }\n const value = kind === \"workflow\" || kind === \"rag\" || kind === \"store\" ? parseYaml(text, filePath, diagnostics) : frontmatter(text, filePath, diagnostics);\n validateSchema(kind, value, filePath, diagnostics);\n if ((kind === \"agent\" || kind === \"skill\") && (UUID.test(markdownBody(text).trim()) || URL_PATTERN.test(markdownBody(text).trim()))) {\n add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", `${filePath}/body`, \"Platform UUIDs and URLs are forbidden in source packages\");\n }\n parsed.set(filePath, value);\n if (kind !== \"agent\") resources.push({ path: filePath, kind: kind === \"workflow\" ? \"agent\" : kind === \"rag\" ? \"rag_pipeline\" : kind === \"store\" ? \"knowledge_store\" : \"instruction\", name: value.name });\n }\n const declaredRows = Array.isArray(manifest.resources) ? manifest.resources.map(String) : [];\n if (declaredRows.some((item, index) => item !== [...declaredRows].sort()[index])) add(diagnostics, \"error\", \"RESOURCE_ORDER\", MANIFEST, \"resources must be sorted deterministically\");\n const declared = new Set(declaredRows);\n const platformResources = new Set(resources.map((item) => String(item.path)));\n declaredRows.forEach((filePath, index) => {\n if (!platformResources.has(filePath)) add(diagnostics, \"error\", \"RESOURCE_DECLARATION_INVALID\", `${MANIFEST}/resources/${index}`, `Declared resource does not exist or is not a platform resource: ${filePath}`);\n });\n for (const filePath of platformResources) if (!declared.has(filePath)) add(diagnostics, \"error\", \"RESOURCE_NOT_DECLARED\", filePath, \"Platform resource must be listed in agents24.yaml resources\");\n const reachable = new Set<string>();\n const queue = declaredRows.filter((filePath) => platformResources.has(filePath));\n let referenceCount = 0;\n while (queue.length) {\n const source = queue.shift() as string;\n if (reachable.has(source)) continue;\n reachable.add(source);\n const value = parsed.get(source) || {};\n if (source.startsWith(\"agents/\")) {\n for (const match of (files.get(source) || \"\").matchAll(/\\[\\[skill:([a-z0-9]+(?:-[a-z0-9]+)*)\\]\\]/g)) {\n referenceCount += 1;\n const target = `skills/${match[1]}.md`;\n if (!parsed.has(target)) add(diagnostics, \"error\", \"LOCAL_REFERENCE_MISSING\", `${source}/body`, `Missing local reference: ${target}`);\n else queue.push(target);\n }\n }\n walk(value, (item, itemPath, key) => {\n if (key && SECRET_FIELDS.has(key.toLowerCase())) add(diagnostics, \"error\", \"FORBIDDEN_FIELD\", source + itemPath, \"Secret and platform identity fields are forbidden\");\n if (typeof item !== \"string\") return;\n if (UUID.test(item) || URL_PATTERN.test(item)) add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", source + itemPath, \"Platform UUIDs and URLs are forbidden in source packages\");\n const symbol = SYMBOL.exec(item);\n if (symbol) {\n referenceCount += 1;\n const declarations = (manifest.requires as Record<string, Record<string, unknown>> | undefined)?.[symbol[1]];\n if (!declarations || !(symbol[2] in declarations)) add(diagnostics, \"error\", \"REQUIREMENT_UNDECLARED\", source + itemPath, `${item} is not declared`);\n }\n const target = resolve(source, item);\n const platformTarget = Boolean(target && /^(workflows|rag|skills|stores)\\//.test(target));\n if (target && (platformTarget || [\"uses\",\"skills\",\"instructions\",\"file\"].includes(String(key)))) {\n referenceCount += 1;\n if (!parsed.has(target)) add(diagnostics, \"error\", \"LOCAL_REFERENCE_MISSING\", source + itemPath, `Missing local reference: ${target}`);\n else {\n if (platformTarget && !declared.has(target)) add(diagnostics, \"error\", \"RESOURCE_NOT_DECLARED\", source + itemPath, `Referenced platform resource is not declared: ${target}`);\n queue.push(target);\n }\n }\n });\n }\n for (const filePath of parsed.keys()) if (/^(agents|files)\\//.test(filePath) && !reachable.has(filePath)) add(diagnostics, \"error\", \"ORPHAN_AUXILIARY\", filePath, \"Auxiliary file is not referenced by a declared resource\");\n if (resources.length > 250) add(diagnostics, \"error\", \"RESOURCE_LIMIT\", MANIFEST, \"Package exceeds 250 resources\");\n if (referenceCount > 5000) add(diagnostics, \"error\", \"REFERENCE_LIMIT\", MANIFEST, \"Package exceeds 5,000 references\");\n diagnostics.sort((left,right) => left.path.localeCompare(right.path) || left.code.localeCompare(right.code) || left.message.localeCompare(right.message));\n const requirements = [...new Set([...files.values()].flatMap((text) => [...text.matchAll(/\\$(?:workflows|rag|skills|models|stores|tools|toolsets|artifacts|integrations|secrets)\\.[a-z0-9-]+/g)].map((match) => match[0])))].sort();\n return { valid: !diagnostics.some((item) => item.severity === \"error\"), package: manifest, resources, requirements, diagnostics, files };\n}\nexport async function validatePackage(input: string): Promise<ValidationResult> {\n return validateFiles(await loadPackageFiles(input));\n}\nexport async function packPackage(input: string): Promise<Uint8Array> {\n const result = await validatePackage(input);\n if (!result.valid) throw Object.assign(new Error(\"Resource package is invalid\"), { diagnostics: result.diagnostics });\n return packFiles(result.files);\n}\nexport async function initializePackage(directory: string, packageName: string): Promise<string> {\n const packageSlug = slug(packageName);\n await mkdir(path.join(directory, \"workflows\"), { recursive: true });\n await mkdir(path.join(directory, \"agents\"), { recursive: true });\n await mkdir(path.join(directory, \"rag\"), { recursive: true });\n await mkdir(path.join(directory, \"skills\"), { recursive: true });\n await mkdir(path.join(directory, \"stores\"), { recursive: true });\n await mkdir(path.join(directory, \"files\"), { recursive: true });\n const manifest = { schema: \"agents24.package/v1\", name: packageSlug, description: `${packageName} agent package`, resources: [\"workflows/main.yaml\"], requires: { models: { primary: { required: true, capability: \"chat\" } } } };\n const workflow = { schema: \"agents24.workflow/v1\", name: packageName, description: \"\", inputs: { text: \"string\" }, outputs: { response: \"string\" }, entry: \"assistant\", nodes: { assistant: { uses: \"../agents/assistant.md\" } }, flow: [{ from: \"assistant.output\", to: \"output.response\" }] };\n const agent = `---\\nschema: agents24.agent/v1\\nname: Assistant\\ndescription: Primary assistant\\nmodel: $models.primary\\n---\\n\\nYou are a helpful assistant.\\n`;\n await writeFile(path.join(directory, MANIFEST), _yaml(manifest), { flag: \"wx\" });\n await writeFile(path.join(directory, \"workflows/main.yaml\"), _yaml(workflow), { flag: \"wx\" });\n await writeFile(path.join(directory, \"agents/assistant.md\"), agent, { flag: \"wx\" });\n return packageSlug;\n}\nfunction _yaml(value: unknown): string {\n const doc = parseDocument(\"{}\");\n doc.contents = doc.createNode(value) as typeof doc.contents;\n return String(doc);\n}\n","type ResourcePackageUpload = { data: Uint8Array; filename?: string };\ntype ResourceBundleRequest = {\n bundle: Record<string, unknown>;\n selected_resource_keys?: string[];\n mappings?: Record<string, string>;\n};\n\nexport type RemoteClient = {\n resourcePackages: {\n exportPackage(request: Record<string, unknown>): Promise<{ data: Uint8Array; filename: string }>;\n validatePackage(upload: ResourcePackageUpload): Promise<Record<string, unknown>>;\n compilePackage(upload: ResourcePackageUpload): Promise<Record<string, unknown>>;\n };\n resourceBundles: {\n importPreview(request: ResourceBundleRequest): Promise<Record<string, unknown>>;\n importBundle(request: ResourceBundleRequest, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n candidates(options: { kind: string; query?: string; requiredCapability?: \"chat\" | \"embedding\" }): Promise<Record<string, unknown>>;\n };\n agents: { publish(id: string, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>> };\n resourcePolicies: { list(): Promise<Array<Record<string, unknown>>> };\n clientDeployments: { create(request: Record<string, unknown>, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>> };\n};\n\nexport async function createRemoteClient(environment: NodeJS.ProcessEnv = process.env): Promise<RemoteClient> {\n const required = [\"AGENTS24_API_KEY\"] as const;\n const missing = required.filter((name) => !String(environment[name] || \"\").trim());\n if (missing.length) throw new Error(`Missing remote configuration: ${missing.join(\", \")}`);\n\n const canonicalNodePackage = \"@agents24/node\";\n const module = await import(canonicalNodePackage) as { Agents24?: new (options: Record<string, unknown>) => unknown };\n if (!module.Agents24) throw new Error(\"@agents24/node does not export Agents24\");\n return new module.Agents24({\n baseUrl: String(environment.AGENTS24_BASE_URL || \"https://api.agents24.dev\").trim(),\n apiKey: environment.AGENTS24_API_KEY,\n }) as unknown as RemoteClient;\n}\n","export function parseMappings(items: string[]): Record<string, string> {\n return Object.fromEntries(items.map((item) => {\n const separator = item.indexOf(\"=\");\n if (separator <= 0 || separator === item.length - 1) {\n throw new Error(\"--map must use requirement-key=target-id\");\n }\n return [item.slice(0, separator), item.slice(separator + 1)];\n }));\n}\n\nexport function shouldPromptForDependency(dependency: Record<string, unknown>): boolean {\n return dependency.kind !== \"model\";\n}\n\nexport function assertInstallPreviewReady(preview: Record<string, unknown>): void {\n if (preview.can_import === true) return;\n const blockers = Array.isArray(preview.blockers) ? preview.blockers as Array<Record<string, unknown>> : [];\n const message = String(blockers[0]?.message || \"Package cannot be installed\");\n throw new Error(message);\n}\n\nexport function assertImportAllowed(\n preview: Record<string, unknown>,\n options: { allowIncomplete: boolean; yes: boolean; interactive: boolean },\n): void {\n const resources = Array.isArray(preview.resources) ? preview.resources as Array<Record<string, unknown>> : [];\n if (resources.some((item) => item.status === \"incomplete\") && !options.allowIncomplete) {\n throw new Error(\"Import would create incomplete drafts; pass --allow-incomplete to continue\");\n }\n if (!options.yes && !options.interactive) throw new Error(\"Non-interactive import requires --yes\");\n}\n"],"mappings":";;;AAAA,SAAS,gBAAgB,sBAAsB;AAE/C,IAAM,iBAAiB,IAAI,OAAO;AAClC,IAAM,mBAAmB,KAAK,OAAO;AACrC,IAAM,WAAW,IAAI,OAAO;AAC5B,IAAM,YAAY;AAClB,IAAM,YAAY;AAElB,IAAM,YAAY,MAAM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