agentfootprint 9.96.1 → 9.98.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 +77 -0
- package/dist/artifacts/datasetResult.js +119 -0
- package/dist/artifacts/datasetResult.js.map +1 -0
- package/dist/artifacts/index.js +4 -1
- package/dist/artifacts/index.js.map +1 -1
- package/dist/core/Agent.js +43 -6
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/RunnerBase.js +10 -0
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +22 -3
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/inputRequest.js +202 -0
- package/dist/core/inputRequest.js.map +1 -0
- package/dist/core/pause.js +17 -1
- package/dist/core/pause.js.map +1 -1
- package/dist/core/toolSessions.js +10 -8
- package/dist/core/toolSessions.js.map +1 -1
- package/dist/esm/artifacts/datasetResult.d.ts +44 -0
- package/dist/esm/artifacts/datasetResult.js +114 -0
- package/dist/esm/artifacts/datasetResult.js.map +1 -0
- package/dist/esm/artifacts/index.d.ts +1 -0
- package/dist/esm/artifacts/index.js +1 -0
- package/dist/esm/artifacts/index.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +2 -2
- package/dist/esm/core/Agent.js +43 -6
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +7 -0
- package/dist/esm/core/RunnerBase.js +10 -0
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +1 -0
- package/dist/esm/core/agent/stages/toolCalls.js +22 -3
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/inputRequest.d.ts +62 -0
- package/dist/esm/core/inputRequest.js +194 -0
- package/dist/esm/core/inputRequest.js.map +1 -0
- package/dist/esm/core/pause.d.ts +9 -0
- package/dist/esm/core/pause.js +14 -0
- package/dist/esm/core/pause.js.map +1 -1
- package/dist/esm/core/toolSessions.d.ts +10 -7
- package/dist/esm/core/toolSessions.js +10 -8
- package/dist/esm/core/toolSessions.js.map +1 -1
- package/dist/esm/hosting/httpHost.js +7 -2
- package/dist/esm/hosting/httpHost.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +1 -1
- package/dist/esm/hosting/index.js +1 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/ingressRecord.js +8 -3
- package/dist/esm/hosting/ingressRecord.js.map +1 -1
- package/dist/esm/hosting/sessionWire.d.ts +7 -0
- package/dist/esm/hosting/sessionWire.js +6 -3
- package/dist/esm/hosting/sessionWire.js.map +1 -1
- package/dist/esm/hosting/standingAgent.js +70 -4
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +3 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/hosting/wireOps.d.ts +2 -0
- package/dist/esm/hosting/wireOps.js +4 -1
- package/dist/esm/hosting/wireOps.js.map +1 -1
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integrity/assertion/conflicts.d.ts +5 -32
- package/dist/esm/integrity/assertion/conflicts.js +6 -69
- package/dist/esm/integrity/assertion/conflicts.js.map +1 -1
- package/dist/esm/integrity/assertion/types.d.ts +8 -69
- package/dist/esm/integrity/assertion/types.js +0 -0
- package/dist/esm/integrity/assertion/types.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineMenuHint.js +3 -5
- package/dist/esm/lib/injection-engine/factories/defineMenuHint.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillToolDescriptors.d.ts +4 -2
- package/dist/esm/lib/injection-engine/skillToolDescriptors.js +17 -8
- package/dist/esm/lib/injection-engine/skillToolDescriptors.js.map +1 -1
- package/dist/esm/lib/mcp/mcpClient.js +5 -97
- package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/mockMcpClient.d.ts +8 -4
- package/dist/esm/lib/mcp/mockMcpClient.js +6 -5
- package/dist/esm/lib/mcp/mockMcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/toolResult.d.ts +8 -0
- package/dist/esm/lib/mcp/toolResult.js +244 -0
- package/dist/esm/lib/mcp/toolResult.js.map +1 -0
- package/dist/esm/lib/mcp/types.d.ts +15 -0
- package/dist/esm/lib/semantics/check.d.ts +7 -1
- package/dist/esm/lib/semantics/check.js +16 -0
- package/dist/esm/lib/semantics/check.js.map +1 -1
- package/dist/esm/lib/semantics/cli.js +3 -0
- package/dist/esm/lib/semantics/cli.js.map +1 -1
- package/dist/esm/lib/semantics/projection.d.ts +15 -0
- package/dist/esm/lib/semantics/projection.js +186 -0
- package/dist/esm/lib/semantics/projection.js.map +1 -0
- package/dist/esm/lib/time-travel/index.d.ts +1 -1
- package/dist/esm/lib/time-travel/index.js.map +1 -1
- package/dist/esm/lib/time-travel/receipt.d.ts +5 -0
- package/dist/esm/lib/time-travel/receipt.js +2 -0
- package/dist/esm/lib/time-travel/receipt.js.map +1 -1
- package/dist/esm/lib/time-travel/requestMeasurement.d.ts +33 -0
- package/dist/esm/lib/time-travel/requestMeasurement.js +120 -0
- package/dist/esm/lib/time-travel/requestMeasurement.js.map +1 -0
- package/dist/esm/lib/time-travel/servedView.js +8 -1
- package/dist/esm/lib/time-travel/servedView.js.map +1 -1
- package/dist/hosting/httpHost.js +6 -1
- package/dist/hosting/httpHost.js.map +1 -1
- package/dist/hosting/index.js +2 -1
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/ingressRecord.js +7 -2
- package/dist/hosting/ingressRecord.js.map +1 -1
- package/dist/hosting/sessionWire.js +7 -4
- package/dist/hosting/sessionWire.js.map +1 -1
- package/dist/hosting/standingAgent.js +69 -3
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/hosting/wireOps.js +4 -1
- package/dist/hosting/wireOps.js.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/integrity/assertion/conflicts.js +6 -69
- package/dist/integrity/assertion/conflicts.js.map +1 -1
- package/dist/integrity/assertion/types.js +0 -0
- package/dist/integrity/assertion/types.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineMenuHint.js +3 -5
- package/dist/lib/injection-engine/factories/defineMenuHint.js.map +1 -1
- package/dist/lib/injection-engine/skillToolDescriptors.js +17 -8
- package/dist/lib/injection-engine/skillToolDescriptors.js.map +1 -1
- package/dist/lib/mcp/mcpClient.js +5 -97
- package/dist/lib/mcp/mcpClient.js.map +1 -1
- package/dist/lib/mcp/mockMcpClient.js +6 -5
- package/dist/lib/mcp/mockMcpClient.js.map +1 -1
- package/dist/lib/mcp/toolResult.js +249 -0
- package/dist/lib/mcp/toolResult.js.map +1 -0
- package/dist/lib/semantics/check.js +16 -0
- package/dist/lib/semantics/check.js.map +1 -1
- package/dist/lib/semantics/cli.js +3 -0
- package/dist/lib/semantics/cli.js.map +1 -1
- package/dist/lib/semantics/projection.js +191 -0
- package/dist/lib/semantics/projection.js.map +1 -0
- package/dist/lib/time-travel/index.js.map +1 -1
- package/dist/lib/time-travel/receipt.js +2 -0
- package/dist/lib/time-travel/receipt.js.map +1 -1
- package/dist/lib/time-travel/requestMeasurement.js +124 -0
- package/dist/lib/time-travel/requestMeasurement.js.map +1 -0
- package/dist/lib/time-travel/servedView.js +8 -1
- package/dist/lib/time-travel/servedView.js.map +1 -1
- package/dist/types/artifacts/datasetResult.d.ts +45 -0
- package/dist/types/artifacts/datasetResult.d.ts.map +1 -0
- package/dist/types/artifacts/index.d.ts +1 -0
- package/dist/types/artifacts/index.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +2 -2
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +7 -0
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +1 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/inputRequest.d.ts +63 -0
- package/dist/types/core/inputRequest.d.ts.map +1 -0
- package/dist/types/core/pause.d.ts +9 -0
- package/dist/types/core/pause.d.ts.map +1 -1
- package/dist/types/core/toolSessions.d.ts +10 -7
- package/dist/types/core/toolSessions.d.ts.map +1 -1
- package/dist/types/hosting/httpHost.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +1 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/ingressRecord.d.ts.map +1 -1
- package/dist/types/hosting/sessionWire.d.ts +7 -0
- package/dist/types/hosting/sessionWire.d.ts.map +1 -1
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +3 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/hosting/wireOps.d.ts +2 -0
- package/dist/types/hosting/wireOps.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrity/assertion/conflicts.d.ts +5 -32
- package/dist/types/integrity/assertion/conflicts.d.ts.map +1 -1
- package/dist/types/integrity/assertion/types.d.ts +8 -69
- package/dist/types/integrity/assertion/types.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineMenuHint.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillToolDescriptors.d.ts +4 -2
- package/dist/types/lib/injection-engine/skillToolDescriptors.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/lib/mcp/mockMcpClient.d.ts +8 -4
- package/dist/types/lib/mcp/mockMcpClient.d.ts.map +1 -1
- package/dist/types/lib/mcp/toolResult.d.ts +9 -0
- package/dist/types/lib/mcp/toolResult.d.ts.map +1 -0
- package/dist/types/lib/mcp/types.d.ts +15 -0
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/dist/types/lib/semantics/check.d.ts +7 -1
- package/dist/types/lib/semantics/check.d.ts.map +1 -1
- package/dist/types/lib/semantics/cli.d.ts.map +1 -1
- package/dist/types/lib/semantics/projection.d.ts +16 -0
- package/dist/types/lib/semantics/projection.d.ts.map +1 -0
- package/dist/types/lib/time-travel/index.d.ts +1 -1
- package/dist/types/lib/time-travel/index.d.ts.map +1 -1
- package/dist/types/lib/time-travel/receipt.d.ts +5 -0
- package/dist/types/lib/time-travel/receipt.d.ts.map +1 -1
- package/dist/types/lib/time-travel/requestMeasurement.d.ts +34 -0
- package/dist/types/lib/time-travel/requestMeasurement.d.ts.map +1 -0
- package/dist/types/lib/time-travel/servedView.d.ts.map +1 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,83 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [9.98.0] - 2026-09-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `withDatasetArtifacts(tool, adapter)` and `stageDatasetArtifacts` publish
|
|
15
|
+
producer-declared datasets through the existing scoped artifact store. Local,
|
|
16
|
+
HTTP-backed and structured MCP tools share source lineage, unavailable receipts
|
|
17
|
+
and retention checks. Storage is configured by the host; a frontend is optional.
|
|
18
|
+
Includes a chatbot-only example that calculates from the same ref on a later
|
|
19
|
+
turn. This handles materialized results, not streaming or remote dataset handles.
|
|
20
|
+
- MCP clients can opt into `resultMode: 'structured'` or `'structured-or-json'`
|
|
21
|
+
before dataset adaptation. Structured data survives without text conversion;
|
|
22
|
+
the fallback accepts only one declared JSON-object text block. Default text
|
|
23
|
+
decoding is unchanged, and tool errors remain failures.
|
|
24
|
+
- `receipt.requestMeasurement` records JSON character and UTF-8 byte sizes for
|
|
25
|
+
the initial prepared canonical request and its separately serialized slots,
|
|
26
|
+
including complete tool schemas. Unsupported or cyclic values report an
|
|
27
|
+
unavailable measurement without failing the call. Internal work limits report
|
|
28
|
+
`measurement-limit` at more than 100,000 visited values, 64 nested containers,
|
|
29
|
+
or 4,000,000 string/key UTF-16 code units while copying or serialized JSON
|
|
30
|
+
characters; they never truncate or reject provider input. Older receipts may
|
|
31
|
+
lack the field. Existing advisory counters are unchanged; these sizes do not
|
|
32
|
+
represent tokens, later retries or provider HTTP payloads. The measurement
|
|
33
|
+
records no request content; `RequestMeasurement` and `RequestJsonSize` are public types.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Reuse ContextFootprint's pure assertion comparison and Claim-face helpers.
|
|
38
|
+
Existing assertion keys, witness identity, diagnostic checks and answer-delivery
|
|
39
|
+
policies remain unchanged. Use the published exact `contextfootprint: "0.1.1"`
|
|
40
|
+
runtime dependency; remove the temporary vendored archive and bundle used before
|
|
41
|
+
that registry release. Clean online installs and cached offline installs are
|
|
42
|
+
checked through source and packed consumers.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Dataset projections preserve original absence, coverage, clarification and
|
|
47
|
+
semantic declarations, including recognized tool-effect status/effects.
|
|
48
|
+
`withDatasetArtifacts` refuses removed, changed or unreadable declarations;
|
|
49
|
+
optional paired `checkSemantics` fixtures apply the same check at build time.
|
|
50
|
+
This checks declaration preservation, not factual truth, never infers absence
|
|
51
|
+
from empty data, and leaves `requestInput` pauses unchanged.
|
|
52
|
+
- `read_skill` describes each visible skill once when the turn-start menu and
|
|
53
|
+
the catalog or reachability lists overlap. Later memberships retain the skill
|
|
54
|
+
id; candidate ordering, supplied relevance, cursor, visibility and admission
|
|
55
|
+
remain unchanged. The default menu hint and tool wording no longer claim an
|
|
56
|
+
offline scorer necessarily ranked the menu. No routing option is required.
|
|
57
|
+
- Upgrade the shared comparison to ContextFootprint 0.1.1. Distinct JSON data
|
|
58
|
+
with an own `__proto__` property now produces the expected conflict, including
|
|
59
|
+
nested objects and known Claim payloads. Legacy recording keys and original
|
|
60
|
+
witnesses remain unchanged. Pre-call and post-call integration tests exercise
|
|
61
|
+
the shared implementation. Both release paths now require the packed dependency
|
|
62
|
+
check before publishing.
|
|
63
|
+
|
|
64
|
+
## [9.97.0] - 2026-09-13
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
|
|
68
|
+
- `requestInput()` pauses a collection tool with typed missing fields and a
|
|
69
|
+
runtime-stamped `awaiting_input` state. Partial replies retain accepted values
|
|
70
|
+
without model calls; complete replies resume the same tool boundary and skill
|
|
71
|
+
position through normal result validation, redaction and placement.
|
|
72
|
+
- Hosted typed replies and explicit cancellation preserve session ownership and
|
|
73
|
+
conversation history. `session-pending` reloads the pending question without
|
|
74
|
+
exposing the execution checkpoint. Application defaults remain app-owned.
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- Hosted cancellation releases the paused session's run resources without
|
|
79
|
+
executing remaining tools. Run terminals preserve other paused sessions, and
|
|
80
|
+
teardown events retain the actual registration's run and session identity.
|
|
81
|
+
- Keep documentation within existing browser and export budgets: load only the
|
|
82
|
+
syntax grammars used by interactive code blocks and prepare SkillGraph demo
|
|
83
|
+
data on the server while retaining its interactive browser view.
|
|
84
|
+
|
|
8
85
|
## [9.96.1] - 2026-09-13
|
|
9
86
|
|
|
10
87
|
### Fixed
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stageDatasetArtifacts = exports.withDatasetArtifacts = void 0;
|
|
4
|
+
const projection_js_1 = require("../lib/semantics/projection.js");
|
|
5
|
+
/**
|
|
6
|
+
* Adapt any local, HTTP-backed or MCP Tool using the SAME already-bound execution capability.
|
|
7
|
+
* Claim-check: the host configures storage; the model carries tickets between tools. No UI required.
|
|
8
|
+
* No store: pass through without calling the adapter; the host's normal result policy still applies.
|
|
9
|
+
* Writes are independent, not a transaction. A failed source does not hide otherwise readable data;
|
|
10
|
+
* its unavailable receipt must remain explicit in the producer's projection. Recheck tickets after
|
|
11
|
+
* the batch because a later put can evict an earlier one. Expiry after publication remains possible.
|
|
12
|
+
* This stages materialized payloads; it does not add remote handles, streaming or query pushdown.
|
|
13
|
+
*/
|
|
14
|
+
function withDatasetArtifacts(tool, adapter) {
|
|
15
|
+
return {
|
|
16
|
+
...tool,
|
|
17
|
+
async execute(args, ctx) {
|
|
18
|
+
const result = await tool.execute(args, ctx);
|
|
19
|
+
if (!ctx.hasArtifacts)
|
|
20
|
+
return result;
|
|
21
|
+
const semantics = (0, projection_js_1.snapshotProjectionSemantics)(result);
|
|
22
|
+
const plan = await adapter.describe(result, args);
|
|
23
|
+
if (plan === undefined) {
|
|
24
|
+
const issues = (0, projection_js_1.projectionSemanticsIssues)(semantics, result);
|
|
25
|
+
if (issues.length)
|
|
26
|
+
throw new Error(issues[0].message);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
if (!plan || typeof plan.project !== 'function') {
|
|
30
|
+
throw new TypeError('A dataset result plan requires a project function.');
|
|
31
|
+
}
|
|
32
|
+
const projected = await plan.project(await stageDatasetArtifacts(plan.datasets, ctx.artifacts));
|
|
33
|
+
const issues = (0, projection_js_1.projectionSemanticsIssues)(semantics, projected);
|
|
34
|
+
if (issues.length)
|
|
35
|
+
throw new Error(issues[0].message);
|
|
36
|
+
return projected;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.withDatasetArtifacts = withDatasetArtifacts;
|
|
41
|
+
/** The same staging step for an existing tool pipeline that already owns execution and projection. */
|
|
42
|
+
async function stageDatasetArtifacts(datasets, artifacts) {
|
|
43
|
+
assertInputs(datasets);
|
|
44
|
+
const publications = [];
|
|
45
|
+
for (const entry of datasets) {
|
|
46
|
+
const source = entry.source ? await put(artifacts, entry.source) : undefined;
|
|
47
|
+
const parentRefs = source?.status === 'stored'
|
|
48
|
+
? [...(entry.artifact.parentRefs ?? []), source.meta.ref]
|
|
49
|
+
: entry.artifact.parentRefs;
|
|
50
|
+
const artifact = await put(artifacts, { ...entry.artifact, ...(parentRefs && { parentRefs }) });
|
|
51
|
+
publications.push({ key: entry.key, artifact, ...(source && { source }) });
|
|
52
|
+
}
|
|
53
|
+
const held = [];
|
|
54
|
+
for (const publication of publications) {
|
|
55
|
+
const artifact = await current(artifacts, publication.artifact);
|
|
56
|
+
const source = publication.source ? await current(artifacts, publication.source) : undefined;
|
|
57
|
+
held.push({ key: publication.key, artifact, ...(source && { source }) });
|
|
58
|
+
}
|
|
59
|
+
return held;
|
|
60
|
+
}
|
|
61
|
+
exports.stageDatasetArtifacts = stageDatasetArtifacts;
|
|
62
|
+
async function put(artifacts, input) {
|
|
63
|
+
try {
|
|
64
|
+
return { status: 'stored', meta: await artifacts.put(input) };
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Store exceptions may contain connection strings. The existing artifact event records the refusal.
|
|
68
|
+
return { status: 'unavailable', reason: 'store-unavailable' };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function current(artifacts, receipt) {
|
|
72
|
+
if (receipt.status !== 'stored')
|
|
73
|
+
return receipt;
|
|
74
|
+
try {
|
|
75
|
+
const meta = await artifacts.head(receipt.meta.ref);
|
|
76
|
+
return meta
|
|
77
|
+
? { status: 'stored', meta }
|
|
78
|
+
: { status: 'unavailable', reason: 'missing-or-expired' };
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return { status: 'unavailable', reason: 'store-unavailable' };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** Validate declaration shape before any writes. Payload serialization and parent proofs belong to the store. */
|
|
85
|
+
function assertInputs(datasets) {
|
|
86
|
+
if (!Array.isArray(datasets)) {
|
|
87
|
+
throw new TypeError('Dataset declarations must be an array.');
|
|
88
|
+
}
|
|
89
|
+
const keys = new Set();
|
|
90
|
+
for (const entry of datasets) {
|
|
91
|
+
if (!entry || typeof entry.key !== 'string' || entry.key.trim() === '' || keys.has(entry.key)) {
|
|
92
|
+
throw new TypeError('Dataset keys must be nonempty and unique within one result.');
|
|
93
|
+
}
|
|
94
|
+
keys.add(entry.key);
|
|
95
|
+
for (const input of [entry.artifact, ...(entry.source === undefined ? [] : [entry.source])]) {
|
|
96
|
+
if (!input ||
|
|
97
|
+
typeof input !== 'object' ||
|
|
98
|
+
Array.isArray(input) ||
|
|
99
|
+
typeof input.kind !== 'string' ||
|
|
100
|
+
!input.kind.trim() ||
|
|
101
|
+
typeof input.mediaType !== 'string' ||
|
|
102
|
+
!input.mediaType.trim() ||
|
|
103
|
+
!Object.prototype.hasOwnProperty.call(input, 'data')) {
|
|
104
|
+
throw new TypeError('Each dataset/source artifact requires kind, mediaType and data.');
|
|
105
|
+
}
|
|
106
|
+
if (input.parentRefs !== undefined) {
|
|
107
|
+
if (!Array.isArray(input.parentRefs)) {
|
|
108
|
+
throw new TypeError('Dataset/source parentRefs must be an array of strings.');
|
|
109
|
+
}
|
|
110
|
+
for (const ref of input.parentRefs) {
|
|
111
|
+
if (typeof ref !== 'string') {
|
|
112
|
+
throw new TypeError('Dataset/source parentRefs must be an array of strings.');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=datasetResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasetResult.js","sourceRoot":"","sources":["../../src/artifacts/datasetResult.ts"],"names":[],"mappings":";;;AAIA,kEAGwC;AAsCxC;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,IAA0B,EAC1B,OAAyD;IAEzD,OAAO;QACL,GAAG,IAAI;QACP,KAAK,CAAC,OAAO,CAAC,IAAW,EAAE,GAAyB;YAClD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC7C,IAAI,CAAC,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
package/dist/artifacts/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* this folder for the one-job map and the import direction.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.placedToolResult = exports.placedResultKind = exports.isPlacedToolResult = exports.assertArtifactPlacement = exports.runArtifactStoreConformance = exports.runArtifactStoreCase = exports.formatArtifactStoreReport = exports.artifactStoreConformance = exports.UnserializableRecordingError = exports.chartWalkPutInput = exports.CHART_WALK_ARTIFACT_KIND = exports.RECORDING_MEDIA_TYPE = exports.RECORDING_ARTIFACT_KIND = exports.recordingPutInput = exports.presentArtifact = exports.PRESENT_TOOL_NAME = exports.wantsNeedsStoreRefusal = exports.resolveToolWants = exports.assertToolWants = exports.unconfiguredArtifacts = exports.bindArtifacts = exports.collectStream = exports.canStreamArtifacts = exports.canPutArtifactStream = exports.canGetArtifactStream = exports.bytesAsStream = exports.assertStreamBytes = exports.gcsArtifacts = exports.s3Artifacts = exports.UnreadableArtifactStoreError = exports.sqliteArtifacts = exports.UnreadableArtifactFileError = exports.fileArtifacts = exports.DEFAULT_IN_MEMORY_ARTIFACT_RETENTION = exports.inMemoryArtifacts = exports.mintArtifactRef = exports.isArtifactRef = exports.ARTIFACT_REF_PREFIX = exports.UnknownParentRefError = exports.InvalidArtifactError = exports.ArtifactIntegrityError = void 0;
|
|
14
|
+
exports.stageDatasetArtifacts = exports.withDatasetArtifacts = exports.placedToolResult = exports.placedResultKind = exports.isPlacedToolResult = exports.assertArtifactPlacement = exports.runArtifactStoreConformance = exports.runArtifactStoreCase = exports.formatArtifactStoreReport = exports.artifactStoreConformance = exports.UnserializableRecordingError = exports.chartWalkPutInput = exports.CHART_WALK_ARTIFACT_KIND = exports.RECORDING_MEDIA_TYPE = exports.RECORDING_ARTIFACT_KIND = exports.recordingPutInput = exports.presentArtifact = exports.PRESENT_TOOL_NAME = exports.wantsNeedsStoreRefusal = exports.resolveToolWants = exports.assertToolWants = exports.unconfiguredArtifacts = exports.bindArtifacts = exports.collectStream = exports.canStreamArtifacts = exports.canPutArtifactStream = exports.canGetArtifactStream = exports.bytesAsStream = exports.assertStreamBytes = exports.gcsArtifacts = exports.s3Artifacts = exports.UnreadableArtifactStoreError = exports.sqliteArtifacts = exports.UnreadableArtifactFileError = exports.fileArtifacts = exports.DEFAULT_IN_MEMORY_ARTIFACT_RETENTION = exports.inMemoryArtifacts = exports.mintArtifactRef = exports.isArtifactRef = exports.ARTIFACT_REF_PREFIX = exports.UnknownParentRefError = exports.InvalidArtifactError = exports.ArtifactIntegrityError = void 0;
|
|
15
15
|
var types_js_1 = require("./types.js");
|
|
16
16
|
Object.defineProperty(exports, "ArtifactIntegrityError", { enumerable: true, get: function () { return types_js_1.ArtifactIntegrityError; } });
|
|
17
17
|
Object.defineProperty(exports, "InvalidArtifactError", { enumerable: true, get: function () { return types_js_1.InvalidArtifactError; } });
|
|
@@ -71,4 +71,7 @@ Object.defineProperty(exports, "assertArtifactPlacement", { enumerable: true, ge
|
|
|
71
71
|
Object.defineProperty(exports, "isPlacedToolResult", { enumerable: true, get: function () { return placement_js_1.isPlacedToolResult; } });
|
|
72
72
|
Object.defineProperty(exports, "placedResultKind", { enumerable: true, get: function () { return placement_js_1.placedResultKind; } });
|
|
73
73
|
Object.defineProperty(exports, "placedToolResult", { enumerable: true, get: function () { return placement_js_1.placedToolResult; } });
|
|
74
|
+
var datasetResult_js_1 = require("./datasetResult.js");
|
|
75
|
+
Object.defineProperty(exports, "withDatasetArtifacts", { enumerable: true, get: function () { return datasetResult_js_1.withDatasetArtifacts; } });
|
|
76
|
+
Object.defineProperty(exports, "stageDatasetArtifacts", { enumerable: true, get: function () { return datasetResult_js_1.stageDatasetArtifacts; } });
|
|
74
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG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ACvB,4HAAA,oBAAoB,OAAA;AACpB,gIAAA,wBAAwB,OAAA;AACxB,yHAAA,iBAAiB,OAAA;AACjB,oIAAA,4BAA4B,OAAA;AAI9B,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,mCAAmC;AACnC,mDAagC;AAZ9B,oHAAA,wBAAwB,OAAA;AACxB,qHAAA,yBAAyB,OAAA;AACzB,gHAAA,oBAAoB,OAAA;AACpB,uHAAA,2BAA2B,OAAA;AAU7B,+CAOwB;AANtB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,gHAAA,gBAAgB,OAAA;AAIlB,uDAQ4B;AAP1B,wHAAA,oBAAoB,OAAA;AACpB,yHAAA,qBAAqB,OAAA"}
|
package/dist/core/Agent.js
CHANGED
|
@@ -118,6 +118,7 @@ const routeTurn_js_1 = require("./agent/stages/routeTurn.js");
|
|
|
118
118
|
const outputFallback_js_1 = require("./outputFallback.js");
|
|
119
119
|
const runCheckpoint_js_1 = require("./runCheckpoint.js");
|
|
120
120
|
const conversation_js_1 = require("./conversation.js");
|
|
121
|
+
const inputRequest_js_1 = require("./inputRequest.js");
|
|
121
122
|
const outputSchema_js_1 = require("./outputSchema.js");
|
|
122
123
|
const runInput_js_1 = require("./runInput.js");
|
|
123
124
|
const outputRetry_js_1 = require("./agent/stages/outputRetry.js");
|
|
@@ -1604,6 +1605,38 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
1604
1605
|
const gate = (0, pause_js_1.pauseDemandsDecision)(checkpoint.pauseData);
|
|
1605
1606
|
if (gate && !(0, checkin_js_1.isCheckInDecision)(input))
|
|
1606
1607
|
throw new pause_js_1.DecisionRequiredError(gate, input);
|
|
1608
|
+
// Typed data collection is not consent. Validate before changing any run state.
|
|
1609
|
+
const awaitingInput = gate === undefined ? (0, inputRequest_js_1.readAwaitingInput)(checkpoint.pauseData) : undefined;
|
|
1610
|
+
if (awaitingInput !== undefined) {
|
|
1611
|
+
this.assertNotRunning('Agent.resume');
|
|
1612
|
+
const answered = (0, inputRequest_js_1.applyInputResponse)(awaitingInput, input);
|
|
1613
|
+
if ('cancel' in answered) {
|
|
1614
|
+
throw new TypeError('[input request] Cancel a hosted request through its host, or abandonPause() before starting another run.');
|
|
1615
|
+
}
|
|
1616
|
+
if (answered.missing.length > 0) {
|
|
1617
|
+
const copy = structuredClone(checkpoint);
|
|
1618
|
+
const pauseData = {
|
|
1619
|
+
...copy.pauseData,
|
|
1620
|
+
awaitingInput: answered,
|
|
1621
|
+
};
|
|
1622
|
+
const outcome = {
|
|
1623
|
+
paused: true,
|
|
1624
|
+
checkpoint: { ...copy, pauseData },
|
|
1625
|
+
pauseData,
|
|
1626
|
+
awaitingInput: answered,
|
|
1627
|
+
};
|
|
1628
|
+
this.recordPendingQuestion(outcome);
|
|
1629
|
+
return outcome;
|
|
1630
|
+
}
|
|
1631
|
+
input = {
|
|
1632
|
+
status: 'input_received',
|
|
1633
|
+
requestId: answered.requestId,
|
|
1634
|
+
values: answered.supplied,
|
|
1635
|
+
origins: answered.origins,
|
|
1636
|
+
origin: answered.origin,
|
|
1637
|
+
...(answered.context !== undefined && { context: answered.context }),
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1607
1640
|
// And the answer must be about the thing that was asked. Checked HERE, at
|
|
1608
1641
|
// the same door and before any state moves, because a resume that has begun
|
|
1609
1642
|
// is a resume that has already used the value.
|
|
@@ -1678,7 +1711,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
1678
1711
|
* Fired for the TURN, not for `currentRunContext.runId` — `resume()` mints a
|
|
1679
1712
|
* fresh run id, so a pause and its resume are one turn across two runs, and
|
|
1680
1713
|
* filtering on the id would leave everything a paused turn opened alive
|
|
1681
|
-
* forever. See `ToolSessionTier.fireRun`.
|
|
1714
|
+
* forever. Hosted turns are scoped to their session, preserving other pauses. See `ToolSessionTier.fireRun`.
|
|
1682
1715
|
*
|
|
1683
1716
|
* @param outcome what `run()`/`resume()` is about to return, or about to throw.
|
|
1684
1717
|
*/
|
|
@@ -1689,7 +1722,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
1689
1722
|
return;
|
|
1690
1723
|
if (outcome instanceof Error && outcome.name === 'PauseSignal')
|
|
1691
1724
|
return;
|
|
1692
|
-
|
|
1725
|
+
if (this.currentRunContext.sessionId !== undefined)
|
|
1726
|
+
await this.toolSessionTier.fireSessionRuns(this.currentRunContext.sessionId);
|
|
1727
|
+
else
|
|
1728
|
+
await this.toolSessionTier.fireRun();
|
|
1693
1729
|
}
|
|
1694
1730
|
/**
|
|
1695
1731
|
* The conversation this agent's LAST completed run leaves behind, packed as
|
|
@@ -1981,6 +2017,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
1981
2017
|
*/
|
|
1982
2018
|
toolRunFacts() {
|
|
1983
2019
|
return {
|
|
2020
|
+
runContext: { ...this.currentRunContext },
|
|
1984
2021
|
runId: this.currentRunContext.runId,
|
|
1985
2022
|
...(this.currentRunContext.sessionId !== undefined && {
|
|
1986
2023
|
sessionId: this.currentRunContext.sessionId,
|
|
@@ -1998,7 +2035,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
1998
2035
|
if (!this.toolSessionTier) {
|
|
1999
2036
|
this.toolSessionTier = new toolSessions_js_1.ToolSessionTier({
|
|
2000
2037
|
timeoutMs: this.toolTeardownTimeoutMs,
|
|
2001
|
-
report: (report) => this.emitToolSessionReport(report),
|
|
2038
|
+
report: (report, origin) => this.emitToolSessionReport(report, origin),
|
|
2002
2039
|
});
|
|
2003
2040
|
}
|
|
2004
2041
|
return this.toolSessionTier;
|
|
@@ -2017,10 +2054,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
2017
2054
|
* hardcodes `runId: 'consumer-scope'`, and a teardown event stamped that way
|
|
2018
2055
|
* cannot be joined to the run that OPENED the session — the exact
|
|
2019
2056
|
* unjoinability 9.4.0 spent a release fixing for credential events. So the
|
|
2020
|
-
* meta comes from
|
|
2057
|
+
* meta comes from the registration-time run context, with a STATED pseudo-stage, the same
|
|
2021
2058
|
* move as the `'<stageId>#paused'` stamp at the pause boundary.
|
|
2022
2059
|
*/
|
|
2023
|
-
emitToolSessionReport(report) {
|
|
2060
|
+
emitToolSessionReport(report, origin) {
|
|
2024
2061
|
const type = report.kind === 'closed'
|
|
2025
2062
|
? 'agentfootprint.tools.session_closed'
|
|
2026
2063
|
: 'agentfootprint.tools.session_close_failed';
|
|
@@ -2031,7 +2068,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
|
|
|
2031
2068
|
dispatcher.dispatch({
|
|
2032
2069
|
type,
|
|
2033
2070
|
payload,
|
|
2034
|
-
meta: (0, eventMeta_js_1.buildEventMeta)({ runtimeStageId: TOOL_TEARDOWN_STAGE_ID }, this.currentRunContext),
|
|
2071
|
+
meta: (0, eventMeta_js_1.buildEventMeta)({ runtimeStageId: TOOL_TEARDOWN_STAGE_ID }, origin.runContext ?? this.currentRunContext),
|
|
2035
2072
|
});
|
|
2036
2073
|
}
|
|
2037
2074
|
openSkillIds() {
|