@astrosheep/keiyaku 4.6.32 → 4.6.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/README.md +55 -97
- package/build/plugins/pi/keiyaku.ts +2 -9
- package/build/skills/keiyaku-akuma/SKILL.md +13 -9
- package/build/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/src/akuma/akuma-instance.d.ts +11 -0
- package/build/src/akuma/akuma-instance.js +1 -2
- package/build/src/akuma/akuma-observe.js +73 -14
- package/build/src/akuma/akuma-selection-execution.d.ts +82 -7
- package/build/src/akuma/akuma-selection-execution.js +26 -27
- package/build/src/akuma/akuma-wait.d.ts +40 -1
- package/build/src/akuma/akuma-wait.js +58 -29
- package/build/src/akuma/akuma.d.ts +11 -0
- package/build/src/akuma/body.js +13 -18
- package/build/src/akuma/call-initial-tell.d.ts +0 -1
- package/build/src/akuma/call-initial-tell.js +0 -1
- package/build/src/akuma/heart/activity-schema.d.ts +16 -0
- package/build/src/akuma/heart/activity-schema.js +7 -0
- package/build/src/akuma/heart/index.d.ts +1 -1
- package/build/src/akuma/heart/index.js +9 -1
- package/build/src/akuma/heart/timeline.js +4 -4
- package/build/src/akuma/projection-read.d.ts +4 -2
- package/build/src/akuma/projection-read.js +21 -14
- package/build/src/akuma/projection.d.ts +94 -2
- package/build/src/akuma/projection.js +47 -47
- package/build/src/akuma/provider.d.ts +2 -2
- package/build/src/akuma/provider.js +27 -20
- package/build/src/akuma/providers/acp/core.js +2 -5
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +2 -1
- package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
- package/build/src/akuma/publication.js +3 -2
- package/build/src/akuma/selection-observation.d.ts +23 -0
- package/build/src/akuma/selection-observation.js +15 -4
- package/build/src/akuma/status-projection.d.ts +14 -1
- package/build/src/akuma/status-projection.js +40 -2
- package/build/src/akuma/turn-drive.js +21 -15
- package/build/src/body/amend.js +5 -17
- package/build/src/body/decode.js +11 -1
- package/build/src/body/envelope.d.ts +5 -1
- package/build/src/body/envelope.js +4 -2
- package/build/src/body/render.js +4 -6
- package/build/src/cli/commands/akuma-grammar.d.ts +3 -5
- package/build/src/cli/commands/akuma-grammar.js +22 -40
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +6 -58
- package/build/src/cli/commands/contract-grammar.d.ts +1 -0
- package/build/src/cli/commands/contract-grammar.js +7 -11
- package/build/src/cli/commands/contract-help.d.ts +3 -2
- package/build/src/cli/commands/contract-help.js +11 -5
- package/build/src/cli/commands/contract.js +3 -0
- package/build/src/cli/commands/debt-grammar.js +2 -4
- package/build/src/cli/parse.js +1 -4
- package/build/src/cli/render/akuma-activity.d.ts +3 -15
- package/build/src/cli/render/akuma-activity.js +19 -73
- package/build/src/cli/render/akuma.d.ts +5 -11
- package/build/src/cli/render/akuma.js +22 -30
- package/build/src/cli/render/catalog.js +1 -4
- package/build/src/cli/render/contract-history.js +2 -0
- package/build/src/cli/render/contract-observation.d.ts +2 -1
- package/build/src/cli/render/contract-observation.js +25 -1
- package/build/src/cli/render/contract-wait.d.ts +2 -2
- package/build/src/cli/render/contract-wait.js +13 -17
- package/build/src/cli/render/contract.js +12 -9
- package/build/src/cli/render/debt.js +1 -2
- package/build/src/cli/render/execution-progress.js +1 -3
- package/build/src/cli/render/kanshi-akuma.js +1 -2
- package/build/src/cli/render/kanshi.js +11 -17
- package/build/src/cli/render/receipt.d.ts +1 -1
- package/build/src/cli/render/receipt.js +33 -28
- package/build/src/cli/render/reconcile.js +2 -5
- package/build/src/cli/render/refusal.js +3 -6
- package/build/src/cli/render/terminal.d.ts +2 -4
- package/build/src/cli/render/terminal.js +10 -17
- package/build/src/cli/render/verbs.d.ts +1 -0
- package/build/src/cli/render/verbs.js +19 -17
- package/build/src/cli/runtime.js +3 -9
- package/build/src/core/facts/codec.js +7 -2
- package/build/src/core/facts/eligibility.d.ts +4 -4
- package/build/src/core/facts/eligibility.js +11 -0
- package/build/src/core/facts/fold.js +9 -5
- package/build/src/core/facts/gate.d.ts +5 -1
- package/build/src/core/facts/gate.js +14 -10
- package/build/src/core/facts/types.d.ts +5 -1
- package/build/src/core/facts/types.js +7 -0
- package/build/src/core/subject.d.ts +4 -1
- package/build/src/core/subject.js +10 -2
- package/build/src/core/verbs/amend.d.ts +15 -4
- package/build/src/core/verbs/amend.js +19 -9
- package/build/src/debt/index.d.ts +0 -1
- package/build/src/debt/index.js +6 -11
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +6 -4
- package/build/src/dispatch/index.d.ts +0 -17
- package/build/src/dispatch/index.js +1 -10
- package/build/src/git/identity.js +16 -45
- package/build/src/git/nuke.js +13 -23
- package/build/src/git/observe.d.ts +3 -0
- package/build/src/git/observe.js +25 -23
- package/build/src/git/process.js +11 -18
- package/build/src/git/read-observation.d.ts +5 -4
- package/build/src/git/repository.d.ts +2 -0
- package/build/src/git/repository.js +13 -1
- package/build/src/git/scratch.js +2 -14
- package/build/src/git/terminal-reconcile.js +1 -13
- package/build/src/index.d.ts +2 -0
- package/build/src/kanshi/index.d.ts +0 -1
- package/build/src/kanshi/index.js +0 -1
- package/build/src/kanshi/read.d.ts +21 -0
- package/build/src/kanshi/read.js +2 -1
- package/build/src/kanshi/report.d.ts +94 -0
- package/build/src/library/address.d.ts +12 -5
- package/build/src/library/address.js +18 -32
- package/build/src/library/akuma-creation.d.ts +39 -0
- package/build/src/library/akuma-creation.js +3 -9
- package/build/src/library/continuation.d.ts +10 -0
- package/build/src/library/contract-creation.js +10 -11
- package/build/src/library/contract-outcomes.d.ts +72 -1
- package/build/src/library/contract-outcomes.js +1 -0
- package/build/src/library/contract-types.d.ts +18 -0
- package/build/src/library/contract-types.js +2 -0
- package/build/src/library/contract-wait.d.ts +7 -0
- package/build/src/library/contract-wait.js +53 -49
- package/build/src/library/delivery.d.ts +25 -0
- package/build/src/library/input.d.ts +5 -23
- package/build/src/library/input.js +12 -7
- package/build/src/library/kei.js +39 -20
- package/build/src/library/keiyaku-classify.js +3 -3
- package/build/src/library/keiyaku-debt.js +1 -2
- package/build/src/library/keiyaku-identity.d.ts +3 -3
- package/build/src/library/keiyaku-identity.js +11 -6
- package/build/src/library/keiyaku-verbs.d.ts +456 -1362
- package/build/src/library/keiyaku-verbs.js +80 -92
- package/build/src/library/keiyaku-wait.d.ts +183 -0
- package/build/src/library/keiyaku-wait.js +213 -0
- package/build/src/library/keiyaku.d.ts +3 -1
- package/build/src/library/keiyaku.js +49 -73
- package/build/src/{mcp/output.d.ts → library/model-tools.d.ts} +227 -56
- package/build/src/library/model-tools.js +347 -0
- package/build/src/library/outcome.js +5 -6
- package/build/src/library/refusal.d.ts +25 -1
- package/build/src/library/refusal.js +4 -5
- package/build/src/library/selection.d.ts +12 -0
- package/build/src/library/selection.js +1 -2
- package/build/src/mcp/adapter.d.ts +0 -6
- package/build/src/mcp/adapter.js +10 -159
- package/build/src/mcp/description.d.ts +2 -0
- package/build/src/mcp/description.js +2 -0
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +6 -4
- package/build/src/pi/index.d.ts +3 -0
- package/build/src/pi/index.js +83 -0
- package/build/src/protocol/amend.d.ts +14 -3
- package/build/src/protocol/amend.js +113 -46
- package/build/src/protocol/bind.d.ts +1 -1
- package/build/src/protocol/bind.js +5 -16
- package/build/src/protocol/completion.d.ts +30 -0
- package/build/src/protocol/completion.js +8 -5
- package/build/src/protocol/deliver.js +7 -20
- package/build/src/protocol/delivery-preview.d.ts +5 -0
- package/build/src/protocol/execution-observation.d.ts +8 -0
- package/build/src/protocol/intent.d.ts +1 -0
- package/build/src/protocol/intent.js +4 -1
- package/build/src/protocol/operations.d.ts +54 -16
- package/build/src/protocol/operations.js +17 -31
- package/build/src/protocol/placement.js +7 -1
- package/build/src/protocol/progress.js +0 -6
- package/build/src/protocol/read/status.d.ts +40 -0
- package/build/src/protocol/read/status.js +7 -10
- package/build/src/protocol/reintegrate.js +2 -2
- package/build/src/protocol/result-leaves.d.ts +56 -8
- package/build/src/protocol/result-leaves.js +11 -2
- package/build/src/protocol/run.js +1 -4
- package/build/src/protocol/verify.d.ts +10 -0
- package/build/src/protocol/verify.js +1 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/settle.js +19 -68
- package/package.json +7 -3
- package/plugins/pi/README.md +55 -97
- package/plugins/pi/keiyaku.ts +2 -9
- package/skills/keiyaku-akuma/SKILL.md +13 -9
- package/skills/keiyaku-babysit/SKILL.md +8 -6
- package/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/akuma-tools.ts +0 -283
- package/build/src/body/keys.d.ts +0 -4
- package/build/src/body/keys.js +0 -11
- package/build/src/kanshi/roster.d.ts +0 -2
- package/build/src/kanshi/roster.js +0 -2
- package/build/src/mcp/output.js +0 -193
- package/plugins/pi/akuma-tools.ts +0 -283
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { realpath } from "node:fs
|
|
1
|
+
import { realpath } from "node:fs";
|
|
2
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
3
|
+
import { promisify } from "node:util";
|
|
2
4
|
import { projectAkumaBirth } from "./caller.js";
|
|
3
5
|
import { createStatusFactReader, readLifeSnapshot, HeldAkumaLeash, heartExists, isHeartAbsent, life, lifeAt, probeLeash, readHeart, readSeal, } from "./heart/index.js";
|
|
4
6
|
import { pathsForAkumaId } from "./identity.js";
|
|
5
|
-
import { DEFAULT_TAIL, projectTurns, selectHistory, selectSnapshot, } from "./projection.js";
|
|
7
|
+
import { DEFAULT_TAIL, projectTurns, reportedChangePaths, selectHistory, selectSnapshot, } from "./projection.js";
|
|
6
8
|
import { resolveProviderExecution } from "./providers/index.js";
|
|
7
9
|
import { abortableDelay } from "./abort.js";
|
|
8
10
|
import { AkumaNotBornError } from "./akuma-errors.js";
|
|
11
|
+
/** Native resolution answers on-disk case as well as symlinks; the portable form keeps the caller's spelling. */
|
|
12
|
+
const realpathNative = promisify(realpath.native);
|
|
9
13
|
export async function rosterListRow(paths, expected) {
|
|
10
14
|
const snapshot = await readHeart(paths);
|
|
11
15
|
if (snapshot.soul !== null) {
|
|
@@ -79,22 +83,79 @@ export async function observeStatusOutcome(status, observer) {
|
|
|
79
83
|
if (snapshot.kind === "idle" && snapshot.outcome !== undefined)
|
|
80
84
|
await observer?.(status.id, [`turn/${snapshot.outcome.turnSequence}`]);
|
|
81
85
|
}
|
|
82
|
-
function snapshotSelection(input, executionDir) {
|
|
86
|
+
function snapshotSelection(input, executionDir, canonicalize) {
|
|
83
87
|
if (input.ordinaryBudget !== undefined && (!Number.isSafeInteger(input.ordinaryBudget) || input.ordinaryBudget < 0))
|
|
84
88
|
throw new TypeError("ordinary budget must be a nonnegative safe integer");
|
|
85
89
|
return {
|
|
86
90
|
aperture: input.aperture,
|
|
87
91
|
budget: { tail: Math.min(DEFAULT_TAIL, input.ordinaryBudget ?? DEFAULT_TAIL) },
|
|
88
92
|
...(executionDir === undefined ? {} : { executionDir }),
|
|
93
|
+
...(canonicalize === undefined ? {} : { canonicalize }),
|
|
89
94
|
...(input.admittedTellId === undefined ? {} : { admittedTellId: input.admittedTellId }),
|
|
90
95
|
};
|
|
91
96
|
}
|
|
97
|
+
/** Canonical resolutions of reported-change anchors, so projection itself stays synchronous. */
|
|
98
|
+
function createCanonicalAnchors() {
|
|
99
|
+
const resolved = new Map();
|
|
100
|
+
let changed = 0;
|
|
101
|
+
return {
|
|
102
|
+
changed: () => changed,
|
|
103
|
+
clear: () => {
|
|
104
|
+
resolved.clear();
|
|
105
|
+
changed = 0;
|
|
106
|
+
},
|
|
107
|
+
/** Answer from what is already resolved; an unresolved directory stays lexical. */
|
|
108
|
+
canonicalize(absolutePath) {
|
|
109
|
+
const hit = resolved.get(absolutePath);
|
|
110
|
+
if (hit !== undefined)
|
|
111
|
+
return hit;
|
|
112
|
+
const dir = resolved.get(dirname(absolutePath));
|
|
113
|
+
return dir === undefined ? absolutePath : join(dir, basename(absolutePath));
|
|
114
|
+
},
|
|
115
|
+
async resolve(absolutePaths) {
|
|
116
|
+
for (const absolutePath of new Set(absolutePaths)) {
|
|
117
|
+
if (resolved.has(absolutePath))
|
|
118
|
+
continue;
|
|
119
|
+
try {
|
|
120
|
+
resolved.set(absolutePath, await realpathNative(absolutePath));
|
|
121
|
+
changed += 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// A deleted or not-yet-existing leaf still belongs to its canonical directory.
|
|
126
|
+
}
|
|
127
|
+
const dir = dirname(absolutePath);
|
|
128
|
+
if (resolved.has(dir))
|
|
129
|
+
continue;
|
|
130
|
+
try {
|
|
131
|
+
resolved.set(dir, await realpathNative(dir));
|
|
132
|
+
changed += 1;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// An unresolvable directory stays lexical without caching the transient error.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function reusableSelection(memo, ledger, options, anchorsChanged) {
|
|
142
|
+
if (memo === undefined || memo.ledger !== ledger || memo.anchorsChanged !== anchorsChanged)
|
|
143
|
+
return undefined;
|
|
144
|
+
if (memo.options.aperture !== options.aperture ||
|
|
145
|
+
memo.options.admittedTellId !== options.admittedTellId ||
|
|
146
|
+
memo.options.budget.tail !== options.budget.tail ||
|
|
147
|
+
memo.options.executionDir !== options.executionDir)
|
|
148
|
+
return undefined;
|
|
149
|
+
return memo.selected;
|
|
150
|
+
}
|
|
92
151
|
/** Private to a live wait: retain only this member's current frontier and last selection. */
|
|
93
152
|
export function createLiveStatusReader(paths, expected) {
|
|
94
153
|
const reader = createStatusFactReader(paths);
|
|
154
|
+
const anchors = createCanonicalAnchors();
|
|
95
155
|
let memo;
|
|
96
156
|
const clear = () => {
|
|
97
157
|
reader.clear();
|
|
158
|
+
anchors.clear();
|
|
98
159
|
memo = undefined;
|
|
99
160
|
};
|
|
100
161
|
return {
|
|
@@ -121,16 +182,14 @@ export function createLiveStatusReader(paths, expected) {
|
|
|
121
182
|
(await resolveProviderExecution(soul.provider)).adapter.resume === undefined;
|
|
122
183
|
const facts = await reader.read(input, signal);
|
|
123
184
|
const ledger = memo?.facts === facts ? memo.ledger : projectTurns(facts);
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
memo = { facts, ledger, options, selected };
|
|
133
|
-
const lastActivityAt = ledger.rows.findLast((row) => row.kind !== "turn")?.at;
|
|
185
|
+
const executionDir = await realpathNative(soul.cwd).catch(() => undefined);
|
|
186
|
+
if (executionDir !== undefined)
|
|
187
|
+
await anchors.resolve(reportedChangePaths(ledger).map((reported) => resolve(executionDir, reported)));
|
|
188
|
+
const options = snapshotSelection(input, executionDir, executionDir === undefined ? undefined : anchors.canonicalize);
|
|
189
|
+
const anchorsChanged = anchors.changed();
|
|
190
|
+
const selected = reusableSelection(memo, ledger, options, anchorsChanged) ?? selectSnapshot(ledger, options);
|
|
191
|
+
memo = { facts, ledger, options, selected, anchorsChanged };
|
|
192
|
+
const lastActivityAt = snapshot.lastActivityAt;
|
|
134
193
|
return {
|
|
135
194
|
status: {
|
|
136
195
|
id: soul.id,
|
|
@@ -144,7 +203,7 @@ export function createLiveStatusReader(paths, expected) {
|
|
|
144
203
|
...(soul.options.model === undefined ? {} : { model: soul.options.model }),
|
|
145
204
|
...(resumeUnsupported ? { strandedReason: "resume-unsupported" } : {}),
|
|
146
205
|
timeline: selected.snapshot,
|
|
147
|
-
...(lastActivityAt ===
|
|
206
|
+
...(lastActivityAt === null ? {} : { lastActivityAt }),
|
|
148
207
|
},
|
|
149
208
|
ordinarySelected: selected.ordinaryCount,
|
|
150
209
|
rows: ledger.rows,
|
|
@@ -76,6 +76,18 @@ export declare const liveStatusObservationSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
76
76
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
77
77
|
kind: z.ZodLiteral<"row">;
|
|
78
78
|
row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
79
|
+
kind: z.ZodLiteral<"permission">;
|
|
80
|
+
sequence: z.ZodNumber;
|
|
81
|
+
turnSequence: z.ZodNumber;
|
|
82
|
+
at: z.ZodString;
|
|
83
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
action: z.ZodString;
|
|
86
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
87
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strict>>>>;
|
|
89
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
90
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
79
91
|
kind: z.ZodLiteral<"report">;
|
|
80
92
|
sequence: z.ZodNumber;
|
|
81
93
|
bodySequence: z.ZodNumber;
|
|
@@ -222,6 +234,18 @@ export declare const liveStatusObservationSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
222
234
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
223
235
|
kind: z.ZodLiteral<"row">;
|
|
224
236
|
row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
237
|
+
kind: z.ZodLiteral<"permission">;
|
|
238
|
+
sequence: z.ZodNumber;
|
|
239
|
+
turnSequence: z.ZodNumber;
|
|
240
|
+
at: z.ZodString;
|
|
241
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
242
|
+
id: z.ZodString;
|
|
243
|
+
action: z.ZodString;
|
|
244
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
245
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
246
|
+
}, z.core.$strict>>>>;
|
|
247
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
248
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
225
249
|
kind: z.ZodLiteral<"report">;
|
|
226
250
|
sequence: z.ZodNumber;
|
|
227
251
|
bodySequence: z.ZodNumber;
|
|
@@ -338,6 +362,18 @@ export declare const liveStatusObservationSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
338
362
|
}, z.core.$strict>>;
|
|
339
363
|
ordinarySelected: z.ZodNumber;
|
|
340
364
|
rows: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
365
|
+
kind: z.ZodLiteral<"permission">;
|
|
366
|
+
sequence: z.ZodNumber;
|
|
367
|
+
turnSequence: z.ZodNumber;
|
|
368
|
+
at: z.ZodString;
|
|
369
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
370
|
+
id: z.ZodString;
|
|
371
|
+
action: z.ZodString;
|
|
372
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
373
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
374
|
+
}, z.core.$strict>>>>;
|
|
375
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
376
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
341
377
|
kind: z.ZodLiteral<"turn">;
|
|
342
378
|
sequence: z.ZodNumber;
|
|
343
379
|
bodySequence: z.ZodNumber;
|
|
@@ -588,6 +624,18 @@ export declare const askProgressSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Zod
|
|
|
588
624
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
589
625
|
kind: z.ZodLiteral<"row">;
|
|
590
626
|
row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
627
|
+
kind: z.ZodLiteral<"permission">;
|
|
628
|
+
sequence: z.ZodNumber;
|
|
629
|
+
turnSequence: z.ZodNumber;
|
|
630
|
+
at: z.ZodString;
|
|
631
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
632
|
+
id: z.ZodString;
|
|
633
|
+
action: z.ZodString;
|
|
634
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
635
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
636
|
+
}, z.core.$strict>>>>;
|
|
637
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
638
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
591
639
|
kind: z.ZodLiteral<"report">;
|
|
592
640
|
sequence: z.ZodNumber;
|
|
593
641
|
bodySequence: z.ZodNumber;
|
|
@@ -734,6 +782,18 @@ export declare const askProgressSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Zod
|
|
|
734
782
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
735
783
|
kind: z.ZodLiteral<"row">;
|
|
736
784
|
row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
785
|
+
kind: z.ZodLiteral<"permission">;
|
|
786
|
+
sequence: z.ZodNumber;
|
|
787
|
+
turnSequence: z.ZodNumber;
|
|
788
|
+
at: z.ZodString;
|
|
789
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
790
|
+
id: z.ZodString;
|
|
791
|
+
action: z.ZodString;
|
|
792
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
793
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
794
|
+
}, z.core.$strict>>>>;
|
|
795
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
796
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
737
797
|
kind: z.ZodLiteral<"report">;
|
|
738
798
|
sequence: z.ZodNumber;
|
|
739
799
|
bodySequence: z.ZodNumber;
|
|
@@ -850,6 +910,18 @@ export declare const askProgressSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Zod
|
|
|
850
910
|
}, z.core.$strict>>;
|
|
851
911
|
ordinarySelected: z.ZodNumber;
|
|
852
912
|
rows: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
913
|
+
kind: z.ZodLiteral<"permission">;
|
|
914
|
+
sequence: z.ZodNumber;
|
|
915
|
+
turnSequence: z.ZodNumber;
|
|
916
|
+
at: z.ZodString;
|
|
917
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
918
|
+
id: z.ZodString;
|
|
919
|
+
action: z.ZodString;
|
|
920
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
921
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
922
|
+
}, z.core.$strict>>>>;
|
|
923
|
+
truncated: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
924
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
853
925
|
kind: z.ZodLiteral<"turn">;
|
|
854
926
|
sequence: z.ZodNumber;
|
|
855
927
|
bodySequence: z.ZodNumber;
|
|
@@ -1011,7 +1083,14 @@ type AskExecutionInput = TellExecutionInput & Readonly<{
|
|
|
1011
1083
|
schemaJson?: string;
|
|
1012
1084
|
}>;
|
|
1013
1085
|
export declare function executeTellAkuma(input: TellExecutionInput): Promise<AkumaTellResult>;
|
|
1014
|
-
|
|
1086
|
+
type TextAskResult = Exclude<AkumaAskResult, {
|
|
1087
|
+
kind: "answered";
|
|
1088
|
+
}> | (Omit<Extract<AkumaAskResult, {
|
|
1089
|
+
kind: "answered";
|
|
1090
|
+
}>, "answer"> & Readonly<{
|
|
1091
|
+
answer: string;
|
|
1092
|
+
}>);
|
|
1093
|
+
export declare function observeAdmittedTellAkuma(input: Readonly<{
|
|
1015
1094
|
path: WorldRoot;
|
|
1016
1095
|
id: AkumaStatus["id"];
|
|
1017
1096
|
tellId: string;
|
|
@@ -1028,12 +1107,8 @@ export declare function observeAdmittedAskAkuma(input: Readonly<{
|
|
|
1028
1107
|
receipt?: TellResult;
|
|
1029
1108
|
onObserve?: AskObserver;
|
|
1030
1109
|
outcomeObserved?: OutcomeObserver;
|
|
1031
|
-
}>): Promise<
|
|
1032
|
-
|
|
1033
|
-
}>;
|
|
1034
|
-
export declare function executeAskAkuma(input: AskExecutionInput): Promise<AkumaAskResult & {
|
|
1035
|
-
answer?: string;
|
|
1036
|
-
}>;
|
|
1110
|
+
}>): Promise<TextAskResult>;
|
|
1111
|
+
export declare function executeAskAkuma(input: AskExecutionInput): Promise<AkumaAskResult>;
|
|
1037
1112
|
type KillExecutionInput = Readonly<{
|
|
1038
1113
|
spawn: BodyLauncher;
|
|
1039
1114
|
path: WorldRoot;
|
|
@@ -18,11 +18,7 @@ export const askProgressSchema = z.union([
|
|
|
18
18
|
z.strictObject({ kind: z.literal("admitted"), tell: tellResultSchema, id: akumaIdSchema }).readonly(),
|
|
19
19
|
z.strictObject({ kind: z.literal("live"), observation: liveStatusObservationSchema }).readonly(),
|
|
20
20
|
]);
|
|
21
|
-
|
|
22
|
-
if (input.wait === true) {
|
|
23
|
-
const { akumaId, tellId, wake, interrupt, ...observation } = await executeAskAkuma(input);
|
|
24
|
-
return completeTell({ akumaId, tellId, ...(wake === undefined ? {} : { wake }), ...(interrupt === undefined ? {} : { interrupt }) }, observation.kind === "invalid-output" ? { kind: "failed", diagnostic: observation.diagnostic } : observation);
|
|
25
|
-
}
|
|
21
|
+
async function admitExecutionTell(input) {
|
|
26
22
|
input.signal?.throwIfAborted();
|
|
27
23
|
const owner = new AkumaOwner(input.id, input.path);
|
|
28
24
|
const admission = input.interrupt === true
|
|
@@ -32,12 +28,21 @@ export async function executeTellAkuma(input) {
|
|
|
32
28
|
throw new AkumaNotBornError(input.id);
|
|
33
29
|
if (admission.kind === "unavailable")
|
|
34
30
|
throw new AkumaProviderError(`Tell interrupt unavailable: ${admission.evidence}`);
|
|
35
|
-
|
|
31
|
+
const receipt = {
|
|
36
32
|
...pendingTellReceipt(admission.tell),
|
|
37
33
|
...("barrier" in admission && admission.barrier !== undefined
|
|
38
34
|
? { interruption: { kind: "pending", bodySequence: admission.barrier.bodySequence } }
|
|
39
35
|
: {}),
|
|
40
36
|
};
|
|
37
|
+
return { owner, admission, receipt };
|
|
38
|
+
}
|
|
39
|
+
export async function executeTellAkuma(input) {
|
|
40
|
+
if (input.wait === true) {
|
|
41
|
+
const { akumaId, tellId, wake, interrupt, ...observation } = await executeObservedTellAkuma(input);
|
|
42
|
+
return completeTell({ akumaId, tellId, ...(wake === undefined ? {} : { wake }), ...(interrupt === undefined ? {} : { interrupt }) }, observation.kind === "invalid-output" ? { kind: "failed", diagnostic: observation.diagnostic } : observation);
|
|
43
|
+
}
|
|
44
|
+
const { owner, admission, receipt } = await admitExecutionTell(input);
|
|
45
|
+
let tell = receipt;
|
|
41
46
|
try {
|
|
42
47
|
tell = await ("wake" in admission
|
|
43
48
|
? admission.wake
|
|
@@ -49,22 +54,24 @@ export async function executeTellAkuma(input) {
|
|
|
49
54
|
throw withTellFailureReceipt(error, completeTell(tellAdmissionEvidence(input.id, tell)), input.signal);
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
|
-
function
|
|
57
|
+
function tellObservation(observed) {
|
|
53
58
|
if (observed.outcome === null)
|
|
54
59
|
return observed.reason === "deadline" ? { kind: "deadline" } : { kind: "unanswered" };
|
|
55
60
|
if (observed.outcome.kind === "canceled")
|
|
56
61
|
return { kind: "unanswered" };
|
|
62
|
+
const completedAt = observed.completedAt === null ? {} : { completedAt: observed.completedAt };
|
|
57
63
|
if (observed.outcome.kind === "answered")
|
|
58
|
-
return { kind: "answered", answer: observed.outcome.answerJson ?? observed.outcome.answer };
|
|
64
|
+
return { kind: "answered", answer: observed.outcome.answerJson ?? observed.outcome.answer, ...completedAt };
|
|
59
65
|
if (observed.outcome.kind === "failed")
|
|
60
|
-
return { kind: "failed", diagnostic: observed.outcome.diagnostic };
|
|
66
|
+
return { kind: "failed", diagnostic: observed.outcome.diagnostic, ...completedAt };
|
|
61
67
|
return {
|
|
62
68
|
kind: "invalid-output",
|
|
63
69
|
diagnostic: observed.outcome.diagnostic,
|
|
64
70
|
answer: observed.outcome.answer,
|
|
71
|
+
...completedAt,
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
|
-
export async function
|
|
74
|
+
export async function observeAdmittedTellAkuma(input) {
|
|
68
75
|
const owner = new AkumaOwner(input.id, input.path, input.outcomeObserved);
|
|
69
76
|
const tell = input.receipt ?? (await owner.admittedReceipt(input.tellId));
|
|
70
77
|
await input.onObserve?.admitted?.(tell, input.id);
|
|
@@ -102,35 +109,27 @@ export async function observeAdmittedAskAkuma(input) {
|
|
|
102
109
|
throw withTellFailureReceipt(error, completeTell(tellAdmissionEvidence(input.id, settled ?? tell)), input.signal);
|
|
103
110
|
}
|
|
104
111
|
const receipt = tellAdmissionEvidence(input.id, settled ?? tell);
|
|
105
|
-
const observation =
|
|
112
|
+
const observation = tellObservation(observed);
|
|
106
113
|
const { wake, ...subject } = receipt;
|
|
107
114
|
return observation.kind === "unanswered" || observation.kind === "deadline"
|
|
108
115
|
? { ...subject, ...(wake === undefined ? {} : { wake }), ...observation }
|
|
109
116
|
: { ...subject, ...(wake?.kind === "failed" ? { wake } : {}), ...observation };
|
|
110
117
|
}
|
|
111
118
|
export async function executeAskAkuma(input) {
|
|
112
|
-
input
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (admission.kind === "unavailable")
|
|
120
|
-
throw new AkumaProviderError(`Tell interrupt unavailable: ${admission.evidence}`);
|
|
119
|
+
const result = await executeObservedTellAkuma(input);
|
|
120
|
+
return result.kind === "answered" && input.schemaJson !== undefined
|
|
121
|
+
? { ...result, answer: JSON.parse(result.answer) }
|
|
122
|
+
: result;
|
|
123
|
+
}
|
|
124
|
+
async function executeObservedTellAkuma(input) {
|
|
125
|
+
const { owner, admission, receipt } = await admitExecutionTell(input);
|
|
121
126
|
const observing = new AbortController();
|
|
122
127
|
const signal = input.signal === undefined ? observing.signal : AbortSignal.any([input.signal, observing.signal]);
|
|
123
128
|
const wake = "wake" in admission
|
|
124
129
|
? admission.wake
|
|
125
130
|
: owner.completeInterruptAdmission(admission, tellWakeRuntime(input.spawn), signal);
|
|
126
|
-
const receipt = {
|
|
127
|
-
...pendingTellReceipt(admission.tell),
|
|
128
|
-
...("barrier" in admission && admission.barrier !== undefined
|
|
129
|
-
? { interruption: { kind: "pending", bodySequence: admission.barrier.bodySequence } }
|
|
130
|
-
: {}),
|
|
131
|
-
};
|
|
132
131
|
try {
|
|
133
|
-
return await
|
|
132
|
+
return await observeAdmittedTellAkuma({
|
|
134
133
|
...input,
|
|
135
134
|
tellId: admission.tell.id,
|
|
136
135
|
receipt,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorldRoot } from "../world.js";
|
|
2
2
|
import { type LiveStatusObservation, type WaitReason, type OutcomeObserver } from "./akuma-observe.js";
|
|
3
3
|
import type { AkumaStatus } from "./akuma.js";
|
|
4
|
-
import type { AkumaWaitItem } from "./selection-observation.js";
|
|
4
|
+
import type { AkumaUnobserved, AkumaWaitItem } from "./selection-observation.js";
|
|
5
5
|
type WaitExecutionInput = Readonly<{
|
|
6
6
|
path: WorldRoot;
|
|
7
7
|
ids: readonly AkumaStatus["id"][];
|
|
@@ -18,6 +18,45 @@ export type NativeWaitResult = Readonly<{
|
|
|
18
18
|
observations: readonly LiveStatusObservation["status"][];
|
|
19
19
|
results: readonly AkumaWaitItem[];
|
|
20
20
|
}>;
|
|
21
|
+
export declare const AKUMA_WAIT_POLL_MS = 250;
|
|
22
|
+
/** Private observation custody shared by native and invocation set waits. */
|
|
23
|
+
export declare function createAkumaWaitObserver(path: WorldRoot, ids: readonly AkumaStatus["id"][]): {
|
|
24
|
+
items: Map<import("./identity.js").AkumaId, Readonly<{
|
|
25
|
+
kind: "observed";
|
|
26
|
+
id: import("./identity.js").AkumaId;
|
|
27
|
+
life: "hung" | "untidy" | "killed" | "running" | "asleep" | "stranded";
|
|
28
|
+
pending?: true;
|
|
29
|
+
outcome?: Readonly<{
|
|
30
|
+
kind: "answered";
|
|
31
|
+
historyId: `turn/${number}`;
|
|
32
|
+
answer: string;
|
|
33
|
+
}> | Readonly<{
|
|
34
|
+
kind: "failed";
|
|
35
|
+
historyId: `turn/${number}`;
|
|
36
|
+
diagnostic: string;
|
|
37
|
+
}> | Readonly<{
|
|
38
|
+
kind: "canceled";
|
|
39
|
+
historyId: `turn/${number}`;
|
|
40
|
+
}>;
|
|
41
|
+
strandedReason?: "resume-unsupported";
|
|
42
|
+
}> | Readonly<{
|
|
43
|
+
kind: "unobserved";
|
|
44
|
+
id: import("./identity.js").AkumaId;
|
|
45
|
+
diagnostic: string;
|
|
46
|
+
}> | Readonly<{
|
|
47
|
+
kind: "missing";
|
|
48
|
+
id: import("./identity.js").AkumaId;
|
|
49
|
+
}>>;
|
|
50
|
+
satisfied: (id: AkumaStatus["id"]) => boolean;
|
|
51
|
+
observe: (signal?: AbortSignal) => Promise<Readonly<{
|
|
52
|
+
observations: readonly LiveStatusObservation[];
|
|
53
|
+
unobserved: readonly AkumaUnobserved[];
|
|
54
|
+
missing: readonly AkumaStatus["id"][];
|
|
55
|
+
}>>;
|
|
56
|
+
probe: (completion: "any" | "all", signal?: AbortSignal) => Promise<boolean>;
|
|
57
|
+
notify(observer?: OutcomeObserver): Promise<void>;
|
|
58
|
+
clear: () => void;
|
|
59
|
+
};
|
|
21
60
|
/** Compact final native evidence, retaining full statuses privately for owner composition. */
|
|
22
61
|
export declare function executeWaitAkuma(input: WaitExecutionInput): Promise<NativeWaitResult>;
|
|
23
62
|
export {};
|
|
@@ -2,7 +2,8 @@ import { AkumaNotBornError } from "./akuma-errors.js";
|
|
|
2
2
|
import { createLiveStatusReader, defaultWaitComplete, readWaitComplete, waitForObservation, } from "./akuma-observe.js";
|
|
3
3
|
import { pathsForAkumaId } from "./identity.js";
|
|
4
4
|
const SHARED_ORDINARY_BUDGET = 30;
|
|
5
|
-
|
|
5
|
+
export const AKUMA_WAIT_POLL_MS = 250;
|
|
6
|
+
async function observeWaitRound(ids, readerFor, signal, witnessed) {
|
|
6
7
|
const read = (id, ordinaryBudget) => readerFor(id).read({ aperture: "monitoring", ...(ordinaryBudget === undefined ? {} : { ordinaryBudget }) }, signal);
|
|
7
8
|
signal?.throwIfAborted();
|
|
8
9
|
let remaining = SHARED_ORDINARY_BUDGET;
|
|
@@ -14,14 +15,20 @@ async function observeWaitRound(ids, readerFor, signal) {
|
|
|
14
15
|
try {
|
|
15
16
|
const observed = await read(id, remaining);
|
|
16
17
|
observations.push(observed);
|
|
18
|
+
witnessed?.(completionItem(observed), observed);
|
|
17
19
|
remaining -= observed.ordinarySelected;
|
|
18
20
|
}
|
|
19
21
|
catch (error) {
|
|
20
22
|
signal?.throwIfAborted();
|
|
21
|
-
if (error instanceof AkumaNotBornError)
|
|
23
|
+
if (error instanceof AkumaNotBornError) {
|
|
22
24
|
missing.push(id);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
witnessed?.({ kind: "missing", id });
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const item = { id, diagnostic: diagnostic(error) };
|
|
29
|
+
unobserved.push(item);
|
|
30
|
+
witnessed?.({ kind: "unobserved", ...item });
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
return { observations, unobserved, missing };
|
|
@@ -56,55 +63,77 @@ function completionItem({ status, rows }) {
|
|
|
56
63
|
...(status.strandedReason === undefined ? {} : { strandedReason: status.strandedReason }),
|
|
57
64
|
};
|
|
58
65
|
}
|
|
59
|
-
/**
|
|
60
|
-
export
|
|
66
|
+
/** Private observation custody shared by native and invocation set waits. */
|
|
67
|
+
export function createAkumaWaitObserver(path, ids) {
|
|
61
68
|
const readers = new Map();
|
|
69
|
+
const items = new Map();
|
|
70
|
+
const observations = new Map();
|
|
62
71
|
const readerFor = (id) => {
|
|
63
72
|
let reader = readers.get(id);
|
|
64
73
|
if (reader === undefined) {
|
|
65
|
-
reader = createLiveStatusReader(pathsForAkumaId(
|
|
74
|
+
reader = createLiveStatusReader(pathsForAkumaId(path, id), id);
|
|
66
75
|
readers.set(id, reader);
|
|
67
76
|
}
|
|
68
77
|
return reader;
|
|
69
78
|
};
|
|
79
|
+
return {
|
|
80
|
+
items,
|
|
81
|
+
satisfied: (id) => {
|
|
82
|
+
const observation = observations.get(id);
|
|
83
|
+
return items.get(id)?.kind === "observed" && observation !== undefined && defaultWaitComplete(observation.status);
|
|
84
|
+
},
|
|
85
|
+
observe: (signal) => observeWaitRound(ids, readerFor, signal, (item, observation) => {
|
|
86
|
+
items.set(item.id, item);
|
|
87
|
+
if (observation === undefined)
|
|
88
|
+
observations.delete(item.id);
|
|
89
|
+
else
|
|
90
|
+
observations.set(item.id, observation);
|
|
91
|
+
}),
|
|
92
|
+
probe: (completion, signal) => readWaitComplete(path, ids, completion, signal, (id) => readerFor(id)
|
|
93
|
+
.complete(signal)
|
|
94
|
+
.catch((error) => {
|
|
95
|
+
if (error instanceof AkumaNotBornError)
|
|
96
|
+
return true;
|
|
97
|
+
throw error;
|
|
98
|
+
})),
|
|
99
|
+
async notify(observer) {
|
|
100
|
+
for (const { status, rows } of observations.values()) {
|
|
101
|
+
const outcome = rows.findLast((row) => row.kind === "outcome");
|
|
102
|
+
if (outcome !== undefined)
|
|
103
|
+
await observer?.(status.id, [`turn/${outcome.turnSequence}`]);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
clear: () => {
|
|
107
|
+
for (const reader of readers.values())
|
|
108
|
+
reader.clear();
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** Compact final native evidence, retaining full statuses privately for owner composition. */
|
|
113
|
+
export async function executeWaitAkuma(input) {
|
|
114
|
+
const observer = createAkumaWaitObserver(input.path, input.ids);
|
|
70
115
|
try {
|
|
71
116
|
const waited = await waitForObservation({
|
|
72
|
-
pollMs:
|
|
117
|
+
pollMs: AKUMA_WAIT_POLL_MS,
|
|
73
118
|
...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),
|
|
74
119
|
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
75
120
|
...(input.predicate === undefined
|
|
76
121
|
? {
|
|
77
|
-
probe:
|
|
78
|
-
.complete(input.signal)
|
|
79
|
-
.catch((error) => {
|
|
80
|
-
if (error instanceof AkumaNotBornError)
|
|
81
|
-
return true;
|
|
82
|
-
throw error;
|
|
83
|
-
})),
|
|
122
|
+
probe: () => observer.probe(input.completion, input.signal),
|
|
84
123
|
}
|
|
85
124
|
: {}),
|
|
86
|
-
observe:
|
|
125
|
+
observe: () => observer.observe(input.signal),
|
|
87
126
|
complete: (round) => roundComplete(round, input.completion, input.predicate),
|
|
88
127
|
});
|
|
89
|
-
|
|
90
|
-
const outcome = rows.findLast((row) => row.kind === "outcome");
|
|
91
|
-
if (outcome !== undefined)
|
|
92
|
-
await input.outcomeObserved?.(status.id, [`turn/${outcome.turnSequence}`]);
|
|
93
|
-
}
|
|
94
|
-
const items = new Map(waited.value.observations.map((observation) => [observation.status.id, completionItem(observation)]));
|
|
95
|
-
for (const item of waited.value.unobserved)
|
|
96
|
-
items.set(item.id, { kind: "unobserved", ...item });
|
|
97
|
-
for (const id of waited.value.missing)
|
|
98
|
-
items.set(id, { kind: "missing", id });
|
|
128
|
+
await observer.notify(input.outcomeObserved);
|
|
99
129
|
return {
|
|
100
130
|
reason: waited.reason,
|
|
101
131
|
observations: waited.value.observations.map((observation) => observation.status),
|
|
102
|
-
results: input.ids.map((id) => items.get(id)),
|
|
132
|
+
results: input.ids.map((id) => observer.items.get(id)),
|
|
103
133
|
};
|
|
104
134
|
}
|
|
105
135
|
finally {
|
|
106
|
-
|
|
107
|
-
reader.clear();
|
|
136
|
+
observer.clear();
|
|
108
137
|
}
|
|
109
138
|
}
|
|
110
139
|
function diagnostic(error) {
|
|
@@ -84,6 +84,17 @@ export declare const akumaStatusSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
84
84
|
toolId: z.ZodString;
|
|
85
85
|
}, z.core.$strict>>>>>;
|
|
86
86
|
latestActivity: z.ZodExactOptional<z.ZodNumber>;
|
|
87
|
+
awaiting: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
88
|
+
kind: z.ZodLiteral<"permission">;
|
|
89
|
+
id: z.ZodNumber;
|
|
90
|
+
requests: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
action: z.ZodString;
|
|
93
|
+
resources: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
94
|
+
tool: z.ZodExactOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strict>>>>;
|
|
96
|
+
clipped: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
97
|
+
}, z.core.$strict>>>;
|
|
87
98
|
pending: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
88
99
|
id: z.ZodNumber;
|
|
89
100
|
tellId: z.ZodString;
|