@tomflow/chatloop-context 0.6.37 → 0.6.39
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 +1 -1
- package/lib/core/health.mjs +17 -8
- package/lib/core/run-cancel.mjs +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ accepts `permit.status` (the exact original Task + actionToken, returning
|
|
|
110
110
|
bounded recorded kind/approval revision) and
|
|
111
111
|
`run.idleStartPermitStatus` (whether the **only** permit in that Task is
|
|
112
112
|
the consumed original START permit). The latter is preliminary evidence:
|
|
113
|
-
`run.fence.cancel` repeats the same original START-only Permit check inside
|
|
113
|
+
`run.fence.cancel` preserves Stage 03 progress/audit notes; the absence of any execution Permit or unknown effect, not an empty text progress array, is the idle proof. It repeats the same original START-only Permit check inside
|
|
114
114
|
**its own SQLite transaction**, so a concurrent CONTINUE/HANDOFF reservation
|
|
115
115
|
cannot slip between the read and cancellation commit. V2 Context reads
|
|
116
116
|
also supply the fixed `storeEpoch` and current Project/R/P writer checks.
|
package/lib/core/health.mjs
CHANGED
|
@@ -87,17 +87,26 @@ export function createHealthMethods(values) {
|
|
|
87
87
|
&&/^[a-f0-9]{32}$/.test(startActionToken),
|
|
88
88
|
'START_PERMIT_TOKEN_INVALID');
|
|
89
89
|
return readSnapshot(()=>{
|
|
90
|
-
required(projectId,taskId);
|
|
90
|
+
const r=required(projectId,taskId),c=parse(r.context_json);
|
|
91
91
|
const permits=db.prepare(
|
|
92
92
|
'SELECT action_token,kind FROM permits WHERE project_id=? AND task_id=?'
|
|
93
93
|
).all(projectId,taskId);
|
|
94
|
-
// BindInitial preserves a USED tombstone.
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
// BindInitial preserves a USED tombstone. Stage 03 progress text is
|
|
95
|
+
// audit evidence, not an execution permit. Actual unknown effects,
|
|
96
|
+
// delivery, pending work and the current writer remain hard gates.
|
|
97
|
+
const startOnly=permits.length===1
|
|
98
|
+
&&permits[0].action_token===startActionToken
|
|
99
|
+
&&permits[0].kind==='USED';
|
|
100
|
+
if(startOnly)ensureNoPendingIssue(projectId,taskId);
|
|
101
|
+
const cancelEligible=startOnly&&r.writable_ref!==null
|
|
102
|
+
&&r.pending_attempt===null&&r.pending_checkpoint===null
|
|
103
|
+
&&r.writer_approval_revision===r.approval_revision
|
|
104
|
+
&&!projectDrift(r).projectDrift
|
|
105
|
+
&&c.stage==='DRAFT'&&c.executionOutcome!=='DONE'
|
|
106
|
+
&&!c.deliveryRef&&!c.sessionCancellation
|
|
107
|
+
&&Array.isArray(c.progress)&&Array.isArray(c.blockers)
|
|
108
|
+
&&unresolvedEffects(c).length===0;
|
|
109
|
+
return {projectId,taskId,startOnly,cancelEligible};
|
|
101
110
|
});
|
|
102
111
|
},
|
|
103
112
|
permitStatus(projectId,taskId,actionToken){
|
package/lib/core/run-cancel.mjs
CHANGED
|
@@ -15,6 +15,7 @@ export function createCancelMethods(values){
|
|
|
15
15
|
&&a.runRef===a.sessionId+':'+a.taskId+':'+a.generation,
|
|
16
16
|
'RUN_REF_MISMATCH');
|
|
17
17
|
assert(!r.pending_attempt,'HANDOFF_PENDING');
|
|
18
|
+
assert(r.pending_checkpoint===null,'CHECKPOINT_PENDING');
|
|
18
19
|
if(a.scopedStartActionToken!==undefined){
|
|
19
20
|
// V2 idle Cancel must prove IN THIS SAME Context transaction that
|
|
20
21
|
// no Continue/Handoff permit was ever consumed or reserved. The
|
|
@@ -39,7 +40,12 @@ export function createCancelMethods(values){
|
|
|
39
40
|
const context=parse(r.context_json);
|
|
40
41
|
assert(context.stage==='DRAFT'&&context.executionOutcome!=='DONE'
|
|
41
42
|
&&!context.deliveryRef&&!context.sessionCancellation
|
|
42
|
-
|
|
43
|
+
// Stage 03 may already have recorded R/P/preflight/Adopt evidence
|
|
44
|
+
// before START. progress is an audit narrative, not proof of a
|
|
45
|
+
// Continue/Handoff permit or browser send. Preserve it unchanged;
|
|
46
|
+
// the START-only permit, bounded Run and effect ledger are the
|
|
47
|
+
// actual no-execution gates.
|
|
48
|
+
&&Array.isArray(context.progress)
|
|
43
49
|
&&Array.isArray(context.blockers)
|
|
44
50
|
&&unresolvedEffects(context).length===0,
|
|
45
51
|
'IDLE_CANCEL_UNSAFE');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomflow/chatloop-context",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Independent local Context SDK and short-lived CLI for Chat Loop projects",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"ps-list": "9.0.0",
|
|
35
|
-
"@tomflow/chatloop-extension": "0.4.
|
|
35
|
+
"@tomflow/chatloop-extension": "0.4.43",
|
|
36
36
|
"@tomflow/chatloop-trace": "0.4.6"
|
|
37
37
|
}
|
|
38
38
|
}
|