opencode-swarm 7.153.0 → 7.153.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.
- package/dist/background/pending-delegations.d.ts +7 -0
- package/dist/cli/{config-doctor-7s7xga6f.js → config-doctor-ze21qs6b.js} +2 -2
- package/dist/cli/{core-vkpy14vv.js → core-qdmhh1kx.js} +1 -1
- package/dist/cli/{curation-policy-xy7tm4ad.js → curation-policy-twa6agf8.js} +7 -7
- package/dist/cli/{curator-6freqnhf.js → curator-hxb3wsxr.js} +30 -30
- package/dist/cli/{curator-llm-factory-q5cjk7mt.js → curator-llm-factory-s8atmc2n.js} +30 -30
- package/dist/cli/{evidence-summary-service-engtgjww.js → evidence-summary-service-wzzym9r7.js} +13 -13
- package/dist/cli/{gate-evidence-6bzzz8kq.js → gate-evidence-f71dn9vv.js} +7 -7
- package/dist/cli/{guardrail-explain-vsck39dh.js → guardrail-explain-5kzeem4m.js} +31 -31
- package/dist/cli/{guardrail-log-0dn8m3k6.js → guardrail-log-38jnajpa.js} +5 -5
- package/dist/cli/{guardrail-reset-6e2vyfn9.js → guardrail-reset-wzvtmpn2.js} +30 -30
- package/dist/cli/{hive-promoter-021abs6z.js → hive-promoter-55qcqgfx.js} +30 -30
- package/dist/cli/{index-hw49515c.js → index-0tyc8kdg.js} +1 -1
- package/dist/cli/{index-9vdh4kdx.js → index-0tzv5zg2.js} +2 -2
- package/dist/cli/{index-e2hs0bh7.js → index-1akn19mp.js} +1 -1
- package/dist/cli/{index-5x67858f.js → index-1dtshrzg.js} +5 -5
- package/dist/cli/{index-9gjbe4e4.js → index-1gzdnjg9.js} +2 -2
- package/dist/cli/{index-dh1gk5c5.js → index-23rneydq.js} +32 -32
- package/dist/cli/{index-z4bg1hv8.js → index-2mqmvxac.js} +9 -2
- package/dist/cli/index-3cegckkq.js +239 -0
- package/dist/cli/{index-1yfpw7w0.js → index-3ttktt56.js} +1 -1
- package/dist/cli/{index-eajfs7v4.js → index-4g0g3dqz.js} +1 -1
- package/dist/cli/{index-x6zy6veh.js → index-4pjkdcgc.js} +1 -1
- package/dist/cli/{index-g0m6kypc.js → index-6vgb5fyb.js} +1 -1
- package/dist/cli/{index-95qra69h.js → index-6ybjrqf7.js} +4397 -2470
- package/dist/cli/{index-txbd25bc.js → index-891g7hbf.js} +1 -1
- package/dist/cli/{index-7q56f3se.js → index-8v9sj4aq.js} +2 -2
- package/dist/cli/{index-babtfqa0.js → index-9v8d3c0k.js} +450 -48
- package/dist/cli/{index-eqh3t8eh.js → index-af0cqe6n.js} +14 -14
- package/dist/cli/{index-hkmgzesw.js → index-ajkxx2k6.js} +2 -2
- package/dist/cli/{index-6v77adf7.js → index-gn26q90p.js} +2 -2
- package/dist/cli/{index-77xy577c.js → index-k10qtq71.js} +9 -9
- package/dist/cli/{index-80ekaf5b.js → index-mb7b1gye.js} +3 -3
- package/dist/cli/{index-0q2mjxp2.js → index-meg33yyv.js} +1 -1
- package/dist/cli/{index-3z2f1cy8.js → index-n5pxkera.js} +4 -4
- package/dist/cli/{index-3z5jtyan.js → index-n823qsae.js} +3 -2
- package/dist/cli/{index-6zkm4p7p.js → index-pk1gbqmq.js} +1 -1
- package/dist/cli/{index-4gn111h3.js → index-smqsp8hs.js} +5 -5
- package/dist/cli/{index-k2ydsqs7.js → index-td0jz8xe.js} +4 -4
- package/dist/cli/{index-xv881ahz.js → index-tdzbm974.js} +7 -7
- package/dist/cli/{index-5w915x8b.js → index-v689bmr2.js} +4 -4
- package/dist/cli/{index-qgfnd206.js → index-x3y6zhgj.js} +1 -1
- package/dist/cli/{index-aw492hpn.js → index-x8vw6ap1.js} +58 -41
- package/dist/cli/{index-hexhzq5j.js → index-xkjrg9k4.js} +3 -3
- package/dist/cli/{index-0n7nm9e8.js → index-zppxpc3y.js} +2 -2
- package/dist/cli/index.js +30 -30
- package/dist/cli/{knowledge-escalator-79zbhpz5.js → knowledge-escalator-w05ztgvk.js} +12 -12
- package/dist/cli/{knowledge-events-79cak7eb.js → knowledge-events-pwm9jc0m.js} +10 -10
- package/dist/cli/{knowledge-link-40zsr5ja.js → knowledge-link-ge0rddxw.js} +6 -6
- package/dist/cli/{knowledge-store-w29aw5w0.js → knowledge-store-4xv65tj2.js} +7 -7
- package/dist/cli/{knowledge-validator-qsecnt2d.js → knowledge-validator-0ttfsca7.js} +9 -9
- package/dist/cli/{pending-delegations-a2nmssr1.js → pending-delegations-nk78wx7h.js} +4 -4
- package/dist/cli/{pr-subscriptions-7879nq5k.js → pr-subscriptions-dq1f61ye.js} +4 -4
- package/dist/cli/{runner-fbgsxs74.js → runner-n50w1y4w.js} +7 -7
- package/dist/cli/{scan-cursor-1r3pcdqp.js → scan-cursor-b6n15w8d.js} +8 -8
- package/dist/cli/{schema-19qsv6fw.js → schema-jkbfwqr2.js} +1 -1
- package/dist/cli/{scope-persistence-ypcrvqtt.js → scope-persistence-5xt2m5ep.js} +9 -9
- package/dist/cli/{skill-generator-wpp9kpa0.js → skill-generator-3keadpf7.js} +14 -14
- package/dist/cli/{telemetry-52pw5xac.js → telemetry-hh1j99za.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-p31zm5k0.js → worktree-collision-ownership-4drcjymy.js} +15 -10
- package/dist/cli/{worktree-isolation-wcry8qnn.js → worktree-isolation-1ymaxn4h.js} +30 -30
- package/dist/commands/lanes.d.ts +25 -0
- package/dist/consensus/corpus.d.ts +16 -0
- package/dist/hooks/delegation-gate/worktree-isolation.d.ts +50 -3
- package/dist/hooks/delegation-gate/worktree-provisioning-owner.d.ts +40 -2
- package/dist/hooks/delegation-gate/worktree-recovery-authority.d.ts +201 -0
- package/dist/hooks/init-orphan-recovery.d.ts +5 -1
- package/dist/hooks/trajectory-logger.d.ts +22 -6
- package/dist/hooks/trajectory-step-state.d.ts +43 -2
- package/dist/index.js +556 -551
- package/dist/observability/catalog.d.ts +6 -4
- package/dist/prm/index.d.ts +3 -3
- package/dist/prm/replay.d.ts +29 -2
- package/dist/prm/trajectory-store.d.ts +210 -20
- package/dist/telemetry.d.ts +21 -1
- package/dist/utils/atomic-write.d.ts +2 -0
- package/dist/utils/canonical-root.d.ts +31 -0
- package/dist/workflow/coder-settlement.d.ts +2 -0
- package/dist/worktree/index.d.ts +2 -2
- package/dist/worktree/merge.d.ts +47 -0
- package/package.json +2 -1
- package/dist/cli/index-fxvgaeq4.js +0 -125
- package/dist/cli/worktree-provisioning-owner-cve95q4f.js +0 -22
- package/dist/cli/{curator-drift-2h1d2fnq.js → curator-drift-h57z6tm3.js} +1 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
export declare const WORKTREE_RECOVERY_MUTATOR_NAMES: readonly ["publish", "claim", "renew", "release", "finalize", "replay"];
|
|
2
|
+
export type WorktreeRecoveryMutatorName = (typeof WORKTREE_RECOVERY_MUTATOR_NAMES)[number];
|
|
3
|
+
export type WorktreeRecoveryStrategy = 'merge' | 'rebase' | 'cherry-pick';
|
|
4
|
+
export type WorktreeRecoveryStatus = 'preserved' | 'claimed' | 'released' | 'finalized';
|
|
5
|
+
export type WorktreeRecoveryJournalState = 'PREPARED' | 'COMMITTED' | 'CLAIM_RENEWED' | 'ABORTED' | 'RELEASED' | 'FINALIZED';
|
|
6
|
+
export interface WorktreeRecoveryImmutableIdentityInput {
|
|
7
|
+
originalCallID: string;
|
|
8
|
+
parentSessionId: string;
|
|
9
|
+
taskId: string;
|
|
10
|
+
reservationId: string;
|
|
11
|
+
generation: number;
|
|
12
|
+
canonicalBranch: string;
|
|
13
|
+
canonicalPath: string;
|
|
14
|
+
laneBranch: string;
|
|
15
|
+
lanePath: string;
|
|
16
|
+
expectedPrimaryHead: string;
|
|
17
|
+
sourceBaseOid: string;
|
|
18
|
+
sourceHeadOid: string;
|
|
19
|
+
targetHeadOid: string;
|
|
20
|
+
strategy: WorktreeRecoveryStrategy;
|
|
21
|
+
declaredConflictFiles?: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface WorktreeRecoveryImmutableIdentity extends WorktreeRecoveryImmutableIdentityInput {
|
|
24
|
+
createdAt: number;
|
|
25
|
+
}
|
|
26
|
+
export interface WorktreeRecoveryClaimState {
|
|
27
|
+
claimantCallID: string;
|
|
28
|
+
claimantSessionId: string;
|
|
29
|
+
childSessionId: string;
|
|
30
|
+
claimRevision: number;
|
|
31
|
+
attempt: number;
|
|
32
|
+
leaseExpiresAt: number;
|
|
33
|
+
claimTokenDigest: string;
|
|
34
|
+
claimedAt: number;
|
|
35
|
+
}
|
|
36
|
+
export interface WorktreeRecoveryAuthorityRecord {
|
|
37
|
+
schemaVersion: 2;
|
|
38
|
+
authorityDigest: string;
|
|
39
|
+
immutable: WorktreeRecoveryImmutableIdentity;
|
|
40
|
+
status: WorktreeRecoveryStatus;
|
|
41
|
+
claim?: WorktreeRecoveryClaimState;
|
|
42
|
+
claimCursor?: {
|
|
43
|
+
lastClaimRevision: number;
|
|
44
|
+
lastAttempt: number;
|
|
45
|
+
};
|
|
46
|
+
finalizedAt?: number;
|
|
47
|
+
settlement?: {
|
|
48
|
+
sourceCommitOrder: string[];
|
|
49
|
+
rewrittenCommitOrder: string[];
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
interface WorktreeRecoveryStore {
|
|
53
|
+
schemaVersion: 2;
|
|
54
|
+
authorities: WorktreeRecoveryAuthorityRecord[];
|
|
55
|
+
index: {
|
|
56
|
+
bySessionTask: Record<string, string[]>;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface WorktreeRecoveryClaimJournalEntry {
|
|
60
|
+
schemaVersion: 1;
|
|
61
|
+
authorityDigest: string;
|
|
62
|
+
state: WorktreeRecoveryJournalState;
|
|
63
|
+
claimantCallID: string;
|
|
64
|
+
claimantSessionId: string;
|
|
65
|
+
childSessionId?: string;
|
|
66
|
+
claimRevision: number;
|
|
67
|
+
attempt: number;
|
|
68
|
+
leaseExpiresAt: number;
|
|
69
|
+
claimTokenDigest: string;
|
|
70
|
+
preparedAt: number;
|
|
71
|
+
credentialInstalledAt?: number;
|
|
72
|
+
committedAt?: number;
|
|
73
|
+
abortedAt?: number;
|
|
74
|
+
reason?: string;
|
|
75
|
+
}
|
|
76
|
+
interface WorktreeRecoveryClaimJournal {
|
|
77
|
+
schemaVersion: 1;
|
|
78
|
+
entries: WorktreeRecoveryClaimJournalEntry[];
|
|
79
|
+
}
|
|
80
|
+
interface WorktreeRecoveryCredential {
|
|
81
|
+
schemaVersion: 1;
|
|
82
|
+
authorityDigest: string;
|
|
83
|
+
claimantCallID: string;
|
|
84
|
+
claimantSessionId: string;
|
|
85
|
+
childSessionId: string;
|
|
86
|
+
claimRevision: number;
|
|
87
|
+
rawToken: string;
|
|
88
|
+
leaseExpiresAt: number;
|
|
89
|
+
createdAt: number;
|
|
90
|
+
}
|
|
91
|
+
type ScanStatus = 'ok' | 'unsupported-legacy' | 'uncertain';
|
|
92
|
+
export type WorktreeRecoveryScanResult = {
|
|
93
|
+
status: 'ok';
|
|
94
|
+
authorities: WorktreeRecoveryAuthorityRecord[];
|
|
95
|
+
} | {
|
|
96
|
+
status: 'unsupported-legacy';
|
|
97
|
+
reason: string;
|
|
98
|
+
} | {
|
|
99
|
+
status: 'uncertain';
|
|
100
|
+
reason: string;
|
|
101
|
+
};
|
|
102
|
+
export type WorktreeRecoveryLookupResult = {
|
|
103
|
+
status: 'ok';
|
|
104
|
+
authorities: WorktreeRecoveryAuthorityRecord[];
|
|
105
|
+
} | {
|
|
106
|
+
status: Exclude<ScanStatus, 'ok'>;
|
|
107
|
+
reason: string;
|
|
108
|
+
};
|
|
109
|
+
type BaseMutationFailureCode = 'not_found' | 'busy' | 'stale_claim' | 'retry_cap_exceeded' | 'revalidation_required' | 'revalidation_failed' | 'unsupported_legacy' | 'uncertain_store' | 'finalized';
|
|
110
|
+
type BaseMutationFailure = {
|
|
111
|
+
ok: false;
|
|
112
|
+
code: BaseMutationFailureCode;
|
|
113
|
+
reason: string;
|
|
114
|
+
};
|
|
115
|
+
export type PublishWorktreeRecoveryAuthorityResult = {
|
|
116
|
+
ok: true;
|
|
117
|
+
authority: WorktreeRecoveryAuthorityRecord;
|
|
118
|
+
} | BaseMutationFailure;
|
|
119
|
+
export type ClaimWorktreeRecoveryAuthorityResult = {
|
|
120
|
+
ok: true;
|
|
121
|
+
authority: WorktreeRecoveryAuthorityRecord;
|
|
122
|
+
rawToken: string;
|
|
123
|
+
credentialPath: string;
|
|
124
|
+
} | BaseMutationFailure;
|
|
125
|
+
export type MutateWorktreeRecoveryClaimResult = {
|
|
126
|
+
ok: true;
|
|
127
|
+
authority: WorktreeRecoveryAuthorityRecord;
|
|
128
|
+
} | BaseMutationFailure;
|
|
129
|
+
export interface ClaimWorktreeRecoveryAuthorityRequest {
|
|
130
|
+
authorityDigest: string;
|
|
131
|
+
claimantCallID: string;
|
|
132
|
+
claimantSessionId: string;
|
|
133
|
+
now?: number;
|
|
134
|
+
leaseMs: number;
|
|
135
|
+
maxAttempts?: number;
|
|
136
|
+
createChildSession: () => string | Promise<string>;
|
|
137
|
+
revalidateExpiredClaim?: (args: {
|
|
138
|
+
authority: WorktreeRecoveryAuthorityRecord;
|
|
139
|
+
previousClaim: WorktreeRecoveryClaimState;
|
|
140
|
+
}) => {
|
|
141
|
+
ok: true;
|
|
142
|
+
} | {
|
|
143
|
+
ok: false;
|
|
144
|
+
reason: string;
|
|
145
|
+
} | Promise<{
|
|
146
|
+
ok: true;
|
|
147
|
+
} | {
|
|
148
|
+
ok: false;
|
|
149
|
+
reason: string;
|
|
150
|
+
}>;
|
|
151
|
+
}
|
|
152
|
+
interface ExactClaimMutationRequest {
|
|
153
|
+
authorityDigest: string;
|
|
154
|
+
claimantCallID: string;
|
|
155
|
+
claimRevision: number;
|
|
156
|
+
rawToken: string;
|
|
157
|
+
now?: number;
|
|
158
|
+
}
|
|
159
|
+
export interface FinalizeWorktreeRecoveryAuthorityRequest extends ExactClaimMutationRequest {
|
|
160
|
+
settlement?: {
|
|
161
|
+
sourceCommitOrder: string[];
|
|
162
|
+
rewrittenCommitOrder: string[];
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export interface ReplayPreparedClaimOptions {
|
|
166
|
+
onAbortPreparedClaim?: (entry: WorktreeRecoveryClaimJournalEntry) => void;
|
|
167
|
+
}
|
|
168
|
+
export interface ReplayPreparedClaimOutcome {
|
|
169
|
+
authorityDigest: string;
|
|
170
|
+
outcome: 'aborted_prepared_claim' | 'removed_uncommitted_credential' | 'committed_claim_stable' | 'released_orphaned_committed_claim' | 'repaired_terminal_claim' | 'uncertain_committed_without_authority' | 'noop';
|
|
171
|
+
}
|
|
172
|
+
declare function storePath(directory: string): string;
|
|
173
|
+
declare function journalPath(directory: string): string;
|
|
174
|
+
declare function credentialPath(directory: string, authorityDigest: string): string;
|
|
175
|
+
declare function acquireAuthorityLock(directory: string): (() => void) | undefined;
|
|
176
|
+
export declare function publishWorktreeRecoveryAuthority(directory: string, input: WorktreeRecoveryImmutableIdentityInput): PublishWorktreeRecoveryAuthorityResult;
|
|
177
|
+
export declare function scanWorktreeRecoveryAuthoritiesForRecovery(directory: string): WorktreeRecoveryScanResult;
|
|
178
|
+
export declare function lookupWorktreeRecoveryAuthoritiesByTask(directory: string, query: {
|
|
179
|
+
parentSessionId: string;
|
|
180
|
+
taskId: string;
|
|
181
|
+
}): WorktreeRecoveryLookupResult;
|
|
182
|
+
export declare function claimWorktreeRecoveryAuthority(directory: string, request: ClaimWorktreeRecoveryAuthorityRequest): Promise<ClaimWorktreeRecoveryAuthorityResult>;
|
|
183
|
+
export declare function renewWorktreeRecoveryClaim(directory: string, request: ExactClaimMutationRequest & {
|
|
184
|
+
leaseMs: number;
|
|
185
|
+
}): MutateWorktreeRecoveryClaimResult;
|
|
186
|
+
export declare function releaseWorktreeRecoveryClaim(directory: string, request: ExactClaimMutationRequest): MutateWorktreeRecoveryClaimResult;
|
|
187
|
+
export declare function finalizeWorktreeRecoveryAuthority(directory: string, request: FinalizeWorktreeRecoveryAuthorityRequest): MutateWorktreeRecoveryClaimResult;
|
|
188
|
+
export declare function replayWorktreeRecoveryClaimJournal(directory: string, options?: ReplayPreparedClaimOptions): ReplayPreparedClaimOutcome[];
|
|
189
|
+
export declare const _internals: {
|
|
190
|
+
generateRawToken: () => string;
|
|
191
|
+
writeRecoveryStore: (targetPath: string, store: WorktreeRecoveryStore, _phase: "publish" | "claim-commit" | "claim-renew" | "claim-release" | "claim-finalize") => void;
|
|
192
|
+
writeClaimJournal: (targetPath: string, journal: WorktreeRecoveryClaimJournal) => void;
|
|
193
|
+
writeCredentialFile: (targetPath: string, credential: WorktreeRecoveryCredential) => void;
|
|
194
|
+
getRecoveryStorePath: typeof storePath;
|
|
195
|
+
getClaimJournalPath: typeof journalPath;
|
|
196
|
+
getCredentialPath: typeof credentialPath;
|
|
197
|
+
acquireAuthorityLock: typeof acquireAuthorityLock;
|
|
198
|
+
readClaimJournal(directory: string): WorktreeRecoveryClaimJournal;
|
|
199
|
+
resetForTest(): void;
|
|
200
|
+
};
|
|
201
|
+
export {};
|
|
@@ -21,7 +21,8 @@ import { isLocked, listActiveLocks, tryAcquireLock } from '../parallel/file-lock
|
|
|
21
21
|
import { removeWorktree } from '../worktree/core';
|
|
22
22
|
import { scanRegisteredWorktreeLiveness } from '../worktree/merge';
|
|
23
23
|
import { scanWorktreeMergeFailuresForRecovery } from './delegation-gate/worktree-merge-status';
|
|
24
|
-
import { removeWorktreeProvisioningOwner, scanWorktreeProvisioningOwnersForRecovery } from './delegation-gate/worktree-provisioning-owner';
|
|
24
|
+
import { removeWorktreeProvisioningOwner, scanWorktreeProvisioningLifecycleJournalForRecovery, scanWorktreeProvisioningOwnersForRecovery } from './delegation-gate/worktree-provisioning-owner';
|
|
25
|
+
import { replayWorktreeRecoveryClaimJournal, scanWorktreeRecoveryAuthoritiesForRecovery } from './delegation-gate/worktree-recovery-authority';
|
|
25
26
|
type OwnershipTagSessionScan = {
|
|
26
27
|
status: 'ok';
|
|
27
28
|
sessionIds: string[];
|
|
@@ -51,7 +52,10 @@ export declare const _internals: {
|
|
|
51
52
|
recordDelegationRecoveryObservation: typeof recordDelegationRecoveryObservation;
|
|
52
53
|
scanDelegationFallbacksForRecovery: typeof scanDelegationFallbacksForRecovery;
|
|
53
54
|
scanWorktreeMergeFailuresForRecovery: typeof scanWorktreeMergeFailuresForRecovery;
|
|
55
|
+
scanWorktreeRecoveryAuthoritiesForRecovery: typeof scanWorktreeRecoveryAuthoritiesForRecovery;
|
|
56
|
+
replayWorktreeRecoveryClaimJournal: typeof replayWorktreeRecoveryClaimJournal;
|
|
54
57
|
scanWorktreeProvisioningOwnersForRecovery: typeof scanWorktreeProvisioningOwnersForRecovery;
|
|
58
|
+
scanWorktreeProvisioningLifecycleJournalForRecovery: typeof scanWorktreeProvisioningLifecycleJournalForRecovery;
|
|
55
59
|
scanRegisteredWorktreeLiveness: typeof scanRegisteredWorktreeLiveness;
|
|
56
60
|
removeWorktreeProvisioningOwner: typeof removeWorktreeProvisioningOwner;
|
|
57
61
|
};
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export interface TrajectoryConfig {
|
|
11
11
|
enabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Line budget for BOTH the session store's in-memory cache trim AND its
|
|
14
|
+
* on-disk compaction (issue #2041): over budget, the newest
|
|
15
|
+
* floor(max_lines/2) entries are retained on disk and in cache, and the
|
|
16
|
+
* derived byte ceiling is sovereign. The task-evidence copy below uses the
|
|
17
|
+
* same value for its own write-side truncation.
|
|
18
|
+
*/
|
|
12
19
|
max_lines: number;
|
|
13
20
|
}
|
|
14
21
|
export interface TrajectoryEntry {
|
|
@@ -64,8 +71,8 @@ declare function extractTarget(tool: string, args?: Record<string, unknown>): st
|
|
|
64
71
|
/**
|
|
65
72
|
* Creates the trajectory logger hook pair.
|
|
66
73
|
*
|
|
67
|
-
* @param config - TrajectoryConfig { enabled: boolean (default true), max_lines: number (default 500) }
|
|
68
|
-
* @param _directory -
|
|
74
|
+
* @param config - TrajectoryConfig { enabled: boolean (default true), max_lines: number (default 500) — bounds the session store's cache AND disk compaction plus the task-evidence truncation }
|
|
75
|
+
* @param _directory - Workspace root (session store + evidence paths derive from it)
|
|
69
76
|
* @returns Object with toolAfter handler
|
|
70
77
|
*/
|
|
71
78
|
export declare function createTrajectoryLoggerHook(config: Partial<TrajectoryConfig>, _directory: string): {
|
|
@@ -90,8 +97,9 @@ export declare function createTrajectoryLoggerHook(config: Partial<TrajectoryCon
|
|
|
90
97
|
* the record of it.
|
|
91
98
|
*
|
|
92
99
|
* Contract:
|
|
93
|
-
* - The step is minted with the SHARED `nextTrajectoryStep(sessionId)
|
|
94
|
-
*
|
|
100
|
+
* - The step is minted with the SHARED `nextTrajectoryStep(sessionId, directory)`
|
|
101
|
+
* (seeded from the persisted high-water mark — see ensureSessionStepSeeded).
|
|
102
|
+
* Any private counter would desynchronise the `prmTrajectoryStep` window and
|
|
95
103
|
* silently break PRM's step-range filtering.
|
|
96
104
|
* - `session.delegationActive` gates recording at all (the architect session
|
|
97
105
|
* is deliberately out of scope); the task-evidence copy additionally
|
|
@@ -117,13 +125,18 @@ export declare function recordDeniedToolCall(sessionID: string, input: {
|
|
|
117
125
|
export declare function clearDeniedCallMarkers(): void;
|
|
118
126
|
/**
|
|
119
127
|
* Resets the step counter for a session. Called when a new session starts
|
|
120
|
-
* or when trajectory tracking should restart from step 1.
|
|
128
|
+
* or when trajectory tracking should restart from step 1. The restart-seed
|
|
129
|
+
* gate is invalidated so the next mint re-seeds from the persisted
|
|
130
|
+
* high-water mark (issue #2041 monotonicity).
|
|
121
131
|
*
|
|
122
132
|
* @param sessionId - Session identifier
|
|
133
|
+
* @param directory - Workspace root owning the session's trajectory store
|
|
123
134
|
*/
|
|
124
|
-
export declare function resetTrajectoryStep(sessionId: string): void;
|
|
135
|
+
export declare function resetTrajectoryStep(sessionId: string, directory?: string): void;
|
|
125
136
|
/**
|
|
126
137
|
* Clears trajectory step counters for one session, or all sessions when omitted.
|
|
138
|
+
* The restart-seed gate is invalidated alongside so a cleared session re-seeds
|
|
139
|
+
* from disk on its next mint (issue #2041 monotonicity).
|
|
127
140
|
*
|
|
128
141
|
* @param sessionId - Optional session identifier
|
|
129
142
|
*/
|
|
@@ -140,6 +153,7 @@ export declare function recordToolCallStart(sessionId: string, callID: string, s
|
|
|
140
153
|
/**
|
|
141
154
|
* Tier-0 pure-function test seam (writing-tests skill). These helpers take no
|
|
142
155
|
* external dependencies, so testing them directly needs no mocks at all.
|
|
156
|
+
* The seed-gate accessors cover the restart-seeding state machine (issue #2041).
|
|
143
157
|
*/
|
|
144
158
|
export declare const _test_exports: {
|
|
145
159
|
readonly deriveAction: typeof deriveAction;
|
|
@@ -147,5 +161,7 @@ export declare const _test_exports: {
|
|
|
147
161
|
readonly MAX_DENIED_CALL_MARKERS: 500;
|
|
148
162
|
readonly DENIED_CALL_TTL_MS: number;
|
|
149
163
|
readonly deniedCallMarkerCount: () => number;
|
|
164
|
+
readonly stepSeedGateSize: () => number;
|
|
165
|
+
readonly clearStepSeedGate: () => void;
|
|
150
166
|
};
|
|
151
167
|
export {};
|
|
@@ -1,11 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Module-level trajectory step counters shared by runtime reset code and the
|
|
3
3
|
* trajectory logger without creating a state <-> hook import cycle.
|
|
4
|
+
*
|
|
5
|
+
* Keys are canonical-root + session id (issue #2041 Required 6): the counters
|
|
6
|
+
* are process-global module state, so a host that loads one plugin module
|
|
7
|
+
* instance for several project roots must not let two roots' sessions with
|
|
8
|
+
* the same host session id share a counter — nor let two aliases of one root
|
|
9
|
+
* diverge. The shared `src/utils/canonical-root.ts` helper owns the keying so
|
|
10
|
+
* the trajectory store, these counters, and the logger's restart-seed gate
|
|
11
|
+
* cannot drift. `directory` is required on the minting/seed path; the clear
|
|
12
|
+
* paths may omit it and suffix-scan every root, because the reset entry
|
|
13
|
+
* points legitimately lack a directory.
|
|
14
|
+
*/
|
|
15
|
+
/** Current step-counter generation (changes on every clear/reset). */
|
|
16
|
+
export declare function trajectoryStepGeneration(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Mints the next sequential step for a session. Restart continuity is the
|
|
19
|
+
* logger's job (`ensureSessionStepSeeded` in trajectory-logger.ts seeds the
|
|
20
|
+
* counter from the bounded store before the first mint), not this counter's.
|
|
21
|
+
*/
|
|
22
|
+
export declare function nextTrajectoryStep(sessionId: string, directory: string): number;
|
|
23
|
+
/**
|
|
24
|
+
* Raises a session's counter to `step` when it is higher than the current
|
|
25
|
+
* value. Used by the restart-seed path so a resumed session continues minting
|
|
26
|
+
* monotonically after the on-disk high-water mark instead of restarting at 1
|
|
27
|
+
* (which would duplicate step numbers against the persisted trajectory).
|
|
28
|
+
* A lower value never lowers the counter (issue #2041 monotonicity).
|
|
29
|
+
*/
|
|
30
|
+
export declare function seedTrajectoryStepCounter(sessionId: string, directory: string, step: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Resets the step counter for a session to zero (module-level semantics —
|
|
33
|
+
* "restart at step one"). The production reset entry points go through
|
|
34
|
+
* trajectory-logger.ts, which also invalidates the per-process restart-seed
|
|
35
|
+
* gate so the next mint re-seeds from disk and steps stay monotonic against
|
|
36
|
+
* the persisted trajectory.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resetTrajectoryStepCounter(sessionId: string, directory: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clears trajectory step counters for one session (every canonical root — the
|
|
41
|
+
* reset entry points legitimately lack a directory), or all sessions when
|
|
42
|
+
* omitted.
|
|
4
43
|
*/
|
|
5
|
-
export declare function nextTrajectoryStep(sessionId: string): number;
|
|
6
|
-
export declare function resetTrajectoryStepCounter(sessionId: string): void;
|
|
7
44
|
export declare function clearTrajectoryStepCounters(sessionId?: string): void;
|
|
8
45
|
export declare const _test_exports: {
|
|
9
46
|
MAX_TRACKED_STEP_SESSIONS: number;
|
|
10
47
|
getTrackedStepSessionCount: () => number;
|
|
48
|
+
/** Whether a counter exists for this session+root in this process. */
|
|
49
|
+
hasTrajectoryStepCounter: (sessionId: string, directory: string) => boolean;
|
|
50
|
+
/** Current generation (test seam: gate-invalidation assertions). */
|
|
51
|
+
getStepCounterGeneration: () => number;
|
|
11
52
|
};
|