agentfootprint 9.46.3 → 9.47.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/CLAUDE.md +39 -0
- package/dist/adapters/code/agentcore.js +35 -7
- package/dist/adapters/code/agentcore.js.map +1 -1
- package/dist/adapters/code/local.js +94 -10
- package/dist/adapters/code/local.js.map +1 -1
- package/dist/core/Agent.js +4 -0
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/checkin.js +16 -2
- package/dist/core/checkin.js.map +1 -1
- package/dist/core/pause.js +64 -1
- package/dist/core/pause.js.map +1 -1
- package/dist/esm/adapters/code/agentcore.js +35 -7
- package/dist/esm/adapters/code/agentcore.js.map +1 -1
- package/dist/esm/adapters/code/local.js +94 -10
- package/dist/esm/adapters/code/local.js.map +1 -1
- package/dist/esm/core/Agent.js +5 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/checkin.d.ts +58 -0
- package/dist/esm/core/checkin.js +16 -2
- package/dist/esm/core/checkin.js.map +1 -1
- package/dist/esm/core/pause.d.ts +44 -0
- package/dist/esm/core/pause.js +61 -0
- package/dist/esm/core/pause.js.map +1 -1
- package/dist/esm/hosting/conformance/cases.js +23 -4
- package/dist/esm/hosting/conformance/cases.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/hosting/conformance/cases.js +23 -4
- package/dist/hosting/conformance/cases.js.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/types/adapters/code/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/code/local.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/checkin.d.ts +58 -0
- package/dist/types/core/checkin.d.ts.map +1 -1
- package/dist/types/core/pause.d.ts +44 -0
- package/dist/types/core/pause.d.ts.map +1 -1
- package/dist/types/hosting/conformance/cases.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/CLAUDE.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
|
|
4
4
|
Agent framework layered on footprintjs: every runner (Agent, LLMCall, compositions, patterns) is a footprintjs chart built ONCE at construction and executed on a fresh `FlowChartExecutor` per run. Engine seams (stage kinds, $-methods, engine handlers) live UPSTREAM in footprintjs and are closed here. This file maps this repo's seams and blast radius — **trust the code** where any doc disagrees.
|
|
5
5
|
|
|
6
|
+
## Before you design it: it may already exist
|
|
7
|
+
|
|
8
|
+
**Read this table before proposing any new capability.** Everything below already
|
|
9
|
+
ships. The failure it exists to stop is real and expensive: a reader searches for
|
|
10
|
+
the words THEY would use, finds nothing, and designs a feature the library has had
|
|
11
|
+
for releases. That has happened repeatedly — the typed-HITL ask, element bindings
|
|
12
|
+
by role and name, and the artifact-kind renderer were each re-proposed after they
|
|
13
|
+
shipped.
|
|
14
|
+
|
|
15
|
+
Keyed by **what you would call it**, not by what it is called here. If your idea is
|
|
16
|
+
not in this table, search `src/index.ts` for the nearest noun before writing code.
|
|
17
|
+
|
|
18
|
+
| If you are about to build… | It is | Where | Since |
|
|
19
|
+
|---|---|---|---|
|
|
20
|
+
| a typed HITL prompt — let a person pick from a list, choose a range, use a real control instead of typing prose | `AskComponent` | `src/core/askComponent.ts` | 9.24.0 |
|
|
21
|
+
| carrying WHAT the person chose back, with what they could see | `DecisionValue` | `src/core/checkin.ts` | 9.47.0 |
|
|
22
|
+
| keeping a large tool result out of the model's context | `artifacts` + `wants` + `placement` | `src/artifacts/` | 9.21.0 |
|
|
23
|
+
| letting the UI draw an artifact without the model naming a component | `registerArtifactComponent` (in the `agentfootprint-lens` package) | — | — |
|
|
24
|
+
| finding which tools the model keeps writing by hand | `agentfootprint.tools.code_run` + `codeShape` | `src/core/codeRunnerTool.ts` | 9.46.0 |
|
|
25
|
+
| a tool answering "I looked and found nothing", routably | `absent` | `src/core/agent/coverage/absent.ts` | 9.43.0 |
|
|
26
|
+
| stating what a clean answer does NOT rule out | `coverage` | `src/core/agent/coverage/ledger.ts` | 9.43.0 |
|
|
27
|
+
| proving a session store really honours the port | `runSessionLifecycleConformance` | `src/hosting/conformance/` | 9.37.0 |
|
|
28
|
+
| deciding who owns a contested session write | `resolveSessionOwner` | `src/hosting/sessionOwnership.ts` | 9.37.0 |
|
|
29
|
+
| making a caller-supplied id safe for a backend | `encodeIdentityField` | `src/memory/identity/encode.ts` | 9.40.0 |
|
|
30
|
+
| scoping a skill's tools so they reach the model only while it is active | `toolsFromActiveSkill` | `src/core/agent/toolsFromActiveSkill.ts` | 9.43.0 |
|
|
31
|
+
| subscribing to every event in one domain at once | `DomainWildcard` | `src/events/dispatcher.ts` | 9.4.0 |
|
|
32
|
+
| pausing a run for a person and resuming it later | `checkInApproved` / `checkInDeclined` | `src/core/checkin.ts` | 9.24.0 |
|
|
33
|
+
|
|
34
|
+
**One law before you add a mapping.** Any function turning caller data into a KEY,
|
|
35
|
+
a namespace, a filename or an index entry must be injective, and its collision
|
|
36
|
+
check ships in the SAME change — not the release that discovers it. Six defects of
|
|
37
|
+
that exact shape were fixed between 9.37.0 and 9.46.0. Use `encodeIdentityField`
|
|
38
|
+
rather than writing a seventh.
|
|
39
|
+
|
|
40
|
+
**Maintaining this table:** a new public capability adds a row.
|
|
41
|
+
`test/docs/capability-index.test.ts` fails if a row names a file or symbol that
|
|
42
|
+
does not exist, so the table can go out of date by OMISSION but can never lie
|
|
43
|
+
about what it names.
|
|
44
|
+
|
|
6
45
|
## Module map
|
|
7
46
|
Entry points — THIRTEEN doors, and `package.json` `exports` is exhaustive, so a path not on this list does not resolve at all: `.` core API · `/providers` everything you plug a backend into (mock/anthropic/openai/bedrock/browser*, embedders, staticTools/gatedTools/skillScopedTools/mcpClient, thinking handlers, code runners) · `/memory` (defineMemory, MEMORY_TYPES, InMemoryStore, mockEmbedder, redis/agentcore/bedrockAgentMemory stores) · `/rag` index-time loaders/splitters/indexCorpus · `/cache` prompt caching (+ registerCacheStrategy; side-effectful, hence its own door) · `/observe` the whole watching story (recorders, recordRun, strategies + attach*, vendor sinks, run-autopsy finders, toSSE, status, locales) · `/events` typed event system · `/context` the injection engine (defineInjection/Skill/Fact/Instruction/Steering, decideSkill) · `/resilience` provider decorators + the reliability RULES · `/hosting` nodeHost/httpHost/standingAgent + session stores · `/security` permissions + tool credentials (it absorbed the old identity door) · `/reliability` the retained alias, kept ONLY because it is the sole home of the gate's `CircuitOpenError` · `/skill-graph` the framework-neutral routing layer. 9.0.0 removed sixteen older paths (`/llm-providers`, `/injection-engine`, `/tool-providers`, `/strategies`, `/observability-providers`, `/identity`, `/stream`, `/thinking`, `/status`, `/locales`, `/debug`, `/debug/finders`, `/memory-providers`, `/embedders`, `/hosting-providers`, `/observability/contextError/finders`) — it removed PATHS, not code; each name still ships through the door that absorbed it. This list is pinned against `package.json` by test/api-conformance/documented-doors.test.ts, and the removed sixteen by subpath-exports.test.ts. **Main barrel does NOT export** mock/browser*/defineMemory/defineSkill/skillGraph/mcpClient/InMemoryStore — import from the doors above.
|
|
8
47
|
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
*/
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
62
|
exports.agentCoreCodeRunner = void 0;
|
|
63
|
+
const toolSessions_js_1 = require("../../core/toolSessions.js");
|
|
63
64
|
const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
|
|
64
65
|
const DEFAULT_MAX_OUTPUT_CHARS = 8_000;
|
|
65
66
|
/** The service's own name for "run this code". Not a name we chose. */
|
|
@@ -78,10 +79,10 @@ function agentCoreCodeRunner(options) {
|
|
|
78
79
|
const api = resolve();
|
|
79
80
|
const started = await api.startSession({
|
|
80
81
|
codeInterpreterIdentifier: options.identifier,
|
|
81
|
-
// The isolation key
|
|
82
|
-
// reading the console sees the same partition the runtime
|
|
83
|
-
//
|
|
84
|
-
//
|
|
82
|
+
// The DIGEST of the isolation key labels the session on AWS's side, so
|
|
83
|
+
// an operator reading the console sees the same partition the runtime
|
|
84
|
+
// enforces — and sees it under the same digest the trace publishes.
|
|
85
|
+
// The key itself never leaves this process; see `sessionName`.
|
|
85
86
|
name: sessionName(req.key),
|
|
86
87
|
...(options.sessionTimeoutSeconds !== undefined && {
|
|
87
88
|
sessionTimeoutSeconds: options.sessionTimeoutSeconds,
|
|
@@ -153,10 +154,37 @@ function agentCoreCodeRunner(options) {
|
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
156
|
exports.agentCoreCodeRunner = agentCoreCodeRunner;
|
|
156
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* A label for the remote session — derived FROM the isolation key, carrying
|
|
159
|
+
* none of it.
|
|
160
|
+
*
|
|
161
|
+
* **Why not the key itself.** The isolation key is
|
|
162
|
+
* `t=<tenant>/p=<principal>/s=<sessionId>` (see `toolSessionKey`), so it holds
|
|
163
|
+
* a tenant name, a principal and the hosting session id. The previous version
|
|
164
|
+
* of this function folded that string's illegal characters to `-` and sent the
|
|
165
|
+
* result to AWS as `StartCodeInterpreterSession`'s `name` — which put
|
|
166
|
+
* `af-t-acme-p-alice-s-s1` into a vendor control plane, its console, and its
|
|
167
|
+
* audit log, for every session opened. One module over,
|
|
168
|
+
* {@link hashSessionKey} exists precisely so the same identifiers never reach
|
|
169
|
+
* the event wire ("enough to JOIN two rows and not enough to name whose they
|
|
170
|
+
* are"). Two opposite decisions about one string; this is the one that agrees
|
|
171
|
+
* with the rest of the library.
|
|
172
|
+
*
|
|
173
|
+
* **What it buys beyond not leaking.** The label is now byte-identical to the
|
|
174
|
+
* `keyHash` on `agentfootprint.tools.session_closed`, so an operator with a
|
|
175
|
+
* session in the AWS console can actually FIND its rows in the trace. The fold
|
|
176
|
+
* could not do that: `alice:1` and `alice-1` produced one label, and any key
|
|
177
|
+
* over 100 characters was truncated onto its neighbours, so the console name
|
|
178
|
+
* an operator read did not identify one partition.
|
|
179
|
+
*
|
|
180
|
+
* **Not an address.** AWS documents `name` as a non-unique friendly handle;
|
|
181
|
+
* nothing — here or in the SDK — ever looks a session up by it. The address is
|
|
182
|
+
* the service-assigned `sessionId`, which `start()` reads back and passes to
|
|
183
|
+
* every `Invoke` and `Stop` verbatim. So no stored state is keyed on this
|
|
184
|
+
* string and relabelling migrates nothing.
|
|
185
|
+
*/
|
|
157
186
|
function sessionName(key) {
|
|
158
|
-
|
|
159
|
-
return `af-${key.replace(/[^A-Za-z0-9_-]/g, '-')}`.slice(0, 100);
|
|
187
|
+
return `af-${(0, toolSessions_js_1.hashSessionKey)(key)}`;
|
|
160
188
|
}
|
|
161
189
|
function isAlreadyGone(err) {
|
|
162
190
|
const name = err instanceof Error ? err.name : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentcore.js","sourceRoot":"","sources":["../../../src/adapters/code/agentcore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;;;AAGH,6DAAuD;AAuEvD,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,uEAAuE;AACvE,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,SAAgB,mBAAmB,CAAC,OAAmC;IACrE,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,uBAAuB,CAAC;IACjD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,wBAAwB,CAAC;IAC1E,IAAI,MAA2C,CAAC;IAChD,MAAM,OAAO,GAAG,GAA4B,EAAE;QAC5C,MAAM,KAAK,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO;QACL,EAAE;QACF,KAAK,CAAC,KAAK,CAAC,GAAG;YACb,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;YACtB,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,YAAY,CA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ACH,CAAC;IACH,CAAC;IACD,OAAO;QACL,MAAM;QACN,MAAM;QACN,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC3C,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC;KAC5B,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,SAAS,GAAG,CAAC,IAAY,EAAE,GAAW;IACpC,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACpD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -162,9 +162,10 @@ function localCodeRunner(options = {}) {
|
|
|
162
162
|
stagingDir ??= makeStagingDir(fs, options._stagingRoot);
|
|
163
163
|
for (const input of inputs) {
|
|
164
164
|
// The name is CALLER data landing in a filesystem, so it is
|
|
165
|
-
//
|
|
166
|
-
// name of '../../etc/passwd' becomes a literal file name,
|
|
167
|
-
//
|
|
165
|
+
// ENCODED into a single inert segment here rather than trusted: a
|
|
166
|
+
// name of '../../etc/passwd' becomes a literal file name, two
|
|
167
|
+
// distinct names never become one file, and the manifest still
|
|
168
|
+
// keys it by what was asked for.
|
|
168
169
|
const fileName = safeFileName(input.fileName ?? input.name);
|
|
169
170
|
const path = `${stagingDir}/${fileName}`;
|
|
170
171
|
const bytes = typeof input.data === 'string'
|
|
@@ -232,17 +233,100 @@ function writeFile(fs, path, data) {
|
|
|
232
233
|
}
|
|
233
234
|
writeFileSync(path, data);
|
|
234
235
|
}
|
|
236
|
+
/** Longest file name this adapter will write. Well inside every POSIX
|
|
237
|
+
* `NAME_MAX`, and the cap this adapter has always used. */
|
|
238
|
+
const FILE_NAME_MAX = 120;
|
|
239
|
+
/** Marks a name this adapter had to rewrite. Nothing arm A returns may start
|
|
240
|
+
* with it. */
|
|
241
|
+
const ENCODED_FILE_PREFIX = '_enc_';
|
|
242
|
+
/** Already one inert segment: no separator, no escape-looking bytes. */
|
|
243
|
+
const FILE_NAME_ALREADY_LEGAL = /^[A-Za-z0-9._-]+$/;
|
|
244
|
+
/** `.`, `..`, `...` — a name that is nothing but dots. Not a hop once the
|
|
245
|
+
* separators are gone, but not a name either, so it goes to arm B. */
|
|
246
|
+
const DOTS_ONLY = /^\.+$/;
|
|
247
|
+
/** Legal AND not the escape character — the set {@link encodeFileName} passes
|
|
248
|
+
* through untouched. */
|
|
249
|
+
const FILE_CHAR_PASSES_THROUGH = /[A-Za-z0-9.-]/;
|
|
235
250
|
/**
|
|
236
|
-
* One caller-supplied name → one inert file-name segment
|
|
251
|
+
* One caller-supplied name → one inert file-name segment, **without ever
|
|
252
|
+
* folding two names into one file**.
|
|
237
253
|
*
|
|
238
|
-
* Separators
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
254
|
+
* Separators cannot survive as a parent hop and `a/b` cannot become two
|
|
255
|
+
* segments — the same law `artifacts/scopePath` states for scope tuples,
|
|
256
|
+
* applied to the one other place caller strings become file names in this
|
|
257
|
+
* package. But the old version got there by REPLACING every illegal character
|
|
258
|
+
* with `_`, which meant `a/b.csv` and `a_b.csv` became the same file: the
|
|
259
|
+
* second write clobbered the first's bytes, `stageInputs` answered two manifest
|
|
260
|
+
* entries pointing at one path, and the model's code opened `a/b.csv` and read
|
|
261
|
+
* whatever `a_b.csv` contained. Nothing failed. The computation was simply run
|
|
262
|
+
* against the wrong dataset — which is the worst shape a data bug can take,
|
|
263
|
+
* because the answer still looks like an answer. `.slice(0, 120)` folded the
|
|
264
|
+
* same way for any two names agreeing on their first 120 characters.
|
|
265
|
+
*
|
|
266
|
+
* So this ENCODES instead of sanitising, in two arms whose outputs cannot meet
|
|
267
|
+
* (the shape `safeSessionId` uses in `adapters/hosting/agentcore.ts`):
|
|
268
|
+
*
|
|
269
|
+
* A. already one legal segment, not claiming to be an encoded name, and not
|
|
270
|
+
* dots-only → returned BYTE FOR BYTE. This is what keeps the fix from
|
|
271
|
+
* renaming anything that works today: `dataset.json`, `a_b.json`, every
|
|
272
|
+
* name `codeRunnerTool` derives from a declared argument, all land at
|
|
273
|
+
* exactly the path they landed at before.
|
|
274
|
+
* B. anything else → `_enc_` + an escaped form, where `_` is the escape
|
|
275
|
+
* character (`_` → `__`, any other illegal UTF-16 unit → `_uXXXX`). A
|
|
276
|
+
* decoder is a left inverse of that, which is what makes it injective.
|
|
277
|
+
*
|
|
278
|
+
* Arm A never starts with `_enc_` (excluded by construction) and every arm B
|
|
279
|
+
* output does, so no name from one arm can collide with a name from the other.
|
|
280
|
+
* Both arms produce ASCII with no `/`, no `\` and no NUL, so the path-hop law
|
|
281
|
+
* the old version enforced is unchanged.
|
|
242
282
|
*/
|
|
243
283
|
function safeFileName(raw) {
|
|
244
|
-
|
|
245
|
-
|
|
284
|
+
if (raw.length <= FILE_NAME_MAX &&
|
|
285
|
+
FILE_NAME_ALREADY_LEGAL.test(raw) &&
|
|
286
|
+
!raw.startsWith(ENCODED_FILE_PREFIX) &&
|
|
287
|
+
!DOTS_ONLY.test(raw)) {
|
|
288
|
+
return raw;
|
|
289
|
+
}
|
|
290
|
+
const encoded = ENCODED_FILE_PREFIX + encodeFileName(raw);
|
|
291
|
+
// Strictly less, so the two shapes below are told apart by LENGTH alone: a
|
|
292
|
+
// digested name is always exactly FILE_NAME_MAX and an escaped one never is.
|
|
293
|
+
if (encoded.length < FILE_NAME_MAX)
|
|
294
|
+
return encoded;
|
|
295
|
+
// Past the cap no mapping can stay injective — there are more names than
|
|
296
|
+
// there are file names — so the tail becomes a digest of the WHOLE raw name.
|
|
297
|
+
// SHA-256 rather than the package's 32-bit FNV-1a: a name reaching this
|
|
298
|
+
// adapter is caller data, and a 32-bit digest is a collision somebody can go
|
|
299
|
+
// and find, which for a file the model then reads as data is the same defect
|
|
300
|
+
// this function exists to close.
|
|
301
|
+
const digest = sha256Hex(raw).slice(0, 32);
|
|
302
|
+
return `${encoded.slice(0, FILE_NAME_MAX - digest.length - 2)}_z${digest}`;
|
|
303
|
+
}
|
|
304
|
+
/** `_` → `__`, anything else illegal → `_uXXXX`. Injective by construction. */
|
|
305
|
+
function encodeFileName(raw) {
|
|
306
|
+
let out = '';
|
|
307
|
+
for (let i = 0; i < raw.length; i++) {
|
|
308
|
+
const ch = raw[i];
|
|
309
|
+
if (ch === '_')
|
|
310
|
+
out += '__';
|
|
311
|
+
else if (FILE_CHAR_PASSES_THROUGH.test(ch))
|
|
312
|
+
out += ch;
|
|
313
|
+
else
|
|
314
|
+
out += `_u${raw.charCodeAt(i).toString(16).padStart(4, '0')}`;
|
|
315
|
+
}
|
|
316
|
+
return out;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* SHA-256, hex.
|
|
320
|
+
*
|
|
321
|
+
* `node:crypto` rather than a fallback: this is only ever reached from
|
|
322
|
+
* `stageInputs`, which has already required `node:fs` and written to a
|
|
323
|
+
* temp directory. A runtime with a filesystem but no crypto is not a shape
|
|
324
|
+
* this adapter can be in, and pretending otherwise with a weaker digest would
|
|
325
|
+
* quietly widen the very collision the digest is here to close.
|
|
326
|
+
*/
|
|
327
|
+
function sha256Hex(text) {
|
|
328
|
+
const crypto = (0, lazyRequire_js_1.lazyRequire)('node:crypto');
|
|
329
|
+
return crypto.createHash('sha256').update(text, 'utf8').digest('hex');
|
|
246
330
|
}
|
|
247
331
|
function resolveChildProcess(options) {
|
|
248
332
|
if (options._childProcess)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../src/adapters/code/local.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;;;AAGH,0CAAgD;AAChD,6DAAuD;AA0EvD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,wB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AAC;YACD,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;gBAC1B,MAAM,CACJ,IAAI,KAAK,CACP,mDAAmD,IAAI,CAAC,SAAS,aAAa;oBAC5E,2EAA2E,CAC9E,CACF,CAAC;gBACF,OAAO;YACT,CAAC;YACD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACnC,qEAAqE;gBACrE,wDAAwD;gBACxD,MAAM,CACJ,IAAI,KAAK,CACP,mCAAmC,IAAI,MAAM,KAAK,CAAC,IAAI,KAAK;oBAC1D,6DAA6D,CAChE,CACF,CAAC;gBACF,OAAO;YACT,CAAC;YACD,qEAAqE;YACrE,OAAO,CAAC;gBACN,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO;gBAC7C,QAAQ,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAC1D,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,SAAS,GAAG,CAAC,IAAY,EAAE,GAAW;IACpC,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACpD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/core/Agent.js
CHANGED
|
@@ -1394,6 +1394,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
1394
1394
|
const gate = (0, pause_js_1.pauseDemandsDecision)(checkpoint.pauseData);
|
|
1395
1395
|
if (gate && !(0, checkin_js_1.isCheckInDecision)(input))
|
|
1396
1396
|
throw new pause_js_1.DecisionRequiredError(gate, input);
|
|
1397
|
+
// And the answer must be about the thing that was asked. Checked HERE, at
|
|
1398
|
+
// the same door and before any state moves, because a resume that has begun
|
|
1399
|
+
// is a resume that has already used the value.
|
|
1400
|
+
(0, pause_js_1.assertDecisionIsNotStale)(checkpoint.pauseData, input);
|
|
1397
1401
|
// The same one-turn-at-a-time guard `run()` carries: a resume writes the
|
|
1398
1402
|
// same per-instance state a run does. Answering the question is what this
|
|
1399
1403
|
// door is FOR, so it never checks `pendingQuestion` — it clears it.
|