brainclaw 0.29.2 → 1.5.3
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 +193 -170
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/cli.js +673 -24
- package/dist/commands/accept.js +3 -0
- package/dist/commands/add-step.js +11 -26
- package/dist/commands/agent-board.js +70 -3
- package/dist/commands/audit.js +19 -0
- package/dist/commands/check-policy.js +54 -0
- package/dist/commands/check-security-mcp.js +145 -0
- package/dist/commands/check-security.js +106 -0
- package/dist/commands/claim-resource.js +1 -0
- package/dist/commands/codev.js +672 -0
- package/dist/commands/compact.js +74 -0
- package/dist/commands/complete-step.js +16 -26
- package/dist/commands/constraint.js +8 -20
- package/dist/commands/decision.js +9 -20
- package/dist/commands/delete-plan.js +10 -12
- package/dist/commands/delete-step.js +16 -0
- package/dist/commands/dispatch.js +163 -0
- package/dist/commands/doctor.js +1122 -49
- package/dist/commands/enable-agent.js +1 -0
- package/dist/commands/export.js +280 -22
- package/dist/commands/handoff.js +33 -0
- package/dist/commands/harvest.js +189 -0
- package/dist/commands/hooks.js +82 -25
- package/dist/commands/inbox.js +169 -0
- package/dist/commands/init.js +38 -31
- package/dist/commands/install-hooks.js +71 -44
- package/dist/commands/link.js +89 -0
- package/dist/commands/list-claims.js +48 -3
- package/dist/commands/list-plans.js +129 -25
- package/dist/commands/loops-handlers.js +409 -0
- package/dist/commands/mcp-read-handlers.js +1628 -0
- package/dist/commands/mcp-schemas.generated.js +74 -0
- package/dist/commands/mcp.js +4221 -1501
- package/dist/commands/plan-resource.js +64 -0
- package/dist/commands/plan.js +12 -26
- package/dist/commands/prune.js +37 -2
- package/dist/commands/reflect.js +20 -7
- package/dist/commands/release-claim.js +11 -6
- package/dist/commands/release-notes.js +170 -0
- package/dist/commands/repair.js +210 -0
- package/dist/commands/run-profile.js +57 -0
- package/dist/commands/sequence.js +113 -0
- package/dist/commands/session-end.js +423 -14
- package/dist/commands/session-start.js +214 -41
- package/dist/commands/setup-security.js +103 -0
- package/dist/commands/setup.js +42 -4
- package/dist/commands/stale.js +109 -0
- package/dist/commands/switch.js +100 -2
- package/dist/commands/trap.js +14 -31
- package/dist/commands/update-handoff.js +63 -4
- package/dist/commands/update-plan.js +21 -28
- package/dist/commands/update-step.js +37 -0
- package/dist/commands/upgrade.js +313 -6
- package/dist/commands/usage.js +102 -0
- package/dist/commands/version.js +20 -0
- package/dist/commands/who.js +33 -5
- package/dist/commands/worktree.js +105 -0
- package/dist/core/actions.js +315 -0
- package/dist/core/agent-capability.js +610 -17
- package/dist/core/agent-context.js +7 -1
- package/dist/core/agent-files.js +1169 -85
- package/dist/core/agent-integrations.js +160 -5
- package/dist/core/agent-inventory.js +2 -0
- package/dist/core/agent-profiles.js +93 -0
- package/dist/core/agent-registry.js +162 -30
- package/dist/core/agentrun-reconciler.js +345 -0
- package/dist/core/agentruns.js +424 -0
- package/dist/core/ai-agent-detection.js +31 -10
- package/dist/core/archival.js +77 -0
- package/dist/core/assignment-sweeper.js +82 -0
- package/dist/core/assignments.js +367 -0
- package/dist/core/audit.js +30 -0
- package/dist/core/brainclaw-version.js +94 -2
- package/dist/core/candidates.js +93 -2
- package/dist/core/claims.js +419 -0
- package/dist/core/codev-metrics.js +77 -0
- package/dist/core/codev-personas.js +31 -0
- package/dist/core/codev-plan-gen.js +35 -0
- package/dist/core/codev-prompts.js +74 -0
- package/dist/core/codev-responses.js +62 -0
- package/dist/core/codev-rounds.js +218 -0
- package/dist/core/config.js +4 -0
- package/dist/core/context.js +381 -34
- package/dist/core/coordination.js +201 -6
- package/dist/core/cross-project.js +230 -16
- package/dist/core/default-profiles/doctor.yaml +11 -0
- package/dist/core/default-profiles/janitor.yaml +11 -0
- package/dist/core/default-profiles/onboarder.yaml +11 -0
- package/dist/core/default-profiles/reviewer.yaml +13 -0
- package/dist/core/dispatcher.js +1189 -0
- package/dist/core/duplicates.js +2 -2
- package/dist/core/entity-operations.js +450 -0
- package/dist/core/entity-registry.js +344 -0
- package/dist/core/events.js +106 -2
- package/dist/core/execution-adapters.js +154 -0
- package/dist/core/execution-context.js +63 -0
- package/dist/core/execution-profile.js +270 -0
- package/dist/core/execution.js +255 -0
- package/dist/core/facade-schema.js +81 -0
- package/dist/core/federation-cloud.js +99 -0
- package/dist/core/federation-message.js +52 -0
- package/dist/core/federation-transport.js +65 -0
- package/dist/core/gc-semantic.js +482 -0
- package/dist/core/governance.js +247 -0
- package/dist/core/guards.js +19 -0
- package/dist/core/ideation.js +72 -0
- package/dist/core/identity.js +110 -25
- package/dist/core/ids.js +6 -0
- package/dist/core/input-validation.js +2 -2
- package/dist/core/instruction-templates.js +344 -136
- package/dist/core/io.js +90 -11
- package/dist/core/lock.js +6 -2
- package/dist/core/loops/brief-assembly.js +213 -0
- package/dist/core/loops/facade-schema.js +148 -0
- package/dist/core/loops/index.js +7 -0
- package/dist/core/loops/iteration-engine.js +139 -0
- package/dist/core/loops/lock.js +385 -0
- package/dist/core/loops/store.js +201 -0
- package/dist/core/loops/types.js +403 -0
- package/dist/core/loops/verbs.js +534 -0
- package/dist/core/markdown.js +15 -3
- package/dist/core/memory-compactor.js +432 -0
- package/dist/core/memory-git.js +152 -8
- package/dist/core/messaging.js +278 -0
- package/dist/core/migration.js +32 -1
- package/dist/core/mutation-pipeline.js +4 -2
- package/dist/core/operations/memory-mutation.js +129 -0
- package/dist/core/operations/memory-write.js +78 -0
- package/dist/core/operations/plan.js +190 -0
- package/dist/core/policy.js +169 -0
- package/dist/core/reputation.js +9 -3
- package/dist/core/schema.js +491 -6
- package/dist/core/search.js +21 -2
- package/dist/core/security-cache.js +71 -0
- package/dist/core/security-guard.js +152 -0
- package/dist/core/security-scoring.js +86 -0
- package/dist/core/sequence.js +130 -0
- package/dist/core/socket-client.js +113 -0
- package/dist/core/staleness.js +246 -0
- package/dist/core/state.js +98 -22
- package/dist/core/store-resolution.js +43 -11
- package/dist/core/toml-writer.js +76 -0
- package/dist/core/upgrades/backup.js +232 -0
- package/dist/core/upgrades/health-check.js +169 -0
- package/dist/core/upgrades/patches/candidate-archive.js +145 -0
- package/dist/core/upgrades/patches/handoff-review-strip.js +128 -0
- package/dist/core/upgrades/patches/provenance-rollout.js +136 -0
- package/dist/core/upgrades/schema-version.js +97 -0
- package/dist/core/worktree.js +606 -0
- package/dist/facts.js +114 -0
- package/dist/facts.json +111 -0
- package/docs/architecture/project-refs.md +5 -1
- package/docs/cli.md +690 -43
- package/docs/concepts/ideation-loop.md +317 -0
- package/docs/concepts/loop-engine.md +456 -0
- package/docs/concepts/mcp-governance.md +268 -0
- package/docs/concepts/memory-staleness.md +122 -0
- package/docs/concepts/multi-agent-workflows.md +166 -0
- package/docs/concepts/plans-and-claims.md +31 -6
- package/docs/concepts/project-md-convention.md +35 -0
- package/docs/concepts/troubleshooting.md +220 -0
- package/docs/concepts/upgrade-cli.md +202 -0
- package/docs/concepts/upgrade-dogfood-procedure.md +114 -0
- package/docs/context-format-changelog.md +2 -2
- package/docs/context-format.md +2 -2
- package/docs/index.md +68 -0
- package/docs/integrations/agents.md +15 -16
- package/docs/integrations/cline.md +88 -0
- package/docs/integrations/codex.md +75 -23
- package/docs/integrations/continue.md +60 -0
- package/docs/integrations/copilot.md +67 -9
- package/docs/integrations/kilocode.md +72 -0
- package/docs/integrations/mcp.md +304 -21
- package/docs/integrations/mistral-vibe.md +122 -0
- package/docs/integrations/opencode.md +84 -0
- package/docs/integrations/overview.md +23 -8
- package/docs/integrations/roo.md +74 -0
- package/docs/integrations/windsurf.md +83 -0
- package/docs/mcp-schema-changelog.md +191 -1
- package/docs/playbooks/integration/index.md +121 -0
- package/docs/playbooks/productivity/index.md +102 -0
- package/docs/playbooks/team/index.md +122 -0
- package/docs/product/agent-first-model.md +184 -0
- package/docs/product/entity-model-audit.md +462 -0
- package/docs/quickstart-existing-project.md +135 -0
- package/docs/quickstart.md +124 -37
- package/docs/release-maintenance.md +79 -0
- package/docs/review.md +2 -0
- package/docs/server-operations.md +118 -0
- package/package.json +20 -12
- package/dist/commands/claude-desktop-extension.js +0 -18
- package/dist/commands/diff.js +0 -99
- package/dist/core/claude-desktop-extension.js +0 -224
package/dist/core/schema.js
CHANGED
|
@@ -62,11 +62,60 @@ export const ConstraintStatusSchema = z.enum(['active', 'resolved', 'expired']);
|
|
|
62
62
|
export const ConstraintCategorySchema = z.enum(['architecture', 'performance', 'security', 'reliability', 'compatibility', 'process', 'other']);
|
|
63
63
|
export const SeveritySchema = z.enum(['low', 'medium', 'high']);
|
|
64
64
|
export const TrapStatusSchema = z.enum(['active', 'resolved', 'expired']);
|
|
65
|
-
export const PrioritySchema = z.enum(['low', 'medium', 'high']);
|
|
65
|
+
export const PrioritySchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
66
66
|
export const MemoryVisibilitySchema = z.enum(['shared', 'machine', 'private']);
|
|
67
67
|
export const HandoffStatusSchema = z.enum(['open', 'accepted', 'closed']);
|
|
68
|
+
export const ReviewVerdictSchema = z.enum(['approve', 'request_changes']);
|
|
68
69
|
export const DecisionOutcomeSchema = z.enum(['approved', 'rejected', 'deferred', 'pending']);
|
|
69
70
|
export const MemoryScopeSchema = z.enum(['project', 'machine', 'user']).default('project');
|
|
71
|
+
/**
|
|
72
|
+
* Typed discriminated-union provenance (Phase 3 slice 3f, P6.3).
|
|
73
|
+
* Tracks how a record entered the store — drives read filters
|
|
74
|
+
* (default excludes `legacy` + low-confidence `auto_reflect`), audit
|
|
75
|
+
* narratives, and federation-safe federation behaviour.
|
|
76
|
+
*/
|
|
77
|
+
export const ProvenanceSchema = z.discriminatedUnion('kind', [
|
|
78
|
+
z.object({
|
|
79
|
+
kind: z.literal('agent'),
|
|
80
|
+
agent_id: z.string().optional(),
|
|
81
|
+
session_id: z.string().optional(),
|
|
82
|
+
}),
|
|
83
|
+
z.object({
|
|
84
|
+
kind: z.literal('auto_reflect'),
|
|
85
|
+
source_session: z.string().optional(),
|
|
86
|
+
confidence: z.number().min(0).max(1).optional(),
|
|
87
|
+
}),
|
|
88
|
+
z.object({
|
|
89
|
+
kind: z.literal('user'),
|
|
90
|
+
author: z.string().optional(),
|
|
91
|
+
}),
|
|
92
|
+
z.object({
|
|
93
|
+
kind: z.literal('loop_artifact'),
|
|
94
|
+
loop_id: z.string(),
|
|
95
|
+
slot: z.string().optional(),
|
|
96
|
+
turn: z.number().optional(),
|
|
97
|
+
}),
|
|
98
|
+
z.object({
|
|
99
|
+
kind: z.literal('federation'),
|
|
100
|
+
source_project: z.string(),
|
|
101
|
+
remote_id: z.string().optional(),
|
|
102
|
+
}),
|
|
103
|
+
z.object({
|
|
104
|
+
kind: z.literal('correction'),
|
|
105
|
+
supersedes: z.string(),
|
|
106
|
+
}),
|
|
107
|
+
z.object({
|
|
108
|
+
kind: z.literal('legacy'),
|
|
109
|
+
}),
|
|
110
|
+
]);
|
|
111
|
+
/**
|
|
112
|
+
* Legacy passthrough kept for backwards compatibility with records
|
|
113
|
+
* that predate slice 3f. Entity shapes carry this (permissive) rather
|
|
114
|
+
* than `ProvenanceSchema.optional()` so that existing files do not
|
|
115
|
+
* fail to parse. New writes go through `stampProvenance()` in
|
|
116
|
+
* entity-operations.ts which enforces the typed shape.
|
|
117
|
+
*/
|
|
118
|
+
export const ProvenancePassthroughSchema = z.unknown().optional();
|
|
70
119
|
export const ConstraintSchema = z.object({
|
|
71
120
|
schema_version: z.number().int().positive().optional(),
|
|
72
121
|
id: z.string(),
|
|
@@ -84,7 +133,9 @@ export const ConstraintSchema = z.object({
|
|
|
84
133
|
scope: MemoryScopeSchema.optional(),
|
|
85
134
|
tags: TagsSchema,
|
|
86
135
|
related_paths: z.array(z.string()).optional(),
|
|
136
|
+
plan_id: z.string().optional(),
|
|
87
137
|
expires_at: z.string().optional(),
|
|
138
|
+
provenance: ProvenancePassthroughSchema,
|
|
88
139
|
});
|
|
89
140
|
export const DecisionSchema = z.object({
|
|
90
141
|
schema_version: z.number().int().positive().optional(),
|
|
@@ -103,6 +154,7 @@ export const DecisionSchema = z.object({
|
|
|
103
154
|
related_paths: z.array(z.string()).optional(),
|
|
104
155
|
plan_id: z.string().optional(),
|
|
105
156
|
tags: TagsSchema,
|
|
157
|
+
provenance: ProvenancePassthroughSchema,
|
|
106
158
|
});
|
|
107
159
|
export const TrapSchema = z.object({
|
|
108
160
|
schema_version: z.number().int().positive().optional(),
|
|
@@ -125,6 +177,27 @@ export const TrapSchema = z.object({
|
|
|
125
177
|
host_id: z.string().optional(),
|
|
126
178
|
expires_at: z.string().optional(),
|
|
127
179
|
platform_scope: z.string().optional(),
|
|
180
|
+
provenance: ProvenancePassthroughSchema,
|
|
181
|
+
});
|
|
182
|
+
export const HandoffContractSchema = z.object({
|
|
183
|
+
files_touched: z.array(z.string()).optional(),
|
|
184
|
+
pre_conditions: z.array(z.string()).optional(),
|
|
185
|
+
post_conditions: z.array(z.string()).optional(),
|
|
186
|
+
tests_to_verify: z.array(z.string()).optional(),
|
|
187
|
+
linked_plans: z.array(z.string()).optional(),
|
|
188
|
+
});
|
|
189
|
+
export const HandoffReviewSchema = z.object({
|
|
190
|
+
requester: z.string().optional(),
|
|
191
|
+
reviewer: z.string().optional(),
|
|
192
|
+
requested_at: z.string().optional(),
|
|
193
|
+
thread_id: z.string().optional(),
|
|
194
|
+
message_id: z.string().optional(),
|
|
195
|
+
verdict: ReviewVerdictSchema.optional(),
|
|
196
|
+
reviewed_at: z.string().optional(),
|
|
197
|
+
reviewed_by: z.string().optional(),
|
|
198
|
+
summary: z.string().optional(),
|
|
199
|
+
blocking_issues: z.array(z.string()).optional(),
|
|
200
|
+
suggestions: z.array(z.string()).optional(),
|
|
128
201
|
});
|
|
129
202
|
export const HandoffSchema = z.object({
|
|
130
203
|
schema_version: z.number().int().positive().optional(),
|
|
@@ -143,11 +216,22 @@ export const HandoffSchema = z.object({
|
|
|
143
216
|
status: HandoffStatusSchema,
|
|
144
217
|
project: z.string().optional(),
|
|
145
218
|
plan_id: z.string().optional(),
|
|
219
|
+
narrative: z.string().optional(),
|
|
146
220
|
tags: TagsSchema,
|
|
147
221
|
related_paths: z.array(z.string()).optional(),
|
|
222
|
+
contract: HandoffContractSchema.optional(),
|
|
223
|
+
review: HandoffReviewSchema.optional(),
|
|
148
224
|
snapshot: z.object({
|
|
149
225
|
diff: z.string().optional(),
|
|
150
226
|
}).optional(),
|
|
227
|
+
provenance: ProvenancePassthroughSchema,
|
|
228
|
+
/**
|
|
229
|
+
* Tombstone pointer (P6.1). Present on correction handoffs that
|
|
230
|
+
* supersede an earlier, incorrect handoff. The original is left
|
|
231
|
+
* immutable; federation and history still carry both.
|
|
232
|
+
*/
|
|
233
|
+
superseded_by: z.string().optional(),
|
|
234
|
+
supersedes: z.string().optional(),
|
|
151
235
|
});
|
|
152
236
|
export const PlanStatusSchema = z.enum(['todo', 'in_progress', 'blocked', 'done', 'dropped']);
|
|
153
237
|
export const PlanStepStatusSchema = z.enum(['todo', 'in_progress', 'testing', 'done', 'blocked']);
|
|
@@ -183,6 +267,36 @@ export const PlanItemSchema = z.object({
|
|
|
183
267
|
started_at: z.string().optional(),
|
|
184
268
|
completed_at: z.string().optional(),
|
|
185
269
|
});
|
|
270
|
+
export const SequenceStatusSchema = z.enum(['draft', 'active', 'archived']);
|
|
271
|
+
export const SequenceItemSchema = z.object({
|
|
272
|
+
planId: z.string(),
|
|
273
|
+
stepId: z.string().optional(), // Reference a specific step within the plan
|
|
274
|
+
rank: z.number().int().positive(),
|
|
275
|
+
hard_after: z.array(z.string()).default([]),
|
|
276
|
+
soft_after: z.array(z.string()).default([]),
|
|
277
|
+
lane: z.string().optional(),
|
|
278
|
+
scope_hint: z.string().optional(),
|
|
279
|
+
rationale: z.string().optional(),
|
|
280
|
+
});
|
|
281
|
+
export const SequenceSchema = z.object({
|
|
282
|
+
schema_version: z.number().int().positive().optional(),
|
|
283
|
+
id: z.string(),
|
|
284
|
+
short_label: z.string().optional(),
|
|
285
|
+
name: z.string(),
|
|
286
|
+
description: z.string().optional(),
|
|
287
|
+
status: SequenceStatusSchema.default('draft'),
|
|
288
|
+
items: z.array(SequenceItemSchema).default([]),
|
|
289
|
+
owner: z.string().optional(),
|
|
290
|
+
created_at: z.string(),
|
|
291
|
+
updated_at: z.string(),
|
|
292
|
+
author: z.string(),
|
|
293
|
+
author_id: z.string().optional(),
|
|
294
|
+
model: z.string().optional(),
|
|
295
|
+
project_id: z.string().optional(),
|
|
296
|
+
host_id: z.string().optional(),
|
|
297
|
+
session_id: z.string().optional(),
|
|
298
|
+
tags: TagsSchema,
|
|
299
|
+
});
|
|
186
300
|
export const InstructionLayerSchema = z.enum(['global', 'project', 'agent']);
|
|
187
301
|
export const InstructionEntrySchema = z.object({
|
|
188
302
|
schema_version: z.number().int().positive().optional(),
|
|
@@ -237,6 +351,52 @@ export const ProjectToolSchema = z.object({
|
|
|
237
351
|
author_id: z.string().optional(),
|
|
238
352
|
model: z.string().optional(),
|
|
239
353
|
});
|
|
354
|
+
// --- Message schema (inter-agent inbox) ---
|
|
355
|
+
export const MessageTypeSchema = z.enum(['assign', 'review', 'rfc', 'info', 'reply']);
|
|
356
|
+
export const MessageStatusSchema = z.enum(['pending', 'read', 'acknowledged', 'archived']);
|
|
357
|
+
export const InboxMessageSchema = z.object({
|
|
358
|
+
schema_version: z.number().int().positive().optional(),
|
|
359
|
+
id: z.string(),
|
|
360
|
+
short_label: z.string().optional(),
|
|
361
|
+
/** Sender agent name */
|
|
362
|
+
from: z.string(),
|
|
363
|
+
/** Target agent name */
|
|
364
|
+
to: z.string(),
|
|
365
|
+
/** Message type: assign (work), review (feedback request), rfc (ideation), info (notification), reply (response in thread) */
|
|
366
|
+
type: MessageTypeSchema,
|
|
367
|
+
/** Human-readable message body */
|
|
368
|
+
text: z.string(),
|
|
369
|
+
/** Reference to a plan, sequence, handoff, or RFC thread */
|
|
370
|
+
ref: z.string().optional(),
|
|
371
|
+
/** Structured payload — brief, context, criteria, or any structured data */
|
|
372
|
+
payload: z.record(z.string(), z.unknown()).optional(),
|
|
373
|
+
/** File scope relevant to this message */
|
|
374
|
+
scope: z.string().optional(),
|
|
375
|
+
/** Whether the recipient must acknowledge */
|
|
376
|
+
requires_ack: z.boolean().default(false),
|
|
377
|
+
/** Thread ID for multi-turn conversations (RFC ideation, review rounds) */
|
|
378
|
+
thread_id: z.string().optional(),
|
|
379
|
+
/** Status tracking */
|
|
380
|
+
status: MessageStatusSchema.default('pending'),
|
|
381
|
+
/** When the message was read */
|
|
382
|
+
read_at: z.string().optional(),
|
|
383
|
+
/** When the message was acknowledged */
|
|
384
|
+
ack_at: z.string().optional(),
|
|
385
|
+
created_at: z.string(),
|
|
386
|
+
updated_at: z.string(),
|
|
387
|
+
author: z.string(),
|
|
388
|
+
author_id: z.string().optional(),
|
|
389
|
+
model: z.string().optional(),
|
|
390
|
+
project_id: z.string().optional(),
|
|
391
|
+
host_id: z.string().optional(),
|
|
392
|
+
session_id: z.string().optional(),
|
|
393
|
+
/** Top-level claim_id for dispatch routing. Instances filter their inbox by this field.
|
|
394
|
+
* Also present in payload.claim_id for backward compat — this top-level field is authoritative. */
|
|
395
|
+
claim_id: z.string().optional(),
|
|
396
|
+
/** Top-level assignment_id for Agent SDK protocol. Enables filtering/display without parsing payload. */
|
|
397
|
+
assignment_id: z.string().optional(),
|
|
398
|
+
tags: TagsWithDefaultSchema,
|
|
399
|
+
});
|
|
240
400
|
// --- State schema ---
|
|
241
401
|
export const StateSchema = z.object({
|
|
242
402
|
version: z.literal(1),
|
|
@@ -252,10 +412,35 @@ export const RedactionConfigSchema = z.object({
|
|
|
252
412
|
enabled: z.boolean(),
|
|
253
413
|
patterns: z.array(z.string()),
|
|
254
414
|
});
|
|
415
|
+
export const PreinstallThresholdsSchema = z.object({
|
|
416
|
+
composite_pass: z.number().min(0).max(100).default(70),
|
|
417
|
+
composite_warn: z.number().min(0).max(100).default(50),
|
|
418
|
+
supply_chain_block: z.number().min(0).max(100).default(30),
|
|
419
|
+
vulnerability_block: z.number().min(0).max(100).default(20),
|
|
420
|
+
});
|
|
421
|
+
export const PreinstallWeightsSchema = z.object({
|
|
422
|
+
supply_chain: z.number().min(0).max(1).default(0.35),
|
|
423
|
+
vulnerability: z.number().min(0).max(1).default(0.30),
|
|
424
|
+
quality: z.number().min(0).max(1).default(0.15),
|
|
425
|
+
maintenance: z.number().min(0).max(1).default(0.15),
|
|
426
|
+
license: z.number().min(0).max(1).default(0.05),
|
|
427
|
+
});
|
|
428
|
+
export const PreinstallConfigSchema = z.object({
|
|
429
|
+
enabled: z.boolean().default(false),
|
|
430
|
+
mode: z.enum(['advisory', 'enforced']).default('advisory'),
|
|
431
|
+
thresholds: PreinstallThresholdsSchema.prefault({}),
|
|
432
|
+
weights: PreinstallWeightsSchema.prefault({}),
|
|
433
|
+
cache_ttl_hours: z.number().positive().default(24),
|
|
434
|
+
fallback_on_error: z.enum(['warn', 'pass', 'block']).default('warn'),
|
|
435
|
+
allowlist: z.array(z.string()).default([]),
|
|
436
|
+
denylist: z.array(z.string()).default([]),
|
|
437
|
+
socket_endpoint: z.string().default('https://mcp.socket.dev/'),
|
|
438
|
+
});
|
|
255
439
|
export const SecurityConfigSchema = z.object({
|
|
256
440
|
mode: z.enum(['warn', 'strict']).default('warn'),
|
|
257
441
|
strict_redaction: z.boolean().default(false),
|
|
258
442
|
block_sensitive_paths: z.boolean().default(true),
|
|
443
|
+
preinstall: PreinstallConfigSchema.optional(),
|
|
259
444
|
});
|
|
260
445
|
export const MarkdownConfigSchema = z.object({
|
|
261
446
|
max_items_per_section: z.number().default(20),
|
|
@@ -265,6 +450,8 @@ export const MarkdownConfigSchema = z.object({
|
|
|
265
450
|
export const CandidateTypeSchema = z.enum([
|
|
266
451
|
'constraint', 'decision', 'trap', 'handoff',
|
|
267
452
|
]);
|
|
453
|
+
/** Who originated this candidate. 'auto' = session-end auto-reflect; 'agent' = intentional agent action; 'human' = human-created or unknown legacy item. */
|
|
454
|
+
export const CandidateSourceSchema = z.enum(['auto', 'agent', 'human']);
|
|
268
455
|
export const CandidateStatusSchema = z.enum(['pending', 'accepted', 'rejected']);
|
|
269
456
|
export const CandidateUseSchema = z.object({
|
|
270
457
|
by: z.string(),
|
|
@@ -281,7 +468,28 @@ export const CandidateContradictionSchema = z.object({
|
|
|
281
468
|
score: z.number(),
|
|
282
469
|
kind: z.string(),
|
|
283
470
|
});
|
|
284
|
-
|
|
471
|
+
/** Legacy candidates stored `source` as free-text (e.g. 'session-end:git-diff:sess_xxx',
|
|
472
|
+
* 'runtime-note:agent:id'). Worker 2 narrowed `source` to an enum. To preserve
|
|
473
|
+
* provenance without rewriting files, we migrate free-text values to `origin`
|
|
474
|
+
* on read via this preprocess. Files are NOT rewritten — preprocess only
|
|
475
|
+
* affects parsed in-memory values. */
|
|
476
|
+
const CANDIDATE_SOURCE_ENUM = new Set(['auto', 'agent', 'human']);
|
|
477
|
+
const candidatePreprocess = (raw) => {
|
|
478
|
+
if (!raw || typeof raw !== 'object')
|
|
479
|
+
return raw;
|
|
480
|
+
const obj = raw;
|
|
481
|
+
const src = obj.source;
|
|
482
|
+
if (typeof src === 'string' && !CANDIDATE_SOURCE_ENUM.has(src)) {
|
|
483
|
+
// Free-text source → preserve into origin (if not already set), drop from source.
|
|
484
|
+
const clone = { ...obj };
|
|
485
|
+
if (clone.origin === undefined)
|
|
486
|
+
clone.origin = src;
|
|
487
|
+
clone.source = undefined;
|
|
488
|
+
return clone;
|
|
489
|
+
}
|
|
490
|
+
return raw;
|
|
491
|
+
};
|
|
492
|
+
export const CandidateSchema = z.preprocess(candidatePreprocess, z.object({
|
|
285
493
|
schema_version: z.number().int().positive().optional(),
|
|
286
494
|
id: z.string(),
|
|
287
495
|
short_label: z.string().optional(),
|
|
@@ -294,7 +502,14 @@ export const CandidateSchema = z.object({
|
|
|
294
502
|
project_id: z.string().optional(),
|
|
295
503
|
host_id: z.string().optional(),
|
|
296
504
|
session_id: z.string().optional(),
|
|
297
|
-
|
|
505
|
+
/** Normalized category of the originator. Missing field / unknown legacy value
|
|
506
|
+
* falls back to `origin`-based inference, then to 'human'. */
|
|
507
|
+
source: CandidateSourceSchema.optional().catch(undefined),
|
|
508
|
+
/** Free-text provenance string preserved for reputation/audit. Examples:
|
|
509
|
+
* 'session-end:git-diff:sess_xxx', 'runtime-note:<agent>:<note_id>',
|
|
510
|
+
* 'mcp:quick-capture', 'cross-project:<project>'. Used alongside `source`
|
|
511
|
+
* (which is the enum); not narrowed by Zod. */
|
|
512
|
+
origin: z.string().optional(),
|
|
298
513
|
tags: TagsSchema,
|
|
299
514
|
status: CandidateStatusSchema,
|
|
300
515
|
// type-specific optional fields
|
|
@@ -309,13 +524,15 @@ export const CandidateSchema = z.object({
|
|
|
309
524
|
usage_events: z.array(CandidateUseSchema).default([]),
|
|
310
525
|
last_used_at: z.string().optional(),
|
|
311
526
|
plan_id: z.string().optional(),
|
|
527
|
+
narrative: z.string().optional(),
|
|
312
528
|
contradictions_detected: z.array(CandidateContradictionSchema).optional(),
|
|
313
529
|
contradiction_summary: z.string().optional(),
|
|
314
530
|
promotion_blocked_reason: z.string().optional(),
|
|
315
531
|
resolved_at: z.string().optional(),
|
|
316
532
|
resolved_by: z.string().optional(),
|
|
317
533
|
resolution_reason: z.string().optional(),
|
|
318
|
-
|
|
534
|
+
provenance: ProvenancePassthroughSchema,
|
|
535
|
+
}));
|
|
319
536
|
export const ReflectiveMemoryConfigSchema = z.object({
|
|
320
537
|
enabled: z.boolean().default(true),
|
|
321
538
|
auto_accept: z.boolean().default(false),
|
|
@@ -343,6 +560,7 @@ export const ReputationConfigSchema = z.object({
|
|
|
343
560
|
});
|
|
344
561
|
// --- Work claims schemas ---
|
|
345
562
|
export const ClaimStatusSchema = z.enum(['active', 'released', 'stale']);
|
|
563
|
+
export const ClaimHandoffModeSchema = z.enum(['self-commit', 'integrator']);
|
|
346
564
|
export const ClaimSchema = z.object({
|
|
347
565
|
schema_version: z.number().int().positive().optional(),
|
|
348
566
|
id: z.string(),
|
|
@@ -362,6 +580,178 @@ export const ClaimSchema = z.object({
|
|
|
362
580
|
released_at: z.string().optional(),
|
|
363
581
|
expires_at: z.string().optional(),
|
|
364
582
|
model: z.string().optional(),
|
|
583
|
+
/** Absolute path to the git worktree associated with this claim, if one was created. */
|
|
584
|
+
worktree_path: z.string().optional(),
|
|
585
|
+
/** Handoff mode: "self-commit" = worker commits+merges, "integrator" = another agent reviews+merges. */
|
|
586
|
+
handoff_mode: ClaimHandoffModeSchema.optional(),
|
|
587
|
+
/** ISO timestamp when a spawned instance adopted this claim via session_start. */
|
|
588
|
+
adopted_at: z.string().optional(),
|
|
589
|
+
/** Message ID of the dispatch assignment that created this claim. For tracing claim→message→instance. */
|
|
590
|
+
assignment_message_id: z.string().optional(),
|
|
591
|
+
/** Assignment ID from the Agent SDK runtime protocol. Links claim to its Assignment lifecycle entity. */
|
|
592
|
+
assignment_id: z.string().optional(),
|
|
593
|
+
});
|
|
594
|
+
// --- Assignment schemas (Agent SDK runtime protocol) ---
|
|
595
|
+
export const AssignmentStatusSchema = z.enum([
|
|
596
|
+
'created', // Record exists, not yet offered to agent
|
|
597
|
+
'offered', // Brief delivered to agent inbox
|
|
598
|
+
'accepted', // Worker acknowledged receipt
|
|
599
|
+
'started', // Worker reports active work begun
|
|
600
|
+
'completed', // Worker reports successful completion
|
|
601
|
+
'failed', // Worker reports failure
|
|
602
|
+
'blocked', // Worker reports external blocker
|
|
603
|
+
'timed_out', // Sweeper detected no heartbeat within TTL
|
|
604
|
+
'expired', // Offered but never accepted within TTL
|
|
605
|
+
'retrying', // Failed/timed-out assignment being requeued
|
|
606
|
+
'rerouted', // Blocked assignment rerouted to different agent
|
|
607
|
+
]);
|
|
608
|
+
export const AssignmentArtifactSchema = z.object({
|
|
609
|
+
type: z.string(),
|
|
610
|
+
ref: z.string(),
|
|
611
|
+
description: z.string().optional(),
|
|
612
|
+
});
|
|
613
|
+
export const AssignmentSchema = z.object({
|
|
614
|
+
schema_version: z.number().int().positive().optional(),
|
|
615
|
+
id: z.string(),
|
|
616
|
+
short_label: z.string().optional(),
|
|
617
|
+
// Cross-references (links, not replacement)
|
|
618
|
+
claim_id: z.string(),
|
|
619
|
+
message_id: z.string().optional(),
|
|
620
|
+
plan_id: z.string().optional(),
|
|
621
|
+
sequence_id: z.string().optional(),
|
|
622
|
+
/** For retry chains: original assignment_id. */
|
|
623
|
+
correlation_id: z.string().optional(),
|
|
624
|
+
// Actors
|
|
625
|
+
agent: z.string(),
|
|
626
|
+
agent_id: z.string().optional(),
|
|
627
|
+
session_id: z.string().optional(),
|
|
628
|
+
dispatcher_agent: z.string(),
|
|
629
|
+
dispatcher_session_id: z.string().optional(),
|
|
630
|
+
// Task metadata
|
|
631
|
+
scope: z.string(),
|
|
632
|
+
description: z.string(),
|
|
633
|
+
lane: z.string().optional(),
|
|
634
|
+
worktree_path: z.string().optional(),
|
|
635
|
+
// Status FSM
|
|
636
|
+
status: AssignmentStatusSchema,
|
|
637
|
+
status_reason: z.string().optional(),
|
|
638
|
+
// Timestamps
|
|
639
|
+
created_at: z.string(),
|
|
640
|
+
updated_at: z.string().optional(),
|
|
641
|
+
offered_at: z.string().optional(),
|
|
642
|
+
accepted_at: z.string().optional(),
|
|
643
|
+
started_at: z.string().optional(),
|
|
644
|
+
completed_at: z.string().optional(),
|
|
645
|
+
failed_at: z.string().optional(),
|
|
646
|
+
blocked_at: z.string().optional(),
|
|
647
|
+
timed_out_at: z.string().optional(),
|
|
648
|
+
expired_at: z.string().optional(),
|
|
649
|
+
rerouted_at: z.string().optional(),
|
|
650
|
+
last_heartbeat_at: z.string().optional(),
|
|
651
|
+
// Result
|
|
652
|
+
artifacts: z.array(AssignmentArtifactSchema).default([]),
|
|
653
|
+
error_message: z.string().optional(),
|
|
654
|
+
retry_count: z.number().int().default(0),
|
|
655
|
+
max_retries: z.number().int().default(2),
|
|
656
|
+
// Timeout config (ms)
|
|
657
|
+
heartbeat_ttl_ms: z.number().int().default(30 * 60_000), // 30 min
|
|
658
|
+
acceptance_ttl_ms: z.number().int().default(15 * 60_000), // 15 min
|
|
659
|
+
tags: TagsWithDefaultSchema,
|
|
660
|
+
});
|
|
661
|
+
// --- AgentRun schemas (execution-layer runtime state) ---
|
|
662
|
+
export const AgentRunTransportSchema = z.enum([
|
|
663
|
+
'cli_spawn',
|
|
664
|
+
'manual_command',
|
|
665
|
+
'inbox_only',
|
|
666
|
+
]);
|
|
667
|
+
export const AgentRunStatusSchema = z.enum([
|
|
668
|
+
'created',
|
|
669
|
+
'launching',
|
|
670
|
+
'waiting_input',
|
|
671
|
+
'running',
|
|
672
|
+
'blocked',
|
|
673
|
+
'completed',
|
|
674
|
+
'failed',
|
|
675
|
+
'cancelled',
|
|
676
|
+
'timed_out',
|
|
677
|
+
'interrupted',
|
|
678
|
+
]);
|
|
679
|
+
export const AgentRunSchema = z.object({
|
|
680
|
+
schema_version: z.number().int().positive().optional(),
|
|
681
|
+
id: z.string(),
|
|
682
|
+
short_label: z.string().optional(),
|
|
683
|
+
assignment_id: z.string(),
|
|
684
|
+
claim_id: z.string(),
|
|
685
|
+
message_id: z.string().optional(),
|
|
686
|
+
plan_id: z.string().optional(),
|
|
687
|
+
sequence_id: z.string().optional(),
|
|
688
|
+
retry_of_run_id: z.string().optional(),
|
|
689
|
+
attempt_index: z.number().int().positive().default(1),
|
|
690
|
+
agent: z.string(),
|
|
691
|
+
agent_id: z.string().optional(),
|
|
692
|
+
session_id: z.string().optional(),
|
|
693
|
+
transport: AgentRunTransportSchema,
|
|
694
|
+
status: AgentRunStatusSchema,
|
|
695
|
+
status_reason: z.string().optional(),
|
|
696
|
+
scope: z.string(),
|
|
697
|
+
description: z.string(),
|
|
698
|
+
worktree_path: z.string().optional(),
|
|
699
|
+
command: z.string().optional(),
|
|
700
|
+
shell: z.string().optional(),
|
|
701
|
+
pid: z.number().int().positive().optional(),
|
|
702
|
+
provider_run_id: z.string().optional(),
|
|
703
|
+
created_at: z.string(),
|
|
704
|
+
updated_at: z.string().optional(),
|
|
705
|
+
launched_at: z.string().optional(),
|
|
706
|
+
started_at: z.string().optional(),
|
|
707
|
+
blocked_at: z.string().optional(),
|
|
708
|
+
completed_at: z.string().optional(),
|
|
709
|
+
failed_at: z.string().optional(),
|
|
710
|
+
cancelled_at: z.string().optional(),
|
|
711
|
+
timed_out_at: z.string().optional(),
|
|
712
|
+
interrupted_at: z.string().optional(),
|
|
713
|
+
last_event_at: z.string().optional(),
|
|
714
|
+
artifacts: z.array(AssignmentArtifactSchema).default([]),
|
|
715
|
+
error_message: z.string().optional(),
|
|
716
|
+
tags: TagsWithDefaultSchema,
|
|
717
|
+
});
|
|
718
|
+
// --- ActionRequired schema (runtime pause/resume) ---
|
|
719
|
+
export const ActionRequiredKindSchema = z.enum(['approval', 'user_input', 'clarification', 'plan_approval']);
|
|
720
|
+
export const ActionRequiredStatusSchema = z.enum(['pending', 'resolved', 'rejected', 'cancelled', 'expired']);
|
|
721
|
+
export const ActionRequiredResponseSchema = z.object({
|
|
722
|
+
outcome: z.enum(['resolved', 'rejected', 'cancelled']),
|
|
723
|
+
text: z.string().optional(),
|
|
724
|
+
payload: z.record(z.string(), z.unknown()).optional(),
|
|
725
|
+
responded_by: z.string(),
|
|
726
|
+
responded_by_id: z.string().optional(),
|
|
727
|
+
responded_at: z.string(),
|
|
728
|
+
});
|
|
729
|
+
export const ActionRequiredSchema = z.object({
|
|
730
|
+
schema_version: z.number().int().positive().optional(),
|
|
731
|
+
id: z.string(),
|
|
732
|
+
short_label: z.string().optional(),
|
|
733
|
+
assignment_id: z.string(),
|
|
734
|
+
run_id: z.string().optional(),
|
|
735
|
+
claim_id: z.string().optional(),
|
|
736
|
+
message_id: z.string().optional(),
|
|
737
|
+
plan_id: z.string().optional(),
|
|
738
|
+
sequence_id: z.string().optional(),
|
|
739
|
+
agent: z.string(),
|
|
740
|
+
agent_id: z.string().optional(),
|
|
741
|
+
session_id: z.string().optional(),
|
|
742
|
+
kind: ActionRequiredKindSchema,
|
|
743
|
+
status: ActionRequiredStatusSchema.default('pending'),
|
|
744
|
+
scope: z.string().optional(),
|
|
745
|
+
title: z.string(),
|
|
746
|
+
prompt: z.string(),
|
|
747
|
+
options: z.array(z.string()).default([]),
|
|
748
|
+
response_schema: z.record(z.string(), z.unknown()).optional(),
|
|
749
|
+
created_at: z.string(),
|
|
750
|
+
updated_at: z.string(),
|
|
751
|
+
expires_at: z.string().optional(),
|
|
752
|
+
resolved_at: z.string().optional(),
|
|
753
|
+
response: ActionRequiredResponseSchema.optional(),
|
|
754
|
+
tags: TagsWithDefaultSchema,
|
|
365
755
|
});
|
|
366
756
|
// --- Runtime notes schemas ---
|
|
367
757
|
export const RuntimeNoteSchema = z.object({
|
|
@@ -381,6 +771,7 @@ export const RuntimeNoteSchema = z.object({
|
|
|
381
771
|
expires_at: z.string().optional(),
|
|
382
772
|
note_type: z.enum(['observation', 'session_start', 'session_end']).default('observation'),
|
|
383
773
|
model: z.string().optional(),
|
|
774
|
+
provenance: ProvenancePassthroughSchema,
|
|
384
775
|
});
|
|
385
776
|
// --- AI surface task request schemas ---
|
|
386
777
|
export const AiSurfaceTaskStatusSchema = z.enum(['queued', 'in_progress', 'completed', 'cancelled', 'failed']);
|
|
@@ -417,6 +808,30 @@ export const RuntimeEventTypeSchema = z.enum([
|
|
|
417
808
|
'task_finished',
|
|
418
809
|
'session_start',
|
|
419
810
|
'session_end',
|
|
811
|
+
'assignment_created',
|
|
812
|
+
'assignment_offered',
|
|
813
|
+
'assignment_accepted',
|
|
814
|
+
'assignment_started',
|
|
815
|
+
'assignment_progress',
|
|
816
|
+
'assignment_completed',
|
|
817
|
+
'assignment_failed',
|
|
818
|
+
'assignment_blocked',
|
|
819
|
+
'assignment_timed_out',
|
|
820
|
+
'assignment_expired',
|
|
821
|
+
'assignment_retrying',
|
|
822
|
+
'assignment_rerouted',
|
|
823
|
+
'run_created',
|
|
824
|
+
'run_launching',
|
|
825
|
+
'run_waiting_input',
|
|
826
|
+
'run_running',
|
|
827
|
+
'run_blocked',
|
|
828
|
+
'run_completed',
|
|
829
|
+
'run_failed',
|
|
830
|
+
'run_cancelled',
|
|
831
|
+
'run_timed_out',
|
|
832
|
+
'run_interrupted',
|
|
833
|
+
'plan_cascade_to_done',
|
|
834
|
+
'candidate_harvested',
|
|
420
835
|
]);
|
|
421
836
|
export const RuntimeEventSchema = z.object({
|
|
422
837
|
id: z.string(),
|
|
@@ -429,13 +844,24 @@ export const RuntimeEventSchema = z.object({
|
|
|
429
844
|
created_at: z.string(),
|
|
430
845
|
text: z.string(),
|
|
431
846
|
tags: TagsWithDefaultSchema,
|
|
847
|
+
assignment_id: z.string().optional(),
|
|
848
|
+
run_id: z.string().optional(),
|
|
849
|
+
claim_id: z.string().optional(),
|
|
850
|
+
message_id: z.string().optional(),
|
|
851
|
+
plan_id: z.string().optional(),
|
|
852
|
+
sequence_id: z.string().optional(),
|
|
853
|
+
correlation_id: z.string().optional(),
|
|
854
|
+
scope: z.string().optional(),
|
|
855
|
+
transport: z.enum(['cli_spawn', 'manual_command', 'inbox_only']).optional(),
|
|
856
|
+
status: z.string().optional(),
|
|
857
|
+
status_reason: z.string().optional(),
|
|
432
858
|
// Optional routing and type hints for candidate generation
|
|
433
859
|
candidate_type: CandidateTypeSchema.optional(),
|
|
434
860
|
severity: SeveritySchema.optional(),
|
|
435
861
|
from: z.string().optional(),
|
|
436
862
|
to: z.string().optional(),
|
|
437
863
|
related_paths: z.array(z.string()).optional(),
|
|
438
|
-
metadata: z.record(z.unknown()).optional(),
|
|
864
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
439
865
|
model: z.string().optional(),
|
|
440
866
|
});
|
|
441
867
|
// --- Profile schema ---
|
|
@@ -461,6 +887,28 @@ export const ProjectIdentityDocumentSchema = z.object({
|
|
|
461
887
|
storage_dir: z.string(),
|
|
462
888
|
topology: TopologyModeSchema,
|
|
463
889
|
});
|
|
890
|
+
// --- Agent profile schemas ---
|
|
891
|
+
export const AgentProfileTriggerSchema = z.enum(['manual', 'schedule', 'memory_pressure']);
|
|
892
|
+
export const AgentProfileSchema = z.object({
|
|
893
|
+
name: z.string().min(1),
|
|
894
|
+
description: z.string().min(1),
|
|
895
|
+
trust_level: AgentTrustLevelSchema.default('contributor'),
|
|
896
|
+
trigger: AgentProfileTriggerSchema.default('manual'),
|
|
897
|
+
scope: z.string().optional(),
|
|
898
|
+
prompt: z.string().min(1),
|
|
899
|
+
invoke: z.string().min(1),
|
|
900
|
+
tags: TagsWithDefaultSchema,
|
|
901
|
+
});
|
|
902
|
+
export const AgentInvokeSchema = z.object({
|
|
903
|
+
/** CLI command template with {prompt} and {cwd} placeholders */
|
|
904
|
+
command: z.string(),
|
|
905
|
+
/** Delivery channel: spawn (launch CLI process) or inbox (deposit message) */
|
|
906
|
+
channel: z.enum(['spawn', 'inbox']).default('spawn'),
|
|
907
|
+
/** Max execution time in seconds (default: 600 = 10min) */
|
|
908
|
+
timeout: z.number().int().positive().default(600),
|
|
909
|
+
/** Environment variables to set when spawning */
|
|
910
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
911
|
+
}).strict();
|
|
464
912
|
export const AgentIdentityDocumentSchema = z.object({
|
|
465
913
|
schema_version: z.number().int().positive().optional(),
|
|
466
914
|
version: z.literal(1),
|
|
@@ -472,6 +920,9 @@ export const AgentIdentityDocumentSchema = z.object({
|
|
|
472
920
|
capabilities: z.array(z.string()).default([]),
|
|
473
921
|
identity_key: AgentIdentityKeySchema.optional(),
|
|
474
922
|
model: z.string().optional(),
|
|
923
|
+
context_profile: z.enum(['dev', 'dense', 'compact', 'copilot', 'quick', 'openclaw', 'ops', 'research']).optional(),
|
|
924
|
+
/** CLI invoke template for autonomous spawning by coordinator agents */
|
|
925
|
+
invoke: AgentInvokeSchema.optional(),
|
|
475
926
|
});
|
|
476
927
|
export const ProjectsConfigSchema = z.object({
|
|
477
928
|
strategy: ProjectStrategySchema.default('manual'),
|
|
@@ -502,6 +953,7 @@ export const SessionActiveProjectSchema = z.object({
|
|
|
502
953
|
/** ISO timestamp of the switch. */
|
|
503
954
|
switched_at: z.string(),
|
|
504
955
|
}).strict();
|
|
956
|
+
export const IsolationModeSchema = z.enum(['shared-checkout', 'dedicated-worktree']);
|
|
505
957
|
export const CurrentSessionStateSchema = z.object({
|
|
506
958
|
schema_version: z.number().int().positive().optional(),
|
|
507
959
|
session_id: z.string(),
|
|
@@ -514,8 +966,16 @@ export const CurrentSessionStateSchema = z.object({
|
|
|
514
966
|
user: z.string().optional(),
|
|
515
967
|
/** Process ID of the agent process (for liveness detection). */
|
|
516
968
|
pid: z.number().int().positive().optional(),
|
|
969
|
+
/** LLM model used in this session (e.g. "claude-opus-4-6", "gpt-4.1"). */
|
|
970
|
+
model: z.string().optional(),
|
|
517
971
|
/** Session-scoped active project (overrides global active-project.json). */
|
|
518
972
|
active_project: SessionActiveProjectSchema.optional(),
|
|
973
|
+
/** Git worktree path for this session (undefined = main worktree / shared checkout). */
|
|
974
|
+
worktree_path: z.string().optional(),
|
|
975
|
+
/** Git branch this session is working on. */
|
|
976
|
+
branch: z.string().optional(),
|
|
977
|
+
/** Isolation mode: shared-checkout (default) or dedicated-worktree. */
|
|
978
|
+
isolation_mode: IsolationModeSchema.optional(),
|
|
519
979
|
});
|
|
520
980
|
export const MemorySeedKindSchema = z.enum([
|
|
521
981
|
'command',
|
|
@@ -677,13 +1137,14 @@ export const AgentIntegrationNameSchema = z.enum([
|
|
|
677
1137
|
'antigravity',
|
|
678
1138
|
'continue',
|
|
679
1139
|
'roo',
|
|
1140
|
+
'kilocode',
|
|
680
1141
|
'openclaw',
|
|
681
1142
|
'nanoclaw',
|
|
682
1143
|
'nemoclaw',
|
|
683
1144
|
'picoclaw',
|
|
684
1145
|
'zeroclaw',
|
|
685
1146
|
]);
|
|
686
|
-
export const AgentIntegrationSurfaceKindSchema = z.enum(['instructions', 'mcp', 'skill', 'rule', 'hook']);
|
|
1147
|
+
export const AgentIntegrationSurfaceKindSchema = z.enum(['instructions', 'mcp', 'skill', 'rule', 'hook', 'permissions']);
|
|
687
1148
|
export const AgentIntegrationLocationSchema = z.enum(['workspace', 'machine']);
|
|
688
1149
|
export const AgentIntegrationDeclarationSourceSchema = z.enum(['manual', 'detected']);
|
|
689
1150
|
export const AgentIntegrationSurfaceSchema = z.object({
|
|
@@ -706,6 +1167,7 @@ export const CrossProjectLinkSchema = z.object({
|
|
|
706
1167
|
path: z.string(),
|
|
707
1168
|
name: z.string().optional(),
|
|
708
1169
|
role: z.enum(['subscriber', 'publisher']).default('subscriber'),
|
|
1170
|
+
channels: z.array(z.string()).optional(),
|
|
709
1171
|
});
|
|
710
1172
|
export const BrainclawUpdateSourceLocalPackSchema = z.object({
|
|
711
1173
|
type: z.literal('local-pack'),
|
|
@@ -720,6 +1182,20 @@ export const BrainclawUpdateSourceSchema = z.discriminatedUnion('type', [
|
|
|
720
1182
|
BrainclawUpdateSourceLocalPackSchema,
|
|
721
1183
|
BrainclawUpdateSourceNpmSchema,
|
|
722
1184
|
]);
|
|
1185
|
+
export const AgentReleaseNotesSchema = z.object({
|
|
1186
|
+
/** One-line summary an agent can surface directly to the operator. */
|
|
1187
|
+
summary: z.string().min(1),
|
|
1188
|
+
/** Concrete impact on agent workflows: new MCP tools, changed behaviour, removed commands. */
|
|
1189
|
+
agent_relevance: z.string().optional(),
|
|
1190
|
+
/** How risky is upgrading without reading the changelog first. */
|
|
1191
|
+
breaking_risk: z.enum(['none', 'low', 'medium', 'high']).default('none'),
|
|
1192
|
+
/** Audience tags ('all', 'multi-agent', 'large-teams'). Absent means 'all'. */
|
|
1193
|
+
recommended_for: z.array(z.string()).optional(),
|
|
1194
|
+
/** Short bullet points the agent can list (max ~5). */
|
|
1195
|
+
highlights: z.array(z.string()).optional(),
|
|
1196
|
+
/** What the agent should tell the operator, e.g. "Safe to auto-install" or "Needs review before upgrading". */
|
|
1197
|
+
action_recommendation: z.string().optional(),
|
|
1198
|
+
});
|
|
723
1199
|
export const BrainclawLocalReleaseManifestSchema = z.object({
|
|
724
1200
|
schema_version: z.number().int().positive().optional(),
|
|
725
1201
|
version: z.literal(1),
|
|
@@ -730,6 +1206,7 @@ export const BrainclawLocalReleaseManifestSchema = z.object({
|
|
|
730
1206
|
artifact_path: z.string().optional(),
|
|
731
1207
|
install_command: z.string().optional(),
|
|
732
1208
|
release_notes: z.string().optional(),
|
|
1209
|
+
agent_release_notes: AgentReleaseNotesSchema.optional(),
|
|
733
1210
|
});
|
|
734
1211
|
export const ConfigSchema = z.object({
|
|
735
1212
|
schema_version: z.number().int().positive().optional(),
|
|
@@ -765,5 +1242,13 @@ export const ConfigSchema = z.object({
|
|
|
765
1242
|
cross_project_links: z.array(CrossProjectLinkSchema).optional().default([]),
|
|
766
1243
|
implicit_session_ttl: z.string().default('4h'),
|
|
767
1244
|
auto_reflect_notes: z.boolean().default(false),
|
|
1245
|
+
auto_refresh_live: z.boolean().default(true),
|
|
1246
|
+
claims: z.object({
|
|
1247
|
+
auto_release_after_hours: z.number().default(24),
|
|
1248
|
+
}).prefault({}),
|
|
1249
|
+
worktree: z.object({
|
|
1250
|
+
shared_paths: z.array(z.string()).default([]),
|
|
1251
|
+
exclude_shared: z.array(z.string()).default([]),
|
|
1252
|
+
}).optional(),
|
|
768
1253
|
});
|
|
769
1254
|
//# sourceMappingURL=schema.js.map
|