@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@agents24/cli`
2
2
 
3
- Last Updated: 2026-08-06
3
+ Last Updated: 2026-08-13
4
4
 
5
5
  Command-line tooling for editable `agents24.resource_package` source packages.
6
6
 
@@ -23,15 +23,18 @@ agents24 package export --kind agent --id <id> --target draft
23
23
  agents24 package compile customer-service.agents24.zip --output bundle.json
24
24
  agents24 package preview customer-service.agents24.zip
25
25
  agents24 package import customer-service.agents24.zip --yes
26
- agents24 install customer-service.agents24.zip --yes
26
+ agents24 prepare ./customer-service
27
+ agents24 plan ./customer-service
28
+ agents24 apply ./customer-service
29
+ agents24 publish ./customer-service
27
30
  ```
28
31
 
29
- `install` is the canonical remote installation workflow; the `package` commands remain authoring tools. It validates, compiles, resolves canonical Model requirements without model-selection prompts, previews, and imports the complete package, then publishes one selected Agent through the canonical Agent publish API. A missing preferred Model uses the effective default when available; otherwise the Agent/Store is saved without a model and can be configured later. That API publishes required RAG pipelines, Instructions, and child Agents; the CLI does not expose a separate RAG publication route. If the package contains several Agents, use `--agent <resource-key|id|name>` or choose interactively. `--map` remains available as an advanced override for noncanonical external requirements.
32
+ Package V2 uses stable resource keys and a durable server-side installation. `prepare` generates declared secrets in protected `.env.local`, `plan` compiles and shows reconciliation without mutation, and `apply` creates or updates the same product **as drafts only**. `publish` rejects source changed since its successful apply, then atomically promotes production-ready drafts. `setup` performs apply, publish, and detected-app configuration. `status` reports bindings and operation state; `link --resource <key>=<uuid>` explicitly adopts existing same-organization resources; `resources list --kind <kind>` aids discovery. `package import` remains create-only cloning. There is no top-level `install` command.
30
33
 
31
- From a generated app, `install` reads `package.json.agents24.integration` automatically; `--app <directory>` selects another generated app. Without one, choose or pass `--integration <client-deployment|bff|publish-only>`. Client deployment uses guided active-policy, origin, and anonymous-auth defaults, then writes `VITE_AGENTS24_DEPLOYMENT_ID`. An explicit non-production `AGENTS24_BASE_URL` is copied as public `VITE_AGENTS24_BASE_URL` so the generated browser app reaches the same local or staging API. BFF writes `AGENTS24_API_KEY` and `AGENTS24_AGENT_ID`. `.env.local` is updated by default without disturbing unrelated entries and is locked to user-only permissions; `--no-write-env` leaves configuration for later.
34
+ From a generated app, `setup` reads `package.json.agents24.integration`; `--app <directory>` selects another app. Later applies retain direct-client deployment IDs and Resource Policy assignments, or BFF API key plus Agent ID. `.env.local` is updated without disturbing unrelated values and is user-only; `--no-write-env` leaves application configuration for later.
32
35
 
33
- The API key comes only from `AGENTS24_API_KEY` or an interactive masked prompt; `--api-key` is rejected. Create a new key in **Settings API Keys** to receive the default Agent-integration permissions for install, publish, and trusted-server execution. Existing keys are not widened when that preset changes, so replace an under-scoped key. On authorization failure, the CLI reports this corrective guidance rather than the API's generic denial message. Guided client deployment uses `roles.read` only to list active Resource Policy sets; it does not modify them.
36
+ The API key comes only from `AGENTS24_API_KEY` or an interactive masked prompt; `--api-key` is rejected. Remote Artifact signing values are created locally then synchronized through write-only APIs; neither values nor credentials appear in packages, plans, or output. MCP servers and OAuth remain external requirements.
34
37
 
