@sema-agent/core 7.67.2 → 7.67.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/brain/errors.d.ts +20 -0
- package/dist/brain/errors.js +114 -0
- package/dist/brain/provider-message.d.ts +5 -3
- package/dist/brain/provider-message.js +35 -8
- package/dist/core/protocol-http-auth.d.ts +20 -5
- package/dist/core/protocol-http-auth.js +65 -31
- package/dist/core/untrusted-egress.d.ts +14 -3
- package/dist/core/untrusted-egress.js +20 -1
- package/dist/core/untrusted-text.d.ts +6 -0
- package/dist/core/untrusted-text.js +4 -1
- package/package.json +2 -2
- package/wire-changes/core-stores-sql@7.67.3.json +39 -0
- package/wire-changes/core@7.67.3.json +65 -0
- package/wire-changes/mods-kernel@7.67.3.json +39 -0
- package/wire-changes/primitives@7.67.3.json +39 -0
- package/wire-changes/wiki-gate@7.67.3.json +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 7.67.3 — 2026-11-12
|
|
2
|
+
|
|
3
|
+
### `providerMessage` is no weaker than the same response's `terminal.message`: what the raw-body reading withholds inside the sentence's literal, the sentence withholds too — a token split inside by a line break, a tab or an escaped Unicode space no longer rides the retry frame or the terminal refusal account in part (#4343; Security; behavior change: narrowing — more of such a sentence renders `[redacted]`, see Legibility; widening: a value read inside an engine tag now leaves the rest of the sentence readable, see Now; hard-breaking: none; closed sets: none; exports: none from the package root; wire: none) (@server @cli @client-core)
|
|
4
|
+
|
|
5
|
+
- **Affected versions.** 7.67.0 – 7.67.2. 7.66.x carries no `providerMessage`; there the same text reached only `terminal.message`, which read it clean.
|
|
6
|
+
- **Trigger.** The provider's `error.message` holds a credential whose middle is a character the JSON writer of the endpoint wrote as an escape and the vocabulary reads as the end of a token once it is parsed: a line break (LF, CRLF), a tab, VT, FF — every writer escapes those — or U+2028 / U+2029 (Go also escapes them), a no-break space or U+3000 (an ASCII-only writer: Python's `ensure_ascii`, PHP's default). Or the sentence holds a character the writer escaped that the parsed sentence's reading needs as it is (a no-break space before a label's `=`, a zero-width character inside `Bearer`, `/` written `\/` behind a `Token` run). Behind a scheme word (`Authorization: Bearer|Basic|Negotiate|<any scheme>`, a bare `Bearer`, `Token`) or a key label (`x-api-key:`, `api_key=`, `api_key:`, `api-key=`, `password=`). Or a value the vocabulary finds under a label elsewhere in the body (`"x-api-key": "<value>"` among echoed headers) stands again in the sentence (`Rejected value <value>`) and the body also holds a Cookie member or the request's declared key, which run the raw-body reading's echo pass: that pass takes the value out wherever it stands. `terminal.message` reads the raw body, where the escape keeps the token one word and the echo pass sees the whole body, and withholds it; `providerMessage` read only the parsed sentence and carried the rest (server measured the LF / CRLF / TAB and `x-api-key` forms on 7.67.1 and the 7.67.2 candidate through `runs/:id`, 7.66.1 clean; the engine pin reads them on 7.67.2's src).
|
|
7
|
+
- **Now.** The sentence also withholds what the raw-body reading withholds in the BODY inside the sentence's literal, as the endpoint wrote it: the one reader of the envelope (`statedSentence`, `src/brain/errors.ts`) states the sentence with where each of its characters stands in the body — the literal found by a walk that reads the body by `JSON.parse`'s rules (trimmed as the envelope reader trims it, member names decoded, the last of a repeated member) and checked by decoding (a literal that does not decode to the sentence is not its spelling: the sentence is then withheld whole). What the raw-body reading withholds (`remoteWordsSpans`, `src/core/protocol-http-auth.ts`, beside `remoteWords`, which `terminal.message` is: its echo pass's ranges — every Cookie member's value, the declared values, the values the vocabulary found anywhere in the body, wherever they stand — and what its vocabulary pass then withholds in those marked words, read off the renderer's own account of what it took, `egressCredentialReading`, `src/core/untrusted-egress.ts`: every hit of every pass, a later pass's over the words an earlier mark set apart included — `AKIA…password=<token>` — each less the label its rendering keeps; read back through the marks; and checked against the reading's own output — where the text outside those spans does not stand in that output as written, the spans missed a removal and the answer is the whole body) is mapped back through the literal's escapes onto the sentence (each span to the whole characters whose spelling it touches) and taken out with the parts read in the parsed sentence and the declared values. That is the raw-body reading's own finding on the same bytes, computed by the same plan (`remoteWords` and `remoteWordsSpans` share the echo pass's one decision), so the sentence is not weaker than `terminal.message` whatever escapes the writer chose and wherever else in the body the value stood — no writer is guessed. The pass reads the sentence folded only (`foldToOneLine`, `src/core/untrusted-text.ts`: white space runs to one space, nothing neutralized); engine tags are neutralized once, at the bound (`inlineUntrusted`, which is now that fold, the cap and the neutralization, byte for byte as before). So every part's one-line spelling stands in the folded words wherever the part stands, and every occurrence is taken out: `password=<skills attr=x> password=<skills…` no longer carries the first value in its neutralized spelling (`<skills`), and `password=<system-reminder attr=x>` reads `password=[redacted] attr=x>` where 7.67.2 carried `password=<system-reminder attr=x>`. A host Brain's sentence (`admittedProviderMessage`) comes with no body: it is read as written only, by the same pass as the body path's parsed sentence, so the pass's own changes reach it too (see Host seat). One rule in the shared matcher moves with it (`remoteWords`, `src/core/protocol-http-auth.ts`): a value the credential vocabulary found — in these words, or (the new `found` argument) in another spelling of them — is taken out wherever it stands, a Cookie member's name included; only a declared value spares that name (it can be an ordinary word). Before, a found value that folded into `Set-Cookie :` was spared like a declared one. Every face that mints a remote's words through `remoteWords` withholds more in that one shape and nothing less.
|
|
8
|
+
- **Measured** (a real Runner over the OpenAI lane — and the Anthropic one for its envelope — a local replay server answering 400, 429 and server's status set with the envelope written by five writers; every key synthetic; base `9af3fa778` (= 7.67.2's src) against this change): 1 637 readings, 3 396 `providerMessage` exit cells — fixed 1 690, same 1 549, more withheld 33, regressions 0; cells where `providerMessage` carries a four-character piece of what `terminal.message` of the same response withholds: 1 690 on 7.67.2, 0 now. Server's 189-form cut table: every should-turn-clean form clean, no must-stay-clean form or whole-token control reads differently (47 cells, all the same); 35 forms carry a piece on both readings (#4333). The 33 more-withheld cells: 20 the found value folded into a Cookie member's name (a colon), 12 the escaped U+3000 joining a clause (KL-4343-a), 1 a further piece of a token split by CRLF and a space. 135 envelopes the test suites already hold, through both trees: all read the same, none withheld whole by the check.
|
|
9
|
+
- **Legibility (KNOWN-LIMITS KL-4343-a).** The sentence now reads what the raw-body reading of the same envelope reads, so where that reading joins words behind a credential, the sentence joins them too: a Unicode space right behind a credential that the endpoint wrote as an escape (U+3000 or a no-break space from an ASCII-only writer; U+2028 / U+2029 from Go or an ASCII-only writer) makes the words after it, up to the next ASCII white space, quote, `;`, `|` or `&`, part of it. `Authorization: Bearer <token> 请检查您的密钥是否正确` from an ASCII-only writer → `Authorization: [redacted]` (7.67.2: `… [redacted] 请检查您的密钥是否正确`); the Japanese `… <token> キーが無効です。もう一度お試しください` → `Authorization: [redacted]`. The same sentence from a writer that left U+3000 as it is keeps the clause, as on 7.67.2. Not affected for any writer: a plain space between the credential and the words; a U+3000 later in the words; an emoji glued or after a space; a sentence with no credential (Chinese and Japanese prose holding U+3000 / NBSP / U+2028 reads byte for byte as on 7.67.2). A full stop glued to the token (`<token>。请…`) was already withheld with it on 7.67.2. (KL-4343-b) A `Cookie:` / `Set-Cookie:` written as words in a string member BEFORE the sentence (`{"note":"Set-Cookie: sid=abc","error":{"message":"hello world"}}`) is read to the end of its line, which in a one-line body is the end of the body: the raw-body reading withheld the sentence with it on 7.67.2 already, and now the sentence reads `[redacted]` too; a Cookie member written as a record member (`"headers":{"Cookie":"sid=abc"}`), or written after the sentence, leaves the sentence as it was. Where the spans read off the raw-body reading do not account for its output, the sentence reads `[redacted]` whole — measured on 40 000 seeded texts of labels, keys, marks and separators: 143 (0.36 %); the five read by hand are runs of labels with nothing a label could hold between them (`password=Authorization: Bearer `).
|
|
10
|
+
- **Performance.** The sentence's reading now runs the raw-body reading over the body (at most 64 KiB, `ERROR_BODY_BYTE_CAP`, `src/brain/stream-engine.ts:232`) — its echo pass where it runs, the vocabulary's renderer with its account of each hit — the walk to the literal and the check. Measured on one host at one load, both trees side by side (darwin, median of five, `readProviderMessage` over bodies that fill the cap): ASCII text 30 ms (7.67.2: 22 ms); `Authorization: Bearer <token>` lines split by LF 155 – 177 ms (7.67.2: 80 – 90 ms); `api_key=<token>` + U+3000 + CJK lines 142 – 160 ms (49 – 64 ms); the worst, `Bearer <token>` lines with a no-break space and an emoji, 212 – 258 ms (60 – 72 ms); `x-api-key: <value>` lines with distinct values 190 – 220 ms (64 – 70 ms), the raw-body reading of the same body, which `terminal.message` already runs, 4 – 69 ms; `Bearer <token>` lines with a Cookie member 156 ms (67 ms); the previous ticket's 200 000-character input through the function alone 143 → 151 ms. The worst found (a review leg's shapes, re-measured on both trees side by side, loaded host at a load of 9 – 12, median of three after a warm-up): a body of about 3 000 short distinct values (`pw=1 password=<6 characters>` repeated to the cap) 975 ms (7.67.2: 234 ms); the same with a Cookie member beside the envelope 1 012 ms (256 ms); `x-api-key: <10 characters>` lines with a Cookie member and a labelled key beside the envelope 683 ms (184 ms) — on that leg's host 3.06 s / 1.98 s against 0.63 s / 0.41 s. The time grows with the number of hits, linearly (8 / 16 / 32 / 64 KiB of the first shape: 194 / 259 / 507 / 975 ms): each reading of the words renders every hit once more on its own to learn the label it keeps (`withheldOf`, `src/core/untrusted-egress.ts`), and this reading runs three — the body's, the sentence's as written, and the folded sentence's own echo pass; 7.67.2 ran one. No cheap change keeps that exact: KNOWN-LIMITS KL-4343-c. The body read is capped at 64 KiB (`ERROR_BODY_BYTE_CAP`, `src/brain/stream-engine.ts:232`); a body that reaches the cap did not end, and a body that did not end states no sentence (`statedEnvelope`) — there is no larger input and no fallback to another reading. Once per attempt that reads a body.
|
|
11
|
+
- **Known, not changed here.** A token split by a plain space, a vendor-prefixed key with no label split by a line break (`sk-proj-…\n…`), and a token behind a scheme word that is itself cut by a line break (`Authorization: Bea\nrer <token>`) carry their value on both `providerMessage` and `terminal.message` at the engine (#4333; server's own second pass withholds the last on its faces). A private-key body whose banner was cut away is read on neither (KL-3769-b, now naming both exits). A value found under a label elsewhere in a body that holds no Cookie member and no declared value stays in the sentence on both readings (the raw-body reading runs its echo pass only when one of those is there). A host Brain's sentence has no body to read it against; it is read as written. A `Private-Lines: N` body whose last line is followed on the same line by ordinary words keeps that last line on `providerMessage` (N = 1: the one line), as on 7.67.2 (measured on this change, 7.67.2's src and the published 7.67.2 package: the same readings; a body that ends at its line's end is withheld whole; #4361). A cut `providerMessage` is 240 code points and the ellipsis, 241 in all, where the member's type comment says at most 240 (`src/core/terminal-cause.ts`, unchanged here; #4362).
|
|
12
|
+
- **Host seat (`admittedProviderMessage`) against 7.67.2.** Measured over 804 sentences (a review leg's corpus of labels, escapes, zero-width splits and marks, plus its four probes): 792 read the same, 12 differ, in three kinds. (1) 10: a value split inside by a zero-width or other format character — the part after the split is now also withheld where it stands again in the sentence (`secret=[<value><tail>] <tail>]` → `secret=[redacted] [redacted]]`); 7.67.2 carried that copy. (2) 1: the same, where the part after the split is one character: it is withheld wherever it stands, in any letter case, inside ordinary words too (`then` → `t[redacted]en`; KNOWN-LIMITS KL-4343-d). (3) 1: a value read inside an engine tag (`password=<system-reminder attr=x>` → `password=[redacted] attr=x>`, see Now). No sentence carries a piece of a credential 7.67.2 withheld (pin ⑪).
|
|
13
|
+
- **Rules.** Readers of the envelope: 1 (`statedEnvelope`), now also stating where its sentence stands (`statedSentence`: one read, two products, checked against each other). What the sentence's pass takes out: the declared values and the parts read in the parsed sentence → those and what the raw-body reading withholds inside the literal. The raw-body reading's plan (does the echo pass run, and what does it take): 1, shared by the text (`remoteWords`) and its spans (`remoteWordsSpans`). What the vocabulary pass withheld, read off the body: the scanner's spans (no later pass) → the renderer's own account (`egressCredentialReading`), which the echo pass's found values read too — the second copy of the "less the label its rendering keeps" rule (`vocabularyValues`) is gone. The parts of the sentence as written (`egressCredentialParts`): the scanner's hits as before (a hit inside a larger one included: `Basic <x>` inside `Basic <x>-<y>`, so `<x>` standing alone later in the sentence goes too) with the renderer's account. The spans are checked against the output they claim to account for (fail closed: the whole body). Folds before the pass: 1, now the fold alone (`foldToOneLine`; `inlineUntrusted` is that fold, the cap and the neutralization). Guessed writer spellings: 0. Special cases: 0. The existence check a part used to pass before it was taken out is gone (every occurrence is taken out by construction). The Cookie-name exemption: declared and found values → declared values only.
|
|
14
|
+
- **Pins.** `test/backlog4343-provider-message-not-weaker.test.ts` — 9 holders × 11 separators + 13 escape and review shapes, each × five writers (minimal, Go, ASCII-only, PHP's default, Python's default) × the 400 terminal, the 429's retry frames and its terminal, through a real Runner (① no exit carries a piece the raw-body reading of the same response withholds, and a property over 600 bodies from a seeded writer that picks each character's spelling at random; ② the raw-body reading per writer; ③ plain words after the credential; ④ the literal reader by `JSON.parse`'s rules, the disagreeing-readings arm, the exact way back, every occurrence taken out; ⑤ the egress pass and `inlineUntrusted` read as before; ⑥ legibility M1 – M3; ⑦ server's six forms per writer; ⑧ witnesses; ⑨ server's 189-form cut table — every envelope it builds, the Anthropic Brain lane, statuses 400 / 401 / 403 / 404 / 408 / 409 / 422 / 429 / 500 / 503 — with its acceptance set; ⑩ what the raw-body reading takes out elsewhere in the body — a value under a label beside a Cookie member or the echoed declared key, before or after the envelope, holding a `/` PHP writes `\/` — in its own marked words, and by a later pass over the words an earlier mark set apart, every writer, the check's whole-body arm, the OpenAI lanes and the Anthropic one, with KL-4343-b's two forms; ⑪ a property — whatever 7.67.2's reading withheld of a credential, this one withholds too, body path and host seat — over every shape and writer above, server's 189 forms, the elsewhere forms, 144 sub-hit sentences × two writers and 1 500 seeded sentences × two writers, against 7.67.2's reading spelled from exported pieces (certified equal to 7.67.2's own on 8 000 seeded inputs), and the check's three anchors). Re-pinned: `test/backlog4329-provider-message-mask-order.test.ts` W7, `test/fixtures/backlog3826-inline-untrusted-authors.json` (the function's one `inlineUntrusted` call).
|
|
15
|
+
- **Consumers.** No code change asked. @server @cli @client-core: `providerMessage` on a run's result, its events and its replay no longer carries the parts above; a reader that matched a provider sentence literally sees `[redacted]` where they stood, and the rest of a sentence holding an engine tag where 7.67.2 showed the tag's neutralized spelling. `@sema-agent/primitives` is unchanged.
|
|
16
|
+
- **Narrowings, each open to veto (@server @cli @client-core).** (1) Words behind a credential followed by a Unicode space the endpoint wrote as an escape are withheld with it, up to the next ASCII white space, quote, `;`, `|` or `&` (KL-4343-a). (2) A text-form `Cookie:` / `Set-Cookie:` in a string member before the sentence of a one-line body withholds the sentence (KL-4343-b). (3) Where the spans do not account for the raw-body reading's output, the sentence is `[redacted]` whole — the member is present, no notice is sent (143 of 40 000 seeded texts, 0.36 %; 0 of the 135 envelopes the suites hold; 0 of 41 real provider sentences × 6 cells read by a review leg). (4) The part after a zero-width or other format split is withheld where it stands again; a one-character part is withheld in every word, in any case (KL-4343-d). (5) A value the vocabulary found is taken out of a Cookie member's name too, on every face that mints through `remoteWords`. Widening: one — a value read inside an engine tag leaves the rest of the sentence readable (see Now).
|
|
17
|
+
|
|
1
18
|
## 7.67.2 — 2026-11-12
|
|
2
19
|
|
|
3
20
|
### The provider's own sentence (`providerMessage`) withholds what the credential vocabulary finds in its words as written, together with what the one pass finds in its one-line form — a key split by a zero-width or other format character, and a private-key body read by its line breaks, no longer ride the retry frame or the terminal refusal account in part (#4329; Security; behavior change: narrowing — more of such a sentence renders `[redacted]`; widening: none; hard-breaking: none; closed sets: none; exports: none; wire: none) (@server @cli @client-core)
|
package/dist/brain/errors.d.ts
CHANGED
|
@@ -148,6 +148,26 @@ export interface FailedBody {
|
|
|
148
148
|
/** What a failed response's body states — its envelope — and only when the body ended ({@link FailedBody}). Every
|
|
149
149
|
* reader of a failed body (the dialect verdict, the echoed word) reads it through here. */
|
|
150
150
|
export declare function statedEnvelope(body: FailedBody | undefined): ReturnType<typeof providerErrorObject>;
|
|
151
|
+
/** The sentence an envelope states and how the endpoint wrote it. */
|
|
152
|
+
export interface StatedSentence {
|
|
153
|
+
/** `error.message`, as {@link statedEnvelope} reads it. */
|
|
154
|
+
readonly sentence: string;
|
|
155
|
+
/** For each code unit of the sentence, the span of the body it was written as (`from[i]` … `to[i]`: the character itself, or the
|
|
156
|
+
* whole escape that stands for it). Absent when the walk below does not place a literal that decodes to the sentence — two
|
|
157
|
+
* readings of one body that disagree, which the reader of the sentence answers by withholding it. */
|
|
158
|
+
readonly written?: {
|
|
159
|
+
readonly from: Int32Array;
|
|
160
|
+
readonly to: Int32Array;
|
|
161
|
+
} | undefined;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The sentence a failed response's envelope states (`error.message` when it is a string, read through {@link statedEnvelope}),
|
|
165
|
+
* with where each of its characters stands in the body as the endpoint wrote it — one read, two products: the value `JSON.parse`
|
|
166
|
+
* gives, and the literal that value came from, found by a walk that reads the body by `JSON.parse`'s rules (the body trimmed as
|
|
167
|
+
* {@link providerErrorObject} trims it, member names decoded, the last of a repeated member) and checked by decoding: a literal
|
|
168
|
+
* that does not decode to the sentence is not its spelling, and the sentence is stated without one.
|
|
169
|
+
*/
|
|
170
|
+
export declare function statedSentence(body: FailedBody | undefined): StatedSentence | undefined;
|
|
151
171
|
/** The envelope's word as the echo seat carries it ({@link readProviderErrorCode}, for an envelope already in hand —
|
|
152
172
|
* an in-band error frame's): carried in the echo shape, else dropped whole and counted once. */
|
|
153
173
|
export declare function carriedProviderWord(err: {
|
package/dist/brain/errors.js
CHANGED
|
@@ -82,6 +82,120 @@ export function readProviderErrorCode(body) {
|
|
|
82
82
|
export function statedEnvelope(body) {
|
|
83
83
|
return body !== undefined && body.endedNormally ? providerErrorObject(body.text) : undefined;
|
|
84
84
|
}
|
|
85
|
+
export function statedSentence(body) {
|
|
86
|
+
const sentence = statedEnvelope(body)?.message;
|
|
87
|
+
if (body === undefined || typeof sentence !== "string")
|
|
88
|
+
return undefined;
|
|
89
|
+
const literal = envelopeMessageLiteral(body.text);
|
|
90
|
+
const units = literal === undefined ? undefined : literalUnits(body.text, literal);
|
|
91
|
+
return units !== undefined && units.text === sentence ? { sentence, written: { from: units.from, to: units.to } } : { sentence };
|
|
92
|
+
}
|
|
93
|
+
const isJsonSpace = (c) => c === " " || c === "\t" || c === "\n" || c === "\r";
|
|
94
|
+
const skipJsonSpace = (t, i) => {
|
|
95
|
+
while (isJsonSpace(t[i]))
|
|
96
|
+
i++;
|
|
97
|
+
return i;
|
|
98
|
+
};
|
|
99
|
+
function jsonStringEnd(t, i) {
|
|
100
|
+
for (let j = i + 1; j < t.length; j++) {
|
|
101
|
+
if (t[j] === "\\")
|
|
102
|
+
j++;
|
|
103
|
+
else if (t[j] === '"')
|
|
104
|
+
return j + 1;
|
|
105
|
+
}
|
|
106
|
+
return -1;
|
|
107
|
+
}
|
|
108
|
+
function jsonValueEnd(t, i) {
|
|
109
|
+
const c = t[i];
|
|
110
|
+
if (c === '"')
|
|
111
|
+
return jsonStringEnd(t, i);
|
|
112
|
+
if (c !== "{" && c !== "[") {
|
|
113
|
+
let j = i;
|
|
114
|
+
while (j < t.length && !isJsonSpace(t[j]) && t[j] !== "," && t[j] !== "}" && t[j] !== "]")
|
|
115
|
+
j++;
|
|
116
|
+
return j > i ? j : -1;
|
|
117
|
+
}
|
|
118
|
+
let depth = 0;
|
|
119
|
+
for (let j = i; j < t.length; j++) {
|
|
120
|
+
const d = t[j];
|
|
121
|
+
if (d === '"') {
|
|
122
|
+
const end = jsonStringEnd(t, j);
|
|
123
|
+
if (end < 0)
|
|
124
|
+
return -1;
|
|
125
|
+
j = end - 1;
|
|
126
|
+
}
|
|
127
|
+
else if (d === "{" || d === "[")
|
|
128
|
+
depth++;
|
|
129
|
+
else if ((d === "}" || d === "]") && --depth === 0)
|
|
130
|
+
return j + 1;
|
|
131
|
+
}
|
|
132
|
+
return -1;
|
|
133
|
+
}
|
|
134
|
+
function jsonMembers(t, i) {
|
|
135
|
+
const members = [];
|
|
136
|
+
let j = skipJsonSpace(t, i + 1);
|
|
137
|
+
if (t[j] === "}")
|
|
138
|
+
return members;
|
|
139
|
+
for (;;) {
|
|
140
|
+
if (t[j] !== '"')
|
|
141
|
+
return undefined;
|
|
142
|
+
const nameEnd = jsonStringEnd(t, j);
|
|
143
|
+
if (nameEnd < 0)
|
|
144
|
+
return undefined;
|
|
145
|
+
const name = literalUnits(t, { start: j, end: nameEnd })?.text;
|
|
146
|
+
j = skipJsonSpace(t, nameEnd);
|
|
147
|
+
if (name === undefined || t[j] !== ":")
|
|
148
|
+
return undefined;
|
|
149
|
+
const start = skipJsonSpace(t, j + 1);
|
|
150
|
+
const end = jsonValueEnd(t, start);
|
|
151
|
+
if (end < 0)
|
|
152
|
+
return undefined;
|
|
153
|
+
members.push({ name, start, end });
|
|
154
|
+
j = skipJsonSpace(t, end);
|
|
155
|
+
if (t[j] === "}")
|
|
156
|
+
return members;
|
|
157
|
+
if (t[j] !== ",")
|
|
158
|
+
return undefined;
|
|
159
|
+
j = skipJsonSpace(t, j + 1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const lastMember = (members, name) => members?.filter((m) => m.name === name).pop();
|
|
163
|
+
function envelopeMessageLiteral(text) {
|
|
164
|
+
const at = text.length - text.trimStart().length;
|
|
165
|
+
if (text[at] !== "{")
|
|
166
|
+
return undefined;
|
|
167
|
+
const error = lastMember(jsonMembers(text, at), "error");
|
|
168
|
+
if (error === undefined || text[error.start] !== "{")
|
|
169
|
+
return undefined;
|
|
170
|
+
const message = lastMember(jsonMembers(text, error.start), "message");
|
|
171
|
+
return message !== undefined && text[message.start] === '"' ? message : undefined;
|
|
172
|
+
}
|
|
173
|
+
const JSON_SHORT_ESCAPES = Object.freeze({ '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: "\n", r: "\r", t: "\t" });
|
|
174
|
+
function literalUnits(t, literal) {
|
|
175
|
+
const from = [];
|
|
176
|
+
const to = [];
|
|
177
|
+
let text = "";
|
|
178
|
+
for (let i = literal.start + 1; i < literal.end - 1;) {
|
|
179
|
+
if (t[i] !== "\\") {
|
|
180
|
+
text += t[i];
|
|
181
|
+
from.push(i);
|
|
182
|
+
to.push(i + 1);
|
|
183
|
+
i += 1;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const escape = t[i + 1] ?? "";
|
|
187
|
+
const hex = t.slice(i + 2, i + 6);
|
|
188
|
+
const unit = escape === "u" && /^[0-9A-Fa-f]{4}$/.test(hex) ? String.fromCharCode(parseInt(hex, 16)) : JSON_SHORT_ESCAPES[escape];
|
|
189
|
+
if (unit === undefined)
|
|
190
|
+
return undefined;
|
|
191
|
+
const width = escape === "u" ? 6 : 2;
|
|
192
|
+
text += unit;
|
|
193
|
+
from.push(i);
|
|
194
|
+
to.push(i + width);
|
|
195
|
+
i += width;
|
|
196
|
+
}
|
|
197
|
+
return { text, from: Int32Array.from(from), to: Int32Array.from(to) };
|
|
198
|
+
}
|
|
85
199
|
export function carriedProviderWord(err) {
|
|
86
200
|
const word = providerErrorWord(err);
|
|
87
201
|
const reading = providerEchoReading(word);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type FailedBody } from "./errors.js";
|
|
2
2
|
/** The bound on a carried sentence, in code points (cut after the pass, so a cut leaves no part of a credential the pass withheld). */
|
|
3
3
|
export declare const PROVIDER_MESSAGE_MAX_CHARS = 240;
|
|
4
|
-
/** A sentence through the one pass
|
|
5
|
-
|
|
4
|
+
/** A sentence through the one pass, with `asSent` (parts of it the raw-body reading withholds) taken out too; `undefined` for a
|
|
5
|
+
* value that is not a string, or says nothing once the pass has folded it. */
|
|
6
|
+
export declare function providerMessageOf(sentence: unknown, declared: readonly string[], asSent?: readonly string[]): string | undefined;
|
|
6
7
|
/** The sentence a failed response's envelope states, as the engine carries it; `declared` = the request's declared values. */
|
|
7
8
|
export declare function readProviderMessage(body: FailedBody | undefined, declared: readonly string[]): string | undefined;
|
|
8
|
-
/** A value that crossed a seat the engine did not mint (a host Brain's message or status): the same pass, no declared values
|
|
9
|
+
/** A value that crossed a seat the engine did not mint (a host Brain's message or status): the same pass, no declared values,
|
|
10
|
+
* read as written only (no body comes with it). */
|
|
9
11
|
export declare function admittedProviderMessage(value: unknown): string | undefined;
|
|
@@ -1,18 +1,45 @@
|
|
|
1
|
-
import { remoteWords } from "../core/protocol-http-auth.js";
|
|
1
|
+
import { remoteWords, remoteWordsSpans } from "../core/protocol-http-auth.js";
|
|
2
2
|
import { egressCredentialParts, egressText } from "../core/untrusted-egress.js";
|
|
3
|
-
import { inlineUntrusted } from "../core/untrusted-text.js";
|
|
4
|
-
import {
|
|
3
|
+
import { foldToOneLine, inlineUntrusted } from "../core/untrusted-text.js";
|
|
4
|
+
import { statedSentence } from "./errors.js";
|
|
5
5
|
export const PROVIDER_MESSAGE_MAX_CHARS = 240;
|
|
6
|
-
export function providerMessageOf(sentence, declared) {
|
|
6
|
+
export function providerMessageOf(sentence, declared, asSent = []) {
|
|
7
7
|
if (typeof sentence !== "string")
|
|
8
8
|
return undefined;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const carried = inlineUntrusted(egressText("human", remoteWords(oneLine(sentence), withheld)), PROVIDER_MESSAGE_MAX_CHARS);
|
|
9
|
+
const parts = [...egressCredentialParts(sentence), ...asSent].map(foldToOneLine);
|
|
10
|
+
const carried = inlineUntrusted(egressText("human", remoteWords(foldToOneLine(sentence), declared, parts)), PROVIDER_MESSAGE_MAX_CHARS);
|
|
12
11
|
return carried === "" ? undefined : carried;
|
|
13
12
|
}
|
|
13
|
+
function firstAbove(a, v) {
|
|
14
|
+
let lo = 0;
|
|
15
|
+
let hi = a.length;
|
|
16
|
+
while (lo < hi) {
|
|
17
|
+
const mid = (lo + hi) >> 1;
|
|
18
|
+
if (a[mid] > v)
|
|
19
|
+
hi = mid;
|
|
20
|
+
else
|
|
21
|
+
lo = mid + 1;
|
|
22
|
+
}
|
|
23
|
+
return lo;
|
|
24
|
+
}
|
|
25
|
+
function partsAsSent(body, stated, declared) {
|
|
26
|
+
if (stated.written === undefined)
|
|
27
|
+
return [stated.sentence];
|
|
28
|
+
const { from, to } = stated.written;
|
|
29
|
+
if (from.length === 0)
|
|
30
|
+
return [];
|
|
31
|
+
const parts = [];
|
|
32
|
+
for (const [start, end] of remoteWordsSpans(body.text, declared)) {
|
|
33
|
+
const first = firstAbove(to, start);
|
|
34
|
+
const last = firstAbove(from, end - 1) - 1;
|
|
35
|
+
if (first <= last)
|
|
36
|
+
parts.push(stated.sentence.slice(first, last + 1));
|
|
37
|
+
}
|
|
38
|
+
return parts;
|
|
39
|
+
}
|
|
14
40
|
export function readProviderMessage(body, declared) {
|
|
15
|
-
|
|
41
|
+
const stated = statedSentence(body);
|
|
42
|
+
return stated === undefined || body === undefined ? undefined : providerMessageOf(stated.sentence, declared, partsAsSent(body, stated, declared));
|
|
16
43
|
}
|
|
17
44
|
export function admittedProviderMessage(value) {
|
|
18
45
|
return providerMessageOf(value, []);
|
|
@@ -88,12 +88,27 @@ export declare function eraseSentCredentials(text: string, credentials: readonly
|
|
|
88
88
|
* ({@link scrubRequestEcho}: `declared` is required, so no mint reads a remote's words without naming its request), then the credential
|
|
89
89
|
* vocabulary. Words with no declared value in them read exactly as the vocabulary renders them. Where a declared value is there, the
|
|
90
90
|
* values the vocabulary finds in the ORIGINAL words are taken out with it, so neither disarms the other: removing a declared `Bearer`
|
|
91
|
-
* cannot hide the token after it from the vocabulary, and the vocabulary rewriting part of a declared value cannot leave the rest.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
91
|
+
* cannot hide the token after it from the vocabulary, and the vocabulary rewriting part of a declared value cannot leave the rest.
|
|
92
|
+
* `found` are values the vocabulary found in another spelling of the same words (a reader that carries the words in one spelling and
|
|
93
|
+
* read them in another); they and the values found here are taken out wherever they stand, a Cookie member's name included (only a
|
|
94
|
+
* declared value spares it). A caller that bounds the text for display cuts what this returns, never the remote's raw words, so a cut
|
|
95
|
+
* can leave no part of a value. The function is a fixed point (its own output answers the same text). A store, a log or an event lane
|
|
96
|
+
* that receives the result does not redact again: persistence is not an exit, the mint is.
|
|
95
97
|
*/
|
|
96
|
-
export declare function remoteWords(text: string, declared: readonly string[]): Egress<"same-principal">;
|
|
98
|
+
export declare function remoteWords(text: string, declared: readonly string[], found?: readonly string[]): Egress<"same-principal">;
|
|
99
|
+
/**
|
|
100
|
+
* What {@link remoteWords} withholds of `text`, as [start, end) spans in the text's coordinates — THE answer to "which characters of
|
|
101
|
+
* these words does their remote-words reading not carry", for a reader that carries the same words in another spelling and must carry
|
|
102
|
+
* no less: the ranges its echo pass takes (merged, as its marks stand for them) and the spans its vocabulary pass then withholds
|
|
103
|
+
* ({@link egressCredentialReading}: the label a rendering keeps is in the span), read back through those marks (a span that touches a
|
|
104
|
+
* mark reaches the whole range the mark stands for). Checked against the reading's own output: where the text outside the spans does
|
|
105
|
+
* not stand in it as written ({@link carriesTheRest}), the spans missed a removal, and the answer is the whole text.
|
|
106
|
+
*/
|
|
107
|
+
export declare function remoteWordsSpans(text: string, declared: readonly string[], found?: readonly string[]): Array<readonly [number, number]>;
|
|
108
|
+
/** Whether `rendered` carries, as written and in order, every character of `text` outside `spans`: the text between the spans (merged)
|
|
109
|
+
* stands in `rendered` piece by piece — the first at its start, the last at its end, each other one after the one before. Exported for
|
|
110
|
+
* its pins; not on the package barrel. */
|
|
111
|
+
export declare function carriesTheRest(text: string, spans: ReadonlyArray<readonly [number, number]>, rendered: string): boolean;
|
|
97
112
|
/** Whether a resolved header set carries anything the declaration bound to its endpoints — a request that does follows no redirect (the
|
|
98
113
|
* next hop is not a declared endpoint; A2A's follow law reads this). */
|
|
99
114
|
export declare function carriesDeclaredHeaders(headers: Record<string, string> | undefined): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isLoopbackHost } from "./host-floor.js";
|
|
2
2
|
import { authSchemeCredentials } from "./secret-env.js";
|
|
3
|
-
import { egressText } from "./untrusted-egress.js";
|
|
3
|
+
import { egressCredentialReading, egressText } from "./untrusted-egress.js";
|
|
4
4
|
import { REDACTION_MARK, redactionMarkerSpans } from "./redaction-marks.js";
|
|
5
5
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
6
6
|
import { callerText } from "./caller-text.js";
|
|
@@ -113,27 +113,31 @@ export function eraseSentCredentials(text, credentials) {
|
|
|
113
113
|
return text;
|
|
114
114
|
return markedOver(text, needleRanges(text, credentials, []));
|
|
115
115
|
}
|
|
116
|
+
function mergedRanges(removed) {
|
|
117
|
+
const merged = [];
|
|
118
|
+
for (const [start, end] of [...removed].sort((a, b) => a[0] - b[0] || b[1] - a[1])) {
|
|
119
|
+
const last = merged[merged.length - 1];
|
|
120
|
+
if (last !== undefined && start <= last[1])
|
|
121
|
+
last[1] = Math.max(last[1], end);
|
|
122
|
+
else
|
|
123
|
+
merged.push([start, end]);
|
|
124
|
+
}
|
|
125
|
+
return merged;
|
|
126
|
+
}
|
|
116
127
|
function markedOver(text, removed) {
|
|
117
128
|
if (removed.length === 0)
|
|
118
129
|
return text;
|
|
119
|
-
removed.sort((a, b) => a[0] - b[0] || b[1] - a[1]);
|
|
120
130
|
let out = "";
|
|
121
131
|
let kept = 0;
|
|
122
|
-
|
|
123
|
-
for (const [start, end] of removed) {
|
|
124
|
-
if (wrote && start <= kept) {
|
|
125
|
-
kept = Math.max(kept, end);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
132
|
+
for (const [start, end] of mergedRanges(removed)) {
|
|
128
133
|
out += text.slice(kept, start) + REDACTION_MARK;
|
|
129
134
|
kept = end;
|
|
130
|
-
wrote = true;
|
|
131
135
|
}
|
|
132
136
|
return out + text.slice(kept);
|
|
133
137
|
}
|
|
134
|
-
function requestEchoRanges(text, declared) {
|
|
138
|
+
function requestEchoRanges(text, declared, found = []) {
|
|
135
139
|
const members = cookieMembers(text);
|
|
136
|
-
return [...members.map(([, from, end]) => [from, end]), ...needleRanges(text, declared, members)];
|
|
140
|
+
return [...members.map(([, from, end]) => [from, end]), ...needleRanges(text, declared, members), ...needleRanges(text, found, [])];
|
|
137
141
|
}
|
|
138
142
|
function needleRanges(text, values, members) {
|
|
139
143
|
const forms = new Set();
|
|
@@ -153,26 +157,56 @@ function needleRanges(text, values, members) {
|
|
|
153
157
|
}
|
|
154
158
|
return removed;
|
|
155
159
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
160
|
+
export function remoteWords(text, declared, found = []) {
|
|
161
|
+
return egressText("same-principal", markedOver(text, echoTaken(text, declared, found)));
|
|
162
|
+
}
|
|
163
|
+
function echoTaken(text, declared, found) {
|
|
164
|
+
if (requestEchoRanges(text, declared, found).length === 0)
|
|
165
|
+
return [];
|
|
166
|
+
return requestEchoRanges(text, declared, [...found, ...egressCredentialReading(text).spans.map(([start, end]) => text.slice(start, end))]);
|
|
167
|
+
}
|
|
168
|
+
export function remoteWordsSpans(text, declared, found = []) {
|
|
169
|
+
const taken = mergedRanges(echoTaken(text, declared, found));
|
|
170
|
+
const marked = markedOver(text, taken);
|
|
171
|
+
const reading = egressCredentialReading(marked);
|
|
172
|
+
const lo = new Int32Array(marked.length);
|
|
173
|
+
const hi = new Int32Array(marked.length);
|
|
174
|
+
let at = 0;
|
|
175
|
+
let kept = 0;
|
|
176
|
+
const keep = (until) => {
|
|
177
|
+
for (; kept < until; kept++, at++)
|
|
178
|
+
[lo[at], hi[at]] = [kept, kept + 1];
|
|
179
|
+
};
|
|
180
|
+
for (const [start, end] of taken) {
|
|
181
|
+
keep(start);
|
|
182
|
+
for (let k = 0; k < REDACTION_MARK.length; k++, at++)
|
|
183
|
+
[lo[at], hi[at]] = [start, end];
|
|
184
|
+
kept = end;
|
|
185
|
+
}
|
|
186
|
+
keep(text.length);
|
|
187
|
+
const spans = [...taken, ...reading.spans.filter(([start, end]) => end > start).map(([start, end]) => [lo[start], hi[end - 1]])];
|
|
188
|
+
return carriesTheRest(text, spans, reading.rendered) ? spans : [[0, text.length]];
|
|
189
|
+
}
|
|
190
|
+
export function carriesTheRest(text, spans, rendered) {
|
|
191
|
+
const pieces = [];
|
|
192
|
+
let kept = 0;
|
|
193
|
+
for (const [start, end] of mergedRanges(spans)) {
|
|
194
|
+
pieces.push(text.slice(kept, start));
|
|
195
|
+
kept = end;
|
|
196
|
+
}
|
|
197
|
+
const last = text.slice(kept);
|
|
198
|
+
if (pieces.length === 0)
|
|
199
|
+
return rendered === last;
|
|
200
|
+
if (!rendered.startsWith(pieces[0]))
|
|
201
|
+
return false;
|
|
202
|
+
let at = pieces[0].length;
|
|
203
|
+
for (const piece of pieces.slice(1)) {
|
|
204
|
+
const found = rendered.indexOf(piece, at);
|
|
205
|
+
if (found < 0)
|
|
206
|
+
return false;
|
|
207
|
+
at = found + piece.length;
|
|
208
|
+
}
|
|
209
|
+
return rendered.length - last.length >= at && rendered.endsWith(last);
|
|
176
210
|
}
|
|
177
211
|
function cookieMembers(text) {
|
|
178
212
|
const members = [];
|
|
@@ -40,9 +40,20 @@ export type Egress<T extends EgressTier> = string & {
|
|
|
40
40
|
/** Tier `tier`'s one pass over a text. A report's `preexistingMarkers` counts the engine's own marks ({@link REDACTION_MARKS})
|
|
41
41
|
* already in the text. */
|
|
42
42
|
export declare function egressText<T extends EgressTier>(tier: T, text: string, report?: RedactionReport): Egress<T>;
|
|
43
|
-
/** The
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
/** The egress pass's credential vocabulary over `text` (the `same-principal` tier's pass): what it renders, and the spans of `text` it
|
|
44
|
+
* withholds, as [start, end) in `text`'s coordinates — the renderer's own account of what it took (every hit of every pass, read as
|
|
45
|
+
* written and with its format characters removed, a later pass's over the words an earlier one's mark left, each mapped back to the
|
|
46
|
+
* text), each less the head and tail its own rendering keeps around the mark (`x-api-key: ` stays, the value is what goes; a hit its
|
|
47
|
+
* rendering keeps nothing of is taken whole); the whole text when the pass withholds it whole. */
|
|
48
|
+
export declare function egressCredentialReading(text: string): {
|
|
49
|
+
readonly rendered: string;
|
|
50
|
+
readonly spans: Array<readonly [number, number]>;
|
|
51
|
+
};
|
|
52
|
+
/** The parts of `text` the egress pass's credential vocabulary reads as credentials, as the substrings they cover: every hit its
|
|
53
|
+
* scanner reads, as written and with its format characters removed (a hit another one holds included — `Basic <x>` inside
|
|
54
|
+
* `Basic <x>-<y>`, so `<x>` standing alone elsewhere is a credential too), with the renderer's own account
|
|
55
|
+
* ({@link egressCredentialReading}: a later pass's hit over the words an earlier mark set apart); the whole text when either reads
|
|
56
|
+
* it whole. A reader that carries the text in another spelling (folded to one line) takes these out of that spelling. */
|
|
46
57
|
export declare function egressCredentialParts(text: string): string[];
|
|
47
58
|
/** The text a thrown value reads as (`thrownText`), through tier `tier`'s pass: the one form a thrown value's words take
|
|
48
59
|
* on their way out of the engine. */
|
|
@@ -32,9 +32,28 @@ export function egressText(tier, text, report) {
|
|
|
32
32
|
report.preexistingMarkers = redactionMarkerSpans(text).length;
|
|
33
33
|
return renderSecrets(text, EGRESS_POLICY, REDACTION_NOTATION, { passes: TIER_PASSES[tier], report });
|
|
34
34
|
}
|
|
35
|
+
export function egressCredentialReading(text) {
|
|
36
|
+
const report = { findings: [] };
|
|
37
|
+
const rendered = egressText("same-principal", text, report);
|
|
38
|
+
if (rendered === REDACTION_NOTATION.overStrip && rendered !== text)
|
|
39
|
+
return { rendered, spans: [[0, text.length]] };
|
|
40
|
+
return { rendered, spans: report.findings.map(({ span: [from, end] }) => withheldOf(text, from, end)) };
|
|
41
|
+
}
|
|
42
|
+
function withheldOf(text, from, end) {
|
|
43
|
+
const found = text.slice(from, end);
|
|
44
|
+
const rendered = egressText("same-principal", found);
|
|
45
|
+
let head = 0;
|
|
46
|
+
while (head < found.length && head < rendered.length && found[head] === rendered[head])
|
|
47
|
+
head++;
|
|
48
|
+
let tail = 0;
|
|
49
|
+
while (tail < found.length - head && tail < rendered.length - head && found[found.length - 1 - tail] === rendered[rendered.length - 1 - tail])
|
|
50
|
+
tail++;
|
|
51
|
+
return head + tail >= found.length ? [from, end] : [from + head, end - tail];
|
|
52
|
+
}
|
|
35
53
|
export function egressCredentialParts(text) {
|
|
36
54
|
const scan = scanSecrets(text, EGRESS_POLICY);
|
|
37
|
-
|
|
55
|
+
const scanned = scan.outcome === "whole" ? [text] : scan.spans.map(({ start, end }) => text.slice(start, end));
|
|
56
|
+
return [...scanned, ...egressCredentialReading(text).spans.map(([start, end]) => text.slice(start, end))];
|
|
38
57
|
}
|
|
39
58
|
export function egressThrownText(tier, err) {
|
|
40
59
|
return egressText(tier, thrownText(err));
|
|
@@ -404,6 +404,12 @@ export declare function defuseControlChars(text: string): string;
|
|
|
404
404
|
* reader compiles it with the `u` flag, which `\p{Cf}` needs.
|
|
405
405
|
*/
|
|
406
406
|
export declare const UNRENDERABLE_CHAR_CLASS = "\\u0000-\\u0008\\u000A-\\u001F\\u007F-\\u009F\\p{Cf}\\u2028\\u2029";
|
|
407
|
+
/**
|
|
408
|
+
* {@link inlineUntrusted}'s fold alone — every run of whitespace or {@link UNRENDERABLE_CHAR_CLASS} characters as one space, the
|
|
409
|
+
* edges trimmed — with no cap and no neutralization: the one-line form a pass reads before {@link inlineUntrusted} makes the
|
|
410
|
+
* result fit a trusted line. It only replaces runs, so the fold of any substring of a text is a substring of the text's fold.
|
|
411
|
+
*/
|
|
412
|
+
export declare function foldToOneLine(text: string): string;
|
|
407
413
|
/**
|
|
408
414
|
* Make untrusted text safe to interpolate INLINE on a trusted prompt line (not inside a {@link delimitUntrusted}
|
|
409
415
|
* fence) — e.g. design/80 D-F echoes a chosen option label into the "The user answered:" block. Folds EVERY
|
|
@@ -563,8 +563,11 @@ export function defuseControlChars(text) {
|
|
|
563
563
|
const LABEL_MAX = 160;
|
|
564
564
|
export const UNRENDERABLE_CHAR_CLASS = "\\u0000-\\u0008\\u000A-\\u001F\\u007F-\\u009F\\p{Cf}\\u2028\\u2029";
|
|
565
565
|
const INLINE_FOLD_RE = new RegExp(`[\\s${UNRENDERABLE_CHAR_CLASS}]+`, "gu");
|
|
566
|
+
export function foldToOneLine(text) {
|
|
567
|
+
return text.replace(INLINE_FOLD_RE, " ").trim();
|
|
568
|
+
}
|
|
566
569
|
export function inlineUntrusted(text, maxLen = LABEL_MAX) {
|
|
567
|
-
const oneLine = text
|
|
570
|
+
const oneLine = foldToOneLine(text);
|
|
568
571
|
const cps = [...oneLine];
|
|
569
572
|
const capped = cps.length > maxLen ? cps.slice(0, maxLen).join("") + INLINE_TRUNCATION_MARK : oneLine;
|
|
570
573
|
const out = neutralizeForFence(capped);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.67.
|
|
3
|
+
"version": "7.67.3",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"dependencies": {
|
|
132
132
|
"@modelcontextprotocol/client": "2.4.0",
|
|
133
133
|
"@modelcontextprotocol/core": "2.4.0",
|
|
134
|
-
"@sema-agent/primitives": "7.67.
|
|
134
|
+
"@sema-agent/primitives": "7.67.3",
|
|
135
135
|
"typebox": "1.1.39",
|
|
136
136
|
"undici": "7.30.0"
|
|
137
137
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"package": "@sema-agent/core-stores-sql",
|
|
4
|
+
"version": "7.67.3",
|
|
5
|
+
"from": "13086f70a6e4bbeeaba792feb1a7b1d130fcf70b",
|
|
6
|
+
"to": "v7.67.3",
|
|
7
|
+
"added": [],
|
|
8
|
+
"removed": [],
|
|
9
|
+
"changed": [],
|
|
10
|
+
"subpaths": [],
|
|
11
|
+
"subpathsUnread": [
|
|
12
|
+
"from",
|
|
13
|
+
"to"
|
|
14
|
+
],
|
|
15
|
+
"narrowed": [],
|
|
16
|
+
"faces": {
|
|
17
|
+
"open": [],
|
|
18
|
+
"source": null
|
|
19
|
+
},
|
|
20
|
+
"closedSetMembers": [],
|
|
21
|
+
"closedSetsUnreadable": [],
|
|
22
|
+
"typeKeys": [],
|
|
23
|
+
"typeKeysUnreadableArms": [],
|
|
24
|
+
"typeKeysFlattenedCount": 3,
|
|
25
|
+
"signatures": [],
|
|
26
|
+
"versionLiterals": [],
|
|
27
|
+
"declarationMoves": [],
|
|
28
|
+
"mintMoves": [],
|
|
29
|
+
"criteriaObserves": [],
|
|
30
|
+
"consumersHint": {
|
|
31
|
+
"cli": [],
|
|
32
|
+
"server": [],
|
|
33
|
+
"sdk": [],
|
|
34
|
+
"note": "scanned cli@bb8ce63a server@b7a58474c sdk@3708338 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
35
|
+
},
|
|
36
|
+
"breakingCount": 0,
|
|
37
|
+
"breakingItems": [],
|
|
38
|
+
"toResolvedAt": "6f2a5d74a12787a191fcfea2e0226ac557043aa0"
|
|
39
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"version": "7.67.3",
|
|
4
|
+
"from": "13086f70a6e4bbeeaba792feb1a7b1d130fcf70b",
|
|
5
|
+
"to": "v7.67.3",
|
|
6
|
+
"added": [],
|
|
7
|
+
"removed": [],
|
|
8
|
+
"changed": [],
|
|
9
|
+
"subpaths": [],
|
|
10
|
+
"narrowed": [
|
|
11
|
+
{
|
|
12
|
+
"id": "F1",
|
|
13
|
+
"source": "behaviorFlips.summary",
|
|
14
|
+
"text": "#4343 (P0, Security; CHANGELOG fields: behavior change: narrowing — more of such a sentence renders `[redacted]`; widening: a value read inside an engine tag now leaves the rest of the sentence readable; hard-breaking: none; closed sets: none; exports: none from the package root; wire: none): the provider's own sentence `providerMessage` — on `terminal.detail` of a `provider_rejected` refusal and on the retry frame `BrainStatus` — is no weaker than the same response's `terminal.message`: a value after a scheme word or a credential label split inside by a line break, a tab, VT / FF / CR, or a Unicode space or plain space the endpoint wrote as an escape, no longer leaves the part after the split; and nothing 7.67.2 withheld from that sentence is carried now. A found value is also taken out of a Cookie member's name on every face that mints through `remoteWords` (narrowing)."
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"faces": {
|
|
18
|
+
"open": [
|
|
19
|
+
"TRACE_EVENT_KINDS",
|
|
20
|
+
"TraceEvent"
|
|
21
|
+
],
|
|
22
|
+
"source": "src/core/contract-faces.ts"
|
|
23
|
+
},
|
|
24
|
+
"closedSetMembers": [],
|
|
25
|
+
"closedSetsUnreadable": [],
|
|
26
|
+
"typeKeys": [],
|
|
27
|
+
"typeKeysUnreadableArms": [],
|
|
28
|
+
"typeKeysFlattenedCount": 299,
|
|
29
|
+
"signatures": [],
|
|
30
|
+
"versionLiterals": [],
|
|
31
|
+
"declarationMoves": [],
|
|
32
|
+
"mintMoves": [],
|
|
33
|
+
"criteriaObserves": [
|
|
34
|
+
{
|
|
35
|
+
"kind": "typeMember",
|
|
36
|
+
"name": "BrainStatus.providerMessage",
|
|
37
|
+
"assertions": [
|
|
38
|
+
"G1.a",
|
|
39
|
+
"G1.b",
|
|
40
|
+
"G2.a",
|
|
41
|
+
"G3.a"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"kind": "typeMember",
|
|
46
|
+
"name": "TaskResult.terminal.detail.providerMessage",
|
|
47
|
+
"assertions": [
|
|
48
|
+
"G1.a",
|
|
49
|
+
"G2.a",
|
|
50
|
+
"G3.a",
|
|
51
|
+
"G4.a",
|
|
52
|
+
"G5.a"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"consumersHint": {
|
|
57
|
+
"cli": [],
|
|
58
|
+
"server": [],
|
|
59
|
+
"sdk": [],
|
|
60
|
+
"note": "scanned cli@bb8ce63a server@b7a58474c sdk@3708338 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
61
|
+
},
|
|
62
|
+
"breakingCount": 0,
|
|
63
|
+
"breakingItems": [],
|
|
64
|
+
"toResolvedAt": "6f2a5d74a12787a191fcfea2e0226ac557043aa0"
|
|
65
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"package": "@sema-agent/mods-kernel",
|
|
4
|
+
"version": "7.67.3",
|
|
5
|
+
"from": "13086f70a6e4bbeeaba792feb1a7b1d130fcf70b",
|
|
6
|
+
"to": "v7.67.3",
|
|
7
|
+
"added": [],
|
|
8
|
+
"removed": [],
|
|
9
|
+
"changed": [],
|
|
10
|
+
"subpaths": [],
|
|
11
|
+
"subpathsUnread": [
|
|
12
|
+
"from",
|
|
13
|
+
"to"
|
|
14
|
+
],
|
|
15
|
+
"narrowed": [],
|
|
16
|
+
"faces": {
|
|
17
|
+
"open": [],
|
|
18
|
+
"source": null
|
|
19
|
+
},
|
|
20
|
+
"closedSetMembers": [],
|
|
21
|
+
"closedSetsUnreadable": [],
|
|
22
|
+
"typeKeys": [],
|
|
23
|
+
"typeKeysUnreadableArms": [],
|
|
24
|
+
"typeKeysFlattenedCount": 1,
|
|
25
|
+
"signatures": [],
|
|
26
|
+
"versionLiterals": [],
|
|
27
|
+
"declarationMoves": [],
|
|
28
|
+
"mintMoves": [],
|
|
29
|
+
"criteriaObserves": [],
|
|
30
|
+
"consumersHint": {
|
|
31
|
+
"cli": [],
|
|
32
|
+
"server": [],
|
|
33
|
+
"sdk": [],
|
|
34
|
+
"note": "scanned cli@bb8ce63a server@b7a58474c sdk@3708338 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
35
|
+
},
|
|
36
|
+
"breakingCount": 0,
|
|
37
|
+
"breakingItems": [],
|
|
38
|
+
"toResolvedAt": "6f2a5d74a12787a191fcfea2e0226ac557043aa0"
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"package": "@sema-agent/primitives",
|
|
4
|
+
"version": "7.67.3",
|
|
5
|
+
"from": "13086f70a6e4bbeeaba792feb1a7b1d130fcf70b",
|
|
6
|
+
"to": "v7.67.3",
|
|
7
|
+
"added": [],
|
|
8
|
+
"removed": [],
|
|
9
|
+
"changed": [],
|
|
10
|
+
"subpaths": [],
|
|
11
|
+
"subpathsUnread": [
|
|
12
|
+
"from",
|
|
13
|
+
"to"
|
|
14
|
+
],
|
|
15
|
+
"narrowed": [],
|
|
16
|
+
"faces": {
|
|
17
|
+
"open": [],
|
|
18
|
+
"source": null
|
|
19
|
+
},
|
|
20
|
+
"closedSetMembers": [],
|
|
21
|
+
"closedSetsUnreadable": [],
|
|
22
|
+
"typeKeys": [],
|
|
23
|
+
"typeKeysUnreadableArms": [],
|
|
24
|
+
"typeKeysFlattenedCount": 7,
|
|
25
|
+
"signatures": [],
|
|
26
|
+
"versionLiterals": [],
|
|
27
|
+
"declarationMoves": [],
|
|
28
|
+
"mintMoves": [],
|
|
29
|
+
"criteriaObserves": [],
|
|
30
|
+
"consumersHint": {
|
|
31
|
+
"cli": [],
|
|
32
|
+
"server": [],
|
|
33
|
+
"sdk": [],
|
|
34
|
+
"note": "scanned cli@bb8ce63a server@b7a58474c sdk@3708338 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
35
|
+
},
|
|
36
|
+
"breakingCount": 0,
|
|
37
|
+
"breakingItems": [],
|
|
38
|
+
"toResolvedAt": "6f2a5d74a12787a191fcfea2e0226ac557043aa0"
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"package": "@sema-agent/wiki-gate",
|
|
4
|
+
"version": "7.67.3",
|
|
5
|
+
"from": "13086f70a6e4bbeeaba792feb1a7b1d130fcf70b",
|
|
6
|
+
"to": "v7.67.3",
|
|
7
|
+
"added": [],
|
|
8
|
+
"removed": [],
|
|
9
|
+
"changed": [],
|
|
10
|
+
"subpaths": [],
|
|
11
|
+
"subpathsUnread": [
|
|
12
|
+
"from",
|
|
13
|
+
"to"
|
|
14
|
+
],
|
|
15
|
+
"narrowed": [],
|
|
16
|
+
"faces": {
|
|
17
|
+
"open": [],
|
|
18
|
+
"source": null
|
|
19
|
+
},
|
|
20
|
+
"closedSetMembers": [],
|
|
21
|
+
"closedSetsUnreadable": [],
|
|
22
|
+
"typeKeys": [],
|
|
23
|
+
"typeKeysUnreadableArms": [],
|
|
24
|
+
"typeKeysFlattenedCount": 5,
|
|
25
|
+
"signatures": [],
|
|
26
|
+
"versionLiterals": [],
|
|
27
|
+
"declarationMoves": [],
|
|
28
|
+
"mintMoves": [],
|
|
29
|
+
"criteriaObserves": [],
|
|
30
|
+
"consumersHint": {
|
|
31
|
+
"cli": [],
|
|
32
|
+
"server": [],
|
|
33
|
+
"sdk": [],
|
|
34
|
+
"note": "scanned cli@bb8ce63a server@b7a58474c sdk@3708338 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
35
|
+
},
|
|
36
|
+
"breakingCount": 0,
|
|
37
|
+
"breakingItems": [],
|
|
38
|
+
"toResolvedAt": "6f2a5d74a12787a191fcfea2e0226ac557043aa0"
|
|
39
|
+
}
|