@provos/ironcurtain 0.7.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.
Files changed (95) hide show
  1. package/README.md +24 -100
  2. package/dist/cli.js +6 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/constitution-readonly.md +21 -0
  5. package/dist/config/generated-readonly/compiled-policy.json +468 -0
  6. package/dist/config/paths.d.ts +17 -0
  7. package/dist/config/paths.js +23 -0
  8. package/dist/config/paths.js.map +1 -1
  9. package/dist/cron/constitution-generator.d.ts +60 -0
  10. package/dist/cron/constitution-generator.js +217 -0
  11. package/dist/cron/constitution-generator.js.map +1 -0
  12. package/dist/cron/job-commands.js +104 -41
  13. package/dist/cron/job-commands.js.map +1 -1
  14. package/dist/cron/job-customizer.d.ts +22 -0
  15. package/dist/cron/job-customizer.js +47 -0
  16. package/dist/cron/job-customizer.js.map +1 -0
  17. package/dist/cron/types.d.ts +8 -0
  18. package/dist/cron/types.js +3 -6
  19. package/dist/cron/types.js.map +1 -1
  20. package/dist/daemon/ironcurtain-daemon.js +3 -1
  21. package/dist/daemon/ironcurtain-daemon.js.map +1 -1
  22. package/dist/docker/mitm-proxy.js +10 -5
  23. package/dist/docker/mitm-proxy.js.map +1 -1
  24. package/dist/docker/oauth-credentials.js +2 -2
  25. package/dist/docker/oauth-credentials.js.map +1 -1
  26. package/dist/docker/pty-session.js +139 -35
  27. package/dist/docker/pty-session.js.map +1 -1
  28. package/dist/index.js +13 -4
  29. package/dist/index.js.map +1 -1
  30. package/dist/mux/mux-command.js +29 -1
  31. package/dist/mux/mux-command.js.map +1 -1
  32. package/dist/persona/compile-persona-policy.d.ts +21 -0
  33. package/dist/persona/compile-persona-policy.js +50 -0
  34. package/dist/persona/compile-persona-policy.js.map +1 -0
  35. package/dist/persona/persona-command.d.ts +9 -0
  36. package/dist/persona/persona-command.js +479 -0
  37. package/dist/persona/persona-command.js.map +1 -0
  38. package/dist/persona/persona-customizer.d.ts +23 -0
  39. package/dist/persona/persona-customizer.js +52 -0
  40. package/dist/persona/persona-customizer.js.map +1 -0
  41. package/dist/persona/persona-prompt.d.ts +19 -0
  42. package/dist/persona/persona-prompt.js +42 -0
  43. package/dist/persona/persona-prompt.js.map +1 -0
  44. package/dist/persona/resolve.d.ts +46 -0
  45. package/dist/persona/resolve.js +108 -0
  46. package/dist/persona/resolve.js.map +1 -0
  47. package/dist/persona/types.d.ts +40 -0
  48. package/dist/persona/types.js +20 -0
  49. package/dist/persona/types.js.map +1 -0
  50. package/dist/pipeline/annotate.js +8 -3
  51. package/dist/pipeline/annotate.js.map +1 -1
  52. package/dist/pipeline/compile.d.ts +13 -0
  53. package/dist/pipeline/compile.js +27 -1
  54. package/dist/pipeline/compile.js.map +1 -1
  55. package/dist/pipeline/constitution-compiler.d.ts +6 -0
  56. package/dist/pipeline/constitution-compiler.js +41 -5
  57. package/dist/pipeline/constitution-compiler.js.map +1 -1
  58. package/dist/pipeline/constitution-customizer.d.ts +3 -0
  59. package/dist/pipeline/constitution-customizer.js +19 -5
  60. package/dist/pipeline/constitution-customizer.js.map +1 -1
  61. package/dist/pipeline/customizer-loop.d.ts +34 -0
  62. package/dist/pipeline/customizer-loop.js +167 -0
  63. package/dist/pipeline/customizer-loop.js.map +1 -0
  64. package/dist/pipeline/pipeline-runner.js +2 -9
  65. package/dist/pipeline/pipeline-runner.js.map +1 -1
  66. package/dist/pipeline/pipeline-shared.d.ts +8 -1
  67. package/dist/pipeline/pipeline-shared.js +9 -4
  68. package/dist/pipeline/pipeline-shared.js.map +1 -1
  69. package/dist/pipeline/tool-annotator.js +20 -2
  70. package/dist/pipeline/tool-annotator.js.map +1 -1
  71. package/dist/session/index.d.ts +10 -0
  72. package/dist/session/index.js +108 -35
  73. package/dist/session/index.js.map +1 -1
  74. package/dist/session/session-metadata.d.ts +18 -0
  75. package/dist/session/session-metadata.js +34 -0
  76. package/dist/session/session-metadata.js.map +1 -0
  77. package/dist/session/types.d.ts +20 -0
  78. package/dist/signal/signal-bot-daemon.js +8 -5
  79. package/dist/signal/signal-bot-daemon.js.map +1 -1
  80. package/dist/trusted-process/domain-utils.d.ts +2 -3
  81. package/dist/trusted-process/domain-utils.js +46 -34
  82. package/dist/trusted-process/domain-utils.js.map +1 -1
  83. package/dist/trusted-process/mcp-proxy-server.d.ts +19 -0
  84. package/dist/trusted-process/mcp-proxy-server.js +32 -12
  85. package/dist/trusted-process/mcp-proxy-server.js.map +1 -1
  86. package/dist/trusted-process/policy-engine.d.ts +2 -3
  87. package/dist/trusted-process/policy-engine.js +4 -42
  88. package/dist/trusted-process/policy-engine.js.map +1 -1
  89. package/dist/types/slug.d.ts +7 -0
  90. package/dist/types/slug.js +14 -0
  91. package/dist/types/slug.js.map +1 -0
  92. package/dist/utils/editor.d.ts +24 -0
  93. package/dist/utils/editor.js +66 -0
  94. package/dist/utils/editor.js.map +1 -0
  95. package/package.json +1 -1
