agentfootprint 11.2.0 → 11.4.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/AGENTS.md +1 -1
- package/CAPABILITIES.md +4 -0
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/identity/verify/claims.js +3 -3
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js +3 -2
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +6 -5
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +8 -6
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/answer-account/account.js +15 -3
- package/dist/answer-account/account.js.map +1 -1
- package/dist/answer-account/facts/howSure.js +10 -22
- package/dist/answer-account/facts/howSure.js.map +1 -1
- package/dist/core/Agent.js +26 -3
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +69 -12
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/assessment/assess.js +15 -4
- package/dist/core/agent/assessment/assess.js.map +1 -1
- package/dist/core/agent/assessment/compose.js +153 -15
- package/dist/core/agent/assessment/compose.js.map +1 -1
- package/dist/core/agent/assessment/reasons.js +35 -1
- package/dist/core/agent/assessment/reasons.js.map +1 -1
- package/dist/core/agent/assessment/sources.js +205 -0
- package/dist/core/agent/assessment/sources.js.map +1 -0
- package/dist/core/agent/assessment/stage.js +15 -4
- package/dist/core/agent/assessment/stage.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +4 -1
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/evidence/evidenceIndex.js +30 -2
- package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/core/agent/evidence/extract.js +34 -5
- package/dist/core/agent/evidence/extract.js.map +1 -1
- package/dist/core/agent/evidence/figures.js +31 -3
- package/dist/core/agent/evidence/figures.js.map +1 -1
- package/dist/core/agent/evidence/numberPrecision.js +58 -2
- package/dist/core/agent/evidence/numberPrecision.js.map +1 -1
- package/dist/core/agent/honesty/mounts.js.map +1 -1
- package/dist/core/agent/stages/prepareFinal.js +33 -17
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/route.js +2 -1
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +14 -1
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +1 -1
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/adapters/identity/jwks.d.ts +2 -2
- package/dist/esm/adapters/identity/verify/claims.d.ts +3 -3
- package/dist/esm/adapters/identity/verify/claims.js +3 -3
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +3 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +3 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +6 -5
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +6 -5
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.d.ts +3 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +9 -7
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/answer-account/account.js +16 -4
- package/dist/esm/answer-account/account.js.map +1 -1
- package/dist/esm/answer-account/facts/howSure.js +10 -22
- package/dist/esm/answer-account/facts/howSure.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +2 -1
- package/dist/esm/core/Agent.js +26 -3
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +22 -1
- package/dist/esm/core/agent/AgentBuilder.js +69 -12
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/assessment/assess.js +15 -4
- package/dist/esm/core/agent/assessment/assess.js.map +1 -1
- package/dist/esm/core/agent/assessment/compose.d.ts +82 -5
- package/dist/esm/core/agent/assessment/compose.js +148 -14
- package/dist/esm/core/agent/assessment/compose.js.map +1 -1
- package/dist/esm/core/agent/assessment/reasons.d.ts +17 -1
- package/dist/esm/core/agent/assessment/reasons.js +35 -1
- package/dist/esm/core/agent/assessment/reasons.js.map +1 -1
- package/dist/esm/core/agent/assessment/sources.d.ts +66 -0
- package/dist/esm/core/agent/assessment/sources.js +201 -0
- package/dist/esm/core/agent/assessment/sources.js.map +1 -0
- package/dist/esm/core/agent/assessment/stage.d.ts +17 -4
- package/dist/esm/core/agent/assessment/stage.js +16 -5
- package/dist/esm/core/agent/assessment/stage.js.map +1 -1
- package/dist/esm/core/agent/assessment/types.d.ts +37 -0
- package/dist/esm/core/agent/buildAgentChart.d.ts +8 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.js +5 -2
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +12 -2
- package/dist/esm/core/agent/evidence/evidenceIndex.js +30 -2
- package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/esm/core/agent/evidence/extract.js +35 -6
- package/dist/esm/core/agent/evidence/extract.js.map +1 -1
- package/dist/esm/core/agent/evidence/figures.d.ts +6 -0
- package/dist/esm/core/agent/evidence/figures.js +32 -4
- package/dist/esm/core/agent/evidence/figures.js.map +1 -1
- package/dist/esm/core/agent/evidence/numberPrecision.d.ts +29 -1
- package/dist/esm/core/agent/evidence/numberPrecision.js +56 -1
- package/dist/esm/core/agent/evidence/numberPrecision.js.map +1 -1
- package/dist/esm/core/agent/honesty/mounts.d.ts +11 -2
- package/dist/esm/core/agent/honesty/mounts.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +19 -3
- package/dist/esm/core/agent/stages/prepareFinal.js +33 -17
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/route.js +2 -1
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.js +14 -1
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +16 -2
- package/dist/esm/core/slots/buildToolsSlot.js +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +194 -0
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/hosting/doorGuard.d.ts +3 -3
- package/dist/esm/hosting/doorGuard.js +2 -2
- package/dist/esm/hosting/nodeHost.d.ts +1 -1
- package/dist/esm/lib/displayName.d.ts +81 -0
- package/dist/esm/lib/displayName.js +119 -0
- package/dist/esm/lib/displayName.js.map +1 -0
- package/dist/esm/mcp/callLifetime.d.ts +49 -0
- package/dist/esm/mcp/callLifetime.js +99 -0
- package/dist/esm/mcp/callLifetime.js.map +1 -0
- package/dist/esm/mcp/mcpClient.d.ts +4 -1
- package/dist/esm/mcp/mcpClient.js +70 -28
- package/dist/esm/mcp/mcpClient.js.map +1 -1
- package/dist/esm/mcp/requestLedger.d.ts +97 -0
- package/dist/esm/mcp/requestLedger.js +192 -0
- package/dist/esm/mcp/requestLedger.js.map +1 -0
- package/dist/esm/mcp/seriesEvidence.d.ts +102 -0
- package/dist/esm/mcp/seriesEvidence.js +246 -0
- package/dist/esm/mcp/seriesEvidence.js.map +1 -0
- package/dist/esm/mcp/throttleRetry.d.ts +70 -35
- package/dist/esm/mcp/throttleRetry.js +181 -54
- package/dist/esm/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/mcp/types.d.ts +12 -7
- package/dist/esm/redaction/knownStrings.js +30 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/security/PermissionPolicy.d.ts +1 -1
- package/dist/esm/security/PermissionPolicy.js +1 -1
- package/dist/esm/semantics/coverage/answer.d.ts +9 -1
- package/dist/esm/semantics/coverage/answer.js +50 -10
- package/dist/esm/semantics/coverage/answer.js.map +1 -1
- package/dist/esm/strategies/defaults/chatBubbleLiveStatus.d.ts +1 -1
- package/dist/esm/strategies/defaults/chatBubbleLiveStatus.js +1 -1
- package/dist/esm/tool-lint/analyze.d.ts +1 -1
- package/dist/esm/tool-lint/analyze.js +1 -1
- package/dist/esm/tool-lint/rules.d.ts +3 -3
- package/dist/esm/tool-lint/rules.js +3 -3
- package/dist/esm/tools/requestEvidence.d.ts +78 -0
- package/dist/esm/tools/requestEvidence.js +331 -0
- package/dist/esm/tools/requestEvidence.js.map +1 -0
- package/dist/esm/tools/tools.d.ts +30 -0
- package/dist/esm/tools/tools.js +16 -0
- package/dist/esm/tools/tools.js.map +1 -1
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/doorGuard.js +2 -2
- package/dist/lib/displayName.js +125 -0
- package/dist/lib/displayName.js.map +1 -0
- package/dist/mcp/callLifetime.js +103 -0
- package/dist/mcp/callLifetime.js.map +1 -0
- package/dist/mcp/mcpClient.js +69 -27
- package/dist/mcp/mcpClient.js.map +1 -1
- package/dist/mcp/requestLedger.js +196 -0
- package/dist/mcp/requestLedger.js.map +1 -0
- package/dist/mcp/seriesEvidence.js +251 -0
- package/dist/mcp/seriesEvidence.js.map +1 -0
- package/dist/mcp/throttleRetry.js +184 -55
- package/dist/mcp/throttleRetry.js.map +1 -1
- package/dist/redaction/knownStrings.js +30 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/security/PermissionPolicy.js +1 -1
- package/dist/semantics/coverage/answer.js +49 -9
- package/dist/semantics/coverage/answer.js.map +1 -1
- package/dist/strategies/defaults/chatBubbleLiveStatus.js +1 -1
- package/dist/tool-lint/analyze.js +1 -1
- package/dist/tool-lint/rules.js +3 -3
- package/dist/tools/requestEvidence.js +337 -0
- package/dist/tools/requestEvidence.js.map +1 -0
- package/dist/tools/tools.js +18 -1
- package/dist/tools/tools.js.map +1 -1
- package/dist/types/adapters/identity/jwks.d.ts +2 -2
- package/dist/types/adapters/identity/verify/claims.d.ts +3 -3
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +3 -2
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +6 -5
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts +3 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
- package/dist/types/answer-account/account.d.ts.map +1 -1
- package/dist/types/answer-account/facts/howSure.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +2 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +22 -1
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/assess.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/compose.d.ts +82 -5
- package/dist/types/core/agent/assessment/compose.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/reasons.d.ts +17 -1
- package/dist/types/core/agent/assessment/reasons.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/sources.d.ts +67 -0
- package/dist/types/core/agent/assessment/sources.d.ts.map +1 -0
- package/dist/types/core/agent/assessment/stage.d.ts +17 -4
- package/dist/types/core/agent/assessment/stage.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/types.d.ts +37 -0
- package/dist/types/core/agent/assessment/types.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +8 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts +12 -2
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/extract.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/figures.d.ts +6 -0
- package/dist/types/core/agent/evidence/figures.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/numberPrecision.d.ts +29 -1
- package/dist/types/core/agent/evidence/numberPrecision.d.ts.map +1 -1
- package/dist/types/core/agent/honesty/mounts.d.ts +11 -2
- package/dist/types/core/agent/honesty/mounts.d.ts.map +1 -1
- package/dist/types/core/agent/stages/prepareFinal.d.ts +19 -3
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +16 -2
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +194 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/hosting/doorGuard.d.ts +3 -3
- package/dist/types/hosting/nodeHost.d.ts +1 -1
- package/dist/types/lib/displayName.d.ts +82 -0
- package/dist/types/lib/displayName.d.ts.map +1 -0
- package/dist/types/mcp/callLifetime.d.ts +50 -0
- package/dist/types/mcp/callLifetime.d.ts.map +1 -0
- package/dist/types/mcp/mcpClient.d.ts +4 -1
- package/dist/types/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/mcp/requestLedger.d.ts +98 -0
- package/dist/types/mcp/requestLedger.d.ts.map +1 -0
- package/dist/types/mcp/seriesEvidence.d.ts +103 -0
- package/dist/types/mcp/seriesEvidence.d.ts.map +1 -0
- package/dist/types/mcp/throttleRetry.d.ts +70 -35
- package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/mcp/types.d.ts +12 -7
- package/dist/types/mcp/types.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/security/PermissionPolicy.d.ts +1 -1
- package/dist/types/semantics/coverage/answer.d.ts +9 -1
- package/dist/types/semantics/coverage/answer.d.ts.map +1 -1
- package/dist/types/strategies/defaults/chatBubbleLiveStatus.d.ts +1 -1
- package/dist/types/tool-lint/analyze.d.ts +1 -1
- package/dist/types/tool-lint/rules.d.ts +3 -3
- package/dist/types/tools/requestEvidence.d.ts +79 -0
- package/dist/types/tools/requestEvidence.d.ts.map +1 -0
- package/dist/types/tools/tools.d.ts +30 -0
- package/dist/types/tools/tools.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
* the model's reply with a question), so an absence renders "not sure — what
|
|
15
15
|
* was searched", never "ask".
|
|
16
16
|
*
|
|
17
|
+
* THE SOURCE. What each reason rests on is declared here too, once: `calls`
|
|
18
|
+
* when its rows are about specific tool calls (a result, a coverage row, an
|
|
19
|
+
* argument or period row, a conflict between readings); `answer` when its row
|
|
20
|
+
* is a verdict on the answer itself (a value no result carried, a claim in it,
|
|
21
|
+
* the app's checks on its bytes); `run` when it is about how the run went (a
|
|
22
|
+
* pause still waiting, a limit, unfinished steps, a check that could not reach
|
|
23
|
+
* a verdict). The fold never decides it per run, so "the run" is never an
|
|
24
|
+
* empty list of calls in disguise.
|
|
25
|
+
*
|
|
17
26
|
* WHAT IS NOT HERE, AND WHY. A reason is read from a COMMITTED row, never from
|
|
18
27
|
* an event, so the running agent and a later reader fold the same bytes. Two
|
|
19
28
|
* verdicts the honesty design names are events only in this version and so
|
|
@@ -32,150 +41,175 @@ export const REASONS = Object.freeze([
|
|
|
32
41
|
{
|
|
33
42
|
reason: 'asked',
|
|
34
43
|
class: 'ask',
|
|
44
|
+
source: 'run',
|
|
35
45
|
reads: 'pausedToolCallId: the call a pause is still waiting on (requestInput, askHuman / pauseHere, a checkIn, a middleware ask, a credential consent)',
|
|
36
46
|
},
|
|
37
47
|
{
|
|
38
48
|
reason: 'argument-asked',
|
|
39
49
|
layer: 2,
|
|
40
50
|
class: 'ask',
|
|
51
|
+
source: 'run',
|
|
41
52
|
reads: "argumentAsk: the inputs layer's batch ask with a question still out (`waiting`) — nothing in that batch has run; the findingsLedger's current `asked` rows of this turn name the values",
|
|
42
53
|
},
|
|
43
54
|
{
|
|
44
55
|
reason: 'argument-assumed',
|
|
45
56
|
layer: 2,
|
|
46
57
|
class: 'not-sure',
|
|
58
|
+
source: 'calls',
|
|
47
59
|
reads: "findingsLedger: an argument row of this turn with source 'default' (the tool's rule assumed the value); or middlewareDecisions: a before-tool rewrite of a ruled argument (changedKeys) with no declared origin",
|
|
48
60
|
},
|
|
49
61
|
{
|
|
50
62
|
reason: 'argument-unverified',
|
|
51
63
|
layer: 2,
|
|
52
64
|
class: 'not-sure',
|
|
65
|
+
source: 'calls',
|
|
53
66
|
reads: "findingsLedger: an argument row of this turn with source 'model' on a ruled or period argument, or with a failed declared-source check (on any argument)",
|
|
54
67
|
},
|
|
55
68
|
{
|
|
56
69
|
reason: 'argument-read',
|
|
57
70
|
layer: 2,
|
|
58
71
|
class: 'not-sure',
|
|
72
|
+
source: 'calls',
|
|
59
73
|
reads: "findingsLedger: an argument row of this turn with source 'said' and reading — the person's words were found, the value is the model's reading of them (under an ask rule it asked instead)",
|
|
60
74
|
},
|
|
61
75
|
{
|
|
62
76
|
reason: 'value-contingent',
|
|
63
77
|
layer: 2,
|
|
64
78
|
class: 'not-sure',
|
|
79
|
+
source: 'calls',
|
|
65
80
|
reads: "findingsLedger: an argument row of this turn with source 'result' and setAside (the model named a result it had set aside); or a contingent row of this turn",
|
|
66
81
|
},
|
|
67
82
|
{
|
|
68
83
|
reason: 'coverage-gap',
|
|
69
84
|
layer: 3,
|
|
70
85
|
class: 'not-sure',
|
|
86
|
+
source: 'calls',
|
|
71
87
|
reads: "coverageDeclared: a notChecked or cannotCover item on a call of this turn; or history: the result's own envelope lists one, when its call has no coverage row",
|
|
72
88
|
},
|
|
73
89
|
{
|
|
74
90
|
reason: 'declared-absent',
|
|
75
91
|
layer: 3,
|
|
76
92
|
class: 'not-sure',
|
|
93
|
+
source: 'calls',
|
|
77
94
|
reads: "coverageDeclared: an absence on a call of this turn; or history: an empty rowset inside a declared coverage() boundary, or an absence in the result's own envelope when its call has no coverage row (the one emptiness reader)",
|
|
78
95
|
},
|
|
79
96
|
{
|
|
80
97
|
reason: 'empty-undeclared',
|
|
81
98
|
layer: 3,
|
|
82
99
|
class: 'not-sure',
|
|
100
|
+
source: 'calls',
|
|
83
101
|
reads: 'history: an empty rowset (a top-level array, the app’s rowsAt key, or the dataset ticket left where those rows were, counting 0) whose call has no coverage row',
|
|
84
102
|
},
|
|
85
103
|
{
|
|
86
104
|
reason: 'period-not-held',
|
|
87
105
|
layer: 3,
|
|
88
106
|
class: 'not-sure',
|
|
107
|
+
source: 'calls',
|
|
89
108
|
reads: "findingsLedger: a period row of this turn with verdict 'not-held' — the store holds none of what the read asked for (and, when the tool declares a ToolPeriod, the inputs layer's argument row for the same call: who chose the period)",
|
|
90
109
|
},
|
|
91
110
|
{
|
|
92
111
|
reason: 'period-partly-held',
|
|
93
112
|
layer: 3,
|
|
94
113
|
class: 'not-sure',
|
|
114
|
+
source: 'calls',
|
|
95
115
|
reads: "findingsLedger: a period row of this turn with verdict 'partly-held'",
|
|
96
116
|
},
|
|
97
117
|
{
|
|
98
118
|
reason: 'period-unknown',
|
|
99
119
|
layer: 3,
|
|
100
120
|
class: 'not-sure',
|
|
121
|
+
source: 'calls',
|
|
101
122
|
reads: "findingsLedger: a period row of this turn with verdict 'unknown' — the tool declared held: 'unknown'",
|
|
102
123
|
},
|
|
103
124
|
{
|
|
104
125
|
reason: 'period-undeclared',
|
|
105
126
|
layer: 3,
|
|
106
127
|
class: 'not-sure',
|
|
128
|
+
source: 'calls',
|
|
107
129
|
reads: "findingsLedger: a period row of this turn with verdict 'undeclared' — the tool declares a ToolPeriod and the result declared no period",
|
|
108
130
|
},
|
|
109
131
|
{
|
|
110
132
|
reason: 'period-differs-from-asked',
|
|
111
133
|
layer: 3,
|
|
112
134
|
class: 'not-sure',
|
|
135
|
+
source: 'calls',
|
|
113
136
|
reads: "findingsLedger: a period row of this turn with differs (the time layer, step T8) — what the call read is not the range it asked for (missing: asked, not read; extra: read, not asked — TQ8: extra alone is 'not sure' too), or, for a window the model chose, not the person's window",
|
|
114
137
|
},
|
|
115
138
|
{
|
|
116
139
|
reason: 'period-beyond-retention',
|
|
117
140
|
layer: 3,
|
|
118
141
|
class: 'not-sure',
|
|
142
|
+
source: 'calls',
|
|
119
143
|
reads: 'findingsLedger: a period row of this turn with beyondRetention (the time layer, step T8) — the window was wholly older than the tool declares its source keeps: refused before dispatch, or read that way',
|
|
120
144
|
},
|
|
121
145
|
{
|
|
122
146
|
reason: 'sources-conflict',
|
|
123
147
|
layer: 3,
|
|
124
148
|
class: 'not-sure',
|
|
149
|
+
source: 'calls',
|
|
125
150
|
reads: 'findingsLedger: a conflict row whose witnesses name a call of this turn',
|
|
126
151
|
},
|
|
127
152
|
{
|
|
128
153
|
reason: 'value-unsupported',
|
|
129
154
|
layer: 4,
|
|
130
155
|
class: 'not-sure',
|
|
156
|
+
source: 'answer',
|
|
131
157
|
reads: 'unsupportedValues (revised: false)',
|
|
132
158
|
},
|
|
133
159
|
{
|
|
134
160
|
reason: 'value-survived-revision',
|
|
135
161
|
layer: 4,
|
|
136
162
|
class: 'not-sure',
|
|
163
|
+
source: 'answer',
|
|
137
164
|
reads: 'unsupportedValues (revised: true)',
|
|
138
165
|
},
|
|
139
166
|
{
|
|
140
167
|
reason: 'derived-from-reading',
|
|
141
168
|
layer: 4,
|
|
142
169
|
class: 'not-sure',
|
|
170
|
+
source: 'answer',
|
|
143
171
|
reads: "findingsLedger: a time-derived row of this turn — the answer states a time value no tool result carried that the library itself spelled from a reading of the person's words (an implied year, an offset, the end-of-grain minute, the served time line)",
|
|
144
172
|
},
|
|
145
|
-
{ reason: 'stopped-early', layer: 4, class: 'not-sure', reads: 'stoppedEarly' },
|
|
173
|
+
{ reason: 'stopped-early', layer: 4, class: 'not-sure', source: 'run', reads: 'stoppedEarly' },
|
|
146
174
|
{
|
|
147
175
|
reason: 'steps-unfinished',
|
|
148
176
|
layer: 4,
|
|
149
177
|
class: 'not-sure',
|
|
178
|
+
source: 'run',
|
|
150
179
|
reads: "findingsLedger: a steps-unfinished witness row of this turn (the answer came before the active skill's declared steps finished — filed while the answer layer is armed)",
|
|
151
180
|
},
|
|
152
181
|
{
|
|
153
182
|
reason: 'negative-prose-unverified',
|
|
154
183
|
layer: 4,
|
|
155
184
|
class: 'not-sure',
|
|
185
|
+
source: 'answer',
|
|
156
186
|
reads: 'findingsLedger: a negative-claim or negative-claim-note row of this turn; model prose never establishes a negative claim',
|
|
157
187
|
},
|
|
158
188
|
{
|
|
159
189
|
reason: 'claim-exceeds-search',
|
|
160
190
|
layer: 4,
|
|
161
191
|
class: 'not-sure',
|
|
192
|
+
source: 'answer',
|
|
162
193
|
reads: 'answerValidation.checks: a typed negative exceeded the admitted search',
|
|
163
194
|
},
|
|
164
195
|
{
|
|
165
196
|
reason: 'declaration-overclaimed',
|
|
166
197
|
layer: 3,
|
|
167
198
|
class: 'not-sure',
|
|
199
|
+
source: 'calls',
|
|
168
200
|
reads: 'answerValidation.checks: a tool refusal overstated the read',
|
|
169
201
|
},
|
|
170
202
|
{
|
|
171
203
|
reason: 'answer-check-failed',
|
|
172
204
|
layer: 4,
|
|
173
205
|
class: 'not-sure',
|
|
206
|
+
source: 'answer',
|
|
174
207
|
reads: "answerValidation: status 'failed'",
|
|
175
208
|
},
|
|
176
209
|
{
|
|
177
210
|
reason: 'check-unreachable',
|
|
178
211
|
class: 'not-sure',
|
|
212
|
+
source: 'run',
|
|
179
213
|
reads: "answerValidation: status 'unverified' (an armed check that could not reach a verdict), or a failed report that also counts unreachable checks or names a reason (a validator that did not finish)",
|
|
180
214
|
},
|
|
181
215
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasons.js","sourceRoot":"","sources":["../../../../../src/core/agent/assessment/reasons.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"reasons.js","sourceRoot":"","sources":["../../../../../src/core/agent/assessment/reasons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAoBH,sFAAsF;AACtF,MAAM,CAAC,MAAM,OAAO,GAA2B,MAAM,CAAC,MAAM,CAAC;IAC3D;QACE,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,KAAK,EACH,gJAAgJ;KACnJ;IACD;QACE,MAAM,EAAE,gBAAgB;QACxB,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,KAAK,EACH,yLAAyL;KAC5L;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,OAAO;QACf,KAAK,EACH,iNAAiN;KACpN;IACD;QACE,MAAM,EAAE,qBAAqB;QAC7B,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,OAAO;QACf,KAAK,EACH,0JAA0J;KAC7J;IACD;QACE,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,OAAO;QACf,KAAK,EACH,4LAA4L;KAC/L;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,OAAO;QACf,KAAK,EACH,8JAA8J;KACjK;IACD;QACE,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,CAAC;QACR,K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,mCAAmC;KAC3C;IACD;QACE,MAAM,EAAE,mBAAmB;QAC3B,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,KAAK;QACb,KAAK,EACH,mMAAmM;KACtM;CACF,CAAC,CAAC;AAEH,sCAAsC;AACtC,MAAM,UAAU,WAAW,CAAC,MAAwB;IAClD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IACvD,yFAAyF;IACzF,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,MAAM,GAAG,CAAC,CAAC;IAC9F,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* assessment/sources — what each reason rests on
|
|
3
|
+
* (`AnswerAssessment.reasons[].source`): specific calls, the answer itself, or
|
|
4
|
+
* the run as a whole.
|
|
5
|
+
*
|
|
6
|
+
* Pattern: a projection inside the one Fold (`assess.ts` · `assessAnswer`).
|
|
7
|
+
* The KIND is declared per reason (`reasons.ts` · `REASONS`); for a
|
|
8
|
+
* `calls` reason this module reads the calls off the very rows the
|
|
9
|
+
* reason's witnesses point at — a history result carries its call id,
|
|
10
|
+
* a committed row names its call — and the call's tool name off the
|
|
11
|
+
* same row, or off the run's `history` for a row that names only an id.
|
|
12
|
+
* It reads the committed record only, and adds nothing to it.
|
|
13
|
+
* Role: core/ layer, pure. Asked once per fired reason by the fold; every
|
|
14
|
+
* reader takes the source from the fold — the answer layer's line
|
|
15
|
+
* (`compose.ts` · `standingLineOf`) and the answer account's "How
|
|
16
|
+
* sure" counts (`answer-account/facts/howSure.ts`) — and never
|
|
17
|
+
* re-derives it.
|
|
18
|
+
* Emits: N/A.
|
|
19
|
+
*
|
|
20
|
+
* ## Names and ids only
|
|
21
|
+
*
|
|
22
|
+
* A source holds call ids and registered tool names, never a value, an
|
|
23
|
+
* argument or a result: the rows it reads hold more, and it copies two strings
|
|
24
|
+
* out of each.
|
|
25
|
+
*
|
|
26
|
+
* ## Which calls a row names
|
|
27
|
+
*
|
|
28
|
+
* - a tool result in `history` — its own call;
|
|
29
|
+
* - a coverage, argument, period or middleware row — its own call (the row's
|
|
30
|
+
* `toolCallId`, with the row's `toolName`);
|
|
31
|
+
* - a conflict row — the calls of the readings that disagree (`witnesses`);
|
|
32
|
+
* - a contingent row — the results the value came from (`carriers`), and an
|
|
33
|
+
* argument row behind `value-contingent` — the result it names (`result`):
|
|
34
|
+
* the reason is that a value came from results the model itself set aside;
|
|
35
|
+
* - an answer check that names its tool and not its call
|
|
36
|
+
* (`declaration-overclaimed`) — every call of that tool this turn: it may
|
|
37
|
+
* over-report, it never hides (the fold's rule for "rests on").
|
|
38
|
+
*
|
|
39
|
+
* A row that names no call, a call whose tool's name the record does not
|
|
40
|
+
* hold, and every entry of a list (a conflict's readings, a contingent value's
|
|
41
|
+
* carriers, an answer check's tools) that names no call — beside the entries
|
|
42
|
+
* that do — is COUNTED in `unnamed`, never dropped and never guessed. Only a
|
|
43
|
+
* known call id is said once.
|
|
44
|
+
*/
|
|
45
|
+
import type { AssessmentPointer, AssessmentReason, AssessmentReasonSource } from './types.js';
|
|
46
|
+
/** What the projection reads: the committed state, and this turn's results (for a tool-name join). */
|
|
47
|
+
export interface SourceRead {
|
|
48
|
+
readonly state: Readonly<Record<string, unknown>>;
|
|
49
|
+
readonly turnResults: readonly {
|
|
50
|
+
readonly toolCallId?: string;
|
|
51
|
+
readonly toolName?: string;
|
|
52
|
+
}[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What one fired reason rests on — its declared `kind`, and for `calls` the
|
|
56
|
+
* calls its witnesses' rows name, each once, in witness order.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* reasonSourceOf('declared-absent', 'calls', [historyPointer], read);
|
|
61
|
+
* // { kind: 'calls', calls: [{ toolCallId: 'c1', toolName: 'load_attachment' }] }
|
|
62
|
+
* reasonSourceOf('stopped-early', 'run', [statePointer('stoppedEarly')], read);
|
|
63
|
+
* // { kind: 'run' }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function reasonSourceOf(reason: AssessmentReason, kind: AssessmentReasonSource['kind'], witness: readonly AssessmentPointer[], read: SourceRead): AssessmentReasonSource;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* assessment/sources — what each reason rests on
|
|
3
|
+
* (`AnswerAssessment.reasons[].source`): specific calls, the answer itself, or
|
|
4
|
+
* the run as a whole.
|
|
5
|
+
*
|
|
6
|
+
* Pattern: a projection inside the one Fold (`assess.ts` · `assessAnswer`).
|
|
7
|
+
* The KIND is declared per reason (`reasons.ts` · `REASONS`); for a
|
|
8
|
+
* `calls` reason this module reads the calls off the very rows the
|
|
9
|
+
* reason's witnesses point at — a history result carries its call id,
|
|
10
|
+
* a committed row names its call — and the call's tool name off the
|
|
11
|
+
* same row, or off the run's `history` for a row that names only an id.
|
|
12
|
+
* It reads the committed record only, and adds nothing to it.
|
|
13
|
+
* Role: core/ layer, pure. Asked once per fired reason by the fold; every
|
|
14
|
+
* reader takes the source from the fold — the answer layer's line
|
|
15
|
+
* (`compose.ts` · `standingLineOf`) and the answer account's "How
|
|
16
|
+
* sure" counts (`answer-account/facts/howSure.ts`) — and never
|
|
17
|
+
* re-derives it.
|
|
18
|
+
* Emits: N/A.
|
|
19
|
+
*
|
|
20
|
+
* ## Names and ids only
|
|
21
|
+
*
|
|
22
|
+
* A source holds call ids and registered tool names, never a value, an
|
|
23
|
+
* argument or a result: the rows it reads hold more, and it copies two strings
|
|
24
|
+
* out of each.
|
|
25
|
+
*
|
|
26
|
+
* ## Which calls a row names
|
|
27
|
+
*
|
|
28
|
+
* - a tool result in `history` — its own call;
|
|
29
|
+
* - a coverage, argument, period or middleware row — its own call (the row's
|
|
30
|
+
* `toolCallId`, with the row's `toolName`);
|
|
31
|
+
* - a conflict row — the calls of the readings that disagree (`witnesses`);
|
|
32
|
+
* - a contingent row — the results the value came from (`carriers`), and an
|
|
33
|
+
* argument row behind `value-contingent` — the result it names (`result`):
|
|
34
|
+
* the reason is that a value came from results the model itself set aside;
|
|
35
|
+
* - an answer check that names its tool and not its call
|
|
36
|
+
* (`declaration-overclaimed`) — every call of that tool this turn: it may
|
|
37
|
+
* over-report, it never hides (the fold's rule for "rests on").
|
|
38
|
+
*
|
|
39
|
+
* A row that names no call, a call whose tool's name the record does not
|
|
40
|
+
* hold, and every entry of a list (a conflict's readings, a contingent value's
|
|
41
|
+
* carriers, an answer check's tools) that names no call — beside the entries
|
|
42
|
+
* that do — is COUNTED in `unnamed`, never dropped and never guessed. Only a
|
|
43
|
+
* known call id is said once.
|
|
44
|
+
*/
|
|
45
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
46
|
+
const str = (value) => typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
47
|
+
/** The row an RFC 6901 pointer's first segment indexes, in an array-valued key. */
|
|
48
|
+
function rowAt(state, key, path) {
|
|
49
|
+
const rows = state[key];
|
|
50
|
+
const index = Number(path.split('/')[1]);
|
|
51
|
+
return Array.isArray(rows) && Number.isInteger(index) ? rows[index] : undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* One reference per entry of a list of `{ toolCallId }` entries, in order. An
|
|
55
|
+
* entry that names no call is an ANONYMOUS reference — counted in `unnamed`,
|
|
56
|
+
* never dropped: a conflict whose one reading names its call and whose other
|
|
57
|
+
* does not still rests on both.
|
|
58
|
+
*/
|
|
59
|
+
function refsIn(list) {
|
|
60
|
+
if (!Array.isArray(list))
|
|
61
|
+
return [];
|
|
62
|
+
return list.map((entry) => {
|
|
63
|
+
const id = isRecord(entry) ? str(entry.toolCallId) : undefined;
|
|
64
|
+
return id === undefined ? {} : { id };
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** The calls one committed row names, read for `reason`. */
|
|
68
|
+
function callsOfRow(reason, row) {
|
|
69
|
+
if (!isRecord(row))
|
|
70
|
+
return [];
|
|
71
|
+
if (row.kind === 'conflict')
|
|
72
|
+
return refsIn(row.witnesses);
|
|
73
|
+
if (row.kind === 'contingent')
|
|
74
|
+
return refsIn(row.carriers);
|
|
75
|
+
if (reason === 'value-contingent' && row.kind === 'argument') {
|
|
76
|
+
const result = str(row.result);
|
|
77
|
+
return result === undefined ? [] : [{ id: result }];
|
|
78
|
+
}
|
|
79
|
+
const id = str(row.toolCallId);
|
|
80
|
+
const name = str(row.toolName);
|
|
81
|
+
return id === undefined && name === undefined
|
|
82
|
+
? []
|
|
83
|
+
: [{ ...(id !== undefined && { id }), ...(name !== undefined && { name }) }];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* An answer check that names the TOOLS it is about (`tools`) and no call —
|
|
87
|
+
* every call of each named tool among this turn's results. A tool no call of
|
|
88
|
+
* this turn ran, and an entry that is not a tool name, is an ANONYMOUS
|
|
89
|
+
* reference each: counted, never dropped beside the tools that matched.
|
|
90
|
+
*/
|
|
91
|
+
function callsOfCheck(check, read) {
|
|
92
|
+
if (!isRecord(check) || !Array.isArray(check.tools))
|
|
93
|
+
return [];
|
|
94
|
+
const names = [
|
|
95
|
+
...new Set(check.tools.flatMap((t) => (str(t) === undefined ? [] : [t]))),
|
|
96
|
+
];
|
|
97
|
+
const malformed = check.tools
|
|
98
|
+
.filter((t) => str(t) === undefined)
|
|
99
|
+
.map(() => ({}));
|
|
100
|
+
const matched = names.flatMap((name) => {
|
|
101
|
+
const calls = read.turnResults.filter((r) => r.toolName === name);
|
|
102
|
+
return calls.length === 0
|
|
103
|
+
? [{ name }]
|
|
104
|
+
: calls.map((r) => ({ ...(r.toolCallId !== undefined && { id: r.toolCallId }), name }));
|
|
105
|
+
});
|
|
106
|
+
return [...matched, ...malformed];
|
|
107
|
+
}
|
|
108
|
+
/** The calls one witness names. */
|
|
109
|
+
function callsOfWitness(reason, w, read) {
|
|
110
|
+
if (w.kind === 'history') {
|
|
111
|
+
const message = Array.isArray(read.state.history) ? read.state.history[w.index] : undefined;
|
|
112
|
+
const name = isRecord(message) ? str(message.toolName) : undefined;
|
|
113
|
+
return w.toolCallId === undefined && name === undefined
|
|
114
|
+
? []
|
|
115
|
+
: [
|
|
116
|
+
{
|
|
117
|
+
...(w.toolCallId !== undefined && { id: w.toolCallId }),
|
|
118
|
+
...(name !== undefined && { name }),
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
if (w.key === 'answerValidation') {
|
|
123
|
+
// `/checks/<index>` — the check row the reason fired on.
|
|
124
|
+
const [, list, at] = w.path.split('/');
|
|
125
|
+
const report = read.state.answerValidation;
|
|
126
|
+
const checks = isRecord(report) && list === 'checks' ? report.checks : undefined;
|
|
127
|
+
return Array.isArray(checks) ? callsOfCheck(checks[Number(at)], read) : [];
|
|
128
|
+
}
|
|
129
|
+
return callsOfRow(reason, rowAt(read.state, w.key, w.path));
|
|
130
|
+
}
|
|
131
|
+
/** Every call id → its tool's registered name, as `history` holds it (a result, else the call). */
|
|
132
|
+
function toolNamesOf(state) {
|
|
133
|
+
const names = new Map();
|
|
134
|
+
const history = Array.isArray(state.history) ? state.history : [];
|
|
135
|
+
for (const m of history) {
|
|
136
|
+
if (!isRecord(m))
|
|
137
|
+
continue;
|
|
138
|
+
const id = str(m.toolCallId);
|
|
139
|
+
const name = str(m.toolName);
|
|
140
|
+
if (m.role === 'tool' && id !== undefined && name !== undefined)
|
|
141
|
+
names.set(id, name);
|
|
142
|
+
if (!Array.isArray(m.toolCalls))
|
|
143
|
+
continue;
|
|
144
|
+
for (const call of m.toolCalls) {
|
|
145
|
+
const callId = isRecord(call) ? str(call.id) : undefined;
|
|
146
|
+
const callName = isRecord(call) ? str(call.name) : undefined;
|
|
147
|
+
if (callId !== undefined && callName !== undefined && !names.has(callId)) {
|
|
148
|
+
names.set(callId, callName);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return names;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* What one fired reason rests on — its declared `kind`, and for `calls` the
|
|
156
|
+
* calls its witnesses' rows name, each once, in witness order.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* reasonSourceOf('declared-absent', 'calls', [historyPointer], read);
|
|
161
|
+
* // { kind: 'calls', calls: [{ toolCallId: 'c1', toolName: 'load_attachment' }] }
|
|
162
|
+
* reasonSourceOf('stopped-early', 'run', [statePointer('stoppedEarly')], read);
|
|
163
|
+
* // { kind: 'run' }
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export function reasonSourceOf(reason, kind, witness, read) {
|
|
167
|
+
if (kind !== 'calls')
|
|
168
|
+
return { kind };
|
|
169
|
+
let names;
|
|
170
|
+
const nameOf = (id) => (names ??= toolNamesOf(read.state)).get(id);
|
|
171
|
+
const calls = [];
|
|
172
|
+
const listed = new Set();
|
|
173
|
+
// A call the record names by id but not by tool — counted once per id.
|
|
174
|
+
const nameless = new Set();
|
|
175
|
+
// A reference that names no call — a row that names none, or a list entry with no
|
|
176
|
+
// call id beside entries that have one — counted once each, never merged.
|
|
177
|
+
let anonymous = 0;
|
|
178
|
+
for (const w of witness) {
|
|
179
|
+
const refs = callsOfWitness(reason, w, read);
|
|
180
|
+
if (refs.length === 0)
|
|
181
|
+
anonymous += 1;
|
|
182
|
+
for (const ref of refs) {
|
|
183
|
+
if (ref.id === undefined) {
|
|
184
|
+
anonymous += 1;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (listed.has(ref.id) || nameless.has(ref.id))
|
|
188
|
+
continue;
|
|
189
|
+
const toolName = ref.name ?? nameOf(ref.id);
|
|
190
|
+
if (toolName === undefined) {
|
|
191
|
+
nameless.add(ref.id);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
listed.add(ref.id);
|
|
195
|
+
calls.push({ toolCallId: ref.id, toolName });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const unnamed = nameless.size + anonymous;
|
|
199
|
+
return { kind: 'calls', calls, ...(unnamed > 0 && { unnamed }) };
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../../../src/core/agent/assessment/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAIH,MAAM,QAAQ,GAAG,CAAC,KAAc,EAA8C,EAAE,CAC9E,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,MAAM,GAAG,GAAG,CAAC,KAAc,EAAsB,EAAE,CACjD,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAcpE,mFAAmF;AACnF,SAAS,KAAK,CAAC,KAAwC,EAAE,GAAW,EAAE,IAAY;IAChF,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC;AAED;;;;;GAKG;AACH,SAAS,MAAM,CAAC,IAAa;IAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CA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AI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;gBACzB,SAAS,IAAI,CAAC,CAAC;gBACf,SAAS;YACX,CAAC;YACD,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,SAAS;YACzD,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC5C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACrB,SAAS;YACX,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACnB,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC;IAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC"}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* at build from the agent's arms) — runs `assessAnswer` over them,
|
|
9
9
|
* and serves the result three ways: `answerAssessment` for
|
|
10
10
|
* PrepareFinal's `turn_end.answerAssessment`, one
|
|
11
|
-
* `agentfootprint.answer.assessed` event, and — under its own arm
|
|
12
|
-
* one line for the person
|
|
11
|
+
* `agentfootprint.answer.assessed` event, and — under its own arm,
|
|
12
|
+
* for the standings its mode says it for — one line for the person
|
|
13
|
+
* (`compose.ts` · `standingLineOf`, `standingLineSaid`).
|
|
13
14
|
* Role: core/ layer. Loaded through `import()` by the mount
|
|
14
15
|
* (`honesty/mounts.ts` · `startFinalBranch`) on the first armed
|
|
15
16
|
* answer — the optional-family law — so a plain agent's graph never
|
|
@@ -43,14 +44,26 @@
|
|
|
43
44
|
*/
|
|
44
45
|
import type { TypedScope } from 'footprintjs';
|
|
45
46
|
import type { AgentState } from '../types.js';
|
|
47
|
+
import { type StandingLineWhen } from './compose.js';
|
|
46
48
|
/** What the mount hands the stage — build-time facts, never scope. */
|
|
47
49
|
export interface AnswerStageDeps {
|
|
48
50
|
/** The committed keys the fold reads — only those this agent's arms can write. */
|
|
49
51
|
readonly reads: readonly string[];
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
+
/**
|
|
53
|
+
* `.answerLayer({ standingLine })` — compose the line for the person, in
|
|
54
|
+
* the answers its mode says it for (`compose.ts` · `standingLineSaid`;
|
|
55
|
+
* `standingLine: true` is `'always'`). Absent → no line.
|
|
56
|
+
*/
|
|
57
|
+
readonly standingLine?: StandingLineWhen;
|
|
52
58
|
/** `.answerValidation()` is armed: an answer its report withholds is never assessed. */
|
|
53
59
|
readonly validated?: true;
|
|
60
|
+
/**
|
|
61
|
+
* The app's words for a call of a tool — its `displayName`, read through the
|
|
62
|
+
* agent's own tools (`lib/displayName.ts` · `readDisplayName`). Present only
|
|
63
|
+
* on an agent where a tool can declare one; the line then names a reason's
|
|
64
|
+
* calls in those words. Absent → the line is the bytes it always was.
|
|
65
|
+
*/
|
|
66
|
+
readonly displayNameOf?: (toolName: string) => string | undefined;
|
|
54
67
|
}
|
|
55
68
|
/**
|
|
56
69
|
* The answer layer's stage: fold, file, announce — and, under its own arm,
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* at build from the agent's arms) — runs `assessAnswer` over them,
|
|
9
9
|
* and serves the result three ways: `answerAssessment` for
|
|
10
10
|
* PrepareFinal's `turn_end.answerAssessment`, one
|
|
11
|
-
* `agentfootprint.answer.assessed` event, and — under its own arm
|
|
12
|
-
* one line for the person
|
|
11
|
+
* `agentfootprint.answer.assessed` event, and — under its own arm,
|
|
12
|
+
* for the standings its mode says it for — one line for the person
|
|
13
|
+
* (`compose.ts` · `standingLineOf`, `standingLineSaid`).
|
|
13
14
|
* Role: core/ layer. Loaded through `import()` by the mount
|
|
14
15
|
* (`honesty/mounts.ts` · `startFinalBranch`) on the first armed
|
|
15
16
|
* answer — the optional-family law — so a plain agent's graph never
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
import { typedEmit } from '../../../recorders/core/typedEmit.js';
|
|
45
46
|
import { validatedAnswerMayDeliver } from '../stages/prepareFinal.js';
|
|
46
47
|
import { assessAnswer } from './assess.js';
|
|
47
|
-
import { assessmentDataOf, assumedValuesSourceOf, rewrittenBehind, standingLineOf, } from './compose.js';
|
|
48
|
+
import { assessmentDataOf, assumedValuesSourceOf, rewrittenBehind, sourcesByReason, standingDisplayNames, standingLineOf, standingLineSaid, } from './compose.js';
|
|
48
49
|
/**
|
|
49
50
|
* The fold's record, read off the final branch's scope: each key in `reads`
|
|
50
51
|
* that holds a value, as the committed object itself (`$getValue` — never a
|
|
@@ -97,10 +98,20 @@ export async function assessAnswerStage(scope, deps) {
|
|
|
97
98
|
iteration: scope.iteration,
|
|
98
99
|
...assessmentDataOf(assessed),
|
|
99
100
|
});
|
|
100
|
-
|
|
101
|
+
// The line's mode decides whether THIS answer gets one — the data above went out either way.
|
|
102
|
+
if (deps.standingLine === undefined || !standingLineSaid(deps.standingLine, assessed.standing)) {
|
|
101
103
|
return;
|
|
104
|
+
}
|
|
102
105
|
const data = assessmentDataOf(assessed);
|
|
103
106
|
const assumed = await assumedValuesOf(data, record);
|
|
104
|
-
|
|
107
|
+
// The app's words for the calls the reasons rest on — only tools that declare them.
|
|
108
|
+
const displayNames = deps.displayNameOf === undefined
|
|
109
|
+
? new Map()
|
|
110
|
+
: standingDisplayNames(assessed, assumed, deps.displayNameOf);
|
|
111
|
+
scope.answerStandingLine = standingLineOf(data, assumed, rewrittenBehind(assessed), displayNames.size > 0 ? { sources: sourcesByReason(assessed), displayNames } : undefined);
|
|
112
|
+
// Filed for PrepareFinal (`turn_end.standingLineNames`): the words the record keeps, so a
|
|
113
|
+
// reader rebuilds the very line (`answer-account/account.ts` · `appendedStandingLine`).
|
|
114
|
+
if (displayNames.size > 0)
|
|
115
|
+
scope.answerStandingNames = Object.fromEntries(displayNames);
|
|
105
116
|
}
|
|
106
117
|
//# sourceMappingURL=stage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.js","sourceRoot":"","sources":["../../../../../src/core/agent/assessment/stage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stage.js","sourceRoot":"","sources":["../../../../../src/core/agent/assessment/stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,gBAAgB,GAIjB,MAAM,cAAc,CAAC;AAuBtB;;;;;GAKG;AACH,SAAS,iBAAiB,CACxB,KAA6B,EAC7B,KAAwB;IAExB,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,eAAe,CAC5B,IAA0B,EAC1B,MAAyC;IAEzC,MAAM,MAAM,GAAG,qBAAqB,CAA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AC,CAAC;IACxC,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpD,oFAAoF;IACpF,MAAM,YAAY,GAChB,IAAI,CAAC,aAAa,KAAK,SAAS;QAC9B,CAAC,CAAC,IAAI,GAAG,EAAkB;QAC3B,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAClE,KAAK,CAAC,kBAAkB,GAAG,cAAc,CACvC,IAAI,EACJ,OAAO,EACP,eAAe,CAAC,QAAQ,CAAC,EACzB,YAAY,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS,CACzF,CAAC;IACF,0FAA0F;IAC1F,wFAAwF;IACxF,IAAI,YAAY,CAAC,IAAI,GAAG,CAAC;QAAE,KAAK,CAAC,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -156,6 +156,41 @@ export type AssessmentReason = 'asked' | 'argument-asked' | 'argument-assumed' |
|
|
|
156
156
|
export type AssessmentCheck = 'argument-rules' | 'argument-sources' | 'result-period' | 'tool-coverage' | 'result-shape' | 'names-and-numbers' | 'answer-checks';
|
|
157
157
|
/** The honesty layer a reason or a check belongs to: 1 choose · 2 inputs · 3 results · 4 answer. */
|
|
158
158
|
export type HonestyLayer = 1 | 2 | 3 | 4;
|
|
159
|
+
/**
|
|
160
|
+
* What a reason rests on — names and ids only, never a value or an argument.
|
|
161
|
+
* The KIND is declared once per reason (`reasons.ts` · `REASONS`), never
|
|
162
|
+
* inferred per run; the calls are read off the rows the reason's witnesses
|
|
163
|
+
* point at (`sources.ts` · `reasonSourceOf`) — a projection of what is
|
|
164
|
+
* recorded, never a guess at which claim leans on which call:
|
|
165
|
+
*
|
|
166
|
+
* - `calls` — specific tool calls: the calls those rows name, each once, in
|
|
167
|
+
* witness order (`{ toolCallId, toolName }` — the record's own ids and the
|
|
168
|
+
* tool's registered name). `unnamed` counts the calls the rows rest on that
|
|
169
|
+
* the record does not name in full (no call id, or no tool name for it),
|
|
170
|
+
* present only when there is one — so a `calls` reason with an empty list
|
|
171
|
+
* still says it rests on calls, and an empty list never stands for "the
|
|
172
|
+
* run";
|
|
173
|
+
* - `answer` — the answer itself: a value in it no evidence carried, a claim
|
|
174
|
+
* in it, a check on its bytes;
|
|
175
|
+
* - `run` — the run as a whole: it paused for a person, a limit stopped it,
|
|
176
|
+
* it skipped declared steps, a check could not reach a verdict.
|
|
177
|
+
*
|
|
178
|
+
* Naming a source never changes the standing, and never says the rest of the
|
|
179
|
+
* answer is unaffected: which claim depends on which call is not on the
|
|
180
|
+
* record.
|
|
181
|
+
*/
|
|
182
|
+
export type AssessmentReasonSource = {
|
|
183
|
+
readonly kind: 'calls';
|
|
184
|
+
readonly calls: readonly {
|
|
185
|
+
readonly toolCallId: string;
|
|
186
|
+
readonly toolName: string;
|
|
187
|
+
}[];
|
|
188
|
+
readonly unnamed?: number;
|
|
189
|
+
} | {
|
|
190
|
+
readonly kind: 'answer';
|
|
191
|
+
} | {
|
|
192
|
+
readonly kind: 'run';
|
|
193
|
+
};
|
|
159
194
|
/**
|
|
160
195
|
* One answer's assessment, folded from its committed record.
|
|
161
196
|
*
|
|
@@ -181,6 +216,8 @@ export interface AnswerAssessment {
|
|
|
181
216
|
/** The honesty layer; absent for a reason that belongs to every layer (`asked`, `check-unreachable`). */
|
|
182
217
|
readonly layer?: HonestyLayer;
|
|
183
218
|
readonly witness: readonly AssessmentPointer[];
|
|
219
|
+
/** What it rests on — specific calls, the answer, or the run (see {@link AssessmentReasonSource}). */
|
|
220
|
+
readonly source: AssessmentReasonSource;
|
|
184
221
|
}[];
|
|
185
222
|
/** The row `known` stands on — present only when one does. */
|
|
186
223
|
readonly support?: {
|