@provos/ironcurtain 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -86
- package/dist/cli-help.d.ts +63 -0
- package/dist/cli-help.js +102 -0
- package/dist/cli-help.js.map +1 -0
- package/dist/cli.js +79 -56
- package/dist/cli.js.map +1 -1
- package/dist/config/config-command.js +136 -2
- package/dist/config/config-command.js.map +1 -1
- package/dist/config/constitution-readonly.md +21 -0
- package/dist/config/generated/tool-annotations.json +487 -338
- package/dist/config/generated-readonly/compiled-policy.json +468 -0
- package/dist/config/index.d.ts +21 -1
- package/dist/config/index.js +12 -4
- package/dist/config/index.js.map +1 -1
- package/dist/config/mcp-servers.json +2 -8
- package/dist/config/paths.d.ts +47 -0
- package/dist/config/paths.js +81 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/config/tool-description-hints.json +15 -0
- package/dist/config/types.d.ts +7 -0
- package/dist/config/user-config.d.ts +21 -0
- package/dist/config/user-config.js +8 -0
- package/dist/config/user-config.js.map +1 -1
- package/dist/cron/compile-task-policy.d.ts +17 -0
- package/dist/cron/compile-task-policy.js +39 -0
- package/dist/cron/compile-task-policy.js.map +1 -0
- package/dist/cron/constitution-generator.d.ts +60 -0
- package/dist/cron/constitution-generator.js +217 -0
- package/dist/cron/constitution-generator.js.map +1 -0
- package/dist/cron/cron-scheduler.d.ts +65 -0
- package/dist/cron/cron-scheduler.js +184 -0
- package/dist/cron/cron-scheduler.js.map +1 -0
- package/dist/cron/file-lock.d.ts +41 -0
- package/dist/cron/file-lock.js +156 -0
- package/dist/cron/file-lock.js.map +1 -0
- package/dist/cron/format-utils.d.ts +18 -0
- package/dist/cron/format-utils.js +145 -0
- package/dist/cron/format-utils.js.map +1 -0
- package/dist/cron/git-sync.d.ts +22 -0
- package/dist/cron/git-sync.js +121 -0
- package/dist/cron/git-sync.js.map +1 -0
- package/dist/cron/headless-transport.d.ts +27 -0
- package/dist/cron/headless-transport.js +43 -0
- package/dist/cron/headless-transport.js.map +1 -0
- package/dist/cron/job-commands.d.ts +39 -0
- package/dist/cron/job-commands.js +585 -0
- package/dist/cron/job-commands.js.map +1 -0
- package/dist/cron/job-customizer.d.ts +22 -0
- package/dist/cron/job-customizer.js +47 -0
- package/dist/cron/job-customizer.js.map +1 -0
- package/dist/cron/job-store.d.ts +35 -0
- package/dist/cron/job-store.js +111 -0
- package/dist/cron/job-store.js.map +1 -0
- package/dist/cron/types.d.ts +135 -0
- package/dist/cron/types.js +22 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/daemon/control-socket.d.ts +127 -0
- package/dist/daemon/control-socket.js +261 -0
- package/dist/daemon/control-socket.js.map +1 -0
- package/dist/daemon/daemon-command.d.ts +13 -0
- package/dist/daemon/daemon-command.js +230 -0
- package/dist/daemon/daemon-command.js.map +1 -0
- package/dist/daemon/ironcurtain-daemon.d.ts +90 -0
- package/dist/daemon/ironcurtain-daemon.js +550 -0
- package/dist/daemon/ironcurtain-daemon.js.map +1 -0
- package/dist/docker/adapters/claude-code.js +7 -47
- package/dist/docker/adapters/claude-code.js.map +1 -1
- package/dist/docker/adapters/goose.d.ts +58 -0
- package/dist/docker/adapters/goose.js +250 -0
- package/dist/docker/adapters/goose.js.map +1 -0
- package/dist/docker/adapters/shared-scripts.d.ts +29 -0
- package/dist/docker/adapters/shared-scripts.js +80 -0
- package/dist/docker/adapters/shared-scripts.js.map +1 -0
- package/dist/docker/agent-adapter.d.ts +12 -0
- package/dist/docker/agent-adapter.js.map +1 -1
- package/dist/docker/agent-registry.d.ts +6 -1
- package/dist/docker/agent-registry.js +10 -1
- package/dist/docker/agent-registry.js.map +1 -1
- package/dist/docker/docker-agent-session.d.ts +2 -25
- package/dist/docker/docker-agent-session.js +7 -106
- package/dist/docker/docker-agent-session.js.map +1 -1
- package/dist/docker/docker-infrastructure.d.ts +8 -0
- package/dist/docker/docker-infrastructure.js +12 -11
- package/dist/docker/docker-infrastructure.js.map +1 -1
- package/dist/docker/mitm-proxy.js +10 -5
- package/dist/docker/mitm-proxy.js.map +1 -1
- package/dist/docker/oauth-credentials.js +2 -2
- package/dist/docker/oauth-credentials.js.map +1 -1
- package/dist/docker/pty-session.js +146 -39
- package/dist/docker/pty-session.js.map +1 -1
- package/dist/escalation/escalation-watcher.d.ts +2 -0
- package/dist/escalation/escalation-watcher.js +3 -0
- package/dist/escalation/escalation-watcher.js.map +1 -1
- package/dist/escalation/session-registry.js +1 -14
- package/dist/escalation/session-registry.js.map +1 -1
- package/dist/index.js +43 -5
- package/dist/index.js.map +1 -1
- package/dist/mux/mux-app.js +11 -6
- package/dist/mux/mux-app.js.map +1 -1
- package/dist/mux/mux-command.js +49 -10
- package/dist/mux/mux-command.js.map +1 -1
- package/dist/mux/mux-input-handler.d.ts +5 -0
- package/dist/mux/mux-input-handler.js +64 -9
- package/dist/mux/mux-input-handler.js.map +1 -1
- package/dist/mux/mux-renderer.d.ts +20 -0
- package/dist/mux/mux-renderer.js +127 -35
- package/dist/mux/mux-renderer.js.map +1 -1
- package/dist/mux/mux-splash.js +2 -1
- package/dist/mux/mux-splash.js.map +1 -1
- package/dist/mux/paste-interceptor.d.ts +22 -0
- package/dist/mux/paste-interceptor.js +143 -0
- package/dist/mux/paste-interceptor.js.map +1 -0
- package/dist/mux/pty-bridge.js +1 -1
- package/dist/mux/pty-bridge.js.map +1 -1
- package/dist/mux/types.d.ts +8 -1
- package/dist/mux/types.js +17 -5
- package/dist/mux/types.js.map +1 -1
- package/dist/persona/compile-persona-policy.d.ts +21 -0
- package/dist/persona/compile-persona-policy.js +50 -0
- package/dist/persona/compile-persona-policy.js.map +1 -0
- package/dist/persona/persona-command.d.ts +9 -0
- package/dist/persona/persona-command.js +479 -0
- package/dist/persona/persona-command.js.map +1 -0
- package/dist/persona/persona-customizer.d.ts +23 -0
- package/dist/persona/persona-customizer.js +52 -0
- package/dist/persona/persona-customizer.js.map +1 -0
- package/dist/persona/persona-prompt.d.ts +19 -0
- package/dist/persona/persona-prompt.js +42 -0
- package/dist/persona/persona-prompt.js.map +1 -0
- package/dist/persona/resolve.d.ts +46 -0
- package/dist/persona/resolve.js +108 -0
- package/dist/persona/resolve.js.map +1 -0
- package/dist/persona/types.d.ts +40 -0
- package/dist/persona/types.js +20 -0
- package/dist/persona/types.js.map +1 -0
- package/dist/pipeline/annotate.js +10 -4
- package/dist/pipeline/annotate.js.map +1 -1
- package/dist/pipeline/compile.d.ts +14 -31
- package/dist/pipeline/compile.js +50 -563
- package/dist/pipeline/compile.js.map +1 -1
- package/dist/pipeline/constitution-compiler.d.ts +6 -0
- package/dist/pipeline/constitution-compiler.js +42 -6
- package/dist/pipeline/constitution-compiler.js.map +1 -1
- package/dist/pipeline/constitution-customizer.d.ts +3 -0
- package/dist/pipeline/constitution-customizer.js +19 -5
- package/dist/pipeline/constitution-customizer.js.map +1 -1
- package/dist/pipeline/customizer-loop.d.ts +34 -0
- package/dist/pipeline/customizer-loop.js +167 -0
- package/dist/pipeline/customizer-loop.js.map +1 -0
- package/dist/pipeline/mcp-connections.d.ts +16 -0
- package/dist/pipeline/mcp-connections.js +61 -0
- package/dist/pipeline/mcp-connections.js.map +1 -0
- package/dist/pipeline/pipeline-runner.d.ts +86 -0
- package/dist/pipeline/pipeline-runner.js +547 -0
- package/dist/pipeline/pipeline-runner.js.map +1 -0
- package/dist/pipeline/pipeline-shared.d.ts +37 -3
- package/dist/pipeline/pipeline-shared.js +77 -16
- package/dist/pipeline/pipeline-shared.js.map +1 -1
- package/dist/pipeline/refresh-lists.js +38 -12
- package/dist/pipeline/refresh-lists.js.map +1 -1
- package/dist/pipeline/scenario-generator.js +2 -1
- package/dist/pipeline/scenario-generator.js.map +1 -1
- package/dist/pipeline/tool-annotator.d.ts +3 -3
- package/dist/pipeline/tool-annotator.js +114 -4
- package/dist/pipeline/tool-annotator.js.map +1 -1
- package/dist/pipeline/types.d.ts +52 -0
- package/dist/sandbox/index.js +36 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/session/agent-session.d.ts +3 -0
- package/dist/session/agent-session.js +10 -1
- package/dist/session/agent-session.js.map +1 -1
- package/dist/session/index.d.ts +10 -0
- package/dist/session/index.js +134 -12
- package/dist/session/index.js.map +1 -1
- package/dist/session/preflight.js +26 -6
- package/dist/session/preflight.js.map +1 -1
- package/dist/session/prompts.d.ts +14 -0
- package/dist/session/prompts.js +39 -2
- package/dist/session/prompts.js.map +1 -1
- package/dist/session/session-manager.d.ts +105 -0
- package/dist/session/session-manager.js +134 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/session/session-metadata.d.ts +18 -0
- package/dist/session/session-metadata.js +34 -0
- package/dist/session/session-metadata.js.map +1 -0
- package/dist/session/types.d.ts +47 -0
- package/dist/session/workspace-validation.d.ts +2 -0
- package/dist/session/workspace-validation.js +6 -5
- package/dist/session/workspace-validation.js.map +1 -1
- package/dist/signal/bot-command.d.ts +2 -0
- package/dist/signal/bot-command.js +8 -0
- package/dist/signal/bot-command.js.map +1 -1
- package/dist/signal/format.d.ts +27 -0
- package/dist/signal/format.js +59 -0
- package/dist/signal/format.js.map +1 -1
- package/dist/signal/signal-bot-daemon.d.ts +27 -25
- package/dist/signal/signal-bot-daemon.js +153 -135
- package/dist/signal/signal-bot-daemon.js.map +1 -1
- package/dist/signal/signal-container.js +63 -19
- package/dist/signal/signal-container.js.map +1 -1
- package/dist/signal/signal-transport.js +3 -8
- package/dist/signal/signal-transport.js.map +1 -1
- package/dist/trusted-process/domain-utils.d.ts +37 -4
- package/dist/trusted-process/domain-utils.js +130 -11
- package/dist/trusted-process/domain-utils.js.map +1 -1
- package/dist/trusted-process/index.js +6 -2
- package/dist/trusted-process/index.js.map +1 -1
- package/dist/trusted-process/mcp-client-manager.js +11 -5
- package/dist/trusted-process/mcp-client-manager.js.map +1 -1
- package/dist/trusted-process/mcp-proxy-server.d.ts +21 -0
- package/dist/trusted-process/mcp-proxy-server.js +91 -28
- package/dist/trusted-process/mcp-proxy-server.js.map +1 -1
- package/dist/trusted-process/permissive-output-validator.d.ts +23 -0
- package/dist/trusted-process/permissive-output-validator.js +10 -0
- package/dist/trusted-process/permissive-output-validator.js.map +1 -0
- package/dist/trusted-process/policy-engine.d.ts +29 -7
- package/dist/trusted-process/policy-engine.js +149 -92
- package/dist/trusted-process/policy-engine.js.map +1 -1
- package/dist/trusted-process/tool-description-hints.d.ts +19 -0
- package/dist/trusted-process/tool-description-hints.js +53 -0
- package/dist/trusted-process/tool-description-hints.js.map +1 -0
- package/dist/types/argument-roles.d.ts +33 -1
- package/dist/types/argument-roles.js +129 -1
- package/dist/types/argument-roles.js.map +1 -1
- package/dist/types/slug.d.ts +7 -0
- package/dist/types/slug.js +14 -0
- package/dist/types/slug.js.map +1 -0
- package/dist/utils/editor.d.ts +24 -0
- package/dist/utils/editor.js +66 -0
- package/dist/utils/editor.js.map +1 -0
- package/docker/Dockerfile.goose +34 -0
- package/docker/entrypoint-goose.sh +30 -0
- package/package.json +1 -1
- package/src/config/generated/tool-annotations.json +487 -338
- package/src/config/mcp-servers.json +2 -8
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive LLM-assisted constitution customizer for personas.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around the shared customizer loop, adding
|
|
5
|
+
* persona-specific context to the LLM system prompt.
|
|
6
|
+
*/
|
|
7
|
+
import type { GitHubIdentity } from '../pipeline/github-identity.js';
|
|
8
|
+
import type { ToolAnnotation } from '../pipeline/types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Builds a system prompt for the persona constitution customizer.
|
|
11
|
+
* Extends the base customizer prompt with persona-specific context.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildPersonaCustomizerSystemPrompt(baseConstitution: string, toolAnnotations: ToolAnnotation[], personaDescription: string, serverAllowlist?: readonly string[], githubIdentity?: GitHubIdentity | null): string;
|
|
14
|
+
/**
|
|
15
|
+
* Runs an interactive constitution customizer session for a persona.
|
|
16
|
+
* Operates on an in-memory constitution string (not the global file).
|
|
17
|
+
*
|
|
18
|
+
* @param initialConstitution - Starting constitution text (from generator or existing)
|
|
19
|
+
* @param personaDescription - The persona description (context for the LLM)
|
|
20
|
+
* @param serverAllowlist - Optional server allowlist (context for the LLM)
|
|
21
|
+
* @returns The final constitution text, or undefined if the user cancelled
|
|
22
|
+
*/
|
|
23
|
+
export declare function runPersonaConstitutionCustomizer(initialConstitution: string, personaDescription: string, serverAllowlist?: readonly string[]): Promise<string | undefined>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive LLM-assisted constitution customizer for personas.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around the shared customizer loop, adding
|
|
5
|
+
* persona-specific context to the LLM system prompt.
|
|
6
|
+
*/
|
|
7
|
+
import { buildSystemPrompt } from '../pipeline/constitution-customizer.js';
|
|
8
|
+
import { runConstitutionCustomizerLoop } from '../pipeline/customizer-loop.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Persona-Scoped System Prompt
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Builds a system prompt for the persona constitution customizer.
|
|
14
|
+
* Extends the base customizer prompt with persona-specific context.
|
|
15
|
+
*/
|
|
16
|
+
export function buildPersonaCustomizerSystemPrompt(baseConstitution, toolAnnotations, personaDescription, serverAllowlist, githubIdentity) {
|
|
17
|
+
const basePrompt = buildSystemPrompt(baseConstitution, toolAnnotations, githubIdentity);
|
|
18
|
+
const serverContext = serverAllowlist
|
|
19
|
+
? `\nThis persona only has access to these MCP servers: ${serverAllowlist.join(', ')}.`
|
|
20
|
+
: '';
|
|
21
|
+
return `${basePrompt}
|
|
22
|
+
|
|
23
|
+
## Persona Context
|
|
24
|
+
|
|
25
|
+
This constitution is for a persona with the following purpose:
|
|
26
|
+
|
|
27
|
+
${personaDescription}
|
|
28
|
+
${serverContext}
|
|
29
|
+
|
|
30
|
+
Focus your suggestions on what this persona needs. Grant the minimum
|
|
31
|
+
permissions required for the persona's purpose.`;
|
|
32
|
+
}
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Main Entry Point
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Runs an interactive constitution customizer session for a persona.
|
|
38
|
+
* Operates on an in-memory constitution string (not the global file).
|
|
39
|
+
*
|
|
40
|
+
* @param initialConstitution - Starting constitution text (from generator or existing)
|
|
41
|
+
* @param personaDescription - The persona description (context for the LLM)
|
|
42
|
+
* @param serverAllowlist - Optional server allowlist (context for the LLM)
|
|
43
|
+
* @returns The final constitution text, or undefined if the user cancelled
|
|
44
|
+
*/
|
|
45
|
+
export async function runPersonaConstitutionCustomizer(initialConstitution, personaDescription, serverAllowlist) {
|
|
46
|
+
return runConstitutionCustomizerLoop(initialConstitution, (ctx) => buildPersonaCustomizerSystemPrompt('', ctx.annotations, personaDescription, serverAllowlist, ctx.githubIdentity), {
|
|
47
|
+
stepName: 'persona-customize-policy',
|
|
48
|
+
noteTitle: 'Current Persona Constitution',
|
|
49
|
+
refinePlaceholder: 'e.g., "also allow fetching from news sites"',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=persona-customizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona-customizer.js","sourceRoot":"","sources":["../../src/persona/persona-customizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAA8B,MAAM,gCAAgC,CAAC;AAI3G,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAChD,gBAAwB,EACxB,eAAiC,EACjC,kBAA0B,EAC1B,eAAmC,EACnC,cAAsC;IAEtC,MAAM,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IAExF,MAAM,aAAa,GAAG,eAAe;QACnC,CAAC,CAAC,wDAAwD,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QACvF,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,GAAG,UAAU;;;;;;EAMpB,kBAAkB;EAClB,aAAa;;;gDAGiC,CAAC;AACjD,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,mBAA2B,EAC3B,kBAA0B,EAC1B,eAAmC;IAEnC,OAAO,6BAA6B,CAClC,mBAAmB,EACnB,CAAC,GAA0B,EAAE,EAAE,CAC7B,kCAAkC,CAAC,EAAE,EAAE,GAAG,CAAC,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,GAAG,CAAC,cAAc,CAAC,EAClH;QACE,QAAQ,EAAE,0BAA0B;QACpC,SAAS,EAAE,8BAA8B;QACzC,iBAAiB,EAAE,6CAA6C;KACjE,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona system prompt augmentation.
|
|
3
|
+
*
|
|
4
|
+
* Builds the system prompt fragment injected when a session is
|
|
5
|
+
* created with a persona. Includes the persona description and
|
|
6
|
+
* the contents of the persistent memory file (workspace/memory.md).
|
|
7
|
+
*/
|
|
8
|
+
import type { PersonaDefinition } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Builds the system prompt augmentation for a persona session.
|
|
11
|
+
*
|
|
12
|
+
* Includes the persona's description and the current contents of
|
|
13
|
+
* the memory file. The agent is instructed to read and update the
|
|
14
|
+
* memory file across sessions.
|
|
15
|
+
*
|
|
16
|
+
* @param persona - The persona definition.
|
|
17
|
+
* @param memoryPath - Absolute path to the memory file (workspace/memory.md).
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildPersonaSystemPromptAugmentation(persona: PersonaDefinition, memoryPath: string): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona system prompt augmentation.
|
|
3
|
+
*
|
|
4
|
+
* Builds the system prompt fragment injected when a session is
|
|
5
|
+
* created with a persona. Includes the persona description and
|
|
6
|
+
* the contents of the persistent memory file (workspace/memory.md).
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
9
|
+
/**
|
|
10
|
+
* Builds the system prompt augmentation for a persona session.
|
|
11
|
+
*
|
|
12
|
+
* Includes the persona's description and the current contents of
|
|
13
|
+
* the memory file. The agent is instructed to read and update the
|
|
14
|
+
* memory file across sessions.
|
|
15
|
+
*
|
|
16
|
+
* @param persona - The persona definition.
|
|
17
|
+
* @param memoryPath - Absolute path to the memory file (workspace/memory.md).
|
|
18
|
+
*/
|
|
19
|
+
export function buildPersonaSystemPromptAugmentation(persona, memoryPath) {
|
|
20
|
+
const memoryContent = existsSync(memoryPath) ? readFileSync(memoryPath, 'utf-8') : '';
|
|
21
|
+
return `
|
|
22
|
+
## Persona: ${persona.name}
|
|
23
|
+
|
|
24
|
+
${persona.description}
|
|
25
|
+
|
|
26
|
+
## Persistent Memory
|
|
27
|
+
|
|
28
|
+
You have a persistent memory file at: ${memoryPath}
|
|
29
|
+
This file survives across sessions. Use it to remember important context:
|
|
30
|
+
- User preferences and patterns
|
|
31
|
+
- Ongoing tasks and their status
|
|
32
|
+
- Key decisions and their reasoning
|
|
33
|
+
- Names, dates, and recurring items
|
|
34
|
+
|
|
35
|
+
Read this file at the start of each session to recall prior context.
|
|
36
|
+
Before the session ends, update it with anything worth remembering.
|
|
37
|
+
Keep it concise and organized — this is your long-term memory.
|
|
38
|
+
|
|
39
|
+
${memoryContent ? `### Current Memory Contents\n\n${memoryContent}` : 'The memory file is currently empty — this is your first session.'}
|
|
40
|
+
`.trim();
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=persona-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona-prompt.js","sourceRoot":"","sources":["../../src/persona/persona-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGnD;;;;;;;;;GASG;AACH,MAAM,UAAU,oCAAoC,CAAC,OAA0B,EAAE,UAAkB;IACjG,MAAM,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtF,OAAO;cACK,OAAO,CAAC,IAAI;;EAExB,OAAO,CAAC,WAAW;;;;wCAImB,UAAU;;;;;;;;;;;EAWhD,aAAa,CAAC,CAAC,CAAC,kCAAkC,aAAa,EAAE,CAAC,CAAC,CAAC,kEAAkE;CACvI,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona resolver -- locates persona directories, loads definitions,
|
|
3
|
+
* and validates compiled policy existence.
|
|
4
|
+
*
|
|
5
|
+
* Follows the same directory-layout pattern as job paths in
|
|
6
|
+
* src/config/paths.ts (getJobDir, getJobGeneratedDir, etc.).
|
|
7
|
+
*/
|
|
8
|
+
import { type PersonaDefinition, type PersonaName } from './types.js';
|
|
9
|
+
import type { MCPServerConfig } from '../config/types.js';
|
|
10
|
+
/** Returns the base directory for all personas: {home}/personas/ */
|
|
11
|
+
export declare function getPersonasDir(): string;
|
|
12
|
+
/** Returns the directory for a specific persona: {home}/personas/{name}/ */
|
|
13
|
+
export declare function getPersonaDir(name: PersonaName): string;
|
|
14
|
+
/** Returns the generated artifacts directory for a persona: {home}/personas/{name}/generated/ */
|
|
15
|
+
export declare function getPersonaGeneratedDir(name: PersonaName): string;
|
|
16
|
+
/** Returns the constitution path for a persona: {home}/personas/{name}/constitution.md */
|
|
17
|
+
export declare function getPersonaConstitutionPath(name: PersonaName): string;
|
|
18
|
+
/** Returns the workspace directory for a persona: {home}/personas/{name}/workspace/ */
|
|
19
|
+
export declare function getPersonaWorkspaceDir(name: PersonaName): string;
|
|
20
|
+
/** Returns the persona definition file path: {home}/personas/{name}/persona.json */
|
|
21
|
+
export declare function getPersonaDefinitionPath(name: PersonaName): string;
|
|
22
|
+
/**
|
|
23
|
+
* Loads a persona definition from disk.
|
|
24
|
+
* @throws if the persona directory or persona.json does not exist.
|
|
25
|
+
*/
|
|
26
|
+
export declare function loadPersona(name: PersonaName): PersonaDefinition;
|
|
27
|
+
/** Result of resolving a persona name to runtime-usable paths. */
|
|
28
|
+
export interface ResolvedPersona {
|
|
29
|
+
readonly policyDir: string;
|
|
30
|
+
readonly persona: PersonaDefinition;
|
|
31
|
+
readonly workspacePath: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolves a persona name to a validated policyDir, workspace path,
|
|
35
|
+
* and persona definition.
|
|
36
|
+
*
|
|
37
|
+
* @throws if persona does not exist or has no compiled policy.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolvePersona(nameRaw: string): ResolvedPersona;
|
|
40
|
+
/**
|
|
41
|
+
* Filters MCP servers to only those in the allowlist.
|
|
42
|
+
* The "filesystem" server is always included even if omitted from
|
|
43
|
+
* the allowlist -- this is a hardcoded safety invariant since the
|
|
44
|
+
* agent sandbox requires filesystem access to function.
|
|
45
|
+
*/
|
|
46
|
+
export declare function applyServerAllowlist(mcpServers: Record<string, MCPServerConfig>, allowlist: readonly string[]): Record<string, MCPServerConfig>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona resolver -- locates persona directories, loads definitions,
|
|
3
|
+
* and validates compiled policy existence.
|
|
4
|
+
*
|
|
5
|
+
* Follows the same directory-layout pattern as job paths in
|
|
6
|
+
* src/config/paths.ts (getJobDir, getJobGeneratedDir, etc.).
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
9
|
+
import { resolve } from 'node:path';
|
|
10
|
+
import { getIronCurtainHome } from '../config/paths.js';
|
|
11
|
+
import { createPersonaName } from './types.js';
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Path helpers
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** Returns the base directory for all personas: {home}/personas/ */
|
|
16
|
+
export function getPersonasDir() {
|
|
17
|
+
return resolve(getIronCurtainHome(), 'personas');
|
|
18
|
+
}
|
|
19
|
+
/** Returns the directory for a specific persona: {home}/personas/{name}/ */
|
|
20
|
+
export function getPersonaDir(name) {
|
|
21
|
+
return resolve(getPersonasDir(), name);
|
|
22
|
+
}
|
|
23
|
+
/** Returns the generated artifacts directory for a persona: {home}/personas/{name}/generated/ */
|
|
24
|
+
export function getPersonaGeneratedDir(name) {
|
|
25
|
+
return resolve(getPersonaDir(name), 'generated');
|
|
26
|
+
}
|
|
27
|
+
/** Returns the constitution path for a persona: {home}/personas/{name}/constitution.md */
|
|
28
|
+
export function getPersonaConstitutionPath(name) {
|
|
29
|
+
return resolve(getPersonaDir(name), 'constitution.md');
|
|
30
|
+
}
|
|
31
|
+
/** Returns the workspace directory for a persona: {home}/personas/{name}/workspace/ */
|
|
32
|
+
export function getPersonaWorkspaceDir(name) {
|
|
33
|
+
return resolve(getPersonaDir(name), 'workspace');
|
|
34
|
+
}
|
|
35
|
+
/** Returns the persona definition file path: {home}/personas/{name}/persona.json */
|
|
36
|
+
export function getPersonaDefinitionPath(name) {
|
|
37
|
+
return resolve(getPersonaDir(name), 'persona.json');
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Loading
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/**
|
|
43
|
+
* Loads a persona definition from disk.
|
|
44
|
+
* @throws if the persona directory or persona.json does not exist.
|
|
45
|
+
*/
|
|
46
|
+
export function loadPersona(name) {
|
|
47
|
+
const defPath = getPersonaDefinitionPath(name);
|
|
48
|
+
let raw;
|
|
49
|
+
try {
|
|
50
|
+
raw = readFileSync(defPath, 'utf-8');
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
if (err.code === 'ENOENT') {
|
|
54
|
+
throw new Error(`Persona "${name}" not found: ${defPath} does not exist.`, { cause: err });
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
return JSON.parse(raw);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolves a persona name to a validated policyDir, workspace path,
|
|
62
|
+
* and persona definition.
|
|
63
|
+
*
|
|
64
|
+
* @throws if persona does not exist or has no compiled policy.
|
|
65
|
+
*/
|
|
66
|
+
export function resolvePersona(nameRaw) {
|
|
67
|
+
const name = createPersonaName(nameRaw);
|
|
68
|
+
// Load persona.json first — validates the persona directory exists and
|
|
69
|
+
// produces a clear error ("not found") before checking for compiled policy.
|
|
70
|
+
const persona = loadPersona(name);
|
|
71
|
+
const generatedDir = getPersonaGeneratedDir(name);
|
|
72
|
+
if (!existsSync(resolve(generatedDir, 'compiled-policy.json'))) {
|
|
73
|
+
throw new Error(`Persona "${name}" has no compiled policy. ` + `Run: ironcurtain persona compile ${name}`);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
policyDir: generatedDir,
|
|
77
|
+
persona,
|
|
78
|
+
workspacePath: getPersonaWorkspaceDir(name),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Server allowlist filtering
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
/**
|
|
85
|
+
* Filters MCP servers to only those in the allowlist.
|
|
86
|
+
* The "filesystem" server is always included even if omitted from
|
|
87
|
+
* the allowlist -- this is a hardcoded safety invariant since the
|
|
88
|
+
* agent sandbox requires filesystem access to function.
|
|
89
|
+
*/
|
|
90
|
+
export function applyServerAllowlist(mcpServers, allowlist) {
|
|
91
|
+
// Warn about server names in the allowlist that don't exist in the
|
|
92
|
+
// global mcp-servers.json. This catches typos and stale references
|
|
93
|
+
// without breaking the persona (non-fatal warning).
|
|
94
|
+
const knownServers = new Set(Object.keys(mcpServers));
|
|
95
|
+
for (const name of allowlist) {
|
|
96
|
+
if (!knownServers.has(name) && name !== 'filesystem') {
|
|
97
|
+
process.stderr.write(`Warning: persona allowlist includes unknown server "${name}" (not in mcp-servers.json)\n`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const filtered = {};
|
|
101
|
+
for (const [name, config] of Object.entries(mcpServers)) {
|
|
102
|
+
if (allowlist.includes(name) || name === 'filesystem') {
|
|
103
|
+
filtered[name] = config;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return filtered;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/persona/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAA4C,MAAM,YAAY,CAAC;AAGzF,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,oEAAoE;AACpE,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,kBAAkB,EAAE,EAAE,UAAU,CAAC,CAAC;AACnD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,OAAO,OAAO,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,sBAAsB,CAAC,IAAiB;IACtD,OAAO,OAAO,CAAC,aAAa,CAA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
/**
|
|
2
|
+
* Persona types -- named profiles bundling a constitution and compiled
|
|
3
|
+
* policy under ~/.ironcurtain/personas/<name>/.
|
|
4
|
+
*
|
|
5
|
+
* Follows the same branded-type pattern as JobId in src/cron/types.ts.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Regex for valid persona names: 1-63 chars, lowercase alphanumeric,
|
|
9
|
+
* hyphens, or underscores. Same rules as JobId.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PERSONA_NAME_PATTERN: RegExp;
|
|
12
|
+
/**
|
|
13
|
+
* Branded persona name to prevent mixing with other string identifiers.
|
|
14
|
+
*/
|
|
15
|
+
export type PersonaName = string & {
|
|
16
|
+
readonly __brand: 'PersonaName';
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Validates and creates a PersonaName from a user-provided string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createPersonaName(raw: string): PersonaName;
|
|
22
|
+
/**
|
|
23
|
+
* Persisted persona definition. Stored as JSON at
|
|
24
|
+
* ~/.ironcurtain/personas/{name}/persona.json.
|
|
25
|
+
*/
|
|
26
|
+
export interface PersonaDefinition {
|
|
27
|
+
/** Persona name. Matches the directory name. */
|
|
28
|
+
readonly name: PersonaName;
|
|
29
|
+
/** Human-readable description of the persona's purpose. */
|
|
30
|
+
readonly description: string;
|
|
31
|
+
/** ISO 8601 timestamp of when the persona was created. */
|
|
32
|
+
readonly createdAt: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional allowlist of MCP server names from the global
|
|
35
|
+
* mcp-servers.json. When set, only these servers are available.
|
|
36
|
+
* When omitted, all global servers are enabled (default).
|
|
37
|
+
* The "filesystem" server is always included regardless.
|
|
38
|
+
*/
|
|
39
|
+
readonly servers?: readonly string[];
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona types -- named profiles bundling a constitution and compiled
|
|
3
|
+
* policy under ~/.ironcurtain/personas/<name>/.
|
|
4
|
+
*
|
|
5
|
+
* Follows the same branded-type pattern as JobId in src/cron/types.ts.
|
|
6
|
+
*/
|
|
7
|
+
import { SLUG_PATTERN, validateSlug } from '../types/slug.js';
|
|
8
|
+
/**
|
|
9
|
+
* Regex for valid persona names: 1-63 chars, lowercase alphanumeric,
|
|
10
|
+
* hyphens, or underscores. Same rules as JobId.
|
|
11
|
+
*/
|
|
12
|
+
export const PERSONA_NAME_PATTERN = SLUG_PATTERN;
|
|
13
|
+
/**
|
|
14
|
+
* Validates and creates a PersonaName from a user-provided string.
|
|
15
|
+
*/
|
|
16
|
+
export function createPersonaName(raw) {
|
|
17
|
+
validateSlug(raw, 'persona name');
|
|
18
|
+
return raw;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/persona/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAW,YAAY,CAAC;AAOzD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,YAAY,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAClC,OAAO,GAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { resolve } from 'node:path';
|
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
12
12
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
13
|
+
import { permissiveJsonSchemaValidator } from '../trusted-process/permissive-output-validator.js';
|
|
13
14
|
import chalk from 'chalk';
|
|
14
15
|
import { computeHash, createPipelineLlm, loadExistingArtifact, loadPipelineConfig, showCached, writeArtifact, withSpinner, } from './pipeline-shared.js';
|
|
15
16
|
import { annotateTools, buildAnnotationPrompt, validateAnnotationsHeuristic } from './tool-annotator.js';
|
|
@@ -33,7 +34,7 @@ async function connectAndDiscoverTools(mcpServers) {
|
|
|
33
34
|
if (transport.stderr) {
|
|
34
35
|
transport.stderr.on('data', () => { });
|
|
35
36
|
}
|
|
36
|
-
client = new Client({ name: 'ironcurtain-annotator', version: VERSION });
|
|
37
|
+
client = new Client({ name: 'ironcurtain-annotator', version: VERSION }, { jsonSchemaValidator: permissiveJsonSchemaValidator });
|
|
37
38
|
await client.connect(transport);
|
|
38
39
|
const toolsResult = await client.listTools();
|
|
39
40
|
totalTools += toolsResult.tools.length;
|
|
@@ -78,9 +79,9 @@ async function annotateServerTools(serverName, tools, existingAnnotations, llm)
|
|
|
78
79
|
});
|
|
79
80
|
const validation = validateAnnotationsHeuristic(tools, annotations);
|
|
80
81
|
if (!validation.valid) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const summary = validation.warnings.join('\n - ');
|
|
83
|
+
throw new Error(`Path-gap validation failed for server "${serverName}":\n - ${summary}\n` +
|
|
84
|
+
'Annotations are part of the TCB — every path-bearing argument must have a path role.');
|
|
84
85
|
}
|
|
85
86
|
return annotations;
|
|
86
87
|
}, (annotations, elapsed) => `${stepText}: ${annotations.length} tools annotated (${elapsed.toFixed(1)}s)`);
|
|
@@ -124,6 +125,11 @@ export async function main() {
|
|
|
124
125
|
const config = loadPipelineConfig();
|
|
125
126
|
console.error(chalk.bold('Tool Annotation Pipeline'));
|
|
126
127
|
console.error(chalk.bold('========================'));
|
|
128
|
+
console.error('');
|
|
129
|
+
console.error(chalk.yellow.bold('⚠ WARNING: Tool annotations are part of the IronCurtain TCB (Trusted Computing Base).'));
|
|
130
|
+
console.error(chalk.yellow(' This is a developer tool and should not be run lightly. All annotation'));
|
|
131
|
+
console.error(chalk.yellow(' output must be manually reviewed for correctness before use in production.'));
|
|
132
|
+
console.error('');
|
|
127
133
|
console.error(`Output: ${chalk.dim(config.generatedDir + '/')}`);
|
|
128
134
|
console.error('');
|
|
129
135
|
const { model: llm, logContext, logPath } = await createPipelineLlm(config.generatedDir, 'annotate');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotate.js","sourceRoot":"","sources":["../../src/pipeline/annotate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEzG,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAWxC,KAAK,UAAU,uBAAuB,CACpC,UAA2C;IAE3C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,WAAW,CAClC,iCAAiC,EACjC,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;QACxD,MAAM,OAAO,GAAuC,EAAE,CAAC;QACvD,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9D,OAAO,CAAC,IAAI,GAAG,mCAAmC,UAAU,KAAK,CAAC;YAClE,IAAI,MAA0B,CAAC;YAC/B,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC;oBACzC,OAA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urtain compile-policy`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. Generate test scenarios via LLM
|
|
7
|
-
* 3. Verify compiled policy against real engine + LLM judge
|
|
4
|
+
* Thin wrapper over PipelineRunner that handles CLI-specific concerns:
|
|
5
|
+
* loading config, printing the progress banner, and exit codes.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
* `npm run annotate-tools` first to generate it.
|
|
11
|
-
*/
|
|
12
|
-
import type { MCPServerConfig } from '../config/types.js';
|
|
13
|
-
import { type McpServerConnection } from './list-resolver.js';
|
|
14
|
-
import type { CompiledRule, DiscardedScenario, ListDefinition, TestScenario } from './types.js';
|
|
15
|
-
/**
|
|
16
|
-
* Merges replacement scenarios from the regeneration session into the
|
|
17
|
-
* scenario list. Removes corrected and discarded scenarios, then adds
|
|
18
|
-
* unique replacements that don't duplicate any remaining scenario.
|
|
19
|
-
*/
|
|
20
|
-
export declare function mergeReplacements(scenarios: TestScenario[], replacements: TestScenario[], corrections: ReadonlyArray<{
|
|
21
|
-
scenarioDescription: string;
|
|
22
|
-
}>, discardedScenarios: ReadonlyArray<DiscardedScenario>): TestScenario[];
|
|
23
|
-
/**
|
|
24
|
-
* Resolves all `paths.within` values in compiled rules to their real
|
|
25
|
-
* filesystem paths, following symlinks. This ensures that symlinked
|
|
26
|
-
* directories (e.g., ~/Downloads -> /mnt/c/.../Downloads on WSL) are
|
|
27
|
-
* resolved to their canonical form so that runtime path comparisons
|
|
28
|
-
* match correctly.
|
|
7
|
+
* The core compile-verify-repair loop lives in PipelineRunner.
|
|
29
8
|
*
|
|
30
|
-
*
|
|
9
|
+
* CLI flags:
|
|
10
|
+
* --constitution <path> Use an alternative constitution file
|
|
11
|
+
* --output-dir <path> Write compiled artifacts to this directory
|
|
31
12
|
*/
|
|
32
|
-
export
|
|
13
|
+
export { resolveRulePaths, mergeReplacements } from './pipeline-shared.js';
|
|
14
|
+
export interface CompilePolicyCliArgs {
|
|
15
|
+
constitution?: string;
|
|
16
|
+
outputDir?: string;
|
|
17
|
+
}
|
|
33
18
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* Returns a map keyed by server name for the resolver.
|
|
19
|
+
* Parses --constitution and --output-dir from process.argv.
|
|
20
|
+
* Returns resolved absolute paths when provided.
|
|
37
21
|
*/
|
|
38
|
-
export declare function
|
|
39
|
-
export declare function disconnectMcpServers(connections: Map<string, McpServerConnection>): Promise<void>;
|
|
22
|
+
export declare function parseCompilePolicyArgs(argv?: string[]): CompilePolicyCliArgs;
|
|
40
23
|
export declare function main(): Promise<void>;
|