@agimon-ai/po-domain 0.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/apiContracts.cjs +17 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +13 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/apply.cjs +76 -0
- package/dist/apply.cjs.map +1 -0
- package/dist/apply.d.mts +23 -0
- package/dist/apply.d.mts.map +1 -0
- package/dist/apply.mjs +72 -0
- package/dist/apply.mjs.map +1 -0
- package/dist/domainText-Dm8k7p4z.mjs +97 -0
- package/dist/domainText-Dm8k7p4z.mjs.map +1 -0
- package/dist/domainText-UIRIz6-_.cjs +204 -0
- package/dist/domainText-UIRIz6-_.cjs.map +1 -0
- package/dist/extensions/mcp.cjs +26 -0
- package/dist/extensions/mcp.cjs.map +1 -0
- package/dist/extensions/mcp.d.mts +5 -0
- package/dist/extensions/mcp.d.mts.map +1 -0
- package/dist/extensions/mcp.mjs +21 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/server.cjs +229 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +221 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +26 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +19 -0
- package/dist/index.d.mts +84 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/mcp.cjs +32 -0
- package/dist/mcp.cjs.map +1 -0
- package/dist/mcp.d.mts +52 -0
- package/dist/mcp.d.mts.map +1 -0
- package/dist/mcp.mjs +19 -0
- package/dist/mcp.mjs.map +1 -0
- package/dist/mcpFilter-CZNmU_VF.cjs +189 -0
- package/dist/mcpFilter-CZNmU_VF.cjs.map +1 -0
- package/dist/mcpFilter-Cf-czy8O.mjs +151 -0
- package/dist/mcpFilter-Cf-czy8O.mjs.map +1 -0
- package/dist/pluginMaterializer-C8IZ1PSY.cjs +267 -0
- package/dist/pluginMaterializer-C8IZ1PSY.cjs.map +1 -0
- package/dist/pluginMaterializer-D9-oDF-b.mjs +259 -0
- package/dist/pluginMaterializer-D9-oDF-b.mjs.map +1 -0
- package/dist/plugins.cjs +3 -0
- package/dist/plugins.d.mts +14 -0
- package/dist/plugins.d.mts.map +1 -0
- package/dist/plugins.mjs +2 -0
- package/dist/resourceCollector-CRY5cmeY.mjs +773 -0
- package/dist/resourceCollector-CRY5cmeY.mjs.map +1 -0
- package/dist/resourceCollector-Cu-lp5hJ.cjs +837 -0
- package/dist/resourceCollector-Cu-lp5hJ.cjs.map +1 -0
- package/dist/resources-BEjxE3Zn.d.mts +66 -0
- package/dist/resources-BEjxE3Zn.d.mts.map +1 -0
- package/dist/resources.cjs +12 -0
- package/dist/resources.d.mts +43 -0
- package/dist/resources.d.mts.map +1 -0
- package/dist/resources.mjs +2 -0
- package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/dist/toolNames-Ckp5VLMD.mjs +43 -0
- package/dist/toolNames-Ckp5VLMD.mjs.map +1 -0
- package/dist/toolNames-Cuu-u8r1.cjs +48 -0
- package/dist/toolNames-Cuu-u8r1.cjs.map +1 -0
- package/llms.txt +12 -0
- package/package.json +158 -0
- package/src/prompts/po-author-domain/SKILL.md +18 -0
- package/src/prompts/po-author-domain/references/domains-contract.md +165 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { o as resolveMcpAllowlist } from "../mcpFilter-Cf-czy8O.mjs";
|
|
2
|
+
import { t as materializePluginEntries } from "../pluginMaterializer-D9-oDF-b.mjs";
|
|
3
|
+
import { c as stageMcpResources, r as collectResources } from "../resourceCollector-CRY5cmeY.mjs";
|
|
4
|
+
import { d as splitDomains, l as normalizeDomainNames, m as toggledDomains, p as toggleOptionDomain, s as domainToggleOptions, t as DOMAIN_COMMAND, u as pickerTitle } from "../domainText-Dm8k7p4z.mjs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { listDomainNames, resolvePluginEntries } from "@agimon-ai/po-config/domains";
|
|
7
|
+
import { loadHarnessState } from "@agimon-ai/po-config/harnessStore";
|
|
8
|
+
import os from "node:os";
|
|
9
|
+
import { DOOM_MCP_PROJECTION_RESOLVER_SERVICE } from "@agimon-ai/po-core/mcpProjection";
|
|
10
|
+
import { composeServerProviderOverrides, defineServerPlugin, packageResourcePath, readPackageResource } from "@agimon-ai/po-core/serverFacet";
|
|
11
|
+
import { composeRootHooks, defineResource, defineRoot, defineRoutedContribution } from "@agimon-ai/po-core/extensionFile";
|
|
12
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
13
|
+
import { DOOM_RESOURCE_CATALOG_ENTRY_TYPE } from "@agimon-ai/po-core/skills";
|
|
14
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/domainServerResources.ts
|
|
15
|
+
/** Retain valid domains behind selection conditions; a broken neighbor must not prevent startup. */
|
|
16
|
+
async function domainServerResources(context) {
|
|
17
|
+
const resources = [];
|
|
18
|
+
const home = context.environment.HOME ?? os.homedir();
|
|
19
|
+
for (const domain of listDomainNames(context.repoRoot, home)) {
|
|
20
|
+
const temporaryDirectory = await mkdtemp(path.join(os.tmpdir(), "doom-domain-"));
|
|
21
|
+
try {
|
|
22
|
+
const plugins = await materializePluginEntries(resolvePluginEntries(context.repoRoot, [domain], [], home));
|
|
23
|
+
const collected = await collectResources(context.repoRoot, plugins, {
|
|
24
|
+
agents: false,
|
|
25
|
+
mcp: false,
|
|
26
|
+
sharedSkills: false,
|
|
27
|
+
temporaryDirectory
|
|
28
|
+
});
|
|
29
|
+
for (const skill of collected.skillSources) resources.push({
|
|
30
|
+
name: skill.name,
|
|
31
|
+
description: skill.description,
|
|
32
|
+
path: skill.path,
|
|
33
|
+
kind: "skill",
|
|
34
|
+
when: {
|
|
35
|
+
domain,
|
|
36
|
+
attribution: {
|
|
37
|
+
kind: "domain",
|
|
38
|
+
mode: domain
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
read: () => readFile(skill.path, "utf8")
|
|
42
|
+
});
|
|
43
|
+
} catch (error) {
|
|
44
|
+
await context.client.notify({
|
|
45
|
+
title: `Po domain ${domain} unavailable`,
|
|
46
|
+
body: error instanceof Error ? error.message : String(error),
|
|
47
|
+
level: "warning"
|
|
48
|
+
});
|
|
49
|
+
} finally {
|
|
50
|
+
await rm(temporaryDirectory, {
|
|
51
|
+
recursive: true,
|
|
52
|
+
force: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return resources;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
60
|
+
var root_server_default = defineRoot(async ({ agent }) => {
|
|
61
|
+
const services = [];
|
|
62
|
+
if (agent) {
|
|
63
|
+
const execution = agent.context;
|
|
64
|
+
const home = execution.environment.HOME ?? os.homedir();
|
|
65
|
+
const resolver = { async resolve(domains) {
|
|
66
|
+
const { state } = loadHarnessState({ ...execution.environment });
|
|
67
|
+
const directory = await mkdtemp(path.join(os.tmpdir(), "doom-domain-mcp-"));
|
|
68
|
+
try {
|
|
69
|
+
const plugins = await materializePluginEntries(resolvePluginEntries(execution.repoRoot, [...domains], [...state.pluginDirectories], home));
|
|
70
|
+
return {
|
|
71
|
+
projection: (await stageMcpResources(execution.repoRoot, plugins, {
|
|
72
|
+
enabled: true,
|
|
73
|
+
temporaryDirectory: directory,
|
|
74
|
+
mcpAllowlist: resolveMcpAllowlist(execution.repoRoot, [...domains])
|
|
75
|
+
})).mcpProjection,
|
|
76
|
+
cleanup: () => rm(directory, {
|
|
77
|
+
recursive: true,
|
|
78
|
+
force: true
|
|
79
|
+
})
|
|
80
|
+
};
|
|
81
|
+
} catch (error) {
|
|
82
|
+
await rm(directory, {
|
|
83
|
+
recursive: true,
|
|
84
|
+
force: true
|
|
85
|
+
});
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
} };
|
|
89
|
+
services.push((cordis) => {
|
|
90
|
+
cordis.plugin((provider) => {
|
|
91
|
+
provider.provide(DOOM_MCP_PROJECTION_RESOLVER_SERVICE, resolver);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
value: { resources: agent ? await domainServerResources(agent.context) : [] },
|
|
97
|
+
services
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/extensions/workspaces/sessions/(backend)/_lib/domainServerCommand.ts
|
|
102
|
+
const DOMAIN_SELECTION_KIND = "po-domains-selection";
|
|
103
|
+
const DOMAIN_SELECTION_VERSION = 1;
|
|
104
|
+
/** Full-set web replies share the string transport with legacy single-toggle labels. */
|
|
105
|
+
function domainSelectionReply(answer) {
|
|
106
|
+
if (!answer.trimStart().startsWith("{")) return null;
|
|
107
|
+
const reply = JSON.parse(answer);
|
|
108
|
+
if (typeof reply !== "object" || reply === null || !("kind" in reply) || reply.kind !== DOMAIN_SELECTION_KIND || !("version" in reply) || reply.version !== DOMAIN_SELECTION_VERSION || !("domains" in reply) || !Array.isArray(reply.domains) || !reply.domains.every((name) => typeof name === "string")) throw new Error("Invalid domains selection reply");
|
|
109
|
+
return reply.domains;
|
|
110
|
+
}
|
|
111
|
+
function createDomainServerCommand(host) {
|
|
112
|
+
return {
|
|
113
|
+
name: DOMAIN_COMMAND,
|
|
114
|
+
description: "Show or change the active Po domains.",
|
|
115
|
+
async execute(args, execution) {
|
|
116
|
+
const available = listDomainNames(execution.repoRoot);
|
|
117
|
+
let requested = splitDomains(args);
|
|
118
|
+
let fullSet = false;
|
|
119
|
+
if (requested.length === 0) {
|
|
120
|
+
const listing = {
|
|
121
|
+
active: [...execution.selection.domains],
|
|
122
|
+
effective: [...execution.selection.domains],
|
|
123
|
+
available
|
|
124
|
+
};
|
|
125
|
+
const selected = await execution.client.request({
|
|
126
|
+
kind: "select",
|
|
127
|
+
title: pickerTitle(listing),
|
|
128
|
+
options: domainToggleOptions(listing).map((label) => ({
|
|
129
|
+
label,
|
|
130
|
+
value: label
|
|
131
|
+
}))
|
|
132
|
+
});
|
|
133
|
+
if (typeof selected !== "string" || !selected) return;
|
|
134
|
+
const domains = domainSelectionReply(selected);
|
|
135
|
+
fullSet = domains !== null;
|
|
136
|
+
requested = domains ?? toggledDomains(listing.effective, toggleOptionDomain(selected));
|
|
137
|
+
}
|
|
138
|
+
requested = normalizeDomainNames(requested);
|
|
139
|
+
const unknown = requested.filter((name) => !available.includes(name));
|
|
140
|
+
if (unknown.length > 0) throw new Error(`Unknown domain: ${unknown.join(", ")}`);
|
|
141
|
+
if (fullSet) {
|
|
142
|
+
const wanted = new Set(requested);
|
|
143
|
+
const current = new Set(execution.selection.domains);
|
|
144
|
+
requested = [...execution.selection.domains.filter((name) => wanted.has(name)), ...available.filter((name) => wanted.has(name) && !current.has(name))];
|
|
145
|
+
}
|
|
146
|
+
if (requested.length === execution.selection.domains.length && requested.every((name, index) => name === execution.selection.domains[index])) return;
|
|
147
|
+
await host.changeSelection({
|
|
148
|
+
axis: "domains",
|
|
149
|
+
domains: requested
|
|
150
|
+
});
|
|
151
|
+
const projection = {
|
|
152
|
+
version: 1,
|
|
153
|
+
revision: Date.now()
|
|
154
|
+
};
|
|
155
|
+
await execution.session.appendCustomEntry(DOOM_RESOURCE_CATALOG_ENTRY_TYPE, projection);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/extensions/workspaces/sessions/(backend)/command/domains.server.ts
|
|
161
|
+
var domains_server_default$1 = defineRoutedContribution(({ agent }) => agent ? createDomainServerCommand(agent) : void 0, { cardinality: "optional" });
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/domains.server.ts
|
|
164
|
+
var domains_server_default = defineRoutedContribution((context) => context.root.resources, { cardinality: "many" });
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/extensions/workspaces/sessions/(backend)/resource/poAuthorDomain.server.ts
|
|
167
|
+
var poAuthorDomain_server_default = defineResource({
|
|
168
|
+
name: "po-author-domain",
|
|
169
|
+
description: "Configure Po plugin catalogs and domain resource selections in domains.yaml. Use when creating or editing .po/domains.yaml or ~/.po/domains.yaml, choosing local, Git, or npm plugins, filtering plugin resources, setting aliases or defaults, or verifying resolved domain composition.",
|
|
170
|
+
when: {
|
|
171
|
+
state: { "minor-mode": "help" },
|
|
172
|
+
attribution: {
|
|
173
|
+
kind: "minor",
|
|
174
|
+
mode: "help"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
kind: "skill",
|
|
178
|
+
path: packageResourcePath(import.meta.url, "src/prompts/po-author-domain/SKILL.md"),
|
|
179
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/po-author-domain/SKILL.md")
|
|
180
|
+
});
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region generated/server.ts
|
|
183
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
184
|
+
const many = (value, context) => {
|
|
185
|
+
const resolved = typeof value === "function" ? value(context) : value;
|
|
186
|
+
return Array.isArray(resolved) ? resolved : [resolved];
|
|
187
|
+
};
|
|
188
|
+
/* v8 ignore next -- generated normalization branch */
|
|
189
|
+
const defined = (values) => values.filter((value) => value !== void 0);
|
|
190
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
191
|
+
...identity,
|
|
192
|
+
...value
|
|
193
|
+
};
|
|
194
|
+
const facet = defineServerPlugin({
|
|
195
|
+
name: "@agimon-ai/po-domain",
|
|
196
|
+
providerOverrides: composeServerProviderOverrides(root_server_default),
|
|
197
|
+
session: async (context) => {
|
|
198
|
+
const scopeSession = await root_server_default(context);
|
|
199
|
+
const contextSession = {
|
|
200
|
+
...context,
|
|
201
|
+
root: scopeSession.value
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
...composeRootHooks(scopeSession),
|
|
205
|
+
get commands() {
|
|
206
|
+
return defined([via({ name: "domains" }, at(domains_server_default$1, contextSession))]);
|
|
207
|
+
},
|
|
208
|
+
get resources() {
|
|
209
|
+
return [...many(domains_server_default, contextSession), at(poAuthorDomain_server_default, contextSession)];
|
|
210
|
+
},
|
|
211
|
+
services: [...scopeSession.services ?? []],
|
|
212
|
+
get activities() {
|
|
213
|
+
return [...scopeSession.activities ?? []];
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
//#endregion
|
|
219
|
+
export { facet as default, facet };
|
|
220
|
+
|
|
221
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["rootSession","commandDomains","resourceDomains","resourcePoAuthorDomain"],"sources":["../../src/extensions/workspaces/sessions/(backend)/_lib/domainServerResources.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/domainServerCommand.ts","../../src/extensions/workspaces/sessions/(backend)/command/domains.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/domains.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/poAuthorDomain.server.ts","../../generated/server.ts"],"sourcesContent":["import { mkdtemp, readFile, rm } from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { listDomainNames, resolvePluginEntries } from '@agimon-ai/po-config/domains';\nimport type { DoomHeadlessExecutionContext, DoomHeadlessResource } from '@agimon-ai/po-core/headless';\n\nimport { materializePluginEntries } from '../../../../../services/pluginMaterializer';\nimport { collectResources } from '../../../../../services/resourceCollector';\n\n/** Retain valid domains behind selection conditions; a broken neighbor must not prevent startup. */\nexport async function domainServerResources(context: DoomHeadlessExecutionContext): Promise<DoomHeadlessResource[]> {\n const resources: DoomHeadlessResource[] = [];\n const home = context.environment.HOME ?? os.homedir();\n for (const domain of listDomainNames(context.repoRoot, home)) {\n // Own staging here so collection failures also release their temporary files.\n const temporaryDirectory = await mkdtemp(path.join(os.tmpdir(), 'doom-domain-'));\n try {\n const plugins = await materializePluginEntries(resolvePluginEntries(context.repoRoot, [domain], [], home));\n const collected = await collectResources(context.repoRoot, plugins, {\n agents: false,\n mcp: false,\n sharedSkills: false,\n temporaryDirectory,\n });\n for (const skill of collected.skillSources) {\n resources.push({\n name: skill.name,\n description: skill.description,\n path: skill.path,\n kind: 'skill',\n when: { domain, attribution: { kind: 'domain', mode: domain } },\n read: () => readFile(skill.path, 'utf8'),\n });\n }\n } catch (error) {\n await context.client.notify({\n title: `Po domain ${domain} unavailable`,\n body: error instanceof Error ? error.message : String(error),\n level: 'warning',\n });\n } finally {\n await rm(temporaryDirectory, { recursive: true, force: true });\n }\n }\n return resources;\n}\n","import { mkdtemp, rm } from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { resolvePluginEntries } from '@agimon-ai/po-config/domains';\nimport { loadHarnessState } from '@agimon-ai/po-config/harnessStore';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport {\n DOOM_MCP_PROJECTION_RESOLVER_SERVICE,\n type DoomMcpProjectionResolverService,\n} from '@agimon-ai/po-core/mcpProjection';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { resolveMcpAllowlist } from '../../../../services/mcpFilter';\nimport { materializePluginEntries } from '../../../../services/pluginMaterializer';\nimport { stageMcpResources } from '../../../../services/resourceCollector';\nimport { domainServerResources } from './_lib/domainServerResources';\nimport type { DomainServerScope } from './_lib/serverScope';\n\nexport default defineRoot(async ({ agent }: DoomServerPluginContext) => {\n const services: Array<(cordis: Context) => void> = [];\n if (agent) {\n const execution = agent.context;\n const home = execution.environment.HOME ?? os.homedir();\n const resolver: DoomMcpProjectionResolverService = {\n async resolve(domains) {\n const { state } = loadHarnessState({ ...execution.environment });\n const directory = await mkdtemp(path.join(os.tmpdir(), 'doom-domain-mcp-'));\n try {\n const plugins = await materializePluginEntries(\n resolvePluginEntries(execution.repoRoot, [...domains], [...state.pluginDirectories], home),\n );\n const staged = await stageMcpResources(execution.repoRoot, plugins, {\n enabled: true,\n temporaryDirectory: directory,\n mcpAllowlist: resolveMcpAllowlist(execution.repoRoot, [...domains]),\n });\n return {\n projection: staged.mcpProjection,\n cleanup: () => rm(directory, { recursive: true, force: true }),\n };\n } catch (error) {\n await rm(directory, { recursive: true, force: true });\n throw error;\n }\n },\n };\n services.push((cordis) => {\n cordis.plugin((provider) => {\n provider.provide(DOOM_MCP_PROJECTION_RESOLVER_SERVICE, resolver);\n });\n });\n }\n return {\n value: { resources: agent ? await domainServerResources(agent.context) : [] } satisfies DomainServerScope,\n services,\n };\n});\n","import { listDomainNames } from '@agimon-ai/po-config/domains';\nimport { type DoomHeadlessCommand, type DoomHeadlessHostService } from '@agimon-ai/po-core/headless';\nimport { DOOM_RESOURCE_CATALOG_ENTRY_TYPE, type ResourceCatalogProjection } from '@agimon-ai/po-core/skills';\n\nimport {\n DOMAIN_COMMAND,\n domainToggleOptions,\n normalizeDomainNames,\n pickerTitle,\n splitDomains,\n toggledDomains,\n toggleOptionDomain,\n} from '../../../../../services/domainText';\n\nconst DOMAIN_SELECTION_KIND = 'po-domains-selection';\nconst DOMAIN_SELECTION_VERSION = 1;\n\n/** Full-set web replies share the string transport with legacy single-toggle labels. */\nfunction domainSelectionReply(answer: string): string[] | null {\n if (!answer.trimStart().startsWith('{')) return null;\n const reply: unknown = JSON.parse(answer);\n if (\n typeof reply !== 'object' ||\n reply === null ||\n !('kind' in reply) ||\n reply.kind !== DOMAIN_SELECTION_KIND ||\n !('version' in reply) ||\n reply.version !== DOMAIN_SELECTION_VERSION ||\n !('domains' in reply) ||\n !Array.isArray(reply.domains) ||\n !reply.domains.every((name: unknown): name is string => typeof name === 'string')\n ) {\n throw new Error('Invalid domains selection reply');\n }\n return reply.domains;\n}\n\nexport function createDomainServerCommand(host: DoomHeadlessHostService): DoomHeadlessCommand {\n return {\n name: DOMAIN_COMMAND,\n description: 'Show or change the active Po domains.',\n async execute(args, execution) {\n const available = listDomainNames(execution.repoRoot);\n let requested = splitDomains(args);\n let fullSet = false;\n if (requested.length === 0) {\n const listing = {\n active: [...execution.selection.domains],\n effective: [...execution.selection.domains],\n available,\n };\n const selected = await execution.client.request({\n kind: 'select',\n title: pickerTitle(listing),\n options: domainToggleOptions(listing).map((label) => ({ label, value: label })),\n });\n if (typeof selected !== 'string' || !selected) return;\n const domains = domainSelectionReply(selected);\n fullSet = domains !== null;\n requested = domains ?? toggledDomains(listing.effective, toggleOptionDomain(selected));\n }\n requested = normalizeDomainNames(requested);\n const unknown = requested.filter((name) => !available.includes(name));\n if (unknown.length > 0) throw new Error(`Unknown domain: ${unknown.join(', ')}`);\n if (fullSet) {\n const wanted = new Set(requested);\n const current = new Set(execution.selection.domains);\n requested = [\n ...execution.selection.domains.filter((name) => wanted.has(name)),\n ...available.filter((name) => wanted.has(name) && !current.has(name)),\n ];\n }\n if (\n requested.length === execution.selection.domains.length &&\n requested.every((name, index) => name === execution.selection.domains[index])\n ) {\n return;\n }\n await host.changeSelection({ axis: 'domains', domains: requested });\n // The web composer caches get_commands for `$` completion. Signal only after\n // the headless host has reconciled commands so the re-read sees this selection.\n const projection: ResourceCatalogProjection = { version: 1, revision: Date.now() };\n await execution.session.appendCustomEntry(DOOM_RESOURCE_CATALOG_ENTRY_TYPE, projection);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createDomainServerCommand } from '../_lib/domainServerCommand';\nexport default defineRoutedContribution(\n ({ agent }: DoomServerPluginContext) => (agent ? createDomainServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { DomainServerScope } from '../_lib/serverScope';\n\nexport default defineRoutedContribution(\n (context: WithRoot<DoomServerPluginContext, DomainServerScope>) => context.root.resources,\n { cardinality: 'many' },\n);\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverFacet';\n\nexport default defineResource({\n name: 'po-author-domain',\n description:\n 'Configure Po plugin catalogs and domain resource selections in domains.yaml. Use when creating or editing .po/domains.yaml or ~/.po/domains.yaml, choosing local, Git, or npm plugins, filtering plugin resources, setting aliases or defaults, or verifying resolved domain composition.',\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/po-author-domain/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-author-domain/SKILL.md'),\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/po-core/serverFacet';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport commandDomains from '../src/extensions/workspaces/sessions/(backend)/command/domains.server';\nimport resourceDomains from '../src/extensions/workspaces/sessions/(backend)/resource/domains.server';\nimport resourcePoAuthorDomain from '../src/extensions/workspaces/sessions/(backend)/resource/poAuthorDomain.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\ntype ManyFactory<T, C> = (context: C) => T | readonly T[];\nconst many = <T, C>(value: T | readonly T[] | ManyFactory<T, C>, context: C): readonly T[] => {\n const resolved = typeof value === 'function' ? (value as ManyFactory<T, C>)(context) : value;\n return Array.isArray(resolved) ? resolved : [resolved as T];\n};\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/po-domain',\n providerOverrides: composeServerProviderOverrides(rootSession),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): DoomServerSessionPlugin['commands'] { return defined([via({ name: 'domains' }, at(commandDomains, contextSession))]); },\n get resources(): DoomServerSessionPlugin['resources'] { return [...many(resourceDomains, contextSession), at(resourcePoAuthorDomain, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;;;;;;;;AAWA,eAAsB,sBAAsB,SAAwE;CAClH,MAAM,YAAoC,CAAC;CAC3C,MAAM,OAAO,QAAQ,YAAY,QAAQ,GAAG,QAAQ;CACpD,KAAK,MAAM,UAAU,gBAAgB,QAAQ,UAAU,IAAI,GAAG;EAE5D,MAAM,qBAAqB,MAAM,QAAQ,KAAK,KAAK,GAAG,OAAO,GAAG,cAAc,CAAC;EAC/E,IAAI;GACF,MAAM,UAAU,MAAM,yBAAyB,qBAAqB,QAAQ,UAAU,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC;GACzG,MAAM,YAAY,MAAM,iBAAiB,QAAQ,UAAU,SAAS;IAClE,QAAQ;IACR,KAAK;IACL,cAAc;IACd;GACF,CAAC;GACD,KAAK,MAAM,SAAS,UAAU,cAC5B,UAAU,KAAK;IACb,MAAM,MAAM;IACZ,aAAa,MAAM;IAC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oB,YAAY,KAAK,uCAAuC;AAC1F,CAAC;;;ACAD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAM,QAAc,OAA6C,YAA6B;CAC5F,MAAM,WAAW,OAAO,UAAU,aAAc,MAA4B,OAAO,IAAI;CACvF,OAAO,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAa;AAC5D;;AAEA,MAAM,WAAc,WAClB,OAAO,QAAQ,UAAsB,UAAU,KAAA,CAAS;AAC1D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,QAAQ,mBAAmB;CACtC,MAAM;CACN,mBAAmB,+BAA+BA,mBAAW;CAC7D,SAAS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAMA,oBAAY,OAAO;EAC9C,MAAM,iBAAiB;GAAE,GAAG;GAAS,MAAM,aAAa;EAAM;EAC9D,OAAO;GACL,GAAG,iBAAiB,YAAY;GAChC,IAAI,WAAgD;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,0BAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GACtI,IAAI,YAAkD;IAAE,OAAO,CAAC,GAAG,KAAKC,wBAAiB,cAAc,GAAG,GAAGC,+BAAwB,cAAc,CAAC;GAAG;GACvJ,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineSelectionAxis, defineWebPlugin } from "@agimon-ai/po-core/web";
|
|
2
|
+
//#region src/extensions/workspaces/sessions/(frontend)/selection-axis/domains.web.ts
|
|
3
|
+
var domains_web_default = defineSelectionAxis({
|
|
4
|
+
name: "domains",
|
|
5
|
+
command: "domains",
|
|
6
|
+
statusKey: "doom-domain",
|
|
7
|
+
emptyLabel: "no domains",
|
|
8
|
+
multi: true,
|
|
9
|
+
order: 20
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region generated/web.ts
|
|
13
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
14
|
+
...identity,
|
|
15
|
+
...value
|
|
16
|
+
};
|
|
17
|
+
const webPlugin = defineWebPlugin({
|
|
18
|
+
id: "domain",
|
|
19
|
+
session: { get selectionAxes() {
|
|
20
|
+
return [via({ name: "domains" }, domains_web_default)];
|
|
21
|
+
} }
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { webPlugin };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=web.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.mjs","names":["selectionAxisDomains"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/selection-axis/domains.web.ts","../../generated/web.ts"],"sourcesContent":["import { defineSelectionAxis } from '@agimon-ai/po-core/web';\nexport default defineSelectionAxis({\n name: 'domains',\n command: 'domains',\n statusKey: 'doom-domain',\n emptyLabel: 'no domains',\n multi: true,\n order: 20,\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport selectionAxisDomains from '../src/extensions/workspaces/sessions/(frontend)/selection-axis/domains.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'domain',\n session: {\n get selectionAxes(): WebPluginContributions['selectionAxes'] { return [via({ name: 'domains' }, selectionAxisDomains)]; },\n },\n});\n"],"mappings":";;AACA,IAAA,sBAAe,oBAAoB;CACjC,MAAM;CACN,SAAS;CACT,WAAW;CACX,YAAY;CACZ,OAAO;CACP,OAAO;AACT,CAAC;;;ACHD,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,UAAU,GAAGA,mBAAoB,CAAC;CAAG,EAC1H;AACF,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_toolNames = require("./toolNames-Cuu-u8r1.cjs");
|
|
3
|
+
const require_domainText = require("./domainText-UIRIz6-_.cjs");
|
|
4
|
+
exports.DOMAIN_COMMAND = require_domainText.DOMAIN_COMMAND;
|
|
5
|
+
exports.DOMAIN_SOURCE = require_domainText.DOMAIN_SOURCE;
|
|
6
|
+
exports.DOMAIN_STATUS_KEY = require_domainText.DOMAIN_STATUS_KEY;
|
|
7
|
+
exports.NONE = require_domainText.NONE;
|
|
8
|
+
exports.SAFE_DOMAIN_NAME = require_domainText.SAFE_DOMAIN_NAME;
|
|
9
|
+
exports.domainItems = require_domainText.domainItems;
|
|
10
|
+
exports.domainStatus = require_domainText.domainStatus;
|
|
11
|
+
exports.domainSummary = require_domainText.domainSummary;
|
|
12
|
+
exports.errorMessage = require_domainText.errorMessage;
|
|
13
|
+
exports.normalizeDomainNames = require_domainText.normalizeDomainNames;
|
|
14
|
+
exports.pickerTitle = require_domainText.pickerTitle;
|
|
15
|
+
exports.splitDomains = require_domainText.splitDomains;
|
|
16
|
+
exports.switchedSummary = require_domainText.switchedSummary;
|
|
17
|
+
exports.toPiToolName = require_toolNames.toPiToolName;
|
|
18
|
+
exports.transitionError = require_domainText.transitionError;
|
|
19
|
+
exports.unchangedSummary = require_domainText.unchangedSummary;
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DoomTransitionResult } from "@agimon-ai/po-core/transition";
|
|
2
|
+
//#region src/types/domains.d.ts
|
|
3
|
+
/** The npm name this package registers its voice tools and contributions under. */
|
|
4
|
+
export declare const DOMAIN_SOURCE = "@agimon-ai/po-domain";
|
|
5
|
+
/**
|
|
6
|
+
* The only names a domain, an operation or a handoff token may carry.
|
|
7
|
+
*
|
|
8
|
+
* Selections arrive from the model and from the command line, and every one of
|
|
9
|
+
* them ends up in a filesystem path or a process environment variable, so the
|
|
10
|
+
* shape is constrained once here and reused by the schema and the validator.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SAFE_DOMAIN_NAME: RegExp;
|
|
13
|
+
/**
|
|
14
|
+
* The selection as the command, the picker and the voice tool all need to see it.
|
|
15
|
+
*
|
|
16
|
+
* `active` is what the session persisted and `effective` is what it is running
|
|
17
|
+
* with, which differ while a major mode contributes its default domains.
|
|
18
|
+
*/
|
|
19
|
+
interface DomainListing {
|
|
20
|
+
readonly active: string[];
|
|
21
|
+
readonly effective: string[];
|
|
22
|
+
readonly available: string[];
|
|
23
|
+
}
|
|
24
|
+
/** One comma-triggered autocomplete response for the `/domains` argument. */
|
|
25
|
+
interface DomainCompletion {
|
|
26
|
+
readonly prefix: string;
|
|
27
|
+
readonly items: Array<{
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/services/domainText/index.d.ts
|
|
34
|
+
interface SelectItem {
|
|
35
|
+
value: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const DOMAIN_COMMAND = "domains";
|
|
40
|
+
/** Footer status key the cockpit's domains axis reads. */
|
|
41
|
+
export declare const DOMAIN_STATUS_KEY = "doom-domain";
|
|
42
|
+
/** What an empty selection reads as, which is a real state rather than an error. */
|
|
43
|
+
export declare const NONE = "(none)";
|
|
44
|
+
/** Splits the comma-separated argument the command and the autocomplete share. */
|
|
45
|
+
export declare function splitDomains(value: string): string[];
|
|
46
|
+
/** The published axis content: the active domains in the same comma-separated shape splitDomains reads. */
|
|
47
|
+
export declare function domainStatus(domains: readonly string[]): string;
|
|
48
|
+
/** Picker rows for the domain multi-select. */
|
|
49
|
+
export declare function domainItems(names: string[], descriptions?: Readonly<Record<string, string | undefined>>): SelectItem[];
|
|
50
|
+
export declare function domainSummary(listing: DomainListing): string;
|
|
51
|
+
export declare function switchedSummary(domains: readonly string[]): string;
|
|
52
|
+
export declare function unchangedSummary(domains: readonly string[]): string;
|
|
53
|
+
export declare function pickerTitle(listing: DomainListing): string;
|
|
54
|
+
/**
|
|
55
|
+
* Deduplicates a requested selection and rejects anything unsafe.
|
|
56
|
+
*
|
|
57
|
+
* Bounded before the manifest is read, because a selection large enough to
|
|
58
|
+
* matter comes from the model rather than from a person typing the command.
|
|
59
|
+
*/
|
|
60
|
+
export declare function normalizeDomainNames(values: readonly string[]): string[];
|
|
61
|
+
export declare function errorMessage(error: unknown): string;
|
|
62
|
+
export declare function transitionError(result: DoomTransitionResult): Error;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/services/toolNames/index.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* Translation from Claude tool names to Pi tool names.
|
|
67
|
+
*
|
|
68
|
+
* Agent definitions inside a domain's plugins are authored with Claude names and
|
|
69
|
+
* have to be rewritten before Pi loads them. The reverse map is derived from the
|
|
70
|
+
* forward one so a name that is already written for Pi passes through without a
|
|
71
|
+
* second hand-maintained table to keep in step.
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Pi's name for a tool named in an agent definition.
|
|
75
|
+
*
|
|
76
|
+
* Returns undefined for Skill, which Pi discovers rather than declares. Web and
|
|
77
|
+
* MCP tools all collapse onto Pi's single `mcp` tool. Definitions already
|
|
78
|
+
* written against Pi pass through unchanged, and an unrecognised name throws
|
|
79
|
+
* rather than reaching Pi as a tool it will silently ignore.
|
|
80
|
+
*/
|
|
81
|
+
export declare function toPiToolName(tool: string): string | undefined;
|
|
82
|
+
//#endregion
|
|
83
|
+
export type { DomainCompletion, DomainListing };
|
|
84
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/domains.ts","../src/services/domainText/index.ts","../src/services/toolNames/index.ts"],"mappings":";;;qBACa;;;;;;;;qBASA,kBAAgB;;;;;;;UAQZ;WACN;WACA;WACA;;;UAIM;WACN;WACA,OAAO;IAAQ;IAAe;;;;;UCtB/B;EACR;EACA;EACA;;qBAIW;;qBAEA;;qBAEA;;wBAGG,aAAa;;wBAQb,aAAa;;wBAKb,YACd,iBACA,eAAc,SAAS,sCACtB;wBAQa,cAAc,SAAS;wBAKvB,gBAAgB;wBAIhB,iBAAiB;wBAIjB,YAAY,SAAS;;;;;;;wBAkCrB,qBAAqB;wBAkBrB,aAAa;wBAIb,gBAAgB,QAAQ,uBAAuB;;;;;;;;;;;;;;;;;;;wBC9E/C,aAAa"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { t as toPiToolName } from "./toolNames-Ckp5VLMD.mjs";
|
|
2
|
+
import { _ as DOMAIN_SOURCE, a as domainStatus, c as errorMessage, d as splitDomains, f as switchedSummary, g as unchangedSummary, h as transitionError, i as domainItems, l as normalizeDomainNames, n as DOMAIN_STATUS_KEY, o as domainSummary, r as NONE, t as DOMAIN_COMMAND, u as pickerTitle, v as SAFE_DOMAIN_NAME } from "./domainText-Dm8k7p4z.mjs";
|
|
3
|
+
export { DOMAIN_COMMAND, DOMAIN_SOURCE, DOMAIN_STATUS_KEY, NONE, SAFE_DOMAIN_NAME, domainItems, domainStatus, domainSummary, errorMessage, normalizeDomainNames, pickerTitle, splitDomains, switchedSummary, toPiToolName, transitionError, unchangedSummary };
|
package/dist/mcp.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_mcpFilter = require("./mcpFilter-CZNmU_VF.cjs");
|
|
3
|
+
let _agimon_ai_po_config_agentPluginMcp = require("@agimon-ai/po-config/agentPluginMcp");
|
|
4
|
+
let _agimon_ai_po_core_mcpSession = require("@agimon-ai/po-core/mcpSession");
|
|
5
|
+
//#region src/services/mcpSessionEnvironment/index.ts
|
|
6
|
+
/** Projects the complete domain-selected MCP picture into the Pi session environment. */
|
|
7
|
+
function mcpSessionEnvironment(input) {
|
|
8
|
+
const configuration = {
|
|
9
|
+
repoRoot: input.repoRoot,
|
|
10
|
+
stagingDirectory: input.stagingDirectory,
|
|
11
|
+
...input.generatedConfigPath ? { generatedConfigPath: input.generatedConfigPath } : {},
|
|
12
|
+
...input.pluginConfigPaths?.length ? { pluginConfigPaths: [...input.pluginConfigPaths] } : {},
|
|
13
|
+
...input.allowlist ? { allowlist: structuredClone(input.allowlist) } : {}
|
|
14
|
+
};
|
|
15
|
+
return (0, _agimon_ai_po_core_mcpSession.doomMcpSessionEnvironment)(configuration);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.PROXY_SERVER_NAME = require_mcpFilter.PROXY_SERVER_NAME;
|
|
19
|
+
exports.applyMcpAllowlist = require_mcpFilter.applyMcpAllowlist;
|
|
20
|
+
exports.filterMcpServers = require_mcpFilter.filterMcpServers;
|
|
21
|
+
exports.filterProxyConfig = require_mcpFilter.filterProxyConfig;
|
|
22
|
+
exports.mcpSessionEnvironment = mcpSessionEnvironment;
|
|
23
|
+
Object.defineProperty(exports, "normalizeAgentPluginMcpSource", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return _agimon_ai_po_config_agentPluginMcp.normalizeAgentPluginMcpSource;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
exports.persistMcpConfig = require_mcpFilter.persistMcpConfig;
|
|
30
|
+
exports.resolveMcpAllowlist = require_mcpFilter.resolveMcpAllowlist;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=mcp.cjs.map
|
package/dist/mcp.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["doomMcpSessionEnvironment"],"sources":["../src/services/mcpSessionEnvironment/index.ts"],"sourcesContent":["import {\n type DoomMcpSessionAllowlist,\n type DoomMcpSessionConfig,\n doomMcpSessionEnvironment,\n} from '@agimon-ai/po-core/mcpSession';\n\nexport interface McpSessionEnvironmentInput {\n readonly repoRoot: string;\n readonly stagingDirectory: string;\n readonly generatedConfigPath?: string;\n readonly pluginConfigPaths?: readonly string[];\n readonly allowlist?: DoomMcpSessionAllowlist;\n}\n\n/** Projects the complete domain-selected MCP picture into the Pi session environment. */\nexport function mcpSessionEnvironment(input: McpSessionEnvironmentInput): Record<string, string> {\n const configuration: DoomMcpSessionConfig = {\n repoRoot: input.repoRoot,\n stagingDirectory: input.stagingDirectory,\n ...(input.generatedConfigPath ? { generatedConfigPath: input.generatedConfigPath } : {}),\n ...(input.pluginConfigPaths?.length ? { pluginConfigPaths: [...input.pluginConfigPaths] } : {}),\n ...(input.allowlist ? { allowlist: structuredClone(input.allowlist) } : {}),\n };\n return doomMcpSessionEnvironment(configuration);\n}\n"],"mappings":";;;;;;AAeA,SAAgB,sBAAsB,OAA2D;CAC/F,MAAM,gBAAsC;EAC1C,UAAU,MAAM;EAChB,kBAAkB,MAAM;EACxB,GAAI,MAAM,sBAAsB,EAAE,qBAAqB,MAAM,oBAAoB,IAAI,CAAC;EACtF,GAAI,MAAM,mBAAmB,SAAS,EAAE,mBAAmB,CAAC,GAAG,MAAM,iBAAiB,EAAE,IAAI,CAAC;EAC7F,GAAI,MAAM,YAAY,EAAE,WAAW,gBAAgB,MAAM,SAAS,EAAE,IAAI,CAAC;CAC3E;CACA,QAAA,GAAOA,8BAAAA,0BAAAA,CAA0B,aAAa;AAChD"}
|
package/dist/mcp.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { r as JsonObject } from "./resources-BEjxE3Zn.mjs";
|
|
2
|
+
import { DomainMcpAllowlist } from "@agimon-ai/po-config/domains";
|
|
3
|
+
import { AgentPluginMcpConfigSource, NormalizeAgentPluginMcpOptions, NormalizedAgentPluginMcpSource, normalizeAgentPluginMcpSource } from "@agimon-ai/po-config/agentPluginMcp";
|
|
4
|
+
import { DoomMcpSessionAllowlist } from "@agimon-ai/po-core/mcpSession";
|
|
5
|
+
//#region src/services/mcpFilter/index.d.ts
|
|
6
|
+
/** Server name in .mcp.json whose upstreams are declared in mcp-config.yaml. */
|
|
7
|
+
export declare const PROXY_SERVER_NAME = "agiflow-proxy";
|
|
8
|
+
/**
|
|
9
|
+
* Unions the mcp allowlists of the selected domains.
|
|
10
|
+
*
|
|
11
|
+
* Returns undefined when any selected domain omits `mcp`, which means "give me
|
|
12
|
+
* everything". Filtering only kicks in once every selected domain has opted in,
|
|
13
|
+
* so a domain that has not been migrated yet cannot silently lose its tools.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveMcpAllowlist(repoRoot: string, domainNames: string[]): DomainMcpAllowlist | undefined;
|
|
16
|
+
/** Drops servers that are not on the allowlist. An empty list means keep all. */
|
|
17
|
+
export declare function filterMcpServers(config: JsonObject, allowed?: string[]): JsonObject;
|
|
18
|
+
/**
|
|
19
|
+
* Rewrites the proxy's upstream list, keeping only allowed servers.
|
|
20
|
+
*
|
|
21
|
+
* Entries are removed rather than marked disabled so a filtered upstream cannot
|
|
22
|
+
* be reached even if the proxy ignores the disabled flag. Comments in the
|
|
23
|
+
* source file are not preserved; the result is a per-run temporary file.
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterProxyConfig(yamlText: string, allowed?: string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Copies a generated MCP config out of the run directory so another frontend
|
|
28
|
+
* can use it, keeping the proxy's --config pointing at the copy.
|
|
29
|
+
*
|
|
30
|
+
* The run directory is deleted when the harness exits, so emitting for
|
|
31
|
+
* claude.sh or codex.sh has to relocate both files together.
|
|
32
|
+
*/
|
|
33
|
+
export declare function persistMcpConfig(sourceConfigPath: string, temporaryDirectory: string, targetDirectory: string): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Applies the allowlist to a merged MCP config, writing a filtered proxy config
|
|
36
|
+
* into the run directory and repointing the proxy at it when needed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function applyMcpAllowlist(config: JsonObject, allowlist: DomainMcpAllowlist | undefined, repoRoot: string, temporaryDirectory: string): Promise<JsonObject>;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/services/mcpSessionEnvironment/index.d.ts
|
|
41
|
+
interface McpSessionEnvironmentInput {
|
|
42
|
+
readonly repoRoot: string;
|
|
43
|
+
readonly stagingDirectory: string;
|
|
44
|
+
readonly generatedConfigPath?: string;
|
|
45
|
+
readonly pluginConfigPaths?: readonly string[];
|
|
46
|
+
readonly allowlist?: DoomMcpSessionAllowlist;
|
|
47
|
+
}
|
|
48
|
+
/** Projects the complete domain-selected MCP picture into the Pi session environment. */
|
|
49
|
+
export declare function mcpSessionEnvironment(input: McpSessionEnvironmentInput): Record<string, string>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { type AgentPluginMcpConfigSource, type McpSessionEnvironmentInput, type NormalizeAgentPluginMcpOptions, type NormalizedAgentPluginMcpSource, normalizeAgentPluginMcpSource };
|
|
52
|
+
//# sourceMappingURL=mcp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/services/mcpFilter/index.ts","../src/services/mcpSessionEnvironment/index.ts"],"mappings":";;;;;;qBASa;;;;;;;;wBAWG,oBAAoB,kBAAkB,wBAAwB;;wBAiB9D,iBAAiB,QAAQ,YAAY,qBAAqB;;;;;;;;wBAiB1D,kBAAkB,kBAAkB;;;;;;;;wBAoC9B,iBACpB,0BACA,4BACA,0BACC;;;;;wBA8BmB,kBACpB,QAAQ,YACR,WAAW,gCACX,kBACA,6BACC,QAAQ;;;UC3HM;WACN;WACA;WACA;WACA;WACA,YAAY;;;wBAIP,sBAAsB,OAAO,6BAA6B"}
|
package/dist/mcp.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a as persistMcpConfig, i as filterProxyConfig, n as applyMcpAllowlist, o as resolveMcpAllowlist, r as filterMcpServers, t as PROXY_SERVER_NAME } from "./mcpFilter-Cf-czy8O.mjs";
|
|
2
|
+
import { normalizeAgentPluginMcpSource } from "@agimon-ai/po-config/agentPluginMcp";
|
|
3
|
+
import { doomMcpSessionEnvironment } from "@agimon-ai/po-core/mcpSession";
|
|
4
|
+
//#region src/services/mcpSessionEnvironment/index.ts
|
|
5
|
+
/** Projects the complete domain-selected MCP picture into the Pi session environment. */
|
|
6
|
+
function mcpSessionEnvironment(input) {
|
|
7
|
+
const configuration = {
|
|
8
|
+
repoRoot: input.repoRoot,
|
|
9
|
+
stagingDirectory: input.stagingDirectory,
|
|
10
|
+
...input.generatedConfigPath ? { generatedConfigPath: input.generatedConfigPath } : {},
|
|
11
|
+
...input.pluginConfigPaths?.length ? { pluginConfigPaths: [...input.pluginConfigPaths] } : {},
|
|
12
|
+
...input.allowlist ? { allowlist: structuredClone(input.allowlist) } : {}
|
|
13
|
+
};
|
|
14
|
+
return doomMcpSessionEnvironment(configuration);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { PROXY_SERVER_NAME, applyMcpAllowlist, filterMcpServers, filterProxyConfig, mcpSessionEnvironment, normalizeAgentPluginMcpSource, persistMcpConfig, resolveMcpAllowlist };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=mcp.mjs.map
|
package/dist/mcp.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":[],"sources":["../src/services/mcpSessionEnvironment/index.ts"],"sourcesContent":["import {\n type DoomMcpSessionAllowlist,\n type DoomMcpSessionConfig,\n doomMcpSessionEnvironment,\n} from '@agimon-ai/po-core/mcpSession';\n\nexport interface McpSessionEnvironmentInput {\n readonly repoRoot: string;\n readonly stagingDirectory: string;\n readonly generatedConfigPath?: string;\n readonly pluginConfigPaths?: readonly string[];\n readonly allowlist?: DoomMcpSessionAllowlist;\n}\n\n/** Projects the complete domain-selected MCP picture into the Pi session environment. */\nexport function mcpSessionEnvironment(input: McpSessionEnvironmentInput): Record<string, string> {\n const configuration: DoomMcpSessionConfig = {\n repoRoot: input.repoRoot,\n stagingDirectory: input.stagingDirectory,\n ...(input.generatedConfigPath ? { generatedConfigPath: input.generatedConfigPath } : {}),\n ...(input.pluginConfigPaths?.length ? { pluginConfigPaths: [...input.pluginConfigPaths] } : {}),\n ...(input.allowlist ? { allowlist: structuredClone(input.allowlist) } : {}),\n };\n return doomMcpSessionEnvironment(configuration);\n}\n"],"mappings":";;;;;AAeA,SAAgB,sBAAsB,OAA2D;CAC/F,MAAM,gBAAsC;EAC1C,UAAU,MAAM;EAChB,kBAAkB,MAAM;EACxB,GAAI,MAAM,sBAAsB,EAAE,qBAAqB,MAAM,oBAAoB,IAAI,CAAC;EACtF,GAAI,MAAM,mBAAmB,SAAS,EAAE,mBAAmB,CAAC,GAAG,MAAM,iBAAiB,EAAE,IAAI,CAAC;EAC7F,GAAI,MAAM,YAAY,EAAE,WAAW,gBAAgB,MAAM,SAAS,EAAE,IAAI,CAAC;CAC3E;CACA,OAAO,0BAA0B,aAAa;AAChD"}
|