@provos/ironcurtain 0.9.0 → 0.10.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.
Files changed (96) hide show
  1. package/README.md +20 -12
  2. package/dist/cli.js +2 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/config-command.js +12 -3
  5. package/dist/config/config-command.js.map +1 -1
  6. package/dist/config/model-provider.d.ts +8 -2
  7. package/dist/config/model-provider.js +52 -9
  8. package/dist/config/model-provider.js.map +1 -1
  9. package/dist/config/paths.d.ts +6 -0
  10. package/dist/config/paths.js +18 -9
  11. package/dist/config/paths.js.map +1 -1
  12. package/dist/config/user-config.d.ts +9 -0
  13. package/dist/config/user-config.js +26 -5
  14. package/dist/config/user-config.js.map +1 -1
  15. package/dist/cron/compile-task-policy.js +1 -0
  16. package/dist/cron/compile-task-policy.js.map +1 -1
  17. package/dist/docker/adapters/claude-code.d.ts +2 -1
  18. package/dist/docker/adapters/claude-code.js +135 -120
  19. package/dist/docker/adapters/claude-code.js.map +1 -1
  20. package/dist/docker/agent-registry.js +3 -2
  21. package/dist/docker/agent-registry.js.map +1 -1
  22. package/dist/docker/container-lifecycle.d.ts +15 -0
  23. package/dist/docker/container-lifecycle.js +32 -0
  24. package/dist/docker/container-lifecycle.js.map +1 -0
  25. package/dist/docker/docker-agent-session.js +16 -23
  26. package/dist/docker/docker-agent-session.js.map +1 -1
  27. package/dist/docker/docker-infrastructure.d.ts +10 -0
  28. package/dist/docker/docker-infrastructure.js +71 -4
  29. package/dist/docker/docker-infrastructure.js.map +1 -1
  30. package/dist/docker/docker-manager.js +37 -0
  31. package/dist/docker/docker-manager.js.map +1 -1
  32. package/dist/docker/mitm-proxy.d.ts +6 -0
  33. package/dist/docker/mitm-proxy.js +343 -25
  34. package/dist/docker/mitm-proxy.js.map +1 -1
  35. package/dist/docker/oauth-credentials.d.ts +45 -6
  36. package/dist/docker/oauth-credentials.js +151 -24
  37. package/dist/docker/oauth-credentials.js.map +1 -1
  38. package/dist/docker/oauth-token-manager.d.ts +15 -16
  39. package/dist/docker/oauth-token-manager.js +23 -17
  40. package/dist/docker/oauth-token-manager.js.map +1 -1
  41. package/dist/docker/provider-config.d.ts +32 -0
  42. package/dist/docker/provider-config.js +20 -0
  43. package/dist/docker/provider-config.js.map +1 -1
  44. package/dist/docker/pty-session.js +14 -22
  45. package/dist/docker/pty-session.js.map +1 -1
  46. package/dist/docker/types.d.ts +8 -0
  47. package/dist/index.js +8 -0
  48. package/dist/index.js.map +1 -1
  49. package/dist/mux/mux-app.d.ts +2 -0
  50. package/dist/mux/mux-app.js +48 -37
  51. package/dist/mux/mux-app.js.map +1 -1
  52. package/dist/mux/mux-command.js +7 -1
  53. package/dist/mux/mux-command.js.map +1 -1
  54. package/dist/mux/mux-input-handler.d.ts +2 -0
  55. package/dist/mux/mux-input-handler.js +6 -4
  56. package/dist/mux/mux-input-handler.js.map +1 -1
  57. package/dist/mux/mux-renderer.js +20 -5
  58. package/dist/mux/mux-renderer.js.map +1 -1
  59. package/dist/mux/pty-bridge.d.ts +2 -0
  60. package/dist/mux/pty-bridge.js +3 -0
  61. package/dist/mux/pty-bridge.js.map +1 -1
  62. package/dist/mux/session-scanner.d.ts +7 -0
  63. package/dist/mux/session-scanner.js +21 -1
  64. package/dist/mux/session-scanner.js.map +1 -1
  65. package/dist/mux/types.d.ts +0 -4
  66. package/dist/mux/types.js.map +1 -1
  67. package/dist/persona/compile-persona-policy.js +1 -0
  68. package/dist/persona/compile-persona-policy.js.map +1 -1
  69. package/dist/pipeline/annotate.d.ts +7 -1
  70. package/dist/pipeline/annotate.js +92 -2
  71. package/dist/pipeline/annotate.js.map +1 -1
  72. package/dist/pipeline/compile.js +2 -0
  73. package/dist/pipeline/compile.js.map +1 -1
  74. package/dist/pipeline/llm-logger.d.ts +1 -0
  75. package/dist/pipeline/llm-logger.js +8 -1
  76. package/dist/pipeline/llm-logger.js.map +1 -1
  77. package/dist/pipeline/parallel-progress.d.ts +59 -0
  78. package/dist/pipeline/parallel-progress.js +263 -0
  79. package/dist/pipeline/parallel-progress.js.map +1 -0
  80. package/dist/pipeline/pipeline-runner.d.ts +49 -8
  81. package/dist/pipeline/pipeline-runner.js +375 -226
  82. package/dist/pipeline/pipeline-runner.js.map +1 -1
  83. package/dist/pipeline/pipeline-shared.d.ts +58 -0
  84. package/dist/pipeline/pipeline-shared.js +124 -1
  85. package/dist/pipeline/pipeline-shared.js.map +1 -1
  86. package/dist/pipeline/server-prefilter.d.ts +31 -0
  87. package/dist/pipeline/server-prefilter.js +115 -0
  88. package/dist/pipeline/server-prefilter.js.map +1 -0
  89. package/dist/pipeline/types.d.ts +5 -0
  90. package/dist/session/preflight.js +15 -16
  91. package/dist/session/preflight.js.map +1 -1
  92. package/dist/trusted-process/sandbox-integration.js +8 -0
  93. package/dist/trusted-process/sandbox-integration.js.map +1 -1
  94. package/docker/Dockerfile.base +3 -1
  95. package/docker/Dockerfile.base.arm64 +8 -1
  96. package/package.json +4 -1
