agentfootprint 9.63.0 → 9.65.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.
Files changed (87) hide show
  1. package/dist/adapters/hosting/foundryResponses.js +110 -0
  2. package/dist/adapters/hosting/foundryResponses.js.map +1 -0
  3. package/dist/adapters/hosting/responsesWire.js +322 -0
  4. package/dist/adapters/hosting/responsesWire.js.map +1 -0
  5. package/dist/adapters/observability/otel.js +5 -2
  6. package/dist/adapters/observability/otel.js.map +1 -1
  7. package/dist/core/agent/coverage/absent.js +14 -11
  8. package/dist/core/agent/coverage/absent.js.map +1 -1
  9. package/dist/core/agent/coverage/evidence.js +77 -34
  10. package/dist/core/agent/coverage/evidence.js.map +1 -1
  11. package/dist/core/agent/evidence/evidenceIndex.js +15 -14
  12. package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
  13. package/dist/core/agent/toolArgsValidation.js +142 -18
  14. package/dist/core/agent/toolArgsValidation.js.map +1 -1
  15. package/dist/esm/adapters/hosting/foundryResponses.d.ts +89 -0
  16. package/dist/esm/adapters/hosting/foundryResponses.js +106 -0
  17. package/dist/esm/adapters/hosting/foundryResponses.js.map +1 -0
  18. package/dist/esm/adapters/hosting/responsesWire.d.ts +75 -0
  19. package/dist/esm/adapters/hosting/responsesWire.js +316 -0
  20. package/dist/esm/adapters/hosting/responsesWire.js.map +1 -0
  21. package/dist/esm/adapters/observability/otel.js +5 -2
  22. package/dist/esm/adapters/observability/otel.js.map +1 -1
  23. package/dist/esm/core/agent/coverage/absent.d.ts +14 -11
  24. package/dist/esm/core/agent/coverage/absent.js +14 -11
  25. package/dist/esm/core/agent/coverage/absent.js.map +1 -1
  26. package/dist/esm/core/agent/coverage/evidence.d.ts +52 -28
  27. package/dist/esm/core/agent/coverage/evidence.js +77 -34
  28. package/dist/esm/core/agent/coverage/evidence.js.map +1 -1
  29. package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +8 -7
  30. package/dist/esm/core/agent/evidence/evidenceIndex.js +15 -14
  31. package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
  32. package/dist/esm/core/agent/toolArgsValidation.d.ts +62 -17
  33. package/dist/esm/core/agent/toolArgsValidation.js +142 -18
  34. package/dist/esm/core/agent/toolArgsValidation.js.map +1 -1
  35. package/dist/esm/core/agent/types.d.ts +9 -4
  36. package/dist/esm/events/payloads.d.ts +9 -0
  37. package/dist/esm/hosting/errors.d.ts +43 -0
  38. package/dist/esm/hosting/errors.js +52 -0
  39. package/dist/esm/hosting/errors.js.map +1 -1
  40. package/dist/esm/hosting/httpHost.d.ts +133 -4
  41. package/dist/esm/hosting/httpHost.js +120 -22
  42. package/dist/esm/hosting/httpHost.js.map +1 -1
  43. package/dist/esm/hosting/index.d.ts +2 -2
  44. package/dist/esm/hosting/index.js +1 -1
  45. package/dist/esm/hosting/index.js.map +1 -1
  46. package/dist/esm/hosting-providers.d.ts +17 -0
  47. package/dist/esm/hosting-providers.js +19 -0
  48. package/dist/esm/hosting-providers.js.map +1 -1
  49. package/dist/esm/index.d.ts +1 -1
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/hosting/errors.js +55 -1
  52. package/dist/hosting/errors.js.map +1 -1
  53. package/dist/hosting/httpHost.js +119 -21
  54. package/dist/hosting/httpHost.js.map +1 -1
  55. package/dist/hosting/index.js +4 -2
  56. package/dist/hosting/index.js.map +1 -1
  57. package/dist/hosting-providers.js +30 -1
  58. package/dist/hosting-providers.js.map +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/types/adapters/hosting/foundryResponses.d.ts +90 -0
  61. package/dist/types/adapters/hosting/foundryResponses.d.ts.map +1 -0
  62. package/dist/types/adapters/hosting/responsesWire.d.ts +76 -0
  63. package/dist/types/adapters/hosting/responsesWire.d.ts.map +1 -0
  64. package/dist/types/adapters/observability/otel.d.ts.map +1 -1
  65. package/dist/types/core/agent/coverage/absent.d.ts +14 -11
  66. package/dist/types/core/agent/coverage/absent.d.ts.map +1 -1
  67. package/dist/types/core/agent/coverage/evidence.d.ts +52 -28
  68. package/dist/types/core/agent/coverage/evidence.d.ts.map +1 -1
  69. package/dist/types/core/agent/evidence/evidenceIndex.d.ts +8 -7
  70. package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -1
  71. package/dist/types/core/agent/toolArgsValidation.d.ts +62 -17
  72. package/dist/types/core/agent/toolArgsValidation.d.ts.map +1 -1
  73. package/dist/types/core/agent/types.d.ts +9 -4
  74. package/dist/types/core/agent/types.d.ts.map +1 -1
  75. package/dist/types/events/payloads.d.ts +9 -0
  76. package/dist/types/events/payloads.d.ts.map +1 -1
  77. package/dist/types/hosting/errors.d.ts +43 -0
  78. package/dist/types/hosting/errors.d.ts.map +1 -1
  79. package/dist/types/hosting/httpHost.d.ts +133 -4
  80. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  81. package/dist/types/hosting/index.d.ts +2 -2
  82. package/dist/types/hosting/index.d.ts.map +1 -1
  83. package/dist/types/hosting-providers.d.ts +17 -0
  84. package/dist/types/hosting-providers.d.ts.map +1 -1
  85. package/dist/types/index.d.ts +1 -1
  86. package/dist/types/index.d.ts.map +1 -1
  87. package/package.json +1 -1
