kiokuko-dsh 0.2.9 → 0.2.11
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/agenticreplay-libraries.d.ts +12 -0
- package/dist/dsh/agenticreplay-libraries.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-libraries.js.map +1 -1
- package/dist/dsh/agenticreplay-recorder.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-recorder.js +5 -2
- package/dist/dsh/agenticreplay-recorder.js.map +1 -1
- package/dist/dsh/agenticreplay-types.d.ts +1 -1
- package/dist/dsh/agenticreplay-types.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-writer.d.ts +4 -0
- package/dist/dsh/agenticreplay-writer.d.ts.map +1 -0
- package/dist/dsh/agenticreplay-writer.js +50 -0
- package/dist/dsh/agenticreplay-writer.js.map +1 -0
- package/dist/dsh/coding-workflow/host.d.ts +2 -0
- package/dist/dsh/coding-workflow/host.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/host.js +2 -0
- package/dist/dsh/coding-workflow/host.js.map +1 -1
- package/dist/dsh/coding-workflow/service.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/service.js +11 -4
- package/dist/dsh/coding-workflow/service.js.map +1 -1
- package/dist/dsh/core/host.d.ts.map +1 -1
- package/dist/dsh/core/host.js +4 -0
- package/dist/dsh/core/host.js.map +1 -1
- package/dist/dsh/decisions/akinator-classification.d.ts +1 -1
- package/dist/dsh/decisions/akinator-classification.d.ts.map +1 -1
- package/dist/dsh/decisions/akinator-classification.js +4 -0
- package/dist/dsh/decisions/akinator-classification.js.map +1 -1
- package/dist/dsh/host-adapter.d.ts.map +1 -1
- package/dist/dsh/host-adapter.js +4 -0
- package/dist/dsh/host-adapter.js.map +1 -1
- package/dist/dsh/lifecycle-memory.d.ts +1 -0
- package/dist/dsh/lifecycle-memory.d.ts.map +1 -1
- package/dist/dsh/lifecycle-memory.js +16 -5
- package/dist/dsh/lifecycle-memory.js.map +1 -1
- package/dist/dsh/lisp/http.d.ts +1 -1
- package/dist/dsh/lisp/http.d.ts.map +1 -1
- package/dist/dsh/lisp/http.js +5 -3
- package/dist/dsh/lisp/http.js.map +1 -1
- package/dist/dsh/lisp/manager.d.ts +5 -1
- package/dist/dsh/lisp/manager.d.ts.map +1 -1
- package/dist/dsh/lisp/manager.js +30 -4
- 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 +82 -11
- package/dist/dsh/lisp/surface.js.map +1 -1
- package/dist/dsh/lisp/task-authority.d.ts +3 -1
- package/dist/dsh/lisp/task-authority.d.ts.map +1 -1
- package/dist/dsh/lisp/task-authority.js +5 -3
- package/dist/dsh/lisp/task-authority.js.map +1 -1
- package/dist/dsh/lisp-tool-identity.d.ts +33 -0
- package/dist/dsh/lisp-tool-identity.d.ts.map +1 -0
- package/dist/dsh/lisp-tool-identity.js +37 -0
- package/dist/dsh/lisp-tool-identity.js.map +1 -0
- package/dist/dsh/memory-failure.d.ts +17 -0
- package/dist/dsh/memory-failure.d.ts.map +1 -0
- package/dist/dsh/memory-failure.js +38 -0
- package/dist/dsh/memory-failure.js.map +1 -0
- package/dist/dsh/models/opencode-session.d.ts +6 -0
- package/dist/dsh/models/opencode-session.d.ts.map +1 -0
- package/dist/dsh/models/opencode-session.js +21 -0
- package/dist/dsh/models/opencode-session.js.map +1 -0
- package/dist/dsh/models/profiles.d.ts.map +1 -1
- package/dist/dsh/models/profiles.js +2 -0
- package/dist/dsh/models/profiles.js.map +1 -1
- package/dist/dsh/on-demand-intake.d.ts +6 -2
- package/dist/dsh/on-demand-intake.d.ts.map +1 -1
- package/dist/dsh/on-demand-intake.js +70 -2
- 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 +4 -3
- package/dist/dsh/owned-execution.js.map +1 -1
- package/dist/dsh/runtime-evidence.d.ts +10 -0
- package/dist/dsh/runtime-evidence.d.ts.map +1 -0
- package/dist/dsh/runtime-evidence.js +38 -0
- package/dist/dsh/runtime-evidence.js.map +1 -0
- package/dist/dsh/session-memory-finalizer.d.ts.map +1 -1
- package/dist/dsh/session-memory-finalizer.js +7 -13
- package/dist/dsh/session-memory-finalizer.js.map +1 -1
- package/dist/dsh/skill-prompts.json +1 -1
- package/dist/dsh/task-state-surface.js +1 -1
- package/dist/dsh/task-state-surface.js.map +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/dist/memory/replay-review.d.ts +3 -0
- package/dist/memory/replay-review.d.ts.map +1 -1
- package/dist/memory/replay-review.js +15 -2
- package/dist/memory/replay-review.js.map +1 -1
- package/docs/agenticreplay-recording.md +6 -4
- package/docs/dsh-plugin.md +4 -4
- package/docs/getting-started.ja.md +1 -1
- package/docs/lisp.md +9 -2
- package/docs/model-selection.ja.md +2 -0
- package/docs/model-selection.md +2 -0
- package/docs/replay-memory-review.md +2 -0
- package/docs/token-efficiency.md +10 -2
- package/docs/verification.md +8 -0
- package/lisp/supervisor.mjs +8 -3
- package/package.json +16 -16
- package/skills/kiokuko-lisp/SKILL.md +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface MemoryFailureDiagnostic {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
/** Keep a useful cause while redacting credentials, URLs, internal identities and paths. */
|
|
6
|
+
export declare function memoryFailureDiagnostic(error: unknown): MemoryFailureDiagnostic;
|
|
7
|
+
/** Preserve a failed provider finish as a failure; it is never a successful extraction. */
|
|
8
|
+
export declare function memoryStreamFailure(reason: unknown): Error;
|
|
9
|
+
/** A failed worker may update only its still-processing claim, never a completed or replaced owner. */
|
|
10
|
+
export declare function failedFinalizationPatch(current: Readonly<Record<string, unknown>> | undefined, claimNonce: string, error: unknown): {
|
|
11
|
+
status: 'failed';
|
|
12
|
+
claim_nonce: null;
|
|
13
|
+
lease_until: null;
|
|
14
|
+
last_error_code: string;
|
|
15
|
+
last_error_message: string;
|
|
16
|
+
} | undefined;
|
|
17
|
+
//# sourceMappingURL=memory-failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-failure.d.ts","sourceRoot":"","sources":["../../src/dsh/memory-failure.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAK1E,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,uBAAuB,CAa/E;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,KAAK,CAO1D;AAED,uGAAuG;AACvG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG;IACnI,MAAM,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,IAAI,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAC;CAC7G,GAAG,SAAS,CAIZ"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Bounded diagnostic projection. Never copies raw error objects, response/request fields or stacks. */
|
|
2
|
+
import { scrubAgenticReplayText } from './agenticreplay-security.js';
|
|
3
|
+
import { redactDshSourceText } from '../context/memory-projection.js';
|
|
4
|
+
const providerCodes = new Set(['INVALID_REQUEST', 'AUTHENTICATION_ERROR', 'MISSING_CREDENTIAL', 'RATE_LIMITED', 'API_ERROR', 'ABORTED', 'MODEL_NOT_FOUND', 'PROTOCOL_ERROR', 'NETWORK_ERROR', 'TIMEOUT']);
|
|
5
|
+
const safeCodes = new Set(['USAGE_ERROR', 'VALIDATION_ERROR', 'NOT_FOUND', 'CONFLICT', 'DATABASE_ERROR', 'BACKPRESSURE', 'SERVICE_UNAVAILABLE', 'SECURITY_REJECTION', 'AUTHENTICATION_ERROR', 'INTEGRITY_ERROR', 'PARTIAL_FAILURE', 'NOT_IMPLEMENTED', 'FINALIZATION_FAILED', 'INVALID_MODEL_JSON', 'INVALID_MODEL_OUTPUT', 'SQLITE_BUSY', 'SQLITE_LOCKED', 'ERR_SQLITE_ERROR', 'ECONNREFUSED', 'ECONNRESET', 'ETIMEDOUT', 'ENOTFOUND', 'EAI_AGAIN', 'LLM_STREAM_ERROR', 'LLM_MISSING_FINISH', 'LLM_OUTPUT_LIMIT', 'LLM_UNEXPECTED_TOOL_CALLS', 'LLM_ABORTED', ...[...providerCodes].map(code => `LLM_${code}`)]);
|
|
6
|
+
const record = (value) => value !== null && typeof value === 'object' ? value : undefined;
|
|
7
|
+
/** Keep a useful cause while redacting credentials, URLs, internal identities and paths. */
|
|
8
|
+
export function memoryFailureDiagnostic(error) {
|
|
9
|
+
const value = record(error);
|
|
10
|
+
const code = typeof value?.code === 'string' && safeCodes.has(value.code) ? value.code
|
|
11
|
+
: error instanceof SyntaxError ? 'INVALID_MODEL_JSON' : value?.name === 'ZodError' ? 'INVALID_MODEL_OUTPUT' : 'FINALIZATION_FAILED';
|
|
12
|
+
const raw = error instanceof Error ? error.message : typeof error === 'string' ? error : typeof value?.message === 'string' ? value.message : 'Memory operation failed without a structured error';
|
|
13
|
+
const bounded = raw.slice(0, 8192);
|
|
14
|
+
// Error prose can disclose credentials without ':' or '='. Retain only the explanation before a credential marker.
|
|
15
|
+
const credential = bounded.search(/\b(?:api[\s_-]?key|access[\s_-]?token|refresh[\s_-]?token|client[\s_-]?secret|password|passwd|secret|credentials?|authorization|proxy-authorization|cookies?|set-cookie|token|bearer|basic)\b/iu);
|
|
16
|
+
const explanation = credential < 0 ? bounded : `${bounded.slice(0, credential)}[credential detail redacted]`;
|
|
17
|
+
const scrubbed = scrubAgenticReplayText(explanation).replace(/\bhttps?:\/\/[^\s"'<>]+/giu, '[url redacted]');
|
|
18
|
+
const safe = redactDshSourceText(scrubbed) ?? 'Diagnostic redacted';
|
|
19
|
+
const status = typeof value?.status === 'number' && Number.isInteger(value.status) && value.status >= 100 && value.status <= 599 ? `HTTP ${value.status}: ` : '';
|
|
20
|
+
return { code, message: (status + safe).replace(/[\p{Cc}\p{Cf}]/gu, ' ').replace(/\s+/gu, ' ').trim().slice(0, 2000) };
|
|
21
|
+
}
|
|
22
|
+
/** Preserve a failed provider finish as a failure; it is never a successful extraction. */
|
|
23
|
+
export function memoryStreamFailure(reason) {
|
|
24
|
+
const value = record(reason), failure = record(value?.failure);
|
|
25
|
+
const kind = typeof value?.kind === 'string' && ['error', 'aborted', 'length', 'tool-calls'].includes(value.kind) ? value.kind : 'missing-finish';
|
|
26
|
+
const code = kind === 'error' ? typeof failure?.code === 'string' && providerCodes.has(failure.code) ? `LLM_${failure.code}` : 'LLM_STREAM_ERROR'
|
|
27
|
+
: kind === 'aborted' ? 'LLM_ABORTED' : kind === 'length' ? 'LLM_OUTPUT_LIMIT' : kind === 'tool-calls' ? 'LLM_UNEXPECTED_TOOL_CALLS' : 'LLM_MISSING_FINISH';
|
|
28
|
+
const message = typeof failure?.message === 'string' ? failure.message : `Memory finalization did not stop normally (${kind})`;
|
|
29
|
+
return Object.assign(new Error(message), { code, ...(typeof failure?.status === 'number' ? { status: failure.status } : {}) });
|
|
30
|
+
}
|
|
31
|
+
/** A failed worker may update only its still-processing claim, never a completed or replaced owner. */
|
|
32
|
+
export function failedFinalizationPatch(current, claimNonce, error) {
|
|
33
|
+
if (!claimNonce || current?.status !== 'processing' || current.claim_nonce !== claimNonce)
|
|
34
|
+
return undefined;
|
|
35
|
+
const failure = memoryFailureDiagnostic(error);
|
|
36
|
+
return { status: 'failed', claim_nonce: null, lease_until: null, last_error_code: failure.code, last_error_message: failure.message };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=memory-failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-failure.js","sourceRoot":"","sources":["../../src/dsh/memory-failure.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;AAC1M,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,aAAa,EAAE,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACllB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAuC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,SAAS,CAAC;AAEn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AC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,oBAAoB,CAAC;IAC7J,MAAM,OAAO,GAAG,OAAO,OAAO,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,8CAA8C,IAAI,GAAG,CAAC;IAC/H,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACjI,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,uBAAuB,CAAC,OAAsD,EAAE,UAAkB,EAAE,KAAc;IAGhI,IAAI,CAAC,UAAU,IAAI,OAAO,EAAE,MAAM,KAAK,YAAY,IAAI,OAAO,CAAC,WAAW,KAAK,UAAU;QAAE,OAAO,SAAS,CAAC;IAC5G,MAAM,OAAO,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACxI,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PiAiProvider } from './vendor/pi-ai.js';
|
|
2
|
+
/** Keep deployment headers; otherwise use the conversation or a fresh one-shot identity. */
|
|
3
|
+
export declare function openCodeSessionHeaders(sessionId: string | undefined, headers?: Record<string, string | null>): Record<string, string | null>;
|
|
4
|
+
/** Compose the public Provider stream hooks after protocol selection, without changing a host adapter. */
|
|
5
|
+
export declare function openCodeSessionProvider(provider: PiAiProvider, endpoint: string): PiAiProvider;
|
|
6
|
+
//# sourceMappingURL=opencode-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-session.d.ts","sourceRoot":"","sources":["../../../src/dsh/models/opencode-session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,4FAA4F;AAC5F,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAGhJ;AAED,0GAA0G;AAC1G,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAY9F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** OpenCode routing metadata for transports owned by this plugin. */
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
/** Keep deployment headers; otherwise use the conversation or a fresh one-shot identity. */
|
|
4
|
+
export function openCodeSessionHeaders(sessionId, headers = {}) {
|
|
5
|
+
if (Object.keys(headers).some(name => name.toLowerCase() === 'x-opencode-session'))
|
|
6
|
+
return headers;
|
|
7
|
+
return { ...headers, 'x-opencode-session': sessionId || randomUUID() };
|
|
8
|
+
}
|
|
9
|
+
/** Compose the public Provider stream hooks after protocol selection, without changing a host adapter. */
|
|
10
|
+
export function openCodeSessionProvider(provider, endpoint) {
|
|
11
|
+
const url = new URL(endpoint);
|
|
12
|
+
if (url.origin !== 'https://opencode.ai' || !/^\/zen\/(?:go\/)?v1\/?$/.test(url.pathname))
|
|
13
|
+
return provider;
|
|
14
|
+
const stream = (model, context, options) => provider.stream(model, context, { ...options, headers: openCodeSessionHeaders(options?.sessionId, options?.headers) });
|
|
15
|
+
return {
|
|
16
|
+
...provider,
|
|
17
|
+
stream,
|
|
18
|
+
streamSimple: (model, context, options) => provider.streamSimple(model, context, { ...options, headers: openCodeSessionHeaders(options?.sessionId, options?.headers) }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=opencode-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-session.js","sourceRoot":"","sources":["../../../src/dsh/models/opencode-session.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,4FAA4F;AAC5F,MAAM,UAAU,sBAAsB,CAAC,SAA6B,EAAE,UAAyC,EAAE;IAC/G,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,oBAAoB,CAAC;QAAE,OAAO,OAAO,CAAC;IACnG,OAAO,EAAE,GAAG,OAAO,EAAE,oBAAoB,EAAE,SAAS,IAAI,UAAU,EAAE,EAAE,CAAC;AACzE,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,uBAAuB,CAAC,QAAsB,EAAE,QAAgB;IAC9E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,GAAG,CAAC,MAAM,KAAK,qBAAqB,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAG3G,MAAM,MAAM,GAAG,CAAC,KAAoB,EAAE,OAAsB,EAAE,OAAsB,EAAE,EAAE,CACtF,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACzH,OAAO;QACL,GAAG,QAAQ;QACX,MAAM;QACN,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;KACxK,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/dsh/models/profiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/dsh/models/profiles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAC5C,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,MAAM,CAER;AACD,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAOvG;AACD,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,GAAG,MAAM,CAMpE;AACD,uFAAuF;AACvF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,GACrD,YAAY,CA8Bd;AAmDD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,SAAS,UAAU,EAAE,GACjC,mBAAmB,CAgBrB;AACD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,GACrD,2BAA2B,CA0F7B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
|
|
2
|
+
import { openCodeSessionProvider } from "./opencode-session.js";
|
|
2
3
|
import { adapterBuiltinProviders, } from "./vendor/pi-ai.js";
|
|
3
4
|
import { credentialKey, } from "./contracts.js";
|
|
4
5
|
/**
|
|
@@ -195,6 +196,7 @@ export function connectionProfile(connection, report) {
|
|
|
195
196
|
delete provider.refreshModels;
|
|
196
197
|
if (connection.kind === "infron")
|
|
197
198
|
provider = infronProvider(provider, connection.serviceTier, report);
|
|
199
|
+
provider = openCodeSessionProvider(provider, connection.baseURL);
|
|
198
200
|
return {
|
|
199
201
|
provider: connection.id,
|
|
200
202
|
displayName: connection.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/dsh/models/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/dsh/models/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EACL,uBAAuB,GAGxB,MAAM,mBAAmB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EAAE,GAAG,IAAI,GAAG,IAAI;QACtC,uBAAuB,EAAE,IAAI,GAAG,IAAI;QACpC,oBAAoB,EAAE,IAAI,GAAG,IAAI;QACjC,mBAAmB,EAAE,IAAI,GAAG,CAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAC1E;QACD,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,WAAW,EAAE,kBAAkB,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC"}
|
|
@@ -3,12 +3,12 @@ import type { DshLogEvent } from './session-memory-finalizer.js';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { type TaskType } from '../akinator/types.js';
|
|
5
5
|
import type { AkinatorTaskClassification } from './decisions/akinator-classification.js';
|
|
6
|
-
import type
|
|
6
|
+
import { type TaskSnapshot } from './task-state.js';
|
|
7
7
|
import { type RequestIntentContext, type RequestIntentDecision, type RequestIntentInterpretation } from './decisions/request-intent.js';
|
|
8
8
|
import { type MemoryOwnerKind } from './memory-owner.js';
|
|
9
9
|
export type { IntakeMode } from './intake-mode.js';
|
|
10
10
|
export declare const TASK_PREPARE_TOOL = "prepare_requested_work";
|
|
11
|
-
export declare const ON_DEMAND_GUIDANCE = "The original user request may be answered now without selecting a task category. Ordinary native Bash needs no memory, Goal or prepare_requested_work round trip when the
|
|
11
|
+
export declare const ON_DEMAND_GUIDANCE = "The original user request may be answered now without selecting a task category. Ordinary native Bash needs no memory, Goal or prepare_requested_work round trip, including when optional workflow metadata exists; native permissions and human Stop remain authoritative. Registered root Lisp tools delegate to the Lisp runtime without an optional preparation round trip; foreground processes use native Bash permissions, sandbox, approval and Stop. Explicitly prepared or protected workflow effects retain their task, Plan and coding-choice checks. Owned or explicitly enrolled work retains its authority checks. Preserve the original utterance, every requested action, negation, quotation, target uncertainty, and current-session references; never replace it with a model rewrite. Use only the supplied active Goal and proposal references from this exact native session, never another chat. Classify relation as new, same_scope_continuation, scope_change, or unknown, and action as answer, research, verify, change, operate, or unknown; do not infer either from a fixed phrase or tool name. \u201CCheck how it behaves\u201D is verification/research even when the next tool is Bash. This interpretation grants no native permission. When the decision provider is unavailable, abstains, or returns unknown, interpret the same context in the main model; ask the user only if the action or referenced target remains unclear, and preserve active work while waiting. Native read, glob, grep, web_search and web_fetch demands can gather evidence without preparation. Do not call prepare_requested_work merely to read a plan or inspect files. prepare_requested_work accepts either the legacy taskType alone or a requestIntent with exact evidenceRefs from the supplied context. taskOperation is optional and describes a transition of an existing activeTask, not starting the requested work itself. Omit taskOperation when activeTask is null or the request does not ask for a state transition; it never accepts a rewritten task or target and never changes native permissions. Installed Skill reads need no preparation and do not activate execution. Do not prepare work merely to load a skill. Plan, Goal, cancellation, memory-owner and execution ownership still apply. If only run_code is exposed, use the exact preparation-only carrier returned by this tool contract; the host intercepts it without evaluating code.";
|
|
12
12
|
declare const preparationFieldsSchema: z.ZodObject<{
|
|
13
13
|
taskType: z.ZodOptional<z.ZodEnum<{
|
|
14
14
|
build: "build";
|
|
@@ -172,6 +172,10 @@ export declare class OnDemandIntake {
|
|
|
172
172
|
/** A current host-validated control call, never arbitrary code or a name-based exemption. */
|
|
173
173
|
/** Exact registered native-tool proof, never a model flag or a generic task-control bypass. */
|
|
174
174
|
unownedNative(execution: Execution): boolean;
|
|
175
|
+
/** Direct native Bash follows native permissions, independently of optional task intake. */
|
|
176
|
+
nativeCommand(execution: Execution): boolean;
|
|
177
|
+
/** Delegate real root Lisp tools to their own effect/lease/approval authority. */
|
|
178
|
+
nativeLisp(execution: Execution): boolean;
|
|
175
179
|
preparationOnly(execution: Execution): boolean;
|
|
176
180
|
pending(agent: DemandAgent): boolean;
|
|
177
181
|
/** An admitted host continuation still needs capture to retire the previous turn's receipt. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-demand-intake.d.ts","sourceRoot":"","sources":["../../src/dsh/on-demand-intake.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"on-demand-intake.d.ts","sourceRoot":"","sources":["../../src/dsh/on-demand-intake.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAA;AACxF,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EACL,KAAK,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,KAAK,2BAA2B,EAAgC,MAAM,+BAA+B,CAAA;AAC9J,OAAO,EAA6C,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnG,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,eAAO,MAAM,iBAAiB,2BAA2B,CAAA;AACzD,eAAO,MAAM,kBAAkB,w2EAA81E,CAAA;AAI73E,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAGlB,CAAA;AACX,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAMjE,MAAM,WAAW,WAAW;IAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,IAAI,SAAS,WAAW,EAAE,CAAA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AAI,IAAI;IACN,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IACtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAC/B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLispImplementation, isLispNativeCommand, withRootLispAdmission, rememberLispConversation } from './lisp-tool-identity.js';
|
|
1
2
|
import { ExecutionSelectionPending } from './execution-pending.js';
|
|
2
3
|
import { executionClarification } from './intake-clarification.js';
|
|
3
4
|
import { randomUUID } from 'node:crypto';
|
|
@@ -5,10 +6,11 @@ import { z } from 'zod';
|
|
|
5
6
|
import { TASK_TYPES } from '../akinator/types.js';
|
|
6
7
|
import { canonicalContentHash } from '../serialization/validate.js';
|
|
7
8
|
import { KIOKUKO_DSH_SOURCE_KIND } from './plugin-source.js';
|
|
9
|
+
import { taskAllowedOperations } from './task-state.js';
|
|
8
10
|
import { createRequestIntentContext, unresolvedRequestIntent, validateMainModelRequestIntent, requestIntentReferenceIds, requestIntentMessageRefs, requestIntentTaskType, RequestIntentSubmissionSchema } from './decisions/request-intent.js';
|
|
9
11
|
import { memoryOwnerKind } from './memory-owner.js';
|
|
10
12
|
export const TASK_PREPARE_TOOL = 'prepare_requested_work';
|
|
11
|
-
export const ON_DEMAND_GUIDANCE = 'The original user request may be answered now without selecting a task category. Ordinary native Bash needs no memory, Goal or prepare_requested_work round trip when the
|
|
13
|
+
export const ON_DEMAND_GUIDANCE = 'The original user request may be answered now without selecting a task category. Ordinary native Bash needs no memory, Goal or prepare_requested_work round trip, including when optional workflow metadata exists; native permissions and human Stop remain authoritative. Registered root Lisp tools delegate to the Lisp runtime without an optional preparation round trip; foreground processes use native Bash permissions, sandbox, approval and Stop. Explicitly prepared or protected workflow effects retain their task, Plan and coding-choice checks. Owned or explicitly enrolled work retains its authority checks. Preserve the original utterance, every requested action, negation, quotation, target uncertainty, and current-session references; never replace it with a model rewrite. Use only the supplied active Goal and proposal references from this exact native session, never another chat. Classify relation as new, same_scope_continuation, scope_change, or unknown, and action as answer, research, verify, change, operate, or unknown; do not infer either from a fixed phrase or tool name. “Check how it behaves” is verification/research even when the next tool is Bash. This interpretation grants no native permission. When the decision provider is unavailable, abstains, or returns unknown, interpret the same context in the main model; ask the user only if the action or referenced target remains unclear, and preserve active work while waiting. Native read, glob, grep, web_search and web_fetch demands can gather evidence without preparation. Do not call prepare_requested_work merely to read a plan or inspect files. prepare_requested_work accepts either the legacy taskType alone or a requestIntent with exact evidenceRefs from the supplied context. taskOperation is optional and describes a transition of an existing activeTask, not starting the requested work itself. Omit taskOperation when activeTask is null or the request does not ask for a state transition; it never accepts a rewritten task or target and never changes native permissions. Installed Skill reads need no preparation and do not activate execution. Do not prepare work merely to load a skill. Plan, Goal, cancellation, memory-owner and execution ownership still apply. If only run_code is exposed, use the exact preparation-only carrier returned by this tool contract; the host intercepts it without evaluating code.';
|
|
12
14
|
const ACTION_TYPES = TASK_TYPES.filter(type => type !== 'chat');
|
|
13
15
|
const NO_ACTIVE_GOAL_GUIDANCE = 'The current context has no active Goal. same_scope_continuation may refer to the exact current-session conversation without a formal Goal; it grants no execution permission. scope_change requires an active Goal or task. If the original request clearly specifies a self-contained task, use relation=new and the action it requests (verify for verification), with the exact current evidenceRefs. Otherwise clarify the intended target with the user. Preserve the original scope, constraints and native permissions.';
|
|
14
16
|
const preparationFieldsSchema = z.object({
|
|
@@ -213,6 +215,8 @@ export class OnDemandIntake {
|
|
|
213
215
|
humanContents: new Map(humanMessages(input.messages).map(message => [humanId(message), canonicalContentHash(message)])),
|
|
214
216
|
status: 'capturing', intent: { deferInference: true }, memoryOwner: 'none', preparationCalls: new Set(), controller };
|
|
215
217
|
this.#turns.set(sessionId, state);
|
|
218
|
+
rememberLispConversation(input.agent, () => !this.options.onlyWhenDeferred && !this.#stopped && this.#turns.get(sessionId) === state
|
|
219
|
+
&& state.status === 'answer' && !state.input.signal.aborted && this.host.nativeChild?.(input.agent) !== true);
|
|
216
220
|
const promise = (async () => {
|
|
217
221
|
await this.host.validate(input);
|
|
218
222
|
this.assertCurrent(state);
|
|
@@ -445,7 +449,13 @@ export class OnDemandIntake {
|
|
|
445
449
|
case 'unknown_reference': throw new Error('Request interpretation references another request, stale revision, or unknown proposal. Use only the exact current evidenceRefs from the supplied context.');
|
|
446
450
|
case 'unresolved_intent': throw new Error('Request relation or action is unresolved. Interpret the original request and current context; clarify with the user if its action or target remains unclear.');
|
|
447
451
|
case 'invalid_submission': throw new Error('Invalid request interpretation. Supply a relation, action and unique exact current evidenceRefs.');
|
|
448
|
-
case 'invalid_task_operation':
|
|
452
|
+
case 'invalid_task_operation': {
|
|
453
|
+
const task = state.requestIntentContext.activeTask;
|
|
454
|
+
if (!task)
|
|
455
|
+
throw new Error('No active SQLite task is supplied in the current request context. taskOperation describes a transition of an existing task, not starting the requested work. To prepare the original request, omit taskOperation and retry with the same exact current evidenceRefs. Native permissions remain unchanged.');
|
|
456
|
+
const allowed = taskAllowedOperations(task);
|
|
457
|
+
throw new Error(`The proposed task operation ${submission.taskOperation} is not allowed for the current SQLite task state ${task.state} (run status ${task.runStatus}, revision ${task.revision}, generation ${task.generation}). Allowed state operations: ${allowed.join(', ') || 'none'}. If no state transition is requested, omit taskOperation and retry with the exact current evidenceRefs. Otherwise use task_operation or /kioku-task with an allowed explicit operation; terminal resume requires an explicit operation, and native permissions and required evidence remain unchanged.`);
|
|
458
|
+
}
|
|
449
459
|
}
|
|
450
460
|
}
|
|
451
461
|
const bound = result.decision;
|
|
@@ -530,6 +540,40 @@ export class OnDemandIntake {
|
|
|
530
540
|
&& !!proof && proof.turn === state && proof.execute === this.definition(execution)?.execute
|
|
531
541
|
&& proof.nativeUnownedDigest === canonicalContentHash(execution.arguments);
|
|
532
542
|
}
|
|
543
|
+
/** Direct native Bash follows native permissions, independently of optional task intake. */
|
|
544
|
+
nativeCommand(execution) {
|
|
545
|
+
const state = this.bound(execution), actual = this.definition(execution), proof = this.#executions.get(execution);
|
|
546
|
+
if (!this.options.onlyWhenDeferred && !this.#stopped && actual && isLispNativeCommand(execution, actual.execute))
|
|
547
|
+
return !proof || proof.turn === state && proof.execute === actual.execute && proof.nativeCommandDigest === canonicalContentHash(execution.arguments);
|
|
548
|
+
if (this.options.onlyWhenDeferred || this.#stopped || execution.signal.aborted || execution.name !== 'bash'
|
|
549
|
+
|| execution.parent !== undefined || !state || state.input.signal.aborted || !actual
|
|
550
|
+
|| execution.agent && this.host.nativeChild?.(execution.agent))
|
|
551
|
+
return false;
|
|
552
|
+
try {
|
|
553
|
+
this.assertCurrent(state);
|
|
554
|
+
}
|
|
555
|
+
catch {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
return !proof || proof.turn === state && proof.execute === actual.execute
|
|
559
|
+
&& proof.nativeCommandDigest === canonicalContentHash(execution.arguments);
|
|
560
|
+
}
|
|
561
|
+
/** Delegate real root Lisp tools to their own effect/lease/approval authority. */
|
|
562
|
+
nativeLisp(execution) {
|
|
563
|
+
const state = this.bound(execution), actual = this.definition(execution), proof = this.#executions.get(execution);
|
|
564
|
+
if (this.options.onlyWhenDeferred || this.#stopped || execution.signal.aborted || execution.parent !== undefined
|
|
565
|
+
|| !state || state.status !== 'answer' || state.input.signal.aborted || !actual || !isLispImplementation(actual.execute)
|
|
566
|
+
|| execution.agent && this.host.nativeChild?.(execution.agent))
|
|
567
|
+
return false;
|
|
568
|
+
try {
|
|
569
|
+
this.assertCurrent(state);
|
|
570
|
+
}
|
|
571
|
+
catch {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
return !proof || proof.turn === state && proof.execute === actual.execute
|
|
575
|
+
&& proof.nativeLispDigest === canonicalContentHash(execution.arguments);
|
|
576
|
+
}
|
|
533
577
|
preparationOnly(execution) {
|
|
534
578
|
if (this.isControl(execution))
|
|
535
579
|
return true;
|
|
@@ -669,6 +713,16 @@ export class OnDemandIntake {
|
|
|
669
713
|
this.assertCurrent(state);
|
|
670
714
|
if (state.confirmationResume && execution.name !== TASK_PREPARE_TOOL && this.host.ready(state.input.agent, state.input.turn))
|
|
671
715
|
this.acknowledgeExisting(state);
|
|
716
|
+
if (this.nativeCommand(execution)) {
|
|
717
|
+
this.#executions.set(execution, { turn: state, execute: actual.execute, nativeCommandDigest: canonicalContentHash(execution.arguments) });
|
|
718
|
+
const decision = await next();
|
|
719
|
+
return decision?.kind === 'cancel' ? denied('Native tool policy cancelled this call') : decision;
|
|
720
|
+
}
|
|
721
|
+
if (this.nativeLisp(execution)) {
|
|
722
|
+
this.#executions.set(execution, { turn: state, execute: actual.execute, nativeLispDigest: canonicalContentHash(execution.arguments) });
|
|
723
|
+
const decision = await next();
|
|
724
|
+
return decision?.kind === 'cancel' ? denied('Native tool policy cancelled this call') : decision;
|
|
725
|
+
}
|
|
672
726
|
if (state.nativeUnowned && UNOWNED_NATIVE_TOOLS.has(execution.name) && execution.parent === undefined) {
|
|
673
727
|
if (await this.host.nativeOwnership?.(state.input) !== 'unowned') {
|
|
674
728
|
state.nativeUnowned = false;
|
|
@@ -743,6 +797,16 @@ export class OnDemandIntake {
|
|
|
743
797
|
throw new Error('On-demand dispatch identity changed');
|
|
744
798
|
this.assertCurrent(state);
|
|
745
799
|
execution.signal = AbortSignal.any([execution.signal, state.input.signal, this.#lifecycle.signal]);
|
|
800
|
+
if (proof.nativeCommandDigest !== undefined) {
|
|
801
|
+
if (!this.nativeCommand(execution))
|
|
802
|
+
throw new Error('Native command identity or arguments changed');
|
|
803
|
+
return next();
|
|
804
|
+
}
|
|
805
|
+
if (proof.nativeLispDigest !== undefined) {
|
|
806
|
+
if (!this.nativeLisp(execution))
|
|
807
|
+
throw new Error('Native Lisp identity or arguments changed');
|
|
808
|
+
return withRootLispAdmission(execution, () => this.nativeLisp(execution), next);
|
|
809
|
+
}
|
|
746
810
|
if (proof.nativeUnownedDigest !== undefined) {
|
|
747
811
|
if (!this.unownedNative(execution) || await this.host.nativeOwnership?.(state.input) !== 'unowned') {
|
|
748
812
|
state.nativeUnowned = false;
|
|
@@ -800,6 +864,10 @@ export class OnDemandIntake {
|
|
|
800
864
|
const proof = this.#executions.get(execution);
|
|
801
865
|
if (!proof || proof.turn !== state || proof.execute !== actual.execute || ['closed', 'stale', 'capturing'].includes(state.status))
|
|
802
866
|
return 'Tool execution has no current on-demand preparation';
|
|
867
|
+
if (proof.nativeCommandDigest !== undefined)
|
|
868
|
+
return this.nativeCommand(execution) ? undefined : 'Native command identity or arguments changed';
|
|
869
|
+
if (proof.nativeLispDigest !== undefined)
|
|
870
|
+
return this.nativeLisp(execution) ? undefined : 'Native Lisp identity or arguments changed';
|
|
803
871
|
if (proof.nativeUnownedDigest !== undefined)
|
|
804
872
|
return this.unownedNative(execution) ? undefined : 'Native unowned execution proof changed';
|
|
805
873
|
if (proof.carrier)
|