@qvac/harness 0.7.0 → 1.0.0-rc.0
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/CHANGELOG.md +42 -1
- package/README.md +239 -2
- package/dist-lib/index.d.ts +58 -3
- package/dist-lib/index.js +736 -239
- package/dist-lib/lib/capabilities/completion-engine/abort-polyfill.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/abort-polyfill.js +10 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +17 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/approval.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/approval.js +29 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +73 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +41 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.js +49 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +102 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.d.ts +47 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +87 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/finishing.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/finishing.js +32 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-preload.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-preload.js +75 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +152 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +94 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preload-failure.d.ts +9 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preload-failure.js +11 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preloading.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preloading.js +114 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +198 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +71 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/rejection.d.ts +18 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/rejection.js +70 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +60 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +21 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +48 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +156 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +7 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +61 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.d.ts +25 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.js +553 -0
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +61 -0
- package/dist-lib/lib/capabilities/completion-engine/durable.js +150 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.d.ts +6 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +239 -0
- package/dist-lib/lib/capabilities/completion-engine/ports.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/ports.js +267 -0
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +76 -0
- package/dist-lib/lib/capabilities/completion-engine/session.js +70 -0
- package/dist-lib/lib/capabilities/completion-loop/index.d.ts +80 -0
- package/dist-lib/lib/capabilities/completion-loop/index.js +158 -0
- package/dist-lib/lib/capabilities/completion-loop/metrics.d.ts +5 -0
- package/dist-lib/lib/capabilities/completion-loop/metrics.js +29 -0
- package/dist-lib/lib/capabilities/completion-loop/round.d.ts +33 -0
- package/dist-lib/lib/capabilities/completion-loop/round.js +353 -0
- package/dist-lib/lib/capabilities/completion-loop/tool-execution.d.ts +60 -0
- package/dist-lib/lib/capabilities/completion-loop/tool-execution.js +270 -0
- package/dist-lib/lib/capabilities/completion-loop/turns.d.ts +23 -0
- package/dist-lib/lib/capabilities/completion-loop/turns.js +112 -0
- package/dist-lib/lib/capabilities/completion-runtime.d.ts +46 -0
- package/dist-lib/lib/capabilities/completion-runtime.js +74 -0
- package/dist-lib/lib/capabilities/completion.d.ts +18 -335
- package/dist-lib/lib/capabilities/completion.js +20 -1301
- package/dist-lib/lib/capabilities/download.d.ts +1 -1
- package/dist-lib/lib/capabilities/download.js +7 -2
- package/dist-lib/lib/capabilities/invoke.js +5 -3
- package/dist-lib/lib/capabilities/tool-plan.d.ts +35 -0
- package/dist-lib/lib/capabilities/tool-plan.js +66 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +11 -2
- package/dist-lib/lib/capabilities/tool-turns.js +30 -2
- package/dist-lib/lib/capabilities/types.d.ts +287 -0
- package/dist-lib/lib/capabilities/types.js +1 -0
- package/dist-lib/lib/completion-lifecycle.d.ts +14 -0
- package/dist-lib/lib/completion-lifecycle.js +126 -0
- package/dist-lib/lib/connect.d.ts +10 -3
- package/dist-lib/lib/connect.js +329 -23
- package/dist-lib/lib/contract-types.d.ts +19 -2
- package/dist-lib/lib/harness-lifecycle.d.ts +66 -0
- package/dist-lib/lib/harness-lifecycle.js +129 -0
- package/dist-lib/lib/helpers/detach-json.d.ts +1 -0
- package/dist-lib/lib/helpers/detach-json.js +146 -0
- package/dist-lib/lib/helpers/markup-scanner.d.ts +26 -0
- package/dist-lib/lib/helpers/markup-scanner.js +156 -0
- package/dist-lib/lib/helpers/markup-stream-filter.js +138 -35
- package/dist-lib/lib/helpers/race-abort.d.ts +9 -4
- package/dist-lib/lib/helpers/race-abort.js +2 -7
- package/dist-lib/lib/helpers/recovery-required.d.ts +1 -0
- package/dist-lib/lib/helpers/recovery-required.js +1 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +10 -2
- package/dist-lib/lib/helpers/run-outcome.js +8 -5
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +2 -0
- package/dist-lib/lib/helpers/tool-call-markup.js +197 -82
- package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +1 -0
- package/dist-lib/lib/hooks/built-in/arg-repair.js +1 -0
- package/dist-lib/lib/hooks/built-in/egress.d.ts +1 -0
- package/dist-lib/lib/hooks/built-in/egress.js +2 -1
- package/dist-lib/lib/hooks/built-in/sandbox.d.ts +1 -0
- package/dist-lib/lib/hooks/built-in/sandbox.js +6 -1
- package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +1 -0
- package/dist-lib/lib/hooks/built-in/skill-catalog.js +2 -1
- package/dist-lib/lib/hooks/pipeline.d.ts +4 -1
- package/dist-lib/lib/hooks/pipeline.js +24 -2
- package/dist-lib/lib/hooks/run.d.ts +2 -1
- package/dist-lib/lib/hooks/run.js +19 -7
- package/dist-lib/lib/hooks/types.d.ts +17 -6
- package/dist-lib/lib/machine/completion/actions/approval.d.ts +3 -0
- package/dist-lib/lib/machine/completion/actions/approval.js +16 -0
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +23 -0
- package/dist-lib/lib/machine/completion/actions/completion.js +142 -0
- package/dist-lib/lib/machine/completion/actions/skills.d.ts +9 -0
- package/dist-lib/lib/machine/completion/actions/skills.js +83 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +16 -0
- package/dist-lib/lib/machine/completion/actions/tools.js +173 -0
- package/dist-lib/lib/machine/completion/context.d.ts +9 -0
- package/dist-lib/lib/machine/completion/context.js +44 -0
- package/dist-lib/lib/machine/completion/contract.d.ts +6 -0
- package/dist-lib/lib/machine/completion/contract.js +1 -0
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +9 -0
- package/dist-lib/lib/machine/completion/guards/retry.js +25 -0
- package/dist-lib/lib/machine/completion/implementations.d.ts +81 -0
- package/dist-lib/lib/machine/completion/implementations.js +152 -0
- package/dist-lib/lib/machine/completion/machine.d.ts +375 -0
- package/dist-lib/lib/machine/completion/machine.js +511 -0
- package/dist-lib/lib/machine/completion/ports.d.ts +65 -0
- package/dist-lib/lib/machine/completion/ports.js +224 -0
- package/dist-lib/lib/machine/completion/rules.d.ts +39 -0
- package/dist-lib/lib/machine/completion/rules.js +115 -0
- package/dist-lib/lib/machine/completion/types.d.ts +493 -0
- package/dist-lib/lib/machine/completion/types.js +1 -0
- package/dist-lib/lib/machine/engine.d.ts +93 -0
- package/dist-lib/lib/machine/engine.js +483 -0
- package/dist-lib/lib/machine/errors.d.ts +44 -0
- package/dist-lib/lib/machine/errors.js +373 -0
- package/dist-lib/lib/machine/guards.d.ts +2 -0
- package/dist-lib/lib/machine/guards.js +6 -0
- package/dist-lib/lib/machine/index.d.ts +20 -0
- package/dist-lib/lib/machine/index.js +11 -0
- package/dist-lib/lib/machine/replay-output.d.ts +24 -0
- package/dist-lib/lib/machine/replay-output.js +50 -0
- package/dist-lib/lib/machine/stable-stringify.d.ts +1 -0
- package/dist-lib/lib/machine/stable-stringify.js +11 -0
- package/dist-lib/lib/models/model-handle.d.ts +5 -1
- package/dist-lib/lib/models/model-handle.js +8 -3
- package/dist-lib/lib/models/model-list.d.ts +5 -3
- package/dist-lib/lib/models/model-pool.d.ts +18 -7
- package/dist-lib/lib/models/model-pool.js +126 -38
- package/dist-lib/lib/run-log/history-codec.d.ts +23 -0
- package/dist-lib/lib/run-log/history-codec.js +973 -0
- package/dist-lib/lib/run-log/patch.d.ts +6 -0
- package/dist-lib/lib/run-log/patch.js +93 -0
- package/dist-lib/lib/run-log/persisted-actor.d.ts +18 -0
- package/dist-lib/lib/run-log/persisted-actor.js +218 -0
- package/dist-lib/lib/run-log/protocol-types.d.ts +153 -0
- package/dist-lib/lib/run-log/protocol-types.js +1 -0
- package/dist-lib/lib/run-log/protocol.d.ts +27 -0
- package/dist-lib/lib/run-log/protocol.js +1056 -0
- package/dist-lib/lib/run-log/replay.d.ts +25 -0
- package/dist-lib/lib/run-log/replay.js +129 -0
- package/dist-lib/lib/run-log/run-journal.d.ts +125 -0
- package/dist-lib/lib/run-log/run-journal.js +783 -0
- package/dist-lib/lib/run-log-inspect.d.ts +25 -0
- package/dist-lib/lib/run-log-inspect.js +627 -0
- package/dist-lib/lib/run-log-protocol.d.ts +2 -0
- package/dist-lib/lib/run-log-protocol.js +1 -0
- package/dist-lib/lib/run-log-redact.d.ts +27 -0
- package/dist-lib/lib/run-log-redact.js +1107 -0
- package/dist-lib/lib/serve.js +308 -12
- package/dist-lib/lib/spawn.js +3 -2
- package/dist-lib/lib/tool-call-display.d.ts +1 -21
- package/dist-lib/lib/tools/exec.d.ts +2 -1
- package/dist-lib/lib/tools/exec.js +57 -2
- package/dist-lib/lib/tools/generate-image.js +1 -1
- package/dist-lib/lib/tools/generate-music.js +1 -1
- package/dist-lib/lib/tools/http-request.d.ts +2 -1
- package/dist-lib/lib/tools/http-request.js +2 -1
- package/dist-lib/lib/tools/mcp-call.js +8 -1
- package/dist-lib/lib/tools/operations/builders.d.ts +1 -0
- package/dist-lib/lib/tools/operations/builders.js +1 -0
- package/dist-lib/lib/tools/operations/compile.js +11 -1
- package/dist-lib/lib/tools/operations/manifest.js +1 -0
- package/dist-lib/lib/tools/outbound-guard.d.ts +8 -6
- package/dist-lib/lib/tools/outbound-guard.js +25 -8
- package/dist-lib/lib/tools/skills/catalog.d.ts +1 -0
- package/dist-lib/lib/tools/skills/catalog.js +35 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +1 -0
- package/dist-lib/lib/tools/skills/cli-schema.js +25 -0
- package/dist-lib/lib/wire.d.ts +5 -0
- package/dist-lib/lib/wire.js +128 -5
- package/dist-lib/schema/harness.js +22 -6
- package/dist-lib/spec/hrpc/messages.js +100 -18
- package/dist-lib/spec/hyperschema/index.js +100 -18
- package/dist-lib/spec/hyperschema/schema.json +74 -1
- package/dist-lib/spec/hyperschema/types.d.ts +11 -3
- package/package.json +19 -1
- package/patches/@qvac%2Finference@0.20.0.patch +67 -0
- package/patches/bare-stow@0.1.5.patch +68 -0
- package/patches/hypercore-blob-server@1.15.0.patch +15 -0
- package/patches/localwatch@1.4.3.patch +13 -0
- package/patches/pyodide@314.0.2.patch +144 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { CompletionContext, CompletionMachineEvent, SkillLoadOutput, ToolExecutionSnapshot } from './types.ts';
|
|
2
|
+
interface Args {
|
|
3
|
+
context: CompletionContext;
|
|
4
|
+
event: CompletionMachineEvent;
|
|
5
|
+
}
|
|
6
|
+
export declare const completionGuards: {
|
|
7
|
+
preloadNeeded: ({ event }: Args) => boolean;
|
|
8
|
+
preloadFailed: ({ event }: Args) => boolean;
|
|
9
|
+
directSearchNeeded: ({ event }: Args) => boolean;
|
|
10
|
+
directRejected: ({ event }: Args) => boolean;
|
|
11
|
+
directNeedsApproval: ({ context, event }: Args) => boolean;
|
|
12
|
+
directAutoRuns: ({ event }: Args) => boolean;
|
|
13
|
+
noDirectTool: ({ event }: Args) => boolean;
|
|
14
|
+
searchPending: ({ context }: Args) => boolean;
|
|
15
|
+
roundHasToolCalls: ({ event }: Args) => boolean;
|
|
16
|
+
narratedIntent: ({ context, event }: Args) => boolean;
|
|
17
|
+
hasAnswer: ({ event }: Args) => boolean;
|
|
18
|
+
canMuteRetry: ({ context }: Args) => boolean;
|
|
19
|
+
hasRoundsLeft: ({ context }: Args) => boolean;
|
|
20
|
+
hasQueuedTool: ({ context }: Args) => boolean;
|
|
21
|
+
repeatOfFailed: ({ context }: Args) => boolean;
|
|
22
|
+
repeatsBlocked: ({ context }: Args) => boolean;
|
|
23
|
+
allResolvedToolsCapped: ({ context }: Args) => boolean;
|
|
24
|
+
canRetrySearchCap: ({ context }: Args) => boolean;
|
|
25
|
+
toolRejected: ({ event }: Args) => boolean;
|
|
26
|
+
skillLoadAllowed: ({ event }: Args) => boolean;
|
|
27
|
+
approved: ({ event }: Args) => boolean;
|
|
28
|
+
needsApproval: ({ context }: Args, execution: ToolExecutionSnapshot | null | undefined) => boolean;
|
|
29
|
+
toolAutoRuns: ({ event }: Args) => boolean;
|
|
30
|
+
directExecution: ({ context }: Args) => boolean;
|
|
31
|
+
timeUp: ({ context }: Args) => boolean;
|
|
32
|
+
failedOutcome: ({ context }: Args) => boolean;
|
|
33
|
+
needsRecovery: ({ event }: Args) => boolean;
|
|
34
|
+
interrupted: ({ event }: Args) => boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare const completionActions: {
|
|
37
|
+
requestPreload: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").SkillPreloadPayload, never, never, never, never, never>;
|
|
38
|
+
authorizePreload: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").PreloadInspectionOutput, never, never, never, never, never>;
|
|
39
|
+
settlePreloadFailure: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").PreloadInspectionOutput | SkillLoadOutput, never, never, never, never, never>;
|
|
40
|
+
startDirectTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").DirectToolOutput, never, never, never, never, never>;
|
|
41
|
+
queueDirectSearch: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").PreparingOutput, never, never, never, never, never>;
|
|
42
|
+
rejectDeniedApproval: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").RejectDeniedApprovalParams, never, never, never, never, never>;
|
|
43
|
+
startInitialRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").PreparingPayload, never, never, never, never, never>;
|
|
44
|
+
settleSkill: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, SkillLoadOutput, never, never, never, never, never>;
|
|
45
|
+
finishRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").RoundDonePayload, never, never, never, never, never>;
|
|
46
|
+
finishWrapRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").RoundDonePayload, never, never, never, never, never>;
|
|
47
|
+
wrapCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").RunOutcome, never, never, never, never, never>;
|
|
48
|
+
resolveTools: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ToolsResolvedPayload, never, never, never, never, never>;
|
|
49
|
+
answerCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").AnsweredPayload, never, never, never, never, never>;
|
|
50
|
+
retryMuteRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
51
|
+
retryNarratedRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").AnsweredPayload, never, never, never, never, never>;
|
|
52
|
+
wrapMuteCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
53
|
+
selectNextTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ResolvedCallSnapshot, never, never, never, never, never>;
|
|
54
|
+
rejectRepeatedTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").RepeatOfFailedCallParams, never, never, never, never, never>;
|
|
55
|
+
retryCappedSearch: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
56
|
+
wrapSearchCappedCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
57
|
+
startNextRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
58
|
+
wrapExhaustedCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
59
|
+
startSkillTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").SkillToolExecutionSnapshot, never, never, never, never, never>;
|
|
60
|
+
startTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").GatedToolExecutionSnapshot, never, never, never, never, never>;
|
|
61
|
+
rejectTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./actions/tools.ts").RejectToolParams, never, never, never, never, never>;
|
|
62
|
+
finishDirectTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ToolDonePayload, never, never, never, never, never>;
|
|
63
|
+
finishTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ToolDonePayload, never, never, never, never, never>;
|
|
64
|
+
settleToolSkill: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, SkillLoadOutput, never, never, never, never, never>;
|
|
65
|
+
approveCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
66
|
+
requestApproval: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ApprovalCall, never, never, never, never, never>;
|
|
67
|
+
failCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./actions/completion.ts").CompletionFailureMessage | {
|
|
68
|
+
tag: 'failed';
|
|
69
|
+
message: string;
|
|
70
|
+
name: string;
|
|
71
|
+
code?: string;
|
|
72
|
+
stack?: string;
|
|
73
|
+
cause?: import("../errors.ts").ErrorCause;
|
|
74
|
+
}, never, never, never, never, never>;
|
|
75
|
+
markTimeUp: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
76
|
+
recordPause: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
77
|
+
recordRecovery: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
78
|
+
resumeRun: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
79
|
+
recordFacts: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
80
|
+
};
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { assign } from 'xstate';
|
|
2
|
+
import { approveCompletion, requestApproval } from './actions/approval.js';
|
|
3
|
+
import { answerCompletion, failCompletion, finishWrapRound, finishRound, retryCappedSearch, retryMuteRound, retryNarratedRound, startInitialRound, startNextRound, wrapCompletion, wrapExhaustedCompletion, wrapMuteCompletion, wrapSearchCappedCompletion } from './actions/completion.js';
|
|
4
|
+
import { failSkill, failToolSkill, finishSkill, finishToolSkill, requestPreload, authorizePreload, settlePreloadFailure, startSkillTool } from './actions/skills.js';
|
|
5
|
+
import { finishDirectTool, finishTool, queueDirectSearch, rejectDeniedApproval, rejectRepeatedTool, rejectTool, resolveTools, selectNextTool, startDirectTool, startTool } from './actions/tools.js';
|
|
6
|
+
import { allResolvedToolsCapped, canMuteRetry, canRetryNarrated, canRetrySearchCap, hasQueuedTool, hasRoundsLeft, repeatsBlocked, searchPending } from './guards/retry.js';
|
|
7
|
+
function output(event) {
|
|
8
|
+
return ('output' in event ? event.output : {});
|
|
9
|
+
}
|
|
10
|
+
function errorOf(event) {
|
|
11
|
+
return 'error' in event ? event.error : undefined;
|
|
12
|
+
}
|
|
13
|
+
function preflightFacts(execution) {
|
|
14
|
+
return execution?.gate?.facts;
|
|
15
|
+
}
|
|
16
|
+
function preflightReady(execution) {
|
|
17
|
+
const facts = preflightFacts(execution);
|
|
18
|
+
return Boolean(facts && !facts.validationError && !facts.refusal && !facts.deniedKey);
|
|
19
|
+
}
|
|
20
|
+
function autoRuns(execution) {
|
|
21
|
+
const facts = preflightFacts(execution);
|
|
22
|
+
return Boolean(facts && (facts.effect === 'read' || facts.autoApprove || facts.skipApprovals));
|
|
23
|
+
}
|
|
24
|
+
function needsApproval(context, execution) {
|
|
25
|
+
return Boolean(preflightReady(execution) &&
|
|
26
|
+
!autoRuns(execution) &&
|
|
27
|
+
context.approval.status === 'idle' &&
|
|
28
|
+
execution?.gate?.approver);
|
|
29
|
+
}
|
|
30
|
+
export const completionGuards = {
|
|
31
|
+
preloadNeeded: ({ event }) => {
|
|
32
|
+
const facts = output(event);
|
|
33
|
+
return (facts.skillCandidate !== null &&
|
|
34
|
+
facts.skillLoaderAvailable === true &&
|
|
35
|
+
facts.skillLoaderEffect === 'read' &&
|
|
36
|
+
facts.skillAlreadyLoaded === false);
|
|
37
|
+
},
|
|
38
|
+
preloadFailed: ({ event }) => Boolean(output(event).failure),
|
|
39
|
+
directSearchNeeded: ({ event }) => Boolean(output(event).searchQuery),
|
|
40
|
+
directRejected: ({ event }) => Boolean(output(event).directTool?.rejection),
|
|
41
|
+
directNeedsApproval: ({ context, event }) => needsApproval(context, output(event).directTool?.execution),
|
|
42
|
+
directAutoRuns: ({ event }) => preflightReady(output(event).directTool?.execution) &&
|
|
43
|
+
autoRuns(output(event).directTool?.execution),
|
|
44
|
+
noDirectTool: ({ event }) => !output(event).directTool,
|
|
45
|
+
searchPending: ({ context }) => searchPending(context),
|
|
46
|
+
roundHasToolCalls: ({ event }) => (output(event).calls?.length ?? 0) > 0,
|
|
47
|
+
narratedIntent: ({ context, event }) => canRetryNarrated(context) && Boolean(output(event).narrated),
|
|
48
|
+
hasAnswer: ({ event }) => Boolean(output(event).response?.trim()),
|
|
49
|
+
canMuteRetry: ({ context }) => canMuteRetry(context),
|
|
50
|
+
hasRoundsLeft: ({ context }) => hasRoundsLeft(context),
|
|
51
|
+
hasQueuedTool: ({ context }) => hasQueuedTool(context),
|
|
52
|
+
repeatOfFailed: ({ context }) => {
|
|
53
|
+
const next = context.toolQueue[0];
|
|
54
|
+
return Boolean(next && context.failedCalls[next.key]);
|
|
55
|
+
},
|
|
56
|
+
repeatsBlocked: ({ context }) => repeatsBlocked(context),
|
|
57
|
+
allResolvedToolsCapped: ({ context }) => allResolvedToolsCapped(context),
|
|
58
|
+
canRetrySearchCap: ({ context }) => canRetrySearchCap(context),
|
|
59
|
+
toolRejected: ({ event }) => Boolean(output(event).rejection),
|
|
60
|
+
skillLoadAllowed: ({ event }) => {
|
|
61
|
+
const facts = output(event);
|
|
62
|
+
return Boolean(facts.skillCall &&
|
|
63
|
+
facts.toolAvailable &&
|
|
64
|
+
facts.skillActive &&
|
|
65
|
+
facts.effect === 'read' &&
|
|
66
|
+
preflightReady(facts.execution) &&
|
|
67
|
+
autoRuns(facts.execution));
|
|
68
|
+
},
|
|
69
|
+
approved: ({ event }) => output(event).approved === true,
|
|
70
|
+
needsApproval: ({ context }, execution) => needsApproval(context, execution),
|
|
71
|
+
toolAutoRuns: ({ event }) => preflightReady(output(event).execution) &&
|
|
72
|
+
autoRuns(output(event).execution),
|
|
73
|
+
directExecution: ({ context }) => context.execution?.kind === 'direct',
|
|
74
|
+
timeUp: ({ context }) => context.timeUp,
|
|
75
|
+
failedOutcome: ({ context }) => context.outcome === 'failed',
|
|
76
|
+
needsRecovery: ({ event }) => errorOf(event)?.tag === 'recovery',
|
|
77
|
+
interrupted: ({ event }) => errorOf(event)?.tag === 'aborted'
|
|
78
|
+
};
|
|
79
|
+
export const completionActions = {
|
|
80
|
+
requestPreload: assignAction(requestPreload),
|
|
81
|
+
authorizePreload: assignAction(authorizePreload),
|
|
82
|
+
settlePreloadFailure: assignAction(settlePreloadFailure),
|
|
83
|
+
startDirectTool: assignAction(startDirectTool),
|
|
84
|
+
queueDirectSearch: assignAction(queueDirectSearch),
|
|
85
|
+
rejectDeniedApproval: assignAction(rejectDeniedApproval),
|
|
86
|
+
startInitialRound: assignAction(startInitialRound),
|
|
87
|
+
settleSkill: assignAction((args) => 'failure' in args.params
|
|
88
|
+
? failSkill({ ...args, params: args.params.failure })
|
|
89
|
+
: finishSkill({ ...args, params: args.params })),
|
|
90
|
+
finishRound: assignAction(finishRound),
|
|
91
|
+
finishWrapRound: assignAction(finishWrapRound),
|
|
92
|
+
wrapCompletion: assignAction(wrapCompletion),
|
|
93
|
+
resolveTools: assignAction(resolveTools),
|
|
94
|
+
answerCompletion: assignAction(answerCompletion),
|
|
95
|
+
retryMuteRound: assignAction(retryMuteRound),
|
|
96
|
+
retryNarratedRound: assignAction(retryNarratedRound),
|
|
97
|
+
wrapMuteCompletion: assignAction(wrapMuteCompletion),
|
|
98
|
+
selectNextTool: assignAction(selectNextTool),
|
|
99
|
+
rejectRepeatedTool: assignAction(rejectRepeatedTool),
|
|
100
|
+
retryCappedSearch: assignAction(retryCappedSearch),
|
|
101
|
+
wrapSearchCappedCompletion: assignAction(wrapSearchCappedCompletion),
|
|
102
|
+
startNextRound: assignAction(startNextRound),
|
|
103
|
+
wrapExhaustedCompletion: assignAction(wrapExhaustedCompletion),
|
|
104
|
+
startSkillTool: assignAction(startSkillTool),
|
|
105
|
+
startTool: assignAction(startTool),
|
|
106
|
+
rejectTool: assignAction(rejectTool),
|
|
107
|
+
finishDirectTool: assignAction(finishDirectTool),
|
|
108
|
+
finishTool: assignAction(finishTool),
|
|
109
|
+
settleToolSkill: assignAction((args) => 'failure' in args.params
|
|
110
|
+
? failToolSkill({ ...args, params: args.params.failure })
|
|
111
|
+
: finishToolSkill({ ...args, params: args.params })),
|
|
112
|
+
approveCompletion: assignAction(approveCompletion),
|
|
113
|
+
requestApproval: assignAction(requestApproval),
|
|
114
|
+
failCompletion: assignAction(failCompletion),
|
|
115
|
+
markTimeUp: assignAction(() => ({ timeUp: true })),
|
|
116
|
+
recordPause: assignAction(({ context }) => ({
|
|
117
|
+
pauseCount: context.pauseCount + 1
|
|
118
|
+
})),
|
|
119
|
+
recordRecovery: assign(({ event }) => {
|
|
120
|
+
const error = errorOf(event);
|
|
121
|
+
let recovery;
|
|
122
|
+
if (event.type === 'RECOVERY_REQUIRED') {
|
|
123
|
+
recovery = event.operation;
|
|
124
|
+
}
|
|
125
|
+
else if (error?.tag === 'recovery') {
|
|
126
|
+
recovery = error.operation;
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
recovery
|
|
130
|
+
};
|
|
131
|
+
}),
|
|
132
|
+
resumeRun: assign(({ context, event }) => {
|
|
133
|
+
const pausedMs = event.type === 'RESUME' ? (event.pausedMs ?? 0) : 0;
|
|
134
|
+
const durable = context.durable;
|
|
135
|
+
return {
|
|
136
|
+
recovery: undefined,
|
|
137
|
+
durable: durable && pausedMs > 0
|
|
138
|
+
? {
|
|
139
|
+
...durable,
|
|
140
|
+
runBudget: {
|
|
141
|
+
...durable.runBudget,
|
|
142
|
+
deadlineMs: durable.runBudget.deadlineMs + pausedMs
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
: durable
|
|
146
|
+
};
|
|
147
|
+
}),
|
|
148
|
+
recordFacts: assign(({ event }) => (event.type === 'FACTS' ? { durable: event.value } : {}))
|
|
149
|
+
};
|
|
150
|
+
function assignAction(action) {
|
|
151
|
+
return assign(({ context }, params) => action({ context, params }));
|
|
152
|
+
}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { type EngineDeps } from './ports.ts';
|
|
2
|
+
import type { CompletionContext, DirectToolOutput, EngineEvent, RejectDeniedApprovalParams, SearchingOutput } from './types.ts';
|
|
3
|
+
declare const createCompletionMachineImplementation: (context?: CompletionContext, now?: () => number, deps?: EngineDeps) => import("xstate").StateMachine<CompletionContext, {
|
|
4
|
+
type: 'START';
|
|
5
|
+
} | {
|
|
6
|
+
type: 'PAUSE';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'RESUME';
|
|
9
|
+
pausedMs?: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'RECOVERY_REQUIRED';
|
|
12
|
+
operation: import("../errors.ts").Operation;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'FACTS';
|
|
15
|
+
value: import("./types.ts").EngineFacts;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'FAIL';
|
|
18
|
+
value: {
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
type: `xstate.error.actor.${string}`;
|
|
23
|
+
error: import("../errors.ts").EngineError;
|
|
24
|
+
} | {
|
|
25
|
+
type: `xstate.done.actor.${string}`;
|
|
26
|
+
output: import("./types.ts").CompletionActorOutput;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'OUTPUT';
|
|
29
|
+
event: EngineEvent;
|
|
30
|
+
}, {
|
|
31
|
+
[x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<void, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").AnsweredPayload, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").InspectingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").PreloadInspectionOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").PreparingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").RoundDonePayload, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<SearchingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").ToolDonePayload, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<{
|
|
32
|
+
approved: boolean;
|
|
33
|
+
}, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").SkillLoadOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").ResolvingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<import("./types.ts").RoundDonePayload & {
|
|
34
|
+
response: string;
|
|
35
|
+
}, import("./ports.ts").InvocationInput, import("xstate").EventObject>> | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
src: "answering";
|
|
38
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").AnsweredPayload, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
39
|
+
id: string | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
src: "approving";
|
|
42
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
43
|
+
approved: boolean;
|
|
44
|
+
}, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
45
|
+
id: string | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
src: "cleanup";
|
|
48
|
+
logic: import("xstate").PromiseActorLogic<void, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
49
|
+
id: string | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
src: "executing";
|
|
52
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").ToolDonePayload, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
53
|
+
id: string | undefined;
|
|
54
|
+
} | {
|
|
55
|
+
src: "finishing";
|
|
56
|
+
logic: import("xstate").PromiseActorLogic<void, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
57
|
+
id: string | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
src: "generating";
|
|
60
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").RoundDonePayload, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
61
|
+
id: string | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
src: "inspectPreload";
|
|
64
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").PreloadInspectionOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
65
|
+
id: string | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
src: "inspecting";
|
|
68
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").InspectingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
69
|
+
id: string | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
src: "loadingSkill";
|
|
72
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").SkillLoadOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
73
|
+
id: string | undefined;
|
|
74
|
+
} | {
|
|
75
|
+
src: "preloading";
|
|
76
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").SkillLoadOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
77
|
+
id: string | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
src: "preparing";
|
|
80
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").PreparingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
81
|
+
id: string | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
src: "rejecting";
|
|
84
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").ToolDonePayload, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
85
|
+
id: string | undefined;
|
|
86
|
+
} | {
|
|
87
|
+
src: "resolving";
|
|
88
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").ResolvingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
89
|
+
id: string | undefined;
|
|
90
|
+
} | {
|
|
91
|
+
src: "resume";
|
|
92
|
+
logic: import("xstate").PromiseActorLogic<void, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
93
|
+
id: string | undefined;
|
|
94
|
+
} | {
|
|
95
|
+
src: "searching";
|
|
96
|
+
logic: import("xstate").PromiseActorLogic<SearchingOutput, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
97
|
+
id: string | undefined;
|
|
98
|
+
} | {
|
|
99
|
+
src: "wrapping";
|
|
100
|
+
logic: import("xstate").PromiseActorLogic<import("./types.ts").RoundDonePayload & {
|
|
101
|
+
response: string;
|
|
102
|
+
}, import("./ports.ts").InvocationInput, import("xstate").EventObject>;
|
|
103
|
+
id: string | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
type: "answerCompletion";
|
|
106
|
+
params: import("./types.ts").AnsweredPayload;
|
|
107
|
+
} | {
|
|
108
|
+
type: "approveCompletion";
|
|
109
|
+
params: undefined;
|
|
110
|
+
} | {
|
|
111
|
+
type: "authorizePreload";
|
|
112
|
+
params: import("./types.ts").PreloadInspectionOutput;
|
|
113
|
+
} | {
|
|
114
|
+
type: "failCompletion";
|
|
115
|
+
params: import("./actions/completion.ts").CompletionFailureMessage | {
|
|
116
|
+
tag: 'failed';
|
|
117
|
+
message: string;
|
|
118
|
+
name: string;
|
|
119
|
+
code?: string;
|
|
120
|
+
stack?: string;
|
|
121
|
+
cause?: import("../errors.ts").ErrorCause;
|
|
122
|
+
};
|
|
123
|
+
} | {
|
|
124
|
+
type: "finishDirectTool";
|
|
125
|
+
params: import("./types.ts").ToolDonePayload;
|
|
126
|
+
} | {
|
|
127
|
+
type: "finishRound";
|
|
128
|
+
params: import("./types.ts").RoundDonePayload;
|
|
129
|
+
} | {
|
|
130
|
+
type: "finishTool";
|
|
131
|
+
params: import("./types.ts").ToolDonePayload;
|
|
132
|
+
} | {
|
|
133
|
+
type: "finishWrapRound";
|
|
134
|
+
params: import("./types.ts").RoundDonePayload;
|
|
135
|
+
} | {
|
|
136
|
+
type: "markTimeUp";
|
|
137
|
+
params: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
type: "queueDirectSearch";
|
|
140
|
+
params: import("./types.ts").PreparingOutput;
|
|
141
|
+
} | {
|
|
142
|
+
type: "recordFacts";
|
|
143
|
+
params: undefined;
|
|
144
|
+
} | {
|
|
145
|
+
type: "recordPause";
|
|
146
|
+
params: undefined;
|
|
147
|
+
} | {
|
|
148
|
+
type: "recordRecovery";
|
|
149
|
+
params: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
type: "rejectDeniedApproval";
|
|
152
|
+
params: RejectDeniedApprovalParams;
|
|
153
|
+
} | {
|
|
154
|
+
type: "rejectRepeatedTool";
|
|
155
|
+
params: import("./types.ts").RepeatOfFailedCallParams;
|
|
156
|
+
} | {
|
|
157
|
+
type: "rejectTool";
|
|
158
|
+
params: import("./actions/tools.ts").RejectToolParams;
|
|
159
|
+
} | {
|
|
160
|
+
type: "requestApproval";
|
|
161
|
+
params: import("./types.ts").ApprovalCall;
|
|
162
|
+
} | {
|
|
163
|
+
type: "requestPreload";
|
|
164
|
+
params: import("./types.ts").PreparingPayload & {
|
|
165
|
+
name: string;
|
|
166
|
+
history: import("./types.ts").HistorySplice;
|
|
167
|
+
pendingSearch: string | null;
|
|
168
|
+
};
|
|
169
|
+
} | {
|
|
170
|
+
type: "resolveTools";
|
|
171
|
+
params: import("./types.ts").ToolsResolvedPayload;
|
|
172
|
+
} | {
|
|
173
|
+
type: "resumeRun";
|
|
174
|
+
params: undefined;
|
|
175
|
+
} | {
|
|
176
|
+
type: "retryCappedSearch";
|
|
177
|
+
params: undefined;
|
|
178
|
+
} | {
|
|
179
|
+
type: "retryMuteRound";
|
|
180
|
+
params: undefined;
|
|
181
|
+
} | {
|
|
182
|
+
type: "retryNarratedRound";
|
|
183
|
+
params: import("./types.ts").AnsweredPayload;
|
|
184
|
+
} | {
|
|
185
|
+
type: "selectNextTool";
|
|
186
|
+
params: import("./types.ts").ResolvedCallSnapshot;
|
|
187
|
+
} | {
|
|
188
|
+
type: "settlePreloadFailure";
|
|
189
|
+
params: import("./types.ts").PreloadInspectionOutput | import("./types.ts").SkillLoadOutput;
|
|
190
|
+
} | {
|
|
191
|
+
type: "settleSkill";
|
|
192
|
+
params: import("./types.ts").SkillLoadOutput;
|
|
193
|
+
} | {
|
|
194
|
+
type: "settleToolSkill";
|
|
195
|
+
params: import("./types.ts").SkillLoadOutput;
|
|
196
|
+
} | {
|
|
197
|
+
type: "startDirectTool";
|
|
198
|
+
params: DirectToolOutput;
|
|
199
|
+
} | {
|
|
200
|
+
type: "startInitialRound";
|
|
201
|
+
params: import("./types.ts").PreparingPayload;
|
|
202
|
+
} | {
|
|
203
|
+
type: "startNextRound";
|
|
204
|
+
params: undefined;
|
|
205
|
+
} | {
|
|
206
|
+
type: "startSkillTool";
|
|
207
|
+
params: Omit<import("./types.ts").ToolExecutionSnapshot, "kind" | "skillName"> & {
|
|
208
|
+
kind: 'skill';
|
|
209
|
+
skillName: string;
|
|
210
|
+
};
|
|
211
|
+
} | {
|
|
212
|
+
type: "startTool";
|
|
213
|
+
params: import("./types.ts").ToolExecutionSnapshot & {
|
|
214
|
+
gate: import("./types.ts").ApprovalGate;
|
|
215
|
+
};
|
|
216
|
+
} | {
|
|
217
|
+
type: "wrapCompletion";
|
|
218
|
+
params: import("./types.ts").RunOutcome;
|
|
219
|
+
} | {
|
|
220
|
+
type: "wrapExhaustedCompletion";
|
|
221
|
+
params: undefined;
|
|
222
|
+
} | {
|
|
223
|
+
type: "wrapMuteCompletion";
|
|
224
|
+
params: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
type: "wrapSearchCappedCompletion";
|
|
227
|
+
params: undefined;
|
|
228
|
+
}, {
|
|
229
|
+
type: "allResolvedToolsCapped";
|
|
230
|
+
params: unknown;
|
|
231
|
+
} | {
|
|
232
|
+
type: "approved";
|
|
233
|
+
params: unknown;
|
|
234
|
+
} | {
|
|
235
|
+
type: "canMuteRetry";
|
|
236
|
+
params: unknown;
|
|
237
|
+
} | {
|
|
238
|
+
type: "canRetrySearchCap";
|
|
239
|
+
params: unknown;
|
|
240
|
+
} | {
|
|
241
|
+
type: "directAutoRuns";
|
|
242
|
+
params: unknown;
|
|
243
|
+
} | {
|
|
244
|
+
type: "directExecution";
|
|
245
|
+
params: unknown;
|
|
246
|
+
} | {
|
|
247
|
+
type: "directNeedsApproval";
|
|
248
|
+
params: unknown;
|
|
249
|
+
} | {
|
|
250
|
+
type: "directRejected";
|
|
251
|
+
params: unknown;
|
|
252
|
+
} | {
|
|
253
|
+
type: "directSearchNeeded";
|
|
254
|
+
params: unknown;
|
|
255
|
+
} | {
|
|
256
|
+
type: "errorInActiveOrResumingAndInterrupted";
|
|
257
|
+
params: unknown;
|
|
258
|
+
} | {
|
|
259
|
+
type: "errorInActiveOrResumingAndRecoveryRequired";
|
|
260
|
+
params: unknown;
|
|
261
|
+
} | {
|
|
262
|
+
type: "errorInFinishing";
|
|
263
|
+
params: unknown;
|
|
264
|
+
} | {
|
|
265
|
+
type: "errorInPausing";
|
|
266
|
+
params: unknown;
|
|
267
|
+
} | {
|
|
268
|
+
type: "errorInRoutableState";
|
|
269
|
+
params: unknown;
|
|
270
|
+
} | {
|
|
271
|
+
type: "failedOutcome";
|
|
272
|
+
params: unknown;
|
|
273
|
+
} | {
|
|
274
|
+
type: "hasAnswer";
|
|
275
|
+
params: unknown;
|
|
276
|
+
} | {
|
|
277
|
+
type: "hasQueuedTool";
|
|
278
|
+
params: unknown;
|
|
279
|
+
} | {
|
|
280
|
+
type: "hasRoundsLeft";
|
|
281
|
+
params: unknown;
|
|
282
|
+
} | {
|
|
283
|
+
type: "interrupted";
|
|
284
|
+
params: unknown;
|
|
285
|
+
} | {
|
|
286
|
+
type: "narratedIntent";
|
|
287
|
+
params: unknown;
|
|
288
|
+
} | {
|
|
289
|
+
type: "needsApproval";
|
|
290
|
+
params: import("./types.ts").ToolExecutionSnapshot | null | undefined;
|
|
291
|
+
} | {
|
|
292
|
+
type: "needsRecovery";
|
|
293
|
+
params: unknown;
|
|
294
|
+
} | {
|
|
295
|
+
type: "noDirectTool";
|
|
296
|
+
params: unknown;
|
|
297
|
+
} | {
|
|
298
|
+
type: "preloadFailed";
|
|
299
|
+
params: unknown;
|
|
300
|
+
} | {
|
|
301
|
+
type: "preloadNeeded";
|
|
302
|
+
params: unknown;
|
|
303
|
+
} | {
|
|
304
|
+
type: "repeatOfFailed";
|
|
305
|
+
params: unknown;
|
|
306
|
+
} | {
|
|
307
|
+
type: "repeatsBlocked";
|
|
308
|
+
params: unknown;
|
|
309
|
+
} | {
|
|
310
|
+
type: "roundHasToolCalls";
|
|
311
|
+
params: unknown;
|
|
312
|
+
} | {
|
|
313
|
+
type: "searchPending";
|
|
314
|
+
params: unknown;
|
|
315
|
+
} | {
|
|
316
|
+
type: "skillLoadAllowed";
|
|
317
|
+
params: unknown;
|
|
318
|
+
} | {
|
|
319
|
+
type: "timeUp";
|
|
320
|
+
params: unknown;
|
|
321
|
+
} | {
|
|
322
|
+
type: "toolAutoRuns";
|
|
323
|
+
params: unknown;
|
|
324
|
+
} | {
|
|
325
|
+
type: "toolRejected";
|
|
326
|
+
params: unknown;
|
|
327
|
+
}, "deadline", "done" | "failed" | "paused" | "pausing" | "resuming" | {
|
|
328
|
+
active: "answering" | "finishing" | "generating" | "idle" | "preloadChecking" | "preloading" | "preparing" | "resolving" | "round" | "searching" | "wrapping" | {
|
|
329
|
+
tools: "approving" | "executing" | "inspecting" | "loadingSkill" | "rejecting" | "selecting";
|
|
330
|
+
};
|
|
331
|
+
}, string, CompletionContext, {
|
|
332
|
+
status: 'success';
|
|
333
|
+
response: string;
|
|
334
|
+
metrics: CompletionContext['metrics'];
|
|
335
|
+
} | {
|
|
336
|
+
status: 'failure';
|
|
337
|
+
error: string;
|
|
338
|
+
}, EngineEvent, import("xstate").MetaObject, {
|
|
339
|
+
id: "completion";
|
|
340
|
+
states: {
|
|
341
|
+
readonly active: {
|
|
342
|
+
states: {
|
|
343
|
+
readonly history: {};
|
|
344
|
+
readonly idle: {};
|
|
345
|
+
readonly preparing: {};
|
|
346
|
+
readonly preloadChecking: {};
|
|
347
|
+
readonly preloading: {};
|
|
348
|
+
readonly searching: {};
|
|
349
|
+
readonly round: {};
|
|
350
|
+
readonly generating: {};
|
|
351
|
+
readonly resolving: {};
|
|
352
|
+
readonly answering: {};
|
|
353
|
+
readonly tools: {
|
|
354
|
+
states: {
|
|
355
|
+
readonly selecting: {};
|
|
356
|
+
readonly inspecting: {};
|
|
357
|
+
readonly rejecting: {};
|
|
358
|
+
readonly loadingSkill: {};
|
|
359
|
+
readonly approving: {};
|
|
360
|
+
readonly executing: {};
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
readonly wrapping: {};
|
|
364
|
+
readonly finishing: {};
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
readonly pausing: {};
|
|
368
|
+
readonly resuming: {};
|
|
369
|
+
readonly paused: {};
|
|
370
|
+
readonly done: {};
|
|
371
|
+
readonly failed: {};
|
|
372
|
+
};
|
|
373
|
+
}, import("xstate").MetaObject>;
|
|
374
|
+
export declare const createCompletionMachine: typeof createCompletionMachineImplementation;
|
|
375
|
+
export {};
|