jg-agent-hq 0.2.0 → 0.3.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/CHANGELOG.md +6 -0
- package/README.md +4 -3
- package/api/README.md +10 -6
- package/dist/contracts/actions/types.d.ts +6 -6
- package/dist/contracts/actions/types.js +1 -1
- package/dist/contracts/handoffs/types.d.ts +5 -5
- package/dist/contracts/plans/types.d.ts +25 -25
- package/dist/contracts/plans/types.js +9 -10
- package/dist/contracts/types.d.ts +30 -30
- package/dist/handoffs/types.d.ts +6 -6
- package/dist/plans/admission.d.ts +2 -2
- package/dist/plans/admission.js +24 -16
- package/dist/plans/authority.d.ts +6 -0
- package/dist/plans/authority.js +39 -8
- package/dist/plans/finalization.d.ts +1 -1
- package/dist/plans/finalization.js +4 -3
- package/dist/plans/plans.d.ts +3 -3
- package/dist/plans/plans.js +9 -11
- package/dist/plans/reconciliation.js +3 -3
- package/dist/plans/revisions.d.ts +2 -2
- package/dist/plans/revisions.js +21 -3
- package/dist/plans/types.d.ts +4 -4
- package/dist/providers/claude/control/control.d.ts +1 -1
- package/dist/providers/claude/history/types.d.ts +11 -11
- package/dist/store/control/types.d.ts +6 -6
- package/dist/store/plans/plans.model.d.ts +2 -2
- package/dist/store/plans/plans.model.js +1 -1
- package/dist/store/schema.sql +5 -2
- package/dist/store/types.d.ts +28 -28
- package/errors/README.md +9 -1
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ export const createCompletionLookup = (completions, records) => {
|
|
|
22
22
|
});
|
|
23
23
|
const direct = new Set(completions
|
|
24
24
|
.filter((receipt) => !invalidated.has(receipt.id) &&
|
|
25
|
-
receipt.reopenActionId === (reopened.get(receipt.milestoneId)?.id ?? null))
|
|
25
|
+
receipt.reopenActionId === (reopened.get(receipt.milestoneId ?? '')?.id ?? null))
|
|
26
26
|
.map((receipt) => JSON.stringify([receipt.milestoneId, receipt.contractDigest])));
|
|
27
27
|
const links = new Map();
|
|
28
28
|
for (const [recordIndex, record] of records.entries()) {
|
|
@@ -67,7 +67,7 @@ export const createCompletionLookup = (completions, records) => {
|
|
|
67
67
|
*/
|
|
68
68
|
export const proposeReconciliation = (artifacts, action) => {
|
|
69
69
|
const checkpoint = artifacts.coordination.revision?.checkpoint;
|
|
70
|
-
if (!checkpoint
|
|
70
|
+
if (!checkpoint)
|
|
71
71
|
conflict();
|
|
72
72
|
const sources = checkpoint.entries;
|
|
73
73
|
const oldByContract = new Map();
|
|
@@ -186,7 +186,7 @@ export const confirmReconciliation = (artifacts, proposal, action, decisions) =>
|
|
|
186
186
|
}
|
|
187
187
|
const invalidatedReceiptIds = decision.relation === 'reopened'
|
|
188
188
|
? artifacts.coordination.completions
|
|
189
|
-
.filter((receipt) => decision.sourceIds.includes(receipt.milestoneId))
|
|
189
|
+
.filter((receipt) => receipt.milestoneId !== null && decision.sourceIds.includes(receipt.milestoneId))
|
|
190
190
|
.map((receipt) => receipt.id)
|
|
191
191
|
: [];
|
|
192
192
|
records.push({
|
|
@@ -37,7 +37,7 @@ export declare const finishPlanCheckpoint: (artifacts: IPlanArtifacts, revisionI
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const recordPlanCompletion: (artifacts: IPlanArtifacts, input: {
|
|
39
39
|
action: IPlanOperatorAction;
|
|
40
|
-
milestoneId: string;
|
|
40
|
+
milestoneId: string | null;
|
|
41
41
|
checks: IPlanCompletion["checks"];
|
|
42
42
|
}, checkouts: IPlanWorktreeProof[]) => IPlanCompletion;
|
|
43
43
|
/**
|
|
@@ -46,6 +46,6 @@ export declare const recordPlanCompletion: (artifacts: IPlanArtifacts, input: {
|
|
|
46
46
|
* @throws
|
|
47
47
|
* - -1: The HQ plan is invalid
|
|
48
48
|
*/
|
|
49
|
-
export declare const refreshPlanBaseline: (artifacts: IPlanArtifacts, content: string, revision: IPlanCheckpoint["revision"]) => IPlanCheckpoint;
|
|
49
|
+
export declare const refreshPlanBaseline: (artifacts: IPlanArtifacts, content: string | null, revision: IPlanCheckpoint["revision"]) => IPlanCheckpoint;
|
|
50
50
|
/** Builds indexed retained evidence without exposing whole coordination collections to clients. */
|
|
51
51
|
export declare const projectPlanRevision: (artifacts: IPlanArtifacts) => IPlanRevisionProjection;
|
package/dist/plans/revisions.js
CHANGED
|
@@ -24,8 +24,6 @@ export const capturePlanCheckpoint = (artifacts, threadIds) => {
|
|
|
24
24
|
isQuiescent: false,
|
|
25
25
|
capturedAt: Date.now(),
|
|
26
26
|
};
|
|
27
|
-
if (artifacts.milestones === null || !artifacts.revision.breakdownDigest)
|
|
28
|
-
conflict();
|
|
29
27
|
return {
|
|
30
28
|
revision: artifacts.revision,
|
|
31
29
|
plan: artifacts.plan,
|
|
@@ -120,6 +118,24 @@ export const finishPlanCheckpoint = (artifacts, revisionId, checkouts) => {
|
|
|
120
118
|
* - -1: The HQ action conflicts with its recorded state
|
|
121
119
|
*/
|
|
122
120
|
export const recordPlanCompletion = (artifacts, input, checkouts) => {
|
|
121
|
+
if (input.milestoneId === null) {
|
|
122
|
+
if (artifacts.milestones !== null)
|
|
123
|
+
conflict();
|
|
124
|
+
return {
|
|
125
|
+
id: input.action.id,
|
|
126
|
+
action: input.action,
|
|
127
|
+
milestoneId: null,
|
|
128
|
+
revision: artifacts.revision,
|
|
129
|
+
contractDigest: artifacts.revision.planDigest,
|
|
130
|
+
title: 'Whole plan',
|
|
131
|
+
contract: artifacts.contract.body,
|
|
132
|
+
sharedDigest: null,
|
|
133
|
+
checkouts,
|
|
134
|
+
checks: input.checks,
|
|
135
|
+
completedAt: Date.now(),
|
|
136
|
+
reopenActionId: null,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
123
139
|
const milestone = artifacts.parsed.find((entry) => entry.id === input.milestoneId) ??
|
|
124
140
|
artifacts.coordination.revision?.checkpoint?.entries.find((entry) => entry.id === input.milestoneId);
|
|
125
141
|
if (!milestone?.id || !milestone.contractDigest)
|
|
@@ -155,7 +171,9 @@ export const refreshPlanBaseline = (artifacts, content, revision) => {
|
|
|
155
171
|
revision,
|
|
156
172
|
plan: artifacts.plan,
|
|
157
173
|
milestones: content,
|
|
158
|
-
entries:
|
|
174
|
+
entries: content === null
|
|
175
|
+
? []
|
|
176
|
+
: parsePlanMilestones(content).map((entry) => PlanSnapshotMilestoneSchema.parse(entry)),
|
|
159
177
|
checkouts: previous?.checkouts ?? [],
|
|
160
178
|
threadIds: previous?.threadIds ?? [],
|
|
161
179
|
isQuiescent: previous?.isQuiescent ?? true,
|
package/dist/plans/types.d.ts
CHANGED
|
@@ -156,7 +156,7 @@ export declare const PlanRevisionProjectionSchema: z.ZodObject<{
|
|
|
156
156
|
reference: z.ZodString;
|
|
157
157
|
}, z.core.$strict>;
|
|
158
158
|
}, z.core.$strict>;
|
|
159
|
-
milestoneId: z.ZodUUID
|
|
159
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
160
160
|
revision: z.ZodObject<{
|
|
161
161
|
planDigest: z.ZodString;
|
|
162
162
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
@@ -164,7 +164,7 @@ export declare const PlanRevisionProjectionSchema: z.ZodObject<{
|
|
|
164
164
|
contractDigest: z.ZodString;
|
|
165
165
|
title: z.ZodString;
|
|
166
166
|
contract: z.ZodString;
|
|
167
|
-
sharedDigest: z.ZodString
|
|
167
|
+
sharedDigest: z.ZodNullable<z.ZodString>;
|
|
168
168
|
checkouts: z.ZodArray<z.ZodObject<{
|
|
169
169
|
repository: z.ZodString;
|
|
170
170
|
directory: z.ZodString;
|
|
@@ -290,7 +290,7 @@ export declare const PlanRevisionPageResultSchema: z.ZodObject<{
|
|
|
290
290
|
reference: z.ZodString;
|
|
291
291
|
}, z.core.$strict>;
|
|
292
292
|
}, z.core.$strict>;
|
|
293
|
-
milestoneId: z.ZodUUID
|
|
293
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
294
294
|
revision: z.ZodObject<{
|
|
295
295
|
planDigest: z.ZodString;
|
|
296
296
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
@@ -298,7 +298,7 @@ export declare const PlanRevisionPageResultSchema: z.ZodObject<{
|
|
|
298
298
|
contractDigest: z.ZodString;
|
|
299
299
|
title: z.ZodString;
|
|
300
300
|
contract: z.ZodString;
|
|
301
|
-
sharedDigest: z.ZodString
|
|
301
|
+
sharedDigest: z.ZodNullable<z.ZodString>;
|
|
302
302
|
checkouts: z.ZodArray<z.ZodObject<{
|
|
303
303
|
repository: z.ZodString;
|
|
304
304
|
directory: z.ZodString;
|
|
@@ -47,7 +47,7 @@ export declare const createClaudeControl: (additionalDirectories?: string[]) =>
|
|
|
47
47
|
* @throws
|
|
48
48
|
* - -1: The Claude integration failed
|
|
49
49
|
*/
|
|
50
|
-
readSkills(nativeId: string): Promise<import("../../types.
|
|
50
|
+
readSkills(nativeId: string): Promise<import("../../types.ts").IProviderSkills>;
|
|
51
51
|
/**
|
|
52
52
|
* Names only the native session selected by the admitted action.
|
|
53
53
|
* @returns Native acknowledgement of the name change.
|
|
@@ -110,7 +110,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
110
110
|
planDigest: z.ZodString;
|
|
111
111
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
112
112
|
}, z.core.$strict>;
|
|
113
|
-
fileHash: z.ZodString
|
|
113
|
+
fileHash: z.ZodNullable<z.ZodString>;
|
|
114
114
|
createdAt: z.ZodNumber;
|
|
115
115
|
}, z.core.$strict>>;
|
|
116
116
|
planApproval: z.ZodNullable<z.ZodObject<{
|
|
@@ -330,7 +330,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
330
330
|
planDigest: z.ZodString;
|
|
331
331
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
332
332
|
}, z.core.$strict>;
|
|
333
|
-
fileHash: z.ZodString
|
|
333
|
+
fileHash: z.ZodNullable<z.ZodString>;
|
|
334
334
|
createdAt: z.ZodNumber;
|
|
335
335
|
}, z.core.$strict>>;
|
|
336
336
|
planApproval: z.ZodNullable<z.ZodObject<{
|
|
@@ -518,7 +518,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
518
518
|
reference: z.ZodString;
|
|
519
519
|
}, z.core.$strict>;
|
|
520
520
|
}, z.core.$strict>;
|
|
521
|
-
milestoneId: z.ZodUUID
|
|
521
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
522
522
|
revision: z.ZodObject<{
|
|
523
523
|
planDigest: z.ZodString;
|
|
524
524
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
@@ -526,7 +526,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
526
526
|
contractDigest: z.ZodString;
|
|
527
527
|
title: z.ZodString;
|
|
528
528
|
contract: z.ZodString;
|
|
529
|
-
sharedDigest: z.ZodString
|
|
529
|
+
sharedDigest: z.ZodNullable<z.ZodString>;
|
|
530
530
|
checkouts: z.ZodArray<z.ZodObject<{
|
|
531
531
|
repository: z.ZodString;
|
|
532
532
|
directory: z.ZodString;
|
|
@@ -674,7 +674,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
674
674
|
planDigest: z.ZodString;
|
|
675
675
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
676
676
|
}, z.core.$strict>;
|
|
677
|
-
fileHash: z.ZodString
|
|
677
|
+
fileHash: z.ZodNullable<z.ZodString>;
|
|
678
678
|
createdAt: z.ZodNumber;
|
|
679
679
|
}, z.core.$strict>>;
|
|
680
680
|
planApproval: z.ZodNullable<z.ZodObject<{
|
|
@@ -813,7 +813,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
813
813
|
}, z.core.$strict>>;
|
|
814
814
|
}, z.core.$strict>;
|
|
815
815
|
}, z.core.$strip>;
|
|
816
|
-
content: z.ZodString
|
|
816
|
+
content: z.ZodNullable<z.ZodString>;
|
|
817
817
|
}, z.core.$strip>, z.ZodObject<{
|
|
818
818
|
kind: z.ZodLiteral<"milestones">;
|
|
819
819
|
result: z.ZodObject<{
|
|
@@ -894,7 +894,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
894
894
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
895
895
|
kind: z.ZodLiteral<"execution">;
|
|
896
896
|
authorizationId: z.ZodUUID;
|
|
897
|
-
milestoneId: z.ZodUUID
|
|
897
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
898
898
|
mode: z.ZodEnum<{
|
|
899
899
|
supervised: "supervised";
|
|
900
900
|
auto: "auto";
|
|
@@ -1027,7 +1027,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
1027
1027
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1028
1028
|
kind: z.ZodLiteral<"execution">;
|
|
1029
1029
|
authorizationId: z.ZodUUID;
|
|
1030
|
-
milestoneId: z.ZodUUID
|
|
1030
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1031
1031
|
mode: z.ZodEnum<{
|
|
1032
1032
|
supervised: "supervised";
|
|
1033
1033
|
auto: "auto";
|
|
@@ -1364,7 +1364,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
1364
1364
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1365
1365
|
kind: z.ZodLiteral<"execution">;
|
|
1366
1366
|
authorizationId: z.ZodUUID;
|
|
1367
|
-
milestoneId: z.ZodUUID
|
|
1367
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1368
1368
|
mode: z.ZodEnum<{
|
|
1369
1369
|
supervised: "supervised";
|
|
1370
1370
|
auto: "auto";
|
|
@@ -1440,7 +1440,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
1440
1440
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1441
1441
|
kind: z.ZodLiteral<"execution">;
|
|
1442
1442
|
authorizationId: z.ZodUUID;
|
|
1443
|
-
milestoneId: z.ZodUUID
|
|
1443
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1444
1444
|
mode: z.ZodEnum<{
|
|
1445
1445
|
supervised: "supervised";
|
|
1446
1446
|
auto: "auto";
|
|
@@ -1628,7 +1628,7 @@ export declare const ClaudeHistoryReadSchema: z.ZodUnion<readonly [z.ZodDiscrimi
|
|
|
1628
1628
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1629
1629
|
kind: z.ZodLiteral<"execution">;
|
|
1630
1630
|
authorizationId: z.ZodUUID;
|
|
1631
|
-
milestoneId: z.ZodUUID
|
|
1631
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1632
1632
|
mode: z.ZodEnum<{
|
|
1633
1633
|
supervised: "supervised";
|
|
1634
1634
|
auto: "auto";
|
|
@@ -337,7 +337,7 @@ export declare const AdmissionSchema: z.ZodObject<{
|
|
|
337
337
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
338
338
|
kind: z.ZodLiteral<"execution">;
|
|
339
339
|
authorizationId: z.ZodUUID;
|
|
340
|
-
milestoneId: z.ZodUUID
|
|
340
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
341
341
|
mode: z.ZodEnum<{
|
|
342
342
|
supervised: "supervised";
|
|
343
343
|
auto: "auto";
|
|
@@ -356,7 +356,7 @@ export declare const AdmissionSchema: z.ZodObject<{
|
|
|
356
356
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
357
357
|
kind: z.ZodLiteral<"execution">;
|
|
358
358
|
authorizationId: z.ZodUUID;
|
|
359
|
-
milestoneId: z.ZodUUID
|
|
359
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
360
360
|
mode: z.ZodEnum<{
|
|
361
361
|
supervised: "supervised";
|
|
362
362
|
auto: "auto";
|
|
@@ -389,7 +389,7 @@ export declare const AdmissionSchema: z.ZodObject<{
|
|
|
389
389
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
390
390
|
kind: z.ZodLiteral<"execution">;
|
|
391
391
|
authorizationId: z.ZodUUID;
|
|
392
|
-
milestoneId: z.ZodUUID
|
|
392
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
393
393
|
mode: z.ZodEnum<{
|
|
394
394
|
supervised: "supervised";
|
|
395
395
|
auto: "auto";
|
|
@@ -459,7 +459,7 @@ export declare const AdmissionResultSchema: z.ZodObject<{
|
|
|
459
459
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
460
460
|
kind: z.ZodLiteral<"execution">;
|
|
461
461
|
authorizationId: z.ZodUUID;
|
|
462
|
-
milestoneId: z.ZodUUID
|
|
462
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
463
463
|
mode: z.ZodEnum<{
|
|
464
464
|
supervised: "supervised";
|
|
465
465
|
auto: "auto";
|
|
@@ -570,7 +570,7 @@ export declare const DispatchSchema: z.ZodObject<{
|
|
|
570
570
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
571
571
|
kind: z.ZodLiteral<"execution">;
|
|
572
572
|
authorizationId: z.ZodUUID;
|
|
573
|
-
milestoneId: z.ZodUUID
|
|
573
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
574
574
|
mode: z.ZodEnum<{
|
|
575
575
|
supervised: "supervised";
|
|
576
576
|
auto: "auto";
|
|
@@ -789,7 +789,7 @@ export declare const ActionPageSchema: z.ZodObject<{
|
|
|
789
789
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
790
790
|
kind: z.ZodLiteral<"execution">;
|
|
791
791
|
authorizationId: z.ZodUUID;
|
|
792
|
-
milestoneId: z.ZodUUID
|
|
792
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
793
793
|
mode: z.ZodEnum<{
|
|
794
794
|
supervised: "supervised";
|
|
795
795
|
auto: "auto";
|
|
@@ -76,7 +76,7 @@ export declare class PlansModel {
|
|
|
76
76
|
reference: string;
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
-
milestoneId: string;
|
|
79
|
+
milestoneId: string | null;
|
|
80
80
|
revision: {
|
|
81
81
|
planDigest: string;
|
|
82
82
|
breakdownDigest: string | null;
|
|
@@ -84,7 +84,7 @@ export declare class PlansModel {
|
|
|
84
84
|
contractDigest: string;
|
|
85
85
|
title: string;
|
|
86
86
|
contract: string;
|
|
87
|
-
sharedDigest: string;
|
|
87
|
+
sharedDigest: string | null;
|
|
88
88
|
checkouts: {
|
|
89
89
|
repository: string;
|
|
90
90
|
directory: string;
|
|
@@ -180,7 +180,7 @@ export class PlansModel {
|
|
|
180
180
|
const execution = context.scope.kind === 'execution' ? context.scope : null;
|
|
181
181
|
if (execution) {
|
|
182
182
|
const other = this.__database
|
|
183
|
-
.prepare('SELECT thread.id, thread.state, thread.ownership, thread.runtime_epoch FROM thread_plan INNER JOIN thread ON thread.id = thread_plan.thread_id WHERE thread_plan.authorization_id = ? AND thread_plan.milestone_id
|
|
183
|
+
.prepare('SELECT thread.id, thread.state, thread.ownership, thread.runtime_epoch FROM thread_plan INNER JOIN thread ON thread.id = thread_plan.thread_id WHERE thread_plan.authorization_id = ? AND thread_plan.milestone_id IS ? AND thread_plan.thread_id != ? LIMIT 1')
|
|
184
184
|
.get(execution.authorizationId, execution.milestoneId, threadId);
|
|
185
185
|
if (other) {
|
|
186
186
|
if (other.state !== 'inactive' ||
|
package/dist/store/schema.sql
CHANGED
|
@@ -161,14 +161,17 @@ CREATE TABLE IF NOT EXISTS thread_plan (
|
|
|
161
161
|
context TEXT NOT NULL,
|
|
162
162
|
authorization_id TEXT,
|
|
163
163
|
milestone_id TEXT,
|
|
164
|
-
CONSTRAINT chk_tp__execution_scope_complete CHECK (
|
|
164
|
+
CONSTRAINT chk_tp__execution_scope_complete CHECK (authorization_id IS NOT NULL OR milestone_id IS NULL),
|
|
165
165
|
CONSTRAINT pk_tp__thread_id PRIMARY KEY (thread_id),
|
|
166
166
|
CONSTRAINT fk_tp__thread_id FOREIGN KEY (thread_id) REFERENCES thread(id)
|
|
167
167
|
) STRICT;
|
|
168
168
|
CREATE INDEX IF NOT EXISTS idx_tp__directory_thread_id ON thread_plan (directory, thread_id);
|
|
169
169
|
|
|
170
170
|
CREATE UNIQUE INDEX IF NOT EXISTS uidx_tp__authorization_id_milestone_id_execution
|
|
171
|
-
ON thread_plan (authorization_id, milestone_id) WHERE authorization_id IS NOT NULL;
|
|
171
|
+
ON thread_plan (authorization_id, milestone_id) WHERE authorization_id IS NOT NULL AND milestone_id IS NOT NULL;
|
|
172
|
+
|
|
173
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uidx_tp__authorization_id_plan_execution
|
|
174
|
+
ON thread_plan (authorization_id) WHERE authorization_id IS NOT NULL AND milestone_id IS NULL;
|
|
172
175
|
|
|
173
176
|
CREATE TABLE IF NOT EXISTS handoff (
|
|
174
177
|
id TEXT NOT NULL,
|
package/dist/store/types.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
30
30
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
31
|
kind: z.ZodLiteral<"execution">;
|
|
32
32
|
authorizationId: z.ZodUUID;
|
|
33
|
-
milestoneId: z.ZodUUID
|
|
33
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
34
34
|
mode: z.ZodEnum<{
|
|
35
35
|
supervised: "supervised";
|
|
36
36
|
auto: "auto";
|
|
@@ -166,7 +166,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
166
166
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
167
167
|
kind: z.ZodLiteral<"execution">;
|
|
168
168
|
authorizationId: z.ZodUUID;
|
|
169
|
-
milestoneId: z.ZodUUID
|
|
169
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
170
170
|
mode: z.ZodEnum<{
|
|
171
171
|
supervised: "supervised";
|
|
172
172
|
auto: "auto";
|
|
@@ -185,7 +185,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
185
185
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
186
186
|
kind: z.ZodLiteral<"execution">;
|
|
187
187
|
authorizationId: z.ZodUUID;
|
|
188
|
-
milestoneId: z.ZodUUID
|
|
188
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
189
189
|
mode: z.ZodEnum<{
|
|
190
190
|
supervised: "supervised";
|
|
191
191
|
auto: "auto";
|
|
@@ -352,7 +352,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
352
352
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
353
353
|
kind: z.ZodLiteral<"execution">;
|
|
354
354
|
authorizationId: z.ZodUUID;
|
|
355
|
-
milestoneId: z.ZodUUID
|
|
355
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
356
356
|
mode: z.ZodEnum<{
|
|
357
357
|
supervised: "supervised";
|
|
358
358
|
auto: "auto";
|
|
@@ -371,7 +371,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
371
371
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
372
372
|
kind: z.ZodLiteral<"execution">;
|
|
373
373
|
authorizationId: z.ZodUUID;
|
|
374
|
-
milestoneId: z.ZodUUID
|
|
374
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
375
375
|
mode: z.ZodEnum<{
|
|
376
376
|
supervised: "supervised";
|
|
377
377
|
auto: "auto";
|
|
@@ -468,7 +468,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
468
468
|
}, z.core.$strict>;
|
|
469
469
|
kind: z.ZodLiteral<"finalize">;
|
|
470
470
|
}, z.core.$strict>, z.ZodObject<{
|
|
471
|
-
milestoneId: z.ZodUUID
|
|
471
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
472
472
|
checks: z.ZodArray<z.ZodObject<{
|
|
473
473
|
command: z.ZodString;
|
|
474
474
|
outcome: z.ZodLiteral<"passed">;
|
|
@@ -654,7 +654,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
654
654
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
655
655
|
}, z.core.$strict>;
|
|
656
656
|
authorizationId: z.ZodUUID;
|
|
657
|
-
milestoneId: z.ZodUUID
|
|
657
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
658
658
|
mode: z.ZodEnum<{
|
|
659
659
|
supervised: "supervised";
|
|
660
660
|
auto: "auto";
|
|
@@ -879,7 +879,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
879
879
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
880
880
|
kind: z.ZodLiteral<"execution">;
|
|
881
881
|
authorizationId: z.ZodUUID;
|
|
882
|
-
milestoneId: z.ZodUUID
|
|
882
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
883
883
|
mode: z.ZodEnum<{
|
|
884
884
|
supervised: "supervised";
|
|
885
885
|
auto: "auto";
|
|
@@ -898,7 +898,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
898
898
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
899
899
|
kind: z.ZodLiteral<"execution">;
|
|
900
900
|
authorizationId: z.ZodUUID;
|
|
901
|
-
milestoneId: z.ZodUUID
|
|
901
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
902
902
|
mode: z.ZodEnum<{
|
|
903
903
|
supervised: "supervised";
|
|
904
904
|
auto: "auto";
|
|
@@ -1043,7 +1043,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1043
1043
|
reference: z.ZodString;
|
|
1044
1044
|
}, z.core.$strict>;
|
|
1045
1045
|
}, z.core.$strict>;
|
|
1046
|
-
milestoneId: z.ZodUUID
|
|
1046
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1047
1047
|
revision: z.ZodObject<{
|
|
1048
1048
|
planDigest: z.ZodString;
|
|
1049
1049
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
@@ -1051,7 +1051,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1051
1051
|
contractDigest: z.ZodString;
|
|
1052
1052
|
title: z.ZodString;
|
|
1053
1053
|
contract: z.ZodString;
|
|
1054
|
-
sharedDigest: z.ZodString
|
|
1054
|
+
sharedDigest: z.ZodNullable<z.ZodString>;
|
|
1055
1055
|
checkouts: z.ZodArray<z.ZodObject<{
|
|
1056
1056
|
repository: z.ZodString;
|
|
1057
1057
|
directory: z.ZodString;
|
|
@@ -1364,7 +1364,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1364
1364
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1365
1365
|
kind: z.ZodLiteral<"execution">;
|
|
1366
1366
|
authorizationId: z.ZodUUID;
|
|
1367
|
-
milestoneId: z.ZodUUID
|
|
1367
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1368
1368
|
mode: z.ZodEnum<{
|
|
1369
1369
|
supervised: "supervised";
|
|
1370
1370
|
auto: "auto";
|
|
@@ -1383,7 +1383,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1383
1383
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1384
1384
|
kind: z.ZodLiteral<"execution">;
|
|
1385
1385
|
authorizationId: z.ZodUUID;
|
|
1386
|
-
milestoneId: z.ZodUUID
|
|
1386
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1387
1387
|
mode: z.ZodEnum<{
|
|
1388
1388
|
supervised: "supervised";
|
|
1389
1389
|
auto: "auto";
|
|
@@ -1416,7 +1416,7 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1416
1416
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1417
1417
|
kind: z.ZodLiteral<"execution">;
|
|
1418
1418
|
authorizationId: z.ZodUUID;
|
|
1419
|
-
milestoneId: z.ZodUUID
|
|
1419
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1420
1420
|
mode: z.ZodEnum<{
|
|
1421
1421
|
supervised: "supervised";
|
|
1422
1422
|
auto: "auto";
|
|
@@ -1621,7 +1621,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
1621
1621
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1622
1622
|
kind: z.ZodLiteral<"execution">;
|
|
1623
1623
|
authorizationId: z.ZodUUID;
|
|
1624
|
-
milestoneId: z.ZodUUID
|
|
1624
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1625
1625
|
mode: z.ZodEnum<{
|
|
1626
1626
|
supervised: "supervised";
|
|
1627
1627
|
auto: "auto";
|
|
@@ -1757,7 +1757,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
1757
1757
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1758
1758
|
kind: z.ZodLiteral<"execution">;
|
|
1759
1759
|
authorizationId: z.ZodUUID;
|
|
1760
|
-
milestoneId: z.ZodUUID
|
|
1760
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1761
1761
|
mode: z.ZodEnum<{
|
|
1762
1762
|
supervised: "supervised";
|
|
1763
1763
|
auto: "auto";
|
|
@@ -1776,7 +1776,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
1776
1776
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1777
1777
|
kind: z.ZodLiteral<"execution">;
|
|
1778
1778
|
authorizationId: z.ZodUUID;
|
|
1779
|
-
milestoneId: z.ZodUUID
|
|
1779
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1780
1780
|
mode: z.ZodEnum<{
|
|
1781
1781
|
supervised: "supervised";
|
|
1782
1782
|
auto: "auto";
|
|
@@ -1943,7 +1943,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
1943
1943
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1944
1944
|
kind: z.ZodLiteral<"execution">;
|
|
1945
1945
|
authorizationId: z.ZodUUID;
|
|
1946
|
-
milestoneId: z.ZodUUID
|
|
1946
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1947
1947
|
mode: z.ZodEnum<{
|
|
1948
1948
|
supervised: "supervised";
|
|
1949
1949
|
auto: "auto";
|
|
@@ -1962,7 +1962,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
1962
1962
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1963
1963
|
kind: z.ZodLiteral<"execution">;
|
|
1964
1964
|
authorizationId: z.ZodUUID;
|
|
1965
|
-
milestoneId: z.ZodUUID
|
|
1965
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
1966
1966
|
mode: z.ZodEnum<{
|
|
1967
1967
|
supervised: "supervised";
|
|
1968
1968
|
auto: "auto";
|
|
@@ -2059,7 +2059,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2059
2059
|
}, z.core.$strict>;
|
|
2060
2060
|
kind: z.ZodLiteral<"finalize">;
|
|
2061
2061
|
}, z.core.$strict>, z.ZodObject<{
|
|
2062
|
-
milestoneId: z.ZodUUID
|
|
2062
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2063
2063
|
checks: z.ZodArray<z.ZodObject<{
|
|
2064
2064
|
command: z.ZodString;
|
|
2065
2065
|
outcome: z.ZodLiteral<"passed">;
|
|
@@ -2245,7 +2245,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2245
2245
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
2246
2246
|
}, z.core.$strict>;
|
|
2247
2247
|
authorizationId: z.ZodUUID;
|
|
2248
|
-
milestoneId: z.ZodUUID
|
|
2248
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2249
2249
|
mode: z.ZodEnum<{
|
|
2250
2250
|
supervised: "supervised";
|
|
2251
2251
|
auto: "auto";
|
|
@@ -2470,7 +2470,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2470
2470
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2471
2471
|
kind: z.ZodLiteral<"execution">;
|
|
2472
2472
|
authorizationId: z.ZodUUID;
|
|
2473
|
-
milestoneId: z.ZodUUID
|
|
2473
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2474
2474
|
mode: z.ZodEnum<{
|
|
2475
2475
|
supervised: "supervised";
|
|
2476
2476
|
auto: "auto";
|
|
@@ -2489,7 +2489,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2489
2489
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2490
2490
|
kind: z.ZodLiteral<"execution">;
|
|
2491
2491
|
authorizationId: z.ZodUUID;
|
|
2492
|
-
milestoneId: z.ZodUUID
|
|
2492
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2493
2493
|
mode: z.ZodEnum<{
|
|
2494
2494
|
supervised: "supervised";
|
|
2495
2495
|
auto: "auto";
|
|
@@ -2634,7 +2634,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2634
2634
|
reference: z.ZodString;
|
|
2635
2635
|
}, z.core.$strict>;
|
|
2636
2636
|
}, z.core.$strict>;
|
|
2637
|
-
milestoneId: z.ZodUUID
|
|
2637
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2638
2638
|
revision: z.ZodObject<{
|
|
2639
2639
|
planDigest: z.ZodString;
|
|
2640
2640
|
breakdownDigest: z.ZodNullable<z.ZodString>;
|
|
@@ -2642,7 +2642,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2642
2642
|
contractDigest: z.ZodString;
|
|
2643
2643
|
title: z.ZodString;
|
|
2644
2644
|
contract: z.ZodString;
|
|
2645
|
-
sharedDigest: z.ZodString
|
|
2645
|
+
sharedDigest: z.ZodNullable<z.ZodString>;
|
|
2646
2646
|
checkouts: z.ZodArray<z.ZodObject<{
|
|
2647
2647
|
repository: z.ZodString;
|
|
2648
2648
|
directory: z.ZodString;
|
|
@@ -2955,7 +2955,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2955
2955
|
plan: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2956
2956
|
kind: z.ZodLiteral<"execution">;
|
|
2957
2957
|
authorizationId: z.ZodUUID;
|
|
2958
|
-
milestoneId: z.ZodUUID
|
|
2958
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2959
2959
|
mode: z.ZodEnum<{
|
|
2960
2960
|
supervised: "supervised";
|
|
2961
2961
|
auto: "auto";
|
|
@@ -2974,7 +2974,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
2974
2974
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2975
2975
|
kind: z.ZodLiteral<"execution">;
|
|
2976
2976
|
authorizationId: z.ZodUUID;
|
|
2977
|
-
milestoneId: z.ZodUUID
|
|
2977
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
2978
2978
|
mode: z.ZodEnum<{
|
|
2979
2979
|
supervised: "supervised";
|
|
2980
2980
|
auto: "auto";
|
|
@@ -3007,7 +3007,7 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
3007
3007
|
scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3008
3008
|
kind: z.ZodLiteral<"execution">;
|
|
3009
3009
|
authorizationId: z.ZodUUID;
|
|
3010
|
-
milestoneId: z.ZodUUID
|
|
3010
|
+
milestoneId: z.ZodNullable<z.ZodUUID>;
|
|
3011
3011
|
mode: z.ZodEnum<{
|
|
3012
3012
|
supervised: "supervised";
|
|
3013
3013
|
auto: "auto";
|
package/errors/README.md
CHANGED
|
@@ -53,7 +53,7 @@ State safety rejects non-private ownership, symlinks and non-regular files. Runt
|
|
|
53
53
|
|
|
54
54
|
A native or worker startup failure whose cleanup could not be confirmed carries internal `cleanupUnconfirmed: true`. The runtime retains its owner record in that case rather than allowing a new host to assume its resources have stopped.
|
|
55
55
|
|
|
56
|
-
Plan validation rejects unsupported framing, duplicate or misplaced milestone IDs, invalid frontmatter boundaries, non-regular artifacts and oversized inputs. Plan operation failures retain safe operation diagnostics inside the trusted host. Stale revisions, presentation hashes, replay payload conflicts, revoked authority and unresolved writes use the existing action-state conflict contract. Unresolved correspondence, unverified done evidence, live scope changes, stale runtime authority and unproven quiescence also use the action-state conflict contract. Failed native cleanup retains the checkpoint and closes the editing gate. Neither validation nor write recovery can grant native permissions.
|
|
56
|
+
Plan validation rejects unsupported framing, duplicate or misplaced milestone IDs, invalid frontmatter boundaries, non-regular artifacts and oversized inputs. Plan operation failures retain safe operation diagnostics inside the trusted host. Stale revisions, presentation hashes, replay payload conflicts, revoked authority and unresolved writes use the existing action-state conflict contract. Unresolved correspondence, unverified done evidence, live scope changes, stale runtime authority and unproven quiescence also use the action-state conflict contract. Failed native cleanup retains the checkpoint and closes the editing gate. Neither validation nor write recovery can grant native permissions. Whole-plan selection conflicts with a real breakdown, duplicate live implementation ownership, completed contracts and revoked implementation follow-up authority use the same action-state conflict contract. A valid sequence approval request for a plan without a sequence also conflicts.
|
|
57
57
|
|
|
58
58
|
## Public error messages
|
|
59
59
|
|
|
@@ -81,3 +81,11 @@ Handoff lookup uses the unavailable contract for an unknown identity. Git attrib
|
|
|
81
81
|
| -1 | The HQ website destination check failed |
|
|
82
82
|
|
|
83
83
|
These build-time failures retain operation diagnostics and their original causes locally.
|
|
84
|
+
|
|
85
|
+
## Release tooling
|
|
86
|
+
|
|
87
|
+
| Code | Stable message |
|
|
88
|
+
| ---- | ----------------------------------- |
|
|
89
|
+
| -1 | The HQ package release check failed |
|
|
90
|
+
|
|
91
|
+
Release checks reject invalid registry metadata, oversized responses, changed contents under an existing version and versions that do not exceed the latest release. Diagnostic suffixes explain the required correction. Failed registry reads never authorize a publish.
|