@@ -10,9 +10,9 @@
10
10
  * cycle, then results are merged. This enables incremental recompilation and
11
11
  * better per-server rule quality.
12
12
  */
13
+ import type { LanguageModelV3 } from '@ai-sdk/provider';
13
14
  import type { LanguageModel } from 'ai';
14
15
  import type { MCPServerConfig } from '../config/types.js';
15
- import type { LlmLogContext } from './llm-logger.js';
16
16
  import type { PromptCacheStrategy } from '../session/prompt-cache.js';
17
17
  import type { CompiledPolicyFile, CompiledRule, DynamicListsFile, ListDefinition, StoredToolAnnotationsFile, TestScenario, ToolAnnotation } from './types.js';
18
18
  /**
@@ -57,16 +57,28 @@ export interface PipelineRunConfig {
57
57
  readonly preloadedStoredAnnotations?: StoredToolAnnotationsFile;
58
58
  /** Compile only these servers (default: all servers in annotations). */
59
59
  readonly serverFilter?: string[];
60
+ /**
61
+ * Text for the pre-filter to evaluate server relevance against.
62
+ * Caller provides the appropriate text for the compilation mode:
63
+ * - Constitution mode: user constitution only (without base principles)
64
+ * - Task-policy mode: task description
65
+ * - Persona mode: persona constitution
66
+ *
67
+ * When undefined, the pre-filter is skipped.
68
+ */
69
+ readonly prefilterText?: string;
60
70
  }
61
71
  /**
62
72
  * LLM model references shared across pipeline runs.
63
73
  * Thin wrapper around PipelineLlm with a renamed field for clarity.
64
74
  */
