@leitwerk-dev/worker 0.3.1 → 0.4.1
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/{chunk-4WPLQCF6.js → chunk-KJCBXN5F.js} +1700 -1244
- package/dist/chunk-KJCBXN5F.js.map +1 -0
- package/dist/container-entry-main.js +160 -3
- package/dist/container-entry-main.js.map +1 -1
- package/dist/container-entry.d.ts +1 -0
- package/dist/container-entry.d.ts.map +1 -1
- package/dist/development-tool-environment.d.ts.map +1 -1
- package/dist/diagnostics.d.ts +5 -1
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/docker-registry-credentials.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/ipc.d.ts.map +1 -1
- package/dist/logical-prompt-runner.d.ts.map +1 -1
- package/dist/missing-tool-recovery-runner.d.ts.map +1 -1
- package/dist/pi-adapter.d.ts +2 -0
- package/dist/pi-adapter.d.ts.map +1 -1
- package/dist/pi-event-reporter.d.ts +2 -0
- package/dist/pi-event-reporter.d.ts.map +1 -1
- package/dist/pi-inspection.d.ts +5 -0
- package/dist/pi-inspection.d.ts.map +1 -0
- package/dist/runtime/bootstrap-session.d.ts +4 -1
- package/dist/runtime/bootstrap-session.d.ts.map +1 -1
- package/dist/runtime/bootstrap.d.ts.map +1 -1
- package/dist/runtime/failure-policy.d.ts.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/llm-turn-execution.d.ts +2 -0
- package/dist/runtime/llm-turn-execution.d.ts.map +1 -1
- package/dist/runtime/turn-execution.d.ts.map +1 -1
- package/dist/session-snapshot-exchange.d.ts.map +1 -1
- package/dist/strict-outcome-schema.d.ts +11 -0
- package/dist/strict-outcome-schema.d.ts.map +1 -0
- package/dist/test-helpers/llm-turn.d.ts +4 -0
- package/dist/test-helpers/llm-turn.d.ts.map +1 -0
- package/dist/test-helpers/pi-provider.d.ts +13 -0
- package/dist/test-helpers/pi-provider.d.ts.map +1 -0
- package/dist/transport-error.d.ts +16 -0
- package/dist/transport-error.d.ts.map +1 -0
- package/dist/turn-outcome-tool-session.d.ts +6 -1
- package/dist/turn-outcome-tool-session.d.ts.map +1 -1
- package/dist/turn-result-markdown.d.ts +5 -0
- package/dist/turn-result-markdown.d.ts.map +1 -1
- package/dist/virtual-machine-docker.d.ts +10 -0
- package/dist/virtual-machine-docker.d.ts.map +1 -0
- package/dist/worker-entry.js +1 -1
- package/dist/workspace/checkout-tool.d.ts +6 -0
- package/dist/workspace/checkout-tool.d.ts.map +1 -0
- package/dist/workspace/manifest.d.ts +2 -0
- package/dist/workspace/manifest.d.ts.map +1 -1
- package/dist/workspace/node-run-root-git-ops.d.ts +1 -0
- package/dist/workspace/node-run-root-git-ops.d.ts.map +1 -1
- package/dist/workspace/run-root.d.ts +5 -3
- package/dist/workspace/run-root.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/container-entry.ts +22 -0
- package/src/development-tool-environment.ts +2 -0
- package/src/diagnostics.ts +6 -1
- package/src/docker-registry-credentials.ts +8 -0
- package/src/ipc.ts +4 -24
- package/src/logical-prompt-runner.ts +45 -41
- package/src/missing-tool-recovery-runner.ts +26 -18
- package/src/pi-adapter.ts +219 -337
- package/src/pi-event-reporter.ts +8 -0
- package/src/pi-inspection.ts +126 -0
- package/src/runtime/bootstrap-session.ts +12 -1
- package/src/runtime/bootstrap.ts +15 -5
- package/src/runtime/failure-policy.ts +20 -2
- package/src/runtime/index.ts +65 -10
- package/src/runtime/llm-turn-execution.ts +28 -1
- package/src/runtime/turn-execution.ts +70 -2
- package/src/session-snapshot-exchange.ts +2 -0
- package/src/strict-outcome-schema.ts +84 -0
- package/src/test-helpers/llm-turn.ts +22 -0
- package/src/test-helpers/pi-provider.ts +128 -0
- package/src/transport-error.ts +92 -0
- package/src/turn-outcome-tool-session.ts +123 -26
- package/src/turn-result-markdown.ts +23 -6
- package/src/virtual-machine-docker.ts +191 -0
- package/src/workspace/checkout-tool.ts +68 -0
- package/src/workspace/manifest.ts +3 -0
- package/src/workspace/node-run-root-git-ops.ts +17 -0
- package/src/workspace/run-root.ts +62 -26
- package/dist/chunk-4WPLQCF6.js.map +0 -1
|
@@ -27,29 +27,28 @@ export async function runMissingToolRecovery<TOutcome extends string>(input: {
|
|
|
27
27
|
const trace = (payload: WorkerDiagnosticPayload) => input.emit?.({ kind: "trace", payload });
|
|
28
28
|
const reportError = (payload: WorkerDiagnosticPayload) =>
|
|
29
29
|
input.emit?.({ kind: "error", payload });
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
33
|
-
if (!baseMissingToolRecovery) {
|
|
30
|
+
let recovery = input.toolSession.resolveMissingToolRecovery(input.initialAttempt.completionState);
|
|
31
|
+
if (!recovery) {
|
|
34
32
|
return { finalAttempt: input.initialAttempt };
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
let recoveryContext = input.toolSession.buildRecoveryContext(recovery);
|
|
36
|
+
let description = input.toolSession.describeRecovery(recovery);
|
|
39
37
|
reportError({
|
|
40
38
|
level: "warn",
|
|
41
|
-
code: "turn.required_tool_call_missing",
|
|
42
|
-
message: `Turn '${input.turnId}'
|
|
39
|
+
code: recovery.rejectedOutcome ? "turn.outcome_rejected" : "turn.required_tool_call_missing",
|
|
40
|
+
message: `Turn '${input.turnId}' did not complete: ${description}`,
|
|
43
41
|
turnRecordId: input.turnRecordId,
|
|
44
42
|
turnId: input.turnId,
|
|
45
43
|
errorClass: "protocol_error",
|
|
46
44
|
details: {
|
|
47
45
|
attemptBudget: MAX_MISSING_TOOL_CALL_RECOVERY_ATTEMPTS,
|
|
48
|
-
missingToolNames:
|
|
46
|
+
missingToolNames: recovery.missingToolNames,
|
|
49
47
|
},
|
|
50
48
|
});
|
|
51
49
|
|
|
52
50
|
let finalAttempt = input.initialAttempt;
|
|
51
|
+
let unchangedRejections = 0;
|
|
53
52
|
for (
|
|
54
53
|
let recoveryAttempt = 1;
|
|
55
54
|
recoveryAttempt <= MAX_MISSING_TOOL_CALL_RECOVERY_ATTEMPTS;
|
|
@@ -58,37 +57,46 @@ export async function runMissingToolRecovery<TOutcome extends string>(input: {
|
|
|
58
57
|
trace({
|
|
59
58
|
level: "info",
|
|
60
59
|
code: "turn.required_tool_call_retry_requested",
|
|
61
|
-
message: `Turn '${input.turnId}' is retrying
|
|
60
|
+
message: `Turn '${input.turnId}' is retrying: ${description}`,
|
|
62
61
|
turnRecordId: input.turnRecordId,
|
|
63
62
|
turnId: input.turnId,
|
|
64
63
|
details: {
|
|
65
64
|
recoveryAttempt,
|
|
66
|
-
missingToolNames:
|
|
65
|
+
missingToolNames: recovery.missingToolNames,
|
|
67
66
|
},
|
|
68
67
|
});
|
|
68
|
+
const previousAttempt = finalAttempt;
|
|
69
69
|
finalAttempt = await input.executeLogicalPromptPlan(
|
|
70
70
|
{
|
|
71
71
|
kind: "continue",
|
|
72
72
|
continueUserPrompt: recoveryContext.suggestedContinuePrompt,
|
|
73
73
|
prepareForContinuation: async () =>
|
|
74
|
-
await input.piHandle.branch(
|
|
74
|
+
await input.piHandle.branch(previousAttempt.promptResult.resultEntryId),
|
|
75
75
|
},
|
|
76
|
-
{ baseState:
|
|
76
|
+
{ baseState: previousAttempt.completionState },
|
|
77
77
|
);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const nextRecovery = input.toolSession.resolveMissingToolRecovery(finalAttempt.completionState);
|
|
79
|
+
if (!nextRecovery) return { finalAttempt };
|
|
80
|
+
unchangedRejections =
|
|
81
|
+
recovery.rejectedOutcome &&
|
|
82
|
+
JSON.stringify(recovery.rejectedOutcome) === JSON.stringify(nextRecovery.rejectedOutcome)
|
|
83
|
+
? unchangedRejections + 1
|
|
84
|
+
: 0;
|
|
85
|
+
recovery = nextRecovery;
|
|
86
|
+
recoveryContext = input.toolSession.buildRecoveryContext(recovery);
|
|
87
|
+
description = input.toolSession.describeRecovery(recovery);
|
|
88
|
+
if (unchangedRejections >= 2) break;
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
reportError({
|
|
84
92
|
level: "error",
|
|
85
93
|
code: "turn.required_tool_call_retry_exhausted",
|
|
86
|
-
message: `Turn '${input.turnId}'
|
|
94
|
+
message: `Turn '${input.turnId}' stopped automatic recovery: ${description}`,
|
|
87
95
|
turnRecordId: input.turnRecordId,
|
|
88
96
|
turnId: input.turnId,
|
|
89
97
|
errorClass: "protocol_error",
|
|
90
98
|
details: {
|
|
91
|
-
missingToolNames:
|
|
99
|
+
missingToolNames: recovery.missingToolNames,
|
|
92
100
|
},
|
|
93
101
|
});
|
|
94
102
|
return {
|