agentfootprint 9.112.0 → 9.112.2
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 +86 -0
- package/dist/core/Agent.js +25 -19
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/middleware/ledger.js +10 -7
- package/dist/core/agent/middleware/ledger.js.map +1 -1
- package/dist/core/agent/stages/seed.js +34 -10
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +15 -9
- package/dist/esm/core/Agent.js +25 -19
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/middleware/ledger.d.ts +10 -7
- package/dist/esm/core/agent/middleware/ledger.js +10 -7
- package/dist/esm/core/agent/middleware/ledger.js.map +1 -1
- package/dist/esm/core/agent/middleware/types.d.ts +6 -4
- package/dist/esm/core/agent/stages/seed.d.ts +31 -6
- package/dist/esm/core/agent/stages/seed.js +34 -10
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +7 -5
- package/dist/esm/lib/injection-engine/intentScorer.js +15 -4
- package/dist/esm/lib/injection-engine/intentScorer.js.map +1 -1
- package/dist/esm/lib/injection-engine/routingPolicy.d.ts +3 -1
- package/dist/esm/lib/injection-engine/routingPolicy.js +15 -3
- package/dist/esm/lib/injection-engine/routingPolicy.js.map +1 -1
- package/dist/lib/injection-engine/intentScorer.js +15 -4
- package/dist/lib/injection-engine/intentScorer.js.map +1 -1
- package/dist/lib/injection-engine/routingPolicy.js +15 -3
- package/dist/lib/injection-engine/routingPolicy.js.map +1 -1
- package/dist/types/core/Agent.d.ts +15 -9
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/middleware/ledger.d.ts +10 -7
- package/dist/types/core/agent/middleware/ledger.d.ts.map +1 -1
- package/dist/types/core/agent/middleware/types.d.ts +6 -4
- package/dist/types/core/agent/middleware/types.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts +31 -6
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +7 -5
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/intentScorer.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/routingPolicy.d.ts +3 -1
- package/dist/types/lib/injection-engine/routingPolicy.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -24,13 +24,16 @@
|
|
|
24
24
|
* which is not what occurred.
|
|
25
25
|
*
|
|
26
26
|
* This is not a redaction layer, and it is not trying to be one. For the
|
|
27
|
-
* `'input'` phase
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
27
|
+
* `'input'` phase the seed stage commits the transformed message, so the
|
|
28
|
+
* model and the conversation never hold the original — but this row is NOT
|
|
29
|
+
* its only copy: the run's input as passed (`run.entry` payload), a crash
|
|
30
|
+
* checkpoint's `originalInput`, a refused turn's history entry and a paused
|
|
31
|
+
* run's checkpoint (`RunnerPauseOutcome.checkpoint`, which `standingAgent`
|
|
32
|
+
* stores for a paused session) keep it too — the full list, and what an app
|
|
33
|
+
* must redact, is in `./README.md`, the one place it is maintained. An
|
|
34
|
+
* `Agent` exposes no footprintjs redaction policy today, so an app whose
|
|
35
|
+
* threat model says the original must not survive strips `before` /
|
|
36
|
+
* `after` from these rows where it keeps the record.
|
|
34
37
|
*/
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.recordDecisions = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../../src/core/agent/middleware/ledger.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../../src/core/agent/middleware/ledger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 -9,7 +9,8 @@
|
|
|
9
9
|
* • CHART-BUILD-TIME constants (maxIterations, cachingDisabled,
|
|
10
10
|
* toolSchemas) — passed as direct values to the factory.
|
|
11
11
|
* • PER-RUN MUTABLE state (pendingResumeHistory from
|
|
12
|
-
* resumeOnError(), currentRunContext.runId
|
|
12
|
+
* run({ continueFrom }) / resumeOnError(), currentRunContext.runId
|
|
13
|
+
* set per run) —
|
|
13
14
|
* passed as accessor closures over the Agent instance, since
|
|
14
15
|
* these change between consecutive `agent.run()` invocations.
|
|
15
16
|
*
|
|
@@ -114,6 +115,32 @@ function buildSeedStage(deps) {
|
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
117
|
exports.buildSeedStage = buildSeedStage;
|
|
118
|
+
/**
|
|
119
|
+
* The conversation this run starts from, ending in this turn's user entry —
|
|
120
|
+
* the ONE place that entry is written (9.112.2).
|
|
121
|
+
*
|
|
122
|
+
* `message` is what the `'input'` chain let through (the caller's message
|
|
123
|
+
* when there is no chain; on a refusal, the content as it stood when it was
|
|
124
|
+
* refused), so a rewrite — a scrub, a stated quote — is the entry the model
|
|
125
|
+
* reads on a continued turn exactly as on a first one.
|
|
126
|
+
*
|
|
127
|
+
* • fresh run → `[{ user: message }]`
|
|
128
|
+
* • `run({ continueFrom })` → the stored conversation + `{ user: message }`
|
|
129
|
+
* • `resumeOnError` → the stored conversation as-is: its last user entry
|
|
130
|
+
* IS the failing turn's message, and adding it again would ask twice.
|
|
131
|
+
* An empty stored history falls back to the fresh-run entry, as it
|
|
132
|
+
* always did.
|
|
133
|
+
*
|
|
134
|
+
* With no chain, every arm yields the bytes the earlier releases committed.
|
|
135
|
+
*/
|
|
136
|
+
function historyForTurn(resume, message) {
|
|
137
|
+
const entry = { role: 'user', content: message };
|
|
138
|
+
if (resume === undefined)
|
|
139
|
+
return [entry];
|
|
140
|
+
if (resume.appendsUserTurn)
|
|
141
|
+
return [...resume.history, entry];
|
|
142
|
+
return resume.history.length > 0 ? [...resume.history] : [entry];
|
|
143
|
+
}
|
|
117
144
|
/**
|
|
118
145
|
* Initialise every mutable field of `AgentState` from `message` + the run
|
|
119
146
|
* args. Split out so the message the run proceeds with can come either
|
|
@@ -123,15 +150,12 @@ exports.buildSeedStage = buildSeedStage;
|
|
|
123
150
|
function seedFrom(scope, message, deps) {
|
|
124
151
|
const args = scope.$getArgs();
|
|
125
152
|
scope.userMessage = message;
|
|
126
|
-
// If `resumeOnError(...)` set the side channel,
|
|
127
|
-
//
|
|
128
|
-
// the
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
const
|
|
132
|
-
const history = resumeHistory && resumeHistory.length > 0
|
|
133
|
-
? [...resumeHistory]
|
|
134
|
-
: [{ role: 'user', content: message }];
|
|
153
|
+
// If `run({ continueFrom })` or `resumeOnError(...)` set the side channel,
|
|
154
|
+
// restore the stored conversation; this turn's user entry is `message` —
|
|
155
|
+
// the input chain's verdict — on every path (`historyForTurn`). The
|
|
156
|
+
// accessor clears the field, so a later run without a continuation starts
|
|
157
|
+
// fresh.
|
|
158
|
+
const history = historyForTurn(deps.consumePendingResumeHistory(), message);
|
|
135
159
|
scope.history = history;
|
|
136
160
|
// The window's durable companion. Restored whether or not THIS agent is
|
|
137
161
|
// configured to fold: the spans belong to the conversation, not to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAKH,4DAAkE;AAClE,uEAAiE;AAKjE,2DAA4D;AAC5D,uDAA0D;AAC1D,yDAA+D;AA+O/D;;;GAGG;AACH,SAAS,cAAc,CAAC,OAA8B;IACpD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,OAAO,IAAI,OAAO;QAAE,IAAI,OAAO,CAAC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M,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC;QACxE,IAAI,QAAQ,EAAE,YAAY,KAAK,SAAS;YAAE,KAAK,CAAC,oBAAoB,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC/F,CAAC;IAED,IAAA,wBAAS,EAAC,KAAK,EAAE,iCAAiC,EAAE;QAClD,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,OAAO;KACpB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/core/Agent.d.ts
CHANGED
|
@@ -397,9 +397,11 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
397
397
|
* primary → fallback → canned (in order; canned guarantees no-throw).
|
|
398
398
|
*/
|
|
399
399
|
private readonly outputFallbackCfg?;
|
|
400
|
-
/** Side-channel for `resumeOnError(...)` —
|
|
401
|
-
* function restores `scope.history` from this
|
|
402
|
-
*
|
|
400
|
+
/** Side-channel for `run({ continueFrom })` and `resumeOnError(...)` —
|
|
401
|
+
* when set, the seed function restores `scope.history` from this
|
|
402
|
+
* instead of starting fresh, and appends this turn's user entry when
|
|
403
|
+
* `appendsUserTurn` says so. Cleared on first read so subsequent runs
|
|
404
|
+
* start clean. */
|
|
403
405
|
private pendingResumeHistory?;
|
|
404
406
|
/** Retried request's repair state; never inherited by a new human turn. */
|
|
405
407
|
private pendingEvidenceRecovery?;
|
|
@@ -912,11 +914,9 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
912
914
|
* await agent.run({ message: 'Book me a table for two.' });
|
|
913
915
|
* const conversation = agent.checkpoint(); // persist anywhere
|
|
914
916
|
* // …a restart later, on a fresh Agent:
|
|
915
|
-
* await agent.
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
* originalInput: { message: 'Make it three.' },
|
|
919
|
-
* });
|
|
917
|
+
* await agent.run({ message: 'Make it three.', continueFrom: conversation });
|
|
918
|
+
* // `continueFrom` runs the 'input' middleware chain on the new turn; a user
|
|
919
|
+
* // entry appended to `history` by hand and passed to `resumeOnError` skips it.
|
|
920
920
|
* ```
|
|
921
921
|
*/
|
|
922
922
|
checkpoint(): AgentRunCheckpoint | undefined;
|
|
@@ -981,12 +981,18 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
981
981
|
* restores history + folded spans, and adopts the conversation's identity so
|
|
982
982
|
* the continued turn writes its memory where the earlier turns are.
|
|
983
983
|
*
|
|
984
|
-
* `
|
|
984
|
+
* `appendsUserTurn` is the difference between the two callers, and it is the
|
|
985
985
|
* whole difference. Continuing a conversation ADDS this turn's user message
|
|
986
986
|
* to the stored history; resuming after an error does NOT, because there the
|
|
987
987
|
* message is already the last user turn in that history and appending it
|
|
988
988
|
* would ask the same question twice.
|
|
989
989
|
*
|
|
990
|
+
* Only the FLAG is stashed, never the entry (9.112.2). The entry is written
|
|
991
|
+
* by `seed.ts · historyForTurn` from the message the `'input'` middleware
|
|
992
|
+
* chain let through; an entry built here, before that chain has run, is the
|
|
993
|
+
* caller's raw text — which is what a continued turn served the model
|
|
994
|
+
* through 9.112.1, while the record said the rewrite had happened.
|
|
995
|
+
*
|
|
990
996
|
* @internal
|
|
991
997
|
*/
|
|
992
998
|
private applyContinuation;
|
package/dist/esm/core/Agent.js
CHANGED
|
@@ -482,9 +482,11 @@ export class Agent extends RunnerBase {
|
|
|
482
482
|
* primary → fallback → canned (in order; canned guarantees no-throw).
|
|
483
483
|
*/
|
|
484
484
|
outputFallbackCfg;
|
|
485
|
-
/** Side-channel for `resumeOnError(...)` —
|
|
486
|
-
* function restores `scope.history` from this
|
|
487
|
-
*
|
|
485
|
+
/** Side-channel for `run({ continueFrom })` and `resumeOnError(...)` —
|
|
486
|
+
* when set, the seed function restores `scope.history` from this
|
|
487
|
+
* instead of starting fresh, and appends this turn's user entry when
|
|
488
|
+
* `appendsUserTurn` says so. Cleared on first read so subsequent runs
|
|
489
|
+
* start clean. */
|
|
488
490
|
pendingResumeHistory;
|
|
489
491
|
/** Retried request's repair state; never inherited by a new human turn. */
|
|
490
492
|
pendingEvidenceRecovery;
|
|
@@ -1332,11 +1334,12 @@ export class Agent extends RunnerBase {
|
|
|
1332
1334
|
// A conversation handed in continues through the same side channel
|
|
1333
1335
|
// `resumeOnError` uses — one restoration path, so the two doors cannot
|
|
1334
1336
|
// drift about what "continue" means. This turn's message IS appended:
|
|
1335
|
-
// continuing a conversation adds a turn to it.
|
|
1337
|
+
// continuing a conversation adds a turn to it. Seed appends it, AFTER the
|
|
1338
|
+
// input middleware chain, so the entry is the chain's verdict (9.112.2).
|
|
1336
1339
|
let continued;
|
|
1337
1340
|
if (runInput.continueFrom !== undefined) {
|
|
1338
1341
|
continued = validateCheckpoint(runInput.continueFrom);
|
|
1339
|
-
this.applyContinuation(continued, 'Agent.run({ continueFrom })',
|
|
1342
|
+
this.applyContinuation(continued, 'Agent.run({ continueFrom })', true);
|
|
1340
1343
|
}
|
|
1341
1344
|
// Only an EXPLICIT identity is remembered for `checkpoint()`; see the
|
|
1342
1345
|
// field's note. `input.identity` wins over `options.identity` because the
|
|
@@ -1638,7 +1641,7 @@ export class Agent extends RunnerBase {
|
|
|
1638
1641
|
// reads + clears it before scope.history initializes. No message is
|
|
1639
1642
|
// appended — the failing run's message is already the last user turn in
|
|
1640
1643
|
// that history, and adding it again would ask twice.
|
|
1641
|
-
this.applyContinuation(cp, 'Agent.resumeOnError');
|
|
1644
|
+
this.applyContinuation(cp, 'Agent.resumeOnError', false);
|
|
1642
1645
|
return this.run({
|
|
1643
1646
|
message: cp.originalInput.message,
|
|
1644
1647
|
// The conversation's own identity, unless this call named one. Until
|
|
@@ -1881,11 +1884,9 @@ export class Agent extends RunnerBase {
|
|
|
1881
1884
|
* await agent.run({ message: 'Book me a table for two.' });
|
|
1882
1885
|
* const conversation = agent.checkpoint(); // persist anywhere
|
|
1883
1886
|
* // …a restart later, on a fresh Agent:
|
|
1884
|
-
* await agent.
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1887
|
-
* originalInput: { message: 'Make it three.' },
|
|
1888
|
-
* });
|
|
1887
|
+
* await agent.run({ message: 'Make it three.', continueFrom: conversation });
|
|
1888
|
+
* // `continueFrom` runs the 'input' middleware chain on the new turn; a user
|
|
1889
|
+
* // entry appended to `history` by hand and passed to `resumeOnError` skips it.
|
|
1889
1890
|
* ```
|
|
1890
1891
|
*/
|
|
1891
1892
|
checkpoint() {
|
|
@@ -2019,21 +2020,26 @@ export class Agent extends RunnerBase {
|
|
|
2019
2020
|
* restores history + folded spans, and adopts the conversation's identity so
|
|
2020
2021
|
* the continued turn writes its memory where the earlier turns are.
|
|
2021
2022
|
*
|
|
2022
|
-
* `
|
|
2023
|
+
* `appendsUserTurn` is the difference between the two callers, and it is the
|
|
2023
2024
|
* whole difference. Continuing a conversation ADDS this turn's user message
|
|
2024
2025
|
* to the stored history; resuming after an error does NOT, because there the
|
|
2025
2026
|
* message is already the last user turn in that history and appending it
|
|
2026
2027
|
* would ask the same question twice.
|
|
2027
2028
|
*
|
|
2029
|
+
* Only the FLAG is stashed, never the entry (9.112.2). The entry is written
|
|
2030
|
+
* by `seed.ts · historyForTurn` from the message the `'input'` middleware
|
|
2031
|
+
* chain let through; an entry built here, before that chain has run, is the
|
|
2032
|
+
* caller's raw text — which is what a continued turn served the model
|
|
2033
|
+
* through 9.112.1, while the record said the rewrite had happened.
|
|
2034
|
+
*
|
|
2028
2035
|
* @internal
|
|
2029
2036
|
*/
|
|
2030
|
-
applyContinuation(cp, door,
|
|
2037
|
+
applyContinuation(cp, door, appendsUserTurn) {
|
|
2031
2038
|
assertContinuable(cp, this.explicitId, door);
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
: [...history, { role: 'user', content: appendMessage }];
|
|
2039
|
+
this.pendingResumeHistory = {
|
|
2040
|
+
history: cp.history,
|
|
2041
|
+
appendsUserTurn,
|
|
2042
|
+
};
|
|
2037
2043
|
// The folded spans beside it. A conversation stored before 8.2 has none,
|
|
2038
2044
|
// and `undefined` is the right answer there — it means "this conversation
|
|
2039
2045
|
// recorded no folds", which is exactly true.
|
|
@@ -2052,7 +2058,7 @@ export class Agent extends RunnerBase {
|
|
|
2052
2058
|
// Same failed request retains its single repair budget. A new user turn
|
|
2053
2059
|
// receives neither the rejected draft nor a spent retry allowance.
|
|
2054
2060
|
this.pendingEvidenceRecovery =
|
|
2055
|
-
|
|
2061
|
+
!appendsUserTurn && cp.evidenceRecovery !== undefined
|
|
2056
2062
|
? structuredClone(cp.evidenceRecovery)
|
|
2057
2063
|
: undefined;
|
|
2058
2064
|
}
|