kiokuko-dsh 0.2.21 → 0.2.22
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/dsh/clarification-context.d.ts +24 -0
- package/dist/dsh/clarification-context.d.ts.map +1 -0
- package/dist/dsh/clarification-context.js +31 -0
- package/dist/dsh/clarification-context.js.map +1 -0
- package/dist/dsh/coding-question.d.ts +26 -0
- package/dist/dsh/coding-question.d.ts.map +1 -0
- package/dist/dsh/coding-question.js +48 -0
- package/dist/dsh/coding-question.js.map +1 -0
- package/dist/dsh/coding-workflow/contracts.d.ts +2 -2
- package/dist/dsh/coding-workflow/host.d.ts +2 -4
- package/dist/dsh/coding-workflow/host.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/host.js +13 -29
- package/dist/dsh/coding-workflow/host.js.map +1 -1
- package/dist/dsh/coding-workflow/intent.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/intent.js +2 -1
- package/dist/dsh/coding-workflow/intent.js.map +1 -1
- package/dist/dsh/coding-workflow/service.d.ts +6 -6
- package/dist/dsh/coding-workflow/service.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/service.js +5 -3
- package/dist/dsh/coding-workflow/service.js.map +1 -1
- package/dist/dsh/guardrail/contracts.d.ts +33 -1
- package/dist/dsh/guardrail/contracts.d.ts.map +1 -1
- package/dist/dsh/guardrail/contracts.js +1 -1
- package/dist/dsh/guardrail/contracts.js.map +1 -1
- package/dist/dsh/guardrail/engine.d.ts +2 -0
- package/dist/dsh/guardrail/engine.d.ts.map +1 -1
- package/dist/dsh/guardrail/engine.js +18 -7
- package/dist/dsh/guardrail/engine.js.map +1 -1
- package/dist/dsh/guardrail/evidence.d.ts.map +1 -1
- package/dist/dsh/guardrail/evidence.js +29 -1
- package/dist/dsh/guardrail/evidence.js.map +1 -1
- package/dist/dsh/guardrail/service.d.ts +2 -0
- package/dist/dsh/guardrail/service.d.ts.map +1 -1
- package/dist/dsh/guardrail/service.js +44 -2
- package/dist/dsh/guardrail/service.js.map +1 -1
- package/dist/dsh/lisp/ci.d.ts +7 -0
- package/dist/dsh/lisp/ci.d.ts.map +1 -1
- package/dist/dsh/lisp/ci.js +27 -10
- package/dist/dsh/lisp/ci.js.map +1 -1
- package/dist/dsh/lisp/coding-choice.d.ts +2 -0
- package/dist/dsh/lisp/coding-choice.d.ts.map +1 -1
- package/dist/dsh/lisp/coding-choice.js +5 -1
- package/dist/dsh/lisp/coding-choice.js.map +1 -1
- package/dist/dsh/lisp/coding-preparation.d.ts +4 -5
- package/dist/dsh/lisp/coding-preparation.d.ts.map +1 -1
- package/dist/dsh/lisp/coding-preparation.js +57 -18
- package/dist/dsh/lisp/coding-preparation.js.map +1 -1
- package/dist/dsh/lisp/manager.d.ts +3 -0
- package/dist/dsh/lisp/manager.d.ts.map +1 -1
- package/dist/dsh/lisp/manager.js +114 -13
- package/dist/dsh/lisp/manager.js.map +1 -1
- package/dist/dsh/lisp/surface.d.ts.map +1 -1
- package/dist/dsh/lisp/surface.js +36 -18
- package/dist/dsh/lisp/surface.js.map +1 -1
- package/dist/dsh/lisp/worker.d.ts +10 -2
- package/dist/dsh/lisp/worker.d.ts.map +1 -1
- package/dist/dsh/lisp/worker.js +21 -11
- package/dist/dsh/lisp/worker.js.map +1 -1
- package/dist/dsh/managed-operation-journal.d.ts +115 -0
- package/dist/dsh/managed-operation-journal.d.ts.map +1 -0
- package/dist/dsh/managed-operation-journal.js +336 -0
- package/dist/dsh/managed-operation-journal.js.map +1 -0
- package/dist/dsh/managed-operation-runner.d.ts +33 -0
- package/dist/dsh/managed-operation-runner.d.ts.map +1 -0
- package/dist/dsh/managed-operation-runner.js +104 -0
- package/dist/dsh/managed-operation-runner.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-adapter.d.ts.map +1 -1
- package/dist/dsh/models/vendor/opencode-adapter.js +2 -0
- package/dist/dsh/models/vendor/opencode-adapter.js.map +1 -1
- package/dist/dsh/on-demand-intake.d.ts +5 -0
- package/dist/dsh/on-demand-intake.d.ts.map +1 -1
- package/dist/dsh/on-demand-intake.js +30 -8
- package/dist/dsh/on-demand-intake.js.map +1 -1
- package/dist/dsh/owned-execution.d.ts +2 -0
- package/dist/dsh/owned-execution.d.ts.map +1 -1
- package/dist/dsh/owned-execution.js +242 -110
- package/dist/dsh/owned-execution.js.map +1 -1
- package/dist/dsh/request-interpretation-guidance.d.ts +26 -0
- package/dist/dsh/request-interpretation-guidance.d.ts.map +1 -0
- package/dist/dsh/request-interpretation-guidance.js +35 -0
- package/dist/dsh/request-interpretation-guidance.js.map +1 -0
- package/dist/dsh/task-completion-guidance.d.ts +25 -0
- package/dist/dsh/task-completion-guidance.d.ts.map +1 -0
- package/dist/dsh/task-completion-guidance.js +36 -0
- package/dist/dsh/task-completion-guidance.js.map +1 -0
- package/dist/dsh/task-completion-host.d.ts.map +1 -1
- package/dist/dsh/task-completion-host.js +17 -7
- package/dist/dsh/task-completion-host.js.map +1 -1
- package/dist/dsh/task-completion.d.ts +26 -2
- package/dist/dsh/task-completion.d.ts.map +1 -1
- package/dist/dsh/task-completion.js +27 -13
- package/dist/dsh/task-completion.js.map +1 -1
- package/dist/enno-oduno/coding-workflow.d.ts +1 -1
- package/dist/locale/en.json +1 -1
- package/dist/locale/ja.json +1 -1
- package/dist/locale/ko.json +1 -1
- package/dist/locale/zh-CN.json +1 -1
- package/docs/guardrail.md +11 -4
- package/docs/lisp-prototype-planning.md +1 -1
- package/docs/lisp.md +1 -1
- package/docs/managed-operation-journal.md +21 -0
- package/guardrail/aarch64-apple-darwin/kiokuko-guardrail +0 -0
- package/guardrail/aarch64-apple-darwin/manifest.json +14 -18
- package/guardrail/aarch64-unknown-linux-musl/kiokuko-guardrail +0 -0
- package/guardrail/aarch64-unknown-linux-musl/manifest.json +14 -16
- package/guardrail/build-records.json +198 -0
- package/guardrail/manifest.json +25 -137
- package/guardrail/x86_64-unknown-linux-musl/kiokuko-guardrail +0 -0
- package/guardrail/x86_64-unknown-linux-musl/manifest.json +14 -15
- package/migrations/047_managed_operation_journal.sql +21 -0
- package/package.json +2 -2
- package/scripts/guardrail-artifacts.d.mts +3 -0
- package/scripts/guardrail-artifacts.mjs +34 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { codingIntent, codingContinuation } from '../coding-workflow/intent.js';
|
|
3
|
-
|
|
3
|
+
import { LispCodingCancelled } from '../coding-question.js';
|
|
4
|
+
export const LISP_PROTOTYPE_GUIDANCE = 'Prefer Lisp for useful calculations and transformations. A preliminary prototype is optional in ordinary development; use permitted existing tools directly when appropriate. Native permissions still apply. Never bypass a denial or automatically fall back after cancellation, timeout, unknown outcomes or partial effects. An explicitly protected coding workflow retains its own prototype and verification gates.';
|
|
5
|
+
const PROTECTED_PROTOTYPE_GUIDANCE = 'This protected workflow requires a small relevant lisp_eval prototype:true and complete saved-result inspection with lisp_inspect before implementation. Prototype success is not task completion. Two failures stop automatic prototype retries; repair the cause or explicitly disable Lisp. Ordinary read tools and conversation remain available; Bash still follows host permissions.';
|
|
4
6
|
/** A bounded request protocol. It does not grant native authority or classify arbitrary Lisp effects. */
|
|
5
7
|
export class LispCodingPreparation {
|
|
6
8
|
host;
|
|
@@ -29,22 +31,37 @@ export class LispCodingPreparation {
|
|
|
29
31
|
const key = createHash('sha256').update(JSON.stringify([identity, input.turn, input.task])).digest('hex');
|
|
30
32
|
if (previous?.key === key) {
|
|
31
33
|
await previous.pending;
|
|
34
|
+
if (previous.phase === 'cancelled')
|
|
35
|
+
throw new LispCodingCancelled();
|
|
36
|
+
if (previous.phase === 'unavailable')
|
|
37
|
+
throw new Error(previous.reason);
|
|
32
38
|
return;
|
|
33
39
|
}
|
|
34
|
-
const state = { agent: input.agent, ...identity, task: input.task, key, phase: 'choice_pending', attempts: 0, failures: 0 };
|
|
40
|
+
const state = { agent: input.agent, ...identity, task: input.task, key, protectedWorkflow: false, phase: 'choice_pending', attempts: 0, failures: 0 };
|
|
35
41
|
this.states.set(input.agent, state);
|
|
36
42
|
state.pending = (async () => {
|
|
37
|
-
const
|
|
38
|
-
|
|
43
|
+
const manualSelected = this.host.selected ? await this.host.selected(input.agent) : this.host.enabled(input.agent);
|
|
44
|
+
if (this.current(input.agent) !== state || state.key !== key || input.signal.aborted)
|
|
45
|
+
throw new LispCodingCancelled('Lisp coding request changed before its choice');
|
|
46
|
+
const selected = manualSelected
|
|
47
|
+
? { status: 'answered', choice: 'yes', answerRef: `enabled-session:${identity.sessionId}:${key}` }
|
|
39
48
|
: await this.host.choose(input);
|
|
40
|
-
input.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
if (this.current(input.agent) !== state || state.key !== key)
|
|
50
|
+
throw new LispCodingCancelled('Lisp coding request changed while awaiting its choice');
|
|
51
|
+
if (input.signal.aborted || selected.status === 'cancelled') {
|
|
52
|
+
state.phase = 'cancelled';
|
|
53
|
+
throw new LispCodingCancelled();
|
|
54
|
+
}
|
|
55
|
+
if (selected.status === 'pending')
|
|
44
56
|
return;
|
|
57
|
+
if (selected.status === 'unavailable') {
|
|
58
|
+
state.phase = 'unavailable';
|
|
59
|
+
state.reason = selected.reason;
|
|
60
|
+
throw new Error(selected.reason);
|
|
61
|
+
}
|
|
45
62
|
state.choice = selected.choice;
|
|
46
63
|
state.answerRef = selected.answerRef;
|
|
47
|
-
state.phase = selected.choice === 'yes' ? '
|
|
64
|
+
state.phase = selected.choice === 'yes' ? 'selected' : 'declined';
|
|
48
65
|
if (selected.choice === 'yes')
|
|
49
66
|
await this.host.activate(input.agent);
|
|
50
67
|
else
|
|
@@ -53,6 +70,13 @@ export class LispCodingPreparation {
|
|
|
53
70
|
try {
|
|
54
71
|
await state.pending;
|
|
55
72
|
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (this.current(input.agent) === state && state.key === key && state.phase === 'choice_pending') {
|
|
75
|
+
state.phase = input.signal.aborted ? 'cancelled' : 'unavailable';
|
|
76
|
+
state.reason = error instanceof Error ? error.message : String(error);
|
|
77
|
+
}
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
56
80
|
finally {
|
|
57
81
|
delete state.pending;
|
|
58
82
|
}
|
|
@@ -65,11 +89,13 @@ export class LispCodingPreparation {
|
|
|
65
89
|
let state = this.current(agent);
|
|
66
90
|
if (!state || state.task !== task || state.answerRef && state.answerRef !== answerRef) {
|
|
67
91
|
const identity = this.host.identity(agent), key = createHash('sha256').update(JSON.stringify([identity, task, answerRef])).digest('hex');
|
|
68
|
-
state = { agent, ...identity, task, key, phase: 'choice_pending', attempts: 0, failures: 0 };
|
|
92
|
+
state = { agent, ...identity, task, key, protectedWorkflow: true, phase: 'choice_pending', attempts: 0, failures: 0 };
|
|
69
93
|
this.states.set(agent, state);
|
|
70
94
|
}
|
|
71
|
-
if (state.choice === choice)
|
|
95
|
+
if (state.choice === choice && state.protectedWorkflow)
|
|
72
96
|
return;
|
|
97
|
+
state.key = createHash('sha256').update(JSON.stringify([state.key, task, answerRef, 'protected'])).digest('hex');
|
|
98
|
+
state.protectedWorkflow = true;
|
|
73
99
|
state.choice = choice;
|
|
74
100
|
state.answerRef = answerRef;
|
|
75
101
|
state.phase = choice === 'yes' ? 'prototype_required' : 'declined';
|
|
@@ -79,35 +105,48 @@ export class LispCodingPreparation {
|
|
|
79
105
|
}
|
|
80
106
|
manual(agent, enabled, answerRef) {
|
|
81
107
|
const state = this.current(agent);
|
|
82
|
-
if (!state)
|
|
108
|
+
if (!state || state.phase === 'cancelled')
|
|
83
109
|
return;
|
|
84
110
|
state.key = createHash('sha256').update(JSON.stringify([state.key, enabled, answerRef ?? randomUUID()])).digest('hex');
|
|
85
111
|
state.choice = enabled ? 'yes' : 'no';
|
|
86
112
|
state.answerRef = answerRef ?? `human-command:${state.key}:${enabled}`;
|
|
87
|
-
state.phase = enabled ? 'prototype_required' : 'declined';
|
|
113
|
+
state.phase = enabled ? (state.protectedWorkflow ? 'prototype_required' : 'selected') : 'declined';
|
|
88
114
|
state.attempts = 0;
|
|
89
115
|
state.failures = 0;
|
|
90
116
|
delete state.operationId;
|
|
91
117
|
}
|
|
118
|
+
cancelled(agent, task) {
|
|
119
|
+
const state = this.current(agent);
|
|
120
|
+
if (state?.task === task) {
|
|
121
|
+
state.key = randomUUID();
|
|
122
|
+
state.phase = 'cancelled';
|
|
123
|
+
delete state.choice;
|
|
124
|
+
delete state.answerRef;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
92
127
|
binding(agent) { return this.current(agent)?.key; }
|
|
93
128
|
status(agent) {
|
|
94
129
|
const state = this.current(agent);
|
|
95
|
-
return state ? { phase: state.phase, attempts: state.attempts, failures: state.failures, operationId: state.operationId, verified: state.phase === 'reviewed', guidance: state.phase === 'declined' ? 'Use ordinary tools; do not reopen Lisp for this request.' : state.phase === 'reviewed' ? 'The prototype was inspected. Implement and verify separately; this is not task completion.' : state.phase === 'choice_pending' ? 'Await the human Lisp choice; reads and conversation remain available.' : LISP_PROTOTYPE_GUIDANCE } : { phase: 'not_applicable', verified: false };
|
|
130
|
+
return state ? { phase: state.phase, attempts: state.attempts, failures: state.failures, operationId: state.operationId, verified: state.phase === 'reviewed', guidance: state.phase === 'cancelled' ? 'Implementation attempt cancelled; work retained. Do not automatically retry or switch tools.' : state.phase === 'unavailable' ? `Question unavailable: ${state.reason}` : state.phase === 'selected' ? LISP_PROTOTYPE_GUIDANCE : state.phase === 'declined' ? 'Use ordinary tools; do not reopen Lisp for this request.' : state.phase === 'reviewed' ? 'The prototype was inspected. Implement and verify separately; this is not task completion.' : state.phase === 'choice_pending' ? 'Await the human Lisp choice; reads and conversation remain available.' : state.protectedWorkflow ? PROTECTED_PROTOTYPE_GUIDANCE : LISP_PROTOTYPE_GUIDANCE } : { phase: 'not_applicable', verified: false };
|
|
96
131
|
}
|
|
97
132
|
denial(agent, name, args, parent) {
|
|
98
133
|
const state = this.current(agent);
|
|
99
134
|
if (!state || parent !== undefined || state.choice === 'no' || state.phase === 'reviewed')
|
|
100
135
|
return;
|
|
101
136
|
const effect = ['bash', 'zsh', 'exec', 'run_code', 'write', 'edit', 'delete', 'remove', 'kioku_write', 'kioku_edit', 'kioku_remove', 'kioku_exec', 'lisp_eval', 'lisp_apply', 'lisp_call', 'lisp_hot_call'].includes(name);
|
|
137
|
+
if (state.phase === 'cancelled')
|
|
138
|
+
return effect ? 'LISP_REQUEST_CANCELLED: this implementation attempt stopped. Do not retry or switch tools; a new explicit implementation request is required.' : undefined;
|
|
139
|
+
if (state.phase === 'unavailable')
|
|
140
|
+
return effect ? `LISP_CHOICE_UNAVAILABLE: ${state.reason}` : undefined;
|
|
102
141
|
if (state.phase === 'choice_pending')
|
|
103
|
-
return effect ? 'LISP_CHOICE_PENDING: answer the Lisp choice or explicitly use /kioku-lisp enable or disable.
|
|
104
|
-
if (!this.host.enabled(agent))
|
|
142
|
+
return effect ? 'LISP_CHOICE_PENDING: answer the Lisp choice or explicitly use /kioku-lisp enable or disable. Ordinary read tools and conversation remain available; Bash follows host permissions.' : undefined;
|
|
143
|
+
if (!state.protectedWorkflow || !this.host.enabled(agent))
|
|
105
144
|
return;
|
|
106
145
|
if (name === 'lisp_eval' && args?.prototype === true) {
|
|
107
146
|
return state.failures >= 2 ? 'LISP_PROTOTYPE_FAILED: two attempts failed; repair the cause or explicitly disable Lisp.' : undefined;
|
|
108
147
|
}
|
|
109
148
|
if (effect)
|
|
110
|
-
return `LISP_PROTOTYPE_REQUIRED: ${state.phase}. ${
|
|
149
|
+
return `LISP_PROTOTYPE_REQUIRED: ${state.phase}. ${PROTECTED_PROTOTYPE_GUIDANCE}`;
|
|
111
150
|
}
|
|
112
151
|
observed(agent, name, args, result, requestKey) {
|
|
113
152
|
const state = this.current(agent);
|
|
@@ -121,7 +160,7 @@ export class LispCodingPreparation {
|
|
|
121
160
|
}
|
|
122
161
|
else {
|
|
123
162
|
state.failures++;
|
|
124
|
-
state.phase = state.failures >= 2 ? 'failed' : 'prototype_required';
|
|
163
|
+
state.phase = state.protectedWorkflow ? (state.failures >= 2 ? 'failed' : 'prototype_required') : 'selected';
|
|
125
164
|
}
|
|
126
165
|
}
|
|
127
166
|
if (name === 'lisp_inspect' && state.phase === 'result_pending' && args.resultOperationId === state.operationId && args.section === 'result' && args.pointer === undefined && (args.offset ?? 0) === 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coding-preparation.js","sourceRoot":"","sources":["../../../src/dsh/lisp/coding-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAC,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"coding-preparation.js","sourceRoot":"","sources":["../../../src/dsh/lisp/coding-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAC,MAAM,8BAA8B,CAAA;AAE7E,OAAO,EAAE,mBAAmB,EAAiC,MAAM,uBAAuB,CAAA;AAE1F,MAAM,CAAC,MAAM,uBAAuB,GAAG,4ZAA4Z,CAAA;AACnc,MAAM,4BAA4B,GAAG,4XAA4X,CAAA;AASja,yGAAyG;AACzG,MAAM,OAAO,qBAAqB;IAEH;IADZ,MAAM,GAAG,IAAI,OAAO,EAAsB,CAAA;IAC3D,YAA6B,IAO5B;QAP4B,SAAI,GAAJ,IAAI,CAOhC;IAAG,CAAC;IACG,OAAO,CAAC,KAAW;QACzB,MAAM,KAAK,GAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK;YAAE,OAAO,SAAS,CAAA;QAC5B,MAAM,QAAQ,GAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACxC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,KAAG,KAAK,IAAI,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KAAG,UAAU,EAAE,CAAC;YAC3E,KAAK,CAAC,QAAQ,EAAE,CAAA;YAChB,IAAG,MAAM,EAAE,EAAE,KAAG,IAAI,IAAI,OAAO,MAAM,CAAC,WAAW,KAAG,QAAQ,EAAC,CAAC;gBAC5D,KAAK,CAAC,WAAW,GAAC,MAAM,CAAC,WAAW,CAAC;gBAAA,KAAK,CAAC,KAAK,GAAC,gBAAgB,CAAA;YACnE,CAAC;iBAAK,CAAC;gBAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAAC,KAAK,CAAC,KAAK,GAAC,KAAK,CAAC,iBAAiB,CAAA,CAAC,CAAA,CAAC,KAAK,CAAC,QAAQ,IAAE,CAAC,CAAA,CAAC,CAAA,QAAQ,CAAA,CAAC,CAAA,oBAAoB,CAAC,CAAA,CAAC,CAAA,UAAU,CAAA;YAAC,CAAC;QAC9H,CAAC;QACD,IAAG,IAAI,KAAG,cAAc,IAAI,KAAK,CAAC,KAAK,KAAG,gBAAgB,IAAI,IAAI,CAAC,iBAAiB,KAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC;eAC1L,MAAM,EAAE,EAAE,KAAG,IAAI,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI;YAClF,KAAK,CAAC,KAAK,GAAC,UAAU,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -67,10 +67,13 @@ export declare class LispManager {
|
|
|
67
67
|
private retainOwned;
|
|
68
68
|
private ownedDispatch;
|
|
69
69
|
private stopOwned;
|
|
70
|
+
private journalProtectedJob;
|
|
71
|
+
private journalRequest;
|
|
70
72
|
private bridge;
|
|
71
73
|
private bridgeBound;
|
|
72
74
|
/** Session-local process evidence only; observing it never creates or wakes a worker. */
|
|
73
75
|
taskJobsIdle(owner: LispOwner): boolean;
|
|
76
|
+
private managedUnresolved;
|
|
74
77
|
status(owner: LispOwner, offset?: number): Promise<unknown>;
|
|
75
78
|
diagnostics(owner: LispOwner, id?: string): Promise<unknown>;
|
|
76
79
|
execute(owner: LispOwner, tool: LispTool, input: Record<string, unknown>, signal?: AbortSignal, nativeCommands?: LispNativeCommands): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/dsh/lisp/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/dsh/lisp/manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAQlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAA2D,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAkB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC/J,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,EAAc,KAAK,cAAc,EAAY,MAAM,aAAa,CAAA;AAKvE,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAMlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,EAAE,iBAAiB,EAA0B,MAAM,qBAAqB,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAYjD,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,E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,mFAAmF;YACrE,iBAAiB;IAS/B,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;YAOnD,YAAY;IAgCpB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS7D,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;YAO9D,YAAY;IAcpB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAgB3C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ/B"}
|
package/dist/dsh/lisp/manager.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ManagedOperationJournal } from '../managed-operation-journal.js';
|
|
2
|
+
import { runManagedOperation, observeManagedResult, managedAdmissionDenied, isManagedAdmissionDenied } from '../managed-operation-runner.js';
|
|
1
3
|
import { LispRecoverySession } from './recovery.js';
|
|
2
4
|
import { CodeIntelligenceAdapterV1 } from './code-intelligence.js';
|
|
3
5
|
import { CODE_METHODS } from './code-intelligence-contracts.js';
|
|
@@ -142,6 +144,12 @@ export class LispManager {
|
|
|
142
144
|
for (const session of await this.#store.start())
|
|
143
145
|
this.enabled.set(session.session_id, session.root_path);
|
|
144
146
|
await this.#hot.catalog.expire();
|
|
147
|
+
await this.#store.database(db => {
|
|
148
|
+
const journal = new ManagedOperationJournal(db);
|
|
149
|
+
for (const row of db.prepare(`SELECT scope_id FROM dsh_managed_scopes WHERE json_extract(scope_json,'$.runtimeIdentity') LIKE 'sbcl:%'`).all()) {
|
|
150
|
+
journal.recover(row.scope_id);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
145
153
|
}
|
|
146
154
|
catch (error) {
|
|
147
155
|
await unlink(lockPath);
|
|
@@ -293,21 +301,21 @@ export class LispManager {
|
|
|
293
301
|
if (this.#config.executionMode === 'protected') {
|
|
294
302
|
const canary = join(base, 'host-canary');
|
|
295
303
|
await writeFile(canary, 'protected', { mode: 0o600 });
|
|
296
|
-
const probe = await
|
|
304
|
+
const probe = await this.journalRequest(state, worker, 'eval', { inputs: [], code: `(let ((read-denied (handler-case (progn (with-open-file (s ${JSON.stringify(canary)}) (read-char s)) nil) (file-error () t))) (delete-denied (handler-case (progn (delete-file ${JSON.stringify(canary)}) nil) (file-error () t)))) (unless (and read-denied delete-denied) (error "ISOLATION_FAILED")) :protected)` }, this.#config.startupTimeoutMs, combined);
|
|
297
305
|
if (!probe.ok || await readFile(canary, 'utf8') !== 'protected')
|
|
298
306
|
fail('ISOLATION_FAILED', 'OS によるファイル保護を確認できません。');
|
|
299
307
|
}
|
|
300
308
|
assertCurrent();
|
|
301
309
|
state.state = 'EVALUATING';
|
|
302
310
|
if (mode === 'compile') {
|
|
303
|
-
const checked = await
|
|
311
|
+
const checked = await this.journalRequest(state, worker, 'task-compile', { code }, this.#config.timeoutMs, combined);
|
|
304
312
|
assertCurrent();
|
|
305
313
|
if (!checked.ok || checked.proposals.length)
|
|
306
314
|
fail('TASK_COMPILE_FAILED', String(checked.value).slice(0, 1000));
|
|
307
315
|
return { value: null, output: worker.output(), generation: worker.generation };
|
|
308
316
|
}
|
|
309
317
|
if (mode === 'eval') {
|
|
310
|
-
const evaluated = await
|
|
318
|
+
const evaluated = await this.journalRequest(state, worker, 'eval', { code, inputs: [] }, this.#config.timeoutMs, combined);
|
|
311
319
|
assertCurrent();
|
|
312
320
|
if (!evaluated.ok || evaluated.proposals.length)
|
|
313
321
|
fail('TASK_EVAL_FAILED', String(evaluated.value).slice(0, 1000));
|
|
@@ -321,7 +329,7 @@ export class LispManager {
|
|
|
321
329
|
await writeFile(inputPath, encoded, { flag: 'wx', mode: 0o400 });
|
|
322
330
|
assertCurrent();
|
|
323
331
|
state.state = 'EVALUATING';
|
|
324
|
-
const response = await
|
|
332
|
+
const response = await this.journalRequest(state, worker, 'task', { code, input: inputPath }, this.#config.timeoutMs, combined);
|
|
325
333
|
if (!response.ok || response.proposals.length)
|
|
326
334
|
fail('TASK_EXECUTION_FAILED', String(response.value).slice(0, 1000));
|
|
327
335
|
const result = await snapshot(layout.scratch, 'task-result.json', []);
|
|
@@ -380,7 +388,7 @@ export class LispManager {
|
|
|
380
388
|
layout.compiled = compiled.path;
|
|
381
389
|
layout.workspace = state.owner.root;
|
|
382
390
|
layout.protected = this.#config.executionMode === 'protected';
|
|
383
|
-
worker = new LispWorker(layout, this.#config, (method, args, context) => this.bridge(state, method, args, context), undefined, () => this.taskAuthority.bound(state.execution, async () => { await this.taskAuthority.authorizeEffect(state.owner, this.#config.executionMode === 'protected' ? 'protected' : 'direct'); }));
|
|
391
|
+
worker = new LispWorker(layout, this.#config, (method, args, context) => this.bridge(state, method, args, context), undefined, () => this.taskAuthority.bound(state.execution, async () => { await this.taskAuthority.authorizeEffect(state.owner, this.#config.executionMode === 'protected' ? 'protected' : 'direct'); }), (input, launch) => this.journalProtectedJob(state, input, launch));
|
|
384
392
|
state.worker = worker;
|
|
385
393
|
if (this.#closed || state.state !== 'PREFLIGHT' || abort.signal.aborted)
|
|
386
394
|
fail('CANCELLED', '起動は取り消されています。');
|
|
@@ -390,7 +398,7 @@ export class LispManager {
|
|
|
390
398
|
const canary = join(base, 'host-canary');
|
|
391
399
|
await writeFile(canary, 'protected', { mode: 0o600 });
|
|
392
400
|
const quote = (value) => JSON.stringify(value);
|
|
393
|
-
const probe = await
|
|
401
|
+
const probe = await this.journalRequest(state, worker, 'eval', { inputs: [], code: `(let ((read-denied (handler-case (progn (with-open-file (s ${quote(canary)}) (read-char s)) nil) (file-error () t))) (delete-denied (handler-case (progn (delete-file ${quote(canary)}) nil) (file-error () t)))) (unless (and read-denied delete-denied) (error "ISOLATION_FAILED")) (kioku.files:write-text (merge-pathnames "probe" (kioku.files:scratch)) "ok") :protected)` }, this.#config.startupTimeoutMs);
|
|
394
402
|
if (!probe.ok || await readFile(canary, 'utf8') !== 'protected')
|
|
395
403
|
fail('ISOLATION_FAILED', 'OS によるファイル保護を確認できません。');
|
|
396
404
|
}
|
|
@@ -562,7 +570,7 @@ export class LispManager {
|
|
|
562
570
|
}
|
|
563
571
|
retainOwned(state, value) {
|
|
564
572
|
const receipt = value?.receipt;
|
|
565
|
-
if (receipt && typeof receipt.operationId === 'string' && !(receipt.processStopped === true && ['completed', 'cancelled'].includes(receipt.state ?? '')))
|
|
573
|
+
if (receipt && typeof receipt.operationId === 'string' && !(receipt.processStopped === true && ['completed', 'cancelled'].includes(receipt.state ?? '') || receipt.state === 'denied' && receipt.processStarted === false))
|
|
566
574
|
(state.ownedJobs ??= new Set()).add(receipt.operationId);
|
|
567
575
|
}
|
|
568
576
|
async ownedDispatch(state, action) {
|
|
@@ -606,8 +614,70 @@ export class LispManager {
|
|
|
606
614
|
state.ownedStop = stopping.finally(() => { delete state.ownedStop; });
|
|
607
615
|
return state.ownedStop;
|
|
608
616
|
}
|
|
617
|
+
async journalProtectedJob(state, input, launch) {
|
|
618
|
+
const scope = state.managedScope;
|
|
619
|
+
if (!scope)
|
|
620
|
+
fail('JOURNAL_SCOPE_MISSING', 'Managed evaluation collection is unavailable.');
|
|
621
|
+
await scope.database(db => {
|
|
622
|
+
if (db.prepare(`SELECT 1 FROM dsh_managed_operations o JOIN dsh_managed_scopes s ON s.scope_id=o.scope_id
|
|
623
|
+
WHERE json_extract(s.scope_json,'$.sessionId')=? AND json_extract(o.operation_json,'$.route')='native' AND o.state='unknown' LIMIT 1`).get(state.owner.sessionId)) {
|
|
624
|
+
new ManagedOperationJournal(db).markIncomplete(scope.scopeId);
|
|
625
|
+
fail('JOURNAL_RECONCILE_REQUIRED', 'A previous native operation is unresolved; inspect it before another effect.');
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
const operation = await scope.database(db => new ManagedOperationJournal(db).prepare(scope.scopeId, { route: 'native', kind: 'process', request: { input, environment: { ...process.env }, cwd: state.worker?.layout.scratch, runtime: process.version } }));
|
|
629
|
+
if (!await scope.database(db => new ManagedOperationJournal(db).claim(operation.operationId)))
|
|
630
|
+
fail('JOURNAL_REPLAY', 'Process already dispatched.');
|
|
631
|
+
let job;
|
|
632
|
+
try {
|
|
633
|
+
job = await launch();
|
|
634
|
+
}
|
|
635
|
+
catch (error) {
|
|
636
|
+
await scope.database(db => new ManagedOperationJournal(db).transition(operation.operationId, { state: isManagedAdmissionDenied(error) ? 'denied' : 'unknown' }));
|
|
637
|
+
throw error;
|
|
638
|
+
}
|
|
639
|
+
await scope.database(db => new ManagedOperationJournal(db).transition(operation.operationId, { state: 'running' }));
|
|
640
|
+
const done = job.done;
|
|
641
|
+
job.done = done.then(async () => {
|
|
642
|
+
await observeManagedResult({ ...scope, operationId: operation.operationId, kind: 'process' }, {
|
|
643
|
+
code: job.result?.code, receipt: { route: 'native', processStopped: job.settled === true },
|
|
644
|
+
});
|
|
645
|
+
await scope.database(db => new ManagedOperationJournal(db).setDelivery(operation.operationId, 'delivered'));
|
|
646
|
+
});
|
|
647
|
+
// Background completion persists independently of Lisp's final return value.
|
|
648
|
+
void job.done.catch(() => { });
|
|
649
|
+
return job;
|
|
650
|
+
}
|
|
651
|
+
async journalRequest(state, worker, ...args) {
|
|
652
|
+
const lease = state.execution?.lease ?? this.taskAuthority.current()?.lease;
|
|
653
|
+
const scope = await this.#store.database(db => new ManagedOperationJournal(db).createScope({
|
|
654
|
+
...(lease ? { binding: { taskId: lease.taskId, workerGeneration: worker.generation, leaseAuthorityGeneration: lease.generation, leaseRevision: lease.revision } } : {}),
|
|
655
|
+
sessionId: state.owner.sessionId, parentId: randomUUID(), runtimeIdentity: `sbcl:${worker.generation}`,
|
|
656
|
+
}));
|
|
657
|
+
const managedScope = { database: this.#store.database, scopeId: scope.scopeId };
|
|
658
|
+
state.managedScope = managedScope;
|
|
659
|
+
try {
|
|
660
|
+
return await worker.request(...args);
|
|
661
|
+
}
|
|
662
|
+
finally {
|
|
663
|
+
if (state.managedScope === managedScope)
|
|
664
|
+
delete state.managedScope;
|
|
665
|
+
await this.#store.database(db => new ManagedOperationJournal(db).seal(scope.scopeId));
|
|
666
|
+
}
|
|
667
|
+
}
|
|
609
668
|
bridge(state, method, args, context) {
|
|
610
|
-
const pending = this.taskAuthority.bound(state.execution, () =>
|
|
669
|
+
const pending = this.taskAuthority.bound(state.execution, () => {
|
|
670
|
+
const parsed = args;
|
|
671
|
+
const processEffect = ['run', 'start-job', 'ci-verify'].includes(method) || method === 'tool-call' && parsed?.name === 'kioku_exec';
|
|
672
|
+
const file = method === 'tool-call' && ['kioku_write', 'kioku_edit', 'kioku_remove'].includes(parsed?.name ?? '');
|
|
673
|
+
if (!processEffect && !file)
|
|
674
|
+
return this.bridgeBound(state, method, args, context);
|
|
675
|
+
if (!state.managedScope)
|
|
676
|
+
fail('JOURNAL_SCOPE_MISSING', 'Managed evaluation collection is unavailable; no operation was dispatched.');
|
|
677
|
+
const route = method === 'run' && this.taskAuthority.current()?.nativeCommands && this.#config.executionMode === 'development' ? 'native' : 'owned';
|
|
678
|
+
return runManagedOperation(state.managedScope, { route, kind: file ? 'file' : 'process',
|
|
679
|
+
request: { method, args, cwd: state.owner.root, workerGeneration: context.generation, evaluationId: context.evaluationId, rpcId: context.rpcId, environment: { ...process.env }, runtime: process.version } }, () => this.bridgeBound(state, method, args, context));
|
|
680
|
+
});
|
|
611
681
|
if (['run', 'start-job', 'tool-call', 'ci-verify'].includes(method)) {
|
|
612
682
|
(state.ownedCalls ??= new Set()).add(pending);
|
|
613
683
|
const settled = () => { state.ownedCalls?.delete(pending); };
|
|
@@ -745,8 +815,9 @@ export class LispManager {
|
|
|
745
815
|
const active = [...state.active];
|
|
746
816
|
if (active.length !== 1)
|
|
747
817
|
fail('HOST_STATE', 'CI 呼び出しの実行主体を一意に確認できません。');
|
|
818
|
+
// This authority check precedes the CI adapter; a refusal proves no dispatch.
|
|
748
819
|
if (request.kind === 'verify')
|
|
749
|
-
await this.taskAuthority.authorizeEffect(state.owner);
|
|
820
|
+
await this.taskAuthority.authorizeEffect(state.owner).catch(managedAdmissionDenied);
|
|
750
821
|
context.signal.throwIfAborted();
|
|
751
822
|
const result = await this.options.ciCall(state.owner, request, active[0].signal, state.worker.layout.scratch);
|
|
752
823
|
if (request.kind === 'verify')
|
|
@@ -814,6 +885,22 @@ export class LispManager {
|
|
|
814
885
|
}
|
|
815
886
|
return true;
|
|
816
887
|
}
|
|
888
|
+
managedUnresolved(owner) {
|
|
889
|
+
return this.#store.database(db => {
|
|
890
|
+
// Safety decisions use the full set, never the bounded diagnostic page.
|
|
891
|
+
const counts = db.prepare(`SELECT COUNT(*) AS total, COALESCE(SUM(CASE WHEN o.state='unknown' THEN 1 ELSE 0 END),0) AS unknown_count
|
|
892
|
+
FROM dsh_managed_operations o JOIN dsh_managed_scopes s ON s.scope_id=o.scope_id
|
|
893
|
+
WHERE json_extract(s.scope_json,'$.sessionId')=? AND o.state IN ('unknown','dispatching','running','prepared')`)
|
|
894
|
+
.get(owner.sessionId);
|
|
895
|
+
const operations = db.prepare(`SELECT o.operation_json FROM dsh_managed_operations o JOIN dsh_managed_scopes s ON s.scope_id=o.scope_id
|
|
896
|
+
WHERE json_extract(s.scope_json,'$.sessionId')=? AND o.state IN ('unknown','dispatching','running','prepared') ORDER BY o.rowid DESC LIMIT 100`)
|
|
897
|
+
.all(owner.sessionId).map(row => {
|
|
898
|
+
const value = JSON.parse(row.operation_json);
|
|
899
|
+
return { id: value.operationId, scopeId: value.scopeId, route: value.route, kind: value.kind, state: value.state, ...(value.originalRef ? { originalRef: value.originalRef } : {}) };
|
|
900
|
+
});
|
|
901
|
+
return { operations, total: counts.total, unknownCount: counts.unknown_count, truncated: counts.total > operations.length };
|
|
902
|
+
});
|
|
903
|
+
}
|
|
817
904
|
async status(owner, offset) {
|
|
818
905
|
const policy = this.options.questions?.approvalPolicy;
|
|
819
906
|
const approval = { mode: policy?.mode() ?? this.#config.approvalMode, scope: 'profile', writable: policy?.writable() ?? false };
|
|
@@ -821,13 +908,16 @@ export class LispManager {
|
|
|
821
908
|
return { approval, enabled: false, state: 'DISABLED', recovery: '/kioku-lisp enable' };
|
|
822
909
|
const state = this.entry(owner);
|
|
823
910
|
const taskMode = await this.isTaskMode(owner);
|
|
911
|
+
const managed = await this.managedUnresolved(owner);
|
|
912
|
+
const managedOperations = managed.operations;
|
|
913
|
+
const managedReconciliation = managed.unknownCount > 0;
|
|
824
914
|
const unconfirmed = [...this.#agents.values()].find(s => s.owner.sessionId === owner.sessionId && s.state === 'STOP_UNCONFIRMED');
|
|
825
915
|
if (state.state === 'READY' && !state.worker?.healthy)
|
|
826
916
|
this.halted(state, new LispError('WORKER_EXITED', 'Lisp が終了しています。新しい Lisp の起動前に状態を確認してください。'));
|
|
827
917
|
const summary = await this.#store.operationSummaries(owner.sessionId, offset);
|
|
828
918
|
const taskSummary = taskMode ? await this.#store.taskSummary(owner) : undefined;
|
|
829
919
|
const operations = summary.operations.map(o => ({ id: o.operation_id, agent: o.agent_id, kind: o.kind, state: o.state, updatedAt: o.updated_at }));
|
|
830
|
-
return { approval, enabled: true, state: unconfirmed ? 'STOP_UNCONFIRMED' : taskMode && state.state === 'RECOVERY_REQUIRED' && !state.worker ? 'TASK_READY' : state.state,
|
|
920
|
+
return { approval, enabled: true, managedOperations, managedOperationCount: managed.total, managedOperationsTruncated: managed.truncated, managedReconciliationRequired: managedReconciliation, state: managedReconciliation ? 'RECONCILIATION_REQUIRED' : unconfirmed ? 'STOP_UNCONFIRMED' : taskMode && state.state === 'RECOVERY_REQUIRED' && !state.worker ? 'TASK_READY' : state.state,
|
|
831
921
|
generation: state.worker?.generation ?? null, supervisorPid: state.worker?.supervisorPid ?? null, error: unconfirmed?.error ?? (taskMode && !state.worker ? null : state.error ?? null),
|
|
832
922
|
jobs: [...(state.worker?.jobStatus() ?? []), ...[...state.ownedJobs ?? []].map(operationId => ({ operationId, owner: 'kiokuko-execution' }))],
|
|
833
923
|
executionMode: this.#config.executionMode,
|
|
@@ -838,14 +928,21 @@ export class LispManager {
|
|
|
838
928
|
...(taskSummary ? { task: taskSummary } : {}),
|
|
839
929
|
hot: await this.#hot.status(owner),
|
|
840
930
|
...(offset === undefined ? {} : { operationCount: summary.count, pendingCount: Object.values(summary.pendingStates).reduce((a, b) => a + b, 0), pendingStates: summary.pendingStates, offset, nextOffset: offset + 10 < summary.count ? offset + 10 : null }),
|
|
841
|
-
recovery: unconfirmed ? '停止と操作記録を照合してください。自動再実行しません。' : taskMode && !state.worker ? null : state.state === 'SUSPENDED' ? 'Lisp は休止中です。次の利用時に自動起動します。変数・関数定義は保持されません。' : state.state === 'READY' ? null : '停止理由と操作履歴を確認し、/kioku-lisp recover を実行してください。' };
|
|
931
|
+
recovery: managedReconciliation ? 'Managed operations remain unresolved. Inspect the listed operation IDs and original receipts; restarting or abandoning Lisp does not reconcile external effects.' : unconfirmed ? '停止と操作記録を照合してください。自動再実行しません。' : taskMode && !state.worker ? null : state.state === 'SUSPENDED' ? 'Lisp は休止中です。次の利用時に自動起動します。変数・関数定義は保持されません。' : state.state === 'READY' ? null : '停止理由と操作履歴を確認し、/kioku-lisp recover を実行してください。' };
|
|
842
932
|
}
|
|
843
933
|
async diagnostics(owner, id) {
|
|
844
934
|
this.entry(owner);
|
|
845
935
|
if (id) {
|
|
846
936
|
const operation = await this.#store.get(owner, identifier.parse(id));
|
|
847
|
-
if (!operation)
|
|
937
|
+
if (!operation) {
|
|
938
|
+
const managed = await this.#store.database(db => db.prepare(`SELECT o.operation_json FROM dsh_managed_operations o JOIN dsh_managed_scopes s ON s.scope_id=o.scope_id
|
|
939
|
+
WHERE o.operation_id=? AND json_extract(s.scope_json,'$.sessionId')=?`).get(id, owner.sessionId));
|
|
940
|
+
if (managed) {
|
|
941
|
+
const value = JSON.parse(managed.operation_json);
|
|
942
|
+
return { operationId: value.operationId, scopeId: value.scopeId, parentId: value.parentId, route: value.route, kind: value.kind, state: value.state, originalRef: value.originalRef ?? null, cause: value.cause ?? null, delivery: value.delivery };
|
|
943
|
+
}
|
|
848
944
|
fail('UNKNOWN_OPERATION', 'この主体の操作記録がありません。');
|
|
945
|
+
}
|
|
849
946
|
return { ...operation, payload: JSON.parse(operation.payload), result: operation.result ? JSON.parse(operation.result) : null };
|
|
850
947
|
}
|
|
851
948
|
const operations = await this.#store.operations(owner.sessionId);
|
|
@@ -1257,7 +1354,7 @@ export class LispManager {
|
|
|
1257
1354
|
reserved = true;
|
|
1258
1355
|
if (tool === 'lisp_eval')
|
|
1259
1356
|
state.currentVerification = { operationId: id, generation: worker.generation, results: [] };
|
|
1260
|
-
const response = await
|
|
1357
|
+
const response = await this.journalRequest(state, worker, tool === 'lisp_eval' ? 'eval' : tool === 'lisp_describe' ? 'describe' : 'inspect', args, timeout, combined);
|
|
1261
1358
|
const result = { ok: response.ok, operationId: id, value: response.value, output: worker.output(), generation: worker.generation, proposals: response.proposals };
|
|
1262
1359
|
evidence = { ...result, state: response.ok ? 'RUNNING' : 'FAILED' };
|
|
1263
1360
|
await this.#store.transition(owner, id, ['RUNNING'], response.ok ? 'RUNNING' : 'FAILED', evidence);
|
|
@@ -1413,6 +1510,10 @@ export class LispManager {
|
|
|
1413
1510
|
});
|
|
1414
1511
|
}
|
|
1415
1512
|
async recoverBound(owner, signal) {
|
|
1513
|
+
const managed = await this.managedUnresolved(owner);
|
|
1514
|
+
if (managed.unknownCount > 0)
|
|
1515
|
+
return { ok: false, code: 'RECONCILIATION_REQUIRED',
|
|
1516
|
+
message: 'External operation results remain unknown. Inspect the listed originals. Native results without a verifiable host receipt cannot be cleared by restarting Lisp; no command was retried.', managedOperations: managed.operations, managedOperationCount: managed.total, managedOperationsTruncated: managed.truncated };
|
|
1416
1517
|
if (await this.isTaskMode(owner)) {
|
|
1417
1518
|
await this.stopTaskWorkers(owner.sessionId);
|
|
1418
1519
|
await Promise.allSettled([...this.#executions].filter(([, session]) => session === owner.sessionId).map(([promise]) => promise));
|