experimental-a2 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/dist/actor-client.d.ts +1 -1
- package/dist/{actor-BfQSE0KC.d.ts → actor-ohPC-81x.d.ts} +5 -5
- package/dist/{actor-BfQSE0KC.d.ts.map → actor-ohPC-81x.d.ts.map} +1 -1
- package/dist/actor-react.d.ts +3 -3
- package/dist/actor.d.ts +1 -1
- package/dist/actor.js +1 -1
- package/dist/ai-CrLYwNEx.js +2431 -0
- package/dist/ai-CrLYwNEx.js.map +1 -0
- package/dist/{ai-Cai-lCbj.d.ts → ai-HJ9fHfYI.d.ts} +72 -13
- package/dist/ai-HJ9fHfYI.d.ts.map +1 -0
- package/dist/ai-server.d.ts +4 -5
- package/dist/ai-server.d.ts.map +1 -1
- package/dist/ai-server.js +755 -290
- package/dist/ai-server.js.map +1 -1
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1999
- package/dist/client-BYzHjkwU.js.map +1 -1
- package/dist/{client-BAEABRZB.d.ts → client-CzyacQpJ.d.ts} +9 -9
- package/dist/client-CzyacQpJ.d.ts.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/idempotent-id-BRJVeylj.js +13 -0
- package/dist/idempotent-id-BRJVeylj.js.map +1 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -1
- package/dist/otel.d.ts +1 -1
- package/dist/react.d.ts +13 -13
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js.map +1 -1
- package/dist/reducer-DEMjEY_O.js.map +1 -1
- package/dist/{reducer-BcS9VDKC.d.ts → reducer-otzHjuJj.d.ts} +3 -3
- package/dist/{reducer-BcS9VDKC.d.ts.map → reducer-otzHjuJj.d.ts.map} +1 -1
- package/dist/scheduler-qstash.d.ts +2 -2
- package/dist/scheduler-qstash.js +1 -1
- package/dist/scheduler-vercel.d.ts +2 -2
- package/dist/scheduler-vercel.js +1 -1
- package/dist/{server-CjJSGcF7.js → server-BD5ckxZb.js} +39 -26
- package/dist/server-BD5ckxZb.js.map +1 -0
- package/dist/{server-Bp5Nd1pF.d.ts → server-DbD7IJVK.d.ts} +5 -5
- package/dist/{server-Bp5Nd1pF.d.ts.map → server-DbD7IJVK.d.ts.map} +1 -1
- package/dist/server.d.ts +3 -3
- package/dist/server.js +1 -1
- package/dist/{store-D_yhNdPz.d.ts → store-DyZM6fS5.d.ts} +3 -2
- package/dist/{store-D_yhNdPz.d.ts.map → store-DyZM6fS5.d.ts.map} +1 -1
- package/dist/store-N8PXxDAS.js.map +1 -1
- package/dist/store-memory.d.ts +1 -1
- package/dist/store-postgres.d.ts +1 -1
- package/dist/store-redis-http.d.ts +1 -1
- package/dist/store-redis-http.js +1 -1
- package/dist/{store-redis-notify-D2EI6gwX.js → store-redis-notify-BVLUfI3j.js} +14 -13
- package/dist/store-redis-notify-BVLUfI3j.js.map +1 -0
- package/dist/store-redis.d.ts +1 -1
- package/dist/store-redis.js +1 -1
- package/dist/store-sqlite.d.ts +1 -1
- package/dist/{telemetry-CpeclqB2.d.ts → telemetry-B5jzpy6y.d.ts} +2 -2
- package/dist/telemetry-B5jzpy6y.d.ts.map +1 -0
- package/docs/concepts/04-state.mdx +9 -4
- package/docs/guides/06-ai-agents.mdx +134 -43
- package/docs/reference/01-api.mdx +129 -27
- package/examples/playground/app/agent/[agentId]/agent-client.tsx +20 -28
- package/examples/playground/app/agent/[agentId]/agent-queue.test.tsx +123 -0
- package/examples/playground/app/agent/[agentId]/agent-queue.tsx +37 -43
- package/examples/playground/app/agent/[agentId]/compaction-panel.tsx +44 -24
- package/examples/playground/app/agent/compaction-timeline.test.ts +47 -7
- package/examples/playground/app/agent/compaction-timeline.ts +13 -3
- package/examples/playground/app/chat/[chatId]/chat-client.tsx +1 -5
- package/examples/playground/app/chat/[chatId]/session.ts +17 -2
- package/examples/playground/app/chat/model.test.ts +4 -4
- package/examples/playground/app/chat/model.ts +18 -6
- package/examples/playground/app/chat/server.ts +6 -3
- package/examples/playground/package.json +3 -1
- package/package.json +1 -1
- package/src/ai-client-state.ts +0 -2
- package/src/ai-context-schema.ts +296 -0
- package/src/ai-context.ts +680 -0
- package/src/ai-control-server.ts +160 -131
- package/src/ai-control-state.ts +6 -0
- package/src/ai-control.ts +6 -7
- package/src/ai-coordinator.ts +92 -38
- package/src/ai-id.ts +6 -0
- package/src/ai-input-tokens.ts +75 -0
- package/src/ai-message-projection.ts +348 -0
- package/src/ai-server.ts +232 -334
- package/src/ai-stored-state.ts +484 -0
- package/src/ai.ts +252 -418
- package/src/client.ts +21 -15
- package/src/idempotent-id.ts +11 -0
- package/src/index.ts +1 -0
- package/src/react.ts +25 -19
- package/src/reducer.ts +2 -1
- package/src/server.ts +73 -56
- package/src/store-redis-core.ts +15 -17
- package/src/store.ts +1 -0
- package/src/telemetry.ts +2 -1
- package/dist/ai-Cai-lCbj.d.ts.map +0 -1
- package/dist/ai-control-CcD4hh3y.js +0 -119
- package/dist/ai-control-CcD4hh3y.js.map +0 -1
- package/dist/ai.js.map +0 -1
- package/dist/client-BAEABRZB.d.ts.map +0 -1
- package/dist/server-CjJSGcF7.js.map +0 -1
- package/dist/store-redis-notify-D2EI6gwX.js.map +0 -1
- package/dist/telemetry-CpeclqB2.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4798a8e: Separate compacted AI model context from execution control and the full client
|
|
8
|
+
transcript. Successful compaction is permanent: failure, stop, retry, and worker
|
|
9
|
+
recovery never restore pre-compaction content. Retry reruns only the unfinished
|
|
10
|
+
model step and preserves completed steps.
|
|
11
|
+
|
|
12
|
+
Server callbacks receive prompt messages and request information without
|
|
13
|
+
`state` or `execution` arguments. Model and instruction resolvers receive
|
|
14
|
+
`{ event, messages, session, signal }`. Custom transcript folds and schemas
|
|
15
|
+
apply only to the transcript; read application reducers through `session.state()`.
|
|
16
|
+
|
|
17
|
+
Store AI snapshots as normalized `AIStoredState`, sharing payload records and
|
|
18
|
+
keeping inverse changes for the current generation projection. Server callers
|
|
19
|
+
use `reducer.view(snapshot.state)` for inspection and `reducer.fromView(state)`
|
|
20
|
+
for application-owned views. Hydration takes stored state; client and React
|
|
21
|
+
snapshots continue to expose the immediate `AIState` view. The stored format
|
|
22
|
+
uses version 2, with no pre-compaction recovery records.
|
|
23
|
+
|
|
24
|
+
Release covered model context, settled worker facts, and completed tool inputs.
|
|
25
|
+
Compaction waits for final tool exchanges and all A2-owned tool work to settle,
|
|
26
|
+
including stopped or superseded turns. Each candidate reads one fresh coordinator
|
|
27
|
+
checkpoint. Cold tools restore their prompt from the tool-admission checkpoint
|
|
28
|
+
without a separate history read. No new service, subscription, or timer is added.
|
|
29
|
+
The transcript remains available in full.
|
|
30
|
+
|
|
31
|
+
- f917f8a: Make queued-message edits last-write-wins in session log order. Use
|
|
32
|
+
`inputs.queue.edit({ message })`; `expectedRevision` and `InboxItem.revision` are
|
|
33
|
+
removed. Rapid edits remain optimistic while earlier edits await confirmation.
|
|
34
|
+
Editing an admitted message still returns `not-pending`, and changing a
|
|
35
|
+
message's role returns `role-mismatch`.
|
|
36
|
+
- 32a2f76: Use bounded deterministic IDs in the reserved `a2.ai:` namespace for AI requests,
|
|
37
|
+
generations, assistant responses, worker jobs, reports, and lifecycle events.
|
|
38
|
+
Ownership comes from explicit event fields instead of recursive ID strings.
|
|
39
|
+
|
|
40
|
+
Generation requests require `responseMessageId`; tool continuations also require
|
|
41
|
+
`sourceGenerationId`. Approval and application-input payloads require `requestId`.
|
|
42
|
+
`AIState.responseOwners` records generation ID, request ID, and attempt.
|
|
43
|
+
|
|
44
|
+
Send, seed, and steering event IDs equal their input message IDs. The initial
|
|
45
|
+
model-request event ID is also the assistant message ID. Identical submissions
|
|
46
|
+
replay through core deduplication; conflicting payload, action, or session reuse
|
|
47
|
+
rejects before append. Caller command/input IDs must be nonempty and cannot use
|
|
48
|
+
the reserved prefix. Helpers stay synchronous and deterministic.
|
|
49
|
+
|
|
50
|
+
Remove the lifetime input/response-ID registry from control checkpoints. Missing
|
|
51
|
+
queue targets return `not-pending` regardless of prior admission or removal.
|
|
52
|
+
No storage operations, subscriptions, or timers are added. Use fresh sessions
|
|
53
|
+
and matching helpers/handlers; no legacy protocol adapter is provided.
|
|
54
|
+
|
|
55
|
+
- 8959e66: Return one selected snapshot and a scalar head index from Redis state reads.
|
|
56
|
+
Eligible head snapshots skip the historical checkpoint lookup. Snapshot selection
|
|
57
|
+
and event-frontier capture remain atomic.
|
|
58
|
+
|
|
59
|
+
Propagate operational state-read failures with their backend diagnostics, instead
|
|
60
|
+
of silently retrying individual reads or rebuilding from raw
|
|
61
|
+
history. Missing and schema-rejected snapshots still rebuild normally.
|
|
62
|
+
|
|
63
|
+
Keep checkpoint writes in the background and report failures through a new
|
|
64
|
+
`a2.snapshot` telemetry span, or the default console sink. Include session,
|
|
65
|
+
reducer, greatest checkpoint index, and batch count without snapshot contents.
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- 9f772b7: Exclude provider metadata from compaction token estimates without changing model
|
|
70
|
+
requests. Calibrate growing prompts against reported usage in either direction.
|
|
71
|
+
Record the pre-compaction estimate, calibrated input tokens, and threshold in
|
|
72
|
+
automatic compaction requests.
|
|
73
|
+
|
|
74
|
+
Count serialized UTF-8 bytes without allocating a second copy of the prompt.
|
|
75
|
+
|
|
76
|
+
## 0.15.0
|
|
77
|
+
|
|
78
|
+
### Minor Changes
|
|
79
|
+
|
|
80
|
+
- 197b719: Add `idempotentId(...parts: string[])` to derive stable UUIDv8 event IDs from
|
|
81
|
+
ordered strings in server and browser code. Existing IDs and automatic ID
|
|
82
|
+
generation are unchanged.
|
|
83
|
+
|
|
3
84
|
## 0.14.1
|
|
4
85
|
|
|
5
86
|
### Patch Changes
|
package/dist/actor-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ActorCallResult, v as ActorRefusedError } from "./actor-
|
|
1
|
+
import { n as ActorCallResult, v as ActorRefusedError } from "./actor-ohPC-81x.js";
|
|
2
2
|
//#region src/actor-client.d.ts
|
|
3
3
|
declare class ActorRequestError extends Error {
|
|
4
4
|
readonly status: number | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as StandardSchemaV1, i as Contract, s as EventDefs, t as Reducer } from "./reducer-
|
|
2
|
-
import { t as A2Store } from "./store-
|
|
3
|
-
import { f as ScheduleTiming, m as Session, n as A2Server, t as A2Scheduler } from "./server-
|
|
4
|
-
import { i as A2Telemetry } from "./telemetry-
|
|
1
|
+
import { h as StandardSchemaV1, i as Contract, s as EventDefs, t as Reducer } from "./reducer-otzHjuJj.js";
|
|
2
|
+
import { t as A2Store } from "./store-DyZM6fS5.js";
|
|
3
|
+
import { f as ScheduleTiming, m as Session, n as A2Server, t as A2Scheduler } from "./server-DbD7IJVK.js";
|
|
4
|
+
import { i as A2Telemetry } from "./telemetry-B5jzpy6y.js";
|
|
5
5
|
//#region src/actor-shared.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* A handler answered by throwing `NonRetriableError`: the event
|
|
@@ -307,4 +307,4 @@ type ActorDefinition<D extends ActorProtocol> = {
|
|
|
307
307
|
declare function actor<D extends ActorProtocol>(options: ActorOptions<D>): ActorDefinition<D>;
|
|
308
308
|
//#endregion
|
|
309
309
|
export { ActorProtocol as _, ActorHandle as a, ActorScheduleSend as b, ActorOptions as c, concurrent as d, ActorConcurrentContext as f, ActorPresenceValues as g, ActorPresenceOf as h, ActorFetchOptions as i, ActorSendOptions as l, ActorPresenceMap as m, ActorCallResult as n, ActorHandler as o, ActorContext as p, ActorDefinition as r, ActorOperation as s, ActorCallOptions as t, actor as u, ActorRefusedError as v, ActorSend as x, ActorScheduleOptions as y };
|
|
310
|
-
//# sourceMappingURL=actor-
|
|
310
|
+
//# sourceMappingURL=actor-ohPC-81x.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor-
|
|
1
|
+
{"version":3,"file":"actor-ohPC-81x.d.ts","names":[],"sources":["../src/actor-shared.ts","../src/actor.ts"],"mappings":";;;;;;;;;;;cAgCa,0BAA0B;;WAE5B;;WAEA;EACT,YAAY,eAAe,mBAAmB;;;;;;;;;KAepC;EACV;EACA;;;;;;;EAOA;;;KAIU,gBAAgB,UAAU,iBAAiB;EACrD,gBAAgB;IAEd;;KAIQ,oBAAoB,QAC7B,WAAW,cAAc,EAAE;;;;;;KAQlB,iBAAiB;GAExB,yBAAA,WAAW;IAAgB,OAAO,EAAE;IAAI;IAAc,IAAI;;;;;;;;;;;;KAanD,UAAU,iBACV,WAAW,eAAe,EAAE,MACjC,QAAQ,EAAE,eACV,OAAO,EAAE;;;;;;;;;KAWJ,uBAAuB;EAAmB;;;;;;;;;;;;KAY1C,kBAAkB,iBAClB,WAAW,eAAe,EAAE,MACjC,OAAO,EAAE,gBAAgB,SAAS,yBAAyB,iBAC3D,OAAO,EAAE,IAAI,SAAS,yBAAyB;;KAI1C,aAAa,UAAU;;EAEjC,OAAO;;EAEP;;EAEA;;EAEA,QAAQ;;EAER,MAAM,UAAU;;EAEhB,UAAU,kBAAkB;;;;;;;;KASlB,uBAAuB,UAAU;;EAE3C;;EAEA;;EAEA,QAAQ;;EAER,SAAS;IAAU,OAAO;IAAY;;;EAEtC,MAAM,UAAU;;EAEhB,UAAU,kBAAkB;;KAGlB,kBAAkB;EAC5B,OAAO;;EAEP;;EAEA;;;KAWU,qBAAqB;EAC/B,kBAAkB,iBAAiB,kBAAkB;;;;;;;;;;;;;;KCzE3C,aAAa,UAAU,eAAe,gBAAgB,iBAC5D,KAAK,aAAa,IAAI,OAAO,YAAY,cAAc;EAEvD;EACA,SACE,KAAK,uBAAuB,IAC5B,OAAO,YAAY,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MAAM,UAAU,eAC9B,SAAS,aAAa,KACrB,gBAAgB"}
|
package/dist/actor-react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ContractEvent, s as EventDefs } from "./reducer-
|
|
2
|
-
import { g as ActorPresenceValues, m as ActorPresenceMap } from "./actor-
|
|
1
|
+
import { a as ContractEvent, s as EventDefs } from "./reducer-otzHjuJj.js";
|
|
2
|
+
import { g as ActorPresenceValues, m as ActorPresenceMap } from "./actor-ohPC-81x.js";
|
|
3
3
|
import { ActorClientCall, ActorStateOf, AnyActorDefinition } from "./actor-client.js";
|
|
4
|
-
import { a as Connection } from "./client-
|
|
4
|
+
import { a as Connection } from "./client-CzyacQpJ.js";
|
|
5
5
|
//#region src/actor-react.d.ts
|
|
6
6
|
/** The server-to-client handoff: `await def.actor(id).state()`. */
|
|
7
7
|
type ActorSnapshot<S> = {
|
package/dist/actor.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as ActorProtocol, a as ActorHandle, b as ActorScheduleSend, c as ActorOptions, d as concurrent, f as ActorConcurrentContext, g as ActorPresenceValues, h as ActorPresenceOf, i as ActorFetchOptions, l as ActorSendOptions, m as ActorPresenceMap, n as ActorCallResult, o as ActorHandler, p as ActorContext, r as ActorDefinition, s as ActorOperation, t as ActorCallOptions, u as actor, v as ActorRefusedError, x as ActorSend, y as ActorScheduleOptions } from "./actor-
|
|
1
|
+
import { _ as ActorProtocol, a as ActorHandle, b as ActorScheduleSend, c as ActorOptions, d as concurrent, f as ActorConcurrentContext, g as ActorPresenceValues, h as ActorPresenceOf, i as ActorFetchOptions, l as ActorSendOptions, m as ActorPresenceMap, n as ActorCallResult, o as ActorHandler, p as ActorContext, r as ActorDefinition, s as ActorOperation, t as ActorCallOptions, u as actor, v as ActorRefusedError, x as ActorSend, y as ActorScheduleOptions } from "./actor-ohPC-81x.js";
|
|
2
2
|
export { ActorCallOptions, ActorCallResult, type ActorConcurrentContext, type ActorContext, ActorDefinition, ActorFetchOptions, ActorHandle, ActorHandler, ActorOperation, ActorOptions, type ActorPresenceMap, type ActorPresenceOf, type ActorPresenceValues, type ActorProtocol, ActorRefusedError, type ActorScheduleOptions, type ActorScheduleSend, type ActorSend, ActorSendOptions, actor, concurrent };
|
package/dist/actor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as contract } from "./contract-CKRg_E4q.js";
|
|
2
2
|
import { n as NonRetriableError, t as A2Error } from "./errors-DCk6ch5n.js";
|
|
3
|
-
import { a as sseResponse, i as setServerFetchHooks, o as parsePresenceSibling, t as createServer } from "./server-
|
|
3
|
+
import { a as sseResponse, i as setServerFetchHooks, o as parsePresenceSibling, t as createServer } from "./server-BD5ckxZb.js";
|
|
4
4
|
import { a as actorFailedSchema, c as isJsonTree, i as ActorRefusedError, l as openPresenceDefs, n as ACTOR_LANE, o as actorReducer, r as ACTOR_STATE_EVENT, s as actorStateSchema, t as ACTOR_FAILED_EVENT } from "./actor-shared-B5tJfzt-.js";
|
|
5
5
|
//#region src/actor.ts
|
|
6
6
|
/**
|