@agents24/cli 0.1.1 → 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.
- package/README.md +10 -7
- package/compatibility.json +7 -7
- package/dist/{chunk-MNGBA3HP.js → chunk-NLUCQTMN.js} +34 -26
- package/dist/chunk-NLUCQTMN.js.map +1 -0
- package/dist/cli.js +519 -105
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +53 -2
- package/dist/index.js +1 -3
- package/generated/schemas/resource-package/{1.0 → 2.0}/agent.schema.json +7 -2
- package/generated/schemas/resource-package/2.0/artifact.schema.json +67 -0
- package/generated/schemas/resource-package/{1.0 → 2.0}/manifest.schema.json +22 -4
- package/generated/schemas/resource-package/{1.0 → 2.0}/rag.schema.json +1 -1
- package/generated/schemas/resource-package/{1.0 → 2.0}/skill.schema.json +1 -1
- package/generated/schemas/resource-package/{1.0 → 2.0}/store.schema.json +7 -2
- package/generated/schemas/resource-package/{1.0 → 2.0}/workflow.schema.json +1 -1
- package/package.json +3 -3
- package/dist/chunk-MNGBA3HP.js.map +0 -1
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["import { basename, join, resolve } from \"node:path\";\nimport { chmod, readFile, writeFile } from \"node:fs/promises\";\nimport { createInterface } from \"node:readline/promises\";\nimport { createHash } from \"node:crypto\";\nimport { isCancel, password, select, text } from \"@clack/prompts\";\n\nimport { initializePackage, packPackage, validatePackage, type Diagnostic } from \"./package-source.js\";\nimport { createRemoteClient } from \"./remote.js\";\nimport { assertImportAllowed, assertInstallPreviewReady, parseMappings, shouldPromptForDependency } from \"./import-guards.js\";\n\ntype Parsed = {\n command: string;\n positionals: string[];\n flags: Map<string, string[]>;\n};\n\nconst BOOLEAN_FLAGS = new Set([\"json\", \"remote\", \"yes\", \"allow-incomplete\", \"no-write-env\"]);\nconst DEFAULT_API_BASE_URL = \"https://api.agents24.dev\";\nconst DEFAULT_LOCAL_CLIENT_ORIGINS = [\"http://localhost:5173\", \"http://127.0.0.1:5173\"];\n\nfunction parse(argv: string[]): Parsed {\n const standaloneInstall = argv[0] === \"install\";\n if (!standaloneInstall && (argv[0] !== \"package\" || !argv[1])) throw new Error(\"Usage: agents24 install <directory-or-zip> | agents24 package <init|validate|pack|export|compile|preview|import>\");\n const flags = new Map<string, string[]>();\n const positionals: string[] = [];\n for (let index = standaloneInstall ? 1 : 2; index < argv.length; index += 1) {\n const current = argv[index];\n if (!current.startsWith(\"--\")) { positionals.push(current); continue; }\n const [rawName, inline] = current.slice(2).split(\"=\", 2);\n if (!rawName) throw new Error(\"Invalid option\");\n if (rawName === \"api-key\") {\n throw new Error(\"--api-key is not supported; use AGENTS24_API_KEY or the masked prompt\");\n }\n const value = inline ?? (BOOLEAN_FLAGS.has(rawName) ? \"true\" : argv[++index]);\n if (value === undefined || value.startsWith(\"--\")) throw new Error(`--${rawName} requires a value`);\n flags.set(rawName, [...(flags.get(rawName) || []), value]);\n }\n return { command: standaloneInstall ? \"install\" : argv[1], positionals, flags };\n}\n\nfunction flag(parsed: Parsed, name: string): string | undefined {\n return parsed.flags.get(name)?.at(-1);\n}\n\nfunction values(parsed: Parsed, name: string): string[] {\n return parsed.flags.get(name) || [];\n}\n\nfunction mappings(parsed: Parsed): Record<string, string> {\n return parseMappings(values(parsed, \"map\"));\n}\n\nfunction upload(data: Uint8Array, input: string): { data: Uint8Array; filename: string } {\n return { data, filename: basename(input).endsWith(\".zip\") ? basename(input) : \"resource.agents24.zip\" };\n}\n\nfunction safeResult(result: Record<string, unknown>): Record<string, unknown> {\n return result;\n}\n\nasync function confirmation(parsed: Parsed, preview: Record<string, unknown>): Promise<void> {\n const resources = Array.isArray(preview.resources) ? preview.resources as Array<Record<string, unknown>> : [];\n const yes = flag(parsed, \"yes\") === \"true\";\n assertImportAllowed(preview, {\n allowIncomplete: flag(parsed, \"allow-incomplete\") === \"true\",\n yes,\n interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),\n });\n if (yes) return;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await prompt.question(`Import ${resources.length} resource draft(s)? [y/N] `);\n prompt.close();\n if (!/^y(?:es)?$/i.test(answer.trim())) throw new Error(\"Import cancelled\");\n}\n\nasync function promptMappings(parsed: Parsed, client: Awaited<ReturnType<typeof createRemoteClient>>, preview: Record<string, unknown>, current: Record<string, string>): Promise<Record<string, string>> {\n if (!process.stdin.isTTY || !process.stdout.isTTY || flag(parsed, \"yes\") === \"true\") return current;\n const dependencies = Array.isArray(preview.dependencies) ? preview.dependencies.filter((item): item is Record<string, unknown> => Boolean(item && typeof item === \"object\" && item.status === \"unresolved\")) : [];\n const unique = new Map(dependencies.map((item) => [String(item.requirement_key || item.id), item]));\n if (!unique.size) return current;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const next = { ...current };\n for (const [key, dependency] of unique) {\n if (!shouldPromptForDependency(dependency)) {\n continue;\n }\n if (dependency.kind === \"secret\") {\n const answer = await prompt.question(`${dependency.source_name || key} secret ($secret:name, blank to omit): `);\n if (answer.trim()) next[key] = answer.trim();\n continue;\n }\n const response = await client.resourceBundles.candidates({\n kind: String(dependency.kind), query: String(dependency.source_name || \"\"),\n requiredCapability: dependency.required_capability === \"embedding\" ? \"embedding\" : dependency.required_capability === \"chat\" ? \"chat\" : undefined,\n });\n const candidates = Array.isArray(response.items) ? response.items as Array<Record<string, unknown>> : [];\n process.stdout.write(`${dependency.source_name || key}: ${candidates.map((item, index) => `${index + 1}) ${item.name}`).join(\" \")}\\n`);\n const answer = await prompt.question(\"Choose a candidate number (blank to omit): \");\n const selected = candidates[Number(answer) - 1];\n if (selected?.id) next[key] = String(selected.id);\n }\n return next;\n } finally {\n prompt.close();\n }\n}\n\nasync function compiledPackage(parsed: Parsed, client?: Awaited<ReturnType<typeof createRemoteClient>>): Promise<{ data: Uint8Array; result: Record<string, unknown> }> {\n const input = parsed.positionals[0];\n if (!input) throw new Error(`${parsed.command} requires a package directory or ZIP`);\n const local = await validatePackage(input);\n if (!local.valid) throw Object.assign(new Error(\"Resource package is invalid\"), { diagnostics: local.diagnostics });\n const data = await packPackage(input);\n const remoteClient = client || await createRemoteClient();\n const result = await remoteClient.resourcePackages.compilePackage(upload(data, input));\n return { data, result };\n}\n\nfunction canonical(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonical).join(\",\")}]`;\n if (value && typeof value === \"object\") return `{${Object.entries(value as Record<string, unknown>).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(\",\")}}`;\n return JSON.stringify(value);\n}\n\nfunction installKey(bundle: Record<string, unknown>, map: Record<string, string>): string {\n return `install-${createHash(\"sha256\").update(canonical({ bundle, mappings: map })).digest(\"hex\").slice(0, 40)}`;\n}\n\nfunction importedRows(imported: Record<string, unknown>): Array<Record<string, unknown>> {\n return Array.isArray(imported.resources) ? imported.resources.filter((item): item is Record<string, unknown> => Boolean(item && typeof item === \"object\")) : [];\n}\n\ntype InstallMode = \"client-deployment\" | \"bff\" | \"publish-only\";\ntype AppInfo = { directory: string; integration: Exclude<InstallMode, \"publish-only\">; packageManager: string };\n\nfunction interactive(parsed: Parsed): boolean {\n return flag(parsed, \"yes\") !== \"true\" && Boolean(process.stdin.isTTY && process.stdout.isTTY);\n}\n\nfunction cancelled<T>(value: T): asserts value is Exclude<T, symbol> {\n if (isCancel(value)) throw new Error(\"Installation cancelled\");\n}\n\nasync function apiKeyForInstall(parsed: Parsed): Promise<string> {\n let apiKey = String(process.env.AGENTS24_API_KEY || \"\").trim();\n if (!apiKey && interactive(parsed)) {\n const answer = await password({ message: \"Agents24 API key\", validate: (value) => String(value || \"\").trim() ? undefined : \"The API key is required.\" });\n cancelled(answer);\n apiKey = String(answer).trim();\n }\n if (!apiKey) throw new Error(\"AGENTS24_API_KEY is required for noninteractive installation\");\n if (/[\\r\\n\\0]/.test(apiKey)) throw new Error(\"AGENTS24_API_KEY contains invalid control characters\");\n return apiKey;\n}\n\nfunction clientAppBaseUrl(environment: NodeJS.ProcessEnv = process.env): string | undefined {\n const baseUrl = String(environment.AGENTS24_BASE_URL || \"\").trim().replace(/\\/+$/, \"\");\n if (!baseUrl || baseUrl === DEFAULT_API_BASE_URL) return undefined;\n let parsed: URL;\n try {\n parsed = new URL(baseUrl);\n } catch {\n throw new Error(\"AGENTS24_BASE_URL must be a valid absolute HTTP(S) URL.\");\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n throw new Error(\"AGENTS24_BASE_URL must be a valid absolute HTTP(S) URL.\");\n }\n return baseUrl;\n}\n\nasync function appInfoAt(directory: string, explicit: boolean): Promise<AppInfo | undefined> {\n const target = resolve(directory);\n try {\n const manifest = JSON.parse(await readFile(join(target, \"package.json\"), \"utf8\")) as Record<string, unknown>;\n const metadata = manifest.agents24 && typeof manifest.agents24 === \"object\" ? manifest.agents24 as Record<string, unknown> : {};\n const integration = String(metadata.integration || \"\");\n if (integration !== \"client-deployment\" && integration !== \"bff\") {\n if (explicit) throw new Error(\"--app must reference a generated Agents24 application\");\n return undefined;\n }\n return { directory: target, integration, packageManager: String(metadata.package_manager || \"pnpm\") };\n } catch (error) {\n if (explicit || (error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n return undefined;\n }\n}\n\nasync function resolveApp(parsed: Parsed): Promise<AppInfo | undefined> {\n const requested = flag(parsed, \"app\");\n return appInfoAt(requested || process.cwd(), Boolean(requested));\n}\n\nasync function resolveInstallMode(parsed: Parsed, app: AppInfo | undefined): Promise<InstallMode> {\n const requested = flag(parsed, \"integration\") as InstallMode | undefined;\n if (requested && ![\"client-deployment\", \"bff\", \"publish-only\"].includes(requested)) throw new Error(\"--integration must be client-deployment, bff, or publish-only\");\n if (requested && app && requested !== \"publish-only\" && requested !== app.integration) throw new Error(\"--integration does not match the generated application\");\n if (requested) return requested;\n if (app) return app.integration;\n if (!interactive(parsed)) throw new Error(\"--integration is required when no generated application is detected\");\n const answer = await select<InstallMode>({ message: \"How will this Agent be integrated?\", options: [\n { value: \"client-deployment\", label: \"Client deployment\", hint: \"Create a public deployment ID\" },\n { value: \"bff\", label: \"Server BFF\", hint: \"Use the API key only on the server\" },\n { value: \"publish-only\", label: \"Publish only\", hint: \"Configure an integration later\" },\n ] });\n cancelled(answer);\n return answer;\n}\n\nasync function selectInstalledAgent(parsed: Parsed, imported: Record<string, unknown>): Promise<Record<string, unknown>> {\n const agents = importedRows(imported).filter((row) => row.kind === \"agent\");\n if (!agents.length) throw new Error(\"The installed package does not contain an Agent\");\n const requested = flag(parsed, \"agent\");\n if (requested) {\n const match = agents.find((row) => [row.id, row.resource_key, row.name].map(String).includes(requested));\n if (!match) throw new Error(`--agent did not match an imported Agent: ${requested}`);\n return match;\n }\n if (agents.length === 1) return agents[0];\n if (!interactive(parsed)) throw new Error(\"--agent is required when the package contains multiple Agents\");\n const answer = await select<string>({ message: \"Which Agent should be published?\", options: agents.map((row) => ({ value: String(row.id), label: String(row.name) })) });\n cancelled(answer);\n return agents.find((row) => String(row.id) === answer)!;\n}\n\nasync function clientDeployment(parsed: Parsed, client: Awaited<ReturnType<typeof createRemoteClient>>, agent: Record<string, unknown>, app: AppInfo | undefined): Promise<Record<string, unknown>> {\n const policies = (await client.resourcePolicies.list()).filter((row) => row.is_active === true);\n let policyId = flag(parsed, \"policy-set\");\n if (policyId && !policies.some((row) => String(row.id) === policyId)) throw new Error(\"--policy-set must identify an active Resource Policy\");\n if (!policyId && policies.length === 1) policyId = String(policies[0].id);\n if (!policyId && interactive(parsed) && policies.length > 1) {\n const answer = await select<string>({ message: \"Resource Policy\", options: policies.map((row) => ({ value: String(row.id), label: String(row.name) })) });\n cancelled(answer);\n policyId = answer;\n }\n if (!policyId) throw new Error(\"An active Resource Policy is required; pass --policy-set when more than one is active\");\n let origins = values(parsed, \"origin\");\n if (!origins.length && app) origins = [...DEFAULT_LOCAL_CLIENT_ORIGINS];\n if (!origins.length && interactive(parsed)) {\n const answer = await text({ message: \"Allowed browser origins\", placeholder: \"http://localhost:5173\", validate: (value) => String(value || \"\").trim() ? undefined : \"At least one origin is required.\" });\n cancelled(answer);\n origins = String(answer).split(\",\").map((item) => item.trim()).filter(Boolean);\n }\n if (!origins.length) throw new Error(\"At least one --origin is required when no generated app is detected\");\n const authModes = values(parsed, \"auth-mode\").length ? values(parsed, \"auth-mode\") : [\"anonymous\"];\n const oidcRaw = flag(parsed, \"oidc-config\");\n if (authModes.includes(\"external_oidc\") && !oidcRaw) throw new Error(\"--oidc-config is required for external_oidc\");\n const request = {\n agent_id: String(agent.id), resource_policy_set_id: policyId,\n version_policy: { mode: \"latest_published\" }, name: `${String(agent.name)} client deployment`,\n auth_modes: authModes, allowed_origins: origins,\n ...(oidcRaw ? { oidc: JSON.parse(oidcRaw) as Record<string, unknown> } : {}),\n };\n return client.clientDeployments.create(request, { idempotencyKey: `deploy-${createHash(\"sha256\").update(canonical(request)).digest(\"hex\").slice(0, 40)}` });\n}\n\nasync function updateEnvFile(app: AppInfo, values: Record<string, string>): Promise<string> {\n const target = join(app.directory, \".env.local\");\n let content = \"\";\n try { content = await readFile(target, \"utf8\"); } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n let next = content;\n for (const [name, value] of Object.entries(values)) {\n const line = `${name}=${JSON.stringify(value)}`;\n const pattern = new RegExp(`^${name}=.*$`, \"m\");\n next = pattern.test(next) ? next.replace(pattern, line) : `${next}${next && !next.endsWith(\"\\n\") ? \"\\n\" : \"\"}${line}\\n`;\n }\n await writeFile(target, next, { mode: 0o600 });\n await chmod(target, 0o600);\n return target;\n}\n\nasync function execute(parsed: Parsed): Promise<Record<string, unknown>> {\n if (parsed.command === \"init\") {\n const directory = resolve(parsed.positionals[0] || \".\");\n const name = flag(parsed, \"name\") || basename(directory);\n const packageName = await initializePackage(directory, name);\n return { ok: true, directory, package: packageName };\n }\n if (parsed.command === \"validate\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"validate requires a package directory or ZIP\");\n const local = await validatePackage(input);\n let remote: Record<string, unknown> | undefined;\n if (flag(parsed, \"remote\") === \"true\" && local.valid) {\n const data = await packPackage(input);\n remote = await (await createRemoteClient()).resourcePackages.validatePackage(upload(data, input));\n }\n return { ok: local.valid && (!remote || remote.valid === true), local: { ...local, files: undefined }, ...(remote ? { remote } : {}) };\n }\n if (parsed.command === \"pack\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"pack requires a package directory\");\n const data = await packPackage(input);\n const output = resolve(flag(parsed, \"output\") || `${basename(resolve(input))}.agents24.zip`);\n await writeFile(output, data);\n return { ok: true, output, bytes: data.byteLength };\n }\n if (parsed.command === \"export\") {\n const kind = flag(parsed, \"kind\");\n const id = flag(parsed, \"id\");\n if (!kind || !id) throw new Error(\"export requires --kind and --id\");\n const target = flag(parsed, \"target\") || \"draft\";\n const selectors = [{ kind, id, target, ...(flag(parsed, \"version-id\") ? { version_id: flag(parsed, \"version-id\") } : {}) }];\n for (const value of values(parsed, \"selector\")) {\n const [itemKind, itemId, itemTarget = \"draft\", versionId] = value.split(\":\");\n if (!itemKind || !itemId) throw new Error(\"--selector must be kind:id[:draft|version[:version-id]]\");\n selectors.push({ kind: itemKind, id: itemId, target: itemTarget, ...(versionId ? { version_id: versionId } : {}) });\n }\n const request = { selectors };\n const archive = await (await createRemoteClient()).resourcePackages.exportPackage(request);\n const output = resolve(flag(parsed, \"output\") || archive.filename);\n await writeFile(output, archive.data);\n return { ok: true, output, bytes: archive.data.byteLength };\n }\n if (parsed.command === \"compile\") {\n const { result } = await compiledPackage(parsed);\n const output = flag(parsed, \"output\");\n if (output) await writeFile(resolve(output), `${JSON.stringify(result.bundle, null, 2)}\\n`);\n return { ok: result.valid === true, ...(output ? { output: resolve(output) } : {}), result: safeResult(result) };\n }\n if (parsed.command === \"preview\" || parsed.command === \"import\" || parsed.command === \"install\") {\n const app = parsed.command === \"install\" ? await resolveApp(parsed) : undefined;\n const integration = parsed.command === \"install\" ? await resolveInstallMode(parsed, app) : undefined;\n const apiKey = parsed.command === \"install\" ? await apiKeyForInstall(parsed) : undefined;\n const client = apiKey\n ? await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey })\n : await createRemoteClient();\n const { result } = await compiledPackage(parsed, client);\n if (result.valid !== true || !result.bundle || typeof result.bundle !== \"object\") throw new Error(\"Remote compilation did not produce a bundle\");\n const request = {\n bundle: result.bundle as Record<string, unknown>,\n mappings: mappings(parsed),\n };\n let preview = await client.resourceBundles.importPreview(request);\n request.mappings = await promptMappings(parsed, client, preview, request.mappings);\n if (Object.keys(request.mappings).length) preview = await client.resourceBundles.importPreview(request);\n if (parsed.command === \"preview\") return { ok: preview.can_import === true, preview };\n if (parsed.command === \"install\") assertInstallPreviewReady(preview);\n if (preview.can_import !== true) return { ok: false, preview };\n await confirmation(parsed, preview);\n const imported = await client.resourceBundles.importBundle(request, { idempotencyKey: installKey(request.bundle, request.mappings) });\n if (parsed.command === \"import\") return { ok: true, phase: \"imported\", preview, result: imported };\n const agent = await selectInstalledAgent(parsed, imported);\n if (importedRows(imported).some((row) => row.status === \"incomplete\") && flag(parsed, \"allow-incomplete\") !== \"true\") {\n throw Object.assign(new Error(\"Publication is blocked by incomplete imported dependencies\"), { phase: \"post_import\", imported });\n }\n try {\n await client.agents.publish(String(agent.id), {\n idempotencyKey: `publish-${createHash(\"sha256\").update(`agent:${String(agent.id)}`).digest(\"hex\").slice(0, 40)}`,\n });\n } catch (error) {\n throw Object.assign(error instanceof Error ? error : new Error(\"Agent publication failed\"), {\n phase: \"publish\",\n imported,\n });\n }\n let deployment: Record<string, unknown> | undefined;\n try {\n if (integration === \"client-deployment\") deployment = await clientDeployment(parsed, client, agent, app);\n } catch (error) {\n throw Object.assign(error instanceof Error ? error : new Error(\"Client deployment setup failed\"), {\n phase: \"deployment\",\n imported,\n });\n }\n const deploymentId = deployment && typeof deployment.client_id === \"string\" ? deployment.client_id : undefined;\n let envFile: string | undefined;\n if (app && flag(parsed, \"no-write-env\") !== \"true\" && integration !== \"publish-only\") {\n try {\n const localClientBaseUrl = integration === \"client-deployment\" ? clientAppBaseUrl() : undefined;\n envFile = await updateEnvFile(app, integration === \"client-deployment\"\n ? {\n VITE_AGENTS24_DEPLOYMENT_ID: String(deploymentId),\n ...(localClientBaseUrl ? { VITE_AGENTS24_BASE_URL: localClientBaseUrl } : {}),\n }\n : { AGENTS24_API_KEY: apiKey!, AGENTS24_AGENT_ID: String(agent.id) });\n } catch (error) {\n throw Object.assign(error instanceof Error ? error : new Error(\"Could not configure the generated app\"), {\n phase: \"env_write\",\n imported,\n });\n }\n }\n const packageManager = app?.packageManager || \"pnpm\";\n const nextCommand = app && integration !== \"publish-only\"\n ? packageManager === \"npm\" ? \"npm run dev\" : packageManager === \"bun\" ? \"bun run dev\" : `${packageManager} dev`\n : undefined;\n return {\n ok: true,\n phase: deployment ? \"deployed\" : \"published\",\n integration,\n agent_id: String(agent.id),\n ...(deployment ? { deployment, deployment_id: deploymentId } : {}),\n env_written: Boolean(envFile),\n ...(envFile ? { env_file: envFile } : {}),\n ...(nextCommand ? { next_command: nextCommand } : {}),\n preview,\n result: imported,\n };\n }\n throw new Error(`Unknown package command: ${parsed.command}`);\n}\n\nfunction diagnostics(error: unknown): Diagnostic[] | undefined {\n if (!error || typeof error !== \"object\") return undefined;\n const record = error as { diagnostics?: unknown; details?: unknown };\n if (Array.isArray(record.diagnostics)) return record.diagnostics as Diagnostic[];\n if (!record.details || typeof record.details !== \"object\" || Array.isArray(record.details)) return undefined;\n const detail = (record.details as Record<string, unknown>).detail;\n if (!detail || typeof detail !== \"object\" || Array.isArray(detail)) return undefined;\n const value = (detail as Record<string, unknown>).diagnostics;\n return Array.isArray(value) ? value as Diagnostic[] : undefined;\n}\n\nfunction errorMessage(error: unknown, parsed: Parsed | undefined): string {\n if (parsed?.command === \"install\" && error && typeof error === \"object\" && \"status\" in error && error.status === 403) {\n return \"This API key cannot install Agents. Create a new Agent integration API key in Settings; existing keys cannot gain additional scopes.\";\n }\n return error instanceof Error ? error.message : \"Unexpected CLI failure\";\n}\n\nfunction installSummary(result: Record<string, unknown>): string {\n const lines = [\"Agent installed and published.\", `Agent ID: ${String(result.agent_id)}`];\n if (result.deployment_id) lines.push(`Deployment ID: ${String(result.deployment_id)}`);\n if (result.env_written) lines.push(`Configured: ${String(result.env_file)}`);\n else if (result.integration !== \"publish-only\") lines.push(\"Environment configuration was not written.\");\n if (result.next_command) lines.push(`Next: ${String(result.next_command)}`);\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport async function run(argv = process.argv.slice(2)): Promise<number> {\n let parsed: Parsed | undefined;\n try {\n parsed = parse(argv);\n const result = await execute(parsed);\n if (flag(parsed, \"json\") === \"true\") process.stdout.write(`${JSON.stringify(result)}\\n`);\n else if (result.ok === false) process.stderr.write(`${JSON.stringify(result, null, 2)}\\n`);\n else if (parsed.command === \"install\") process.stdout.write(installSummary(result));\n else process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return result.ok === false ? 1 : 0;\n } catch (error) {\n const payload = {\n ok: false,\n error: errorMessage(error, parsed),\n ...(error && typeof error === \"object\" && \"phase\" in error ? { phase: (error as { phase: unknown }).phase } : {}),\n ...(error && typeof error === \"object\" && \"imported\" in error ? { import_result: (error as { imported: unknown }).imported } : {}),\n ...(diagnostics(error) ? { diagnostics: diagnostics(error) } : {}),\n };\n const body = parsed && flag(parsed, \"json\") === \"true\" ? JSON.stringify(payload) : JSON.stringify(payload, null, 2);\n process.stderr.write(`${body}\\n`);\n return 1;\n }\n}\n\nprocess.exitCode = await run();\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,UAAU,MAAM,eAAe;AACxC,SAAS,OAAO,UAAU,iBAAiB;AAC3C,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,UAAU,UAAU,QAAQ,YAAY;AAYjD,IAAM,gBAAgB,oBAAI,IAAI,CAAC,QAAQ,UAAU,OAAO,oBAAo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"node:path\";\nimport { chmod, mkdir, readFile, stat, writeFile } from \"node:fs/promises\";\nimport { createInterface } from \"node:readline/promises\";\nimport { createHash, createHmac, randomBytes } from \"node:crypto\";\nimport { spawn, type ChildProcess } from \"node:child_process\";\nimport { hostname } from \"node:os\";\nimport { parse as parseYaml } from \"yaml\";\nimport { isCancel, password, select, text } from \"@clack/prompts\";\n\nimport { initializePackage, loadPackageFiles, packPackage, validatePackage, type Diagnostic } from \"./package-source.js\";\nimport { createRemoteClient } from \"./remote.js\";\nimport { assertImportAllowed, parseMappings, shouldPromptForDependency } from \"./import-guards.js\";\n\ntype Parsed = {\n command: string;\n positionals: string[];\n flags: Map<string, string[]>;\n};\n\nconst BOOLEAN_FLAGS = new Set([\"json\", \"remote\", \"yes\", \"allow-incomplete\", \"no-write-env\", \"prune\"]);\nconst LIFECYCLE_COMMANDS = new Set([\"prepare\", \"plan\", \"apply\", \"dev\", \"publish\", \"setup\", \"status\", \"link\", \"resources\"]);\nconst DEFAULT_API_BASE_URL = \"https://api.agents24.dev\";\nconst DEFAULT_LOCAL_CLIENT_ORIGINS = [\"http://localhost:5173\", \"http://127.0.0.1:5173\"];\n\nfunction parse(argv: string[]): Parsed {\n const lifecycle = LIFECYCLE_COMMANDS.has(argv[0]);\n if (!lifecycle && (argv[0] !== \"package\" || !argv[1])) throw new Error(\"Usage: agents24 <prepare|plan|apply|dev|publish|setup|status|link|resources> | agents24 package <init|validate|pack|export|compile|preview|import>\");\n const flags = new Map<string, string[]>();\n const positionals: string[] = [];\n for (let index = lifecycle ? 1 : 2; index < argv.length; index += 1) {\n const current = argv[index];\n if (!current.startsWith(\"--\")) { positionals.push(current); continue; }\n const [rawName, inline] = current.slice(2).split(\"=\", 2);\n if (!rawName) throw new Error(\"Invalid option\");\n if (rawName === \"api-key\") {\n throw new Error(\"--api-key is not supported; use AGENTS24_API_KEY or the masked prompt\");\n }\n const value = inline ?? (BOOLEAN_FLAGS.has(rawName) ? \"true\" : argv[++index]);\n if (value === undefined || value.startsWith(\"--\")) throw new Error(`--${rawName} requires a value`);\n flags.set(rawName, [...(flags.get(rawName) || []), value]);\n }\n return { command: lifecycle ? argv[0] : argv[1], positionals, flags };\n}\n\nfunction flag(parsed: Parsed, name: string): string | undefined {\n return parsed.flags.get(name)?.at(-1);\n}\n\nfunction values(parsed: Parsed, name: string): string[] {\n return parsed.flags.get(name) || [];\n}\n\nfunction mappings(parsed: Parsed): Record<string, string> {\n return parseMappings(values(parsed, \"map\"));\n}\n\nfunction upload(data: Uint8Array, input: string): { data: Uint8Array; filename: string } {\n return { data, filename: basename(input).endsWith(\".zip\") ? basename(input) : \"resource.agents24.zip\" };\n}\n\nasync function packageDirectory(input: string): Promise<string | undefined> {\n try { return (await stat(input)).isDirectory() ? resolve(input) : undefined; }\n catch { return undefined; }\n}\n\nasync function installationId(input: string): Promise<string | undefined> {\n const explicit = String(process.env.AGENTS24_INSTALLATION_ID || \"\").trim();\n if (explicit) return explicit;\n const directory = await packageDirectory(input);\n if (!directory) return undefined;\n try { return (await readFile(join(directory, \".agents24/installation-id\"), \"utf8\")).trim() || undefined; }\n catch (error) { if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return undefined; throw error; }\n}\n\nasync function writeInstallationId(input: string, id: string): Promise<string | undefined> {\n if (String(process.env.AGENTS24_INSTALLATION_ID || \"\").trim()) return undefined;\n const directory = await packageDirectory(input);\n if (!directory) return undefined;\n const stateDirectory = join(directory, \".agents24\");\n await mkdir(stateDirectory, { recursive: true, mode: 0o700 });\n const target = join(stateDirectory, \"installation-id\");\n await writeFile(target, `${id}\\n`, { mode: 0o600 });\n await chmod(target, 0o600);\n await ensureIgnored(directory, [\".agents24/\", \".env.local\"]);\n return target;\n}\n\nasync function ensureIgnored(directory: string, entries: string[]): Promise<void> {\n const target = join(directory, \".gitignore\");\n let current = \"\";\n try { current = await readFile(target, \"utf8\"); }\n catch (error) { if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error; }\n const lines = new Set(current.split(/\\r?\\n/).map((item) => item.trim()).filter(Boolean));\n const missing = entries.filter((item) => !lines.has(item));\n if (!missing.length) return;\n const separator = current && !current.endsWith(\"\\n\") ? \"\\n\" : \"\";\n await writeFile(target, `${current}${separator}${missing.join(\"\\n\")}\\n`);\n}\n\nfunction parseEnv(textValue: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (const line of textValue.split(/\\r?\\n/)) {\n const match = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line.trim());\n if (!match) continue;\n const raw = match[2].trim();\n try { result[match[1]] = raw.startsWith('\"') ? JSON.parse(raw) : raw; }\n catch { result[match[1]] = raw; }\n }\n return result;\n}\n\nasync function packageSecretRequirements(input: string): Promise<Array<{ key: string; env: string; generate: boolean }>> {\n const files = await loadPackageFiles(input);\n const manifest = parseYaml(files.get(\"agents24.yaml\") || \"\") as Record<string, unknown>;\n const requires = manifest.requires && typeof manifest.requires === \"object\" ? manifest.requires as Record<string, unknown> : {};\n const secrets = requires.secrets && typeof requires.secrets === \"object\" ? requires.secrets as Record<string, unknown> : {};\n return Object.entries(secrets).map(([key, raw]) => {\n const item = raw && typeof raw === \"object\" ? raw as Record<string, unknown> : {};\n const env = String(item.env || \"\").trim();\n if (!env) throw new Error(`Secret requirement ${key} must declare env`);\n return { key: `$secrets.${key}`, env, generate: item.generate === true };\n });\n}\n\nasync function preparePackage(input: string): Promise<Record<string, unknown>> {\n const directory = await packageDirectory(input);\n if (!directory) throw new Error(\"prepare requires a Resource Package directory\");\n const local = await validatePackage(input);\n if (!local.valid) throw Object.assign(new Error(\"Resource package is invalid\"), { diagnostics: local.diagnostics });\n const target = join(directory, \".env.local\");\n let current = \"\";\n try { current = await readFile(target, \"utf8\"); }\n catch (error) { if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error; }\n const values = parseEnv(current);\n const generated: string[] = [];\n const preserved: string[] = [];\n let next = current;\n for (const requirement of await packageSecretRequirements(input)) {\n if (values[requirement.env] || process.env[requirement.env]) { preserved.push(requirement.env); continue; }\n if (!requirement.generate) continue;\n const value = randomBytes(32).toString(\"base64url\");\n next += `${next && !next.endsWith(\"\\n\") ? \"\\n\" : \"\"}${requirement.env}=${JSON.stringify(value)}\\n`;\n generated.push(requirement.env);\n }\n await writeFile(target, next, { mode: 0o600 });\n await chmod(target, 0o600);\n await ensureIgnored(directory, [\".env.local\", \".agents24/\"]);\n return { ok: true, package: directory, env_file: target, generated, preserved };\n}\n\nasync function secretValues(input: string): Promise<Record<string, string>> {\n const directory = await packageDirectory(input);\n let local: Record<string, string> = {};\n if (directory) {\n try { local = parseEnv(await readFile(join(directory, \".env.local\"), \"utf8\")); }\n catch (error) { if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error; }\n }\n const result: Record<string, string> = {};\n for (const requirement of await packageSecretRequirements(input)) {\n const value = String(process.env[requirement.env] || local[requirement.env] || \"\");\n if (value) result[requirement.key] = value;\n }\n return result;\n}\n\nfunction safeResult(result: Record<string, unknown>): Record<string, unknown> {\n return result;\n}\n\nasync function confirmation(parsed: Parsed, preview: Record<string, unknown>): Promise<void> {\n const resources = Array.isArray(preview.resources) ? preview.resources as Array<Record<string, unknown>> : [];\n const yes = flag(parsed, \"yes\") === \"true\";\n assertImportAllowed(preview, {\n allowIncomplete: flag(parsed, \"allow-incomplete\") === \"true\",\n yes,\n interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),\n });\n if (yes) return;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await prompt.question(`Import ${resources.length} resource draft(s)? [y/N] `);\n prompt.close();\n if (!/^y(?:es)?$/i.test(answer.trim())) throw new Error(\"Import cancelled\");\n}\n\nasync function applyConfirmation(parsed: Parsed, plan: Record<string, unknown>): Promise<void> {\n if (flag(parsed, \"yes\") === \"true\") return;\n if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error(\"apply requires --yes in noninteractive mode\");\n const actions = Array.isArray(plan.actions) ? plan.actions.length : 0;\n const removals = Array.isArray(plan.content) ? (plan.content as Array<Record<string, unknown>>).reduce((count, item) => count + (Array.isArray(item.remove) ? item.remove.length : 0), 0) : 0;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await prompt.question(`Apply ${actions} resource action(s)${removals ? ` and ${removals} content removal(s)` : \"\"}? [y/N] `);\n prompt.close();\n if (!/^y(?:es)?$/i.test(answer.trim())) throw new Error(\"Apply cancelled\");\n}\n\nasync function pollOperation(client: Awaited<ReturnType<typeof createRemoteClient>>, operation: Record<string, unknown>): Promise<Record<string, unknown>> {\n let current = operation;\n for (let attempt = 0; attempt < 900; attempt += 1) {\n const status = String(current.status || \"\");\n if ([\"completed\", \"failed\"].includes(status)) return current;\n await new Promise((resolvePromise) => setTimeout(resolvePromise, 1000));\n current = await client.resourceInstallations.operationStatus(String(current.operation_id));\n }\n throw new Error(\"Resource apply did not finish within 15 minutes\");\n}\n\nasync function promptMappings(parsed: Parsed, client: Awaited<ReturnType<typeof createRemoteClient>>, preview: Record<string, unknown>, current: Record<string, string>): Promise<Record<string, string>> {\n if (!process.stdin.isTTY || !process.stdout.isTTY || flag(parsed, \"yes\") === \"true\") return current;\n const dependencies = Array.isArray(preview.dependencies) ? preview.dependencies.filter((item): item is Record<string, unknown> => Boolean(item && typeof item === \"object\" && item.status === \"unresolved\")) : [];\n const unique = new Map(dependencies.map((item) => [String(item.requirement_key || item.id), item]));\n if (!unique.size) return current;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const next = { ...current };\n for (const [key, dependency] of unique) {\n if (!shouldPromptForDependency(dependency)) {\n continue;\n }\n if (dependency.kind === \"secret\") {\n const answer = await prompt.question(`${dependency.source_name || key} secret ($secret:name, blank to omit): `);\n if (answer.trim()) next[key] = answer.trim();\n continue;\n }\n const response = await client.resourceBundles.candidates({\n kind: String(dependency.kind), query: String(dependency.source_name || \"\"),\n requiredCapability: dependency.required_capability === \"embedding\" ? \"embedding\" : dependency.required_capability === \"chat\" ? \"chat\" : undefined,\n });\n const candidates = Array.isArray(response.items) ? response.items as Array<Record<string, unknown>> : [];\n process.stdout.write(`${dependency.source_name || key}: ${candidates.map((item, index) => `${index + 1}) ${item.name}`).join(\" \")}\\n`);\n const answer = await prompt.question(\"Choose a candidate number (blank to omit): \");\n const selected = candidates[Number(answer) - 1];\n if (selected?.id) next[key] = String(selected.id);\n }\n return next;\n } finally {\n prompt.close();\n }\n}\n\nasync function compiledPackage(parsed: Parsed, client?: Awaited<ReturnType<typeof createRemoteClient>>): Promise<{ data: Uint8Array; result: Record<string, unknown> }> {\n const input = parsed.positionals[0];\n if (!input) throw new Error(`${parsed.command} requires a package directory or ZIP`);\n const local = await validatePackage(input);\n if (!local.valid) throw Object.assign(new Error(\"Resource package is invalid\"), { diagnostics: local.diagnostics });\n const data = await packPackage(input);\n const remoteClient = client || await createRemoteClient();\n const result = await remoteClient.resourcePackages.compilePackage(upload(data, input));\n return { data, result };\n}\n\nfunction canonical(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonical).join(\",\")}]`;\n if (value && typeof value === \"object\") return `{${Object.entries(value as Record<string, unknown>).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(\",\")}}`;\n return JSON.stringify(value);\n}\n\nfunction importKey(bundle: Record<string, unknown>, map: Record<string, string>): string {\n return `import-${createHash(\"sha256\").update(canonical({ bundle, mappings: map })).digest(\"hex\").slice(0, 40)}`;\n}\n\ntype InstallMode = \"client-deployment\" | \"bff\" | \"publish-only\";\ntype AppInfo = { directory: string; integration: Exclude<InstallMode, \"publish-only\">; packageManager: string };\n\nfunction interactive(parsed: Parsed): boolean {\n return flag(parsed, \"yes\") !== \"true\" && Boolean(process.stdin.isTTY && process.stdout.isTTY);\n}\n\nfunction cancelled<T>(value: T): asserts value is Exclude<T, symbol> {\n if (isCancel(value)) throw new Error(\"Installation cancelled\");\n}\n\nasync function apiKeyForLifecycle(parsed: Parsed): Promise<string> {\n let apiKey = String(process.env.AGENTS24_API_KEY || \"\").trim();\n if (!apiKey && interactive(parsed)) {\n const answer = await password({ message: \"Agents24 API key\", validate: (value) => String(value || \"\").trim() ? undefined : \"The API key is required.\" });\n cancelled(answer);\n apiKey = String(answer).trim();\n }\n if (!apiKey) throw new Error(\"AGENTS24_API_KEY is required for noninteractive resource management\");\n if (/[\\r\\n\\0]/.test(apiKey)) throw new Error(\"AGENTS24_API_KEY contains invalid control characters\");\n return apiKey;\n}\n\nfunction clientAppBaseUrl(environment: NodeJS.ProcessEnv = process.env): string | undefined {\n const baseUrl = String(environment.AGENTS24_BASE_URL || \"\").trim().replace(/\\/+$/, \"\");\n if (!baseUrl || baseUrl === DEFAULT_API_BASE_URL) return undefined;\n let parsed: URL;\n try {\n parsed = new URL(baseUrl);\n } catch {\n throw new Error(\"AGENTS24_BASE_URL must be a valid absolute HTTP(S) URL.\");\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n throw new Error(\"AGENTS24_BASE_URL must be a valid absolute HTTP(S) URL.\");\n }\n return baseUrl;\n}\n\nasync function appInfoAt(directory: string, explicit: boolean): Promise<AppInfo | undefined> {\n const target = resolve(directory);\n try {\n const manifest = JSON.parse(await readFile(join(target, \"package.json\"), \"utf8\")) as Record<string, unknown>;\n const metadata = manifest.agents24 && typeof manifest.agents24 === \"object\" ? manifest.agents24 as Record<string, unknown> : {};\n const integration = String(metadata.integration || \"\");\n if (integration !== \"client-deployment\" && integration !== \"bff\") {\n if (explicit) throw new Error(\"--app must reference a generated Agents24 application\");\n return undefined;\n }\n return { directory: target, integration, packageManager: String(metadata.package_manager || \"pnpm\") };\n } catch (error) {\n if (explicit || (error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n return undefined;\n }\n}\n\nasync function resolveApp(parsed: Parsed): Promise<AppInfo | undefined> {\n const requested = flag(parsed, \"app\");\n return appInfoAt(requested || process.cwd(), Boolean(requested));\n}\n\nasync function resolveInstallMode(parsed: Parsed, app: AppInfo | undefined): Promise<InstallMode> {\n const requested = flag(parsed, \"integration\") as InstallMode | undefined;\n if (requested && ![\"client-deployment\", \"bff\", \"publish-only\"].includes(requested)) throw new Error(\"--integration must be client-deployment, bff, or publish-only\");\n if (requested && app && requested !== \"publish-only\" && requested !== app.integration) throw new Error(\"--integration does not match the generated application\");\n if (requested) return requested;\n if (app) return app.integration;\n if (!interactive(parsed)) throw new Error(\"--integration is required when no generated application is detected\");\n const answer = await select<InstallMode>({ message: \"How will this Agent be integrated?\", options: [\n { value: \"client-deployment\", label: \"Client deployment\", hint: \"Create a public deployment ID\" },\n { value: \"bff\", label: \"Server BFF\", hint: \"Use the API key only on the server\" },\n { value: \"publish-only\", label: \"Publish only\", hint: \"Configure an integration later\" },\n ] });\n cancelled(answer);\n return answer;\n}\n\nasync function clientDeployment(parsed: Parsed, client: Awaited<ReturnType<typeof createRemoteClient>>, agent: Record<string, unknown>, app: AppInfo | undefined): Promise<Record<string, unknown>> {\n const policies = (await client.resourcePolicies.list()).filter((row) => row.is_active === true);\n let policyId = flag(parsed, \"policy-set\");\n if (policyId && !policies.some((row) => String(row.id) === policyId)) throw new Error(\"--policy-set must identify an active Resource Policy\");\n if (!policyId && policies.length === 1) policyId = String(policies[0].id);\n if (!policyId && interactive(parsed) && policies.length > 1) {\n const answer = await select<string>({ message: \"Resource Policy\", options: policies.map((row) => ({ value: String(row.id), label: String(row.name) })) });\n cancelled(answer);\n policyId = answer;\n }\n if (!policyId) throw new Error(\"An active Resource Policy is required; pass --policy-set when more than one is active\");\n let origins = values(parsed, \"origin\");\n if (!origins.length && app) origins = [...DEFAULT_LOCAL_CLIENT_ORIGINS];\n if (!origins.length && interactive(parsed)) {\n const answer = await text({ message: \"Allowed browser origins\", placeholder: \"http://localhost:5173\", validate: (value) => String(value || \"\").trim() ? undefined : \"At least one origin is required.\" });\n cancelled(answer);\n origins = String(answer).split(\",\").map((item) => item.trim()).filter(Boolean);\n }\n if (!origins.length) throw new Error(\"At least one --origin is required when no generated app is detected\");\n const authModes = values(parsed, \"auth-mode\").length ? values(parsed, \"auth-mode\") : [\"anonymous\"];\n const oidcRaw = flag(parsed, \"oidc-config\");\n if (authModes.includes(\"external_oidc\") && !oidcRaw) throw new Error(\"--oidc-config is required for external_oidc\");\n const request = {\n agent_id: String(agent.id), resource_policy_set_id: policyId,\n version_policy: { mode: \"latest_published\" }, name: `${String(agent.name)} client deployment`,\n auth_modes: authModes, allowed_origins: origins,\n ...(oidcRaw ? { oidc: JSON.parse(oidcRaw) as Record<string, unknown> } : {}),\n };\n return client.clientDeployments.create(request, { idempotencyKey: `deploy-${createHash(\"sha256\").update(canonical(request)).digest(\"hex\").slice(0, 40)}` });\n}\n\nasync function updateEnvFile(app: AppInfo, values: Record<string, string>): Promise<string> {\n const target = join(app.directory, \".env.local\");\n let content = \"\";\n try { content = await readFile(target, \"utf8\"); } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n let next = content;\n for (const [name, value] of Object.entries(values)) {\n const line = `${name}=${JSON.stringify(value)}`;\n const pattern = new RegExp(`^${name}=.*$`, \"m\");\n next = pattern.test(next) ? next.replace(pattern, line) : `${next}${next && !next.endsWith(\"\\n\") ? \"\\n\" : \"\"}${line}\\n`;\n }\n await writeFile(target, next, { mode: 0o600 });\n await chmod(target, 0o600);\n return target;\n}\n\ntype AppliedDraft = {\n client: Awaited<ReturnType<typeof createRemoteClient>>;\n apiKey: string;\n input: string;\n installationId: string;\n plan: Record<string, unknown>;\n operation: Record<string, unknown>;\n result: Record<string, unknown>;\n agent: Record<string, unknown>;\n};\n\nasync function ensureInstallation(\n input: string,\n client: Awaited<ReturnType<typeof createRemoteClient>>,\n data: Uint8Array,\n): Promise<string> {\n const current = await installationId(input);\n if (current) return current;\n const initial = await client.resourceInstallations.plan(upload(data, input));\n const created = await client.resourceInstallations.create(\n { package_name: String(initial.package_name), operation_id: String(initial.operation_id) },\n { idempotencyKey: `installation-${String(initial.package_hash).slice(0, 40)}` },\n );\n const id = String(created.id);\n await writeInstallationId(input, id);\n return id;\n}\n\nasync function applyDraft(\n parsed: Parsed,\n options: { developmentSessions?: Record<string, string>; development?: boolean; skipConfirmation?: boolean; integrationMode?: InstallMode } = {},\n): Promise<AppliedDraft> {\n const input = parsed.positionals[0];\n if (!input) throw new Error(`${parsed.command} requires a Resource Package directory or ZIP`);\n const apiKey = await apiKeyForLifecycle(parsed);\n const client = await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey });\n const data = await packPackage(input);\n const currentId = await installationId(input);\n const plan = await client.resourceInstallations.plan({\n ...upload(data, input),\n ...(currentId ? { installationId: currentId } : {}),\n prune: flag(parsed, \"prune\") === \"true\",\n development: options.development === true,\n });\n if (plan.can_apply !== true) throw Object.assign(new Error(\"The Resource Package plan is blocked\"), { plan });\n if (!options.skipConfirmation) await applyConfirmation(parsed, plan);\n const secrets = await secretValues(input);\n let operation = await client.resourceInstallations.apply(String(plan.operation_id), {\n primary_resource_key: flag(parsed, \"agent\"),\n integration_mode: options.integrationMode || flag(parsed, \"integration\") || \"publish-only\",\n secrets,\n ...(options.developmentSessions ? { development_sessions: options.developmentSessions } : {}),\n }, { idempotencyKey: `apply-${String(plan.package_hash).slice(0, 40)}` });\n operation = await pollOperation(client, operation);\n if (operation.status !== \"completed\") throw Object.assign(new Error(\"Draft apply failed\"), { operation });\n const installationIdValue = String(operation.installation_id || \"\");\n if (!installationIdValue) throw new Error(\"Apply completed without an installation ID\");\n await writeInstallationId(input, installationIdValue);\n const result = operation.result && typeof operation.result === \"object\" ? operation.result as Record<string, unknown> : {};\n const agentId = String(result.primary_agent_id || \"\");\n const resources = Array.isArray(result.resources) ? result.resources as Array<Record<string, unknown>> : [];\n const agent = resources.find((item) => String(item.id) === agentId) || { id: agentId, name: \"Agent\" };\n return { client, apiKey, input, installationId: installationIdValue, plan, operation, result, agent };\n}\n\nasync function publishDraft(parsed: Parsed, applied?: AppliedDraft): Promise<Record<string, unknown>> {\n const input = applied?.input || parsed.positionals[0];\n if (!input) throw new Error(\"publish requires a Resource Package directory or ZIP\");\n const apiKey = applied?.apiKey || await apiKeyForLifecycle(parsed);\n const client = applied?.client || await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey });\n const id = applied?.installationId || await installationId(input);\n if (!id) throw new Error(\"No installation is linked; run agents24 apply first\");\n const data = await packPackage(input);\n const plan = applied?.plan || await client.resourceInstallations.plan({ ...upload(data, input), installationId: id });\n const publication = await client.resourceInstallations.publish(id, { package_hash: String(plan.package_hash) }, {\n idempotencyKey: `publish-${String(plan.package_hash).slice(0, 40)}`,\n });\n return { publication, client, apiKey, input, installation_id: id, plan };\n}\n\ntype DevelopmentArtifact = {\n key: string;\n baseUrl: string;\n command?: string;\n args: string[];\n cwd: string;\n protocol: Record<string, unknown>;\n signingSecretEnv?: string;\n};\n\nasync function developmentArtifacts(input: string): Promise<DevelopmentArtifact[]> {\n const directory = await packageDirectory(input);\n if (!directory) throw new Error(\"dev requires a Resource Package directory\");\n const files = await loadPackageFiles(input);\n const manifest = parseYaml(files.get(\"agents24.yaml\") || \"\") as Record<string, unknown>;\n const resources = Array.isArray(manifest.resources) ? manifest.resources as Array<Record<string, unknown>> : [];\n const requires = manifest.requires && typeof manifest.requires === \"object\" ? manifest.requires as Record<string, unknown> : {};\n const requiredSecrets = requires.secrets && typeof requires.secrets === \"object\" ? requires.secrets as Record<string, unknown> : {};\n const result: DevelopmentArtifact[] = [];\n for (const resource of resources) {\n const path = String(resource.path || \"\");\n const sourceText = files.get(path);\n if (!sourceText) continue;\n const source = parseYaml(sourceText) as Record<string, unknown>;\n if (source.execution_target !== \"self_hosted\") continue;\n const development = source.development && typeof source.development === \"object\" ? source.development as Record<string, unknown> : undefined;\n if (!development) continue;\n const server = source.server && typeof source.server === \"object\" ? source.server as Record<string, unknown> : {};\n const auth = server.auth && typeof server.auth === \"object\" ? server.auth as Record<string, unknown> : {};\n const secretRequirement = String(auth.secret || \"\");\n const secretKey = secretRequirement.startsWith(\"$secrets.\") ? secretRequirement.slice(\"$secrets.\".length) : \"\";\n const secretDeclaration = secretKey && requiredSecrets[secretKey] && typeof requiredSecrets[secretKey] === \"object\"\n ? requiredSecrets[secretKey] as Record<string, unknown>\n : undefined;\n const cwd = resolve(directory, String(development.cwd || \".\"));\n if (cwd !== directory && !cwd.startsWith(`${directory}/`)) throw new Error(`Artifact ${resource.key} development.cwd must remain inside the package`);\n result.push({\n key: String(resource.key || \"\"), baseUrl: String(development.base_url || \"\"),\n command: development.command ? String(development.command) : undefined,\n args: Array.isArray(development.args) ? development.args.map(String) : [], cwd,\n protocol: {\n manifest_path: server.manifest_path, health_path: server.health_path, verify_path: server.verify_path,\n invoke_path: server.invoke_path, auth_mode: auth.mode, signing_secret_requirement: auth.secret,\n },\n signingSecretEnv: secretDeclaration?.env ? String(secretDeclaration.env) : undefined,\n });\n }\n return result;\n}\n\nasync function waitForServer(baseUrl: string, healthPath: unknown): Promise<void> {\n const target = new URL(String(healthPath || \"/.well-known/agents24/artifact/health\"), baseUrl);\n for (let attempt = 0; attempt < 60; attempt += 1) {\n try { const response = await fetch(target); if (response.ok) return; } catch { /* retry */ }\n await new Promise((resolvePromise) => setTimeout(resolvePromise, 250));\n }\n throw new Error(`Local Artifact server did not become healthy at ${target}`);\n}\n\nasync function openDevelopmentRelay(\n client: Awaited<ReturnType<typeof createRemoteClient>>,\n installationIdValue: string,\n artifact: DevelopmentArtifact,\n localEnv: Record<string, string>,\n): Promise<{ sessionId: string; socket: WebSocket; state: { terminalReason?: string } }> {\n const admission = await client.resourceInstallations.prepareDevelopmentSession(installationIdValue, {\n resource_key: artifact.key, machine_label: hostname(),\n });\n const apiUrl = new URL(String(process.env.AGENTS24_BASE_URL || DEFAULT_API_BASE_URL));\n apiUrl.protocol = apiUrl.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n apiUrl.pathname = String(admission.relay_path);\n const socket = new WebSocket(apiUrl, [\n \"agents24-artifact-relay\",\n `agents24-credential-${String(admission.relay_token)}`,\n ]);\n const state: { terminalReason?: string } = {};\n await new Promise<void>((resolveReady, rejectReady) => {\n socket.addEventListener(\"error\", () => rejectReady(new Error(`Artifact relay failed for ${artifact.key}`)), { once: true });\n socket.addEventListener(\"message\", async (event) => {\n const message = JSON.parse(String(event.data)) as Record<string, unknown>;\n if (message.type === \"ready\") { resolveReady(); return; }\n if (message.type === \"superseded\" || message.type === \"revoked\") {\n state.terminalReason = String(message.type);\n socket.close();\n return;\n }\n if (message.type !== \"request\") return;\n const method = message.operation === \"health\" || message.operation === \"manifest\" ? \"GET\" : \"POST\";\n try {\n const requestBody = method === \"POST\" ? JSON.stringify(message.body || {}) : undefined;\n const headers: Record<string, string> = method === \"POST\" ? { \"content-type\": \"application/json\" } : {};\n if (method === \"POST\" && String(artifact.protocol.auth_mode || \"hmac_sha256\") === \"hmac_sha256\") {\n const signingSecret = String(\n (artifact.signingSecretEnv && (localEnv[artifact.signingSecretEnv] || process.env[artifact.signingSecretEnv])) || \"\",\n );\n if (!signingSecret) throw new Error(`Artifact ${artifact.key} signing secret is unavailable`);\n const timestamp = String(Date.now());\n const signature = createHmac(\"sha256\", signingSecret).update(`${timestamp}.${requestBody}`).digest(\"hex\");\n headers[\"x-agents24-timestamp\"] = timestamp;\n headers[\"x-agents24-signature\"] = `sha256=${signature}`;\n }\n const response = await fetch(new URL(String(message.path || \"/\"), artifact.baseUrl), {\n method,\n headers,\n body: requestBody,\n });\n const textBody = await response.text();\n let body: unknown = textBody;\n try { body = textBody ? JSON.parse(textBody) : null; } catch { /* preserve text */ }\n socket.send(JSON.stringify({ type: \"response\", request_id: message.request_id, status: response.status, body }));\n } catch {\n socket.send(JSON.stringify({ type: \"response\", request_id: message.request_id, status: 502, body: { status: \"failed\" } }));\n }\n });\n const heartbeat = setInterval(() => { if (socket.readyState === WebSocket.OPEN) socket.send(JSON.stringify({ type: \"heartbeat\" })); }, 15_000);\n socket.addEventListener(\"close\", () => clearInterval(heartbeat), { once: true });\n });\n return { sessionId: String(admission.id), socket, state };\n}\n\nasync function execute(parsed: Parsed): Promise<Record<string, unknown>> {\n if (parsed.command === \"prepare\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"prepare requires a Resource Package directory\");\n return preparePackage(input);\n }\n if (parsed.command === \"plan\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"plan requires a Resource Package directory or ZIP\");\n const apiKey = await apiKeyForLifecycle(parsed);\n const client = await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey });\n const data = await packPackage(input);\n const currentId = await installationId(input);\n const plan = await client.resourceInstallations.plan({\n ...upload(data, input),\n ...(currentId ? { installationId: currentId } : {}),\n prune: flag(parsed, \"prune\") === \"true\",\n });\n return { ok: plan.can_apply === true, plan };\n }\n if (parsed.command === \"status\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"status requires a Resource Package directory or ZIP\");\n const id = await installationId(input);\n if (!id) throw new Error(\"No installation is linked; run agents24 apply/link first or set AGENTS24_INSTALLATION_ID\");\n const apiKey = await apiKeyForLifecycle(parsed);\n const status = await (await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey })).resourceInstallations.get(id);\n return { ok: true, installation: status };\n }\n if (parsed.command === \"resources\") {\n if (parsed.positionals[0] !== \"list\") throw new Error(\"Usage: agents24 resources list --kind <kind>\");\n const kind = flag(parsed, \"kind\");\n if (!kind) throw new Error(\"resources list requires --kind\");\n const apiKey = await apiKeyForLifecycle(parsed);\n const result = await (await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey })).resourceInstallations.resources({\n kind, query: flag(parsed, \"query\"), limit: Number(flag(parsed, \"limit\") || 100),\n });\n return { ok: true, ...result };\n }\n if (parsed.command === \"link\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"link requires a Resource Package directory or ZIP\");\n const assignments = values(parsed, \"resource\");\n if (!assignments.length) throw new Error(\"link requires --resource <stable-key>=<uuid>\");\n const apiKey = await apiKeyForLifecycle(parsed);\n const client = await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey });\n let id = await installationId(input);\n if (!id) {\n const data = await packPackage(input);\n const initialPlan = await client.resourceInstallations.plan(upload(data, input));\n const created = await client.resourceInstallations.create(\n { package_name: String(initialPlan.package_name), operation_id: String(initialPlan.operation_id) },\n { idempotencyKey: `installation-${String(initialPlan.package_hash).slice(0, 40)}` },\n );\n id = String(created.id);\n await writeInstallationId(input, id);\n await client.resourceInstallations.plan({ ...upload(data, input), installationId: id });\n }\n const linked = [];\n for (const assignment of assignments) {\n const separator = assignment.indexOf(\"=\");\n if (separator <= 0 || separator === assignment.length - 1) throw new Error(\"--resource must be <stable-key>=<uuid>\");\n const resourceKey = assignment.slice(0, separator);\n const resourceId = assignment.slice(separator + 1);\n linked.push(await client.resourceInstallations.link(id, { resource_key: resourceKey, resource_id: resourceId }, {\n idempotencyKey: `link-${createHash(\"sha256\").update(`${id}:${assignment}`).digest(\"hex\").slice(0, 40)}`,\n }));\n }\n return { ok: true, installation_id: id, linked };\n }\n if (parsed.command === \"apply\") {\n const applied = await applyDraft(parsed);\n return { ok: true, phase: \"draft_applied\", installation_id: applied.installationId, agent_id: applied.agent.id, plan: applied.plan, operation: applied.operation };\n }\n if (parsed.command === \"publish\") {\n const published = await publishDraft(parsed);\n return { ok: true, phase: \"published\", ...published };\n }\n if (parsed.command === \"setup\") {\n const app = await resolveApp(parsed);\n const integration = await resolveInstallMode(parsed, app);\n const applied = await applyDraft(parsed, { integrationMode: integration });\n const published = await publishDraft(parsed, applied);\n const installed = await applied.client.resourceInstallations.get(applied.installationId);\n let deployment: Record<string, unknown> | undefined;\n let deploymentId: string | undefined;\n if (integration === \"client-deployment\") {\n deployment = installed.client_deployment_id\n ? await applied.client.clientDeployments.get(String(installed.client_deployment_id))\n : await clientDeployment(parsed, applied.client, applied.agent, app);\n if (!installed.client_deployment_id) {\n await applied.client.resourceInstallations.bindDeployment(applied.installationId, { client_deployment_id: String(deployment.id) }, { idempotencyKey: `deployment-bind-${applied.installationId}` });\n }\n deploymentId = String(deployment.client_id || \"\");\n }\n let envFile: string | undefined;\n if (app && flag(parsed, \"no-write-env\") !== \"true\" && integration !== \"publish-only\") {\n const localClientBaseUrl = integration === \"client-deployment\" ? clientAppBaseUrl() : undefined;\n envFile = await updateEnvFile(app, integration === \"client-deployment\"\n ? { VITE_AGENTS24_DEPLOYMENT_ID: String(deploymentId), ...(localClientBaseUrl ? { VITE_AGENTS24_BASE_URL: localClientBaseUrl } : {}) }\n : { AGENTS24_API_KEY: applied.apiKey, AGENTS24_AGENT_ID: String(applied.agent.id) });\n }\n return { ok: true, phase: deployment ? \"deployed\" : \"published\", integration, installation_id: applied.installationId, agent_id: applied.agent.id, publication: published.publication, ...(deployment ? { deployment, deployment_id: deploymentId } : {}), ...(envFile ? { env_file: envFile } : {}) };\n }\n if (parsed.command === \"dev\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"dev requires a Resource Package directory\");\n await preparePackage(input);\n const apiKey = await apiKeyForLifecycle(parsed);\n const client = await createRemoteClient({ ...process.env, AGENTS24_API_KEY: apiKey });\n const data = await packPackage(input);\n const id = await ensureInstallation(input, client, data);\n const configuredSecrets = await secretValues(input);\n if (Object.keys(configuredSecrets).length) await client.resourceInstallations.configureSecrets(id, { secrets: configuredSecrets });\n const declared = await developmentArtifacts(input);\n const selectedKey = flag(parsed, \"artifact\");\n const artifacts = selectedKey ? declared.filter((item) => item.key === selectedKey) : declared;\n if (!artifacts.length) throw new Error(selectedKey ? `Artifact ${selectedKey} has no development configuration` : \"No self-hosted Artifact development configuration was found\");\n const directory = await packageDirectory(input);\n const localEnv = directory ? parseEnv(await readFile(join(directory, \".env.local\"), \"utf8\")) : {};\n const children: ChildProcess[] = [];\n const relays: Array<{ sessionId: string; socket: WebSocket; state: { terminalReason?: string } }> = [];\n try {\n for (const artifact of artifacts) {\n if (artifact.command) children.push(spawn(artifact.command, artifact.args, { cwd: artifact.cwd, env: { ...process.env, ...localEnv }, stdio: \"inherit\", shell: false }));\n await waitForServer(artifact.baseUrl, artifact.protocol.health_path);\n relays.push(await openDevelopmentRelay(client, id, artifact, localEnv));\n }\n const developmentSessions: Record<string, string> = Object.fromEntries(artifacts.map((item, index) => [item.key, relays[index].sessionId]));\n for (const artifact of declared) {\n if (developmentSessions[artifact.key]) continue;\n const status = await client.resourceInstallations.developmentSessionStatus(id, artifact.key);\n if (status.status !== \"connected\" || !status.id) throw new Error(`Artifact ${artifact.key} requires an active development connection`);\n developmentSessions[artifact.key] = String(status.id);\n }\n const applied = await applyDraft(parsed, { development: true, developmentSessions, skipConfirmation: true });\n process.stdout.write(`${JSON.stringify({ ok: true, phase: \"development_connected\", installation_id: applied.installationId, development_sessions: developmentSessions }, null, 2)}\\n`);\n await new Promise<void>((resolveStop) => {\n let stopping = false;\n const reconnecting = new Set<number>();\n const stop = () => { stopping = true; resolveStop(); };\n const watch = (relay: typeof relays[number], index: number) => {\n relay.socket.addEventListener(\"close\", async () => {\n if (stopping) return;\n if (relay.state.terminalReason || reconnecting.has(index)) {\n stop();\n return;\n }\n reconnecting.add(index);\n for (let attempt = 1; attempt <= 3 && !stopping; attempt += 1) {\n await new Promise((resolveDelay) => setTimeout(resolveDelay, attempt * 500));\n try {\n const replacement = await openDevelopmentRelay(client, id, artifacts[index], localEnv);\n relays[index] = replacement;\n developmentSessions[artifacts[index].key] = replacement.sessionId;\n await applyDraft(parsed, { development: true, developmentSessions, skipConfirmation: true });\n reconnecting.delete(index);\n watch(replacement, index);\n return;\n } catch {\n // Retry with a fresh one-time relay admission.\n }\n }\n reconnecting.delete(index);\n stop();\n }, { once: true });\n };\n process.once(\"SIGINT\", stop);\n process.once(\"SIGTERM\", stop);\n relays.forEach(watch);\n });\n return { ok: true, phase: \"development_stopped\", installation_id: id };\n } finally {\n for (const relay of relays) relay.socket.close();\n for (const child of children) child.kill(\"SIGTERM\");\n }\n }\n if (parsed.command === \"init\") {\n const directory = resolve(parsed.positionals[0] || \".\");\n const name = flag(parsed, \"name\") || basename(directory);\n const packageName = await initializePackage(directory, name);\n return { ok: true, directory, package: packageName };\n }\n if (parsed.command === \"validate\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"validate requires a package directory or ZIP\");\n const local = await validatePackage(input);\n let remote: Record<string, unknown> | undefined;\n if (flag(parsed, \"remote\") === \"true\" && local.valid) {\n const data = await packPackage(input);\n remote = await (await createRemoteClient()).resourcePackages.validatePackage(upload(data, input));\n }\n return { ok: local.valid && (!remote || remote.valid === true), local: { ...local, files: undefined }, ...(remote ? { remote } : {}) };\n }\n if (parsed.command === \"pack\") {\n const input = parsed.positionals[0];\n if (!input) throw new Error(\"pack requires a package directory\");\n const data = await packPackage(input);\n const output = resolve(flag(parsed, \"output\") || `${basename(resolve(input))}.agents24.zip`);\n await writeFile(output, data);\n return { ok: true, output, bytes: data.byteLength };\n }\n if (parsed.command === \"export\") {\n const kind = flag(parsed, \"kind\");\n const id = flag(parsed, \"id\");\n if (!kind || !id) throw new Error(\"export requires --kind and --id\");\n const target = flag(parsed, \"target\") || \"draft\";\n const selectors = [{ kind, id, target, ...(flag(parsed, \"version-id\") ? { version_id: flag(parsed, \"version-id\") } : {}) }];\n for (const value of values(parsed, \"selector\")) {\n const [itemKind, itemId, itemTarget = \"draft\", versionId] = value.split(\":\");\n if (!itemKind || !itemId) throw new Error(\"--selector must be kind:id[:draft|version[:version-id]]\");\n selectors.push({ kind: itemKind, id: itemId, target: itemTarget, ...(versionId ? { version_id: versionId } : {}) });\n }\n const request = { selectors };\n const archive = await (await createRemoteClient()).resourcePackages.exportPackage(request);\n const output = resolve(flag(parsed, \"output\") || archive.filename);\n await writeFile(output, archive.data);\n return { ok: true, output, bytes: archive.data.byteLength };\n }\n if (parsed.command === \"compile\") {\n const { result } = await compiledPackage(parsed);\n const output = flag(parsed, \"output\");\n if (output) await writeFile(resolve(output), `${JSON.stringify(result.bundle, null, 2)}\\n`);\n return { ok: result.valid === true, ...(output ? { output: resolve(output) } : {}), result: safeResult(result) };\n }\n if (parsed.command === \"preview\" || parsed.command === \"import\") {\n const client = await createRemoteClient();\n const { result } = await compiledPackage(parsed, client);\n if (result.valid !== true || !result.bundle || typeof result.bundle !== \"object\") throw new Error(\"Remote compilation did not produce a bundle\");\n const request = {\n bundle: result.bundle as Record<string, unknown>,\n mappings: mappings(parsed),\n };\n let preview = await client.resourceBundles.importPreview(request);\n request.mappings = await promptMappings(parsed, client, preview, request.mappings);\n if (Object.keys(request.mappings).length) preview = await client.resourceBundles.importPreview(request);\n if (parsed.command === \"preview\") return { ok: preview.can_import === true, preview };\n if (preview.can_import !== true) return { ok: false, preview };\n await confirmation(parsed, preview);\n const imported = await client.resourceBundles.importBundle(request, { idempotencyKey: importKey(request.bundle, request.mappings) });\n return { ok: true, phase: \"imported\", preview, result: imported };\n }\n throw new Error(`Unknown package command: ${parsed.command}`);\n}\n\nfunction diagnostics(error: unknown): Diagnostic[] | undefined {\n if (!error || typeof error !== \"object\") return undefined;\n const record = error as { diagnostics?: unknown; details?: unknown };\n if (Array.isArray(record.diagnostics)) return record.diagnostics as Diagnostic[];\n if (!record.details || typeof record.details !== \"object\" || Array.isArray(record.details)) return undefined;\n const detail = (record.details as Record<string, unknown>).detail;\n if (!detail || typeof detail !== \"object\" || Array.isArray(detail)) return undefined;\n const value = (detail as Record<string, unknown>).diagnostics;\n return Array.isArray(value) ? value as Diagnostic[] : undefined;\n}\n\nfunction errorMessage(error: unknown, parsed: Parsed | undefined): string {\n void parsed;\n return error instanceof Error ? error.message : \"Unexpected CLI failure\";\n}\n\nexport async function run(argv = process.argv.slice(2)): Promise<number> {\n let parsed: Parsed | undefined;\n try {\n parsed = parse(argv);\n const result = await execute(parsed);\n if (flag(parsed, \"json\") === \"true\") process.stdout.write(`${JSON.stringify(result)}\\n`);\n else if (result.ok === false) process.stderr.write(`${JSON.stringify(result, null, 2)}\\n`);\n else process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return result.ok === false ? 1 : 0;\n } catch (error) {\n const payload = {\n ok: false,\n error: errorMessage(error, parsed),\n ...(error && typeof error === \"object\" && \"phase\" in error ? { phase: (error as { phase: unknown }).phase } : {}),\n ...(error && typeof error === \"object\" && \"imported\" in error ? { import_result: (error as { imported: unknown }).imported } : {}),\n ...(diagnostics(error) ? { diagnostics: diagnostics(error) } : {}),\n };\n const body = parsed && flag(parsed, \"json\") === \"true\" ? JSON.stringify(payload) : JSON.stringify(payload, null, 2);\n process.stderr.write(`${body}\\n`);\n return 1;\n }\n}\n\nprocess.exitCode = await run();\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,UAAU,MAAM,eAAe;AACxC,SAAS,OAAO,OAAO,UAAU,MAAM,iBAAiB;AACxD,SAAS,uBAAuB;AAChC,SAAS,YAAY,YAAY,mBAAmB;AACpD,SAAS,aAAgC;AACzC,SAAS,gBAAgB;AACzB,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU,UAAU,QAAQ,YAAY;AAYjD,IAAM,gBAAgB,oBAAI,IAAI,CAAC,QAAQ,UAAU,OAAO,oBAAoB,gBAAgB,OAAO,CAAC;AACpG,IAAM,qBAAqB,oBAAI,IAAI,CAAC,WAAW,QAAQ,SAAS,OAAO,WAAW,SAAS,UAAU,QAAQ,WAAW,CAAC;AACzH,IAAM,uBAAuB;AAC7B,IAAM,+BAA+B,CAAC,yBAAyB,uBAAuB;AAEtF,SAAS,MAAM,MAAwB;AACrC,QAAM,YAAY,mBAAmB,IAAI,KAAK,CAAC,CAAC;AAChD,MAAI,CAAC,cAAc,KAAK,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,GAAI,OAAM,IAAI,MAAM,oJAAoJ;AAC3N,QAAM,QAAQ,oBAAI,IAAsB;AACxC,QAAM,cAAwB,CAAC;AAC/B,WAAS,QAAQ,YAAY,IAAI,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;AACnE,UAAM,UAAU,KAAK,KAAK;AAC1B,QAAI,CAAC,QAAQ,WAAW,IAAI,GAAG;AAAE,kBAAY,KAAK,OAAO;AAAG;AAAA,IAAU;AACtE,UAAM,CAAC,SAA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AI,SAAS,OAAO,UAAU,YAAY,WAAW,QAAQ,EAAE,OAAQ,MAA6B,MAAM,IAAI,CAAC;AAAA,MAC/G,GAAI,SAAS,OAAO,UAAU,YAAY,cAAc,QAAQ,EAAE,eAAgB,MAAgC,SAAS,IAAI,CAAC;AAAA,MAChI,GAAI,YAAY,KAAK,IAAI,EAAE,aAAa,YAAY,KAAK,EAAE,IAAI,CAAC;AAAA,IAClE;AACA,UAAM,OAAO,UAAU,KAAK,QAAQ,MAAM,MAAM,SAAS,KAAK,UAAU,OAAO,IAAI,KAAK,UAAU,SAAS,MAAM,CAAC;AAClH,YAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,CAAI;AAChC,WAAO;AAAA,EACT;AACF;AAEA,QAAQ,WAAW,MAAM,IAAI;","names":["values","answer"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ declare function initializePackage(directory: string, packageName: string): Prom
|
|
|
23
23
|
|
|
24
24
|
declare function parseMappings(items: string[]): Record<string, string>;
|
|
25
25
|
declare function shouldPromptForDependency(dependency: Record<string, unknown>): boolean;
|
|
26
|
-
declare function assertInstallPreviewReady(preview: Record<string, unknown>): void;
|
|
27
26
|
declare function assertImportAllowed(preview: Record<string, unknown>, options: {
|
|
28
27
|
allowIncomplete: boolean;
|
|
29
28
|
yes: boolean;
|
|
@@ -39,6 +38,11 @@ type ResourceBundleRequest = {
|
|
|
39
38
|
selected_resource_keys?: string[];
|
|
40
39
|
mappings?: Record<string, string>;
|
|
41
40
|
};
|
|
41
|
+
type ResourceInstallationPlanUpload = ResourcePackageUpload & {
|
|
42
|
+
installationId?: string;
|
|
43
|
+
prune?: boolean;
|
|
44
|
+
development?: boolean;
|
|
45
|
+
};
|
|
42
46
|
type RemoteClient = {
|
|
43
47
|
resourcePackages: {
|
|
44
48
|
exportPackage(request: Record<string, unknown>): Promise<{
|
|
@@ -59,6 +63,52 @@ type RemoteClient = {
|
|
|
59
63
|
requiredCapability?: "chat" | "embedding";
|
|
60
64
|
}): Promise<Record<string, unknown>>;
|
|
61
65
|
};
|
|
66
|
+
resourceInstallations: {
|
|
67
|
+
list(): Promise<Record<string, unknown>>;
|
|
68
|
+
create(request: {
|
|
69
|
+
package_name: string;
|
|
70
|
+
operation_id: string;
|
|
71
|
+
}, options?: {
|
|
72
|
+
idempotencyKey?: string;
|
|
73
|
+
}): Promise<Record<string, unknown>>;
|
|
74
|
+
get(id: string): Promise<Record<string, unknown>>;
|
|
75
|
+
plan(upload: ResourceInstallationPlanUpload): Promise<Record<string, unknown>>;
|
|
76
|
+
link(id: string, request: {
|
|
77
|
+
resource_key: string;
|
|
78
|
+
resource_id: string;
|
|
79
|
+
}, options?: {
|
|
80
|
+
idempotencyKey?: string;
|
|
81
|
+
}): Promise<Record<string, unknown>>;
|
|
82
|
+
configureSecrets(id: string, request: {
|
|
83
|
+
secrets: Record<string, string>;
|
|
84
|
+
}, options?: {
|
|
85
|
+
idempotencyKey?: string;
|
|
86
|
+
}): Promise<Record<string, unknown>>;
|
|
87
|
+
apply(operationId: string, request: Record<string, unknown>, options?: {
|
|
88
|
+
idempotencyKey?: string;
|
|
89
|
+
}): Promise<Record<string, unknown>>;
|
|
90
|
+
operationStatus(operationId: string): Promise<Record<string, unknown>>;
|
|
91
|
+
publish(id: string, request: {
|
|
92
|
+
package_hash: string;
|
|
93
|
+
}, options?: {
|
|
94
|
+
idempotencyKey?: string;
|
|
95
|
+
}): Promise<Record<string, unknown>>;
|
|
96
|
+
prepareDevelopmentSession(id: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
97
|
+
developmentSessionStatus(id: string, resourceKey: string): Promise<Record<string, unknown>>;
|
|
98
|
+
revokeDevelopmentSession(id: string, sessionId: string, options?: {
|
|
99
|
+
idempotencyKey?: string;
|
|
100
|
+
}): Promise<Record<string, unknown>>;
|
|
101
|
+
bindDeployment(id: string, request: {
|
|
102
|
+
client_deployment_id: string | null;
|
|
103
|
+
}, options?: {
|
|
104
|
+
idempotencyKey?: string;
|
|
105
|
+
}): Promise<Record<string, unknown>>;
|
|
106
|
+
resources(options: {
|
|
107
|
+
kind: string;
|
|
108
|
+
query?: string;
|
|
109
|
+
limit?: number;
|
|
110
|
+
}): Promise<Record<string, unknown>>;
|
|
111
|
+
};
|
|
62
112
|
agents: {
|
|
63
113
|
publish(id: string, options?: {
|
|
64
114
|
idempotencyKey?: string;
|
|
@@ -71,8 +121,9 @@ type RemoteClient = {
|
|
|
71
121
|
create(request: Record<string, unknown>, options?: {
|
|
72
122
|
idempotencyKey?: string;
|
|
73
123
|
}): Promise<Record<string, unknown>>;
|
|
124
|
+
get(id: string): Promise<Record<string, unknown>>;
|
|
74
125
|
};
|
|
75
126
|
};
|
|
76
127
|
declare function createRemoteClient(environment?: NodeJS.ProcessEnv): Promise<RemoteClient>;
|
|
77
128
|
|
|
78
|
-
export { type Diagnostic, type RemoteClient, type ValidationResult, assertImportAllowed,
|
|
129
|
+
export { type Diagnostic, type RemoteClient, type ValidationResult, assertImportAllowed, createRemoteClient, initializePackage, loadPackageFiles, packFiles, packPackage, parseMappings, shouldPromptForDependency, unpackFiles, validateFiles, validatePackage };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
assertImportAllowed,
|
|
4
|
-
assertInstallPreviewReady,
|
|
5
4
|
createRemoteClient,
|
|
6
5
|
initializePackage,
|
|
7
6
|
loadPackageFiles,
|
|
@@ -12,10 +11,9 @@ import {
|
|
|
12
11
|
unpackFiles,
|
|
13
12
|
validateFiles,
|
|
14
13
|
validatePackage
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NLUCQTMN.js";
|
|
16
15
|
export {
|
|
17
16
|
assertImportAllowed,
|
|
18
|
-
assertInstallPreviewReady,
|
|
19
17
|
createRemoteClient,
|
|
20
18
|
initializePackage,
|
|
21
19
|
loadPackageFiles,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.agents24.dev/schemas/resource-package/
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/agent.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": [
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"rag",
|
|
61
61
|
"tool",
|
|
62
62
|
"toolset",
|
|
63
|
-
"integration"
|
|
63
|
+
"integration",
|
|
64
|
+
"artifact"
|
|
64
65
|
]
|
|
65
66
|
},
|
|
66
67
|
"uses": {
|
|
@@ -71,6 +72,10 @@
|
|
|
71
72
|
"static",
|
|
72
73
|
"dynamic"
|
|
73
74
|
]
|
|
75
|
+
},
|
|
76
|
+
"export": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_-]*$"
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/artifact.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schema", "name", "execution_target"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema": { "const": "agents24.artifact/v1" },
|
|
9
|
+
"name": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
10
|
+
"description": { "type": "string", "maxLength": 2000 },
|
|
11
|
+
"execution_target": { "enum": ["platform_hosted", "self_hosted"] },
|
|
12
|
+
"runtime": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"required": ["language", "entry"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"language": { "enum": ["python", "javascript"] },
|
|
18
|
+
"entry": { "type": "string", "minLength": 1 },
|
|
19
|
+
"dependencies": { "type": "array", "items": { "type": "string" } }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"server": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"required": ["auth"],
|
|
26
|
+
"properties": {
|
|
27
|
+
"manifest_path": { "type": "string", "pattern": "^/(?!/)" },
|
|
28
|
+
"health_path": { "type": "string", "pattern": "^/(?!/)" },
|
|
29
|
+
"verify_path": { "type": "string", "pattern": "^/(?!/)" },
|
|
30
|
+
"invoke_path": { "type": "string", "pattern": "^/(?!/)" },
|
|
31
|
+
"auth": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["mode"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"mode": { "enum": ["hmac_sha256", "none"] },
|
|
37
|
+
"secret": { "type": "string", "pattern": "^\\$secrets\\.[a-z0-9]+(?:-[a-z0-9]+)*$" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"development": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"additionalProperties": false,
|
|
45
|
+
"required": ["base_url"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"command": { "type": "string", "minLength": 1, "pattern": "^[^;&|`$<>\\r\\n]+$" },
|
|
48
|
+
"args": { "type": "array", "items": { "type": "string", "maxLength": 4096 }, "maxItems": 64 },
|
|
49
|
+
"cwd": { "type": "string", "minLength": 1 },
|
|
50
|
+
"base_url": { "type": "string", "format": "uri", "pattern": "^http://(?:127\\.0\\.0\\.1|localhost)(?::[0-9]{1,5})?(?:/.*)?$" }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"production": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"required": ["base_url"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"base_url": { "type": "string", "format": "uri", "pattern": "^https://" }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"capabilities": { "type": "object" }
|
|
62
|
+
},
|
|
63
|
+
"oneOf": [
|
|
64
|
+
{ "properties": { "execution_target": { "const": "platform_hosted" } }, "required": ["runtime"] },
|
|
65
|
+
{ "properties": { "execution_target": { "const": "self_hosted" } }, "required": ["server"] }
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.agents24.dev/schemas/resource-package/
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/manifest.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": [
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
"capability": {
|
|
24
24
|
"enum": ["chat", "embedding"]
|
|
25
25
|
},
|
|
26
|
+
"env": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"pattern": "^[A-Z][A-Z0-9_]*$"
|
|
29
|
+
},
|
|
30
|
+
"generate": {
|
|
31
|
+
"type": "boolean"
|
|
32
|
+
},
|
|
26
33
|
"match": {
|
|
27
34
|
"type": "object",
|
|
28
35
|
"additionalProperties": false,
|
|
@@ -44,7 +51,7 @@
|
|
|
44
51
|
},
|
|
45
52
|
"properties": {
|
|
46
53
|
"schema": {
|
|
47
|
-
"const": "agents24.package/
|
|
54
|
+
"const": "agents24.package/v2"
|
|
48
55
|
},
|
|
49
56
|
"name": {
|
|
50
57
|
"type": "string",
|
|
@@ -64,8 +71,19 @@
|
|
|
64
71
|
"maxItems": 250,
|
|
65
72
|
"uniqueItems": true,
|
|
66
73
|
"items": {
|
|
67
|
-
"type": "
|
|
68
|
-
"
|
|
74
|
+
"type": "object",
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": ["key", "path"],
|
|
77
|
+
"properties": {
|
|
78
|
+
"key": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
|
|
81
|
+
},
|
|
82
|
+
"path": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"pattern": "^(workflows/[a-z0-9][a-z0-9-]*\\.yaml|rag/[a-z0-9][a-z0-9-]*\\.yaml|skills/[a-z0-9][a-z0-9-]*\\.md|stores/[a-z0-9][a-z0-9-]*\\.yaml|artifacts/[a-z0-9][a-z0-9-]*/artifact\\.yaml)$"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
69
87
|
}
|
|
70
88
|
},
|
|
71
89
|
"requires": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.agents24.dev/schemas/resource-package/
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/rag.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.agents24.dev/schemas/resource-package/
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/skill.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.agents24.dev/schemas/resource-package/
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/store.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": ["schema", "name", "description", "embedding_model", "chunking", "retrieval_policy", "default_namespace"],
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"embedding_model": { "type": "string", "pattern": "^\\$models\\.[a-z0-9]+(?:-[a-z0-9]+)*$" },
|
|
12
12
|
"chunking": { "type": "object" },
|
|
13
13
|
"retrieval_policy": { "enum": ["semantic_only", "hybrid", "keyword_only", "recency_boosted"] },
|
|
14
|
-
"default_namespace": { "type": "string", "minLength": 1, "maxLength": 128 }
|
|
14
|
+
"default_namespace": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
15
|
+
"content": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"uniqueItems": true,
|
|
18
|
+
"items": { "type": "string", "pattern": "^\\.\\./knowledge/" }
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.agents24.dev/schemas/resource-package/
|
|
3
|
+
"$id": "https://docs.agents24.dev/schemas/resource-package/2.0/workflow.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"required": [
|