@@ -0,0 +1,468 @@
1
+ {
2
+ "generatedAt": "2026-03-06T22:53:18.790Z",
3
+ "constitutionHash": "750295d07a6b1a5dba6ab44d3fa62b2b5a3426340ada35f2cf300b04c418b49b",
4
+ "inputHash": "0536def5e41fbc6f740995d8e9e211b58b4cc40ea7157d053f42ab7931b6fadc-repair",
5
+ "rules": [
6
+ {
7
+ "name": "allow-filesystem-reads",
8
+ "description": "Allow reading files, listing directories, and querying metadata anywhere on the filesystem.",
9
+ "principle": "Broad read access: Reading files, listing directories, and querying metadata is permitted anywhere.",
10
+ "if": {
11
+ "tool": [
12
+ "read_file",
13
+ "read_text_file",
14
+ "read_media_file",
15
+ "read_multiple_files",
16
+ "list_directory",
17
+ "list_directory_with_sizes",
18
+ "directory_tree",
19
+ "search_files",
20
+ "get_file_info"
21
+ ]
22
+ },
23
+ "then": "allow",
24
+ "reason": "Constitution explicitly permits reading files and listing directories anywhere on the filesystem."
25
+ },
26
+ {
27
+ "name": "allow-list-allowed-directories",
28
+ "description": "Allow querying which directories the filesystem server can access.",
29
+ "principle": "Broad read access: Reading files, listing directories, and querying metadata is permitted anywhere.",
30
+ "if": {
31
+ "tool": [
32
+ "list_allowed_directories"
33
+ ]
34
+ },
35
+ "then": "allow",
36
+ "reason": "Listing allowed directories is a read-only metadata query explicitly permitted."
37
+ },
38
+ {
39
+ "name": "escalate-filesystem-writes",
40
+ "description": "Escalate any file write, edit, or create operation for human approval.",
41
+ "principle": "No mutations: Any operation that creates, modifies, or deletes data must be escalated for human approval.",
42
+ "if": {
43
+ "tool": [
44
+ "write_file",
45
+ "edit_file",
46
+ "create_directory"
47
+ ]
48
+ },
49
+ "then": "escalate",
50
+ "reason": "Constitution requires human approval before any write or create operation."
51
+ },
52
+ {
53
+ "name": "escalate-filesystem-move",
54
+ "description": "Escalate any file move/rename operation for human approval.",
55
+ "principle": "No mutations: Any operation that creates, modifies, or deletes data must be escalated for human approval.",
56
+ "if": {
57
+ "tool": [
58
+ "move_file"
59
+ ]
60
+ },
61
+ "then": "escalate",
62
+ "reason": "Move operations modify the filesystem by deleting the source and creating the destination, requiring human approval."
63
+ },
64
+ {
65
+ "name": "allow-git-read-only-tools",
66
+ "description": "Allow reading git log, status, diff, blame, show, reflog, and changelog analysis.",
67
+ "principle": "The agent is allowed to read git log, status, diff, and branch information.",
68
+ "if": {
69
+ "tool": [
70
+ "git_log",
71
+ "git_status",
72
+ "git_diff",
73
+ "git_blame",
74
+ "git_show",
75
+ "git_reflog",
76
+ "git_changelog_analyze"
77
+ ]
78
+ },
79
+ "then": "allow",
80
+ "reason": "Constitution explicitly permits reading git log, status, diff, and branch information."
81
+ },
82
+ {
83
+ "name": "allow-git-set-working-dir",
84
+ "description": "Allow setting or clearing the git working directory for navigation.",
85
+ "principle": "The agent is allowed to set the git working directory for navigation.",
86
+ "if": {
87
+ "tool": [
88
+ "git_set_working_dir",
89
+ "git_clear_working_dir"
90
+ ]
91
+ },
92
+ "then": "allow",
93
+ "reason": "Constitution explicitly permits setting the git working directory for navigation."
94
+ },
95
+ {
96
+ "name": "allow-git-wrapup-instructions",
97
+ "description": "Allow querying git wrap-up workflow instructions (read-only, no side effects).",
98
+ "principle": "Read-only exploration: The agent may only observe and query.",
99
+ "if": {
100
+ "tool": [
101
+ "git_wrapup_instructions"
102
+ ]
103
+ },
104
+ "then": "allow",
105
+ "reason": "git_wrapup_instructions is a read-only query with no side effects."
106
+ },
107
+ {
108
+ "name": "allow-git-branch-read",
109
+ "description": "Allow listing git branches (read-only).",
110
+ "principle": "The agent is allowed to read git log, status, diff, and branch information.",
111
+ "if": {
112
+ "roles": [
113
+ "read-path"
114
+ ],
115
+ "tool": [
116
+ "git_branch"
117
+ ]
118
+ },
119
+ "then": "allow",
120
+ "reason": "Constitution permits reading branch information; listing only activates read-path role."
121
+ },
122
+ {
123
+ "name": "allow-git-remote-list",
124
+ "description": "Allow listing git remotes (read-only, no remote URL argument present).",
125
+ "principle": "The agent is allowed to read git log, status, diff, and branch information.",
126
+ "if": {
127
+ "roles": [
128
+ "read-path"
129
+ ],
130
+ "tool": [
131
+ "git_remote"
132
+ ]
133
+ },
134
+ "then": "allow",
135
+ "reason": "Listing remotes only activates read-path; constitution only requires approval for mutations to remote config."
136
+ },
137
+ {
138
+ "name": "escalate-git-remote-mutations",
139
+ "description": "Escalate adding, removing, or renaming git remotes (when a remote URL is provided).",
140
+ "principle": "The agent must ask for approval before adding, removing, or renaming git remotes.",
141
+ "if": {
142
+ "roles": [
143
+ "git-remote-url"
144
+ ],
145
+ "tool": [
146
+ "git_remote"
147
+ ]
148
+ },
149
+ "then": "escalate",
150
+ "reason": "Constitution requires human approval before modifying git remote configuration."
151
+ },
152
+ {
153
+ "name": "allow-git-fetch-from-github",
154
+ "description": "Allow git fetch from GitHub remotes.",
155
+ "principle": "GitHub read access: Querying GitHub repositories, issues, and pull requests is permitted for reading.",
156
+ "if": {
157
+ "tool": [
158
+ "git_fetch"
159
+ ],
160
+ "domains": {
161
+ "roles": [
162
+ "git-remote-url"
163
+ ],
164
+ "allowed": [
165
+ "github.com"
166
+ ]
167
+ }
168
+ },
169
+ "then": "allow",
170
+ "reason": "Constitution permits GitHub read access; git fetch downloads objects without merging."
171
+ },
172
+ {
173
+ "name": "allow-git-clone-from-github",
174
+ "description": "Allow git clone from GitHub.",
175
+ "principle": "GitHub read access: Querying GitHub repositories, issues, and pull requests is permitted for reading.",
176
+ "if": {
177
+ "tool": [
178
+ "git_clone"
179
+ ],
180
+ "domains": {
181
+ "roles": [
182
+ "git-remote-url"
183
+ ],
184
+ "allowed": [
185
+ "github.com"
186
+ ]
187
+ }
188
+ },
189
+ "then": "allow",
190
+ "reason": "Constitution permits GitHub read access; cloning from GitHub is a read operation."
191
+ },
192
+ {
193
+ "name": "allow-git-stash-list",
194
+ "description": "Allow listing git stashes (read-only stash inspection with no write-history argument active).",
195
+ "principle": "The agent is allowed to read git log, status, diff, and branch information.",
196
+ "if": {
197
+ "roles": [
198
+ "read-path"
199
+ ],
200
+ "tool": [
201
+ "git_stash"
202
+ ]
203
+ },
204
+ "then": "allow",
205
+ "reason": "Stash listing is read-only; constitution permits read-only git inspection."
206
+ },
207
+ {
208
+ "name": "escalate-git-stash-mutations",
209
+ "description": "Escalate git stash push/pop/apply/drop operations that modify git state.",
210
+ "principle": "The agent must ask for approval before modifying git state.",
211
+ "if": {
212
+ "roles": [
213
+ "write-history"
214
+ ],
215
+ "tool": [
216
+ "git_stash"
217
+ ]
218
+ },
219
+ "then": "escalate",
220
+ "reason": "Stash push/pop operations modify git state and require human approval."
221
+ },
222
+ {
223
+ "name": "allow-git-clean-dry-run",
224
+ "description": "Allow git clean in dry-run mode (preview only, read-path role only, no delete-path active).",
225
+ "principle": "Read-only exploration: The agent may only observe and query.",
226
+ "if": {
227
+ "roles": [
228
+ "read-path"
229
+ ],
230
+ "tool": [
231
+ "git_clean"
232
+ ]
233
+ },
234
+ "then": "allow",
235
+ "reason": "git_clean dry-run only reads the working tree without deleting anything."
236
+ },
237
+ {
238
+ "name": "escalate-git-clean-actual",
239
+ "description": "Escalate git clean when it would actually delete files (delete-path role active).",
240
+ "principle": "No mutations: Any operation that creates, modifies, or deletes data must be escalated for human approval.",
241
+ "if": {
242
+ "roles": [
243
+ "delete-path"
244
+ ],
245
+ "tool": [
246
+ "git_clean"
247
+ ]
248
+ },
249
+ "then": "escalate",
250
+ "reason": "git_clean deletes untracked files from the working directory and requires human approval."
251
+ },
252
+ {
253
+ "name": "escalate-git-checkout",
254
+ "description": "Escalate git checkout operations that modify git state.",
255
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
256
+ "if": {
257
+ "tool": [
258
+ "git_checkout"
259
+ ]
260
+ },
261
+ "then": "escalate",
262
+ "reason": "git_checkout modifies git working tree state and requires human approval."
263
+ },
264
+ {
265
+ "name": "escalate-git-commit",
266
+ "description": "Escalate git commit operations that modify git history.",
267
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
268
+ "if": {
269
+ "tool": [
270
+ "git_commit"
271
+ ]
272
+ },
273
+ "then": "escalate",
274
+ "reason": "git_commit modifies git history and requires human approval."
275
+ },
276
+ {
277
+ "name": "escalate-git-merge",
278
+ "description": "Escalate git merge operations that modify git history.",
279
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
280
+ "if": {
281
+ "tool": [
282
+ "git_merge"
283
+ ]
284
+ },
285
+ "then": "escalate",
286
+ "reason": "git_merge modifies git history and requires human approval."
287
+ },
288
+ {
289
+ "name": "escalate-git-rebase",
290
+ "description": "Escalate git rebase operations that modify git history.",
291
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
292
+ "if": {
293
+ "tool": [
294
+ "git_rebase"
295
+ ]
296
+ },
297
+ "then": "escalate",
298
+ "reason": "git_rebase modifies git history and requires human approval."
299
+ },
300
+ {
301
+ "name": "escalate-git-reset",
302
+ "description": "Escalate git reset operations that modify git state.",
303
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
304
+ "if": {
305
+ "tool": [
306
+ "git_reset"
307
+ ]
308
+ },
309
+ "then": "escalate",
310
+ "reason": "git_reset modifies git state and requires human approval."
311
+ },
312
+ {
313
+ "name": "escalate-git-cherry-pick",
314
+ "description": "Escalate git cherry-pick operations that modify git history.",
315
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
316
+ "if": {
317
+ "tool": [
318
+ "git_cherry_pick"
319
+ ]
320
+ },
321
+ "then": "escalate",
322
+ "reason": "git_cherry_pick modifies git history and requires human approval."
323
+ },
324
+ {
325
+ "name": "escalate-git-pull",
326
+ "description": "Escalate git pull operations that modify git state.",
327
+ "principle": "The agent must ask for approval before modifying git state (commit, checkout, merge, rebase).",
328
+ "if": {
329
+ "tool": [
330
+ "git_pull"
331
+ ]
332
+ },
333
+ "then": "escalate",
334
+ "reason": "git_pull fetches and merges, modifying git state, and requires human approval."
335
+ },
336
+ {
337
+ "name": "escalate-git-push",
338
+ "description": "Escalate git push operations to GitHub for human approval.",
339
+ "principle": "The agent must ask for approval before any write, create, delete, or push operation.",
340
+ "if": {
341
+ "tool": [
342
+ "git_push"
343
+ ],
344
+ "domains": {
345
+ "roles": [
346
+ "git-remote-url"
347
+ ],
348
+ "allowed": [
349
+ "github.com"
350
+ ]
351
+ }
352
+ },
353
+ "then": "escalate",
354
+ "reason": "Constitution requires human approval before push operations even to GitHub."
355
+ },
356
+ {
357
+ "name": "escalate-git-add",
358
+ "description": "Escalate git add (staging files modifies git index state).",
359
+ "principle": "The agent must ask for approval before modifying git state.",
360
+ "if": {
361
+ "tool": [
362
+ "git_add"
363
+ ]
364
+ },
365
+ "then": "escalate",
366
+ "reason": "Staging files modifies the git index and requires human approval per the constitution."
367
+ },
368
+ {
369
+ "name": "escalate-git-tag",
370
+ "description": "Escalate git tag operations that create or delete tags.",
371
+ "principle": "The agent must ask for approval before modifying git state.",
372
+ "if": {
373
+ "tool": [
374
+ "git_tag"
375
+ ]
376
+ },
377
+ "then": "escalate",
378
+ "reason": "Creating or deleting tags modifies git state and requires human approval."
379
+ },
380
+ {
381
+ "name": "escalate-git-worktree",
382
+ "description": "Escalate git worktree operations that create or delete working trees.",
383
+ "principle": "No mutations: Any operation that creates, modifies, or deletes data must be escalated for human approval.",
384
+ "if": {
385
+ "tool": [
386
+ "git_worktree"
387
+ ]
388
+ },
389
+ "then": "escalate",
390
+ "reason": "git_worktree can create or delete working trees and requires human approval."
391
+ },
392
+ {
393
+ "name": "escalate-git-init",
394
+ "description": "Escalate git init that creates a new repository.",
395
+ "principle": "No mutations: Any operation that creates, modifies, or deletes data must be escalated for human approval.",
396
+ "if": {
397
+ "tool": [
398
+ "git_init"
399
+ ]
400
+ },
401
+ "then": "escalate",
402
+ "reason": "git_init creates a new git repository on disk and requires human approval."
403
+ },
404
+ {
405
+ "name": "allow-github-read-operations",
406
+ "description": "Allow read-only GitHub API operations: listing/reading issues, PRs, repos, commits, tags, releases, users, teams, and code search.",
407
+ "principle": "GitHub read access: Querying GitHub repositories, issues, and pull requests is permitted for reading.",
408
+ "if": {
409
+ "tool": [
410
+ "get_commit",
411
+ "get_file_contents",
412
+ "get_label",
413
+ "get_latest_release",
414
+ "get_me",
415
+ "get_release_by_tag",
416
+ "get_tag",
417
+ "get_team_members",
418
+ "get_teams",
419
+ "issue_read",
420
+ "list_branches",
421
+ "list_commits",
422
+ "list_issue_types",
423
+ "list_issues",
424
+ "list_pull_requests",
425
+ "list_releases",
426
+ "list_tags",
427
+ "pull_request_read",
428
+ "search_code",
429
+ "search_issues",
430
+ "search_pull_requests",
431
+ "search_repositories",
432
+ "search_users"
433
+ ]
434
+ },
435
+ "then": "allow",
436
+ "reason": "Constitution explicitly permits querying GitHub repositories, issues, and pull requests for reading."
437
+ },
438
+ {
439
+ "name": "escalate-github-write-operations",
440
+ "description": "Escalate all GitHub mutation operations for human approval.",
441
+ "principle": "No mutations: Any operation that creates, modifies, or deletes data must be escalated for human approval.",
442
+ "if": {
443
+ "tool": [
444
+ "add_comment_to_pending_review",
445
+ "add_issue_comment",
446
+ "add_reply_to_pull_request_comment",
447
+ "assign_copilot_to_issue",
448
+ "create_branch",
449
+ "create_or_update_file",
450
+ "create_pull_request",
451
+ "create_repository",
452
+ "delete_file",
453
+ "fork_repository",
454
+ "issue_write",
455
+ "merge_pull_request",
456
+ "pull_request_review_write",
457
+ "push_files",
458
+ "request_copilot_review",
459
+ "sub_issue_write",
460
+ "update_pull_request",
461
+ "update_pull_request_branch"
462
+ ]
463
+ },
464
+ "then": "escalate",
465
+ "reason": "Constitution requires human approval before any write, create, delete, or push operation on GitHub."
466
+ }
467
+ ]
468
+ }
@@ -22,6 +22,11 @@ export declare function getSessionSandboxDir(sessionId: string): string;
22
22
  * {home}/sessions/{sessionId}/escalations/