35
- Completion prints the Agent ID, an optional deployment ID, and the app's next command, but never the key. `--json` includes `phase`, `integration`, `agent_id`, optional `deployment_id`, and `env_written`, without secrets. Repeatable `--map`, `--policy-set`, `--origin`, `--auth-mode`, `--oidc-config`, `--allow-incomplete`, and `--yes` remain available. Stable idempotency makes import, publication, and deployment retries safe; post-import and environment-write failures retain the imported resources and identify the resumable phase.
38
+ The local installation pointer is `.agents24/installation-id` and must be ignored; CI uses `AGENTS24_INSTALLATION_ID`. `apply` is durable and resumable. Deleted declarations are retained by default; `apply --prune` removes only plan-confirmed resources. `dev` starts or attaches declared local self-hosted Artifact servers, opens one managed authenticated HMAC relay connection per Artifact, and applies drafts. A newly verified provisional relay supersedes the prior Artifact-wide relay; relay liveness is required for draft execution. It is a fixed Artifact protocol bridge, not a generic HTTP proxy; no local paths or secrets persist. Hosted Artifacts embed package source; `publish` verifies and atomically activates the deployed HTTPS production binding without mutating the development projection.
36
39
 
37
- The canonical source tree is `agents24.yaml`, `workflows/*.yaml`, `agents/*.md`, `rag/*.yaml`, `skills/*.md`, `stores/*.yaml`, and optional `files/*.md`. The manifest has a sorted complete resource inventory and no entrypoint. It uses relative local references, external `$namespace.slug` requirements, and `[[skill:<slug>]]` inline Instruction mentions. `pack` writes stable ZIP order and metadata. See the [resource movement guide](https://docs.agents24.dev/guides/move-resource-bundles) and [manifest schema](https://docs.agents24.dev/schemas/resource-package/1.0/manifest.schema.json).
40
+ The canonical tree is `agents24.yaml`, Workflows, Agent Markdown, RAG, Skills, Stores, optional Artifacts/source trees, managed `knowledge/` content, and optional `files/`. Local Artifact references use `$artifacts.*` plus an explicit export key. See the [resource movement guide](https://docs.agents24.dev/guides/move-resource-bundles) and [manifest schema](https://docs.agents24.dev/schemas/resource-package/2.0/manifest.schema.json).
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractHash": "13f59fd11fc838b1f7a51afe15afcdb6f1429fed94e37a1341c97061882e57d2",
2
+ "contractHash": "4012be62020727eb18b7e88cdc8067dcc605e1ecbe9d5acd12c51268e351a289",
3
3
  "contractVersion": "0.2.0",
4
4
  "corpus": "conformance/v1/corpus.json",
5
5
  "generatedBy": "@agents24/sdk-contract",
@@ -15,11 +15,11 @@
15
15
  "reactDom": ">=19 <20"
16
16
  },
17
17
  "@agents24/client": {
18
- "contract": "13f59fd11fc838b1f7a51afe15afcdb6f1429fed94e37a1341c97061882e57d2",
18
+ "contract": "a409af6996d10a8d94e0f6332c9a381c3535a9c8511314b6c42b237d7e057029",
19
19
  "runtime": "run-stream.v3"
20
20
  },
21
21
  "@agents24/node": {
22
- "contract": "13f59fd11fc838b1f7a51afe15afcdb6f1429fed94e37a1341c97061882e57d2",
22
+ "contract": "4012be62020727eb18b7e88cdc8067dcc605e1ecbe9d5acd12c51268e351a289",
23
23
  "node": "^22.0.0 || ^24.0.0"
24
24
  },
25
25
  "@agents24/react": {
@@ -27,11 +27,11 @@
27
27
  "react": ">=19 <20"
28
28
  },
29
29
  "@talmudpedia/runtime-sdk": {
30
- "contract": "13f59fd11fc838b1f7a51afe15afcdb6f1429fed94e37a1341c97061882e57d2",
30
+ "contract": "a409af6996d10a8d94e0f6332c9a381c3535a9c8511314b6c42b237d7e057029",
31
31
  "protocolOwner": "@agents24/client"
32
32
  },
33
33
  "agents24": {
34
- "contract": "13f59fd11fc838b1f7a51afe15afcdb6f1429fed94e37a1341c97061882e57d2",
34
+ "contract": "4012be62020727eb18b7e88cdc8067dcc605e1ecbe9d5acd12c51268e351a289",
35
35
  "python": ">=3.10"
36
36
  }
37
37
  },
