@e2edev/e2e 0.7.0 → 0.9.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/README.md +8 -3
- package/dist/agent/act-validation.d.ts +7 -4
- package/dist/agent/act-validation.d.ts.map +1 -1
- package/dist/agent/act-validation.js +18 -3
- package/dist/agent/act-validation.js.map +1 -1
- package/dist/agent/act.d.ts +2 -2
- package/dist/agent/act.d.ts.map +1 -1
- package/dist/agent/act.js +228 -51
- package/dist/agent/act.js.map +1 -1
- package/dist/agent/default-agent.d.ts +1 -1
- package/dist/agent/default-agent.d.ts.map +1 -1
- package/dist/agent/default-agent.js +19 -84
- package/dist/agent/default-agent.js.map +1 -1
- package/dist/agent/executor.d.ts +7 -0
- package/dist/agent/executor.d.ts.map +1 -1
- package/dist/agent/executor.js.map +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +14 -6
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/invocation.d.ts +1 -8
- package/dist/agent/invocation.d.ts.map +1 -1
- package/dist/agent/invocation.js +7 -51
- package/dist/agent/invocation.js.map +1 -1
- package/dist/agent/ledger.d.ts.map +1 -1
- package/dist/agent/ledger.js +10 -1
- package/dist/agent/ledger.js.map +1 -1
- package/dist/agent/loop-guards.d.ts +21 -0
- package/dist/agent/loop-guards.d.ts.map +1 -1
- package/dist/agent/loop-guards.js +48 -0
- package/dist/agent/loop-guards.js.map +1 -1
- package/dist/agent/model/sdk.d.ts +18 -0
- package/dist/agent/model/sdk.d.ts.map +1 -1
- package/dist/agent/model/sdk.js +9 -3
- package/dist/agent/model/sdk.js.map +1 -1
- package/dist/agent/observation-budget.d.ts +27 -0
- package/dist/agent/observation-budget.d.ts.map +1 -0
- package/dist/agent/observation-budget.js +43 -0
- package/dist/agent/observation-budget.js.map +1 -0
- package/dist/agent/observation.d.ts +40 -7
- package/dist/agent/observation.d.ts.map +1 -1
- package/dist/agent/observation.js +56 -11
- package/dist/agent/observation.js.map +1 -1
- package/dist/agent/phases.d.ts +1 -1
- package/dist/agent/phases.d.ts.map +1 -1
- package/dist/agent/phases.js +11 -13
- package/dist/agent/phases.js.map +1 -1
- package/dist/agent/primitives.d.ts +14 -2
- package/dist/agent/primitives.d.ts.map +1 -1
- package/dist/agent/primitives.js +98 -54
- package/dist/agent/primitives.js.map +1 -1
- package/dist/agent/screen-update.d.ts +47 -0
- package/dist/agent/screen-update.d.ts.map +1 -0
- package/dist/agent/screen-update.js +222 -0
- package/dist/agent/screen-update.js.map +1 -0
- package/dist/agent/step-cache.d.ts +38 -10
- package/dist/agent/step-cache.d.ts.map +1 -1
- package/dist/agent/step-cache.js +86 -45
- package/dist/agent/step-cache.js.map +1 -1
- package/dist/agent/tool-loop.d.ts.map +1 -1
- package/dist/agent/tool-loop.js +27 -4
- package/dist/agent/tool-loop.js.map +1 -1
- package/dist/cache/decide.d.ts +4 -3
- package/dist/cache/decide.d.ts.map +1 -1
- package/dist/cache/decide.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/engines.d.ts +2 -3
- package/dist/cli/init/engines.d.ts.map +1 -1
- package/dist/cli/init/engines.js +3 -4
- package/dist/cli/init/engines.js.map +1 -1
- package/dist/cli/signals.d.ts +3 -3
- package/dist/cli/signals.js +3 -3
- package/dist/config/agent.d.ts +6 -2
- package/dist/config/agent.d.ts.map +1 -1
- package/dist/config/agent.js +6 -2
- package/dist/config/agent.js.map +1 -1
- package/dist/config/app.d.ts +4 -4
- package/dist/config/app.d.ts.map +1 -1
- package/dist/config/load.d.ts +2 -2
- package/dist/config/load.js +2 -2
- package/dist/config/resolve.d.ts +21 -6
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +165 -54
- package/dist/config/resolve.js.map +1 -1
- package/dist/engine/contract.d.ts +6 -1
- package/dist/engine/contract.d.ts.map +1 -1
- package/dist/engine/contract.js.map +1 -1
- package/dist/engine/index.d.ts +69 -6
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +25 -5
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +6 -0
- package/dist/engine/session.js.map +1 -1
- package/dist/engine/surface.d.ts +6 -2
- package/dist/engine/surface.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/options.d.ts +9 -0
- package/dist/internal/options.d.ts.map +1 -0
- package/dist/internal/options.js +27 -0
- package/dist/internal/options.js.map +1 -0
- package/dist/locator/expression.js +1 -1
- package/dist/locator/expression.js.map +1 -1
- package/dist/locator/screen.d.ts.map +1 -1
- package/dist/locator/screen.js +4 -2
- package/dist/locator/screen.js.map +1 -1
- package/dist/report/build.d.ts +2 -1
- package/dist/report/build.d.ts.map +1 -1
- package/dist/report/build.js +2 -0
- package/dist/report/build.js.map +1 -1
- package/dist/report/json.d.ts +4 -0
- package/dist/report/json.d.ts.map +1 -0
- package/dist/report/json.js +8 -0
- package/dist/report/json.js.map +1 -0
- package/dist/report/junit.d.ts +7 -0
- package/dist/report/junit.d.ts.map +1 -1
- package/dist/report/junit.js +17 -0
- package/dist/report/junit.js.map +1 -1
- package/dist/report/list-model.d.ts +8 -5
- package/dist/report/list-model.d.ts.map +1 -1
- package/dist/report/list.d.ts +19 -4
- package/dist/report/list.d.ts.map +1 -1
- package/dist/report/list.js +67 -19
- package/dist/report/list.js.map +1 -1
- package/dist/report/running-tree.d.ts +5 -4
- package/dist/report/running-tree.d.ts.map +1 -1
- package/dist/report/running-tree.js +8 -7
- package/dist/report/running-tree.js.map +1 -1
- package/dist/run/artifacts.d.ts.map +1 -1
- package/dist/run/artifacts.js +20 -2
- package/dist/run/artifacts.js.map +1 -1
- package/dist/run/events.d.ts +14 -9
- package/dist/run/events.d.ts.map +1 -1
- package/dist/run/events.js +7 -7
- package/dist/run/events.js.map +1 -1
- package/dist/run/execute.d.ts +24 -5
- package/dist/run/execute.d.ts.map +1 -1
- package/dist/run/execute.js +67 -25
- package/dist/run/execute.js.map +1 -1
- package/dist/run/fixtures.d.ts +6 -1
- package/dist/run/fixtures.d.ts.map +1 -1
- package/dist/run/fixtures.js +0 -1
- package/dist/run/fixtures.js.map +1 -1
- package/dist/run/in-process.d.ts +1 -1
- package/dist/run/in-process.d.ts.map +1 -1
- package/dist/run/in-process.js +6 -3
- package/dist/run/in-process.js.map +1 -1
- package/dist/run/managed-process.d.ts.map +1 -1
- package/dist/run/managed-process.js +6 -2
- package/dist/run/managed-process.js.map +1 -1
- package/dist/run/records.d.ts +14 -1
- package/dist/run/records.d.ts.map +1 -1
- package/dist/run/runner.d.ts +17 -9
- package/dist/run/runner.d.ts.map +1 -1
- package/dist/run/runner.js +180 -101
- package/dist/run/runner.js.map +1 -1
- package/dist/run/scheduler.d.ts +4 -6
- package/dist/run/scheduler.d.ts.map +1 -1
- package/dist/run/scheduler.js +51 -23
- package/dist/run/scheduler.js.map +1 -1
- package/dist/run/serial.d.ts +2 -4
- package/dist/run/serial.d.ts.map +1 -1
- package/dist/run/serial.js +4 -2
- package/dist/run/serial.js.map +1 -1
- package/dist/run/steps.d.ts +25 -0
- package/dist/run/steps.d.ts.map +1 -1
- package/dist/run/steps.js +12 -0
- package/dist/run/steps.js.map +1 -1
- package/dist/run/unit-runner.d.ts +7 -2
- package/dist/run/unit-runner.d.ts.map +1 -1
- package/dist/run/units.d.ts +10 -0
- package/dist/run/units.d.ts.map +1 -1
- package/dist/run/units.js +11 -0
- package/dist/run/units.js.map +1 -1
- package/dist/run/worker/entry.js +1 -0
- package/dist/run/worker/entry.js.map +1 -1
- package/dist/run/worker/handle.d.ts +1 -1
- package/dist/run/worker/handle.d.ts.map +1 -1
- package/dist/run/worker/handle.js +1 -1
- package/dist/run/worker/handle.js.map +1 -1
- package/dist/run/worker/protocol.d.ts +2 -0
- package/dist/run/worker/protocol.d.ts.map +1 -1
- package/dist/run/worker/protocol.js.map +1 -1
- package/dist/run/worker/session.d.ts +2 -0
- package/dist/run/worker/session.d.ts.map +1 -1
- package/dist/run/worker/session.js +1 -0
- package/dist/run/worker/session.js.map +1 -1
- package/dist/telemetry/telemetry.d.ts +2 -3
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/telemetry/telemetry.js +2 -3
- package/dist/telemetry/telemetry.js.map +1 -1
- package/dist/types.d.ts +159 -37
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -6
- package/skills/e2e/SKILL.md +0 -2
- package/skills/e2e/references/agent.md +20 -12
- package/skills/e2e/references/debugging.md +3 -1
- package/skills/e2e/references/running.md +4 -3
- package/skills/e2e/references/setup.md +13 -10
- package/skills/e2e/references/writing-tests.md +6 -5
- package/dist/internal/trace.d.ts +0 -18
- package/dist/internal/trace.d.ts.map +0 -1
- package/dist/internal/trace.js +0 -46
- package/dist/internal/trace.js.map +0 -1
- package/dist/run/public.d.ts +0 -19
- package/dist/run/public.d.ts.map +0 -1
- package/dist/run/public.js +0 -11
- package/dist/run/public.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the built-in agent tells the model about the screen, and how much.
|
|
3
|
+
*
|
|
4
|
+
* The first look at a screen goes out whole. Every look after it is compared
|
|
5
|
+
* with the screen the model already holds and rendered as the difference:
|
|
6
|
+
* the lines that appeared, the lines that changed, the lines that went away.
|
|
7
|
+
* Node ids are stable for as long as an element exists, so a line the model
|
|
8
|
+
* saw earlier still names the same element, and a diff is a complete update
|
|
9
|
+
* rather than a hint. A screen that changed mostly goes out whole again.
|
|
10
|
+
*
|
|
11
|
+
* Every full screen the transcript carries is a candidate for elision once
|
|
12
|
+
* newer full screens supersede it; diffs are small and stay. That keeps the
|
|
13
|
+
* conversation prefix stable turn after turn, which is what lets a provider
|
|
14
|
+
* serve the resent context from its prompt cache.
|
|
15
|
+
*/
|
|
16
|
+
import type { ModelMessage } from 'ai';
|
|
17
|
+
import type { ExecutorObservation } from './executor.ts';
|
|
18
|
+
/** How a screen update reads: the lead line names the action it follows. */
|
|
19
|
+
export interface ScreenUpdateOptions {
|
|
20
|
+
/** Prose placed before the screen, such as `Tapped #n16.`. */
|
|
21
|
+
readonly lead?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the update follows an action that should have changed the
|
|
24
|
+
* screen. An unchanged screen is then reported as the action having had no
|
|
25
|
+
* visible effect, which is what the model needs to stop repeating it.
|
|
26
|
+
*/
|
|
27
|
+
readonly expectChange?: boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
/** Renders one step's screens for the model and remembers what it has seen. */
|
|
30
|
+
export declare class ScreenPresenter {
|
|
31
|
+
private shown;
|
|
32
|
+
/** The step's first screen, whole. */
|
|
33
|
+
initial(observation: ExecutorObservation): string;
|
|
34
|
+
/**
|
|
35
|
+
* A later screen, as the difference from the one the model holds: nothing,
|
|
36
|
+
* the changed lines, or the whole screen when most of it changed.
|
|
37
|
+
*/
|
|
38
|
+
update(observation: ExecutorObservation, options?: ScreenUpdateOptions): string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Elides full screens the transcript no longer needs: every full screen but
|
|
42
|
+
* the newest few is reduced to its lead and a notice, in the opening prompt
|
|
43
|
+
* and in tool results alike. Diffs are never touched. Returns the input array
|
|
44
|
+
* unchanged when nothing qualifies, so the caller can skip the override.
|
|
45
|
+
*/
|
|
46
|
+
export declare function compactScreenHistory(messages: ModelMessage[]): ModelMessage[];
|
|
47
|
+
//# sourceMappingURL=screen-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-update.d.ts","sourceRoot":"","sources":["../../src/agent/screen-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AA6BzD,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,+EAA+E;AAC/E,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAA0B;IAEvC,sCAAsC;IACtC,OAAO,CAAC,WAAW,EAAE,mBAAmB,GAAG,MAAM,CAGhD;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,mBAAmB,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAsBlF;CACF;AA6FD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAiC7E"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the built-in agent tells the model about the screen, and how much.
|
|
3
|
+
*
|
|
4
|
+
* The first look at a screen goes out whole. Every look after it is compared
|
|
5
|
+
* with the screen the model already holds and rendered as the difference:
|
|
6
|
+
* the lines that appeared, the lines that changed, the lines that went away.
|
|
7
|
+
* Node ids are stable for as long as an element exists, so a line the model
|
|
8
|
+
* saw earlier still names the same element, and a diff is a complete update
|
|
9
|
+
* rather than a hint. A screen that changed mostly goes out whole again.
|
|
10
|
+
*
|
|
11
|
+
* Every full screen the transcript carries is a candidate for elision once
|
|
12
|
+
* newer full screens supersede it; diffs are small and stay. That keeps the
|
|
13
|
+
* conversation prefix stable turn after turn, which is what lets a provider
|
|
14
|
+
* serve the resent context from its prompt cache.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* How many of the newest full screens stay verbatim in the transcript. One:
|
|
18
|
+
* a whole new screen means the page changed mostly, and the screen it
|
|
19
|
+
* replaced is dead weight on every later turn. Change updates never elide.
|
|
20
|
+
*/
|
|
21
|
+
const FULL_SCREEN_PRESERVE_COUNT = 1;
|
|
22
|
+
/** A diff past this many lines goes out as the full screen instead. */
|
|
23
|
+
const MAX_DIFF_LINES = 60;
|
|
24
|
+
/** A diff touching more than this share of the new screen goes out whole. */
|
|
25
|
+
const MAX_DIFF_SHARE = 0.5;
|
|
26
|
+
/** Every full screen is introduced by this phrase; the elision looks for it. */
|
|
27
|
+
const FULL_SCREEN_PATTERN = /Current screen \(revision /;
|
|
28
|
+
/** Renders one step's screens for the model and remembers what it has seen. */
|
|
29
|
+
export class ScreenPresenter {
|
|
30
|
+
shown;
|
|
31
|
+
/** The step's first screen, whole. */
|
|
32
|
+
initial(observation) {
|
|
33
|
+
this.shown = indexScreen(observation);
|
|
34
|
+
return renderFull(observation);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A later screen, as the difference from the one the model holds: nothing,
|
|
38
|
+
* the changed lines, or the whole screen when most of it changed.
|
|
39
|
+
*/
|
|
40
|
+
update(observation, options = {}) {
|
|
41
|
+
const previous = this.shown;
|
|
42
|
+
const next = indexScreen(observation);
|
|
43
|
+
this.shown = next;
|
|
44
|
+
const lead = options.lead === undefined ? '' : `${options.lead}\n\n`;
|
|
45
|
+
if (previous === undefined)
|
|
46
|
+
return `${lead}${renderFull(observation)}`;
|
|
47
|
+
const diff = diffScreens(previous, next);
|
|
48
|
+
const changes = diff.length;
|
|
49
|
+
// A truncated screen is never called unchanged: what it left out is unknown.
|
|
50
|
+
if (changes === 0 && !observation.truncated) {
|
|
51
|
+
return `${lead}${renderUnchanged(previous.revision, observation, options.expectChange === true)}`;
|
|
52
|
+
}
|
|
53
|
+
if (changes >= MAX_DIFF_LINES || changes > MAX_DIFF_SHARE * next.order.length) {
|
|
54
|
+
return `${lead}The screen changed substantially since revision ${previous.revision}. ${renderFull(observation)}`;
|
|
55
|
+
}
|
|
56
|
+
const assurance = observation.truncated
|
|
57
|
+
? 'The screen was truncated at the observation byte limit: nodes past it are not listed and none is reported removed; every listed node keeps the id you have.'
|
|
58
|
+
: 'Every node not listed as removed is still on screen under the id you have.';
|
|
59
|
+
return [
|
|
60
|
+
`${lead}Screen changes since revision ${previous.revision} (now revision ${observation.revision}${describeLocation(observation)}, ${String(next.nodes)} nodes): ${describeCounts(diff)}. ${assurance}`,
|
|
61
|
+
...diff,
|
|
62
|
+
].join('\n');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** `2 added, 1 changed, 5 removed`, omitting the kinds that did not happen. */
|
|
66
|
+
function describeCounts(diff) {
|
|
67
|
+
const count = (kind) => diff.filter((line) => line.startsWith(`${kind} `)).length;
|
|
68
|
+
const counts = ['added', 'changed', 'removed']
|
|
69
|
+
.map((kind) => [count(kind), kind])
|
|
70
|
+
.filter(([n]) => n > 0)
|
|
71
|
+
.map(([n, kind]) => `${String(n)} ${kind}`)
|
|
72
|
+
.join(', ');
|
|
73
|
+
return counts === '' ? 'no listed node changed' : counts;
|
|
74
|
+
}
|
|
75
|
+
/** One full screen, headed so the elision can find it later. */
|
|
76
|
+
function renderFull(observation) {
|
|
77
|
+
const nodes = indexScreen(observation).nodes;
|
|
78
|
+
return `Current screen (revision ${observation.revision}${describeLocation(observation)}, ${String(nodes)} nodes):\n${observation.text}`;
|
|
79
|
+
}
|
|
80
|
+
function renderUnchanged(since, observation, expectedChange) {
|
|
81
|
+
const looked = `re-observed as revision ${observation.revision}${describeLocation(observation)}`;
|
|
82
|
+
return expectedChange
|
|
83
|
+
? `The screen did not change within the wait after this action (${looked}); the ids you have stay valid. If a change was expected, the control had no visible effect here: look for another way rather than repeating it.`
|
|
84
|
+
: `Screen unchanged since revision ${since} (${looked}); the ids you have stay valid.`;
|
|
85
|
+
}
|
|
86
|
+
function describeLocation(observation) {
|
|
87
|
+
return observation.path === undefined ? '' : `, path ${observation.path}`;
|
|
88
|
+
}
|
|
89
|
+
/** Node id at the head of one rendered line, or undefined for a marker line. */
|
|
90
|
+
function lineId(line) {
|
|
91
|
+
return /^\s*#(\S+)/.exec(line)?.[1];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The line without its focus state. Focus moves with every action and on its
|
|
95
|
+
* own, so a diff that reported it would drown the changes that matter and
|
|
96
|
+
* make a control that did nothing look like it did something. The states
|
|
97
|
+
* bracket is always the last token of a line. The full screen keeps focus.
|
|
98
|
+
*/
|
|
99
|
+
function withoutFocus(line) {
|
|
100
|
+
return line.replace(/ \[([^\]]*)\]$/, (_match, states) => {
|
|
101
|
+
const kept = states.split(' ').filter((state) => state !== 'focused');
|
|
102
|
+
return kept.length === 0 ? '' : ` [${kept.join(' ')}]`;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function indexScreen(observation) {
|
|
106
|
+
const order = [];
|
|
107
|
+
const byId = new Map();
|
|
108
|
+
for (const raw of observation.text.split('\n')) {
|
|
109
|
+
const id = lineId(raw);
|
|
110
|
+
if (id === undefined)
|
|
111
|
+
continue;
|
|
112
|
+
// Without indentation: a node that only moved to another depth reads the
|
|
113
|
+
// same, and reporting it as changed would show identical text twice.
|
|
114
|
+
const line = withoutFocus(raw).trimStart();
|
|
115
|
+
order.push(line);
|
|
116
|
+
byId.set(id, line);
|
|
117
|
+
}
|
|
118
|
+
return { revision: observation.revision, order, byId, nodes: byId.size, truncated: observation.truncated };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The lines that differ between two screens, keyed by node id: additions and
|
|
122
|
+
* changes in the new screen's document order, then removals in the old one's.
|
|
123
|
+
* A changed line is rendered whole with what it read before, so a value that
|
|
124
|
+
* was typed, a state that toggled, or a label that moved reads at a glance.
|
|
125
|
+
* Each line is prefixed with a word, not a symbol: a model read `- #n19
|
|
126
|
+
* button "Delete"` as a button that was there and tapped it twice more.
|
|
127
|
+
*/
|
|
128
|
+
function diffScreens(previous, next) {
|
|
129
|
+
const lines = [];
|
|
130
|
+
for (const line of next.order) {
|
|
131
|
+
const id = lineId(line);
|
|
132
|
+
if (id === undefined)
|
|
133
|
+
continue;
|
|
134
|
+
const before = previous.byId.get(id);
|
|
135
|
+
if (before === undefined) {
|
|
136
|
+
lines.push(`added ${line}`);
|
|
137
|
+
}
|
|
138
|
+
else if (before !== line) {
|
|
139
|
+
lines.push(`changed ${line} (was: ${before})`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// A truncated screen stopped listing nodes at the byte limit; the ones it
|
|
143
|
+
// left out may well still exist, so nothing is called removed on its word.
|
|
144
|
+
if (next.truncated)
|
|
145
|
+
return lines;
|
|
146
|
+
for (const line of previous.order) {
|
|
147
|
+
const id = lineId(line);
|
|
148
|
+
if (id !== undefined && !next.byId.has(id))
|
|
149
|
+
lines.push(`removed ${line}`);
|
|
150
|
+
}
|
|
151
|
+
return lines;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Elides full screens the transcript no longer needs: every full screen but
|
|
155
|
+
* the newest few is reduced to its lead and a notice, in the opening prompt
|
|
156
|
+
* and in tool results alike. Diffs are never touched. Returns the input array
|
|
157
|
+
* unchanged when nothing qualifies, so the caller can skip the override.
|
|
158
|
+
*/
|
|
159
|
+
export function compactScreenHistory(messages) {
|
|
160
|
+
const total = messages.reduce((count, message) => count + screenParts(message).filter((text) => text !== undefined).length, 0);
|
|
161
|
+
let stale = total - FULL_SCREEN_PRESERVE_COUNT;
|
|
162
|
+
if (stale <= 0)
|
|
163
|
+
return messages;
|
|
164
|
+
return messages.map((message) => {
|
|
165
|
+
if (stale <= 0)
|
|
166
|
+
return message;
|
|
167
|
+
if (message.role === 'user') {
|
|
168
|
+
if (typeof message.content === 'string') {
|
|
169
|
+
if (!FULL_SCREEN_PATTERN.test(message.content))
|
|
170
|
+
return message;
|
|
171
|
+
stale -= 1;
|
|
172
|
+
return { ...message, content: elideScreen(message.content) };
|
|
173
|
+
}
|
|
174
|
+
const content = message.content.map((part) => {
|
|
175
|
+
if (stale <= 0 || part.type !== 'text' || !FULL_SCREEN_PATTERN.test(part.text))
|
|
176
|
+
return part;
|
|
177
|
+
stale -= 1;
|
|
178
|
+
return { ...part, text: elideScreen(part.text) };
|
|
179
|
+
});
|
|
180
|
+
return { ...message, content };
|
|
181
|
+
}
|
|
182
|
+
if (message.role !== 'tool')
|
|
183
|
+
return message;
|
|
184
|
+
const texts = screenParts(message);
|
|
185
|
+
if (!texts.some((text) => text !== undefined))
|
|
186
|
+
return message;
|
|
187
|
+
const content = message.content.map((part, index) => {
|
|
188
|
+
const text = texts[index];
|
|
189
|
+
if (text === undefined || stale <= 0)
|
|
190
|
+
return part;
|
|
191
|
+
stale -= 1;
|
|
192
|
+
return { ...part, output: { type: 'text', value: elideScreen(text) } };
|
|
193
|
+
});
|
|
194
|
+
return { ...message, content };
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/** Everything before the screen, then the notice in place of the tree. */
|
|
198
|
+
function elideScreen(text) {
|
|
199
|
+
const at = text.search(FULL_SCREEN_PATTERN);
|
|
200
|
+
const head = at <= 0 ? (text.split('\n', 1)[0] ?? '') : text.slice(0, at).trimEnd();
|
|
201
|
+
return `${head}\n[earlier screen elided; the newest "Current screen" plus the changes after it describe the screen]`;
|
|
202
|
+
}
|
|
203
|
+
/** Per-part full-screen text of one message; undefined for parts without one. */
|
|
204
|
+
function screenParts(message) {
|
|
205
|
+
if (message.role === 'user') {
|
|
206
|
+
if (typeof message.content === 'string') {
|
|
207
|
+
return [FULL_SCREEN_PATTERN.test(message.content) ? message.content : undefined];
|
|
208
|
+
}
|
|
209
|
+
return message.content.map((part) => part.type === 'text' && FULL_SCREEN_PATTERN.test(part.text) ? part.text : undefined);
|
|
210
|
+
}
|
|
211
|
+
if (message.role !== 'tool')
|
|
212
|
+
return [];
|
|
213
|
+
return message.content.map((part) => {
|
|
214
|
+
if (part.type !== 'tool-result')
|
|
215
|
+
return undefined;
|
|
216
|
+
const output = part.output;
|
|
217
|
+
if (output.type !== 'text' || typeof output.value !== 'string')
|
|
218
|
+
return undefined;
|
|
219
|
+
return FULL_SCREEN_PATTERN.test(output.value) ? output.value : undefined;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=screen-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-update.js","sourceRoot":"","sources":["../../src/agent/screen-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;GAIG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAErC,uEAAuE;AACvE,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,6EAA6E;AAC7E,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAyBzD,+EAA+E;AAC/E,MAAM,OAAO,eAAe;IAClB,KAAK,CAA0B;IAEvC,sCAAsC;IACtC,OAAO,CAAC,WAAgC;QACtC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;QACtC,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAgC,EAAE,OAAO,GAAwB,EAAE;QACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5B,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,MAAM,CAAC;QACrE,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,GAAG,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC5B,6EAA6E;QAC7E,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,C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BAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CACpF,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACvC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa;YAAE,OAAO,SAAS,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACjF,OAAO,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -18,12 +18,18 @@ import type { RecordableAction } from './actions.ts';
|
|
|
18
18
|
import { type ReplayedPrefix, type StepVerdict } from './executor.ts';
|
|
19
19
|
import { type ObservedNodes, type ReplayHost } from './replay.ts';
|
|
20
20
|
/**
|
|
21
|
-
* The replay host plus
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* The replay host plus what replay itself never needs: the current location
|
|
22
|
+
* path, read at both ends of the step for the trace's start-path precondition
|
|
23
|
+
* and end-path postcondition, and the step's live progress.
|
|
24
24
|
*/
|
|
25
25
|
export interface StepCacheHost extends ReplayHost {
|
|
26
26
|
currentPath(observation?: ObservedNodes): Promise<string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Tells the step's live progress the cache has the step (`true`) or has
|
|
29
|
+
* handed it to the model (`false`), so a reporter can show the cache at
|
|
30
|
+
* work instead of a model turn.
|
|
31
|
+
*/
|
|
32
|
+
replaying(active: boolean): void;
|
|
27
33
|
}
|
|
28
34
|
/** What the session needs from the dispatch beyond the host itself. */
|
|
29
35
|
export interface StepCacheOptions {
|
|
@@ -84,13 +90,13 @@ export declare class StepTraceSession {
|
|
|
84
90
|
/** Records one mutating project-tool call as a replay-ending gap. */
|
|
85
91
|
recordGap(toolName: string): void;
|
|
86
92
|
/**
|
|
87
|
-
* Opens the step:
|
|
88
|
-
* and, when this step may write, the
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* Every failure to replay is
|
|
93
|
-
* propagate.
|
|
93
|
+
* Opens the step: reads the cache entry, captures the write-side
|
|
94
|
+
* preconditions — the start path and, when this step may write, the
|
|
95
|
+
* baseline screen — then attempts a zero-turn replay of a hit. Returns the
|
|
96
|
+
* self-finalized verdict on a full replay whose postcondition holds;
|
|
97
|
+
* undefined dispatches the executor — after a miss from the top, after a
|
|
98
|
+
* divergence mid-step with `replayedPrefix` set. Every failure to replay is
|
|
99
|
+
* a miss, never an error; only runtime hard stops propagate.
|
|
94
100
|
*/
|
|
95
101
|
begin(): Promise<StepVerdict | undefined>;
|
|
96
102
|
/**
|
|
@@ -119,6 +125,20 @@ export declare class StepTraceSession {
|
|
|
119
125
|
* degrades to a miss.
|
|
120
126
|
*/
|
|
121
127
|
private readEntry;
|
|
128
|
+
/**
|
|
129
|
+
* The write-side preconditions, captured before any action: the start path,
|
|
130
|
+
* doubling as the replay decision's current path, and the baseline screen
|
|
131
|
+
* when this step may write.
|
|
132
|
+
*/
|
|
133
|
+
private captureStart;
|
|
134
|
+
/**
|
|
135
|
+
* Replays one hit: decides it against the start path, runs the recorded
|
|
136
|
+
* actions, then checks the postcondition. Actions that all ran prove the
|
|
137
|
+
* clicks happened; only the postcondition proves the save took. A flow whose
|
|
138
|
+
* destination changed, or whose effect is not on screen again, hands off
|
|
139
|
+
* like any other divergence.
|
|
140
|
+
*/
|
|
141
|
+
private replayEntry;
|
|
122
142
|
/**
|
|
123
143
|
* The trace's postcondition against the live screen: the recorded end path
|
|
124
144
|
* (pathname only, when the live location is known, and up to the ids the
|
|
@@ -156,4 +176,12 @@ export declare class StepTraceSession {
|
|
|
156
176
|
private repairedAfterEndMismatch;
|
|
157
177
|
private missed;
|
|
158
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* The recorded verdict alone, for the ledger later steps read: how the step
|
|
181
|
+
* was served is the report's business, not context a model should reason
|
|
182
|
+
* about, and the notice would spend handoff bytes on every replayed step.
|
|
183
|
+
* Built from the two constants `replaySummary` writes with, so the two cannot
|
|
184
|
+
* drift apart; a summary not written by it is returned as is.
|
|
185
|
+
*/
|
|
186
|
+
export declare function recordedVerdictOf(summary: string): string;
|
|
159
187
|
//# sourceMappingURL=step-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-cache.d.ts","sourceRoot":"","sources":["../../src/agent/step-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAW7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,WAAW,CAAC,WAAW,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"step-cache.d.ts","sourceRoot":"","sources":["../../src/agent/step-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG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;;OAMG;YACW,WAAW;IA0BzB;;;;OAIG;YACW,eAAe;IAK7B,iGAAiG;YACnF,WAAW;IAkBzB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,OAAO;IAgBf;;;;;;;;;;;;;;;;OAgBG;YACW,KAAK;IA6BnB;;;;OAIG;YACW,KAAK;IAInB,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,MAAM;CAGf;AAyBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIzD"}
|
package/dist/agent/step-cache.js
CHANGED
|
@@ -93,54 +93,36 @@ export class StepTraceSession {
|
|
|
93
93
|
this.recorder?.recordGap(toolName);
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Opens the step:
|
|
97
|
-
* and, when this step may write, the
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* Every failure to replay is
|
|
102
|
-
* propagate.
|
|
96
|
+
* Opens the step: reads the cache entry, captures the write-side
|
|
97
|
+
* preconditions — the start path and, when this step may write, the
|
|
98
|
+
* baseline screen — then attempts a zero-turn replay of a hit. Returns the
|
|
99
|
+
* self-finalized verdict on a full replay whose postcondition holds;
|
|
100
|
+
* undefined dispatches the executor — after a miss from the top, after a
|
|
101
|
+
* divergence mid-step with `replayedPrefix` set. Every failure to replay is
|
|
102
|
+
* a miss, never an error; only runtime hard stops propagate.
|
|
103
103
|
*/
|
|
104
104
|
async begin() {
|
|
105
105
|
this.startedMs = Date.now();
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (!this.cache.replayEligible)
|
|
112
|
-
return undefined;
|
|
113
|
-
const read = await this.readEntry();
|
|
106
|
+
// A retry records like any step but never replays; the report says so
|
|
107
|
+
// instead of looking like a step that ran with caching off.
|
|
108
|
+
const read = this.cache.replayEligible
|
|
109
|
+
? await this.readEntry()
|
|
110
|
+
: { status: 'miss', reason: 'retry' };
|
|
114
111
|
if (read.status === 'miss') {
|
|
112
|
+
await this.captureStart();
|
|
115
113
|
this.info = this.missed(read.reason, 0);
|
|
116
114
|
return undefined;
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// is not on screen again, hands off like any other divergence.
|
|
129
|
-
const stopReason = outcome.completed
|
|
130
|
-
? (await this.endStateMatches(trace))
|
|
131
|
-
? undefined
|
|
132
|
-
: 'end-mismatch'
|
|
133
|
-
: (outcome.stopReason ?? 'action-failed');
|
|
134
|
-
if (stopReason === undefined)
|
|
135
|
-
return this.selfFinalize(trace, outcome);
|
|
136
|
-
if (outcome.executed === 0) {
|
|
137
|
-
// A prefix that performed nothing is a miss with a name, not a hand-off:
|
|
138
|
-
// the executor starts from the top and owes the notice nothing.
|
|
139
|
-
this.info = this.missed(stopReason, outcome.total);
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
this.handOff(outcome, stopReason);
|
|
143
|
-
return undefined;
|
|
116
|
+
// With an entry in hand the step is the cache's from its first moment: the
|
|
117
|
+
// baseline probe doubles as the replay's start-path check, and a step the
|
|
118
|
+
// replay finishes stays the cache's through its verdict and the re-stage,
|
|
119
|
+
// so a reporter never shows a model turn that is not coming. Only a replay
|
|
120
|
+
// that cannot finish the step hands it to the model.
|
|
121
|
+
this.host.replaying(true);
|
|
122
|
+
const verdict = await this.replayEntry(read.entry);
|
|
123
|
+
if (verdict === undefined)
|
|
124
|
+
this.host.replaying(false);
|
|
125
|
+
return verdict;
|
|
144
126
|
}
|
|
145
127
|
/**
|
|
146
128
|
* Closes the session once the step has settled. The whole write-side
|
|
@@ -200,6 +182,49 @@ export class StepTraceSession {
|
|
|
200
182
|
const entry = readTraceEntry(read.entry);
|
|
201
183
|
return entry === undefined ? { status: 'miss', reason: 'invalid-entry' } : { status: 'hit', entry };
|
|
202
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* The write-side preconditions, captured before any action: the start path,
|
|
187
|
+
* doubling as the replay decision's current path, and the baseline screen
|
|
188
|
+
* when this step may write.
|
|
189
|
+
*/
|
|
190
|
+
async captureStart() {
|
|
191
|
+
if (this.recorder !== undefined)
|
|
192
|
+
this.startNodes = await probeScreen(this.host);
|
|
193
|
+
this.startPath = await this.host.currentPath(this.startNodes);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Replays one hit: decides it against the start path, runs the recorded
|
|
197
|
+
* actions, then checks the postcondition. Actions that all ran prove the
|
|
198
|
+
* clicks happened; only the postcondition proves the save took. A flow whose
|
|
199
|
+
* destination changed, or whose effect is not on screen again, hands off
|
|
200
|
+
* like any other divergence.
|
|
201
|
+
*/
|
|
202
|
+
async replayEntry(entry) {
|
|
203
|
+
await this.captureStart();
|
|
204
|
+
const trace = entry.payload;
|
|
205
|
+
const decision = decideTraceReplay(entry, this.startPath);
|
|
206
|
+
if (decision.action === 'miss') {
|
|
207
|
+
this.info = this.missed(decision.reason, trace.actions.length);
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
const outcome = await replayTrace(this.host, trace);
|
|
211
|
+
this.consumedReplay = true;
|
|
212
|
+
const stopReason = outcome.completed
|
|
213
|
+
? (await this.endStateMatches(trace))
|
|
214
|
+
? undefined
|
|
215
|
+
: 'end-mismatch'
|
|
216
|
+
: (outcome.stopReason ?? 'action-failed');
|
|
217
|
+
if (stopReason === undefined)
|
|
218
|
+
return this.selfFinalize(trace, outcome);
|
|
219
|
+
if (outcome.executed === 0) {
|
|
220
|
+
// A prefix that performed nothing is a miss with a name, not a hand-off:
|
|
221
|
+
// the executor starts from the top and owes the notice nothing.
|
|
222
|
+
this.info = this.missed(stopReason, outcome.total);
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
this.handOff(outcome, stopReason);
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
203
228
|
/**
|
|
204
229
|
* The trace's postcondition against the live screen: the recorded end path
|
|
205
230
|
* (pathname only, when the live location is known, and up to the ids the
|
|
@@ -234,10 +259,7 @@ export class StepTraceSession {
|
|
|
234
259
|
replayedActions: outcome.executed,
|
|
235
260
|
totalActions: outcome.total,
|
|
236
261
|
};
|
|
237
|
-
return {
|
|
238
|
-
status: 'passed',
|
|
239
|
-
summary: `replayed ${outcome.executed} recorded action(s) zero-turn from the trace cache; recorded verdict: ${trace.summary}`,
|
|
240
|
-
};
|
|
262
|
+
return { status: 'passed', summary: replaySummary(outcome.executed, trace.summary) };
|
|
241
263
|
}
|
|
242
264
|
handOff(outcome, stopReason) {
|
|
243
265
|
if (stopReason === 'end-mismatch')
|
|
@@ -335,4 +357,23 @@ async function probeScreen(host) {
|
|
|
335
357
|
return undefined;
|
|
336
358
|
}
|
|
337
359
|
}
|
|
360
|
+
const REPLAY_NOTICE_START = 'replayed ';
|
|
361
|
+
const RECORDED_VERDICT_SEPARATOR = '; recorded verdict: ';
|
|
362
|
+
/** The verdict summary of a step the cache replayed whole: the notice, then the recorded verdict. */
|
|
363
|
+
function replaySummary(executed, recorded) {
|
|
364
|
+
return `${REPLAY_NOTICE_START}${String(executed)} recorded action(s) zero-turn from the trace cache${RECORDED_VERDICT_SEPARATOR}${recorded}`;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The recorded verdict alone, for the ledger later steps read: how the step
|
|
368
|
+
* was served is the report's business, not context a model should reason
|
|
369
|
+
* about, and the notice would spend handoff bytes on every replayed step.
|
|
370
|
+
* Built from the two constants `replaySummary` writes with, so the two cannot
|
|
371
|
+
* drift apart; a summary not written by it is returned as is.
|
|
372
|
+
*/
|
|
373
|
+
export function recordedVerdictOf(summary) {
|
|
374
|
+
if (!summary.startsWith(REPLAY_NOTICE_START))
|
|
375
|
+
return summary;
|
|
376
|
+
const at = summary.indexOf(RECORDED_VERDICT_SEPARATOR);
|
|
377
|
+
return at === -1 ? summary : summary.slice(at + RECORDED_VERDICT_SEPARATOR.length);
|
|
378
|
+
}
|
|
338
379
|
//# sourceMappingURL=step-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-cache.js","sourceRoot":"","sources":["../../src/agent/step-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAqC,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAyC,MAAM,eAAe,CAAC;AACzF,OAAO,EACL,WAAW,EACX,aAAa,GAId,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"step-cache.js","sourceRoot":"","sources":["../../src/agent/step-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAqC,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAyC,MAAM,eAAe,CAAC;AACzF,OAAO,EACL,WAAW,EACX,aAAa,GAId,MAAM,aAAa,CAAC;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EAAE,QAAgB;IACvD,OAAO,GAAG,mBAAmB,GAAG,MAAM,CAAC,QAAQ,CAAC,qDAAqD,0BAA0B,GAAG,QAAQ,EAAE,CAAC;AAC/I,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;QAAE,OAAO,OAAO,CAAC;IAC7D,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvD,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-loop.d.ts","sourceRoot":"","sources":["../../src/agent/tool-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAc,OAAO,EAAE,MAAM,IAAI,CAAC;AAC3E,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAgB,MAAM,YAAY,CAAC;AACtD,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAEzB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-loop.d.ts","sourceRoot":"","sources":["../../src/agent/tool-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAc,OAAO,EAAE,MAAM,IAAI,CAAC;AAC3E,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;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