@agimon-ai/po-domain 0.0.0-alpha.2 → 0.0.0-alpha.200
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/LICENSE +1 -1
- package/README.md +13 -50
- package/dist/agentArchive.cjs +110 -0
- package/dist/agentArchive.cjs.map +1 -0
- package/dist/agentArchive.d.mts +31 -0
- package/dist/agentArchive.d.mts.map +1 -0
- package/dist/agentArchive.mjs +106 -0
- package/dist/agentArchive.mjs.map +1 -0
- package/dist/apiContracts.cjs +134 -3
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -3
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +133 -3
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/apply.cjs +10 -8
- package/dist/apply.cjs.map +1 -1
- package/dist/apply.d.mts +4 -4
- package/dist/apply.d.mts.map +1 -1
- package/dist/apply.mjs +10 -8
- package/dist/apply.mjs.map +1 -1
- package/dist/{domainText-UIRIz6-_.cjs → domainText-CbpBLX_M.cjs} +2 -2
- package/dist/domainText-CbpBLX_M.cjs.map +1 -0
- package/dist/{domainText-Dm8k7p4z.mjs → domainText-D0iurn8D.mjs} +2 -2
- package/dist/domainText-D0iurn8D.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +6 -6
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts +1 -1
- package/dist/extensions/mcp.mjs +6 -6
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/native.mjs +3 -1
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +939 -105
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +2 -2
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +942 -107
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +1351 -2
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.mts +10 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/mcp.cjs +2 -2
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.mts +13 -12
- package/dist/mcp.d.mts.map +1 -1
- package/dist/mcp.mjs +3 -3
- package/dist/mcp.mjs.map +1 -1
- package/dist/{mcpFilter-Cf-czy8O.mjs → mcpFilter-CKUbKmxz.mjs} +41 -28
- package/dist/mcpFilter-CKUbKmxz.mjs.map +1 -0
- package/dist/{mcpFilter-CZNmU_VF.cjs → mcpFilter-CghXZ2K-.cjs} +45 -26
- package/dist/mcpFilter-CghXZ2K-.cjs.map +1 -0
- package/dist/{pluginMaterializer-D9-oDF-b.mjs → pluginMaterializer-CNX7M_eh.mjs} +84 -29
- package/dist/pluginMaterializer-CNX7M_eh.mjs.map +1 -0
- package/dist/{pluginMaterializer-C8IZ1PSY.cjs → pluginMaterializer-Cymk7Zbe.cjs} +85 -30
- package/dist/pluginMaterializer-Cymk7Zbe.cjs.map +1 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.mts +6 -0
- package/dist/plugins.d.mts.map +1 -1
- package/dist/plugins.mjs +1 -2
- package/dist/po-runtime-identity.json +1 -0
- package/dist/{resourceCollector-Cu-lp5hJ.cjs → resourceCollector-BvbGSCpL.cjs} +119 -148
- package/dist/resourceCollector-BvbGSCpL.cjs.map +1 -0
- package/dist/{resourceCollector-CRY5cmeY.mjs → resourceCollector-DEk01mPk.mjs} +108 -149
- package/dist/resourceCollector-DEk01mPk.mjs.map +1 -0
- package/dist/{resources-BEjxE3Zn.d.mts → resources-CZN-MUte.d.mts} +16 -10
- package/dist/resources-CZN-MUte.d.mts.map +1 -0
- package/dist/resources.cjs +3 -1
- package/dist/resources.d.mts +28 -7
- package/dist/resources.d.mts.map +1 -1
- package/dist/resources.mjs +1 -2
- package/dist/{toolNames-Cuu-u8r1.cjs → toolNames-CIp8IdhR.cjs} +9 -9
- package/dist/toolNames-CIp8IdhR.cjs.map +1 -0
- package/dist/{toolNames-Ckp5VLMD.mjs → toolNames-L4VE90mU.mjs} +9 -9
- package/dist/toolNames-L4VE90mU.mjs.map +1 -0
- package/dist/zip-Bl6pG9Ap.mjs +68 -0
- package/dist/zip-Bl6pG9Ap.mjs.map +1 -0
- package/dist/zip-DA9sck3v.cjs +75 -0
- package/dist/zip-DA9sck3v.cjs.map +1 -0
- package/llms.txt +4 -4
- package/package.json +51 -21
- package/src/prompts/{po-author-domain → help-how-to-domain}/SKILL.md +1 -1
- package/src/prompts/{po-author-domain → help-how-to-domain}/references/domains-contract.md +21 -2
- package/dist/domainText-Dm8k7p4z.mjs.map +0 -1
- package/dist/domainText-UIRIz6-_.cjs.map +0 -1
- package/dist/mcpFilter-CZNmU_VF.cjs.map +0 -1
- package/dist/mcpFilter-Cf-czy8O.mjs.map +0 -1
- package/dist/pluginMaterializer-C8IZ1PSY.cjs.map +0 -1
- package/dist/pluginMaterializer-D9-oDF-b.mjs.map +0 -1
- package/dist/resourceCollector-CRY5cmeY.mjs.map +0 -1
- package/dist/resourceCollector-Cu-lp5hJ.cjs.map +0 -1
- package/dist/resources-BEjxE3Zn.d.mts.map +0 -1
- package/dist/toolNames-Ckp5VLMD.mjs.map +0 -1
- package/dist/toolNames-Cuu-u8r1.cjs.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,71 +1,34 @@
|
|
|
1
1
|
# @agimon-ai/po-domain
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Domains select composable plugin content for a Po session: skills, agents, and MCP configuration. They are separate from the runtime layers selected by a preset.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
and the minor modes. Unlike a major mode, domains compose: a session selects a set of them, and
|
|
7
|
-
the union of what they contribute is what the model sees.
|
|
5
|
+
The distribution loads this package as fixed host infrastructure. It reads `.po/domains.yaml`; do not add the package to a layer.
|
|
8
6
|
|
|
9
7
|
```yaml
|
|
10
8
|
# .po/domains.yaml
|
|
11
9
|
plugins:
|
|
12
10
|
entries:
|
|
13
|
-
|
|
14
|
-
infra: plugins/infra
|
|
11
|
+
development: plugins/development
|
|
15
12
|
domains:
|
|
16
13
|
development:
|
|
17
|
-
description: Application code
|
|
18
|
-
plugins: [
|
|
19
|
-
mcp:
|
|
20
|
-
servers: [code-intel]
|
|
21
|
-
platform:
|
|
22
|
-
description: Deployment, infrastructure, and incident tooling.
|
|
23
|
-
plugins: [infra]
|
|
14
|
+
description: Application code and review guidance.
|
|
15
|
+
plugins: [development]
|
|
24
16
|
aliases:
|
|
25
|
-
|
|
17
|
+
coding: [development]
|
|
26
18
|
```
|
|
27
19
|
|
|
28
|
-
##
|
|
20
|
+
## Select domains
|
|
29
21
|
|
|
30
|
-
|
|
31
|
-
| ---------- | ----------------------------------------------------- |
|
|
32
|
-
| `/domains` | prints the selection, or switches to `name[,name...]` |
|
|
22
|
+
`/domains` shows or changes the selection. Domains compose: the model receives the union of their admitted content. Selecting a content plugin does not install the runtime capabilities its instructions mention.
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
`po-author-domain` skill. It provides package-owned guidance for plugin catalogs, domain
|
|
36
|
-
filters, aliases, defaults, shared skills, and MCP scopes in `domains.yaml`. The contribution is
|
|
37
|
-
registered through the session's `doom/help` Cordis service and is withdrawn with this package's
|
|
38
|
-
plugin fiber.
|
|
24
|
+
Applying a selection prepares trusted plugin sources, discovered skills and agents, and the session's MCP projection. Config publishes that projection for MCP to consume; Domain does not operate the live MCP runtime directly.
|
|
39
25
|
|
|
40
|
-
|
|
26
|
+
MCP filtering applies only when every selected domain declares an `mcp` allowlist. Mixing an opted-in domain with one that omits it leaves the selection unfiltered. An empty server list is not a deny-all rule. Treat these filters as composition choices, not an execution sandbox.
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
`@agimon-ai/po-config/selectionSwitch` with the major-mode and profile switches. Applying a
|
|
44
|
-
selection:
|
|
28
|
+
## Authoring guidance
|
|
45
29
|
|
|
46
|
-
-
|
|
47
|
-
cache guarded by an install marker;
|
|
48
|
-
- discovers the exact `SKILL.md` files behind the selection, through a manifest cache keyed by
|
|
49
|
-
worktree so a second session does not rescan the tree;
|
|
50
|
-
- adapts each plugin's Claude-authored agent definitions into the form Pi loads, and stages them
|
|
51
|
-
privately (`0600`) beside a dispatcher agent;
|
|
52
|
-
- merges the repository and legacy plugin `.mcp.json` layers, and validates root `mcp.json` for
|
|
53
|
-
schema-gated Agent Plugins v1 (including plugin-relative commands, data directories, and transport
|
|
54
|
-
normalization);
|
|
55
|
-
- applies the selected domains' MCP allowlists and rewrites the proxy's upstream list into a
|
|
56
|
-
private per-run config; and
|
|
57
|
-
- atomically stores an immutable MCP projection in harness state. Config publishes that snapshot through the session Cordis registry for Po MCP to
|
|
58
|
-
consume; Domain never reaches into the live MCP runtime.
|
|
59
|
-
|
|
60
|
-
An allowlist only takes effect once **every** selected domain declares one. Mixing a scoped domain
|
|
61
|
-
with a domain that has not opted in leaves the session unfiltered, so an unmigrated domain cannot
|
|
62
|
-
silently lose its tools.
|
|
63
|
-
|
|
64
|
-
## Installation
|
|
65
|
-
|
|
66
|
-
Po depends on this package and activates it as fixed host core, so a Po install already has
|
|
67
|
-
it. It is not selectable from `.po/modes.yaml`; it reads `.po/domains.yaml`.
|
|
30
|
+
With Help active, `help-how-to-domain` explains plugin catalogs, aliases, defaults, shared skills, and MCP scopes. Start with the [domain guide](./src/prompts/help-how-to-domain/SKILL.md), published through [`llms.txt`](./llms.txt).
|
|
68
31
|
|
|
69
32
|
## License
|
|
70
33
|
|
|
71
|
-
MIT
|
|
34
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_zip = require("./zip-DA9sck3v.cjs");
|
|
3
|
+
let node_buffer = require("node:buffer");
|
|
4
|
+
let _agimon_ai_po_core_verifiedArchive = require("@agimon-ai/po-core/verifiedArchive");
|
|
5
|
+
//#region src/services/agentArchive/index.ts
|
|
6
|
+
const MANIFEST_PATHS = [
|
|
7
|
+
"plugin.json",
|
|
8
|
+
".codex-plugin/plugin.json",
|
|
9
|
+
".claude-plugin/plugin.json",
|
|
10
|
+
".cursor-plugin/plugin.json"
|
|
11
|
+
];
|
|
12
|
+
const MAX_FILE_BYTES = 8388608;
|
|
13
|
+
const MAX_TAR_BYTES = 67108864;
|
|
14
|
+
const MAX_TGZ_BYTES = 33554432;
|
|
15
|
+
const BLOCK = 512;
|
|
16
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
17
|
+
/** Deterministic ustar, all files mode 0644, uid/gid/mtime zero. No input npm metadata survives. */
|
|
18
|
+
function npmTar(files) {
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let size = BLOCK * 2;
|
|
21
|
+
for (const [relative, body] of [...files].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
22
|
+
let name = `package/${relative}`;
|
|
23
|
+
let prefix = "";
|
|
24
|
+
if (node_buffer.Buffer.byteLength(name) > 100) {
|
|
25
|
+
const slash = name.lastIndexOf("/");
|
|
26
|
+
prefix = name.slice(0, slash);
|
|
27
|
+
name = name.slice(slash + 1);
|
|
28
|
+
}
|
|
29
|
+
if (node_buffer.Buffer.byteLength(name) > 100 || node_buffer.Buffer.byteLength(prefix) > 155) throw new Error("Agent archive path is too long.");
|
|
30
|
+
size += BLOCK + Math.ceil(body.length / BLOCK) * BLOCK;
|
|
31
|
+
if (size > MAX_TAR_BYTES) throw new Error("Normalized archive exceeds the expanded size limit.");
|
|
32
|
+
const header = node_buffer.Buffer.alloc(BLOCK);
|
|
33
|
+
const octal = (value, offset, width) => {
|
|
34
|
+
header.write(`${value.toString(8).padStart(width - 1, "0")}\0`, offset, width, "ascii");
|
|
35
|
+
};
|
|
36
|
+
header.write(name, 0, 100, "utf8");
|
|
37
|
+
octal(420, 100, 8);
|
|
38
|
+
octal(0, 108, 8);
|
|
39
|
+
octal(0, 116, 8);
|
|
40
|
+
octal(body.length, 124, 12);
|
|
41
|
+
octal(0, 136, 12);
|
|
42
|
+
header.fill(32, 148, 156);
|
|
43
|
+
header[156] = 48;
|
|
44
|
+
header.write("ustar\0", 257, 6, "ascii");
|
|
45
|
+
header.write("00", 263, 2, "ascii");
|
|
46
|
+
header.write(prefix, 345, 155, "utf8");
|
|
47
|
+
octal(header.reduce((sum, byte) => sum + byte, 0), 148, 8);
|
|
48
|
+
chunks.push(header, body, node_buffer.Buffer.alloc((BLOCK - body.length % BLOCK) % BLOCK));
|
|
49
|
+
}
|
|
50
|
+
chunks.push(node_buffer.Buffer.alloc(BLOCK * 2));
|
|
51
|
+
return chunks;
|
|
52
|
+
}
|
|
53
|
+
async function normalizeAgentFiles(files) {
|
|
54
|
+
const candidates = [...files.keys()].filter((path) => MANIFEST_PATHS.some((manifest) => path === manifest || path.endsWith(`/${manifest}`)));
|
|
55
|
+
if (candidates.length !== 1) throw new Error("An agent ZIP requires exactly one plugin manifest.");
|
|
56
|
+
const manifestPath = candidates[0];
|
|
57
|
+
const root = MANIFEST_PATHS.includes(manifestPath) ? "" : manifestPath.slice(0, manifestPath.indexOf("/") + 1);
|
|
58
|
+
if (!MANIFEST_PATHS.includes(manifestPath.slice(root.length))) throw new Error("Agent manifest must be at root or inside one wrapper folder.");
|
|
59
|
+
if (root && [...files.keys()].some((path) => !path.startsWith(root))) throw new Error("Agent ZIP has files outside its wrapper folder.");
|
|
60
|
+
const manifest = JSON.parse(decoder.decode(files.get(manifestPath)));
|
|
61
|
+
if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) throw new Error("Invalid agent manifest.");
|
|
62
|
+
const { name, version } = manifest;
|
|
63
|
+
if (typeof name !== "string" || name.length > 214 || !_agimon_ai_po_core_verifiedArchive.npmPackageName.test(name) || typeof version !== "string" || version.length > 128 || !_agimon_ai_po_core_verifiedArchive.exactPackageVersion.test(version)) throw new Error("The agent manifest requires an exact npm name and version.");
|
|
64
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
65
|
+
for (const [path, body] of files) {
|
|
66
|
+
const relative = path.slice(root.length);
|
|
67
|
+
if ([
|
|
68
|
+
"package.json",
|
|
69
|
+
"package-lock.json",
|
|
70
|
+
"npm-shrinkwrap.json",
|
|
71
|
+
".npmrc"
|
|
72
|
+
].includes(relative.split("/")[0])) continue;
|
|
73
|
+
normalized.set(relative, body);
|
|
74
|
+
}
|
|
75
|
+
normalized.set("package.json", new TextEncoder().encode(`${JSON.stringify({
|
|
76
|
+
name,
|
|
77
|
+
version
|
|
78
|
+
})}\n`));
|
|
79
|
+
return {
|
|
80
|
+
bytes: await packPluginFiles(normalized),
|
|
81
|
+
name,
|
|
82
|
+
version
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Pack a bounded, already checked set of relative paths without running package scripts. */
|
|
86
|
+
async function packPluginFiles(files) {
|
|
87
|
+
const chunks = npmTar(files)[Symbol.iterator]();
|
|
88
|
+
const tar = new ReadableStream({ pull(controller) {
|
|
89
|
+
const next = chunks.next();
|
|
90
|
+
if (next.done) controller.close();
|
|
91
|
+
else controller.enqueue(next.value);
|
|
92
|
+
} });
|
|
93
|
+
return (0, _agimon_ai_po_core_verifiedArchive.readBoundedBody)(tar.pipeThrough(new CompressionStream("gzip")), MAX_TGZ_BYTES);
|
|
94
|
+
}
|
|
95
|
+
/** Accept one agent manifest at root or inside one wrapper folder. Package identity comes only from it. */
|
|
96
|
+
async function normalizeAgentZip(bytes) {
|
|
97
|
+
const files = /* @__PURE__ */ new Map();
|
|
98
|
+
for await (const member of require_zip.readBoundedZip(bytes, {
|
|
99
|
+
fileBytes: MAX_FILE_BYTES,
|
|
100
|
+
entries: 4095
|
|
101
|
+
})) if (!member.directory) files.set(member.path, member.bytes);
|
|
102
|
+
return normalizeAgentFiles(files);
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
exports.normalizeAgentFiles = normalizeAgentFiles;
|
|
106
|
+
exports.normalizeAgentZip = normalizeAgentZip;
|
|
107
|
+
exports.packPluginFiles = packPluginFiles;
|
|
108
|
+
exports.readBoundedZip = require_zip.readBoundedZip;
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=agentArchive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentArchive.cjs","names":["Buffer","npmPackageName","exactPackageVersion","readBoundedBody","readBoundedZip"],"sources":["../src/services/agentArchive/index.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport { exactPackageVersion, npmPackageName, readBoundedBody } from '@agimon-ai/po-core/verifiedArchive';\n\nimport type { NormalizedAgentArchive } from './type';\nimport { readBoundedZip } from './zip';\n\nconst MANIFEST_PATHS = [\n 'plugin.json',\n '.codex-plugin/plugin.json',\n '.claude-plugin/plugin.json',\n '.cursor-plugin/plugin.json',\n];\nconst MAX_FILE_BYTES = 8 * 1024 * 1024;\nconst MAX_TAR_BYTES = 64 * 1024 * 1024;\nconst MAX_TGZ_BYTES = 32 * 1024 * 1024;\nconst BLOCK = 512;\nconst decoder = new TextDecoder('utf-8', { fatal: true });\n\n/** Deterministic ustar, all files mode 0644, uid/gid/mtime zero. No input npm metadata survives. */\nfunction npmTar(files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>): Uint8Array<ArrayBuffer>[] {\n const chunks: Uint8Array<ArrayBuffer>[] = [];\n let size = BLOCK * 2;\n for (const [relative, body] of [...files].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {\n let name = `package/${relative}`;\n let prefix = '';\n if (Buffer.byteLength(name) > 100) {\n const slash = name.lastIndexOf('/');\n prefix = name.slice(0, slash);\n name = name.slice(slash + 1);\n }\n if (Buffer.byteLength(name) > 100 || Buffer.byteLength(prefix) > 155)\n throw new Error('Agent archive path is too long.');\n size += BLOCK + Math.ceil(body.length / BLOCK) * BLOCK;\n if (size > MAX_TAR_BYTES) throw new Error('Normalized archive exceeds the expanded size limit.');\n const header = Buffer.alloc(BLOCK);\n const octal = (value: number, offset: number, width: number) => {\n header.write(`${value.toString(8).padStart(width - 1, '0')}\\0`, offset, width, 'ascii');\n };\n header.write(name, 0, 100, 'utf8');\n octal(0o644, 100, 8);\n octal(0, 108, 8);\n octal(0, 116, 8);\n octal(body.length, 124, 12);\n octal(0, 136, 12);\n header.fill(32, 148, 156);\n header[156] = 48;\n header.write('ustar\\0', 257, 6, 'ascii');\n header.write('00', 263, 2, 'ascii');\n header.write(prefix, 345, 155, 'utf8');\n octal(\n header.reduce((sum, byte) => sum + byte, 0),\n 148,\n 8,\n );\n chunks.push(header, body, Buffer.alloc((BLOCK - (body.length % BLOCK)) % BLOCK));\n }\n chunks.push(Buffer.alloc(BLOCK * 2));\n return chunks;\n}\n\nexport async function normalizeAgentFiles(\n files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>,\n): Promise<NormalizedAgentArchive> {\n const candidates = [...files.keys()].filter((path) =>\n MANIFEST_PATHS.some((manifest) => path === manifest || path.endsWith(`/${manifest}`)),\n );\n if (candidates.length !== 1) throw new Error('An agent ZIP requires exactly one plugin manifest.');\n const manifestPath = candidates[0]!;\n const root = MANIFEST_PATHS.includes(manifestPath) ? '' : manifestPath.slice(0, manifestPath.indexOf('/') + 1);\n if (!MANIFEST_PATHS.includes(manifestPath.slice(root.length)))\n throw new Error('Agent manifest must be at root or inside one wrapper folder.');\n if (root && [...files.keys()].some((path) => !path.startsWith(root)))\n throw new Error('Agent ZIP has files outside its wrapper folder.');\n const manifest: unknown = JSON.parse(decoder.decode(files.get(manifestPath)!));\n if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) throw new Error('Invalid agent manifest.');\n const { name, version } = manifest as Record<string, unknown>;\n if (\n typeof name !== 'string' ||\n name.length > 214 ||\n !npmPackageName.test(name) ||\n typeof version !== 'string' ||\n version.length > 128 ||\n !exactPackageVersion.test(version)\n ) {\n throw new Error('The agent manifest requires an exact npm name and version.');\n }\n const normalized = new Map<string, Uint8Array<ArrayBuffer>>();\n for (const [path, body] of files) {\n const relative = path.slice(root.length);\n if (['package.json', 'package-lock.json', 'npm-shrinkwrap.json', '.npmrc'].includes(relative.split('/')[0]!))\n continue;\n normalized.set(relative, body);\n }\n normalized.set('package.json', new TextEncoder().encode(`${JSON.stringify({ name, version })}\\n`));\n return { bytes: await packPluginFiles(normalized), name, version };\n}\n\n/** Pack a bounded, already checked set of relative paths without running package scripts. */\nexport async function packPluginFiles(\n files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>,\n): Promise<Uint8Array<ArrayBuffer>> {\n // Stream tar headers and existing file buffers, never allocate another expanded archive in workerd.\n const chunks = npmTar(files)[Symbol.iterator]();\n const tar = new ReadableStream<Uint8Array<ArrayBuffer>>({\n pull(controller) {\n const next = chunks.next();\n if (next.done) controller.close();\n else controller.enqueue(next.value);\n },\n });\n return readBoundedBody(tar.pipeThrough(new CompressionStream('gzip')), MAX_TGZ_BYTES);\n}\n\n/** Accept one agent manifest at root or inside one wrapper folder. Package identity comes only from it. */\nexport async function normalizeAgentZip(bytes: Uint8Array): Promise<NormalizedAgentArchive> {\n const files = new Map<string, Uint8Array<ArrayBuffer>>();\n for await (const member of readBoundedZip(bytes, { fileBytes: MAX_FILE_BYTES, entries: 4095 })) {\n if (!member.directory) files.set(member.path, member.bytes);\n }\n return normalizeAgentFiles(files);\n}\n"],"mappings":";;;;;AAOA,MAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AACA,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AACtB,MAAM,QAAQ;AACd,MAAM,UAAU,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC;;AAGxD,SAAS,OAAO,OAAgF;CAC9F,MAAM,SAAoC,CAAC;CAC3C,IAAI,OAAO,QAAQ;CACnB,KAAK,MAAM,CAAC,UAAU,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAE,GAAG;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U,IAAI;CAC/B;CACA,WAAW,IAAI,gBAAgB,IAAI,YAAY,CAAC,CAAC,OAAO,GAAG,KAAK,UAAU;EAAE;EAAM;CAAQ,CAAC,EAAE,GAAG,CAAC;CACjG,OAAO;EAAE,OAAO,MAAM,gBAAgB,UAAU;EAAG;EAAM;CAAQ;AACnE;;AAGA,eAAsB,gBACpB,OACkC;CAElC,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,OAAO,SAAS,CAAC;CAC9C,MAAM,MAAM,IAAI,eAAwC,EACtD,KAAK,YAAY;EACf,MAAM,OAAO,OAAO,KAAK;EACzB,IAAI,KAAK,MAAM,WAAW,MAAM;OAC3B,WAAW,QAAQ,KAAK,KAAK;CACpC,EACF,CAAC;CACD,QAAA,GAAOC,mCAAAA,gBAAAA,CAAgB,IAAI,YAAY,IAAI,kBAAkB,MAAM,CAAC,GAAG,aAAa;AACtF;;AAGA,eAAsB,kBAAkB,OAAoD;CAC1F,MAAM,wBAAQ,IAAI,IAAqC;CACvD,WAAW,MAAM,UAAUC,YAAAA,eAAe,OAAO;EAAE,WAAW;EAAgB,SAAS;CAAK,CAAC,GAC3F,IAAI,CAAC,OAAO,WAAW,MAAM,IAAI,OAAO,MAAM,OAAO,KAAK;CAE5D,OAAO,oBAAoB,KAAK;AAClC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/services/agentArchive/type.d.ts
|
|
2
|
+
interface ZipLimits {
|
|
3
|
+
archiveBytes?: number;
|
|
4
|
+
expandedBytes?: number;
|
|
5
|
+
fileBytes?: number;
|
|
6
|
+
entries?: number;
|
|
7
|
+
}
|
|
8
|
+
interface ZipMember {
|
|
9
|
+
path: string;
|
|
10
|
+
directory: boolean;
|
|
11
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
12
|
+
}
|
|
13
|
+
interface NormalizedAgentArchive {
|
|
14
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/services/agentArchive/index.d.ts
|
|
20
|
+
export declare function normalizeAgentFiles(files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>): Promise<NormalizedAgentArchive>;
|
|
21
|
+
/** Pack a bounded, already checked set of relative paths without running package scripts. */
|
|
22
|
+
export declare function packPluginFiles(files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>): Promise<Uint8Array<ArrayBuffer>>;
|
|
23
|
+
/** Accept one agent manifest at root or inside one wrapper folder. Package identity comes only from it. */
|
|
24
|
+
export declare function normalizeAgentZip(bytes: Uint8Array): Promise<NormalizedAgentArchive>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/services/agentArchive/zip.d.ts
|
|
27
|
+
/** The single yauzl reader shared by local uploads and cloud normalization. Never executes archive content. */
|
|
28
|
+
export declare function readBoundedZip(bytes: Uint8Array, requested?: ZipLimits): AsyncGenerator<ZipMember>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export type { NormalizedAgentArchive, ZipLimits, ZipMember };
|
|
31
|
+
//# sourceMappingURL=agentArchive.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentArchive.d.mts","names":[],"sources":["../src/services/agentArchive/type.ts","../src/services/agentArchive/index.ts","../src/services/agentArchive/zip.ts"],"mappings":";UAAiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,OAAO,WAAW;;UAGH;EACf,OAAO,WAAW;EAClB;EACA;;;;wBC6CoB,oBACpB,OAAO,oBAAoB,WAAW,gBACrC,QAAQ;;wBAoCW,gBACpB,OAAO,oBAAoB,WAAW,gBACrC,QAAQ,WAAW;;wBAcA,kBAAkB,OAAO,aAAa,QAAQ;;;;wBCvG7C,eAAe,OAAO,YAAY,YAAW,YAAiB,eAAe"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { t as readBoundedZip } from "./zip-Bl6pG9Ap.mjs";
|
|
2
|
+
import { Buffer } from "node:buffer";
|
|
3
|
+
import { exactPackageVersion, npmPackageName, readBoundedBody } from "@agimon-ai/po-core/verifiedArchive";
|
|
4
|
+
//#region src/services/agentArchive/index.ts
|
|
5
|
+
const MANIFEST_PATHS = [
|
|
6
|
+
"plugin.json",
|
|
7
|
+
".codex-plugin/plugin.json",
|
|
8
|
+
".claude-plugin/plugin.json",
|
|
9
|
+
".cursor-plugin/plugin.json"
|
|
10
|
+
];
|
|
11
|
+
const MAX_FILE_BYTES = 8388608;
|
|
12
|
+
const MAX_TAR_BYTES = 67108864;
|
|
13
|
+
const MAX_TGZ_BYTES = 33554432;
|
|
14
|
+
const BLOCK = 512;
|
|
15
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
16
|
+
/** Deterministic ustar, all files mode 0644, uid/gid/mtime zero. No input npm metadata survives. */
|
|
17
|
+
function npmTar(files) {
|
|
18
|
+
const chunks = [];
|
|
19
|
+
let size = BLOCK * 2;
|
|
20
|
+
for (const [relative, body] of [...files].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
21
|
+
let name = `package/${relative}`;
|
|
22
|
+
let prefix = "";
|
|
23
|
+
if (Buffer.byteLength(name) > 100) {
|
|
24
|
+
const slash = name.lastIndexOf("/");
|
|
25
|
+
prefix = name.slice(0, slash);
|
|
26
|
+
name = name.slice(slash + 1);
|
|
27
|
+
}
|
|
28
|
+
if (Buffer.byteLength(name) > 100 || Buffer.byteLength(prefix) > 155) throw new Error("Agent archive path is too long.");
|
|
29
|
+
size += BLOCK + Math.ceil(body.length / BLOCK) * BLOCK;
|
|
30
|
+
if (size > MAX_TAR_BYTES) throw new Error("Normalized archive exceeds the expanded size limit.");
|
|
31
|
+
const header = Buffer.alloc(BLOCK);
|
|
32
|
+
const octal = (value, offset, width) => {
|
|
33
|
+
header.write(`${value.toString(8).padStart(width - 1, "0")}\0`, offset, width, "ascii");
|
|
34
|
+
};
|
|
35
|
+
header.write(name, 0, 100, "utf8");
|
|
36
|
+
octal(420, 100, 8);
|
|
37
|
+
octal(0, 108, 8);
|
|
38
|
+
octal(0, 116, 8);
|
|
39
|
+
octal(body.length, 124, 12);
|
|
40
|
+
octal(0, 136, 12);
|
|
41
|
+
header.fill(32, 148, 156);
|
|
42
|
+
header[156] = 48;
|
|
43
|
+
header.write("ustar\0", 257, 6, "ascii");
|
|
44
|
+
header.write("00", 263, 2, "ascii");
|
|
45
|
+
header.write(prefix, 345, 155, "utf8");
|
|
46
|
+
octal(header.reduce((sum, byte) => sum + byte, 0), 148, 8);
|
|
47
|
+
chunks.push(header, body, Buffer.alloc((BLOCK - body.length % BLOCK) % BLOCK));
|
|
48
|
+
}
|
|
49
|
+
chunks.push(Buffer.alloc(BLOCK * 2));
|
|
50
|
+
return chunks;
|
|
51
|
+
}
|
|
52
|
+
async function normalizeAgentFiles(files) {
|
|
53
|
+
const candidates = [...files.keys()].filter((path) => MANIFEST_PATHS.some((manifest) => path === manifest || path.endsWith(`/${manifest}`)));
|
|
54
|
+
if (candidates.length !== 1) throw new Error("An agent ZIP requires exactly one plugin manifest.");
|
|
55
|
+
const manifestPath = candidates[0];
|
|
56
|
+
const root = MANIFEST_PATHS.includes(manifestPath) ? "" : manifestPath.slice(0, manifestPath.indexOf("/") + 1);
|
|
57
|
+
if (!MANIFEST_PATHS.includes(manifestPath.slice(root.length))) throw new Error("Agent manifest must be at root or inside one wrapper folder.");
|
|
58
|
+
if (root && [...files.keys()].some((path) => !path.startsWith(root))) throw new Error("Agent ZIP has files outside its wrapper folder.");
|
|
59
|
+
const manifest = JSON.parse(decoder.decode(files.get(manifestPath)));
|
|
60
|
+
if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) throw new Error("Invalid agent manifest.");
|
|
61
|
+
const { name, version } = manifest;
|
|
62
|
+
if (typeof name !== "string" || name.length > 214 || !npmPackageName.test(name) || typeof version !== "string" || version.length > 128 || !exactPackageVersion.test(version)) throw new Error("The agent manifest requires an exact npm name and version.");
|
|
63
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
64
|
+
for (const [path, body] of files) {
|
|
65
|
+
const relative = path.slice(root.length);
|
|
66
|
+
if ([
|
|
67
|
+
"package.json",
|
|
68
|
+
"package-lock.json",
|
|
69
|
+
"npm-shrinkwrap.json",
|
|
70
|
+
".npmrc"
|
|
71
|
+
].includes(relative.split("/")[0])) continue;
|
|
72
|
+
normalized.set(relative, body);
|
|
73
|
+
}
|
|
74
|
+
normalized.set("package.json", new TextEncoder().encode(`${JSON.stringify({
|
|
75
|
+
name,
|
|
76
|
+
version
|
|
77
|
+
})}\n`));
|
|
78
|
+
return {
|
|
79
|
+
bytes: await packPluginFiles(normalized),
|
|
80
|
+
name,
|
|
81
|
+
version
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Pack a bounded, already checked set of relative paths without running package scripts. */
|
|
85
|
+
async function packPluginFiles(files) {
|
|
86
|
+
const chunks = npmTar(files)[Symbol.iterator]();
|
|
87
|
+
const tar = new ReadableStream({ pull(controller) {
|
|
88
|
+
const next = chunks.next();
|
|
89
|
+
if (next.done) controller.close();
|
|
90
|
+
else controller.enqueue(next.value);
|
|
91
|
+
} });
|
|
92
|
+
return readBoundedBody(tar.pipeThrough(new CompressionStream("gzip")), MAX_TGZ_BYTES);
|
|
93
|
+
}
|
|
94
|
+
/** Accept one agent manifest at root or inside one wrapper folder. Package identity comes only from it. */
|
|
95
|
+
async function normalizeAgentZip(bytes) {
|
|
96
|
+
const files = /* @__PURE__ */ new Map();
|
|
97
|
+
for await (const member of readBoundedZip(bytes, {
|
|
98
|
+
fileBytes: MAX_FILE_BYTES,
|
|
99
|
+
entries: 4095
|
|
100
|
+
})) if (!member.directory) files.set(member.path, member.bytes);
|
|
101
|
+
return normalizeAgentFiles(files);
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { normalizeAgentFiles, normalizeAgentZip, packPluginFiles, readBoundedZip };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=agentArchive.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentArchive.mjs","names":[],"sources":["../src/services/agentArchive/index.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport { exactPackageVersion, npmPackageName, readBoundedBody } from '@agimon-ai/po-core/verifiedArchive';\n\nimport type { NormalizedAgentArchive } from './type';\nimport { readBoundedZip } from './zip';\n\nconst MANIFEST_PATHS = [\n 'plugin.json',\n '.codex-plugin/plugin.json',\n '.claude-plugin/plugin.json',\n '.cursor-plugin/plugin.json',\n];\nconst MAX_FILE_BYTES = 8 * 1024 * 1024;\nconst MAX_TAR_BYTES = 64 * 1024 * 1024;\nconst MAX_TGZ_BYTES = 32 * 1024 * 1024;\nconst BLOCK = 512;\nconst decoder = new TextDecoder('utf-8', { fatal: true });\n\n/** Deterministic ustar, all files mode 0644, uid/gid/mtime zero. No input npm metadata survives. */\nfunction npmTar(files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>): Uint8Array<ArrayBuffer>[] {\n const chunks: Uint8Array<ArrayBuffer>[] = [];\n let size = BLOCK * 2;\n for (const [relative, body] of [...files].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {\n let name = `package/${relative}`;\n let prefix = '';\n if (Buffer.byteLength(name) > 100) {\n const slash = name.lastIndexOf('/');\n prefix = name.slice(0, slash);\n name = name.slice(slash + 1);\n }\n if (Buffer.byteLength(name) > 100 || Buffer.byteLength(prefix) > 155)\n throw new Error('Agent archive path is too long.');\n size += BLOCK + Math.ceil(body.length / BLOCK) * BLOCK;\n if (size > MAX_TAR_BYTES) throw new Error('Normalized archive exceeds the expanded size limit.');\n const header = Buffer.alloc(BLOCK);\n const octal = (value: number, offset: number, width: number) => {\n header.write(`${value.toString(8).padStart(width - 1, '0')}\\0`, offset, width, 'ascii');\n };\n header.write(name, 0, 100, 'utf8');\n octal(0o644, 100, 8);\n octal(0, 108, 8);\n octal(0, 116, 8);\n octal(body.length, 124, 12);\n octal(0, 136, 12);\n header.fill(32, 148, 156);\n header[156] = 48;\n header.write('ustar\\0', 257, 6, 'ascii');\n header.write('00', 263, 2, 'ascii');\n header.write(prefix, 345, 155, 'utf8');\n octal(\n header.reduce((sum, byte) => sum + byte, 0),\n 148,\n 8,\n );\n chunks.push(header, body, Buffer.alloc((BLOCK - (body.length % BLOCK)) % BLOCK));\n }\n chunks.push(Buffer.alloc(BLOCK * 2));\n return chunks;\n}\n\nexport async function normalizeAgentFiles(\n files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>,\n): Promise<NormalizedAgentArchive> {\n const candidates = [...files.keys()].filter((path) =>\n MANIFEST_PATHS.some((manifest) => path === manifest || path.endsWith(`/${manifest}`)),\n );\n if (candidates.length !== 1) throw new Error('An agent ZIP requires exactly one plugin manifest.');\n const manifestPath = candidates[0]!;\n const root = MANIFEST_PATHS.includes(manifestPath) ? '' : manifestPath.slice(0, manifestPath.indexOf('/') + 1);\n if (!MANIFEST_PATHS.includes(manifestPath.slice(root.length)))\n throw new Error('Agent manifest must be at root or inside one wrapper folder.');\n if (root && [...files.keys()].some((path) => !path.startsWith(root)))\n throw new Error('Agent ZIP has files outside its wrapper folder.');\n const manifest: unknown = JSON.parse(decoder.decode(files.get(manifestPath)!));\n if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) throw new Error('Invalid agent manifest.');\n const { name, version } = manifest as Record<string, unknown>;\n if (\n typeof name !== 'string' ||\n name.length > 214 ||\n !npmPackageName.test(name) ||\n typeof version !== 'string' ||\n version.length > 128 ||\n !exactPackageVersion.test(version)\n ) {\n throw new Error('The agent manifest requires an exact npm name and version.');\n }\n const normalized = new Map<string, Uint8Array<ArrayBuffer>>();\n for (const [path, body] of files) {\n const relative = path.slice(root.length);\n if (['package.json', 'package-lock.json', 'npm-shrinkwrap.json', '.npmrc'].includes(relative.split('/')[0]!))\n continue;\n normalized.set(relative, body);\n }\n normalized.set('package.json', new TextEncoder().encode(`${JSON.stringify({ name, version })}\\n`));\n return { bytes: await packPluginFiles(normalized), name, version };\n}\n\n/** Pack a bounded, already checked set of relative paths without running package scripts. */\nexport async function packPluginFiles(\n files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>,\n): Promise<Uint8Array<ArrayBuffer>> {\n // Stream tar headers and existing file buffers, never allocate another expanded archive in workerd.\n const chunks = npmTar(files)[Symbol.iterator]();\n const tar = new ReadableStream<Uint8Array<ArrayBuffer>>({\n pull(controller) {\n const next = chunks.next();\n if (next.done) controller.close();\n else controller.enqueue(next.value);\n },\n });\n return readBoundedBody(tar.pipeThrough(new CompressionStream('gzip')), MAX_TGZ_BYTES);\n}\n\n/** Accept one agent manifest at root or inside one wrapper folder. Package identity comes only from it. */\nexport async function normalizeAgentZip(bytes: Uint8Array): Promise<NormalizedAgentArchive> {\n const files = new Map<string, Uint8Array<ArrayBuffer>>();\n for await (const member of readBoundedZip(bytes, { fileBytes: MAX_FILE_BYTES, entries: 4095 })) {\n if (!member.directory) files.set(member.path, member.bytes);\n }\n return normalizeAgentFiles(files);\n}\n"],"mappings":";;;;AAOA,MAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AACA,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AACtB,MAAM,QAAQ;AACd,MAAM,UAAU,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC;;AAGxD,SAAS,OAAO,OAAgF;CAC9F,MAAM,SAAoC,CAAC;CAC3C,IAAI,OAAO,QAAQ;CACnB,KAAK,MAAM,CAAC,UAAU,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAE,GAAG;EAC1F,IAAI,OAAO,WAAW;EACtB,IAAI,SAAS;EACb,IAAI,OAAO,WAAW,IAAI,IAAI,KAAK;GACjC,MAAM,QAAQ,KAAK,YAAY,GAAG;GAClC,SAAS,KAAK,MAAM,GAAG,KAAK;GAC5B,OAAO,KAAK,MAAM,QAA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,KAAK,CAAC,CAAC,OAAO,SAAS,CAAC;CAC9C,MAAM,MAAM,IAAI,eAAwC,EACtD,KAAK,YAAY;EACf,MAAM,OAAO,OAAO,KAAK;EACzB,IAAI,KAAK,MAAM,WAAW,MAAM;OAC3B,WAAW,QAAQ,KAAK,KAAK;CACpC,EACF,CAAC;CACD,OAAO,gBAAgB,IAAI,YAAY,IAAI,kBAAkB,MAAM,CAAC,GAAG,aAAa;AACtF;;AAGA,eAAsB,kBAAkB,OAAoD;CAC1F,MAAM,wBAAQ,IAAI,IAAqC;CACvD,WAAW,MAAM,UAAU,eAAe,OAAO;EAAE,WAAW;EAAgB,SAAS;CAAK,CAAC,GAC3F,IAAI,CAAC,OAAO,WAAW,MAAM,IAAI,OAAO,MAAM,OAAO,KAAK;CAE5D,OAAO,oBAAoB,KAAK;AAClC"}
|
package/dist/apiContracts.cjs
CHANGED
|
@@ -2,11 +2,142 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let typebox = require("typebox");
|
|
5
7
|
//#region src/schemas/apiContracts.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
const Name = typebox.Type.String({
|
|
9
|
+
minLength: 1,
|
|
10
|
+
maxLength: 200
|
|
11
|
+
});
|
|
12
|
+
const O = typebox.Type.Optional;
|
|
13
|
+
const PluginOrigin = typebox.Type.Union([
|
|
14
|
+
typebox.Type.Object({ kind: typebox.Type.Literal("uploaded") }),
|
|
15
|
+
typebox.Type.Object({
|
|
16
|
+
kind: typebox.Type.Literal("marketplace"),
|
|
17
|
+
marketplace: typebox.Type.String()
|
|
18
|
+
}),
|
|
19
|
+
typebox.Type.Object({
|
|
20
|
+
kind: typebox.Type.Literal("folder"),
|
|
21
|
+
path: typebox.Type.String()
|
|
22
|
+
}),
|
|
23
|
+
typebox.Type.Object({
|
|
24
|
+
kind: typebox.Type.Literal("remote"),
|
|
25
|
+
source: typebox.Type.String()
|
|
26
|
+
})
|
|
27
|
+
]);
|
|
28
|
+
const MarketplacePin = typebox.Type.Object({
|
|
29
|
+
origin: Name,
|
|
30
|
+
package: Name,
|
|
31
|
+
version: Name,
|
|
32
|
+
integrity: Name
|
|
33
|
+
});
|
|
34
|
+
const PluginSummary = typebox.Type.Object({
|
|
35
|
+
name: Name,
|
|
36
|
+
version: O(typebox.Type.String()),
|
|
37
|
+
installed: O(MarketplacePin),
|
|
38
|
+
update: O(MarketplacePin),
|
|
39
|
+
description: O(typebox.Type.String()),
|
|
40
|
+
origin: PluginOrigin,
|
|
41
|
+
skills: typebox.Type.Array(typebox.Type.String()),
|
|
42
|
+
mcpServers: typebox.Type.Array(typebox.Type.String()),
|
|
43
|
+
hooks: typebox.Type.Integer({ minimum: 0 }),
|
|
44
|
+
domains: typebox.Type.Array(typebox.Type.String()),
|
|
45
|
+
enabled: typebox.Type.Boolean(),
|
|
46
|
+
deletable: typebox.Type.Boolean(),
|
|
47
|
+
missing: O(typebox.Type.Boolean())
|
|
48
|
+
});
|
|
49
|
+
const SettingsView = typebox.Type.Object({
|
|
50
|
+
domains: typebox.Type.Array(typebox.Type.Object({
|
|
51
|
+
name: Name,
|
|
52
|
+
description: O(typebox.Type.String()),
|
|
53
|
+
plugins: typebox.Type.Array(typebox.Type.String())
|
|
54
|
+
})),
|
|
55
|
+
plugins: typebox.Type.Array(PluginSummary)
|
|
56
|
+
});
|
|
57
|
+
const UploadPreview = typebox.Type.Object({
|
|
58
|
+
plugin: PluginSummary,
|
|
59
|
+
destination: typebox.Type.String()
|
|
60
|
+
});
|
|
61
|
+
const json = (schema) => ({
|
|
62
|
+
required: true,
|
|
63
|
+
contentType: "application/json",
|
|
64
|
+
schema
|
|
65
|
+
});
|
|
66
|
+
const zip = {
|
|
67
|
+
required: true,
|
|
68
|
+
contentType: "application/zip",
|
|
69
|
+
schema: typebox.Type.String({ format: "binary" })
|
|
70
|
+
};
|
|
71
|
+
/** Settings > Plugins: one global mount, every write step-up gated by the panel. */
|
|
72
|
+
const pluginSettings = (id, method, path, description, extra = {}) => ({
|
|
73
|
+
id: `domains.plugins.${id}`,
|
|
74
|
+
scope: "host",
|
|
75
|
+
basePath: "plugin-settings",
|
|
76
|
+
path,
|
|
77
|
+
method,
|
|
78
|
+
authentication: "owner",
|
|
79
|
+
description,
|
|
80
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(SettingsView),
|
|
81
|
+
...extra
|
|
82
|
+
});
|
|
83
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
8
84
|
version: 1,
|
|
9
|
-
http: [
|
|
85
|
+
http: [
|
|
86
|
+
{
|
|
87
|
+
id: "domains.current",
|
|
88
|
+
scope: "session",
|
|
89
|
+
basePath: "domains",
|
|
90
|
+
path: "/current",
|
|
91
|
+
method: "GET",
|
|
92
|
+
authentication: "owner",
|
|
93
|
+
description: "Read the current session selection.",
|
|
94
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ domains: typebox.Type.Array(typebox.Type.String()) }))
|
|
95
|
+
},
|
|
96
|
+
pluginSettings("view", "GET", "/view", "Read your domains and every plugin your personal catalog knows."),
|
|
97
|
+
pluginSettings("toggle", "POST", "/toggle", "Turn a plugin on or off.", { body: json(typebox.Type.Object({
|
|
98
|
+
plugin: Name,
|
|
99
|
+
enabled: typebox.Type.Boolean()
|
|
100
|
+
})) }),
|
|
101
|
+
pluginSettings("update", "POST", "/update", "Confirm and verify an exact marketplace update without enabling the plugin.", { body: json(typebox.Type.Object({
|
|
102
|
+
plugin: Name,
|
|
103
|
+
expected: MarketplacePin
|
|
104
|
+
})) }),
|
|
105
|
+
pluginSettings("domain.add", "POST", "/domain-plugins", "Add plugins to one of your domains.", { body: json(typebox.Type.Object({
|
|
106
|
+
domain: Name,
|
|
107
|
+
plugins: typebox.Type.Array(Name, {
|
|
108
|
+
minItems: 1,
|
|
109
|
+
maxItems: 200
|
|
110
|
+
})
|
|
111
|
+
})) }),
|
|
112
|
+
pluginSettings("domain.remove", "DELETE", "/domain-plugins", "Take a plugin out of one of your domains.", { body: json(typebox.Type.Object({
|
|
113
|
+
domain: Name,
|
|
114
|
+
plugin: Name
|
|
115
|
+
})) }),
|
|
116
|
+
pluginSettings("domains.create", "POST", "/domains", "Create a domain in your domains.yaml.", { body: json(typebox.Type.Object({
|
|
117
|
+
name: Name,
|
|
118
|
+
description: O(typebox.Type.String({ maxLength: 500 }))
|
|
119
|
+
})) }),
|
|
120
|
+
pluginSettings("domains.delete", "DELETE", "/domains", "Delete a domain from your domains.yaml.", { body: json(typebox.Type.Object({ name: Name })) }),
|
|
121
|
+
pluginSettings("delete", "DELETE", "/plugins", "Delete a plugin uploaded here.", { body: json(typebox.Type.Object({ plugin: Name })) }),
|
|
122
|
+
pluginSettings("upload.preview", "POST", "/uploads/preview", "Read a zipped plugin and say what it holds.", {
|
|
123
|
+
body: zip,
|
|
124
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(UploadPreview)
|
|
125
|
+
}),
|
|
126
|
+
pluginSettings("upload.install", "POST", "/uploads", "Install a zipped plugin into ~/.po/plugins.", {
|
|
127
|
+
body: zip,
|
|
128
|
+
parameters: [{
|
|
129
|
+
name: "domains",
|
|
130
|
+
in: "query",
|
|
131
|
+
required: false,
|
|
132
|
+
schema: typebox.Type.String()
|
|
133
|
+
}, {
|
|
134
|
+
name: "newDomain",
|
|
135
|
+
in: "query",
|
|
136
|
+
required: false,
|
|
137
|
+
schema: typebox.Type.String()
|
|
138
|
+
}]
|
|
139
|
+
})
|
|
140
|
+
],
|
|
10
141
|
sockets: [],
|
|
11
142
|
dynamic: []
|
|
12
143
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","jsonApiResponses","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst Name = Type.String({ minLength: 1, maxLength: 200 });\nconst O = Type.Optional;\n\nconst PluginOrigin = Type.Union([\n Type.Object({ kind: Type.Literal('uploaded') }),\n Type.Object({ kind: Type.Literal('marketplace'), marketplace: Type.String() }),\n Type.Object({ kind: Type.Literal('folder'), path: Type.String() }),\n Type.Object({ kind: Type.Literal('remote'), source: Type.String() }),\n]);\nconst MarketplacePin = Type.Object({ origin: Name, package: Name, version: Name, integrity: Name });\nconst PluginSummary = Type.Object({\n name: Name,\n version: O(Type.String()),\n installed: O(MarketplacePin),\n update: O(MarketplacePin),\n description: O(Type.String()),\n origin: PluginOrigin,\n skills: Type.Array(Type.String()),\n mcpServers: Type.Array(Type.String()),\n hooks: Type.Integer({ minimum: 0 }),\n domains: Type.Array(Type.String()),\n enabled: Type.Boolean(),\n deletable: Type.Boolean(),\n missing: O(Type.Boolean()),\n});\nconst SettingsView = Type.Object({\n domains: Type.Array(Type.Object({ name: Name, description: O(Type.String()), plugins: Type.Array(Type.String()) })),\n plugins: Type.Array(PluginSummary),\n});\nconst UploadPreview = Type.Object({ plugin: PluginSummary, destination: Type.String() });\n\nconst json = (schema: object) => ({ required: true, contentType: 'application/json', schema });\nconst zip = { required: true, contentType: 'application/zip', schema: Type.String({ format: 'binary' }) };\n\n/** Settings > Plugins: one global mount, every write step-up gated by the panel. */\nconst pluginSettings = (\n id: string,\n method: PoHttpContract['method'],\n path: string,\n description: string,\n extra: Partial<PoHttpContract> = {},\n): PoHttpContract => ({\n id: `domains.plugins.${id}`,\n scope: 'host',\n basePath: 'plugin-settings',\n path,\n method,\n authentication: 'owner',\n description,\n responses: jsonApiResponses(SettingsView),\n ...extra,\n});\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [\n {\n id: 'domains.current',\n scope: 'session',\n basePath: 'domains',\n path: '/current',\n method: 'GET',\n authentication: 'owner',\n description: 'Read the current session selection.',\n responses: jsonApiResponses(Type.Object({ domains: Type.Array(Type.String()) })),\n },\n pluginSettings('view', 'GET', '/view', 'Read your domains and every plugin your personal catalog knows.'),\n pluginSettings('toggle', 'POST', '/toggle', 'Turn a plugin on or off.', {\n body: json(Type.Object({ plugin: Name, enabled: Type.Boolean() })),\n }),\n pluginSettings(\n 'update',\n 'POST',\n '/update',\n 'Confirm and verify an exact marketplace update without enabling the plugin.',\n {\n body: json(Type.Object({ plugin: Name, expected: MarketplacePin })),\n },\n ),\n pluginSettings('domain.add', 'POST', '/domain-plugins', 'Add plugins to one of your domains.', {\n body: json(Type.Object({ domain: Name, plugins: Type.Array(Name, { minItems: 1, maxItems: 200 }) })),\n }),\n pluginSettings('domain.remove', 'DELETE', '/domain-plugins', 'Take a plugin out of one of your domains.', {\n body: json(Type.Object({ domain: Name, plugin: Name })),\n }),\n pluginSettings('domains.create', 'POST', '/domains', 'Create a domain in your domains.yaml.', {\n body: json(Type.Object({ name: Name, description: O(Type.String({ maxLength: 500 })) })),\n }),\n pluginSettings('domains.delete', 'DELETE', '/domains', 'Delete a domain from your domains.yaml.', {\n body: json(Type.Object({ name: Name })),\n }),\n pluginSettings('delete', 'DELETE', '/plugins', 'Delete a plugin uploaded here.', {\n body: json(Type.Object({ plugin: Name })),\n }),\n pluginSettings('upload.preview', 'POST', '/uploads/preview', 'Read a zipped plugin and say what it holds.', {\n body: zip,\n responses: jsonApiResponses(UploadPreview),\n }),\n pluginSettings('upload.install', 'POST', '/uploads', 'Install a zipped plugin into ~/.po/plugins.', {\n body: zip,\n parameters: [\n { name: 'domains', in: 'query', required: false, schema: Type.String() },\n { name: 'newDomain', in: 'query', required: false, schema: Type.String() },\n ],\n }),\n ],\n sockets: [],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,IAAI;IAAS,UAAU;IAAO,QAAQA,QAAAA,KAAK,OAAO;GAAE,CAC3E;EACF,CAAC;CACH;CACA,SAAS,CAAC;CACV,SAAS,CAAC;AACZ,CAAC"}
|
package/dist/apiContracts.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/schemas/apiContracts.d.ts
|
|
2
|
-
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
2
|
export declare const apiContracts: {
|
|
4
3
|
version: 1;
|
|
5
4
|
protocols?: Record<string, string> | undefined;
|
|
6
5
|
schemas?: Record<string, boolean | object> | undefined;
|
|
7
6
|
http: {
|
|
8
7
|
id: string;
|
|
9
|
-
scope: "
|
|
8
|
+
scope: "host" | "session" | "workspace";
|
|
10
9
|
basePath?: string | undefined;
|
|
11
10
|
path: string;
|
|
12
11
|
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
@@ -34,7 +33,7 @@ export declare const apiContracts: {
|
|
|
34
33
|
}[];
|
|
35
34
|
sockets: {
|
|
36
35
|
id: string;
|
|
37
|
-
scope: "
|
|
36
|
+
scope: "host" | "session" | "workspace";
|
|
38
37
|
description: string;
|
|
39
38
|
availability?: string | undefined;
|
|
40
39
|
service: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";qBAwDa"}
|