23
23
  */
24
24
  export declare function getSessionEscalationDir(sessionId: string): string;
25
+ /**
26
+ * Returns the session metadata path for a given session:
27
+ * {home}/sessions/{sessionId}/session-metadata.json
28
+ */
29
+ export declare function getSessionMetadataPath(sessionId: string): string;
25
30
  /**
26
31
  * Returns the audit log path for a given session:
27
32
  * {home}/sessions/{sessionId}/audit.jsonl
@@ -104,6 +109,18 @@ export declare function getBaseUserConstitutionPath(): string;
104
109
  * to the package-bundled defaults in dist/config/generated/.
105
110
  */
106
111
  export declare function getUserGeneratedDir(): string;
112
+ /**
113
+ * Returns the package-bundled read-only policy directory.
114
+ * Contains compiled-policy.json derived from constitution-readonly.md.
115
+ * This is always the package version -- not user-local.
116
+ */
117
+ export declare function getReadOnlyPolicyDir(): string;
118
+ /**
119
+ * Returns the package-bundled config directory.
120
+ * Used to validate that a policyDir is within a trusted location
121
+ * (either the user's IronCurtain home or the package config dir).
122
+ */
123
+ export declare function getPackageConfigDir(): string;
107
124
  /**
108
125
  * Loads the combined constitution text (base + optional user constitution).
109
126
  * If ~/.ironcurtain/constitution.md exists, it replaces the package-bundled base.
@@ -48,6 +48,13 @@ export function getSessionSandboxDir(sessionId) {
48
48
  export function getSessionEscalationDir(sessionId) {
49
49
  return resolve(getSessionDir(sessionId), 'escalations');
50
50
  }
51
+ /**
52
+ * Returns the session metadata path for a given session:
53
+ * {home}/sessions/{sessionId}/session-metadata.json
54
+ */
55
+ export function getSessionMetadataPath(sessionId) {
56
+ return resolve(getSessionDir(sessionId), 'session-metadata.json');
57
+ }
51
58
  /**
52
59
  * Returns the audit log path for a given session:
53
60
  * {home}/sessions/{sessionId}/audit.jsonl
@@ -163,6 +170,22 @@ export function getBaseUserConstitutionPath() {
163
170
  export function getUserGeneratedDir() {
164
171
  return resolve(getIronCurtainHome(), 'generated');
165
172
  }
173
+ /**
174
+ * Returns the package-bundled read-only policy directory.
175
+ * Contains compiled-policy.json derived from constitution-readonly.md.
176
+ * This is always the package version -- not user-local.
177
+ */
178
+ export function getReadOnlyPolicyDir() {
179
+ return resolve(__dirname, 'generated-readonly');
180
+ }
181
+ /**
182
+ * Returns the package-bundled config directory.
183
+ * Used to validate that a policyDir is within a trusted location
184
+ * (either the user's IronCurtain home or the package config dir).
185
+ */
186
+ export function getPackageConfigDir() {
187
+ return resolve(__dirname);
188
+ }
166
189
  /**
167
190
  * Loads the combined constitution text (base + optional user constitution).
168
191
  * If ~/.ironcurtain/constitution.md exists, it replaces the package-bundled base.
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/config/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,G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CAAC,KAAa;IACzC,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Constitution Generator -- uses an LLM with Code Mode access to
3
+ * MCP servers (under read-only policy) to generate a draft task
4
+ * constitution from a task description.
5
+ *
6
+ * The LLM explores MCP servers (read files, list dirs, check git,
7
+ * query GitHub) to understand the task context, then produces a
8
+ * structured constitution.
9
+ */
10
+ /** Result of constitution generation. */
11
+ export interface ConstitutionGenerationResult {
12
+ /** The generated constitution text. */
13
+ readonly constitution: string;
14
+ /** Summary of what the LLM discovered and why it chose these rules. */
15
+ readonly reasoning: string;
16
+ /** Tools/servers the LLM explored during generation. */
17
+ readonly exploredServers: readonly string[];
18
+ }
19
+ /**
20
+ * Controls the framing of the constitution generation prompt.
21
+ *
22
+ * - 'cron': unattended job, escalation effectively means block
23
+ * - 'persona': interactive session, escalation is valid for risky operations
24
+ */
25
+ export type GenerationContext = 'cron' | 'persona';
26
+ /** Options for constitution generation. */
27
+ export interface ConstitutionGeneratorOptions {
28
+ /** The task description to generate a constitution for. */
29
+ readonly taskDescription: string;
30
+ /** Path to the job workspace (for filesystem exploration). */
31
+ readonly workspacePath: string;
32
+ /** Optional git repo URI (included in context for the LLM). */
33
+ readonly gitRepo?: string;
34
+ /** Progress callback for spinner updates. */
35
+ readonly onProgress?: (message: string) => void;
36
+ /** Generation context: 'cron' (default) or 'persona'. */
37
+ readonly context?: GenerationContext;
38
+ }
39
+ /**
40
+ * Builds the system prompt augmentation for the constitution generator.
41
+ * This is appended to the standard Code Mode system prompt via
42
+ * SessionOptions.systemPromptAugmentation.
43
+ *
44
+ * @param context - Generation context: 'cron' for unattended jobs,
45
+ * 'persona' for interactive sessions. Defaults to 'cron'.
46
+ */
47
+ export declare function buildConstitutionGeneratorSystemPrompt(taskDescription: string, workspacePath: string, gitRepo?: string, context?: GenerationContext): string;
48
+ /**
49
+ * Extracts the constitution generation result from the LLM's response.
50
+ * Looks for a JSON block in the response text (in code fences or raw).
51
+ */
52
+ export declare function parseConstitutionResponse(response: string): ConstitutionGenerationResult;
53
+ /**
54
+ * Generates a draft constitution by running an LLM through Code Mode
55
+ * with a read-only policy. The LLM can explore MCP servers to
56
+ * understand the task context before writing policy.
57
+ *
58
+ * @returns The generated constitution and reasoning.
59
+ */
60
+ export declare function generateConstitution(options: ConstitutionGeneratorOptions): Promise<ConstitutionGenerationResult>;