@@ -26,40 +26,79 @@
26
26
  * machine**, and adding a primitive whose purpose is to make failed lookups
27
27
  * informative would have made it cheaper still.
28
28
  *
29
- * So an absence grounds its COVERAGE and nothing else. `checked`,
30
- * `not_checked` and `cannot_cover` are the tool's own words about the world —
31
- * a fabric name, a collector, a window — and they are exactly what an answer
32
- * built on an absence should be allowed to cite. `looked_for`, `try_instead`,
33
- * the note and the marker are not.
34
- *
35
- * The consequence is deliberate and worth stating: if the USER named the
36
- * thing, it is exempt anyway (their message is the exempt corpus), so a real
37
- * question about a real port is unaffected. Only a value that appears *for
38
- * the first time* in an absence loses its grounding — which is the only case
39
- * where it was never evidence to begin with.
29
+ * ## The line, and where it actually falls
30
+ *
31
+ * The first cut of this file drew the line at the coverage lists. That was too
32
+ * narrow, and the field said so: a share-lookup tool returned its absence with
33
+ * the answer attached — an extra `known_shares` key holding the 40 real share
34
+ * names on the filer — and a `try_instead` telling the model to pick one. The
35
+ * model did exactly that, and the gate called the share it picked ungrounded.
36
+ * Following the tool's own advice produced a flagged answer, which makes the
37
+ * advice worthless and the gate wrong.
38
+ *
39
+ * So the line is not "coverage vs everything else". It is **tool-authored
40
+ * knowledge vs caller echo**:
41
+ *
42
+ * • Everything a recognized absence carries is the TOOL speaking about the
43
+ * world — the coverage lists, an extra key like `known_shares`, the
44
+ * author's `try_instead`, the library's own note. Tool knowledge is
45
+ * precisely what the corpus is for, so all of it grounds.
46
+ * • `looked_for` is the one field that quotes the REQUEST rather than
47
+ * stating what the tool knows. It never grounds. See
48
+ * {@link CALLER_ECHO_FIELD}.
49
+ *
50
+ * This widens leniency — the gate accuses less — which is the safe direction
51
+ * on an accusation boundary: a missed fabrication costs a value nobody
52
+ * checked, a false accusation costs a correct answer and a real turn.
53
+ *
54
+ * The consequence of the exclusion is deliberate and worth stating: if the
55
+ * USER named the thing, it is exempt anyway (their message is the exempt
56
+ * corpus), so a real question about a real port is unaffected. Only a value
57
+ * that appears *for the first time* in an absence's `looked_for` loses its
58
+ * grounding — which is the only case where it was never evidence to begin
59
+ * with.
40
60
  *
41
61
  * ## What this does NOT close, said plainly
42
62
  *