@@ -48,7 +48,7 @@
48
48
  "schemaVersion": "agents24.compatibility.v1",
49
49
  "targetOperationCounts": {
50
50
  "client": 22,
51
- "node": 78,
52
- "python": 69
51
+ "node": 93,
52
+ "python": 84
53
53
  }
54
54
  }
@@ -25,7 +25,7 @@ function safePath(raw) {
25
25
  if (parts.some((part) => !part || part === "." || part === "..")) throw new Error("Archive contains an unsafe path");
26
26
  if (parts.length > MAX_DEPTH) throw new Error(`Archive path exceeds depth ${MAX_DEPTH}: ${raw}`);
27
27
  if (/\.(?:zip|tar|tgz|gz)$/i.test(raw)) throw new Error(`Nested archives are unsupported: ${raw}`);
28
- if (!/\.(?:yaml|md)$/.test(raw) || raw.endsWith(".yml")) throw new Error(`Unsupported package file: ${raw}`);
28
+ if (!/\.(?:yaml|md|txt|html|json|csv|py|js|mjs|ts)$/.test(raw) || raw.endsWith(".yml")) throw new Error(`Unsupported package file: ${raw}`);
29
29
  return raw;
30
30
  }
31
31
  function writeUInt32(value) {
@@ -181,8 +181,8 @@ var MANIFEST = "agents24.yaml";
181
181
  var SYMBOL = /^\$(workflows|rag|skills|models|stores|tools|toolsets|artifacts|integrations|secrets)\.([a-z0-9]+(?:-[a-z0-9]+)*)$/;
182
182
  var UUID = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i;
183
183
  var URL_PATTERN = /\b[A-Za-z][A-Za-z0-9+.-]*:\/\//;
184
- var LOCAL = /^(workflows|agents|rag|skills|stores|files)\/(?:[a-z0-9][a-z0-9-]*\/)*[a-z0-9][a-z0-9-]*\.(yaml|md)$/;
185
- var SECRET_FIELDS = /* @__PURE__ */ 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"]);
184
+ var LOCAL = /^(workflows|agents|rag|skills|stores|artifacts|files|knowledge)\//;
185
+ var SECRET_FIELDS = /* @__PURE__ */ 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", "account_id", "organization_id", "project_id", "publication_state", "governance_policy"]);
186
186
  function add(rows, severity, code, itemPath, message) {
187
187
  rows.push({ severity, code, path: itemPath, message });
188
188
  }
@@ -213,17 +213,18 @@ function markdownBody(text) {
213
213
  return match?.[1] || "";
214
214
  }
215
215
  function schema(name) {
216
- const location = new URL(`../generated/schemas/resource-package/1.0/${name}.schema.json`, import.meta.url);
216
+ const location = new URL(`../generated/schemas/resource-package/2.0/${name}.schema.json`, import.meta.url);
217
217
  return JSON.parse(readSync(fileURLToPath(location), "utf8"));
218
218
  }
219
219
  var AjvConstructor = Ajv2020;
220
- var ajv = new AjvConstructor({ allErrors: true, strict: true, strictRequired: false });
221
- var validators = Object.fromEntries(["manifest", "workflow", "agent", "rag", "skill", "store"].map((name) => [name, ajv.compile(schema(name))]));
220
+ var ajv = new AjvConstructor({ allErrors: true, strict: true, strictRequired: false, formats: { uri: true } });
221
+ var validators = Object.fromEntries(["manifest", "workflow", "agent", "rag", "skill", "store", "artifact"].map((name) => [name, ajv.compile(schema(name))]));
222
222
  async function directoryFiles(root) {
223
223
  const files = /* @__PURE__ */ new Map();
224
224
  let total = 0;
225
225
  async function visit(directory) {
226
226
  for (const entry of await readdir(directory, { withFileTypes: true })) {
227
+ if ([".agents24", ".git", "node_modules"].includes(entry.name) || [".env.local", ".gitignore"].includes(entry.name)) continue;
227
228
  const absolute = path.join(directory, entry.name);
228
229
  const relative = path.relative(root, absolute).split(path.sep).join("/");
229
230
  const metadata = await lstat(absolute);
@@ -234,7 +235,7 @@ async function directoryFiles(root) {
234
235
  }
235
236
  if (!metadata.isFile()) continue;
236
237
  if (relative.split("/").length > 12) throw new Error(`Package path exceeds depth 12: ${relative}`);
237
- if (!/\.(?:yaml|md)$/.test(relative) || relative.endsWith(".yml")) throw new Error(`Unsupported package file: ${relative}`);
238
+ if (!/\.(?:yaml|md|txt|html|json|csv|py|js|mjs|ts)$/.test(relative) || relative.endsWith(".yml")) throw new Error(`Unsupported package file: ${relative}`);
238
239
  if (metadata.size > 2 * 1024 * 1024) throw new Error(`Package file exceeds the 2 MiB limit: ${relative}`);
239
240
  total += metadata.size;
240
241
  if (total > 10 * 1024 * 1024) throw new Error("Package exceeds the 10 MiB uncompressed limit");
@@ -285,7 +286,14 @@ function validateFiles(files) {
285
286
  else if (/^rag\/[a-z0-9][a-z0-9-]*\.yaml$/.test(filePath)) kind = "rag";
286
287
  else if (/^skills\/[a-z0-9][a-z0-9-]*\.md$/.test(filePath)) kind = "skill";
287
288
  else if (/^stores\/[a-z0-9][a-z0-9-]*\.yaml$/.test(filePath)) kind = "store";
288
- else if (/^files\/.+\.md$/.test(filePath)) {
289
+ else if (/^artifacts\/[a-z0-9][a-z0-9-]*\/artifact\.yaml$/.test(filePath)) kind = "artifact";
290
+ else if (/^artifacts\/[a-z0-9][a-z0-9-]*\/src\/.+\.(?:py|js|mjs|ts)$/.test(filePath)) {
291
+ parsed.set(filePath, {});
292
+ continue;
293
+ } else if (/^knowledge\/.+\.(?:md|txt|html|json|csv)$/.test(filePath)) {
294
+ parsed.set(filePath, {});
295
+ continue;
296
+ } else if (/^files\/.+\.md$/.test(filePath)) {
289
297
  parsed.set(filePath, {});
290
298
  continue;
291
299
  }
@@ -293,16 +301,20 @@ function validateFiles(files) {
293
301
  add(diagnostics, "error", "UNKNOWN_FILE", filePath, "File is not in a canonical package directory");
294
302
  continue;
295
303
  }
296
- const value = kind === "workflow" || kind === "rag" || kind === "store" ? parseYaml(text, filePath, diagnostics) : frontmatter(text, filePath, diagnostics);
304
+ const value = kind === "workflow" || kind === "rag" || kind === "store" || kind === "artifact" ? parseYaml(text, filePath, diagnostics) : frontmatter(text, filePath, diagnostics);
297
305
  validateSchema(kind, value, filePath, diagnostics);
298
306
  if ((kind === "agent" || kind === "skill") && (UUID.test(markdownBody(text).trim()) || URL_PATTERN.test(markdownBody(text).trim()))) {
299
307
  add(diagnostics, "error", "FORBIDDEN_VALUE", `${filePath}/body`, "Platform UUIDs and URLs are forbidden in source packages");
300
308
  }
301
309
  parsed.set(filePath, value);
302
- if (kind !== "agent") resources.push({ path: filePath, kind: kind === "workflow" ? "agent" : kind === "rag" ? "rag_pipeline" : kind === "store" ? "knowledge_store" : "instruction", name: value.name });
310
+ if (kind !== "agent") resources.push({ path: filePath, kind: kind === "workflow" ? "agent" : kind === "rag" ? "rag_pipeline" : kind === "store" ? "knowledge_store" : kind === "skill" ? "instruction" : kind, name: value.name });
303
311
  }
304
- const declaredRows = Array.isArray(manifest.resources) ? manifest.resources.map(String) : [];
305
- if (declaredRows.some((item, index) => item !== [...declaredRows].sort()[index])) add(diagnostics, "error", "RESOURCE_ORDER", MANIFEST, "resources must be sorted deterministically");
312
+ const declarations = Array.isArray(manifest.resources) ? manifest.resources.filter((item) => Boolean(item && typeof item === "object" && !Array.isArray(item))) : [];
313
+ const declaredRows = declarations.map((item) => String(item.path || ""));
314
+ const declaredKeys = declarations.map((item) => String(item.key || ""));
315
+ if (declaredKeys.some((item, index) => item !== [...declaredKeys].sort()[index])) add(diagnostics, "error", "RESOURCE_ORDER", MANIFEST, "resources must be sorted by key");
316
+ if (new Set(declaredKeys).size !== declaredKeys.length) add(diagnostics, "error", "RESOURCE_KEY_DUPLICATE", MANIFEST, "resource keys must be unique");
317
+ if (new Set(declaredRows).size !== declaredRows.length) add(diagnostics, "error", "RESOURCE_PATH_DUPLICATE", MANIFEST, "resource paths must be unique");
306
318
  const declared = new Set(declaredRows);
307
319
  const platformResources = new Set(resources.map((item) => String(item.path)));
308
320
  declaredRows.forEach((filePath, index) => {
@@ -328,15 +340,16 @@ function validateFiles(files) {
328
340
  walk(value, (item, itemPath, key) => {
329
341
  if (key && SECRET_FIELDS.has(key.toLowerCase())) add(diagnostics, "error", "FORBIDDEN_FIELD", source + itemPath, "Secret and platform identity fields are forbidden");
330
342
  if (typeof item !== "string") return;
331
- if (UUID.test(item) || URL_PATTERN.test(item)) add(diagnostics, "error", "FORBIDDEN_VALUE", source + itemPath, "Platform UUIDs and URLs are forbidden in source packages");
343
+ if (UUID.test(item)) add(diagnostics, "error", "FORBIDDEN_VALUE", source + itemPath, "Platform UUIDs are forbidden in source packages");
344
+ if (URL_PATTERN.test(item) && !(source.startsWith("artifacts/") && ["/development/base_url", "/production/base_url"].includes(itemPath))) add(diagnostics, "error", "FORBIDDEN_VALUE", source + itemPath, "URLs are allowed only in schema-owned connection fields");
332
345
  const symbol = SYMBOL.exec(item);
333
346
  if (symbol) {
334
347
  referenceCount += 1;
335
- const declarations = manifest.requires?.[symbol[1]];
336
- if (!declarations || !(symbol[2] in declarations)) add(diagnostics, "error", "REQUIREMENT_UNDECLARED", source + itemPath, `${item} is not declared`);
348
+ const declarations2 = manifest.requires?.[symbol[1]];
349
+ if (!declarations2 || !(symbol[2] in declarations2)) add(diagnostics, "error", "REQUIREMENT_UNDECLARED", source + itemPath, `${item} is not declared`);
337
350
  }
338
- const target = resolve(source, item);
339
- const platformTarget = Boolean(target && /^(workflows|rag|skills|stores)\//.test(target));
351
+ const target = item.startsWith("../") || item.startsWith("./") ? resolve(source, item) : null;
352
+ const platformTarget = Boolean(target && /^(workflows|rag|skills|stores|artifacts)\//.test(target));
340
353
  if (target && (platformTarget || ["uses", "skills", "instructions", "file"].includes(String(key)))) {
341
354
  referenceCount += 1;
342
355
  if (!parsed.has(target)) add(diagnostics, "error", "LOCAL_REFERENCE_MISSING", source + itemPath, `Missing local reference: ${target}`);
@@ -369,8 +382,10 @@ async function initializePackage(directory, packageName) {
369
382
  await mkdir(path.join(directory, "rag"), { recursive: true });
370
383
  await mkdir(path.join(directory, "skills"), { recursive: true });
371
384
  await mkdir(path.join(directory, "stores"), { recursive: true });
385
+ await mkdir(path.join(directory, "artifacts"), { recursive: true });
386
+ await mkdir(path.join(directory, "knowledge"), { recursive: true });
372
387
  await mkdir(path.join(directory, "files"), { recursive: true });
373
- const manifest = { schema: "agents24.package/v1", name: packageSlug, description: `${packageName} agent package`, resources: ["workflows/main.yaml"], requires: { models: { primary: { required: true, capability: "chat" } } } };
388
+ const manifest = { schema: "agents24.package/v2", name: packageSlug, description: `${packageName} agent package`, resources: [{ key: "main", path: "workflows/main.yaml" }], requires: { models: { primary: { required: true, capability: "chat" } } } };
374
389
  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" }] };
375
390
  const agent = `---
376
391
  schema: agents24.agent/v1
@@ -419,12 +434,6 @@ function parseMappings(items) {
419
434
  function shouldPromptForDependency(dependency) {
420
435
  return dependency.kind !== "model";
421
436
  }
422
- function assertInstallPreviewReady(preview) {
423
- if (preview.can_import === true) return;
424
- const blockers = Array.isArray(preview.blockers) ? preview.blockers : [];
425
- const message = String(blockers[0]?.message || "Package cannot be installed");
426
- throw new Error(message);
427
- }
428
437
  function assertImportAllowed(preview, options) {
429
438
  const resources = Array.isArray(preview.resources) ? preview.resources : [];
430
439
  if (resources.some((item) => item.status === "incomplete") && !options.allowIncomplete) {
@@ -444,7 +453,6 @@ export {
444
453
  createRemoteClient,
445
454
  parseMappings,
446
455
  shouldPromptForDependency,
447
- assertInstallPreviewReady,
448
456
  assertImportAllowed
449
457
  };
450
- //# sourceMappingURL=chunk-MNGBA3HP.js.map
458
+ //# sourceMappingURL=chunk-NLUCQTMN.js.map
@@ -0,0 +1 @@
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|txt|html|json|csv|py|js|mjs|ts)$/.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|artifacts|files|knowledge)\\//;\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\",\"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/2.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, formats: { uri: true } });\nconst validators = Object.fromEntries([\"manifest\",\"workflow\",\"agent\",\"rag\",\"skill\",\"store\",\"artifact\"].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 if ([\".agents24\", \".git\", \"node_modules\"].includes(entry.name) || [\".env.local\", \".gitignore\"].includes(entry.name)) continue;\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|txt|html|json|csv|py|js|mjs|ts)$/.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\"|\"artifact\"|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 (/^artifacts\\/[a-z0-9][a-z0-9-]*\\/artifact\\.yaml$/.test(filePath)) kind = \"artifact\";\n else if (/^artifacts\\/[a-z0-9][a-z0-9-]*\\/src\\/.+\\.(?:py|js|mjs|ts)$/.test(filePath)) { parsed.set(filePath, {}); continue; }\n else if (/^knowledge\\/.+\\.(?:md|txt|html|json|csv)$/.test(filePath)) { parsed.set(filePath, {}); continue; }\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\" || kind === \"artifact\" ? 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\" : kind === \"skill\" ? \"instruction\" : kind, name: value.name });\n }\n const declarations = Array.isArray(manifest.resources) ? manifest.resources.filter((item): item is Record<string, unknown> => Boolean(item && typeof item === \"object\" && !Array.isArray(item))) : [];\n const declaredRows = declarations.map((item) => String(item.path || \"\"));\n const declaredKeys = declarations.map((item) => String(item.key || \"\"));\n if (declaredKeys.some((item, index) => item !== [...declaredKeys].sort()[index])) add(diagnostics, \"error\", \"RESOURCE_ORDER\", MANIFEST, \"resources must be sorted by key\");\n if (new Set(declaredKeys).size !== declaredKeys.length) add(diagnostics, \"error\", \"RESOURCE_KEY_DUPLICATE\", MANIFEST, \"resource keys must be unique\");\n if (new Set(declaredRows).size !== declaredRows.length) add(diagnostics, \"error\", \"RESOURCE_PATH_DUPLICATE\", MANIFEST, \"resource paths must be unique\");\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)) add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", source + itemPath, \"Platform UUIDs are forbidden in source packages\");\n if (URL_PATTERN.test(item) && !(\n source.startsWith(\"artifacts/\")\n && [\"/development/base_url\", \"/production/base_url\"].includes(itemPath)\n )) add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", source + itemPath, \"URLs are allowed only in schema-owned connection fields\");\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 = item.startsWith(\"../\") || item.startsWith(\"./\") ? resolve(source, item) : null;\n const platformTarget = Boolean(target && /^(workflows|rag|skills|stores|artifacts)\\//.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, \"artifacts\"), { recursive: true });\n await mkdir(path.join(directory, \"knowledge\"), { recursive: true });\n await mkdir(path.join(directory, \"files\"), { recursive: true });\n const manifest = { schema: \"agents24.package/v2\", name: packageSlug, description: `${packageName} agent package`, resources: [{ key: \"main\", path: \"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};\ntype ResourceInstallationPlanUpload = ResourcePackageUpload & { installationId?: string; prune?: boolean; development?: boolean };\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 resourceInstallations: {\n list(): Promise<Record<string, unknown>>;\n create(request: { package_name: string; operation_id: string }, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n get(id: string): Promise<Record<string, unknown>>;\n plan(upload: ResourceInstallationPlanUpload): Promise<Record<string, unknown>>;\n link(id: string, request: { resource_key: string; resource_id: string }, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n configureSecrets(id: string, request: { secrets: Record<string, string> }, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n apply(operationId: string, request: Record<string, unknown>, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n operationStatus(operationId: string): Promise<Record<string, unknown>>;\n publish(id: string, request: { package_hash: string }, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n prepareDevelopmentSession(id: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;\n developmentSessionStatus(id: string, resourceKey: string): Promise<Record<string, unknown>>;\n revokeDevelopmentSession(id: string, sessionId: string, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n bindDeployment(id: string, request: { client_deployment_id: string | null }, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n resources(options: { kind: string; query?: string; limit?: number }): 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: {\n create(request: Record<string, unknown>, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n get(id: string): Promise<Record<string, unknown>>;\n };\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 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,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,UAAU;AAC1D,MAAI,QAAQ;AACZ,WAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG;AACnC,YAAS,QAAQ,IAAK,aAAc,UAAU,IAAK,UAAU;AAAA,EAC/D;AACA,SAAO,UAAU;AACnB,CAAC;AAED,SAAS,MAAM,OAA2B;AACxC,MAAI,MAAM;AACV,aAAW,QAAQ,MAAO,OAAM,WAAW,MAAM,QAAQ,GAAI,IAAK,QAAQ;AAC1E,UAAQ,MAAM,gBAAgB;AAChC;AAEA,SAAS,SAAS,KAAqB;AACrC,MAAI,CAAC,OAAO,IAAI,WAAW,GAAG,KAAK,IAAI,SAAS,IAAI,EAAG,OAAM,IAAI,MAAM,iCAAiC;AACxG,QAAM,QAAQ,IAAI,MAAM,GAAG;AAC3B,MAAI,MAAM,KAAK,CAAC,SAAS,CAAC,QAAQ,SAAS,OAAO,SAAS,IAAI,EAAG,OAAM,IAAI,MAAM,iCAAiC;AACnH,MAAI,M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