kiokuko-dsh 0.1.7 → 0.1.8
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/context-injection.d.ts +1 -0
- package/dist/dsh/context-injection.d.ts.map +1 -1
- package/dist/dsh/context-injection.js +1 -0
- package/dist/dsh/context-injection.js.map +1 -1
- package/dist/dsh/directive-projection.d.ts.map +1 -1
- package/dist/dsh/directive-projection.js +4 -2
- package/dist/dsh/directive-projection.js.map +1 -1
- package/dist/dsh/host-adapter.d.ts.map +1 -1
- package/dist/dsh/host-adapter.js +172 -13
- package/dist/dsh/host-adapter.js.map +1 -1
- package/dist/dsh/message-sources.d.ts +6 -2
- package/dist/dsh/message-sources.d.ts.map +1 -1
- package/dist/dsh/message-sources.js +13 -0
- package/dist/dsh/message-sources.js.map +1 -1
- package/dist/dsh/tool-policy.d.ts.map +1 -1
- package/dist/dsh/tool-policy.js +0 -1
- package/dist/dsh/tool-policy.js.map +1 -1
- package/dist/dsh/tools.d.ts +1 -1
- package/dist/dsh/tools.d.ts.map +1 -1
- package/dist/dsh/tools.js +3 -1
- package/dist/dsh/tools.js.map +1 -1
- package/dist/enno-oduno/service.d.ts +3 -1
- package/dist/enno-oduno/service.d.ts.map +1 -1
- package/dist/enno-oduno/service.js +4 -2
- package/dist/enno-oduno/service.js.map +1 -1
- package/dist/model-tools/contracts.d.ts +3 -3
- package/dist/model-tools/contracts.js +3 -3
- package/dist/model-tools/contracts.js.map +1 -1
- package/dist/model-tools/registry.d.ts +2 -0
- package/dist/model-tools/registry.d.ts.map +1 -1
- package/dist/model-tools/registry.js +5 -1
- package/dist/model-tools/registry.js.map +1 -1
- package/docs/dsh-plugin.md +20 -4
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ export declare function injectDshContext(input: {
|
|
|
19
19
|
readonly task: string;
|
|
20
20
|
readonly routeSkillNames?: readonly string[];
|
|
21
21
|
readonly expertRefs?: readonly DshExpertReference[];
|
|
22
|
+
readonly advisoryEvidence?: DshMessageSourceInput['advisoryEvidence'];
|
|
22
23
|
readonly directive?: DshMessageSourceInput['directive'];
|
|
23
24
|
readonly runtime?: Pick<DshRuntime, 'withDatabase'>;
|
|
24
25
|
}): Promise<readonly DshModelMessage[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-injection.d.ts","sourceRoot":"","sources":["../../src/dsh/context-injection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEvG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAQ3D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAA;CACnD;AAOD,sFAAsF;AACtF,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,UAAU,CAAC,GAAG,2BAA2B,CAWpI;AAmBD,4EAA4E;AAC5E,wBAAsB,gBAAgB,CAAC,KAAK,EAAE;IAC5C,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5C,QAAQ,CAAC,U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E,SAAS,MAAM,EAAE,CAAA;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,CAAA;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAA;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;CACpD,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAqBtC"}
|
|
@@ -52,6 +52,7 @@ export async function injectDshContext(input) {
|
|
|
52
52
|
};
|
|
53
53
|
const sources = await buildDshMessageSources({
|
|
54
54
|
...sourceInput(input.prepared, input.task, input.routeSkillNames ?? [], input.expertRefs ?? [], input.directive),
|
|
55
|
+
...(input.advisoryEvidence === undefined ? {} : { advisoryEvidence: input.advisoryEvidence }),
|
|
55
56
|
...(assertMemoryCurrent === undefined ? {} : { assertMemoryCurrent }),
|
|
56
57
|
});
|
|
57
58
|
return Object.freeze(sources.map((source) => Object.freeze({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-injection.js","sourceRoot":"","sources":["../../src/dsh/context-injection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAGlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,6BAA6B,CAAA;AAapC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAiB;IAC9C,GAAG,4BAA4B,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,8BAA8B,CAAC,KAAK,C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CAAA;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive-projection.d.ts","sourceRoot":"","sources":["../../src/dsh/directive-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAiBzD,wEAAwE;AACxE,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,cAAc,GAAG,uBAAuB,GAAG,SAAS,CAEjH;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,WAAW,CAAC,GAAG,aAAa,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"directive-projection.d.ts","sourceRoot":"","sources":["../../src/dsh/directive-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAiBzD,wEAAwE;AACxE,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,cAAc,GAAG,uBAAuB,GAAG,SAAS,CAEjH;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,WAAW,CAAC,GAAG,aAAa,GAAG,IAAI,CASjH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { projectModelFacingInputSchema } from '../model-tools/registry.js';
|
|
2
2
|
const MODEL_OPERATION_BY_NEXT_ACTION = Object.freeze({
|
|
3
3
|
submit_ideal: 'enno_ideal_submit',
|
|
4
4
|
submit_plan: 'enno_plan_submit',
|
|
@@ -23,7 +23,9 @@ export function projectDshDirective(state) {
|
|
|
23
23
|
const operation = modelFacingOperationForNextAction(state.nextAction);
|
|
24
24
|
return {
|
|
25
25
|
...state.directive,
|
|
26
|
-
reportSchema: operation === undefined
|
|
26
|
+
reportSchema: operation === undefined
|
|
27
|
+
? EMPTY_MODEL_SCHEMA
|
|
28
|
+
: projectModelFacingInputSchema(operation, state.directive.reportSchema),
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=directive-projection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive-projection.js","sourceRoot":"","sources":["../../src/dsh/directive-projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"directive-projection.js","sourceRoot":"","sources":["../../src/dsh/directive-projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAmB,MAAM,4BAA4B,CAAA;AAG3F,MAAM,8BAA8B,GAAuE,MAAM,CAAC,MAAM,CAAC;IACvH,YAAY,EAAE,mBAAmB;IACjC,WAAW,EAAE,kBAAkB;IAC/B,iBAAiB,EAAE,kBAAkB;IACrC,mBAAmB,EAAE,aAAa;IAClC,iBAAiB,EAAE,wBAAwB;CAC5C,CAAC,CAAA;AAEF,MAAM,kBAAkB,GAAe,MAAM,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,oBAAoB,EAAE,KAAK;CAC5B,CAAC,CAAA;AAEF,wEAAwE;AACxE,MAAM,UAAU,iCAAiC,CAAC,UAA0B;IAC1E,OAAO,8BAA8B,CAAC,UAAU,CAAC,CAAA;AACnD,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,mBAAmB,CAAC,KAAuD;IACzF,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IACzC,MAAM,SAAS,GAAG,iCAAiC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACrE,OAAO;QACL,GAAG,KAAK,CAAC,SAAS;QAClB,YAAY,EAAE,SAAS,KAAK,SAAS;YACnC,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,6BAA6B,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC;KAC3E,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-adapter.d.ts","sourceRoot":"","sources":["../../src/dsh/host-adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"host-adapter.d.ts","sourceRoot":"","sources":["../../src/dsh/host-adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAA;AAkBzB,OAAO,EAAqB,KAAK,eAAe,EAA+B,MAAM,sBAAsB,CAAA;AAoC3G,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAClF,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9D;AAMD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC;AA6ID,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,qBAA0B,GAAG,cAAc,CA2tBtG;AAkBD,OAAO,EAAE,wBAAwB,EAAE,CAAA"}
|
package/dist/dsh/host-adapter.js
CHANGED
|
@@ -5,6 +5,9 @@ import { KIOKUKO_DSH_HOST_SERVICE, } from './composition.js';
|
|
|
5
5
|
import { DshRuntime } from './runtime.js';
|
|
6
6
|
import { DshIntakeGate } from './intake-gate.js';
|
|
7
7
|
import { resolveGroundedIntakeProfile } from './intake-profile-resolver.js';
|
|
8
|
+
import { deriveAkinatorReasoning } from '../akinator/reasoning.js';
|
|
9
|
+
import { resolveCapabilities } from '../akinator/capabilities.js';
|
|
10
|
+
import { readAkinatorSession, readRunIntakeLink } from '../akinator/store.js';
|
|
8
11
|
import { DshToolPolicy } from './tool-policy.js';
|
|
9
12
|
import { DSH_MODEL_FACING_OPERATIONS, } from './tools.js';
|
|
10
13
|
import { DshSessionBridge, DshRunLifecycle } from './session-bridge.js';
|
|
@@ -18,8 +21,9 @@ import { canonicalContentHash, compareCanonicalStrings } from '../serialization/
|
|
|
18
21
|
import { KiokukoError } from '../errors.js';
|
|
19
22
|
import { injectDshContext, selectDshDirectiveSources } from './context-injection.js';
|
|
20
23
|
import { projectDshDirective } from './directive-projection.js';
|
|
21
|
-
import { submitOdunoIdeal, submitEnnoPlan, submitEnnoAdvice, reportEnnoWork, finishEnno, submitOdunoMeditation, answerEnno, prepareEnnoVerification, stateForSnapshot } from '../enno-oduno/service.js';
|
|
24
|
+
import { submitOdunoIdeal, submitEnnoPlan, submitEnnoAdvice, readPendingEnnoAdvice, reportEnnoWork, finishEnno, submitOdunoMeditation, answerEnno, prepareEnnoVerification, stateForSnapshot } from '../enno-oduno/service.js';
|
|
22
25
|
import { readEnnoSnapshot, terminalizeLedgerRunInTransaction } from '../enno-oduno/store.js';
|
|
26
|
+
import { decideAdapterContinuation } from '../enno-oduno/adapters.js';
|
|
23
27
|
import { resolveProjectWorkspaceReadOnly } from '../memory/workspaces.js';
|
|
24
28
|
import { curateMemoryCandidates } from '../memory/curator.js';
|
|
25
29
|
import { checkpointScopedMemoryWithProvenance } from '../memory/scoped-memory.js';
|
|
@@ -98,6 +102,7 @@ function policyState(state, record, sessionId, lease) {
|
|
|
98
102
|
...(record.prepared.context?.deliveryId === null || record.prepared.context?.deliveryId === undefined ? {} : { deliveryId: record.prepared.context.deliveryId }),
|
|
99
103
|
revision: state.contractRevision ?? 1,
|
|
100
104
|
routeEpoch: lease?.routeEpoch ?? state.routeEpoch ?? 0,
|
|
105
|
+
...(state.advisoryPhaseState.state === 'aggregated' ? { advisoryRoundDigest: state.advisoryPhaseState.inputDigest } : {}),
|
|
101
106
|
...(lease === undefined ? {} : { leaseToken: lease.leaseToken, workUnitId: lease.workUnitId, currentWorkUnitId: lease.workUnitId }),
|
|
102
107
|
dshSessionId: sessionId,
|
|
103
108
|
...(state.nextAction === undefined ? {} : { nextAction: state.nextAction }),
|
|
@@ -134,16 +139,19 @@ async function capabilityCatalog(skills, tools, context) {
|
|
|
134
139
|
.sort((left, right) => compareCanonicalStrings(left.name, right.name));
|
|
135
140
|
return createDshCapabilityCatalog({ skills: skillDescriptors, tools: toolDescriptors });
|
|
136
141
|
}
|
|
137
|
-
function operationInput(args, binding, cwd, operation) {
|
|
142
|
+
function operationInput(args, binding, cwd, operation, catalog) {
|
|
138
143
|
const source = typeof args === 'object' && args !== null && !Array.isArray(args) ? args : {};
|
|
139
144
|
const identity = { runId: binding.runId, workspace: binding.workspace, orchestrationId: binding.orchestrationId, expectedRevision: binding.revision, idempotencyKey: binding.idempotencyKey };
|
|
145
|
+
const advisory = binding.advisoryRoundDigest === undefined ? {} : { advisoryRoundDigest: binding.advisoryRoundDigest };
|
|
140
146
|
if (operation === 'enno_work_report')
|
|
141
147
|
return { ...source, ...identity, leaseToken: binding.leaseToken, routeEpoch: binding.routeEpoch, workUnitId: binding.workUnitId };
|
|
148
|
+
if (operation === 'enno_plan_submit')
|
|
149
|
+
return { ...source, ...identity, ...advisory, capabilities: [...catalog.skills, ...catalog.tools] };
|
|
142
150
|
if (operation === 'curator_check')
|
|
143
151
|
return { ...source, cwd, workspace: binding.workspace };
|
|
144
152
|
if (operation === 'memory_checkpoint')
|
|
145
153
|
return { ...source, cwd, runId: binding.runId, ...(binding.deliveryId === undefined ? {} : { deliveryId: binding.deliveryId }) };
|
|
146
|
-
return { ...source, ...identity };
|
|
154
|
+
return { ...source, ...identity, ...advisory };
|
|
147
155
|
}
|
|
148
156
|
function operationName(value) {
|
|
149
157
|
return DSH_MODEL_FACING_OPERATIONS.includes(value);
|
|
@@ -171,13 +179,17 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
171
179
|
const latestBySession = new Map();
|
|
172
180
|
const states = new Map();
|
|
173
181
|
const activeModeRequests = new Map();
|
|
182
|
+
const advisoryRounds = new Map();
|
|
183
|
+
const resumedLeases = new Map();
|
|
174
184
|
const policy = new DshToolPolicy({ phase: 'intake', runId: 'pending', workspace: 'pending', orchestrationId: 'pending', revision: 1, routeEpoch: 0 });
|
|
175
185
|
const bridge = new DshSessionBridge({ runtime });
|
|
176
186
|
const modes = new DshPonytailModes();
|
|
177
187
|
const confirmation = userQuestions === undefined ? undefined : createDshConfirmationAnswerer(userQuestions);
|
|
178
188
|
let prepareGeneration = 0;
|
|
179
189
|
const continuedTurns = new Map();
|
|
190
|
+
const resumedTurns = new Map();
|
|
180
191
|
let retireSupersededRun;
|
|
192
|
+
let resumeExistingRun;
|
|
181
193
|
const identityKey = (agentId, sessionId) => dshPonytailOwnerKey(agentId, sessionId);
|
|
182
194
|
const turnKey = (agentId, sessionId, turn) => `${identityKey(agentId, sessionId)}\u0000${turn}`;
|
|
183
195
|
const record = (event, result, generation) => {
|
|
@@ -256,7 +268,8 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
256
268
|
policy.setState(next);
|
|
257
269
|
}
|
|
258
270
|
else {
|
|
259
|
-
const next = policyState(result.prepared.ennoOduno, item, event.sessionId);
|
|
271
|
+
const next = policyState(result.prepared.ennoOduno, item, event.sessionId, resumedLeases.get(run));
|
|
272
|
+
resumedLeases.delete(run);
|
|
260
273
|
states.set(item.runId, next);
|
|
261
274
|
policy.setState(next);
|
|
262
275
|
}
|
|
@@ -280,7 +293,7 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
280
293
|
skillDiscoveryMode: event.skillDiscoveryMode ?? null,
|
|
281
294
|
catalogDigest: event.capabilities.digest,
|
|
282
295
|
});
|
|
283
|
-
const cached = continuedTurns.get(cacheKey);
|
|
296
|
+
const cached = continuedTurns.get(cacheKey) ?? resumedTurns.get(cacheKey);
|
|
284
297
|
if (cached !== undefined) {
|
|
285
298
|
if (cached.fingerprint !== fingerprint
|
|
286
299
|
|| cached.nativeAgent !== event.nativeAgent
|
|
@@ -322,6 +335,17 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
322
335
|
throw new Error('kiokuko-dsh run lifecycle is unavailable');
|
|
323
336
|
await retireSupersededRun(previous, previousState.status === 'cancelled' ? 'cancelled' : previousState.status === 'blocked' ? 'failed' : 'completed');
|
|
324
337
|
}
|
|
338
|
+
const resumed = await resumeExistingRun?.(event);
|
|
339
|
+
if (resumed !== undefined) {
|
|
340
|
+
resumedTurns.set(cacheKey, {
|
|
341
|
+
fingerprint,
|
|
342
|
+
result: resumed,
|
|
343
|
+
...(event.nativeAgent === undefined ? {} : { nativeAgent: event.nativeAgent }),
|
|
344
|
+
...(event.nativeSession === undefined ? {} : { nativeSession: event.nativeSession }),
|
|
345
|
+
});
|
|
346
|
+
record(event, resumed, generation);
|
|
347
|
+
return resumed;
|
|
348
|
+
}
|
|
325
349
|
const prepared = await super.prepare(event);
|
|
326
350
|
if (prepared.admitted)
|
|
327
351
|
record(event, prepared, generation);
|
|
@@ -340,6 +364,7 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
340
364
|
clearTurn(sessionId, turn) {
|
|
341
365
|
super.clearTurn(sessionId, turn);
|
|
342
366
|
continuedTurns.delete(`${sessionId}\u0000${turn}`);
|
|
367
|
+
resumedTurns.delete(`${sessionId}\u0000${turn}`);
|
|
343
368
|
}
|
|
344
369
|
}
|
|
345
370
|
const gate = new CapturingGate(runtime, userQuestions === undefined ? undefined : createDshIntakeAnswerer(userQuestions), (context) => capabilityCatalog(skills, tools, context));
|
|
@@ -365,6 +390,111 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
365
390
|
contractRevision: state.contractRevision,
|
|
366
391
|
nextAction: state.nextAction,
|
|
367
392
|
directiveDigest: state.directive === null ? null : canonicalContentHash(state.directive),
|
|
393
|
+
advisoryRoundDigest: state.advisoryPhaseState.state === 'aggregated' ? state.advisoryPhaseState.inputDigest : null,
|
|
394
|
+
});
|
|
395
|
+
const advisoryEvidenceFor = async (item, state) => {
|
|
396
|
+
const advisoryState = state.advisoryPhaseState;
|
|
397
|
+
const contractRevision = state.contractRevision;
|
|
398
|
+
if (advisoryState.state !== 'aggregated' || contractRevision === null)
|
|
399
|
+
return undefined;
|
|
400
|
+
let round = advisoryRounds.get(item.runId);
|
|
401
|
+
if (round?.stateDigest !== advisoryState.inputDigest) {
|
|
402
|
+
const restored = await runtime.withDatabase((database) => readPendingEnnoAdvice(database, {
|
|
403
|
+
runId: item.runId,
|
|
404
|
+
workspace: item.workspace,
|
|
405
|
+
orchestrationId: item.orchestrationId,
|
|
406
|
+
expectedRevision: contractRevision,
|
|
407
|
+
advisoryRoundDigest: advisoryState.inputDigest,
|
|
408
|
+
}));
|
|
409
|
+
round = {
|
|
410
|
+
stateDigest: restored.advisoryRound.inputDigest,
|
|
411
|
+
result: {
|
|
412
|
+
phase: restored.advisoryRound.phase,
|
|
413
|
+
inputDigest: restored.advisoryRound.inputDigest,
|
|
414
|
+
contributions: restored.advisoryRound.contributions,
|
|
415
|
+
degraded: restored.advisoryRound.degraded,
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
advisoryRounds.set(item.runId, round);
|
|
419
|
+
}
|
|
420
|
+
return { phase: round.result.phase, contributions: round.result.contributions };
|
|
421
|
+
};
|
|
422
|
+
resumeExistingRun = async (event) => runtime.withDatabase(async (database) => {
|
|
423
|
+
const project = await resolveProjectWorkspaceReadOnly(database, event.cwd);
|
|
424
|
+
if (project === undefined)
|
|
425
|
+
return undefined;
|
|
426
|
+
const candidates = database.prepare(`
|
|
427
|
+
SELECT ec.run_id AS runId, ec.orchestration_session_id AS orchestrationId
|
|
428
|
+
FROM enno_contracts AS ec
|
|
429
|
+
JOIN ledger_runs AS lr ON lr.run_id = ec.run_id AND lr.workspace = ec.workspace
|
|
430
|
+
WHERE ec.repository_root = ? AND ec.client_kind = 'dsh'
|
|
431
|
+
AND ec.client_session_id = ? AND lr.status = 'active'
|
|
432
|
+
AND ec.status NOT IN ('completed', 'cancelled', 'blocked')
|
|
433
|
+
ORDER BY ec.created_at, ec.run_id
|
|
434
|
+
LIMIT 2
|
|
435
|
+
`).all(project.repositoryRoot, event.sessionId);
|
|
436
|
+
if (candidates.length === 0)
|
|
437
|
+
return undefined;
|
|
438
|
+
if (candidates.length !== 1) {
|
|
439
|
+
throw new KiokukoError('CONFLICT', 'Multiple active Enno-Oduno runs match this repository; refusing to guess');
|
|
440
|
+
}
|
|
441
|
+
const candidate = candidates[0];
|
|
442
|
+
const runId = candidate.runId;
|
|
443
|
+
const decision = decideAdapterContinuation(database, 'dsh', {
|
|
444
|
+
session_id: event.sessionId,
|
|
445
|
+
cwd: event.cwd,
|
|
446
|
+
}, runId);
|
|
447
|
+
if (!decision.continue || decision.runId !== runId) {
|
|
448
|
+
throw new KiokukoError('CONFLICT', decision.warning ?? 'The active Enno-Oduno run cannot be resumed by this DSH session');
|
|
449
|
+
}
|
|
450
|
+
const snapshot = readEnnoSnapshot(database, {
|
|
451
|
+
runId,
|
|
452
|
+
workspace: project.workspace,
|
|
453
|
+
orchestrationId: candidate.orchestrationId,
|
|
454
|
+
});
|
|
455
|
+
const intakeLink = readRunIntakeLink(database, { workspace: project.workspace, runId });
|
|
456
|
+
const intake = readAkinatorSession(database, { workspace: project.workspace, sessionId: intakeLink.sessionId });
|
|
457
|
+
if (intake.status === 'active')
|
|
458
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Resumable Enno-Oduno run has unfinished intake');
|
|
459
|
+
const capabilityEntries = [...event.capabilities.skills, ...event.capabilities.tools];
|
|
460
|
+
const capabilityResolution = resolveCapabilities({
|
|
461
|
+
task: intake.task,
|
|
462
|
+
profile: intake.profile,
|
|
463
|
+
recommendedTags: intakeLink.recommendedTags,
|
|
464
|
+
capabilities: capabilityEntries,
|
|
465
|
+
memoryUse: 'none',
|
|
466
|
+
});
|
|
467
|
+
const canonicalCwd = realpathSync(event.cwd);
|
|
468
|
+
const prepared = {
|
|
469
|
+
project,
|
|
470
|
+
executionContext: {
|
|
471
|
+
canonicalCwd,
|
|
472
|
+
repositoryRoot: project.repositoryRoot,
|
|
473
|
+
cwdIsRepositoryRoot: canonicalCwd === project.repositoryRoot,
|
|
474
|
+
pathPolicy: 'canonical_absolute_under_repository_root',
|
|
475
|
+
},
|
|
476
|
+
intake: {
|
|
477
|
+
status: intake.status,
|
|
478
|
+
sessionId: intake.id,
|
|
479
|
+
profile: intake.profile,
|
|
480
|
+
question: null,
|
|
481
|
+
missingFields: [],
|
|
482
|
+
recommendedTags: intakeLink.recommendedTags,
|
|
483
|
+
reasoning: deriveAkinatorReasoning(intake.task, intake.profile),
|
|
484
|
+
},
|
|
485
|
+
capabilities: capabilityResolution,
|
|
486
|
+
run: { runId, status: 'active' },
|
|
487
|
+
skillDiscovery: { attempted: false, mode: 'off', requirements: [], queries: [], cacheHits: 0, candidates: 0, selected: [], failures: [] },
|
|
488
|
+
context: null,
|
|
489
|
+
memoryPolicy: { memoryReasoningRequired: false, contextWithheld: false, withheldReason: null, deliveryEmpty: true },
|
|
490
|
+
warnings: capabilityResolution.warnings,
|
|
491
|
+
nextAction: 'proceed',
|
|
492
|
+
securityNotice: 'This resumed DSH run uses only current repository evidence and the current host capability catalog; previously delivered ordinary memory is not replayed implicitly.',
|
|
493
|
+
ennoOduno: stateForSnapshot(snapshot),
|
|
494
|
+
};
|
|
495
|
+
if (decision.executionLease !== null)
|
|
496
|
+
resumedLeases.set(runId, decision.executionLease);
|
|
497
|
+
return { admitted: !event.signal.aborted, prepared, catalog: event.capabilities };
|
|
368
498
|
});
|
|
369
499
|
const mapPreStep = async (payload) => {
|
|
370
500
|
const nativeSession = payload.agent.session;
|
|
@@ -424,23 +554,30 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
424
554
|
signal: payload.signal,
|
|
425
555
|
};
|
|
426
556
|
};
|
|
427
|
-
const contextMessages = async (event,
|
|
557
|
+
const contextMessages = async (event, _result) => {
|
|
428
558
|
const item = currentForAgentEvent(event.agent.id, event.sessionId, event.turn, event.nativeSession, event.nativeAgent);
|
|
429
559
|
if (item === undefined || item.sessionId !== event.sessionId)
|
|
430
560
|
throw new Error('kiokuko-dsh turn identity is not bound');
|
|
431
561
|
if (event.nativeSession !== undefined && item.nativeSession !== event.nativeSession)
|
|
432
562
|
throw new Error('kiokuko-dsh native session identity is not bound');
|
|
433
|
-
|
|
563
|
+
// The intake cache is intentionally stable for the logical turn, while
|
|
564
|
+
// Enno operations advance item.prepared after each tool result. Always
|
|
565
|
+
// inject from that current host state instead of replaying the intake-time
|
|
566
|
+
// directive from the cached gate result.
|
|
567
|
+
const prepared = item.prepared;
|
|
568
|
+
const directive = projectDshDirective(prepared.ennoOduno);
|
|
434
569
|
const selection = directive === null ? { routeSkillNames: [], expertRefs: [] } : selectDshDirectiveSources(directive);
|
|
435
|
-
const contextKey = contextInjectionKey(item, event.turn,
|
|
570
|
+
const contextKey = contextInjectionKey(item, event.turn, prepared.ennoOduno, selection);
|
|
436
571
|
if (item.contextInjectionKey === contextKey)
|
|
437
572
|
return [];
|
|
573
|
+
const advisoryEvidence = await advisoryEvidenceFor(item, prepared.ennoOduno);
|
|
438
574
|
const messages = await injectDshContext({
|
|
439
|
-
prepared
|
|
575
|
+
prepared,
|
|
440
576
|
task: event.task,
|
|
441
577
|
routeSkillNames: selection.routeSkillNames,
|
|
442
578
|
expertRefs: selection.expertRefs,
|
|
443
579
|
...(directive === null ? {} : { directive }),
|
|
580
|
+
...(advisoryEvidence === undefined ? {} : { advisoryEvidence }),
|
|
444
581
|
runtime,
|
|
445
582
|
});
|
|
446
583
|
const nativeMessages = messages.map((message) => ({
|
|
@@ -475,6 +612,7 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
475
612
|
...(state.deliveryId === undefined ? {} : { deliveryId: state.deliveryId }),
|
|
476
613
|
revision: state.revision,
|
|
477
614
|
routeEpoch: state.routeEpoch,
|
|
615
|
+
...(state.advisoryRoundDigest === undefined ? {} : { advisoryRoundDigest: state.advisoryRoundDigest }),
|
|
478
616
|
...(state.leaseToken === undefined ? {} : { leaseToken: state.leaseToken }),
|
|
479
617
|
...(state.workUnitId === undefined ? {} : { workUnitId: state.workUnitId }),
|
|
480
618
|
};
|
|
@@ -491,13 +629,14 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
491
629
|
|| binding.orchestrationId !== run.orchestrationId
|
|
492
630
|
|| currentState === undefined
|
|
493
631
|
|| binding.revision !== currentState.revision
|
|
494
|
-
|| binding.routeEpoch !== currentState.routeEpoch
|
|
632
|
+
|| binding.routeEpoch !== currentState.routeEpoch
|
|
633
|
+
|| binding.advisoryRoundDigest !== currentState.advisoryRoundDigest)
|
|
495
634
|
throw new Error('kiokuko-dsh tool binding is not authoritative');
|
|
496
635
|
if (signal?.aborted)
|
|
497
636
|
throw signal.reason;
|
|
498
637
|
const cwd = run.cwd;
|
|
499
638
|
const response = await runtime.withDatabase(async (database) => {
|
|
500
|
-
const input = operationInput(args, binding, cwd, operation);
|
|
639
|
+
const input = operationInput(args, binding, cwd, operation, run.catalog);
|
|
501
640
|
if (operation === 'enno_ideal_submit')
|
|
502
641
|
return submitOdunoIdeal(database, input);
|
|
503
642
|
if (operation === 'enno_plan_submit')
|
|
@@ -506,13 +645,19 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
506
645
|
return reportEnnoWork(database, input);
|
|
507
646
|
if (operation === 'enno_finish')
|
|
508
647
|
return finishEnno(database, input);
|
|
509
|
-
if (operation === 'enno_meditation_submit')
|
|
510
|
-
|
|
648
|
+
if (operation === 'enno_meditation_submit') {
|
|
649
|
+
// The native DSH turn still has a tool result, final assistant
|
|
650
|
+
// message, step end, and turn end to commit. Keep the ledger open
|
|
651
|
+
// until the idle lifecycle flushes that ordered suffix.
|
|
652
|
+
return submitOdunoMeditation(database, input, { deferLedgerTerminalization: true });
|
|
653
|
+
}
|
|
511
654
|
if (operation === 'curator_check')
|
|
512
655
|
return curateMemoryCandidates(database, input);
|
|
513
656
|
return checkpointScopedMemoryWithProvenance(database, input, { clientKind: 'dsh', actor: 'dsh', reference: 'dsh' }, signal);
|
|
514
657
|
});
|
|
515
658
|
if (run !== undefined && isEnnoResponse(response)) {
|
|
659
|
+
if (binding.advisoryRoundDigest !== undefined)
|
|
660
|
+
advisoryRounds.delete(run.runId);
|
|
516
661
|
run.prepared = { ...run.prepared, ennoOduno: response.ennoOduno };
|
|
517
662
|
const next = policyState(response.ennoOduno, run, run.sessionId, response.executionLease);
|
|
518
663
|
states.set(run.runId, next);
|
|
@@ -565,6 +710,13 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
565
710
|
});
|
|
566
711
|
});
|
|
567
712
|
item.prepared = { ...item.prepared, ennoOduno: response.ennoOduno };
|
|
713
|
+
if (response.ennoOduno.advisoryPhaseState.state !== 'aggregated') {
|
|
714
|
+
throw new Error('kiokuko-dsh advisory submission did not produce an aggregated round');
|
|
715
|
+
}
|
|
716
|
+
advisoryRounds.set(item.runId, {
|
|
717
|
+
stateDigest: response.ennoOduno.advisoryPhaseState.inputDigest,
|
|
718
|
+
result,
|
|
719
|
+
});
|
|
568
720
|
const next = policyState(response.ennoOduno, item, item.sessionId);
|
|
569
721
|
states.set(item.runId, next);
|
|
570
722
|
policy.setState(next);
|
|
@@ -595,6 +747,7 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
595
747
|
if (item.contextInjectionKey === contextKey)
|
|
596
748
|
return;
|
|
597
749
|
const projectedDirective = projectDshDirective({ nextAction: state.nextAction, directive: state.directive });
|
|
750
|
+
const advisoryEvidence = await advisoryEvidenceFor(item, state);
|
|
598
751
|
const messages = await injectDshContext({
|
|
599
752
|
prepared: item.prepared,
|
|
600
753
|
task: item.task,
|
|
@@ -603,6 +756,7 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
603
756
|
...(projectedDirective === null
|
|
604
757
|
? {}
|
|
605
758
|
: { directive: projectedDirective }),
|
|
759
|
+
...(advisoryEvidence === undefined ? {} : { advisoryEvidence }),
|
|
606
760
|
runtime,
|
|
607
761
|
});
|
|
608
762
|
for (const message of messages) {
|
|
@@ -703,6 +857,8 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
703
857
|
}
|
|
704
858
|
if (![...turns.values()].some((candidate) => candidate.runId === input.runId))
|
|
705
859
|
states.delete(input.runId);
|
|
860
|
+
advisoryRounds.delete(input.runId);
|
|
861
|
+
resumedLeases.delete(input.runId);
|
|
706
862
|
};
|
|
707
863
|
const errorDisposer = ctx.on('agent/error', (event) => {
|
|
708
864
|
const item = currentForAgentEvent(event.agent.id, event.agent.session?.id ?? event.agent.sessionId, undefined, event.agent.session, event.agent);
|
|
@@ -790,6 +946,9 @@ export function createDshHostAdapter(ctx, options = {}) {
|
|
|
790
946
|
latestBySession.clear();
|
|
791
947
|
states.clear();
|
|
792
948
|
activeModeRequests.clear();
|
|
949
|
+
advisoryRounds.clear();
|
|
950
|
+
resumedTurns.clear();
|
|
951
|
+
resumedLeases.clear();
|
|
793
952
|
if (failures.length === 1)
|
|
794
953
|
throw failures[0];
|
|
795
954
|
if (failures.length > 1)
|