43
- * The whitelist rests on "coverage is the tool's own words about the world".
44
- * An author who interpolates an unvalidated argument into a coverage entry —
45
- * a `checked` line built by string-interpolating the `switch` argument the
46
- * model passed — puts a model-supplied token back into the corpus through the
47
- * one list this file admits. That is narrower than the hole it closes (the
48
- * author chose to echo, rather than the primitive echoing by design), and it
49
- * is not detectable from here: this library cannot tell which characters of a
50
- * sentence a tool composed and which it copied. The guidance is on the door
51
- * itself — interpolate identifiers you RESOLVED, not identifiers you were
52
- * handed. It is also the general limit of the evidence corpus, not a new one:
53
- * any tool that echoes its arguments into its result has always grounded
54
- * them.
63
+ * The rule rests on "everything but `looked_for` is the tool's own words about
64
+ * the world". An author who interpolates an unvalidated argument into any
65
+ * other field — a `checked` line built by string-interpolating the `switch`
66
+ * argument the model passed, an extra key echoing the request back — puts a
67
+ * model-supplied token into the corpus by hand. That is narrower than the hole
68
+ * this file closes (the author chose to echo, rather than the primitive
69
+ * echoing by design), and it is not detectable from here: this library cannot
70
+ * tell which characters of a sentence a tool composed and which it copied. The
71
+ * guidance is on the door itself — interpolate identifiers you RESOLVED, not
72
+ * identifiers you were handed. It is also the general limit of the evidence
73
+ * corpus, not a new one: any tool that echoes its arguments into its result
74
+ * has always grounded them.
55
75
  */
56
76
  Object.defineProperty(exports, "__esModule", { value: true });
57
77
  exports.absenceEvidenceProjection = void 0;
58
78
  const absent_js_1 = require("./absent.js");
59
79
  const ledger_js_1 = require("./ledger.js");
