@agents24/cli 0.2.0 → 0.3.1
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 +12 -6
- package/compatibility.json +6 -6
- package/dist/{chunk-NLUCQTMN.js → chunk-YOT3B62P.js} +130 -8
- package/dist/chunk-YOT3B62P.js.map +1 -0
- package/dist/cli.js +633 -342
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +20 -10
- package/dist/index.js +7 -1
- package/generated/schemas/resource-package/2.0/agent.schema.json +20 -3
- package/generated/schemas/resource-package/2.0/manifest.schema.json +5 -0
- package/generated/schemas/resource-package/2.0/rag.schema.json +16 -2
- package/generated/schemas/resource-package/2.0/store.schema.json +1 -1
- package/generated/schemas/resource-package/2.0/workflow.schema.json +58 -2
- package/package.json +2 -2
- package/dist/chunk-NLUCQTMN.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@agents24/cli`
|
|
2
2
|
|
|
3
|
-
Last Updated: 2026-08-
|
|
3
|
+
Last Updated: 2026-08-23
|
|
4
4
|
|
|
5
5
|
Command-line tooling for editable `agents24.resource_package` source packages.
|
|
6
6
|
|
|
@@ -10,6 +10,7 @@ Requires Node.js 22 or newer.
|
|
|
10
10
|
agents24 package init ./customer-service --name "Customer Service"
|
|
11
11
|
agents24 package validate ./customer-service
|
|
12
12
|
agents24 package pack ./customer-service
|
|
13
|
+
agents24 fork ./customer-service ./customer-service-copy
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
`init`, `validate`, and `pack` work offline. Add `--remote` to `validate` for canonical platform graph/operator validation.
|
|
@@ -20,21 +21,26 @@ Remote commands use the canonical `@agents24/node` client. `AGENTS24_API_KEY` is
|
|
|
20
21
|
|
|
21
22
|
```bash
|
|
22
23
|
agents24 package export --kind agent --id <id> --target draft
|
|
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
26
|
agents24 prepare ./customer-service
|
|
27
27
|
agents24 plan ./customer-service
|
|
28
28
|
agents24 apply ./customer-service
|
|
29
|
+
agents24 status ./customer-service
|
|
30
|
+
agents24 pull ./customer-service
|
|
31
|
+
agents24 status ./customer-service
|
|
29
32
|
agents24 publish ./customer-service
|
|
33
|
+
agents24 status ./customer-service
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
Package V2 uses stable resource keys
|
|
36
|
+
Package V2 requires a cryptographically generated source-owned `package_id` and uses stable resource keys. The same package automatically reconciles the same organization installation from any computer. `fork` copies validated source into an absent or empty target, assigns a new package identity/name, preserves resource keys, and excludes local secrets/state, Git data, dependencies, and build output. `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**. Interactive apply offers exact candidate selection for unresolved external requirements; noninteractive apply requires an explicit `link`. `pull` previews platform-draft changes as Git-like `A`/`M`/`D` file updates, then platform-wins overwrites package-owned files through a rollback-safe local transaction when accepted. Pulled external references remain symbolic in source while their exact IDs are retained as installation mappings. Local-only files, `.env.local`, Remote Artifact development metadata, and self-hosted Artifact server source stay local. `publish` rejects source changed since its successful synchronized snapshot, then atomically promotes production-ready drafts. `setup` performs apply, publish, and detected-app configuration. `status` reports resource mappings, effective draft/published callable attachment health, `latest_pull`, `last_sync_direction`, `last_synchronized_at`, `synchronized_package_hash`, and divergence from the synchronized snapshot, including `registry_kind` and any attached `toolset_id`/`toolset_key` when an export resolves to a Toolset; investigate an unhealthy binding before runtime testing instead of changing prompts to compensate. `link --resource <key>=<uuid>` explicitly adopts existing same-organization resources or symbolic requirements; `resources list --kind <kind>` aids discovery. `package import` remains create-only cloning. There is no top-level `install` command.
|
|
33
37
|
|
|
34
38
|
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.
|
|
35
39
|
|
|
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.
|
|
40
|
+
The API key comes only from `AGENTS24_API_KEY` or an interactive masked prompt; `--api-key` is rejected. When a package is inside an app, lifecycle commands automatically load the parent app `.env.local`, then the package `.env.local`, without overriding explicit shell values. This makes `agents24 pull ./agents24` use the generated BFF's server-only key as one command. Lifecycle success/failure output uses explicit safe projections and never returns the internal client, API key, package path, or secret values. 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. Use `--yes` for deliberate noninteractive confirmation in coding-agent or CI workflows.
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
Lifecycle commands resolve installations only by organization plus manifest `package_id`; they neither create a local installation pointer nor read an installation-ID environment override. Packages without a valid ID fail with guidance to use `agents24 fork`. `apply` is durable, resumable, and connectionless for self-hosted Artifacts. Deleted declarations are retained by default; `apply --prune` removes only plan-confirmed resources. Pull always performs platform draft -> Bundle projection -> canonical package files -> recompilation -> semantic equality. Any portable mismatch is a platform defect surfaced as `RESOURCE_PACKAGE_SERIALIZATION_FAILED` with only safe diagnostics such as kind, stable key, and field path; no local files, mappings, or sync state are written. Plain `dev` starts or attaches declared local self-hosted Artifact servers and opens one managed authenticated relay connection per selected Artifact. It does not apply or reapply drafts. `agents24 dev <package> --apply` is only a shortcut for one `prepare -> apply -> relay connect` sequence. Transport stays `connecting` while the contract verifies; a healthy replacement becomes `connected` only after live catalog and binding synchronization succeeds, then supersedes the prior relay. The CLI automatically detects manifest changes every two seconds, while the backend authoritatively re-verifies them. 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.
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
Artifact development servers are framework-neutral. A configured `development.command` plus `args` runs directly with `shell: false`; omit the command to attach to an existing localhost server. Use watch mode in the server command for code reload, such as `node --watch src/server.mjs` or `uvicorn app:app --reload --host 127.0.0.1 --port 4312`. The relay's automatic manifest synchronization is independent of that language-specific hot reload.
|
|
45
|
+
|
|
46
|
+
The canonical tree is `agents24.yaml`, Workflows, Agent Markdown, RAG, Skills, Stores, optional Artifacts/source trees, managed `knowledge/` content, and optional `files/`. A local Artifact callable uses `kind: artifact`, a relative `uses` path, an explicit `export`, and optional `load: static|dynamic`; the verified manifest determines whether that export is exactly one Tool or exactly one Toolset. Toolset exports attach as Toolsets and are not flattened into member Tools. `$artifacts.*` and `$toolsets.*` are only external requirements. See the [resource movement guide](https://docs.agents24.dev/guides/move-resource-packages) and [manifest schema](https://docs.agents24.dev/schemas/resource-package/2.0/manifest.schema.json).
|
package/compatibility.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractHash": "
|
|
3
|
-
"contractVersion": "0.
|
|
2
|
+
"contractHash": "55fa8df5285c62edb41ce640b217eafbb17f32296ead83ae1b8d34c96d0c21f1",
|
|
3
|
+
"contractVersion": "0.3.0",
|
|
4
4
|
"corpus": "conformance/v1/corpus.json",
|
|
5
5
|
"generatedBy": "@agents24/sdk-contract",
|
|
6
6
|
"packages": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"runtime": "run-stream.v3"
|
|
20
20
|
},
|
|
21
21
|
"@agents24/node": {
|
|
22
|
-
"contract": "
|
|
22
|
+
"contract": "55fa8df5285c62edb41ce640b217eafbb17f32296ead83ae1b8d34c96d0c21f1",
|
|
23
23
|
"node": "^22.0.0 || ^24.0.0"
|
|
24
24
|
},
|
|
25
25
|
"@agents24/react": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"protocolOwner": "@agents24/client"
|
|
32
32
|
},
|
|
33
33
|
"agents24": {
|
|
34
|
-
"contract": "
|
|
34
|
+
"contract": "55fa8df5285c62edb41ce640b217eafbb17f32296ead83ae1b8d34c96d0c21f1",
|
|
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":
|
|
52
|
-
"python":
|
|
51
|
+
"node": 106,
|
|
52
|
+
"python": 99
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -171,16 +171,18 @@ function unpackFiles(value) {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
// src/package-source.ts
|
|
174
|
-
import { lstat, mkdir, readFile, readdir, stat, writeFile } from "fs/promises";
|
|
174
|
+
import { copyFile, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "fs/promises";
|
|
175
175
|
import { readFileSync as readSync } from "fs";
|
|
176
176
|
import path from "path";
|
|
177
177
|
import { fileURLToPath } from "url";
|
|
178
|
+
import { randomBytes } from "crypto";
|
|
178
179
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
179
180
|
import { parseDocument } from "yaml";
|
|
180
181
|
var MANIFEST = "agents24.yaml";
|
|
182
|
+
var PACKAGE_ROOTS = /* @__PURE__ */ new Set(["workflows", "agents", "rag", "skills", "stores", "artifacts", "files", "knowledge"]);
|
|
183
|
+
var PACKAGE_ID = /^pkg_[0-9a-f]{32}$/;
|
|
181
184
|
var SYMBOL = /^\$(workflows|rag|skills|models|stores|tools|toolsets|artifacts|integrations|secrets)\.([a-z0-9]+(?:-[a-z0-9]+)*)$/;
|
|
182
185
|
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
|
-
var URL_PATTERN = /\b[A-Za-z][A-Za-z0-9+.-]*:\/\//;
|
|
184
186
|
var LOCAL = /^(workflows|agents|rag|skills|stores|artifacts|files|knowledge)\//;
|
|
185
187
|
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
188
|
function add(rows, severity, code, itemPath, message) {
|
|
@@ -189,6 +191,9 @@ function add(rows, severity, code, itemPath, message) {
|
|
|
189
191
|
function slug(value) {
|
|
190
192
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "agent";
|
|
191
193
|
}
|
|
194
|
+
function createPackageId() {
|
|
195
|
+
return `pkg_${randomBytes(16).toString("hex")}`;
|
|
196
|
+
}
|
|
192
197
|
function parseYaml(text, itemPath, diagnostics) {
|
|
193
198
|
const doc = parseDocument(text, { uniqueKeys: true });
|
|
194
199
|
for (const error of doc.errors) add(diagnostics, "error", "YAML_INVALID", itemPath, error.message);
|
|
@@ -225,6 +230,7 @@ async function directoryFiles(root) {
|
|
|
225
230
|
async function visit(directory) {
|
|
226
231
|
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
227
232
|
if ([".agents24", ".git", "node_modules"].includes(entry.name) || [".env.local", ".gitignore"].includes(entry.name)) continue;
|
|
233
|
+
if (directory === root && entry.name !== MANIFEST && !PACKAGE_ROOTS.has(entry.name)) continue;
|
|
228
234
|
const absolute = path.join(directory, entry.name);
|
|
229
235
|
const relative = path.relative(root, absolute).split(path.sep).join("/");
|
|
230
236
|
const metadata = await lstat(absolute);
|
|
@@ -274,7 +280,7 @@ function validateFiles(files) {
|
|
|
274
280
|
validateSchema("manifest", manifest, MANIFEST, diagnostics);
|
|
275
281
|
walk(manifest, (item, itemPath, key) => {
|
|
276
282
|
if (key && SECRET_FIELDS.has(key.toLowerCase())) add(diagnostics, "error", "FORBIDDEN_FIELD", MANIFEST + itemPath, "Secret and platform identity fields are forbidden");
|
|
277
|
-
if (typeof item === "string" &&
|
|
283
|
+
if (typeof item === "string" && UUID.test(item)) add(diagnostics, "error", "FORBIDDEN_VALUE", MANIFEST + itemPath, "Platform UUIDs are forbidden in source packages");
|
|
278
284
|
});
|
|
279
285
|
const parsed = /* @__PURE__ */ new Map();
|
|
280
286
|
const resources = [];
|
|
@@ -303,8 +309,8 @@ function validateFiles(files) {
|
|
|
303
309
|
}
|
|
304
310
|
const value = kind === "workflow" || kind === "rag" || kind === "store" || kind === "artifact" ? parseYaml(text, filePath, diagnostics) : frontmatter(text, filePath, diagnostics);
|
|
305
311
|
validateSchema(kind, value, filePath, diagnostics);
|
|
306
|
-
if ((kind === "agent" || kind === "skill") &&
|
|
307
|
-
add(diagnostics, "error", "FORBIDDEN_VALUE", `${filePath}/body`, "Platform UUIDs
|
|
312
|
+
if ((kind === "agent" || kind === "skill") && UUID.test(markdownBody(text).trim())) {
|
|
313
|
+
add(diagnostics, "error", "FORBIDDEN_VALUE", `${filePath}/body`, "Platform UUIDs are forbidden in source packages");
|
|
308
314
|
}
|
|
309
315
|
parsed.set(filePath, value);
|
|
310
316
|
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 });
|
|
@@ -341,7 +347,6 @@ function validateFiles(files) {
|
|
|
341
347
|
if (key && SECRET_FIELDS.has(key.toLowerCase())) add(diagnostics, "error", "FORBIDDEN_FIELD", source + itemPath, "Secret and platform identity fields are forbidden");
|
|
342
348
|
if (typeof item !== "string") return;
|
|
343
349
|
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");
|
|
345
350
|
const symbol = SYMBOL.exec(item);
|
|
346
351
|
if (symbol) {
|
|
347
352
|
referenceCount += 1;
|
|
@@ -375,6 +380,89 @@ async function packPackage(input) {
|
|
|
375
380
|
if (!result.valid) throw Object.assign(new Error("Resource package is invalid"), { diagnostics: result.diagnostics });
|
|
376
381
|
return packFiles(result.files);
|
|
377
382
|
}
|
|
383
|
+
async function packPackageSnapshot(input) {
|
|
384
|
+
return packFiles(await loadPackageFiles(input));
|
|
385
|
+
}
|
|
386
|
+
async function replacePackageFiles(directory, proposed, afterWrite) {
|
|
387
|
+
const root = path.resolve(directory);
|
|
388
|
+
if (!(await stat(root)).isDirectory()) throw new Error("pull requires a Resource Package directory");
|
|
389
|
+
const files = new Map(Object.entries(proposed));
|
|
390
|
+
const current = await directoryFiles(root);
|
|
391
|
+
preserveLocalSelfHostedArtifactSources(current, files);
|
|
392
|
+
const validated = validateFiles(files);
|
|
393
|
+
if (!validated.valid) throw Object.assign(new Error("Pulled Resource Package is invalid"), { diagnostics: validated.diagnostics });
|
|
394
|
+
const changed = [.../* @__PURE__ */ new Set([...current.keys(), ...files.keys()])].filter((item) => current.get(item) !== files.get(item));
|
|
395
|
+
const staging = await mkdtemp(path.join(path.dirname(root), ".agents24-pull-"));
|
|
396
|
+
const backups = path.join(staging, "backups");
|
|
397
|
+
const writes = path.join(staging, "writes");
|
|
398
|
+
const existing = /* @__PURE__ */ new Set();
|
|
399
|
+
try {
|
|
400
|
+
for (const relative of changed) {
|
|
401
|
+
const destination = safeDestination(root, relative);
|
|
402
|
+
if (current.has(relative)) {
|
|
403
|
+
existing.add(relative);
|
|
404
|
+
const backup = path.join(backups, relative);
|
|
405
|
+
await mkdir(path.dirname(backup), { recursive: true });
|
|
406
|
+
await copyFile(destination, backup);
|
|
407
|
+
}
|
|
408
|
+
if (files.has(relative)) {
|
|
409
|
+
const staged = path.join(writes, relative);
|
|
410
|
+
await mkdir(path.dirname(staged), { recursive: true });
|
|
411
|
+
await writeFile(staged, files.get(relative), "utf8");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
for (const relative of changed) {
|
|
415
|
+
const destination = safeDestination(root, relative);
|
|
416
|
+
if (!files.has(relative)) {
|
|
417
|
+
await rm(destination, { force: true });
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
421
|
+
await rename(path.join(writes, relative), destination);
|
|
422
|
+
}
|
|
423
|
+
if (afterWrite) await afterWrite();
|
|
424
|
+
} catch (error) {
|
|
425
|
+
for (const relative of changed) {
|
|
426
|
+
const destination = safeDestination(root, relative);
|
|
427
|
+
if (!existing.has(relative)) {
|
|
428
|
+
await rm(destination, { force: true });
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
432
|
+
await copyFile(path.join(backups, relative), destination);
|
|
433
|
+
}
|
|
434
|
+
throw error;
|
|
435
|
+
} finally {
|
|
436
|
+
await rm(staging, { recursive: true, force: true });
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function preserveLocalSelfHostedArtifactSources(current, proposed) {
|
|
440
|
+
const prefixes = /* @__PURE__ */ new Set([
|
|
441
|
+
...selfHostedArtifactSourcePrefixes(current),
|
|
442
|
+
...selfHostedArtifactSourcePrefixes(proposed)
|
|
443
|
+
]);
|
|
444
|
+
for (const [filePath, content] of current) {
|
|
445
|
+
if ([...prefixes].some((prefix) => filePath.startsWith(prefix))) proposed.set(filePath, content);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function selfHostedArtifactSourcePrefixes(files) {
|
|
449
|
+
const diagnostics = [];
|
|
450
|
+
const manifest = parseYaml(files.get(MANIFEST) || "", MANIFEST, diagnostics);
|
|
451
|
+
const resources = Array.isArray(manifest.resources) ? manifest.resources : [];
|
|
452
|
+
return resources.flatMap((resource) => {
|
|
453
|
+
if (!resource || typeof resource !== "object" || Array.isArray(resource)) return [];
|
|
454
|
+
const artifactPath = String(resource.path || "");
|
|
455
|
+
if (!/^artifacts\/[a-z0-9][a-z0-9-]*\/artifact\.yaml$/.test(artifactPath)) return [];
|
|
456
|
+
const source = parseYaml(files.get(artifactPath) || "", artifactPath, diagnostics);
|
|
457
|
+
return source.execution_target === "self_hosted" ? [artifactPath.replace(/artifact\.yaml$/, "src/")] : [];
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function safeDestination(root, relative) {
|
|
461
|
+
if (!relative || relative.startsWith("/") || relative.includes("\\")) throw new Error("Pulled package contains an unsafe path");
|
|
462
|
+
const destination = path.resolve(root, relative);
|
|
463
|
+
if (!destination.startsWith(`${root}${path.sep}`)) throw new Error("Pulled package contains an unsafe path");
|
|
464
|
+
return destination;
|
|
465
|
+
}
|
|
378
466
|
async function initializePackage(directory, packageName) {
|
|
379
467
|
const packageSlug = slug(packageName);
|
|
380
468
|
await mkdir(path.join(directory, "workflows"), { recursive: true });
|
|
@@ -385,7 +473,7 @@ async function initializePackage(directory, packageName) {
|
|
|
385
473
|
await mkdir(path.join(directory, "artifacts"), { recursive: true });
|
|
386
474
|
await mkdir(path.join(directory, "knowledge"), { recursive: true });
|
|
387
475
|
await mkdir(path.join(directory, "files"), { recursive: true });
|
|
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" } } } };
|
|
476
|
+
const manifest = { schema: "agents24.package/v2", package_id: createPackageId(), name: packageSlug, description: `${packageName} agent package`, resources: [{ key: "main", path: "workflows/main.yaml" }], requires: { models: { primary: { required: true, capability: "chat" } } } };
|
|
389
477
|
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" }] };
|
|
390
478
|
const agent = `---
|
|
391
479
|
schema: agents24.agent/v1
|
|
@@ -401,6 +489,36 @@ You are a helpful assistant.
|
|
|
401
489
|
await writeFile(path.join(directory, "agents/assistant.md"), agent, { flag: "wx" });
|
|
402
490
|
return packageSlug;
|
|
403
491
|
}
|
|
492
|
+
async function forkPackage(source, target, requestedName) {
|
|
493
|
+
const sourceFiles = await loadPackageFiles(source);
|
|
494
|
+
const diagnostics = [];
|
|
495
|
+
const manifest = parseYaml(sourceFiles.get(MANIFEST) || "", MANIFEST, diagnostics);
|
|
496
|
+
if (diagnostics.length) throw Object.assign(new Error("Resource package manifest is invalid"), { diagnostics });
|
|
497
|
+
const packageName = slug(requestedName || path.basename(path.resolve(target)));
|
|
498
|
+
const packageId = createPackageId();
|
|
499
|
+
manifest.package_id = packageId;
|
|
500
|
+
manifest.name = packageName;
|
|
501
|
+
sourceFiles.set(MANIFEST, _yaml(manifest));
|
|
502
|
+
const validated = validateFiles(sourceFiles);
|
|
503
|
+
if (!validated.valid) throw Object.assign(new Error("Resource package is invalid"), { diagnostics: validated.diagnostics });
|
|
504
|
+
let targetExists = true;
|
|
505
|
+
try {
|
|
506
|
+
const metadata = await stat(target);
|
|
507
|
+
if (!metadata.isDirectory()) throw new Error("Fork target must be a directory");
|
|
508
|
+
if ((await readdir(target)).length) throw new Error("Fork target directory must be empty");
|
|
509
|
+
} catch (error) {
|
|
510
|
+
if (error.code === "ENOENT") targetExists = false;
|
|
511
|
+
else throw error;
|
|
512
|
+
}
|
|
513
|
+
if (!targetExists) await mkdir(target, { recursive: true });
|
|
514
|
+
for (const [relative, content] of validated.files) {
|
|
515
|
+
const destination = path.join(target, relative);
|
|
516
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
517
|
+
await writeFile(destination, content, { flag: "wx" });
|
|
518
|
+
}
|
|
519
|
+
if (!PACKAGE_ID.test(packageId)) throw new Error("Generated package identity is invalid");
|
|
520
|
+
return { name: packageName, packageId };
|
|
521
|
+
}
|
|
404
522
|
function _yaml(value) {
|
|
405
523
|
const doc = parseDocument("{}");
|
|
406
524
|
doc.contents = doc.createNode(value);
|
|
@@ -445,14 +563,18 @@ function assertImportAllowed(preview, options) {
|
|
|
445
563
|
export {
|
|
446
564
|
packFiles,
|
|
447
565
|
unpackFiles,
|
|
566
|
+
createPackageId,
|
|
448
567
|
loadPackageFiles,
|
|
449
568
|
validateFiles,
|
|
450
569
|
validatePackage,
|
|
451
570
|
packPackage,
|
|
571
|
+
packPackageSnapshot,
|
|
572
|
+
replacePackageFiles,
|
|
452
573
|
initializePackage,
|
|
574
|
+
forkPackage,
|
|
453
575
|
createRemoteClient,
|
|
454
576
|
parseMappings,
|
|
455
577
|
shouldPromptForDependency,
|
|
456
578
|
assertImportAllowed
|
|
457
579
|
};
|
|
458
|
-
//# sourceMappingURL=chunk-
|
|
580
|
+
//# sourceMappingURL=chunk-YOT3B62P.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 { copyFile, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport { readFileSync as readSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { randomBytes } from \"node:crypto\";\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 PACKAGE_ROOTS = new Set([\"workflows\", \"agents\", \"rag\", \"skills\", \"stores\", \"artifacts\", \"files\", \"knowledge\"]);\nconst PACKAGE_ID = /^pkg_[0-9a-f]{32}$/;\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 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}\nexport function createPackageId(): string {\n return `pkg_${randomBytes(16).toString(\"hex\")}`;\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 if (directory === root && entry.name !== MANIFEST && !PACKAGE_ROOTS.has(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)) add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", MANIFEST + itemPath, \"Platform UUIDs 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())) {\n add(diagnostics, \"error\", \"FORBIDDEN_VALUE\", `${filePath}/body`, \"Platform UUIDs 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 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}\n\nexport async function packPackageSnapshot(input: string): Promise<Uint8Array> {\n return packFiles(await loadPackageFiles(input));\n}\n\nexport async function replacePackageFiles(\n directory: string,\n proposed: Record<string, string>,\n afterWrite?: () => Promise<void>,\n): Promise<void> {\n const root = path.resolve(directory);\n if (!(await stat(root)).isDirectory()) throw new Error(\"pull requires a Resource Package directory\");\n const files = new Map(Object.entries(proposed));\n const current = await directoryFiles(root);\n preserveLocalSelfHostedArtifactSources(current, files);\n const validated = validateFiles(files);\n if (!validated.valid) throw Object.assign(new Error(\"Pulled Resource Package is invalid\"), { diagnostics: validated.diagnostics });\n const changed = [...new Set([...current.keys(), ...files.keys()])].filter((item) => current.get(item) !== files.get(item));\n const staging = await mkdtemp(path.join(path.dirname(root), \".agents24-pull-\"));\n const backups = path.join(staging, \"backups\");\n const writes = path.join(staging, \"writes\");\n const existing = new Set<string>();\n try {\n for (const relative of changed) {\n const destination = safeDestination(root, relative);\n if (current.has(relative)) {\n existing.add(relative);\n const backup = path.join(backups, relative);\n await mkdir(path.dirname(backup), { recursive: true });\n await copyFile(destination, backup);\n }\n if (files.has(relative)) {\n const staged = path.join(writes, relative);\n await mkdir(path.dirname(staged), { recursive: true });\n await writeFile(staged, files.get(relative)!, \"utf8\");\n }\n }\n for (const relative of changed) {\n const destination = safeDestination(root, relative);\n if (!files.has(relative)) {\n await rm(destination, { force: true });\n continue;\n }\n await mkdir(path.dirname(destination), { recursive: true });\n await rename(path.join(writes, relative), destination);\n }\n if (afterWrite) await afterWrite();\n } catch (error) {\n for (const relative of changed) {\n const destination = safeDestination(root, relative);\n if (!existing.has(relative)) {\n await rm(destination, { force: true });\n continue;\n }\n await mkdir(path.dirname(destination), { recursive: true });\n await copyFile(path.join(backups, relative), destination);\n }\n throw error;\n } finally {\n await rm(staging, { recursive: true, force: true });\n }\n}\n\nfunction preserveLocalSelfHostedArtifactSources(current: Map<string, string>, proposed: Map<string, string>): void {\n const prefixes = new Set([\n ...selfHostedArtifactSourcePrefixes(current),\n ...selfHostedArtifactSourcePrefixes(proposed),\n ]);\n for (const [filePath, content] of current) {\n if ([...prefixes].some((prefix) => filePath.startsWith(prefix))) proposed.set(filePath, content);\n }\n}\n\nfunction selfHostedArtifactSourcePrefixes(files: Map<string, string>): string[] {\n const diagnostics: Diagnostic[] = [];\n const manifest = parseYaml(files.get(MANIFEST) || \"\", MANIFEST, diagnostics);\n const resources = Array.isArray(manifest.resources) ? manifest.resources : [];\n return resources.flatMap((resource) => {\n if (!resource || typeof resource !== \"object\" || Array.isArray(resource)) return [];\n const artifactPath = String((resource as Record<string, unknown>).path || \"\");\n if (!/^artifacts\\/[a-z0-9][a-z0-9-]*\\/artifact\\.yaml$/.test(artifactPath)) return [];\n const source = parseYaml(files.get(artifactPath) || \"\", artifactPath, diagnostics);\n return source.execution_target === \"self_hosted\" ? [artifactPath.replace(/artifact\\.yaml$/, \"src/\")] : [];\n });\n}\n\nfunction safeDestination(root: string, relative: string): string {\n if (!relative || relative.startsWith(\"/\") || relative.includes(\"\\\\\")) throw new Error(\"Pulled package contains an unsafe path\");\n const destination = path.resolve(root, relative);\n if (!destination.startsWith(`${root}${path.sep}`)) throw new Error(\"Pulled package contains an unsafe path\");\n return destination;\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\", package_id: createPackageId(), 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}\nexport async function forkPackage(source: string, target: string, requestedName?: string): Promise<{ name: string; packageId: string }> {\n const sourceFiles = await loadPackageFiles(source);\n const diagnostics: Diagnostic[] = [];\n const manifest = parseYaml(sourceFiles.get(MANIFEST) || \"\", MANIFEST, diagnostics);\n if (diagnostics.length) throw Object.assign(new Error(\"Resource package manifest is invalid\"), { diagnostics });\n const packageName = slug(requestedName || path.basename(path.resolve(target)));\n const packageId = createPackageId();\n manifest.package_id = packageId;\n manifest.name = packageName;\n sourceFiles.set(MANIFEST, _yaml(manifest));\n const validated = validateFiles(sourceFiles);\n if (!validated.valid) throw Object.assign(new Error(\"Resource package is invalid\"), { diagnostics: validated.diagnostics });\n let targetExists = true;\n try {\n const metadata = await stat(target);\n if (!metadata.isDirectory()) throw new Error(\"Fork target must be a directory\");\n if ((await readdir(target)).length) throw new Error(\"Fork target directory must be empty\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") targetExists = false;\n else throw error;\n }\n if (!targetExists) await mkdir(target, { recursive: true });\n for (const [relative, content] of validated.files) {\n const destination = path.join(target, relative);\n await mkdir(path.dirname(destination), { recursive: true });\n await writeFile(destination, content, { flag: \"wx\" });\n }\n if (!PACKAGE_ID.test(packageId)) throw new Error(\"Generated package identity is invalid\");\n return { name: packageName, packageId };\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 ResourcePackageImportUpload = ResourcePackageUpload & { mappings?: Record<string, string> };\ntype ResourceInstallationPlanUpload = ResourcePackageUpload & { 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 importPreview(upload: ResourcePackageImportUpload): Promise<Record<string, unknown>>;\n importPackage(upload: ResourcePackageImportUpload, 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_id: string; package_name: string; operation_id: string }, options?: { idempotencyKey?: string }): Promise<Record<string, unknown>>;\n get(id: string): Promise<Record<string, unknown>>;\n getByPackageId(packageId: string): Promise<Record<string, unknown>>;\n plan(upload: ResourceInstallationPlanUpload): Promise<Record<string, unknown>>;\n planPull(id: string, upload: ResourcePackageUpload): Promise<Record<string, unknown>>;\n downloadPull(id: string, pullId: string): Promise<Record<string, unknown>>;\n acceptPull(id: string, pullId: string, request: { platform_snapshot_hash: string; package_hash: string }, options?: { idempotencyKey?: string }): 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,I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