agentfootprint 10.5.1 → 10.6.1
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/CAPABILITIES.md +1 -0
- package/dist/answer-validation/index.js +3 -1
- package/dist/answer-validation/index.js.map +1 -1
- package/dist/answer-validation/requirements.js +107 -0
- package/dist/answer-validation/requirements.js.map +1 -0
- package/dist/core/Agent.js +1 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/esm/answer-validation/index.d.ts +1 -0
- package/dist/esm/answer-validation/index.js +1 -0
- package/dist/esm/answer-validation/index.js.map +1 -1
- package/dist/esm/answer-validation/requirements.d.ts +33 -0
- package/dist/esm/answer-validation/requirements.js +103 -0
- package/dist/esm/answer-validation/requirements.js.map +1 -0
- package/dist/esm/core/Agent.js +1 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/events/dispatcher.js +1 -1
- package/dist/esm/events/dispatcher.js.map +1 -1
- package/dist/esm/hosting/errors.js +1 -0
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +3 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +46 -17
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/events/dispatcher.js +1 -1
- package/dist/events/dispatcher.js.map +1 -1
- package/dist/hosting/errors.js +1 -0
- package/dist/hosting/errors.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js +46 -17
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/types/answer-validation/index.d.ts +1 -0
- package/dist/types/answer-validation/index.d.ts.map +1 -1
- package/dist/types/answer-validation/requirements.d.ts +34 -0
- package/dist/types/answer-validation/requirements.d.ts.map +1 -0
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts +3 -1
- package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Pure prerequisite checks over caller-authenticated producer reports. No IO or value comparison. */
|
|
2
|
+
import { readRequirementResults, REQUIREMENT_RESULT_LIMITS, } from 'foottrace';
|
|
3
|
+
import { copyJson, ownData } from '../lib/boundedJson.js';
|
|
4
|
+
const POLICY_BYTES = 16 * 1024;
|
|
5
|
+
const CHECK_ID_CHARACTERS = 128;
|
|
6
|
+
function ref(value, maximum = REQUIREMENT_RESULT_LIMITS.name) {
|
|
7
|
+
if (typeof value !== 'string' ||
|
|
8
|
+
value.length === 0 ||
|
|
9
|
+
value.length > maximum ||
|
|
10
|
+
/\s/u.test(value))
|
|
11
|
+
throw new Error('Invalid reference.');
|
|
12
|
+
for (let index = 0; index < value.length; index++) {
|
|
13
|
+
const code = value.charCodeAt(index);
|
|
14
|
+
if (code <= 31 || (code >= 127 && code <= 159))
|
|
15
|
+
throw new Error('Invalid reference.');
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
/** Fixed diagnostics: never retain a hostile value or the exception raised while inspecting it. */
|
|
20
|
+
function readPolicy(value) {
|
|
21
|
+
try {
|
|
22
|
+
const source = ownData(value, ['claimRef', 'findingRef', 'windowRef', 'requirementRefs']);
|
|
23
|
+
if (!Array.isArray(source.requirementRefs))
|
|
24
|
+
throw new Error();
|
|
25
|
+
const length = Object.getOwnPropertyDescriptor(source.requirementRefs, 'length')
|
|
26
|
+
?.value;
|
|
27
|
+
if (typeof length !== 'number' || length < 1 || length > REQUIREMENT_RESULT_LIMITS.refs)
|
|
28
|
+
throw new Error();
|
|
29
|
+
const copied = ownData(copyJson(source, POLICY_BYTES, true));
|
|
30
|
+
const copiedRefs = copied.requirementRefs;
|
|
31
|
+
// Preflight limits the read; only the detached copy supplies admitted policy facts.
|
|
32
|
+
if (!Array.isArray(copiedRefs) ||
|
|
33
|
+
copiedRefs.length < 1 ||
|
|
34
|
+
copiedRefs.length > REQUIREMENT_RESULT_LIMITS.refs)
|
|
35
|
+
throw new Error();
|
|
36
|
+
const requirementRefs = copiedRefs.map((item) => ref(item));
|
|
37
|
+
if (new Set(requirementRefs).size !== requirementRefs.length)
|
|
38
|
+
throw new Error();
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
claimRef: ref(copied.claimRef, CHECK_ID_CHARACTERS),
|
|
41
|
+
findingRef: ref(copied.findingRef),
|
|
42
|
+
windowRef: ref(copied.windowRef),
|
|
43
|
+
requirementRefs: Object.freeze(requirementRefs),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw Object.assign(new TypeError('Invalid claim requirement policy.'), {
|
|
48
|
+
code: 'ERR_CLAIM_REQUIREMENT_POLICY',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function assessment(claimRef, resultRefs, reason) {
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
check: Object.freeze({
|
|
55
|
+
id: claimRef,
|
|
56
|
+
disposition: reason === undefined ? 'checked-pass' : 'unreachable',
|
|
57
|
+
...(reason === undefined ? {} : { reason }),
|
|
58
|
+
}),
|
|
59
|
+
requirementResultRefs: Object.freeze([...resultRefs]),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check every expected prerequisite for one exact claim/finding/window binding.
|
|
64
|
+
* Any same-scope unresolved report affecting this claim denies it, including an
|
|
65
|
+
* extra obligation; a satisfied report never overrides that denial. Missing
|
|
66
|
+
* expected obligations are unreachable, not a successful empty check.
|
|
67
|
+
*
|
|
68
|
+
* The host must authenticate the producer and current query/run/scope, authorize
|
|
69
|
+
* receipt access and establish domain validity BEFORE supplying results. The
|
|
70
|
+
* public Foottrace reader admits structure only; neither it nor this helper
|
|
71
|
+
* verifies provenance, freshness, a claim's value, or permission to disclose it.
|
|
72
|
+
* Use the returned check only when the candidate actually asserts this claim.
|
|
73
|
+
* Requirement result IDs are selectors, never artifact evidence references.
|
|
74
|
+
*
|
|
75
|
+
* A malformed host policy throws code ERR_CLAIM_REQUIREMENT_POLICY. Malformed
|
|
76
|
+
* receipt sets produce unreachable/invalid-data without exposing parser errors.
|
|
77
|
+
*/
|
|
78
|
+
export function checkClaimRequirements(policy, results) {
|
|
79
|
+
const expected = readPolicy(policy);
|
|
80
|
+
let admitted;
|
|
81
|
+
try {
|
|
82
|
+
admitted = readRequirementResults(results);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return assessment(expected.claimRef, [], 'invalid-data');
|
|
86
|
+
}
|
|
87
|
+
const affected = admitted.filter((result) => result.affects.includes(expected.claimRef));
|
|
88
|
+
const applicable = affected
|
|
89
|
+
.filter((result) => result.findingRef === expected.findingRef && result.windowRef === expected.windowRef)
|
|
90
|
+
.sort((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0));
|
|
91
|
+
const resultRefs = applicable.map((result) => result.id);
|
|
92
|
+
const unresolved = applicable.find((result) => result.state === 'unresolved');
|
|
93
|
+
if (unresolved?.state === 'unresolved')
|
|
94
|
+
return assessment(expected.claimRef, resultRefs, unresolved.reason);
|
|
95
|
+
for (const requirementRef of expected.requirementRefs) {
|
|
96
|
+
if (!applicable.some((result) => result.requirementRef === requirementRef)) {
|
|
97
|
+
const foreign = affected.some((result) => result.requirementRef === requirementRef);
|
|
98
|
+
return assessment(expected.claimRef, resultRefs, foreign ? 'incompatible' : 'not-collected');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return assessment(expected.claimRef, resultRefs);
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=requirements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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idationConfig !== undefined || governsOutput) && {
|
|
4677
4677
|
suppressDraftTokens: true,
|
|
4678
|
+
withholdDraftContent: true,
|
|
4678
4679
|
}),
|
|
4679
|
-
...(governsOutput && { withholdDraftContent: true }),
|
|
4680
4680
|
// Tool choice by classifier (9.105.0): the outcome row after the reply.
|
|
4681
4681
|
...(this.toolChoiceOptions !== undefined && { toolChoice: true }),
|
|
4682
4682
|
// The declared ontology (9.106.0): the piece served from the run
|