stitchkit 0.112.0 → 0.112.2
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 +13 -0
- package/dist/agent-runtime/history.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/harness.js +1 -1
- package/dist/entrypoints/agent-runtime.js +1 -1
- package/dist/entrypoints/tracking.js +12 -6
- package/dist/{index-5as18gs2.js → index-a0vj9edp.js} +1 -1
- package/dist/tracking/clicks.d.ts +3 -1
- package/dist/tracking/clicks.d.ts.map +1 -1
- package/dist/tracking/client-listeners.d.ts +1 -0
- package/dist/tracking/client-listeners.d.ts.map +1 -1
- package/dist/tracking/client.d.ts +3 -1
- package/dist/tracking/client.d.ts.map +1 -1
- package/llms/agent-runtime.2.txt +57 -103
- package/llms/agent-runtime.3.txt +117 -1
- package/llms/agent-runtime.txt +1 -1
- package/llms/tracking.txt +20 -2
- package/llms-full.txt +86 -2
- package/llms.txt +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,19 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.112.2] - 2026-10-25
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `stitchkit/tracking` — `resolveTrackedClick` and `createTrackingClient` accept `hrefPolicy: 'full'` to retain internal and outbound click query parameters and fragments before consumer `decorate` redaction. The default `path-only` policy, navigation classification, labels and listener cleanup stay unchanged; URL credentials remain excluded.
|
|
23
|
+
|
|
24
|
+
## [0.112.1] - 2026-10-25
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- `stitchkit/agent-runtime` — an empty or control-only failed assistant now retains its non-success marker when explicitly included with `evidencePolicy.failedAssistant: 'assistant-marked'`. The default still omits failed evidence. The compaction guide explains the existing failed-prefix recovery policy, status-aware summarization, and why a closed tool exchange cannot settle an external effect. → ADR 0269
|
|
29
|
+
**Affects:** `stitchkit/agent-runtime` projectAgentHistory, projectAgentHistoryDetailed
|
|
30
|
+
|
|
18
31
|
## [0.112.0] - 2026-10-24
|
|
19
32
|
|
|
20
33
|
### ⚠️ Breaking changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAsB,MAAM,IAAI,CAAC;AAO1E,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAyB,MAAM,WAAW,CAAC;AACvF,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;AAE3B,KAAK,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,WAAW,6BAA6B;IAC5C,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,WAAW,CAAC,CACV,IAAI,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EACjD,OAAO,EAAE,YAAY,GACpB,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC3C,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9C,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,GAAG,aAAa,GAAG,MAAM,CAAC;CACpE;AAED,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IA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AAoB,CAAC,EAAE,kBAAkB,GAAG,aAAa,GAAG,MAAM,CAAC;CACpE;AAED,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,MAAM,EACF,WAAW,GACX,iBAAiB,GACjB,OAAO,GACP,mBAAmB,GACnB,sBAAsB,GACtB,aAAa,GACb,YAAY,CAAC;IACjB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,SAAS,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACrD;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AA2MD,wEAAwE;AACxE,wBAAsB,2BAA2B,CAC/C,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,4BAA4B,CAAC,CA4GvC;AAED,4EAA4E;AAC5E,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,YAAY,EAAE,CAAC,CAEzB"}
|
|
@@ -5,7 +5,7 @@ import"../../index-8kzct1d6.js";
|
|
|
5
5
|
import {
|
|
6
6
|
composeAgentPrompt2,
|
|
7
7
|
createAgentRuntime2
|
|
8
|
-
} from "../../index-
|
|
8
|
+
} from "../../index-a0vj9edp.js";
|
|
9
9
|
import"../../index-qaet40b2.js";
|
|
10
10
|
import"../../index-mnkk1ffz.js";
|
|
11
11
|
import"../../index-fynr93w4.js";
|
|
@@ -204,17 +204,18 @@ function sendUnloadBeacon(url, body, sender = typeof navigator === "undefined" ?
|
|
|
204
204
|
function label(target) {
|
|
205
205
|
return (target?.textContent ?? "").trim().slice(0, 100) || undefined;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function trackedHref(value, origin, policy) {
|
|
208
208
|
if (!value)
|
|
209
209
|
return;
|
|
210
210
|
try {
|
|
211
211
|
const url = new URL(value, origin);
|
|
212
|
-
|
|
212
|
+
const path = `${url.pathname}${policy === "full" ? url.search + url.hash : ""}`;
|
|
213
|
+
return url.origin === origin ? path : `${url.origin}${path}`;
|
|
213
214
|
} catch {
|
|
214
215
|
return;
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
|
-
function resolveTrackedClick(target, { origin, attributes = {}, isAction = () => true }) {
|
|
218
|
+
function resolveTrackedClick(target, { origin, attributes = {}, isAction = () => true, hrefPolicy }) {
|
|
218
219
|
if (!target)
|
|
219
220
|
return null;
|
|
220
221
|
const trackAttribute = attributes.track ?? "data-track";
|
|
@@ -247,12 +248,15 @@ function resolveTrackedClick(target, { origin, attributes = {}, isAction = () =>
|
|
|
247
248
|
result.click = {
|
|
248
249
|
element,
|
|
249
250
|
elementText: label(tracked),
|
|
250
|
-
href:
|
|
251
|
+
href: trackedHref(href, origin, hrefPolicy)
|
|
251
252
|
};
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
if (outbound && href) {
|
|
255
|
-
result.outbound = {
|
|
256
|
+
result.outbound = {
|
|
257
|
+
href: trackedHref(href, origin, hrefPolicy) ?? href,
|
|
258
|
+
label: label(anchor)
|
|
259
|
+
};
|
|
256
260
|
}
|
|
257
261
|
return result.interaction || result.click || result.outbound ? result : null;
|
|
258
262
|
}
|
|
@@ -299,7 +303,8 @@ function wireTrackingListeners(deps) {
|
|
|
299
303
|
const click = resolveTrackedClick(target, {
|
|
300
304
|
origin: host.page().origin,
|
|
301
305
|
attributes: deps.clickAttributes,
|
|
302
|
-
isAction: deps.isAction
|
|
306
|
+
isAction: deps.isAction,
|
|
307
|
+
hrefPolicy: deps.hrefPolicy
|
|
303
308
|
});
|
|
304
309
|
if (!click)
|
|
305
310
|
return;
|
|
@@ -789,6 +794,7 @@ function createTrackingClient(config) {
|
|
|
789
794
|
});
|
|
790
795
|
},
|
|
791
796
|
clickAttributes: config.clickAttributes,
|
|
797
|
+
hrefPolicy: config.hrefPolicy,
|
|
792
798
|
isAction: config.isAction
|
|
793
799
|
});
|
|
794
800
|
return () => {
|
|
@@ -490,7 +490,7 @@ function assistantMessages(message, marker) {
|
|
|
490
490
|
rendered.add("tool-approval-response");
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
if (marker && (messages.length > 0 || content.length > 0)) {
|
|
493
|
+
if (marker === "failed" || marker && (messages.length > 0 || content.length > 0)) {
|
|
494
494
|
append("assistant", {
|
|
495
495
|
type: "text",
|
|
496
496
|
text: marker === "interrupted" ? INTERRUPTION_NOTE : FAILURE_NOTE
|
|
@@ -24,6 +24,8 @@ export interface ResolveTrackedClickOptions {
|
|
|
24
24
|
attributes?: TrackedClickAttributes;
|
|
25
25
|
/** Whether an action name is one the application knows. Default: any. */
|
|
26
26
|
isAction?: (action: string) => boolean;
|
|
27
|
+
/** Click URLs omit query/fragment by default. `full` retains both for consumer redaction. */
|
|
28
|
+
hrefPolicy?: 'path-only' | 'full';
|
|
27
29
|
}
|
|
28
30
|
export interface TrackedClick {
|
|
29
31
|
interaction?: {
|
|
@@ -42,5 +44,5 @@ export interface TrackedClick {
|
|
|
42
44
|
/** The click navigates away — send its facts on the unload path. */
|
|
43
45
|
leavesPage: boolean;
|
|
44
46
|
}
|
|
45
|
-
export declare function resolveTrackedClick(target: ClickTarget | null, { origin, attributes, isAction }: ResolveTrackedClickOptions): TrackedClick | null;
|
|
47
|
+
export declare function resolveTrackedClick(target: ClickTarget | null, { origin, attributes, isAction, hrefPolicy }: ResolveTrackedClickOptions): TrackedClick | null;
|
|
46
48
|
//# sourceMappingURL=clicks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clicks.d.ts","sourceRoot":"","sources":["../../src/tracking/clicks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4EAA4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,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,6FAA6F;IAC7F,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;CACrB;AAqBD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,EAAE,MAAM,EAAE,UAAe,EAAE,QAAqB,EAAE,UAAU,EAAE,EAAE,0BAA0B,GACzF,YAAY,GAAG,IAAI,CA6CrB"}
|
|
@@ -25,6 +25,7 @@ export interface TrackingListenerDeps<TType extends string> {
|
|
|
25
25
|
releaseLease(): void;
|
|
26
26
|
readonly clickAttributes: Parameters<typeof resolveTrackedClick>[1]['attributes'];
|
|
27
27
|
readonly isAction: Parameters<typeof resolveTrackedClick>[1]['isAction'];
|
|
28
|
+
readonly hrefPolicy: Parameters<typeof resolveTrackedClick>[1]['hrefPolicy'];
|
|
28
29
|
}
|
|
29
30
|
export declare function wireTrackingListeners<TType extends string>(deps: TrackingListenerDeps<TType>): Array<() => void>;
|
|
30
31
|
//# sourceMappingURL=client-listeners.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-listeners.d.ts","sourceRoot":"","sources":["../../src/tracking/client-listeners.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,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AI,CAAC;IACnC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACxC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,WAAW,IAAI,MAAM,CAAC;IACtB,YAAY,IAAI,IAAI,CAAC;IACrB,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAClF,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACzE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;CAC9E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,EACxD,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAChC,KAAK,CAAC,MAAM,IAAI,CAAC,CAuEnB"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* session. → ADR 0166.
|
|
13
13
|
*/
|
|
14
14
|
import type { ReferrerRule, ResolvedAttribution } from './attribution.js';
|
|
15
|
-
import type { TrackedClickAttributes } from './clicks.js';
|
|
15
|
+
import type { ResolveTrackedClickOptions, TrackedClickAttributes } from './clicks.js';
|
|
16
16
|
import type { TrackingHost } from './host.js';
|
|
17
17
|
import type { TrackingOutbox } from './outbox.js';
|
|
18
18
|
import type { TrackEventsRequest, TrackEventsResponse, TrackingEventEnvelope, VisitBootstrapResponse, VisitEntryContext } from './schemas.js';
|
|
@@ -88,6 +88,8 @@ export interface TrackingClientConfig<TMetadata extends object, TEvent extends T
|
|
|
88
88
|
isAction?: (action: string) => boolean;
|
|
89
89
|
referrerMap?: readonly ReferrerRule[];
|
|
90
90
|
clickAttributes?: TrackedClickAttributes;
|
|
91
|
+
/** Click URL retention before `decorate`. Default `path-only`; `full` includes query/fragment. */
|
|
92
|
+
hrefPolicy?: ResolveTrackedClickOptions['hrefPolicy'];
|
|
91
93
|
scrollMilestones?: readonly number[];
|
|
92
94
|
/** Heartbeat and flush period. Default 30 s. */
|
|
93
95
|
heartbeatMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/tracking/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/tracking/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAYnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EAErB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAInB,wFAAwF;AACxF,MAAM,WAAW,yBAAyB,CAAC,KAAK,SAAS,MAAM;IAC7D,QAAQ,EAAE,KAAK,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC;IACjB,WAAW,EAAE,KAAK,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,KAAK,CAAC;IACrB,WAAW,EAAE,KAAK,CAAC;CACpB;AAED,2DAA2D;A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C,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD;AAED,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM;IACtD,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B,sFAAsF;IACtF,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,yEAAyE;IACzE,KAAK,IAAI,MAAM,IAAI,CAAC;IACpB,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,IAAI,MAAM,GAAG,IAAI,CAAC;IACjC,8FAA8F;IAC9F,WAAW,IAAI,mBAAmB,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,MAAM,KAAK,CAAC,KAAK,SAAS,MAAM,IAAI,IAAI,CAC5C,qBAAqB,CAAC,KAAK,CAAC,EAC5B,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,iBAAiB,CAC9D,CAAC;AA0CF,wBAAgB,oBAAoB,CAClC,SAAS,SAAS,MAAM,EACxB,MAAM,SAAS,qBAAqB,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,qBAAqB,CACpF,MAAM,SAAS,GAAG,MAAM,CACzB,EACD,MAAM,EAAE,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAiM5E"}
|
package/llms/agent-runtime.2.txt
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Parts of this slice:
|
|
8
8
|
- `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
9
9
|
- `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
10
|
-
- `llms/agent-runtime.3.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
10
|
+
- `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
11
11
|
|
|
12
12
|
==============================================================================
|
|
13
13
|
# Guide: Agent application runtime (docs/guide/agent-runtime.md) (continued)
|
|
@@ -615,6 +615,62 @@ replace a leading summary on the next compaction.
|
|
|
615
615
|
Set `maxAttempts` to allow bounded conflict recovery. Every retry reloads the snapshot, reselects the
|
|
616
616
|
eligible range and recomputes the summary; the stale summary is never retried.
|
|
617
617
|
|
|
618
|
+
### Recovering a prefix after a failed turn
|
|
619
|
+
|
|
620
|
+
The default evidence policy omits failed assistants. A failed turn therefore stops the
|
|
621
|
+
compactable prefix, including completed turns after it. A terminal failure is not an
|
|
622
|
+
unanswered tool call, but opting its partial evidence into a summary is an explicit host
|
|
623
|
+
decision. Use the existing `evidencePolicy: { failedAssistant: 'assistant-marked' }` on
|
|
624
|
+
`structuredCompaction` (or `selectCompactableHistory`) when that evidence is wanted.
|
|
625
|
+
The same policy belongs on the summarizer's history projection and on any corresponding
|
|
626
|
+
token-budget selection. Stored statuses remain unchanged.
|
|
627
|
+
|
|
628
|
+
The summarizer receives **raw** `eligibleMessages`, not provider messages and not an
|
|
629
|
+
automatic failure marker. Project them with the same policy before sending them to a
|
|
630
|
+
model, and preserve failed outcomes in the application's structured summary and prompt:
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
const evidencePolicy: AgentHistoryEvidencePolicy = {
|
|
634
|
+
failedAssistant: 'assistant-marked',
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// Inside structuredCompaction({ evidencePolicy, ... }).summarize:
|
|
638
|
+
const projected = await projectAgentHistoryDetailed(eligibleMessages, {
|
|
639
|
+
evidencePolicy,
|
|
640
|
+
incompleteToolTurn: 'error',
|
|
641
|
+
})
|
|
642
|
+
const failedMessageIds = eligibleMessages
|
|
643
|
+
.filter(message => message.role === 'assistant' && message.status === 'failed')
|
|
644
|
+
.map(message => message.id)
|
|
645
|
+
// Pass projected.messages, projected.system and failedMessageIds to the host's
|
|
646
|
+
// summarizer. Its schema/prompt must retain failures and uncertain effects as
|
|
647
|
+
// such, merge previousSummary, and never describe partial output as success.
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
An opted-in failed assistant projects an explicit non-success marker even when it has
|
|
651
|
+
no text or only control parts. A dangling call, unresolved approval, invalid result
|
|
652
|
+
chronology or a user input with no assistant remains a barrier under either policy.
|
|
653
|
+
Raw whole-turn completeness does not guarantee that every record can be projected:
|
|
654
|
+
for example, a call and its result split across records may be rejected by the projector.
|
|
655
|
+
`incompleteToolTurn: 'error'` makes that rejection stop summarization; the original history
|
|
656
|
+
stays canonical. A host with such records must use a status-aware summarizer that explicitly
|
|
657
|
+
represents every relevant record, or retain the range. Do not silently summarize an omitted
|
|
658
|
+
exchange, filter the failed record out of the replacement range, rewrite its status or skip
|
|
659
|
+
over an incomplete turn. The replacement remains one contiguous prefix under snapshot CAS.
|
|
660
|
+
|
|
661
|
+
Provider chronology and external effect authority answer different questions (ADR 0269).
|
|
662
|
+
A matching `tool-result` with `outcome: 'error'` and an application code such as `UNKNOWN`
|
|
663
|
+
closes the provider exchange; it does **not** prove the external effect failed or succeeded.
|
|
664
|
+
Compaction changes the model-history projection, not the canonical event journal or the
|
|
665
|
+
retained terminal admission receipt. The `durability/effect` intent, accepted proof and
|
|
666
|
+
uncertain outcome remain available after compaction and archive restore. A reconstructed
|
|
667
|
+
`createLocalStepDurability` using the original `(conversationId, runId, effectName)` returns
|
|
668
|
+
the accepted proof, reconciles a bare intent, or returns `uncertain` without calling `run`
|
|
669
|
+
again. It does not deduplicate a new run or a newly named effect. Standalone effect callers
|
|
670
|
+
still own the exclusive execution lease; sharing a ledger is not an atomic claim.
|
|
671
|
+
An application-owned receipt outside that journal retains its own recovery rules and must
|
|
672
|
+
not be discarded because a history turn became compactable.
|
|
673
|
+
|
|
618
674
|
### Compacting without the store
|
|
619
675
|
|
|
620
676
|
The *selection* inside compaction needs no store, no version and no runtime, so
|
|
@@ -772,105 +828,3 @@ first mutation**, so an adapter whose runtime rows reference an application-owne
|
|
|
772
828
|
can provision those parents; the optional `cleanup(context)` removes them again, and runs once
|
|
773
829
|
whether the scenario passed or failed. A factory that owns no fixture state ignores the argument and
|
|
774
830
|
keeps working unchanged.
|
|
775
|
-
|
|
776
|
-
## Plain completions and shared invocation receipts
|
|
777
|
-
|
|
778
|
-
Use `createModelInvocationLedger` from `stitchkit/agent-runtime` when a direct text
|
|
779
|
-
completion and an agent must share causal provider evidence. It uses the existing
|
|
780
|
-
runtime store, not a second database. The completion path sends exactly one user
|
|
781
|
-
prompt, no framework instructions and no tools. It never starts an agent loop.
|
|
782
|
-
|
|
783
|
-
```ts
|
|
784
|
-
import { createModelInvocationLedger } from 'stitchkit/agent-runtime';
|
|
785
|
-
|
|
786
|
-
const invocations = createModelInvocationLedger({
|
|
787
|
-
store, // the same AgentRuntimeStore object passed to createAgentRuntime
|
|
788
|
-
models, // an existing defineModelRegistry result
|
|
789
|
-
payloadKey, // 32 bytes from the host's secret store; retain separately from archives
|
|
790
|
-
authorize: async ({ context, conversationId, action, trace }) => {
|
|
791
|
-
const session = await authenticate(context);
|
|
792
|
-
await authorizeConversation(session, conversationId, action, trace);
|
|
793
|
-
return { subject: session.subject }; // verified identity, never a body field
|
|
794
|
-
},
|
|
795
|
-
});
|
|
796
|
-
|
|
797
|
-
const completion = await invocations.complete({
|
|
798
|
-
conversationId: 'evaluation-42',
|
|
799
|
-
idempotencyKey: 'summary-case-3',
|
|
800
|
-
trace: {
|
|
801
|
-
operationId: 'summary-42', purpose: 'summarize', project: 'example',
|
|
802
|
-
parent: { traceId: 'trace-42' }, experiment: 'evaluation', case: 'case-3',
|
|
803
|
-
},
|
|
804
|
-
prompt: 'Summarize these supplied facts.',
|
|
805
|
-
models: ['primary', 'fallback'], // registry keys; repeat a key for an explicit retry
|
|
806
|
-
settings: { maxOutputTokens: 500 },
|
|
807
|
-
timeoutMs: 30_000,
|
|
808
|
-
}, authenticatedContext);
|
|
809
|
-
|
|
810
|
-
// Add to the existing createAgentRuntime configuration:
|
|
811
|
-
const receiptConfig = {
|
|
812
|
-
ledger: invocations,
|
|
813
|
-
trace: ({ run }) => ({
|
|
814
|
-
operationId: run.id, purpose: 'assistant-turn', project: 'example',
|
|
815
|
-
}),
|
|
816
|
-
};
|
|
817
|
-
// createAgentRuntime({ ...existingConfig, invocations: receiptConfig });
|
|
818
|
-
|
|
819
|
-
const page = await invocations.read({
|
|
820
|
-
conversationId: 'evaluation-42', limit: 100,
|
|
821
|
-
}, authenticatedContext);
|
|
822
|
-
// Continue with fromSeq: page.nextSeq while it is defined.
|
|
823
|
-
```
|
|
824
|
-
|
|
825
|
-
`complete` returns `invocationId`, `outcome` and, on success, `text`. `duplicate`
|
|
826
|
-
returns the existing ID without provider execution or replaying plaintext. Changed
|
|
827
|
-
input, trace or caller under the same key is a conflict. Model attempts are explicit
|
|
828
|
-
and bounded to eight; SDK retries are disabled. Only provider failures trigger the
|
|
829
|
-
next attempt. Abort, audit refusal and configuration errors do not. An admitted call
|
|
830
|
-
whose process died stays claimed: inspect the receipt before choosing a new key.
|
|
831
|
-
|
|
832
|
-
The agent retains its existing prompt, tools and loop. Both modes produce
|
|
833
|
-
`invocation/started`, `provider/request`, `provider/response` and
|
|
834
|
-
`invocation/finished` records through `read`. Each attempt has its own ID; response
|
|
835
|
-
usage is counted once and keeps `unavailable` distinct from measured zero. Requested
|
|
836
|
-
registry selection, sent adapter identity and effective provider identity are
|
|
837
|
-
separate. Effective identity is null when not reported. A gateway's hidden retries
|
|
838
|
-
are not visible as additional attempts.
|
|
839
|
-
|
|
840
|
-
`currentModelInvocationAttempt()` returns the causal context inside a provider's
|
|
841
|
-
`fetch` callback or streamed read. Use it to join a host transport audit to
|
|
842
|
-
`operationId`, `invocationId`, `attemptId`, optional `runId` and `step`.
|
|
843
|
-
`onAttempt` is an awaited admission hook; a rejected hook prevents the provider call.
|
|
844
|
-
SDK payload hashes are not represented as hashes of HTTP wire bytes.
|
|
845
|
-
|
|
846
|
-
Prompts and output are AES-256-GCM payload artifacts. `read` returns references and
|
|
847
|
-
hashes; `readPayload({ conversationId, artifactId }, context)` separately authorizes
|
|
848
|
-
`read-payload` and checks authentication tags and hashes. `payloadKey` must be 32
|
|
849
|
-
bytes and is copied at construction. Keep it outside the event store/backups; retain
|
|
850
|
-
the appropriate key when restoring an archive. `maxPayloadBytes` defaults to 4 MiB
|
|
851
|
-
(range 1 KiB–64 MiB). Streaming output evidence keeps parts up to half of it; past
|
|
852
|
-
that the evidence carries `truncated: { parts, sha256 }` over the whole stream, and
|
|
853
|
-
the answer itself is never cut. A receipt that cannot be written never changes an
|
|
854
|
-
outcome: `complete()` returns it with `receiptError` beside it, and a succeeded
|
|
855
|
-
answer keeps its `text`. Request headers
|
|
856
|
-
are excluded. Protect existing agent history independently: enabling receipts does
|
|
857
|
-
not encrypt its ordinary conversation records.
|
|
858
|
-
|
|
859
|
-
The built-in memory and SQLite stores implement `appendEventOnce`. Custom stores
|
|
860
|
-
must implement its once-only check and append atomically, returning the original
|
|
861
|
-
event on a duplicate key scoped by conversation and kind. A factory without this
|
|
862
|
-
capability refuses receipt setup. The driver-backed implementation finds the keyed
|
|
863
|
-
event by its identity through the driver's optional `events.find` — one index probe
|
|
864
|
-
in SQLite — so admission costs the same on a long conversation as on a new one; a
|
|
865
|
-
custom driver without `find` falls back to paging the log in one transaction.
|
|
866
|
-
`store.findEventOnce({ conversationId, kind, key })` reads the same event back.
|
|
867
|
-
Invocation payload artifacts are keyed by their artifact id the same way.
|
|
868
|
-
|
|
869
|
-
### Migration from direct SDK completions
|
|
870
|
-
|
|
871
|
-
**Who must act:** applications opting into shared completion/agent receipts.
|
|
872
|
-
Replace the direct `generateText` call with `invocations.complete`, configure host
|
|
873
|
-
authorization and a retained payload key, and pass the same ledger in the agent's
|
|
874
|
-
`invocations` option. Use the returned invocation ID and the paginated `read` method
|
|
875
|
-
for receipt queries; do not import runtime internals. Available since 0.100.0;
|
|
876
|
-
existing runtime configurations need no migration.
|
package/llms/agent-runtime.3.txt
CHANGED
|
@@ -6,7 +6,113 @@
|
|
|
6
6
|
Parts of this slice:
|
|
7
7
|
- `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
8
8
|
- `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
9
|
-
- `llms/agent-runtime.3.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
9
|
+
- `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
10
|
+
|
|
11
|
+
==============================================================================
|
|
12
|
+
# Guide: Agent application runtime (docs/guide/agent-runtime.md) (continued)
|
|
13
|
+
==============================================================================
|
|
14
|
+
|
|
15
|
+
## Plain completions and shared invocation receipts
|
|
16
|
+
|
|
17
|
+
Use `createModelInvocationLedger` from `stitchkit/agent-runtime` when a direct text
|
|
18
|
+
completion and an agent must share causal provider evidence. It uses the existing
|
|
19
|
+
runtime store, not a second database. The completion path sends exactly one user
|
|
20
|
+
prompt, no framework instructions and no tools. It never starts an agent loop.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { createModelInvocationLedger } from 'stitchkit/agent-runtime';
|
|
24
|
+
|
|
25
|
+
const invocations = createModelInvocationLedger({
|
|
26
|
+
store, // the same AgentRuntimeStore object passed to createAgentRuntime
|
|
27
|
+
models, // an existing defineModelRegistry result
|
|
28
|
+
payloadKey, // 32 bytes from the host's secret store; retain separately from archives
|
|
29
|
+
authorize: async ({ context, conversationId, action, trace }) => {
|
|
30
|
+
const session = await authenticate(context);
|
|
31
|
+
await authorizeConversation(session, conversationId, action, trace);
|
|
32
|
+
return { subject: session.subject }; // verified identity, never a body field
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const completion = await invocations.complete({
|
|
37
|
+
conversationId: 'evaluation-42',
|
|
38
|
+
idempotencyKey: 'summary-case-3',
|
|
39
|
+
trace: {
|
|
40
|
+
operationId: 'summary-42', purpose: 'summarize', project: 'example',
|
|
41
|
+
parent: { traceId: 'trace-42' }, experiment: 'evaluation', case: 'case-3',
|
|
42
|
+
},
|
|
43
|
+
prompt: 'Summarize these supplied facts.',
|
|
44
|
+
models: ['primary', 'fallback'], // registry keys; repeat a key for an explicit retry
|
|
45
|
+
settings: { maxOutputTokens: 500 },
|
|
46
|
+
timeoutMs: 30_000,
|
|
47
|
+
}, authenticatedContext);
|
|
48
|
+
|
|
49
|
+
// Add to the existing createAgentRuntime configuration:
|
|
50
|
+
const receiptConfig = {
|
|
51
|
+
ledger: invocations,
|
|
52
|
+
trace: ({ run }) => ({
|
|
53
|
+
operationId: run.id, purpose: 'assistant-turn', project: 'example',
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
// createAgentRuntime({ ...existingConfig, invocations: receiptConfig });
|
|
57
|
+
|
|
58
|
+
const page = await invocations.read({
|
|
59
|
+
conversationId: 'evaluation-42', limit: 100,
|
|
60
|
+
}, authenticatedContext);
|
|
61
|
+
// Continue with fromSeq: page.nextSeq while it is defined.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`complete` returns `invocationId`, `outcome` and, on success, `text`. `duplicate`
|
|
65
|
+
returns the existing ID without provider execution or replaying plaintext. Changed
|
|
66
|
+
input, trace or caller under the same key is a conflict. Model attempts are explicit
|
|
67
|
+
and bounded to eight; SDK retries are disabled. Only provider failures trigger the
|
|
68
|
+
next attempt. Abort, audit refusal and configuration errors do not. An admitted call
|
|
69
|
+
whose process died stays claimed: inspect the receipt before choosing a new key.
|
|
70
|
+
|
|
71
|
+
The agent retains its existing prompt, tools and loop. Both modes produce
|
|
72
|
+
`invocation/started`, `provider/request`, `provider/response` and
|
|
73
|
+
`invocation/finished` records through `read`. Each attempt has its own ID; response
|
|
74
|
+
usage is counted once and keeps `unavailable` distinct from measured zero. Requested
|
|
75
|
+
registry selection, sent adapter identity and effective provider identity are
|
|
76
|
+
separate. Effective identity is null when not reported. A gateway's hidden retries
|
|
77
|
+
are not visible as additional attempts.
|
|
78
|
+
|
|
79
|
+
`currentModelInvocationAttempt()` returns the causal context inside a provider's
|
|
80
|
+
`fetch` callback or streamed read. Use it to join a host transport audit to
|
|
81
|
+
`operationId`, `invocationId`, `attemptId`, optional `runId` and `step`.
|
|
82
|
+
`onAttempt` is an awaited admission hook; a rejected hook prevents the provider call.
|
|
83
|
+
SDK payload hashes are not represented as hashes of HTTP wire bytes.
|
|
84
|
+
|
|
85
|
+
Prompts and output are AES-256-GCM payload artifacts. `read` returns references and
|
|
86
|
+
hashes; `readPayload({ conversationId, artifactId }, context)` separately authorizes
|
|
87
|
+
`read-payload` and checks authentication tags and hashes. `payloadKey` must be 32
|
|
88
|
+
bytes and is copied at construction. Keep it outside the event store/backups; retain
|
|
89
|
+
the appropriate key when restoring an archive. `maxPayloadBytes` defaults to 4 MiB
|
|
90
|
+
(range 1 KiB–64 MiB). Streaming output evidence keeps parts up to half of it; past
|
|
91
|
+
that the evidence carries `truncated: { parts, sha256 }` over the whole stream, and
|
|
92
|
+
the answer itself is never cut. A receipt that cannot be written never changes an
|
|
93
|
+
outcome: `complete()` returns it with `receiptError` beside it, and a succeeded
|
|
94
|
+
answer keeps its `text`. Request headers
|
|
95
|
+
are excluded. Protect existing agent history independently: enabling receipts does
|
|
96
|
+
not encrypt its ordinary conversation records.
|
|
97
|
+
|
|
98
|
+
The built-in memory and SQLite stores implement `appendEventOnce`. Custom stores
|
|
99
|
+
must implement its once-only check and append atomically, returning the original
|
|
100
|
+
event on a duplicate key scoped by conversation and kind. A factory without this
|
|
101
|
+
capability refuses receipt setup. The driver-backed implementation finds the keyed
|
|
102
|
+
event by its identity through the driver's optional `events.find` — one index probe
|
|
103
|
+
in SQLite — so admission costs the same on a long conversation as on a new one; a
|
|
104
|
+
custom driver without `find` falls back to paging the log in one transaction.
|
|
105
|
+
`store.findEventOnce({ conversationId, kind, key })` reads the same event back.
|
|
106
|
+
Invocation payload artifacts are keyed by their artifact id the same way.
|
|
107
|
+
|
|
108
|
+
### Migration from direct SDK completions
|
|
109
|
+
|
|
110
|
+
**Who must act:** applications opting into shared completion/agent receipts.
|
|
111
|
+
Replace the direct `generateText` call with `invocations.complete`, configure host
|
|
112
|
+
authorization and a retained payload key, and pass the same ledger in the agent's
|
|
113
|
+
`invocations` option. Use the returned invocation ID and the paginated `read` method
|
|
114
|
+
for receipt queries; do not import runtime internals. Available since 0.100.0;
|
|
115
|
+
existing runtime configurations need no migration.
|
|
10
116
|
|
|
11
117
|
==============================================================================
|
|
12
118
|
# API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
|
|
@@ -244,6 +350,16 @@ projection, budgeting and structured compaction; `isAssistantHistoryEvidence` ap
|
|
|
244
350
|
compatibility default omits it. Approval message schemas are
|
|
245
351
|
`AgentToolApprovalRequestPartSchema` and `AgentToolApprovalResponsePartSchema`.
|
|
246
352
|
|
|
353
|
+
With `failedAssistant: 'assistant-marked'`, `selectCompactableHistory` and
|
|
354
|
+
`structuredCompaction` admit a failed prefix only when the entire turn's tool chronology
|
|
355
|
+
is complete. `eligibleMessages` stays raw: the summarizer must use the same policy in
|
|
356
|
+
`projectAgentHistoryDetailed` and preserve non-success/uncertain outcomes in its summary.
|
|
357
|
+
Even an empty opted-in failed assistant carries a non-success marker in that projection.
|
|
358
|
+
Use `incompleteToolTurn: 'error'` to refuse a range the projector cannot represent.
|
|
359
|
+
Compaction never deletes canonical effect events or the retained terminal receipt;
|
|
360
|
+
chronological completeness does not settle an external effect. See the
|
|
361
|
+
[failed-prefix recovery contract](../guide/agent-runtime.md#recovering-a-prefix-after-a-failed-turn).
|
|
362
|
+
|
|
247
363
|
Model exports are `AgentLanguageModelProvider`, `AgentModelCapability`,
|
|
248
364
|
`AgentModelCapabilitySchema`, `AgentModelDescriptor`,
|
|
249
365
|
`AgentModelDescriptorSchema`, `AgentModelRegistry`, `AgentModelRegistryConfig`,
|
package/llms/agent-runtime.txt
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Parts of this slice:
|
|
8
8
|
- `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
9
9
|
- `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
10
|
-
- `llms/agent-runtime.3.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
10
|
+
- `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
11
11
|
|
|
12
12
|
==============================================================================
|
|
13
13
|
# Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
package/llms/tracking.txt
CHANGED
|
@@ -100,6 +100,24 @@ createTrackingClient<BrowserEvents, TrackingEventEnvelope<keyof BrowserEvents> &
|
|
|
100
100
|
})
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
### Click URL retention
|
|
104
|
+
|
|
105
|
+
`resolveTrackedClick(target, { origin, hrefPolicy: 'full' })` and
|
|
106
|
+
`createTrackingClient({ …, hrefPolicy: 'full' })` retain the clicked URL's pathname,
|
|
107
|
+
query and fragment. Internal URLs are relative (`/item?offer=one#details`);
|
|
108
|
+
outbound URLs include their origin (`https://other.example/item?offer=one#details`).
|
|
109
|
+
URL credentials are excluded. Omitting the option, or selecting `path-only`,
|
|
110
|
+
keeps the default that omits query and fragment. Navigation classification,
|
|
111
|
+
labels and subscriptions are independent of this policy.
|
|
112
|
+
|
|
113
|
+
Full URLs may contain sensitive values. Supply your application's password and
|
|
114
|
+
secret redactor through `decorate` before enabling `full`: it receives the retained
|
|
115
|
+
`event.metadata.href` and must return the redacted metadata. The returned event is
|
|
116
|
+
what the outbox, synchronous unload and normal delivery receive. The framework
|
|
117
|
+
has no application-specific password policy. This option controls click and
|
|
118
|
+
outbound-click metadata; it does not change attribution, page tracking or interaction
|
|
119
|
+
metadata. Use the same redactor on your other ingestion paths.
|
|
120
|
+
|
|
103
121
|
A `bootstrap` operation that needs extra fields of its own (a locale, a RUM
|
|
104
122
|
flag) is not the factory's: build the `entry` schema with
|
|
105
123
|
`createTrackingSchemas(…).entry.extend({ … })` and declare that endpoint yourself.
|
|
@@ -234,7 +252,7 @@ application's — it owns the router and the session. The server half is
|
|
|
234
252
|
| Export | Kind | Summary |
|
|
235
253
|
|--------|------|---------|
|
|
236
254
|
| `createTrackingClient` | function | the client: visit lease and renewal, pending queue, synchronous identity from reserved sequences, outbox and flush lease, delivery, the string-body page-leave beacon plus a queued copy, visible time, scroll milestones, declarative clicks, heartbeats |
|
|
237
|
-
| `TrackingClient` / `TrackingClientConfig` | _type_ | `track` / `onNavigate` / `start` / `visitId` / `browserStreamId` / `attribution`, and the host, `buildId`, `builtin` names, `bootstrap`, `deliver`, optional `decorate` (your `eventExtras` on every minted event), `unload` / `unloadUrl`, `outbox`, `onUnauthorized`, `onVisit`, `onFailure`, `isAction`, `referrerMap`, `clickAttributes`, `scrollMilestones`, `batchSize`, periods and limits |
|
|
255
|
+
| `TrackingClient` / `TrackingClientConfig` | _type_ | `track` / `onNavigate` / `start` / `visitId` / `browserStreamId` / `attribution`, and the host, `buildId`, `builtin` names, `bootstrap`, `deliver`, optional `decorate` (your `eventExtras` on every minted event), `unload` / `unloadUrl`, `outbox`, `onUnauthorized`, `onVisit`, `onFailure`, `isAction`, `referrerMap`, `clickAttributes`, `hrefPolicy` (`path-only` by default; `full` retains click query/fragment before `decorate`), `scrollMilestones`, `batchSize`, periods and limits |
|
|
238
256
|
| `TrackFn` / `EventsWithMetadata` / `EventsWithoutMetadata` | _type_ | `track(type)` / `track(type, metadata)` typed by the application's metadata map, and the two halves of that map |
|
|
239
257
|
| `BuiltinTrackingEventTypes` / `CONVENTIONAL_TRACKING_EVENT_TYPES` | _type_ / const | the application's names for the events the client emits itself; the conventional `PAGE_VIEW` … `INTERACTION` set |
|
|
240
258
|
| `browserTrackingHost` / `TrackingHost` / `TrackingPageContext` | function / _type_ | everything the client takes from a browser tab behind one interface — page context, visibility, scroll depth, events, intervals, clocks, storage — so a test or a non-tab host can supply its own |
|
|
@@ -258,6 +276,6 @@ application's — it owns the router and the session. The server half is
|
|
|
258
276
|
| `createOncePerPage` / `OncePerPage` | function / _type_ | one fact per key per page within a window — the guard a twice-mounted component cannot keep itself |
|
|
259
277
|
| `resolveAttribution` / `ResolveAttributionInput` / `ResolvedAttribution` / `AttributionStorage` / `ReferrerRule` | function / _type_ | first-touch once, current-touch on every new UTM; the referrer → source/medium map is the application's, there is no built-in list |
|
|
260
278
|
| `parseUtmFromSearch` / `parseReferrer` | function | the two parsers `resolveAttribution` is built from |
|
|
261
|
-
| `resolveTrackedClick` / `ResolveTrackedClickOptions` / `TrackedClick` / `TrackedClickAttributes` / `ClickTarget` | function / _type_ | `data-track` → click, `data-track-action` → interaction, a link to another origin → outbound; attribute names configurable; `leavesPage` says which path to send on |
|
|
279
|
+
| `resolveTrackedClick` / `ResolveTrackedClickOptions` / `TrackedClick` / `TrackedClickAttributes` / `ClickTarget` | function / _type_ | `data-track` → click, `data-track-action` → interaction, a link to another origin → outbound; attribute names configurable; `hrefPolicy: 'full'` retains query/fragment (default `path-only` omits them), URL credentials excluded; `leavesPage` says which path to send on |
|
|
262
280
|
|
|
263
281
|
---
|
package/llms-full.txt
CHANGED
|
@@ -511,6 +511,24 @@ createTrackingClient<BrowserEvents, TrackingEventEnvelope<keyof BrowserEvents> &
|
|
|
511
511
|
})
|
|
512
512
|
```
|
|
513
513
|
|
|
514
|
+
### Click URL retention
|
|
515
|
+
|
|
516
|
+
`resolveTrackedClick(target, { origin, hrefPolicy: 'full' })` and
|
|
517
|
+
`createTrackingClient({ …, hrefPolicy: 'full' })` retain the clicked URL's pathname,
|
|
518
|
+
query and fragment. Internal URLs are relative (`/item?offer=one#details`);
|
|
519
|
+
outbound URLs include their origin (`https://other.example/item?offer=one#details`).
|
|
520
|
+
URL credentials are excluded. Omitting the option, or selecting `path-only`,
|
|
521
|
+
keeps the default that omits query and fragment. Navigation classification,
|
|
522
|
+
labels and subscriptions are independent of this policy.
|
|
523
|
+
|
|
524
|
+
Full URLs may contain sensitive values. Supply your application's password and
|
|
525
|
+
secret redactor through `decorate` before enabling `full`: it receives the retained
|
|
526
|
+
`event.metadata.href` and must return the redacted metadata. The returned event is
|
|
527
|
+
what the outbox, synchronous unload and normal delivery receive. The framework
|
|
528
|
+
has no application-specific password policy. This option controls click and
|
|
529
|
+
outbound-click metadata; it does not change attribution, page tracking or interaction
|
|
530
|
+
metadata. Use the same redactor on your other ingestion paths.
|
|
531
|
+
|
|
514
532
|
A `bootstrap` operation that needs extra fields of its own (a locale, a RUM
|
|
515
533
|
flag) is not the factory's: build the `entry` schema with
|
|
516
534
|
`createTrackingSchemas(…).entry.extend({ … })` and declare that endpoint yourself.
|
|
@@ -6706,6 +6724,62 @@ replace a leading summary on the next compaction.
|
|
|
6706
6724
|
Set `maxAttempts` to allow bounded conflict recovery. Every retry reloads the snapshot, reselects the
|
|
6707
6725
|
eligible range and recomputes the summary; the stale summary is never retried.
|
|
6708
6726
|
|
|
6727
|
+
### Recovering a prefix after a failed turn
|
|
6728
|
+
|
|
6729
|
+
The default evidence policy omits failed assistants. A failed turn therefore stops the
|
|
6730
|
+
compactable prefix, including completed turns after it. A terminal failure is not an
|
|
6731
|
+
unanswered tool call, but opting its partial evidence into a summary is an explicit host
|
|
6732
|
+
decision. Use the existing `evidencePolicy: { failedAssistant: 'assistant-marked' }` on
|
|
6733
|
+
`structuredCompaction` (or `selectCompactableHistory`) when that evidence is wanted.
|
|
6734
|
+
The same policy belongs on the summarizer's history projection and on any corresponding
|
|
6735
|
+
token-budget selection. Stored statuses remain unchanged.
|
|
6736
|
+
|
|
6737
|
+
The summarizer receives **raw** `eligibleMessages`, not provider messages and not an
|
|
6738
|
+
automatic failure marker. Project them with the same policy before sending them to a
|
|
6739
|
+
model, and preserve failed outcomes in the application's structured summary and prompt:
|
|
6740
|
+
|
|
6741
|
+
```ts
|
|
6742
|
+
const evidencePolicy: AgentHistoryEvidencePolicy = {
|
|
6743
|
+
failedAssistant: 'assistant-marked',
|
|
6744
|
+
}
|
|
6745
|
+
|
|
6746
|
+
// Inside structuredCompaction({ evidencePolicy, ... }).summarize:
|
|
6747
|
+
const projected = await projectAgentHistoryDetailed(eligibleMessages, {
|
|
6748
|
+
evidencePolicy,
|
|
6749
|
+
incompleteToolTurn: 'error',
|
|
6750
|
+
})
|
|
6751
|
+
const failedMessageIds = eligibleMessages
|
|
6752
|
+
.filter(message => message.role === 'assistant' && message.status === 'failed')
|
|
6753
|
+
.map(message => message.id)
|
|
6754
|
+
// Pass projected.messages, projected.system and failedMessageIds to the host's
|
|
6755
|
+
// summarizer. Its schema/prompt must retain failures and uncertain effects as
|
|
6756
|
+
// such, merge previousSummary, and never describe partial output as success.
|
|
6757
|
+
```
|
|
6758
|
+
|
|
6759
|
+
An opted-in failed assistant projects an explicit non-success marker even when it has
|
|
6760
|
+
no text or only control parts. A dangling call, unresolved approval, invalid result
|
|
6761
|
+
chronology or a user input with no assistant remains a barrier under either policy.
|
|
6762
|
+
Raw whole-turn completeness does not guarantee that every record can be projected:
|
|
6763
|
+
for example, a call and its result split across records may be rejected by the projector.
|
|
6764
|
+
`incompleteToolTurn: 'error'` makes that rejection stop summarization; the original history
|
|
6765
|
+
stays canonical. A host with such records must use a status-aware summarizer that explicitly
|
|
6766
|
+
represents every relevant record, or retain the range. Do not silently summarize an omitted
|
|
6767
|
+
exchange, filter the failed record out of the replacement range, rewrite its status or skip
|
|
6768
|
+
over an incomplete turn. The replacement remains one contiguous prefix under snapshot CAS.
|
|
6769
|
+
|
|
6770
|
+
Provider chronology and external effect authority answer different questions (ADR 0269).
|
|
6771
|
+
A matching `tool-result` with `outcome: 'error'` and an application code such as `UNKNOWN`
|
|
6772
|
+
closes the provider exchange; it does **not** prove the external effect failed or succeeded.
|
|
6773
|
+
Compaction changes the model-history projection, not the canonical event journal or the
|
|
6774
|
+
retained terminal admission receipt. The `durability/effect` intent, accepted proof and
|
|
6775
|
+
uncertain outcome remain available after compaction and archive restore. A reconstructed
|
|
6776
|
+
`createLocalStepDurability` using the original `(conversationId, runId, effectName)` returns
|
|
6777
|
+
the accepted proof, reconciles a bare intent, or returns `uncertain` without calling `run`
|
|
6778
|
+
again. It does not deduplicate a new run or a newly named effect. Standalone effect callers
|
|
6779
|
+
still own the exclusive execution lease; sharing a ledger is not an atomic claim.
|
|
6780
|
+
An application-owned receipt outside that journal retains its own recovery rules and must
|
|
6781
|
+
not be discarded because a history turn became compactable.
|
|
6782
|
+
|
|
6709
6783
|
### Compacting without the store
|
|
6710
6784
|
|
|
6711
6785
|
The *selection* inside compaction needs no store, no version and no runtime, so
|
|
@@ -22288,6 +22362,16 @@ projection, budgeting and structured compaction; `isAssistantHistoryEvidence` ap
|
|
|
22288
22362
|
compatibility default omits it. Approval message schemas are
|
|
22289
22363
|
`AgentToolApprovalRequestPartSchema` and `AgentToolApprovalResponsePartSchema`.
|
|
22290
22364
|
|
|
22365
|
+
With `failedAssistant: 'assistant-marked'`, `selectCompactableHistory` and
|
|
22366
|
+
`structuredCompaction` admit a failed prefix only when the entire turn's tool chronology
|
|
22367
|
+
is complete. `eligibleMessages` stays raw: the summarizer must use the same policy in
|
|
22368
|
+
`projectAgentHistoryDetailed` and preserve non-success/uncertain outcomes in its summary.
|
|
22369
|
+
Even an empty opted-in failed assistant carries a non-success marker in that projection.
|
|
22370
|
+
Use `incompleteToolTurn: 'error'` to refuse a range the projector cannot represent.
|
|
22371
|
+
Compaction never deletes canonical effect events or the retained terminal receipt;
|
|
22372
|
+
chronological completeness does not settle an external effect. See the
|
|
22373
|
+
[failed-prefix recovery contract](../guide/agent-runtime.md#recovering-a-prefix-after-a-failed-turn).
|
|
22374
|
+
|
|
22291
22375
|
Model exports are `AgentLanguageModelProvider`, `AgentModelCapability`,
|
|
22292
22376
|
`AgentModelCapabilitySchema`, `AgentModelDescriptor`,
|
|
22293
22377
|
`AgentModelDescriptorSchema`, `AgentModelRegistry`, `AgentModelRegistryConfig`,
|
|
@@ -23214,7 +23298,7 @@ application's — it owns the router and the session. The server half is
|
|
|
23214
23298
|
| Export | Kind | Summary |
|
|
23215
23299
|
|--------|------|---------|
|
|
23216
23300
|
| `createTrackingClient` | function | the client: visit lease and renewal, pending queue, synchronous identity from reserved sequences, outbox and flush lease, delivery, the string-body page-leave beacon plus a queued copy, visible time, scroll milestones, declarative clicks, heartbeats |
|
|
23217
|
-
| `TrackingClient` / `TrackingClientConfig` | _type_ | `track` / `onNavigate` / `start` / `visitId` / `browserStreamId` / `attribution`, and the host, `buildId`, `builtin` names, `bootstrap`, `deliver`, optional `decorate` (your `eventExtras` on every minted event), `unload` / `unloadUrl`, `outbox`, `onUnauthorized`, `onVisit`, `onFailure`, `isAction`, `referrerMap`, `clickAttributes`, `scrollMilestones`, `batchSize`, periods and limits |
|
|
23301
|
+
| `TrackingClient` / `TrackingClientConfig` | _type_ | `track` / `onNavigate` / `start` / `visitId` / `browserStreamId` / `attribution`, and the host, `buildId`, `builtin` names, `bootstrap`, `deliver`, optional `decorate` (your `eventExtras` on every minted event), `unload` / `unloadUrl`, `outbox`, `onUnauthorized`, `onVisit`, `onFailure`, `isAction`, `referrerMap`, `clickAttributes`, `hrefPolicy` (`path-only` by default; `full` retains click query/fragment before `decorate`), `scrollMilestones`, `batchSize`, periods and limits |
|
|
23218
23302
|
| `TrackFn` / `EventsWithMetadata` / `EventsWithoutMetadata` | _type_ | `track(type)` / `track(type, metadata)` typed by the application's metadata map, and the two halves of that map |
|
|
23219
23303
|
| `BuiltinTrackingEventTypes` / `CONVENTIONAL_TRACKING_EVENT_TYPES` | _type_ / const | the application's names for the events the client emits itself; the conventional `PAGE_VIEW` … `INTERACTION` set |
|
|
23220
23304
|
| `browserTrackingHost` / `TrackingHost` / `TrackingPageContext` | function / _type_ | everything the client takes from a browser tab behind one interface — page context, visibility, scroll depth, events, intervals, clocks, storage — so a test or a non-tab host can supply its own |
|
|
@@ -23238,7 +23322,7 @@ application's — it owns the router and the session. The server half is
|
|
|
23238
23322
|
| `createOncePerPage` / `OncePerPage` | function / _type_ | one fact per key per page within a window — the guard a twice-mounted component cannot keep itself |
|
|
23239
23323
|
| `resolveAttribution` / `ResolveAttributionInput` / `ResolvedAttribution` / `AttributionStorage` / `ReferrerRule` | function / _type_ | first-touch once, current-touch on every new UTM; the referrer → source/medium map is the application's, there is no built-in list |
|
|
23240
23324
|
| `parseUtmFromSearch` / `parseReferrer` | function | the two parsers `resolveAttribution` is built from |
|
|
23241
|
-
| `resolveTrackedClick` / `ResolveTrackedClickOptions` / `TrackedClick` / `TrackedClickAttributes` / `ClickTarget` | function / _type_ | `data-track` → click, `data-track-action` → interaction, a link to another origin → outbound; attribute names configurable; `leavesPage` says which path to send on |
|
|
23325
|
+
| `resolveTrackedClick` / `ResolveTrackedClickOptions` / `TrackedClick` / `TrackedClickAttributes` / `ClickTarget` | function / _type_ | `data-track` → click, `data-track-action` → interaction, a link to another origin → outbound; attribute names configurable; `hrefPolicy: 'full'` retains query/fragment (default `path-only` omits them), URL credentials excluded; `leavesPage` says which path to send on |
|
|
23242
23326
|
|
|
23243
23327
|
---
|
|
23244
23328
|
|
package/llms.txt
CHANGED
|
@@ -25,7 +25,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
25
25
|
- **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 11.7 KB
|
|
26
26
|
- **stitchkit/server**: [llms/server.txt](llms/server.txt) 44.2 KB → [llms/server.2.txt](llms/server.2.txt) 20.5 KB → [llms/server.3.txt](llms/server.3.txt) 45.6 KB → [llms/server.4.txt](llms/server.4.txt) 38.3 KB → [llms/server.5.txt](llms/server.5.txt) 22.9 KB
|
|
27
27
|
- **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 46.9 KB
|
|
28
|
-
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 42.7 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt)
|
|
28
|
+
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 42.7 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 44.8 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 42.1 KB
|
|
29
29
|
- **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.6 KB
|
|
30
30
|
- **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 11.0 KB
|
|
31
31
|
- **stitchkit/agent-runtime/coding-tools**: [llms/agent-runtime-coding-tools.txt](llms/agent-runtime-coding-tools.txt) 5.0 KB
|
|
@@ -45,7 +45,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
45
45
|
- **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt) 36.6 KB
|
|
46
46
|
- **stitchkit/telegram/html**: [llms/telegram-html.txt](llms/telegram-html.txt) 2.7 KB
|
|
47
47
|
- **stitchkit/telegram/screens**: [llms/telegram-screens.txt](llms/telegram-screens.txt) 21.2 KB
|
|
48
|
-
- **stitchkit/tracking**: [llms/tracking.txt](llms/tracking.txt)
|
|
48
|
+
- **stitchkit/tracking**: [llms/tracking.txt](llms/tracking.txt) 18.1 KB
|
|
49
49
|
- **stitchkit/release**: [llms/release.txt](llms/release.txt) 8.9 KB
|
|
50
50
|
- **stitchkit/tracking/server**: [llms/tracking-server.txt](llms/tracking-server.txt) 2.5 KB
|
|
51
51
|
- **stitchkit/geo**: [llms/geo.txt](llms/geo.txt) 4.1 KB
|
package/package.json
CHANGED