65
75
  export interface PipelineModels {
66
- readonly compilationModel: LanguageModel;
76
+ /** The unwrapped base model for creating per-server wrapped models. */
77
+ readonly baseLlm: LanguageModelV3;
67
78
  readonly cacheStrategy: PromptCacheStrategy;
68
- readonly logContext: LlmLogContext;
69
79
  readonly logPath: string;
80
+ /** Cheap model for pre-filter classification (Haiku). */
81
+ readonly prefilterModel: LanguageModel;
70
82
  }
71
83
  /** Creates PipelineModels from user config. Delegates to shared createPipelineLlm. */
72
84
  export declare function createPipelineModels(logDir?: string): Promise<PipelineModels>;
@@ -108,7 +120,10 @@ export declare function deduplicateListDefinitions(defs: ListDefinition[]): List
108
120
  * Rules are concatenated in alphabetical server order for determinism.
109
121
  * List definitions are deduplicated by name.
110
122
  */
111
- export declare function mergeServerResults(results: ServerCompilationResult[], constitutionHash: string): CompiledPolicyFile;
123
+ export declare function mergeServerResults(results: ServerCompilationResult[], constitutionHash: string, skippedServers?: Array<{
124
+ serverName: string;
125
+ reason: string;
126
+ }>): CompiledPolicyFile;
112
127
  /**
113
128
  * Encapsulates the full policy compilation pipeline:
114
129
  * compile rules -> generate scenarios -> verify -> repair loop.
@@ -118,9 +133,10 @@ export declare function mergeServerResults(results: ServerCompilationResult[], c
118
133
  * (broad principles) and 'task-policy' (strict whitelist) modes.
119
134
  */
120
135
  export declare class PipelineRunner {
121
- private readonly model;
136
+ private readonly baseLlm;
122
137
  private readonly cacheStrategy;
123
- private readonly logContext;
138
+ private readonly logPath;
139
+ private readonly prefilterModel;
124
140
  constructor(models: PipelineModels);
125
141
  /**
126
142
  * Runs the full pipeline. Returns the compiled policy on success.
@@ -141,15 +157,40 @@ export declare class PipelineRunner {
141
157
  */
142
158
  private runPerServer;
143
159
  /**
144
- * Compiles rules for all servers sequentially.
145
- * Respects serverFilter if provided (for debugging single servers).
160
+ * Compiles rules for all servers, in parallel when multiple servers are present.
161
+ * Single-server compilation uses sequential spinner-based output.
162
+ * Multi-server compilation uses parallel execution with a multi-line progress display.
146
163
  */
147
164
  private compileAllServers;
165
+ /** Creates a per-server model wrapped with LLM call throttling. */
166
+ private createServerModel;
167
+ private compileServersSequential;
168
+ private compileServersParallel;
169
+ private handleCompilationResults;
148
170
  /**
149
171
  * Compiles a single server: compile -> generate scenarios -> verify -> repair.
150
172
  * Self-contained compile-verify-repair loop per server.
173
+ *
174
+ * Each server receives its own model (with per-server logging middleware),
175
+ * logContext (for step labeling), and reporter (for progress/warnings).
176
+ * This makes the method safe for concurrent execution.
151
177
  */
152
178
  private compileServer;
179
+ /**
180
+ * Runs initial verification and the compile-verify-repair loop for a server.
181
+ * Returns the mutable compilation state after all repair attempts.
182
+ */
183
+ private verifyAndRepairServer;
184
+ /**
185
+ * Filters structurally conflicting scenarios and generates replacements
186
+ * for discarded ones via LLM repair (pre-loop, one-time).
187
+ */
188
+ private filterAndRepairDiscardedScenarios;
189
+ /**
190
+ * Compile-verify-repair loop (up to 2 repair attempts).
191
+ * Mutates `state` in place with updated rules, lists, and verification results.
192
+ */
193
+ private runRepairLoop;
153
194
  /**
154
195
  * Compiles policy rules for a single server (initial compilation).
155
196
  * Uses per-server schema with requireServer: true.