@provos/ironcurtain 0.7.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -100
- package/dist/auth/auth-command.d.ts +15 -0
- package/dist/auth/auth-command.js +424 -0
- package/dist/auth/auth-command.js.map +1 -0
- package/dist/auth/oauth-flow.d.ts +46 -0
- package/dist/auth/oauth-flow.js +279 -0
- package/dist/auth/oauth-flow.js.map +1 -0
- package/dist/auth/oauth-provider.d.ts +55 -0
- package/dist/auth/oauth-provider.js +73 -0
- package/dist/auth/oauth-provider.js.map +1 -0
- package/dist/auth/oauth-registry.d.ts +34 -0
- package/dist/auth/oauth-registry.js +69 -0
- package/dist/auth/oauth-registry.js.map +1 -0
- package/dist/auth/oauth-token-provider.d.ts +52 -0
- package/dist/auth/oauth-token-provider.js +159 -0
- package/dist/auth/oauth-token-provider.js.map +1 -0
- package/dist/auth/oauth-token-store.d.ts +30 -0
- package/dist/auth/oauth-token-store.js +93 -0
- package/dist/auth/oauth-token-store.js.map +1 -0
- package/dist/auth/providers/google-scopes.d.ts +35 -0
- package/dist/auth/providers/google-scopes.js +183 -0
- package/dist/auth/providers/google-scopes.js.map +1 -0
- package/dist/auth/providers/google.d.ts +2 -0
- package/dist/auth/providers/google.js +28 -0
- package/dist/auth/providers/google.js.map +1 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/config/config-command.js +39 -1
- package/dist/config/config-command.js.map +1 -1
- package/dist/config/constitution-readonly.md +14 -11
- package/dist/config/constitution-user-base.md +15 -0
- package/dist/config/first-start.js +4 -1
- package/dist/config/first-start.js.map +1 -1
- package/dist/config/generated/test-scenarios.json +1 -1
- package/dist/config/generated/tool-annotations.json +10617 -296
- package/dist/config/generated-readonly/compiled-policy.json +787 -244
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/mcp-servers.json +31 -2
- package/dist/config/paths.d.ts +20 -0
- package/dist/config/paths.js +43 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/config/types.d.ts +8 -0
- package/dist/config/user-config.d.ts +29 -0
- package/dist/config/user-config.js +30 -0
- package/dist/config/user-config.js.map +1 -1
- package/dist/cron/constitution-generator.d.ts +2 -1
- package/dist/cron/constitution-generator.js +35 -36
- package/dist/cron/constitution-generator.js.map +1 -1
- package/dist/cron/headless-transport.d.ts +4 -0
- package/dist/cron/headless-transport.js +1 -1
- package/dist/cron/headless-transport.js.map +1 -1
- package/dist/daemon/ironcurtain-daemon.js +7 -1
- package/dist/daemon/ironcurtain-daemon.js.map +1 -1
- package/dist/docker/adapters/claude-code.js +32 -5
- package/dist/docker/adapters/claude-code.js.map +1 -1
- package/dist/docker/agent-adapter.d.ts +40 -0
- package/dist/docker/claude-md-seed.d.ts +27 -0
- package/dist/docker/claude-md-seed.js +42 -0
- package/dist/docker/claude-md-seed.js.map +1 -0
- package/dist/docker/docker-agent-session.d.ts +3 -1
- package/dist/docker/docker-agent-session.js +51 -28
- package/dist/docker/docker-agent-session.js.map +1 -1
- package/dist/docker/docker-infrastructure.d.ts +15 -1
- package/dist/docker/docker-infrastructure.js +105 -9
- package/dist/docker/docker-infrastructure.js.map +1 -1
- package/dist/docker/docker-manager.d.ts +2 -0
- package/dist/docker/docker-manager.js +9 -1
- package/dist/docker/docker-manager.js.map +1 -1
- package/dist/docker/mitm-proxy.d.ts +65 -0
- package/dist/docker/mitm-proxy.js +288 -31
- package/dist/docker/mitm-proxy.js.map +1 -1
- package/dist/docker/package-types.d.ts +127 -0
- package/dist/docker/package-types.js +8 -0
- package/dist/docker/package-types.js.map +1 -0
- package/dist/docker/package-validator.d.ts +41 -0
- package/dist/docker/package-validator.js +90 -0
- package/dist/docker/package-validator.js.map +1 -0
- package/dist/docker/platform.d.ts +6 -6
- package/dist/docker/platform.js +8 -6
- package/dist/docker/platform.js.map +1 -1
- package/dist/docker/proxy-tools.d.ts +80 -0
- package/dist/docker/proxy-tools.js +248 -0
- package/dist/docker/proxy-tools.js.map +1 -0
- package/dist/docker/pty-session.d.ts +15 -0
- package/dist/docker/pty-session.js +253 -73
- package/dist/docker/pty-session.js.map +1 -1
- package/dist/docker/pty-types.d.ts +28 -0
- package/dist/docker/pty-types.js +2 -0
- package/dist/docker/pty-types.js.map +1 -1
- package/dist/docker/registry-proxy.d.ts +142 -0
- package/dist/docker/registry-proxy.js +856 -0
- package/dist/docker/registry-proxy.js.map +1 -0
- package/dist/escalation/escalation-watcher.d.ts +3 -1
- package/dist/escalation/escalation-watcher.js +6 -2
- package/dist/escalation/escalation-watcher.js.map +1 -1
- package/dist/escalation/listener-command.js +24 -10
- package/dist/escalation/listener-command.js.map +1 -1
- package/dist/escalation/listener-lock.d.ts +5 -0
- package/dist/escalation/listener-lock.js +14 -0
- package/dist/escalation/listener-lock.js.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/memory/auto-save.d.ts +25 -0
- package/dist/memory/auto-save.js +89 -0
- package/dist/memory/auto-save.js.map +1 -0
- package/dist/memory/memory-annotations.d.ts +47 -0
- package/dist/memory/memory-annotations.js +87 -0
- package/dist/memory/memory-annotations.js.map +1 -0
- package/dist/memory/memory-prompt.d.ts +12 -0
- package/dist/memory/memory-prompt.js +20 -0
- package/dist/memory/memory-prompt.js.map +1 -0
- package/dist/memory/resolve-memory-path.d.ts +20 -0
- package/dist/memory/resolve-memory-path.js +30 -0
- package/dist/memory/resolve-memory-path.js.map +1 -0
- package/dist/mux/mux-app.d.ts +4 -0
- package/dist/mux/mux-app.js +246 -28
- package/dist/mux/mux-app.js.map +1 -1
- package/dist/mux/mux-command.d.ts +2 -2
- package/dist/mux/mux-command.js +14 -22
- package/dist/mux/mux-command.js.map +1 -1
- package/dist/mux/mux-escalation-manager.d.ts +9 -3
- package/dist/mux/mux-escalation-manager.js +69 -19
- package/dist/mux/mux-escalation-manager.js.map +1 -1
- package/dist/mux/mux-input-handler.d.ts +59 -3
- package/dist/mux/mux-input-handler.js +270 -32
- package/dist/mux/mux-input-handler.js.map +1 -1
- package/dist/mux/mux-renderer.d.ts +19 -1
- package/dist/mux/mux-renderer.js +466 -11
- package/dist/mux/mux-renderer.js.map +1 -1
- package/dist/mux/persona-scanner.d.ts +19 -0
- package/dist/mux/persona-scanner.js +53 -0
- package/dist/mux/persona-scanner.js.map +1 -0
- package/dist/mux/pty-bridge.d.ts +8 -0
- package/dist/mux/pty-bridge.js +19 -1
- package/dist/mux/pty-bridge.js.map +1 -1
- package/dist/mux/session-scanner.d.ts +18 -0
- package/dist/mux/session-scanner.js +65 -0
- package/dist/mux/session-scanner.js.map +1 -0
- package/dist/mux/types.d.ts +36 -1
- package/dist/mux/types.js +14 -1
- package/dist/mux/types.js.map +1 -1
- package/dist/persona/persona-command.js +130 -93
- package/dist/persona/persona-command.js.map +1 -1
- package/dist/persona/persona-prompt.d.ts +7 -7
- package/dist/persona/persona-prompt.js +14 -29
- package/dist/persona/persona-prompt.js.map +1 -1
- package/dist/persona/resolve.js +5 -2
- package/dist/persona/resolve.js.map +1 -1
- package/dist/pipeline/annotate.js +1 -7
- package/dist/pipeline/annotate.js.map +1 -1
- package/dist/pipeline/compile.d.ts +5 -2
- package/dist/pipeline/compile.js +23 -11
- package/dist/pipeline/compile.js.map +1 -1
- package/dist/pipeline/constitution-compiler.d.ts +302 -3
- package/dist/pipeline/constitution-compiler.js +285 -23
- package/dist/pipeline/constitution-compiler.js.map +1 -1
- package/dist/pipeline/generate-with-repair.d.ts +2 -2
- package/dist/pipeline/generate-with-repair.js +2 -2
- package/dist/pipeline/handwritten-scenarios.d.ts +20 -7
- package/dist/pipeline/handwritten-scenarios.js +20 -41
- package/dist/pipeline/handwritten-scenarios.js.map +1 -1
- package/dist/pipeline/list-resolver.d.ts +18 -20
- package/dist/pipeline/list-resolver.js +28 -36
- package/dist/pipeline/list-resolver.js.map +1 -1
- package/dist/pipeline/pipeline-runner.d.ts +102 -13
- package/dist/pipeline/pipeline-runner.js +497 -237
- package/dist/pipeline/pipeline-runner.js.map +1 -1
- package/dist/pipeline/pipeline-shared.d.ts +7 -9
- package/dist/pipeline/pipeline-shared.js +8 -18
- package/dist/pipeline/pipeline-shared.js.map +1 -1
- package/dist/pipeline/policy-verifier.d.ts +32 -5
- package/dist/pipeline/policy-verifier.js +137 -8
- package/dist/pipeline/policy-verifier.js.map +1 -1
- package/dist/pipeline/proxy-mcp-connections.d.ts +25 -0
- package/dist/pipeline/proxy-mcp-connections.js +121 -0
- package/dist/pipeline/proxy-mcp-connections.js.map +1 -0
- package/dist/pipeline/refresh-lists.js +21 -13
- package/dist/pipeline/refresh-lists.js.map +1 -1
- package/dist/pipeline/scenario-generator.d.ts +29 -49
- package/dist/pipeline/scenario-generator.js +180 -143
- package/dist/pipeline/scenario-generator.js.map +1 -1
- package/dist/pipeline/scenario-schema-validator.d.ts +51 -0
- package/dist/pipeline/scenario-schema-validator.js +132 -0
- package/dist/pipeline/scenario-schema-validator.js.map +1 -0
- package/dist/pipeline/tool-annotator.d.ts +9 -8
- package/dist/pipeline/tool-annotator.js +48 -95
- package/dist/pipeline/tool-annotator.js.map +1 -1
- package/dist/pipeline/types.d.ts +31 -24
- package/dist/sandbox/index.d.ts +26 -10
- package/dist/sandbox/index.js +151 -40
- package/dist/sandbox/index.js.map +1 -1
- package/dist/servers/fetch-server.js +10 -5
- package/dist/servers/fetch-server.js.map +1 -1
- package/dist/session/agent-session.d.ts +8 -20
- package/dist/session/agent-session.js +22 -70
- package/dist/session/agent-session.js.map +1 -1
- package/dist/session/base-transport.d.ts +17 -1
- package/dist/session/base-transport.js +25 -1
- package/dist/session/base-transport.js.map +1 -1
- package/dist/session/cli-transport.d.ts +5 -0
- package/dist/session/cli-transport.js +48 -25
- package/dist/session/cli-transport.js.map +1 -1
- package/dist/session/index.d.ts +25 -1
- package/dist/session/index.js +57 -8
- package/dist/session/index.js.map +1 -1
- package/dist/session/prompts.js +8 -9
- package/dist/session/prompts.js.map +1 -1
- package/dist/session/session-manager.d.ts +6 -0
- package/dist/session/session-manager.js +12 -0
- package/dist/session/session-manager.js.map +1 -1
- package/dist/session/types.d.ts +11 -1
- package/dist/session/types.js.map +1 -1
- package/dist/session/workspace-validation.js +37 -6
- package/dist/session/workspace-validation.js.map +1 -1
- package/dist/signal/signal-bot-daemon.js +24 -8
- package/dist/signal/signal-bot-daemon.js.map +1 -1
- package/dist/signal/signal-transport.d.ts +5 -2
- package/dist/signal/signal-transport.js +3 -3
- package/dist/signal/signal-transport.js.map +1 -1
- package/dist/trusted-process/approval-whitelist.d.ts +117 -0
- package/dist/trusted-process/approval-whitelist.js +237 -0
- package/dist/trusted-process/approval-whitelist.js.map +1 -0
- package/dist/trusted-process/gworkspace-credentials.d.ts +40 -0
- package/dist/trusted-process/gworkspace-credentials.js +45 -0
- package/dist/trusted-process/gworkspace-credentials.js.map +1 -0
- package/dist/trusted-process/index.d.ts +11 -1
- package/dist/trusted-process/index.js +83 -53
- package/dist/trusted-process/index.js.map +1 -1
- package/dist/trusted-process/mcp-proxy-server.d.ts +23 -0
- package/dist/trusted-process/mcp-proxy-server.js +409 -94
- package/dist/trusted-process/mcp-proxy-server.js.map +1 -1
- package/dist/trusted-process/policy-engine.d.ts +12 -3
- package/dist/trusted-process/policy-engine.js +33 -23
- package/dist/trusted-process/policy-engine.js.map +1 -1
- package/dist/trusted-process/policy-types.d.ts +17 -0
- package/dist/trusted-process/sandbox-integration.d.ts +23 -0
- package/dist/trusted-process/sandbox-integration.js +115 -3
- package/dist/trusted-process/sandbox-integration.js.map +1 -1
- package/dist/trusted-process/token-file-refresher.d.ts +69 -0
- package/dist/trusted-process/token-file-refresher.js +120 -0
- package/dist/trusted-process/token-file-refresher.js.map +1 -0
- package/dist/types/argument-roles.d.ts +7 -1
- package/dist/types/argument-roles.js +50 -0
- package/dist/types/argument-roles.js.map +1 -1
- package/dist/types/audit.d.ts +11 -0
- package/docker/Dockerfile.base +22 -0
- package/docker/Dockerfile.base.arm64 +44 -4
- package/docker/Dockerfile.claude-code +2 -2
- package/docker/entrypoint-claude-code.sh +24 -6
- package/package.json +8 -2
- package/src/config/constitution-user-base.md +15 -0
- package/src/config/generated/test-scenarios.json +1 -1
- package/src/config/generated/tool-annotations.json +10617 -296
- package/src/config/mcp-servers.json +31 -2
- package/dist/pipeline/mcp-connections.d.ts +0 -16
- package/dist/pipeline/mcp-connections.js +0 -61
- package/dist/pipeline/mcp-connections.js.map +0 -1
|
@@ -7,41 +7,39 @@
|
|
|
7
7
|
* structured response.
|
|
8
8
|
*
|
|
9
9
|
* For data-backed lists (requiresMcp: true): gives the LLM access to
|
|
10
|
-
* MCP tools
|
|
11
|
-
*
|
|
10
|
+
* MCP tools exposed through a proxy connection, then parses the final
|
|
11
|
+
* text response for the structured list values.
|
|
12
12
|
*
|
|
13
13
|
* Applies type-specific validation to filter malformed values.
|
|
14
14
|
* Preserves manual overrides from any existing resolution.
|
|
15
15
|
*/
|
|
16
16
|
import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
17
|
-
import type {
|
|
17
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
18
|
+
import type { LanguageModel, ToolSet } from 'ai';
|
|
18
19
|
import type { ListDefinition, ResolvedList, DynamicListsFile } from './types.js';
|
|
19
|
-
/**
|
|
20
|
-
* Shape of a pre-connected MCP server with its discovered tools.
|
|
21
|
-
* Matches the ServerConnection pattern from annotate.ts.
|
|
22
|
-
*/
|
|
23
|
-
export interface McpServerConnection {
|
|
24
|
-
readonly client: Client;
|
|
25
|
-
readonly tools: ReadonlyArray<{
|
|
26
|
-
name: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
inputSchema: Record<string, unknown>;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
31
20
|
export interface ListResolverConfig {
|
|
32
21
|
readonly model: LanguageModel;
|
|
33
22
|
/**
|
|
34
|
-
* Optional
|
|
35
|
-
*
|
|
36
|
-
*
|
|
23
|
+
* Optional proxy connection for data-backed list resolution.
|
|
24
|
+
* The proxy handles policy mediation, OAuth, and sandbox containment
|
|
25
|
+
* internally -- tools are already filtered.
|
|
37
26
|
*/
|
|
38
|
-
readonly
|
|
27
|
+
readonly proxyConnection?: {
|
|
28
|
+
readonly client: Client;
|
|
29
|
+
readonly tools: ReadonlyArray<Tool>;
|
|
30
|
+
};
|
|
39
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Bridges proxy-exposed MCP tools as AI SDK tools. The proxy handles
|
|
34
|
+
* policy evaluation internally, so these wrappers simply forward
|
|
35
|
+
* calls to the MCP client.
|
|
36
|
+
*/
|
|
37
|
+
export declare function bridgeProxyTools(client: Client, tools: ReadonlyArray<Tool>): ToolSet;
|
|
40
38
|
/**
|
|
41
39
|
* Resolves a single list definition to concrete values.
|
|
42
40
|
*
|
|
43
41
|
* For knowledge-based lists: uses structured LLM output.
|
|
44
|
-
* For data-backed lists:
|
|
42
|
+
* For data-backed lists: bridges proxy tools as AI SDK tools for LLM tool-use.
|
|
45
43
|
*
|
|
46
44
|
* Applies type-specific validation to filter malformed values.
|
|
47
45
|
* Preserves manual overrides from any existing resolution.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* structured response.
|
|
8
8
|
*
|
|
9
9
|
* For data-backed lists (requiresMcp: true): gives the LLM access to
|
|
10
|
-
* MCP tools
|
|
11
|
-
*
|
|
10
|
+
* MCP tools exposed through a proxy connection, then parses the final
|
|
11
|
+
* text response for the structured list values.
|
|
12
12
|
*
|
|
13
13
|
* Applies type-specific validation to filter malformed values.
|
|
14
14
|
* Preserves manual overrides from any existing resolution.
|
|
@@ -87,20 +87,20 @@ async function resolveViaLlm(prompt, model, onProgress) {
|
|
|
87
87
|
/** Maximum tool-use steps for MCP-backed resolution. */
|
|
88
88
|
const MAX_MCP_TOOL_STEPS = 5;
|
|
89
89
|
/**
|
|
90
|
-
* Bridges MCP
|
|
91
|
-
*
|
|
90
|
+
* Bridges proxy-exposed MCP tools as AI SDK tools. The proxy handles
|
|
91
|
+
* policy evaluation internally, so these wrappers simply forward
|
|
92
|
+
* calls to the MCP client.
|
|
92
93
|
*/
|
|
93
|
-
function
|
|
94
|
-
const
|
|
95
|
-
for (const mcpTool of
|
|
96
|
-
const qualifiedName = `${serverName}__${mcpTool.name}`;
|
|
94
|
+
export function bridgeProxyTools(client, tools) {
|
|
95
|
+
const bridged = {};
|
|
96
|
+
for (const mcpTool of tools) {
|
|
97
97
|
// Ensure the input schema has "type": "object" (some MCP servers omit it)
|
|
98
98
|
const schema = { type: 'object', ...mcpTool.inputSchema };
|
|
99
|
-
|
|
99
|
+
bridged[mcpTool.name] = tool({
|
|
100
100
|
description: mcpTool.description ?? `Tool: ${mcpTool.name}`,
|
|
101
101
|
inputSchema: jsonSchema(schema),
|
|
102
102
|
execute: async (args) => {
|
|
103
|
-
const result = await
|
|
103
|
+
const result = await client.callTool({
|
|
104
104
|
name: mcpTool.name,
|
|
105
105
|
arguments: args,
|
|
106
106
|
});
|
|
@@ -115,25 +115,7 @@ function bridgeMcpTools(serverName, connection) {
|
|
|
115
115
|
},
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
return
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Selects which MCP connection to use for a definition.
|
|
122
|
-
* Prefers mcpServerHint if it matches a connected server; otherwise
|
|
123
|
-
* uses the first available connection.
|
|
124
|
-
*/
|
|
125
|
-
function selectMcpConnection(definition, connections) {
|
|
126
|
-
if (definition.mcpServerHint) {
|
|
127
|
-
const connection = connections.get(definition.mcpServerHint);
|
|
128
|
-
if (connection)
|
|
129
|
-
return { serverName: definition.mcpServerHint, connection };
|
|
130
|
-
}
|
|
131
|
-
// Fall back to first available connection
|
|
132
|
-
const first = connections.entries().next();
|
|
133
|
-
if (!first.done) {
|
|
134
|
-
return { serverName: first.value[0], connection: first.value[1] };
|
|
135
|
-
}
|
|
136
|
-
return undefined;
|
|
118
|
+
return bridged;
|
|
137
119
|
}
|
|
138
120
|
/**
|
|
139
121
|
* Resolves a data-backed list by giving the LLM access to MCP tools.
|
|
@@ -152,7 +134,14 @@ async function resolveViaMcpTools(prompt, model, mcpTools, onProgress) {
|
|
|
152
134
|
const parsed = parseValuesFromText(result.text);
|
|
153
135
|
if (parsed.length > 0)
|
|
154
136
|
return parsed;
|
|
155
|
-
//
|
|
137
|
+
// Check if the LLM's response indicates all tool calls failed (e.g., missing OAuth, auth errors)
|
|
138
|
+
const errorPatterns = /\b(Error|Login Required|No refresh token|authentication failed|unauthorized)\b/i;
|
|
139
|
+
if (errorPatterns.test(result.text)) {
|
|
140
|
+
// Extract a short excerpt for the error message
|
|
141
|
+
const excerpt = result.text.slice(0, 300).replace(/\n/g, ' ').trim();
|
|
142
|
+
throw new Error(`MCP-backed list resolution failed — LLM reported errors: ${excerpt}`);
|
|
143
|
+
}
|
|
144
|
+
// If parsing failed but no errors detected, warn and return empty
|
|
156
145
|
console.error(` Warning: Could not parse list values from MCP-backed resolution text`);
|
|
157
146
|
return [];
|
|
158
147
|
}
|
|
@@ -195,7 +184,7 @@ function parseValuesFromText(text) {
|
|
|
195
184
|
* Resolves a single list definition to concrete values.
|
|
196
185
|
*
|
|
197
186
|
* For knowledge-based lists: uses structured LLM output.
|
|
198
|
-
* For data-backed lists:
|
|
187
|
+
* For data-backed lists: bridges proxy tools as AI SDK tools for LLM tool-use.
|
|
199
188
|
*
|
|
200
189
|
* Applies type-specific validation to filter malformed values.
|
|
201
190
|
* Preserves manual overrides from any existing resolution.
|
|
@@ -205,13 +194,16 @@ export async function resolveList(definition, config, existing, onProgress) {
|
|
|
205
194
|
const prompt = buildResolutionPrompt(definition);
|
|
206
195
|
let rawValues;
|
|
207
196
|
if (definition.requiresMcp) {
|
|
208
|
-
|
|
209
|
-
|
|
197
|
+
if (!config.proxyConnection) {
|
|
198
|
+
throw new Error(`List "@${definition.name}" requires MCP access but no proxy connection ` +
|
|
199
|
+
`was provided. Ensure MCP servers are available (use --no-mcp to skip).`);
|
|
200
|
+
}
|
|
201
|
+
if (config.proxyConnection.tools.length === 0) {
|
|
210
202
|
throw new Error(`List "@${definition.name}" requires MCP server access (requiresMcp: true) ` +
|
|
211
|
-
`but no MCP
|
|
212
|
-
`"${definition.mcpServerHint ?? 'required'}" MCP server is configured and reachable.`);
|
|
203
|
+
`but no MCP tools are available through the proxy. ` +
|
|
204
|
+
`Ensure the "${definition.mcpServerHint ?? 'required'}" MCP server is configured and reachable.`);
|
|
213
205
|
}
|
|
214
|
-
const mcpTools =
|
|
206
|
+
const mcpTools = bridgeProxyTools(config.proxyConnection.client, config.proxyConnection.tools);
|
|
215
207
|
rawValues = await resolveViaMcpTools(prompt, config.model, mcpTools, onProgress);
|
|
216
208
|
}
|
|
217
209
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resolver.js","sourceRoot":"","sources":["../../src/pipeline/list-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"list-resolver.js","sourceRoot":"","sources":["../../src/pipeline/list-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiBnD,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACpE,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,qBAAqB,CAAC,UAA0B;IACvD,MAAM,OAAO,G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,CAAC;IAED,OAAO;QACL,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
* PipelineRunner -- Encapsulates the full policy compilation pipeline.
|
|
3
3
|
*
|
|
4
4
|
* Provides a reusable abstraction over the compile-verify-repair loop.
|
|
5
|
-
* Used by
|
|
6
|
-
* - compile.ts CLI (constitutionKind: 'constitution')
|
|
7
|
-
* - compileTaskPolicy() (constitutionKind: 'task-policy')
|
|
5
|
+
* Used by:
|
|
6
|
+
* - compile.ts CLI (constitutionKind: 'constitution') -- per-server compilation
|
|
7
|
+
* - compileTaskPolicy() (constitutionKind: 'task-policy') -- per-server whitelist
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Each MCP server is compiled independently with its own compile-verify-repair
|
|
10
|
+
* cycle, then results are merged. This enables incremental recompilation and
|
|
11
|
+
* better per-server rule quality.
|
|
12
12
|
*/
|
|
13
13
|
import type { LanguageModel } from 'ai';
|
|
14
14
|
import type { MCPServerConfig } from '../config/types.js';
|
|
15
15
|
import type { LlmLogContext } from './llm-logger.js';
|
|
16
16
|
import type { PromptCacheStrategy } from '../session/prompt-cache.js';
|
|
17
|
-
import type { CompiledPolicyFile,
|
|
17
|
+
import type { CompiledPolicyFile, CompiledRule, DynamicListsFile, ListDefinition, StoredToolAnnotationsFile, TestScenario, ToolAnnotation } from './types.js';
|
|
18
18
|
/**
|
|
19
|
-
* Selects the LLM prompt variant for policy compilation.
|
|
19
|
+
* Selects the LLM prompt variant for per-server policy compilation.
|
|
20
20
|
*
|
|
21
21
|
* - 'constitution': broad-principle compilation from a constitution document.
|
|
22
|
-
* - 'task-policy': whitelist-generation from an English task description.
|
|
22
|
+
* - 'task-policy': strict whitelist-generation from an English task description.
|
|
23
|
+
*
|
|
24
|
+
* Both modes compile each server independently via the per-server path.
|
|
23
25
|
*/
|
|
24
26
|
export type ConstitutionKind = 'constitution' | 'task-policy';
|
|
25
27
|
/**
|
|
@@ -46,13 +48,15 @@ export interface PipelineRunConfig {
|
|
|
46
48
|
readonly llmLogPath?: string;
|
|
47
49
|
/**
|
|
48
50
|
* Whether to include handwritten scenarios in verification.
|
|
49
|
-
*
|
|
51
|
+
* Defaults to true for 'constitution', false for 'task-policy'.
|
|
50
52
|
*/
|
|
51
53
|
readonly includeHandwrittenScenarios?: boolean;
|
|
52
54
|
/** Progress callback for CLI output. */
|
|
53
55
|
readonly onProgress?: (message: string) => void;
|
|
54
|
-
/** Pre-loaded tool annotations (avoids re-reading from disk). */
|
|
55
|
-
readonly
|
|
56
|
+
/** Pre-loaded stored tool annotations (avoids re-reading from disk). */
|
|
57
|
+
readonly preloadedStoredAnnotations?: StoredToolAnnotationsFile;
|
|
58
|
+
/** Compile only these servers (default: all servers in annotations). */
|
|
59
|
+
readonly serverFilter?: string[];
|
|
56
60
|
}
|
|
57
61
|
/**
|
|
58
62
|
* LLM model references shared across pipeline runs.
|
|
@@ -66,9 +70,52 @@ export interface PipelineModels {
|
|
|
66
70
|
}
|
|
67
71
|
/** Creates PipelineModels from user config. Delegates to shared createPipelineLlm. */
|
|
68
72
|
export declare function createPipelineModels(logDir?: string): Promise<PipelineModels>;
|
|
73
|
+
/** Output from a single server's compilation cycle. */
|
|
74
|
+
interface ServerCompilationResult {
|
|
75
|
+
readonly serverName: string;
|
|
76
|
+
readonly rules: CompiledRule[];
|
|
77
|
+
readonly listDefinitions: ListDefinition[];
|
|
78
|
+
readonly scenarios: TestScenario[];
|
|
79
|
+
readonly inputHash: string;
|
|
80
|
+
readonly constitutionHash: string;
|
|
81
|
+
readonly resolvedLists?: DynamicListsFile;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Computes a content hash for a single server's policy compilation inputs.
|
|
85
|
+
* The hash includes the server name, constitution, annotations, and prompt
|
|
86
|
+
* template so that any change invalidates the cache for this server.
|
|
87
|
+
*/
|
|
88
|
+
export declare function computeServerPolicyHash(serverName: string, constitutionText: string, annotations: ToolAnnotation[], compilerPromptTemplate: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Filters handwritten scenarios to only those belonging to a specific server.
|
|
91
|
+
* Safe because handwritten scenarios are tagged with serverName in their request.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getHandwrittenScenariosForServer(serverName: string, sandboxDir: string): TestScenario[];
|
|
94
|
+
/**
|
|
95
|
+
* Debug assertion: validates that all rules from a server's compilation
|
|
96
|
+
* are properly scoped to exactly that server. This should never fail if
|
|
97
|
+
* the Zod schema with requireServer is correct.
|
|
98
|
+
*/
|
|
99
|
+
export declare function validateServerScoping(serverName: string, rules: CompiledRule[]): void;
|
|
100
|
+
/**
|
|
101
|
+
* Deduplicates list definitions by name. When two servers produce different
|
|
102
|
+
* generationPrompt values for the same named list, uses first-wins
|
|
103
|
+
* (alphabetical server order) and logs a warning.
|
|
104
|
+
*/
|
|
105
|
+
export declare function deduplicateListDefinitions(defs: ListDefinition[]): ListDefinition[];
|
|
106
|
+
/**
|
|
107
|
+
* Merges per-server compilation results into a single CompiledPolicyFile.
|
|
108
|
+
* Rules are concatenated in alphabetical server order for determinism.
|
|
109
|
+
* List definitions are deduplicated by name.
|
|
110
|
+
*/
|
|
111
|
+
export declare function mergeServerResults(results: ServerCompilationResult[], constitutionHash: string): CompiledPolicyFile;
|
|
69
112
|
/**
|
|
70
113
|
* Encapsulates the full policy compilation pipeline:
|
|
71
114
|
* compile rules -> generate scenarios -> verify -> repair loop.
|
|
115
|
+
*
|
|
116
|
+
* Uses per-server compilation with independent compile-verify-repair
|
|
117
|
+
* cycles per server, then merges results. Works for both 'constitution'
|
|
118
|
+
* (broad principles) and 'task-policy' (strict whitelist) modes.
|
|
72
119
|
*/
|
|
73
120
|
export declare class PipelineRunner {
|
|
74
121
|
private readonly model;
|
|
@@ -77,10 +124,52 @@ export declare class PipelineRunner {
|
|
|
77
124
|
constructor(models: PipelineModels);
|
|
78
125
|
/**
|
|
79
126
|
* Runs the full pipeline. Returns the compiled policy on success.
|
|
127
|
+
* All compilation modes use per-server compilation with independent
|
|
128
|
+
* compile-verify-repair cycles per server, then merge results.
|
|
80
129
|
*/
|
|
81
130
|
run(config: PipelineRunConfig): Promise<CompiledPolicyFile>;
|
|
82
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Orchestrates per-server compilation + merge.
|
|
133
|
+
*
|
|
134
|
+
* Phase 1: Compile each server independently (compile-verify-repair per server)
|
|
135
|
+
* Phase 2: Merge all per-server results into final compiled-policy.json
|
|
136
|
+
* Phase 3: Resolve dynamic lists (global, post-merge)
|
|
137
|
+
*
|
|
138
|
+
* Works for both 'constitution' and 'task-policy' modes -- the
|
|
139
|
+
* constitutionKind is forwarded to each server's compilation unit
|
|
140
|
+
* to select the appropriate compiler prompt.
|
|
141
|
+
*/
|
|
142
|
+
private runPerServer;
|
|
143
|
+
/**
|
|
144
|
+
* Compiles rules for all servers sequentially.
|
|
145
|
+
* Respects serverFilter if provided (for debugging single servers).
|
|
146
|
+
*/
|
|
147
|
+
private compileAllServers;
|
|
148
|
+
/**
|
|
149
|
+
* Compiles a single server: compile -> generate scenarios -> verify -> repair.
|
|
150
|
+
* Self-contained compile-verify-repair loop per server.
|
|
151
|
+
*/
|
|
152
|
+
private compileServer;
|
|
153
|
+
/**
|
|
154
|
+
* Compiles policy rules for a single server (initial compilation).
|
|
155
|
+
* Uses per-server schema with requireServer: true.
|
|
156
|
+
*/
|
|
157
|
+
private compileServerPolicyRules;
|
|
83
158
|
private compilePolicyRulesWithRepair;
|
|
159
|
+
/**
|
|
160
|
+
* Attempts point-fix repair via the session, falling back to full recompile.
|
|
161
|
+
* When a compiler session exists, uses repairPointFix() to emit a minimal
|
|
162
|
+
* patch instead of regenerating the entire rule set. This avoids oscillation
|
|
163
|
+
* where fixing one failure breaks previously-passing rules.
|
|
164
|
+
*/
|
|
165
|
+
private compilePolicyRulesWithPointFix;
|
|
166
|
+
/**
|
|
167
|
+
* Resolves dynamic lists for a single server's list definitions.
|
|
168
|
+
* Loads existing per-server dynamic-lists.json for cache comparison,
|
|
169
|
+
* connects MCP servers if needed, and writes results to serverOutputDir.
|
|
170
|
+
*/
|
|
171
|
+
private resolveServerLists;
|
|
84
172
|
private generateTestScenarios;
|
|
85
173
|
private logVerboseFailures;
|
|
86
174
|
}
|
|
175
|
+
export {};
|