60
- /** The coverage lists of one absence, as the only thing it grounds. */
61
- function coverageOnly(absence) {
62
- return [absence.checked ?? [], absence.not_checked ?? [], absence.cannot_cover ?? []];
80
+ /**
81
+ * The ONE field of an absence that is withheld from the evidence corpus.
82
+ *
83
+ * Tool-authored knowledge grounds; caller echoes never do. Every other field —
84
+ * the coverage lists, the note, `try_instead`, and any extra key the tool
85
+ * attached — is the tool stating what it knows about the world, and that is
86
+ * what an answer built on an absence is entitled to cite. `looked_for` states
87
+ * what was ASKED FOR, and in practice quotes the arguments the model passed,
88
+ * so indexing it would ground every identifier a model invented as long as it
89
+ * handed the invention to one tool that found nothing.
90
+ *
91
+ * The distinction is about the SOURCE of the words, not their position in the
92
+ * shape: a tool author who interpolates an unvalidated argument into any other
93
+ * field re-opens the same hole by hand — see "What this does NOT close" above.
94
+ */
95
+ const CALLER_ECHO_FIELD = 'looked_for';
96
+ /** One absence, minus the caller's echo. */
97
+ function toolAuthoredOnly(absence) {
98
+ // Entries, not fields: a tool may spread `absent(…)` and attach keys the
99
+ // `ToolAbsence` type never named, and those are the point of this widening.
100
+ const entries = Object.entries(absence);
101
+ return Object.fromEntries(entries.filter(([key]) => key !== CALLER_ECHO_FIELD));
63
102
  }
64
103
  /**
65
104
  * Project a parsed tool result down to what it may ground, or `undefined`
@@ -67,24 +106,28 @@ function coverageOnly(absence) {
67
106
  * indexes exactly as it always did.
68
107
  *
69
108
  * Two shapes carry one: a bare absence, and an absence bounded by a coverage
70
- * ledger (`coverage(absent(…), …)`). A ledger's own lists are all tool
71
- * prose, so they are indexed whole; only the absence inside it is narrowed.
72
- * An absence buried deeper than that — inside a tool's own domain object —
73
- * is NOT found, and is left indexed as ordinary data: this projection
74
- * recognizes the shapes this library mints, and does not go hunting through
75
- * values it did not write.
109
+ * ledger (`coverage(absent(…), …)`). A ledger's own lists are all tool prose,
110
+ * so they are indexed whole; the absence inside it loses the same one field a
111
+ * bare absence loses, and nothing else. An absence buried deeper than that —
112
+ * inside a tool's own domain object — is NOT found, and is left indexed as
113
+ * ordinary data: this projection recognizes the shapes this library mints, and
114
+ * does not go hunting through values it did not write.
115
+ *
116
+ * What comes back is a value to WALK, not a set of strings: the caller's
117
+ * indexer does the leaf and key work, so an extra key holding a nested object
118
+ * or an array of names is projected without this file knowing its shape.
76
119
  */
77
120
  function absenceEvidenceProjection(parsed) {
78
121
  const absence = (0, absent_js_1.readAbsence)(parsed);
79
122
  if (absence !== undefined)
80
- return coverageOnly(absence);
123
+ return toolAuthoredOnly(absence);
81
124
  const covered = (0, ledger_js_1.readCoverageLedger)(parsed);
82
125
  if (covered === undefined)
83
126
  return undefined;
84
127
  const inner = (0, absent_js_1.readAbsence)(covered.result);
85
128
  if (inner === undefined)
86
129
  return undefined;
87
- return [covered.af_coverage, ...coverageOnly(inner)];
130
+ return [covered.af_coverage, toolAuthoredOnly(inner)];
88
131
  }
89
132
  exports.absenceEvidenceProjection = absenceEvidenceProjection;
90
133
  //# sourceMappingURL=evidence.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../../../src/core/agent/coverage/evidence.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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AAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,iBAAiB,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,yBAAyB,CAAC,MAAe;IACvD,MAAM,OAAO,GAAG,IAAA,uBAAW,EAAC,MAAM,CAAC,CAAC;IACpC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAA,8BAAkB,EAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAA,uBAAW,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AACxD,CAAC;AARD,8DAQC"}
@@ -27,13 +27,14 @@
27
27
  * value because the model passed it to a tool would let any invention
28
28
  * launder itself through one failed lookup.
29
29
  * • **The model's own earlier answers do not count**, for the same reason.
30
- * • **An `absent(…)` result grounds its COVERAGE only.** An absence names
31
- * what was looked FOR, which in practice quotes the arguments the model
32
- * passed — so indexing the whole frame would ground an invented
33
- * identifier through the one operation that proves nothing about it: a
34
- * lookup that found nothing. `checked` / `not_checked` / `cannot_cover`
35
- * are the tool's own words about the world and do count. See
36
- * `../coverage/evidence.ts`.
30
+ * • **An `absent(…)` result grounds everything EXCEPT `looked_for`.** Its
31
+ * coverage lists, its `try_instead`, its note and any extra key the tool
32
+ * attached (a `known_shares` list, say) are the tool's own words about the
33
+ * world, and an answer that follows the absence's advice must not be
34
+ * called ungrounded for doing so. `looked_for` alone quotes the arguments
35
+ * the model passed, so indexing it would ground an invented identifier
36
+ * through the one operation that proves nothing about it: a lookup that
37
+ * found nothing. See `../coverage/evidence.ts`.
37
38
  *
38
39
  * The EXEMPT index is built from a different corpus with the same machinery:
39
40
  * the user's own message, the conversation's user/system turns, and the
@@ -105,13 +106,13 @@ function indexResult(content, sink) {
105
106
  if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
106
107
  try {
107
108
  const parsed = JSON.parse(trimmed);
108
- // An `absent(…)` frame grounds its COVERAGE and nothing else: the rest
109
- // of it is prose about the REQUEST, which usually quotes the model's own
110
- // arguments, and indexing that would ground every identifier a model
111
- // invented as long as it handed the invention to one tool that found
112
- // nothing. See `../coverage/evidence.ts` — it is the frames.ts argument
113
- // on the tool side of the conversation. `undefined` (every other result
114
- // ever returned) keeps the walk it always had.
109
+ // An `absent(…)` frame grounds everything the TOOL authored and drops
110
+ // the one field that quotes the REQUEST (`looked_for`) — indexing that
111
+ // would ground every identifier a model invented as long as it handed
112
+ // the invention to one tool that found nothing. See
113
+ // `../coverage/evidence.ts` — it is the frames.ts argument on the tool
114
+ // side of the conversation. `undefined` (every other result ever
115
+ // returned) keeps the walk it always had.
115
116
  const projection = (0, index_js_1.absenceEvidenceProjection)(parsed);
116
117
  walk(projection ?? parsed, sink);
117
118
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"evidenceIndex.js","sourceRoot":"","sources":["../../../../src/core/agent/evidence/evidenceIndex.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;;AAIH,mDAAiE;AACjE,2CAAoD;AACpD,iDAAuE;AAEvE;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAoBjC,SAAS,GAAG,CAAC,IAAU,EAAE,GAAW;IAClC,MAAM,IAAI,GAAG,IAAA,6BAAc,EAAC,GAAG,CAAC,CAAC;IACjC,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO;IACxB,KAAK,MAAM,IAAI,IAAI,IAAA,0BAAW,EAAC,IAAI,CAAC,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AAM,GAAG,IAAI,IAAI,CAAC,sBAAsB,IAAI,EAAE,EAAE,CAAC;QACpD,IAAI,GAAG,CAAC,UAAU;YAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;QAClD,wEAAwE;QACxE,wEAAwE;QACxE,iCAAiC;aAC5B,IAAI,GAAG,CAAC,cAAc;YAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAxBD,sCAwBC"}
@@ -3,8 +3,10 @@
3
3
  * toolArgsValidation — validate LLM-produced tool args against the tool's
4
4
  * declared `inputSchema` BEFORE dispatch (backlog #9).
5
5
  *
6
- * Pattern: pure function module — no state, no events; the toolCalls stage
7
- * owns when to call it and what to do with the verdict.
6
+ * Pattern: pure function module — no events, and no state beyond one compiled-
7
+ * regex cache (which doubles as the warn-once ledger for `pattern`s
8
+ * that do not compile); the toolCalls stage owns when to call it and
9
+ * what to do with the verdict.
8
10
  * Role: The model writes tool args as free-form JSON; nothing guaranteed
9
11
  * they match the schema the tool advertised. Dispatching garbage
10
12
  * surfaced as deep tool stack traces (or worse, silent misbehavior).
@@ -15,27 +17,138 @@
15
17
  * ── Honest-subset contract ────────────────────────────────────────────────
16
18
  * This is NOT a full JSON Schema implementation. It enforces the core that
17
19
  * tool schemas in the wild actually use, and IGNORES everything else
18
- * (permissive on unknown keywords — a schema using `pattern`/`oneOf`/`$ref`
19
- * still validates the supported core, never false-rejects on the rest):
20
+ * (permissive on unknown keywords — a schema using `oneOf`/`$ref` still
21
+ * validates the supported core, never false-rejects on the rest):
20
22
  *
21
23
  * ENFORCED: `type` (object/array/string/number/integer/boolean/null,
22
24
  * union arrays), `required`, `properties` (recursive),
23
25
  * `items` (single-schema, recursive), `enum` (primitives),
24
- * `additionalProperties: false` ONLY when explicitly set.
25
- * IGNORED: format, pattern, min/max*, oneOf/anyOf/allOf/not, $ref,
26
+ * `additionalProperties: false` ONLY when explicitly set,
27
+ * and the STRING SHAPE keywords `pattern` / `minLength` /
28
+ * `maxLength`.
29
+ * IGNORED: format, numeric min/max, oneOf/anyOf/allOf/not, $ref,
26
30
  * const, dependencies, …
27
31
  *
28
- * ── Security: never echo VALUES ───────────────────────────────────────────
29
- * Issues name the PATH, the EXPECTED shape, and the TYPE of what arrived —
30
- * never the supplied value itself. The message flows into history (LLM),
31
- * the emit channel, and traces; arg values can carry PII or injection
32
- * payloads. Enum expectations echo SCHEMA values only (already LLM-visible
33
- * in the tools block).
32
+ * ── Why string SHAPE joined the subset ────────────────────────────────────
33
+ * A tool result ended with an offer ("I can also map these ids to volume
34
+ * names"); the person answered "yes please"; the model bound that sentence as
35
+ * the IDENTIFIER argument and dispatched. The tool's schema declared the
36
+ * identifier's shape and this boundary did not read it, so a call that could
37
+ * never succeed cost a round trip — and the consumer hand-rolled an
38
+ * affirmative blocklist to do what the declaration already said. A declared
39
+ * shape a boundary ignores is worse than no declaration: the author believes
40
+ * it is enforced.
41
+ *
42
+ * `pattern` is JSON Schema's own semantics — UNANCHORED, ECMA-262, applied to
43
+ * strings only. A regex the schema author got wrong must never take dispatch
44
+ * with it: it is compiled once, and a compile failure degrades to no-pattern
45
+ * plus one developer warning.
46
+ *
47
+ * ── Security: what an issue may echo ──────────────────────────────────────
48
+ * `type` / `enum` / `required` / `additionalProperties` issues name the PATH,
49
+ * the EXPECTED shape, and the TYPE of what arrived — never the supplied value.
50
+ * Enum expectations echo SCHEMA values only (already LLM-visible in the tools
51
+ * block).
52
+ *
53
+ * String-SHAPE issues are the one exception, and it is a narrow one: the
54
+ * complaint IS the value's shape, so `expected string, got string` teaches
55
+ * nothing and the correction cannot converge. They carry `value` — a capped
56
+ * excerpt ({@link MAX_VALUE_CHARS}) of the offending string — plus `hint`, the
57
+ * parameter's own `description`, which is where an author writes what the
58
+ * identifier looks like. Neither adds exposure: the value is the model's own
59
+ * tool-call argument, already verbatim in the history this message is appended
60
+ * to. The OTel adapter renders `path`/`expected`/`got` only, so third-party
61
+ * telemetry stays value-free either way.
34
62
  */
35
63
  Object.defineProperty(exports, "__esModule", { value: true });
36
64
  exports.formatToolArgIssues = exports.validateToolArgs = void 0;
37
65
  /** Cap so a pathological schema/args pair can't flood history or events. */
38
66
  const MAX_ISSUES = 10;
67
+ /** Ceiling on the echoed excerpt of an offending string. Enough to recognize
68
+ * a sentence bound where an identifier belonged; short enough that a 5 MB
69
+ * argument cannot ride the message into history. */
70
+ const MAX_VALUE_CHARS = 80;
71
+ /**
72
+ * Ceiling on compiled `pattern`s held. Schemas are finite in a process, so
73
+ * this is a fence against dynamically-minted ones rather than a tuning knob:
74
+ * past it, patterns compile per call (and a broken one warns again) instead of
75
+ * the map growing without bound.
76
+ */
77
+ const MAX_CACHED_PATTERNS = 256;
78
+ /**
79
+ * Compiled `pattern`s, and the warn-once ledger for the broken ones. A `null`
80
+ * entry means "this pattern does not compile" — recorded so a schema bug is
81
+ * reported once to the developer rather than once per dispatch.
82
+ */
83
+ const patternCache = new Map();
84
+ function compilePattern(pattern) {
85
+ const cached = patternCache.get(pattern);
86
+ if (cached !== undefined)
87
+ return cached;
88
+ let compiled = null;
89
+ try {
90
+ // No flags: JSON Schema `pattern` is an unanchored ECMA-262 match, and a
91
+ // `g` flag would make the RegExp stateful across calls.
92
+ compiled = new RegExp(pattern);
93
+ }
94
+ catch {
95
+ console.warn(`[agentfootprint] a tool inputSchema declares a \`pattern\` that is not a valid regular ` +
96
+ `expression (${pattern}) — it is IGNORED, so this argument's shape is NOT enforced. ` +
97
+ `Fix the expression or drop the keyword.`);
98
+ }
99
+ if (patternCache.size < MAX_CACHED_PATTERNS)
100
+ patternCache.set(pattern, compiled);
101
+ return compiled;
102
+ }
103
+ /** A length bound this validator will act on: a non-negative integer. Anything
104
+ * else is outside the honest subset and ignored rather than guessed at. */
105
+ function lengthBound(raw) {
106
+ return typeof raw === 'number' && Number.isInteger(raw) && raw >= 0 ? raw : undefined;
107
+ }
108
+ function excerptOf(value) {
109
+ return value.length <= MAX_VALUE_CHARS ? value : `${value.slice(0, MAX_VALUE_CHARS)}…`;
110
+ }
111
+ function descriptionOf(schema) {
112
+ const raw = schema.description;
113
+ if (typeof raw !== 'string')
114
+ return undefined;
115
+ const trimmed = raw.trim();
116
+ return trimmed === '' ? undefined : trimmed;
117
+ }
118
+ /**
119
+ * The string SHAPE keywords. At most ONE issue per argument: `pattern`
120
+ * describes the value completely, so adding "and it is too short" is a second
121
+ * sentence about one mistake.
122
+ */
123
+ function checkStringShape(value, schema, path, issues) {
124
+ const hint = descriptionOf(schema);
125
+ const teach = (expected, got) => {
126
+ issues.push({
127
+ path,
128
+ expected,
129
+ got,
130
+ value: excerptOf(value),
131
+ ...(hint !== undefined && { hint }),
132
+ });
133
+ };
134
+ const pattern = schema.pattern;
135
+ if (typeof pattern === 'string') {
136
+ const regex = compilePattern(pattern);
137
+ if (regex !== null && !regex.test(value)) {
138
+ teach(`a string matching ${pattern}`, 'string');
139
+ return;
140
+ }
141
+ }
142
+ const min = lengthBound(schema.minLength);
143
+ if (min !== undefined && value.length < min) {
144
+ teach(`a string of at least ${min} characters`, `string of length ${value.length}`);
145
+ return;
146
+ }
147
+ const max = lengthBound(schema.maxLength);
148
+ if (max !== undefined && value.length > max) {
149
+ teach(`a string of at most ${max} characters`, `string of length ${value.length}`);
150
+ }
151
+ }
39
152
  function typeNameOf(value) {
40
153
  if (value === null)
41
154
  return 'null';
@@ -97,6 +210,12 @@ function validateNode(value, schema, path, issues) {
97
210
  return;
98
211
  }
99
212
  }
213
+ // String SHAPE — same place, same dial, same result shape as `type`/`enum`
214
+ // above. Applies to strings only, which is JSON Schema's own rule.
215
+ if (typeof value === 'string') {
216
+ checkStringShape(value, schema, path, issues);
217
+ return;
218
+ }
100
219
  // Object keywords.
101
220
  if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
102
221
  const record = value;
@@ -173,17 +292,22 @@ function validateToolArgs(args, inputSchema) {
173
292
  }
174
293
  exports.validateToolArgs = validateToolArgs;
175
294
  /**
176
- * Render the MODEL-VISIBLE tool result for a rejected call. Names paths,
177
- * expectations, and received TYPES — never received values. The model
178
- * already has the full schema in its tools block; pointing at the issues
179
- * is what makes the retry converge.
295
+ * Render the MODEL-VISIBLE tool result for a rejected call. Names paths and
296
+ * expectations; reports received TYPES for structural issues and the capped
297
+ * offending VALUE for string-shape ones, because a shape complaint that will
298
+ * not say which string it is about cannot be acted on. `JSON.stringify` quotes
299
+ * and escapes the excerpt, so a multi-line argument stays one line.
300
+ *
301
+ * The parameter's own `description` follows on its own line when the schema
302
+ * declares one: that sentence is usually the whole correction.
180
303
  */
181
304
  function formatToolArgIssues(toolName, issues) {
182
305
  const lines = issues.map((issue) => {
183
306
  const where = issue.path === '' ? 'arguments' : `'${issue.path}'`;
184
- return issue.expected === 'required'
307
+ const head = issue.expected === 'required'
185
308
  ? `- ${where} is required but missing`
186
- : `- ${where}: expected ${issue.expected}, got ${issue.got}`;
309
+ : `- ${where}: expected ${issue.expected}, got ${issue.value === undefined ? issue.got : JSON.stringify(issue.value)}`;
310
+ return issue.hint === undefined ? head : `${head}\n ${where} is described as: ${issue.hint}`;
187
311
  });
188
312
  return (`Invalid arguments for tool '${toolName}' — the call was not executed.\n` +
189
313
  `${lines.join('\n')}\n` +
@@ -1 +1 @@
1
- {"version":3,"file":"toolArgsValidation.js","sourceRoot":"","sources":["../../../src/core/agent/toolArgsValidation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AAmBH,4EAA4E;AAC5E,MAAM,UAAU,GAAG,EAAE,CAAC;AAItB,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,OAAO,KAAK,CAAC;AACtB,CAAC;AAED,iEAAiE;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AK,GAAG,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC;QAClE,MAAM,IAAI,GACR,KAAK,CAAC,QAAQ,KAAK,UAAU;YAC3B,CAAC,CAAC,KAAK,KAAK,0BAA0B;YACtC,CAAC,CAAC,KAAK,KAAK,cAAc,KAAK,CAAC,QAAQ,SACpC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CACpE,EAAE,CAAC;QACT,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,KAAK,qBAAqB,KAAK,CAAC,IAAI,EAAE,CAAC;IAChG,CAAC,CAAC,CAAC;IACH,OAAO,CACL,+BAA+B,QAAQ,kCAAkC;QACzE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QACvB,uEAAuE,CACxE,CAAC;AACJ,CAAC;AAhBD,kDAgBC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * adapters/hosting/foundryResponses — an agent behind Microsoft Foundry's
3
+ * hosted-agent contract.
4
+ *
5
+ * ── The split, and why it is here ────────────────────────────────────────────
6
+ * Two different things are needed to serve a Foundry hosted agent, and only one
7
+ * of them is Microsoft's:
8
+ *
9
+ * • The **Responses protocol** — `input` items, a `response` object, the
10
+ * named streaming lifecycle. That is a protocol several runtimes speak, so
11
+ * it lives in `responsesWire.ts` with no vendor in it.
12
+ * • The **hosting contract** — port 8088, `POST /responses`, a `HEAD` probe
13
+ * on the same path, `GET /readiness` answering `{"status":"healthy"}`, and
14
+ * `agent_session_id` as a session alias. That IS this runtime's contract,
15
+ * the same way `/invocations` and `X-Amzn-…` are another's, and it is what
16
+ * this file supplies.
17
+ *
18
+ * So this file is a configuration, not an implementation. Everything hard —
19
+ * draining on close, aborting when the caller hangs up, failing a handler that
20
+ * throws or answers nothing — is `httpHost`'s, shared with every other adapter
21
+ * rather than reimplemented here where the two would drift.
22
+ *
23
+ * ── What it does NOT do ──────────────────────────────────────────────────────
24
+ * **Workflow Visualizer topology is not provided.** The Inspector can invoke
25
+ * this host and render its answer; it does not learn that the answer came from
26
+ * four composed agents, because nothing in the Responses protocol carries that
27
+ * and inventing a channel for it would be claiming a compatibility this has
28
+ * never demonstrated. An agent's internal structure is readable from
29
+ * agentfootprint's own recorders.
30
+ *
31
+ * Everything the protocol does not carry — tool calls, image and file input,
32
+ * function-call output, structured output — is refused by name. See
33
+ * `responsesWire.ts`.
34
+ *
35
+ * This is an **inbound hosting adapter**: it is the door callers arrive at. It
36
+ * is not a model provider, and it has nothing to do with which model the agent
37
+ * calls — for Foundry models, that is `openai()` with the endpoint's base URL.
38
+ *
39
+ * @example An agent behind the Inspector
40
+ * import { foundryResponsesHost, memorySessions, standingAgent } from 'agentfootprint/hosting';
41
+ *
42
+ * const handle = await standingAgent({
43
+ * agent,
44
+ * sessions: memorySessions(),
45
+ * host: foundryResponsesHost(),
46
+ * });
47
+ * process.on('SIGTERM', () => void handle.close());
48
+ */
49
+ /// <reference types="node" />
50
+ import type { IncomingMessage, Server, ServerResponse } from 'node:http';
51
+ import { type HttpHost } from '../../hosting/httpHost.js';
52
+ /** The port a Foundry hosted agent is expected on. */
53
+ export declare const DEFAULT_FOUNDRY_PORT = 8088;
54
+ /** The path that takes a turn. */
55
+ export declare const FOUNDRY_INVOKE_PATH = "/responses";
56
+ /** The path a Foundry hosted agent answers a readiness probe on. */
57
+ export declare const FOUNDRY_READINESS_PATH = "/readiness";
58
+ /**
59
+ * Session aliases this contract accepts, in precedence order.
60
+ *
61
+ * `conversation` is the protocol's own; `agent_session_id` is this runtime's;
62
+ * `session_id` is the spelling several clients send anyway. First one present
63
+ * wins, so a caller using any of the three reaches the same session.
64
+ */
65
+ export declare const FOUNDRY_SESSION_FIELDS: readonly string[];
66
+ export interface FoundryResponsesHostOptions {
67
+ /** Port to bind. Default {@link DEFAULT_FOUNDRY_PORT}. Pass `0` for an ephemeral test port. */
68
+ readonly port?: number;
69
+ /** Interface to bind. Default `'0.0.0.0'` — a container's door has to be reachable from outside it. */
70
+ readonly hostname?: string;
71
+ /** Model label echoed in `response` objects when the request names none. */
72
+ readonly model?: string;
73
+ /** Ceiling on a request body. Default one mebibyte. */
74
+ readonly maxBodyBytes?: number;
75
+ /**
76
+ * A `node:http` server you own, to ATTACH these routes to rather than binding
77
+ * one. Refused together with `port`/`hostname`, which would name a socket
78
+ * this host does not bind.
79
+ */
80
+ readonly server?: Server;
81
+ /** Answer a path this host does not own. Private-server mode only. */
82
+ readonly onUnhandled?: (req: IncomingMessage, res: ServerResponse) => void;
83
+ }
84
+ /**
85
+ * An {@link HttpHost} speaking Foundry's hosted-agent contract.
86
+ *
87
+ * @param options - Port, interface, model label and body ceiling.
88
+ */
89
+ export declare function foundryResponsesHost(options?: FoundryResponsesHostOptions): HttpHost;