experimental-a2 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/dist/{actor-DBbe5xeE.d.ts → actor-C7b-1arn.d.ts} +5 -5
- package/dist/{actor-DBbe5xeE.d.ts.map → actor-C7b-1arn.d.ts.map} +1 -1
- package/dist/actor-client.d.ts +1 -1
- package/dist/actor-react.d.ts +3 -3
- package/dist/actor-react.js +1 -1
- package/dist/actor.d.ts +1 -1
- package/dist/actor.js +2 -2
- package/dist/{ai-vpGtcaCB.d.ts → ai-BMLlI2Ff.d.ts} +3 -3
- package/dist/{ai-vpGtcaCB.d.ts.map → ai-BMLlI2Ff.d.ts.map} +1 -1
- package/dist/{ai-UrWfKeuv.js → ai-D6mGlO8j.js} +2 -2
- package/dist/{ai-UrWfKeuv.js.map → ai-D6mGlO8j.js.map} +1 -1
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -2
- package/dist/ai-fx.browser.d.ts +1 -0
- package/dist/ai-fx.browser.js +6 -0
- package/dist/ai-fx.browser.js.map +1 -0
- package/dist/ai-fx.d.ts +10 -0
- package/dist/ai-fx.d.ts.map +1 -0
- package/dist/ai-fx.js +692 -0
- package/dist/ai-fx.js.map +1 -0
- package/dist/ai-harness-B2suP2Qh.d.ts +26 -0
- package/dist/ai-harness-B2suP2Qh.d.ts.map +1 -0
- package/dist/ai-harness-BuLh_EYi.js +273 -0
- package/dist/ai-harness-BuLh_EYi.js.map +1 -0
- package/dist/ai-pi.browser.d.ts +1 -0
- package/dist/ai-pi.browser.js +6 -0
- package/dist/ai-pi.browser.js.map +1 -0
- package/dist/ai-pi.d.ts +17 -0
- package/dist/ai-pi.d.ts.map +1 -0
- package/dist/ai-pi.js +950 -0
- package/dist/ai-pi.js.map +1 -0
- package/dist/ai-react.d.ts +5 -5
- package/dist/ai-react.js +2 -2
- package/dist/ai-server.d.ts +47 -25
- package/dist/ai-server.d.ts.map +1 -1
- package/dist/ai-server.js +113 -40
- package/dist/ai-server.js.map +1 -1
- package/dist/ai-tool-input-DmSqMUQi.js +40 -0
- package/dist/ai-tool-input-DmSqMUQi.js.map +1 -0
- package/dist/ai.d.ts +1 -1
- package/dist/ai.js +1 -1
- package/dist/bounded-cache-CPHWF-8h.js +41 -0
- package/dist/bounded-cache-CPHWF-8h.js.map +1 -0
- package/dist/{client-COaiaDub.js → client-BhHLoNKF.js} +3 -3
- package/dist/{client-COaiaDub.js.map → client-BhHLoNKF.js.map} +1 -1
- package/dist/{client-qRnRUzBS.d.ts → client-h_DKFAjj.d.ts} +3 -3
- package/dist/{client-qRnRUzBS.d.ts.map → client-h_DKFAjj.d.ts.map} +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/{initial-snapshot-BrLso5x_.d.ts → initial-snapshot-Bx-c0pDP.d.ts} +2 -2
- package/dist/{initial-snapshot-BrLso5x_.d.ts.map → initial-snapshot-Bx-c0pDP.d.ts.map} +1 -1
- package/dist/{internal-CbVvEwad.js → internal-CscSY7K_.js} +11 -3
- package/dist/internal-CscSY7K_.js.map +1 -0
- package/dist/otel.d.ts +1 -1
- package/dist/{react-BbJ-g6Uu.d.ts → react-BBXgHWFc.d.ts} +4 -4
- package/dist/{react-BbJ-g6Uu.d.ts.map → react-BBXgHWFc.d.ts.map} +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/reducer-BAXc8JyF.js.map +1 -1
- package/dist/{reducer-BYu6DT7h.d.ts → reducer-CqA59Q6U.d.ts} +2 -2
- package/dist/{reducer-BYu6DT7h.d.ts.map → reducer-CqA59Q6U.d.ts.map} +1 -1
- package/dist/scheduler-qstash.d.ts +2 -2
- package/dist/scheduler-qstash.js +3 -3
- package/dist/scheduler-qstash.js.map +1 -1
- package/dist/scheduler-vercel.d.ts +7 -7
- package/dist/scheduler-vercel.d.ts.map +1 -1
- package/dist/scheduler-vercel.js +9 -10
- package/dist/scheduler-vercel.js.map +1 -1
- package/dist/{server-Rj64fNvX.js → server-D-Y4pqwu.js} +126 -67
- package/dist/server-D-Y4pqwu.js.map +1 -0
- package/dist/{server-CGM8WzRG.d.ts → server-DYAATFuT.d.ts} +42 -7
- package/dist/server-DYAATFuT.d.ts.map +1 -0
- package/dist/server.d.ts +4 -4
- package/dist/server.js +1 -1
- package/dist/{session-clear-Dshpuhff.d.ts → session-clear-C-QwTXV1.d.ts} +2 -2
- package/dist/session-clear-C-QwTXV1.d.ts.map +1 -0
- package/dist/{store-Gpkq7WBo.d.ts → store-CyLUy86v.d.ts} +53 -5
- package/dist/store-CyLUy86v.d.ts.map +1 -0
- package/dist/store-N8PXxDAS.js.map +1 -1
- package/dist/store-memory.d.ts +1 -1
- package/dist/store-memory.js +56 -11
- package/dist/store-memory.js.map +1 -1
- package/dist/{store-polling-4_y8lETm.js → store-polling-7WJV0YWP.js} +2 -2
- package/dist/{store-polling-4_y8lETm.js.map → store-polling-7WJV0YWP.js.map} +1 -1
- package/dist/store-postgres.d.ts +1 -1
- package/dist/store-postgres.d.ts.map +1 -1
- package/dist/store-postgres.js +106 -25
- package/dist/store-postgres.js.map +1 -1
- package/dist/{store-presence-polling-Q1C-k2dd.js → store-presence-polling-B1ixeqIS.js} +3 -3
- package/dist/{store-presence-polling-Q1C-k2dd.js.map → store-presence-polling-B1ixeqIS.js.map} +1 -1
- package/dist/store-redis-http.d.ts +1 -1
- package/dist/store-redis-http.js +3 -3
- package/dist/{store-redis-notify-tqWNnMRu.js → store-redis-notify-CM0AfLY0.js} +271 -101
- package/dist/store-redis-notify-CM0AfLY0.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/store-sqlite.js +66 -21
- package/dist/store-sqlite.js.map +1 -1
- package/dist/{telemetry-cZH-cibj.d.ts → telemetry-Cyfqo6Qt.d.ts} +2 -2
- package/dist/telemetry-Cyfqo6Qt.d.ts.map +1 -0
- package/dist/{wire-DjfHOvdW.js → wire-BKxH1vbP.js} +2 -2
- package/dist/{wire-DjfHOvdW.js.map → wire-BKxH1vbP.js.map} +1 -1
- package/docs/01-quickstart.mdx +49 -83
- package/docs/{guides/07-examples.mdx → 02-examples.mdx} +10 -20
- package/docs/actors/01-introduction.mdx +48 -86
- package/docs/actors/02-concurrency.mdx +43 -70
- package/docs/actors/03-timers.mdx +28 -42
- package/docs/actors/04-routes.mdx +110 -150
- package/docs/actors/meta.ts +1 -1
- package/docs/agents/01-introduction.mdx +257 -0
- package/docs/agents/02-tools.mdx +247 -0
- package/docs/agents/03-conversations.mdx +538 -0
- package/docs/agents/04-harnesses.mdx +136 -0
- package/docs/agents/meta.ts +1 -0
- package/docs/client/01-react.mdx +294 -0
- package/docs/client/02-transports.mdx +86 -0
- package/docs/client/03-presence.mdx +224 -0
- package/docs/client/meta.ts +1 -0
- package/docs/contract/01-events.mdx +57 -0
- package/docs/contract/02-state.mdx +142 -0
- package/docs/contract/03-sessions.mdx +175 -0
- package/docs/index.mdx +109 -145
- package/docs/reference/01-core.mdx +139 -0
- package/docs/reference/02-server.mdx +860 -0
- package/docs/reference/03-client.mdx +301 -0
- package/docs/reference/04-ai.mdx +731 -0
- package/docs/reference/05-adapters.mdx +351 -0
- package/docs/reference/06-errors.mdx +138 -0
- package/docs/reference/meta.ts +1 -1
- package/docs/server/01-handlers.mdx +200 -0
- package/docs/server/02-timers.mdx +130 -0
- package/docs/server/03-cancellation.mdx +142 -0
- package/docs/server/04-routes.mdx +243 -0
- package/docs/server/05-production.mdx +323 -0
- package/docs/server/06-guarantees.mdx +132 -0
- package/examples/playground/DEPLOY.md +3 -5
- package/examples/playground/app/a0/[appId]/page.tsx +12 -13
- package/examples/playground/app/a0/app-list.tsx +9 -2
- package/examples/playground/app/a0/app-view.tsx +9 -1
- package/examples/playground/app/a0/apps/[appId]/route.ts +10 -5
- package/examples/playground/app/a0/apps.test.ts +12 -0
- package/examples/playground/app/a0/apps.ts +22 -7
- package/examples/playground/app/a0/chat.tsx +47 -1
- package/examples/playground/app/a0/devtools.tsx +2 -8
- package/examples/playground/app/a0/fx/events/route.ts +9 -0
- package/examples/playground/app/a0/fx/scheduler/route.ts +7 -0
- package/examples/playground/app/a0/fx/short/events/route.ts +11 -0
- package/examples/playground/app/a0/model.test.ts +18 -1
- package/examples/playground/app/a0/model.ts +47 -10
- package/examples/playground/app/a0/no-photon.cjs +4 -0
- package/examples/playground/app/a0/no-quickjs.cjs +3 -0
- package/examples/playground/app/a0/pi/events/route.ts +9 -0
- package/examples/playground/app/a0/pi/scheduler/route.ts +7 -0
- package/examples/playground/app/a0/pi/short/events/route.ts +11 -0
- package/examples/playground/app/a0/sandbox-log.ts +10 -4
- package/examples/playground/app/a0/sandbox-session.ts +152 -0
- package/examples/playground/app/a0/scheduler/route.ts +2 -2
- package/examples/playground/app/a0/server.ts +98 -54
- package/examples/playground/app/a0/session.ts +17 -5
- package/examples/playground/app/a0/shell.tsx +11 -3
- package/examples/playground/app/agent/ingress.test.ts +6 -3
- package/examples/playground/app/agent/server.ts +9 -6
- package/examples/playground/app/agent/telemetry.test.ts +71 -50
- package/examples/playground/app/canvas/[canvasId]/canvas-client.tsx +1 -1
- package/examples/playground/app/chat/server.test.ts +30 -26
- package/examples/playground/app/chat/server.ts +46 -46
- package/examples/playground/next.config.ts +17 -5
- package/examples/playground/package.json +4 -1
- package/examples/playground/vercel.json +18 -0
- package/package.json +27 -3
- package/src/ai-agent.ts +271 -90
- package/src/ai-fx.browser.ts +5 -0
- package/src/ai-fx.ts +912 -0
- package/src/ai-harness.ts +518 -0
- package/src/ai-model-metadata.ts +11 -6
- package/src/ai-pi.browser.ts +5 -0
- package/src/ai-pi.ts +1322 -0
- package/src/ai-sdk-step.ts +2 -2
- package/src/ai-server.ts +3 -1
- package/src/ai-tool-input.ts +45 -0
- package/src/internal.ts +13 -0
- package/src/libfx.d.ts +34 -0
- package/src/reducer.ts +1 -1
- package/src/scheduler-qstash.ts +5 -5
- package/src/scheduler-vercel.ts +14 -15
- package/src/server.ts +233 -29
- package/src/store-memory.ts +92 -16
- package/src/store-postgres.ts +156 -25
- package/src/store-redis-core.ts +322 -110
- package/src/store-redis-notify.ts +2 -0
- package/src/store-sqlite.ts +121 -28
- package/src/store.ts +55 -3
- package/src/telemetry.ts +1 -0
- package/dist/internal-CbVvEwad.js.map +0 -1
- package/dist/server-CGM8WzRG.d.ts.map +0 -1
- package/dist/server-Rj64fNvX.js.map +0 -1
- package/dist/session-clear-Dshpuhff.d.ts.map +0 -1
- package/dist/store-Gpkq7WBo.d.ts.map +0 -1
- package/dist/store-redis-notify-tqWNnMRu.js.map +0 -1
- package/dist/telemetry-cZH-cibj.d.ts.map +0 -1
- package/docs/concepts/01-contracts.mdx +0 -237
- package/docs/concepts/02-handlers.mdx +0 -284
- package/docs/concepts/03-durability.mdx +0 -314
- package/docs/concepts/04-state.mdx +0 -209
- package/docs/guides/01-timers.mdx +0 -193
- package/docs/guides/02-cancellation.mdx +0 -161
- package/docs/guides/03-react.mdx +0 -324
- package/docs/guides/04-local-first.mdx +0 -47
- package/docs/guides/05-production.mdx +0 -534
- package/docs/guides/06-ai-agents.mdx +0 -1408
- package/docs/guides/08-application-data.mdx +0 -113
- package/docs/guides/09-presence.mdx +0 -262
- package/docs/guides/10-transports.mdx +0 -221
- package/docs/reference/01-api.mdx +0 -2358
- package/docs/reference/02-errors.mdx +0 -150
- /package/docs/{concepts → contract}/meta.ts +0 -0
- /package/docs/{guides → server}/meta.ts +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InvalidToolInputError, TypeValidationError, asSchema } from "ai";
|
|
2
|
+
//#region src/ai-tool-input.ts
|
|
3
|
+
/**
|
|
4
|
+
* A call's input through its tool's schema, as the AI SDK step reads it: the
|
|
5
|
+
* schema's output with its defaults, or the AI SDK's error text. A name the
|
|
6
|
+
* tool set does not own has no schema.
|
|
7
|
+
*/
|
|
8
|
+
async function schemaInput({ tools, toolName, value }) {
|
|
9
|
+
const schema = Object.hasOwn(tools, toolName) ? asSchema(tools[toolName].inputSchema) : void 0;
|
|
10
|
+
if (schema?.validate === void 0) return {
|
|
11
|
+
success: true,
|
|
12
|
+
value
|
|
13
|
+
};
|
|
14
|
+
let cause;
|
|
15
|
+
try {
|
|
16
|
+
const result = await schema.validate(value);
|
|
17
|
+
if (result.success) return {
|
|
18
|
+
success: true,
|
|
19
|
+
value: result.value
|
|
20
|
+
};
|
|
21
|
+
cause = result.error;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
cause = error;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
errorText: new InvalidToolInputError({
|
|
28
|
+
toolName,
|
|
29
|
+
toolInput: JSON.stringify(value),
|
|
30
|
+
cause: TypeValidationError.wrap({
|
|
31
|
+
value,
|
|
32
|
+
cause
|
|
33
|
+
})
|
|
34
|
+
}).message
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { schemaInput as t };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=ai-tool-input-DmSqMUQi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-tool-input-DmSqMUQi.js","names":[],"sources":["../src/ai-tool-input.ts"],"sourcesContent":["import {\n asSchema,\n InvalidToolInputError,\n type ToolSet,\n TypeValidationError,\n} from 'ai'\n\nexport type SchemaInput =\n { success: true; value: unknown } | { success: false; errorText: string }\n\n/**\n * A call's input through its tool's schema, as the AI SDK step reads it: the\n * schema's output with its defaults, or the AI SDK's error text. A name the\n * tool set does not own has no schema.\n */\nexport async function schemaInput({\n tools,\n toolName,\n value,\n}: {\n tools: ToolSet\n toolName: string\n value: unknown\n}): Promise<SchemaInput> {\n const schema = Object.hasOwn(tools, toolName)\n ? asSchema(tools[toolName]!.inputSchema)\n : undefined\n if (schema?.validate === undefined) return { success: true, value }\n let cause: unknown\n try {\n const result = await schema.validate(value)\n if (result.success) return { success: true, value: result.value }\n cause = result.error\n } catch (error) {\n cause = error\n }\n return {\n success: false,\n errorText: new InvalidToolInputError({\n toolName,\n toolInput: JSON.stringify(value),\n cause: TypeValidationError.wrap({ value, cause }),\n }).message,\n }\n}\n"],"mappings":";;;;;;;AAeA,eAAsB,YAAY,EAChC,OACA,UACA,SAKuB;CACvB,MAAM,SAAS,OAAO,OAAO,OAAO,QAAQ,IACxC,SAAS,MAAM,SAAS,CAAE,WAAW,IACrC,KAAA;CACJ,IAAI,QAAQ,aAAa,KAAA,GAAW,OAAO;EAAE,SAAS;EAAM;CAAM;CAClE,IAAI;CACJ,IAAI;EACF,MAAM,SAAS,MAAM,OAAO,SAAS,KAAK;EAC1C,IAAI,OAAO,SAAS,OAAO;GAAE,SAAS;GAAM,OAAO,OAAO;EAAM;EAChE,QAAQ,OAAO;CACjB,SAAS,OAAO;EACd,QAAQ;CACV;CACA,OAAO;EACL,SAAS;EACT,WAAW,IAAI,sBAAsB;GACnC;GACA,WAAW,KAAK,UAAU,KAAK;GAC/B,OAAO,oBAAoB,KAAK;IAAE;IAAO;GAAM,CAAC;EAClD,CAAC,CAAC,CAAC;CACL;AACF"}
|
package/dist/ai.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as agentContract, A as InputRespondedPayload, B as PendingApproval, C as GenerationFailedPayload, D as GenerationStartedPayload, E as GenerationRequestedPayload, F as MessageInterruptedPayload, G as SessionClosedPayload, H as ReasoningLevel, I as ModelLimits, J as ToolCalledPayload, K as SessionCreatedPayload, L as ModelMetadataRequestedPayload, M as LanguageModelUsage, N as MessageCompletedPayload, O as GenerationUsage, P as MessageCreatedPayload, Q as UIMessageChunk, R as ModelMetadataResolvedPayload, S as GenerationCompletedPayload, T as GenerationReason, U as RetryGenerationOptions, V as PendingInput, W as RetryRequestedPayload, X as TranscriptMessage, Y as ToolResultPayload, Z as UIMessage, _ as CompactionPart, a as AI_STATE_REDUCER, at as reasoningLevels, b as CompactionState, c as AgentContract, ct as PendingQueueCommand, d as AgentStatus, dt as ControlReceipt, et as createEvents, f as AgentToolContext, ft as InboxItem, g as CompactionCompletedPayload, h as ApprovalRespondedPayload, i as AIState, it as inputs, j as JSONValue, k as InputRequestedPayload, l as AgentContractOptions, lt as ActiveTurn, m as ApprovalRequestedPayload, n as AIInputs, nt as events, o as ActiveGeneration, ot as reduceAIState, p as AgentToolEventDefs, q as ToolActivity, r as AIMessageOf, rt as handlerContext, s as ActiveGenerationProjection, st as isCompactionPart, t as AIEventDefs, tt as deriveUIMessages, u as AgentReducer, ut as ControlCommand, v as CompactionPartData, w as GenerationProgressPayload, x as FinishReason, y as CompactionRequestedPayload, z as ModelMetadataState } from "./ai-
|
|
1
|
+
import { $ as agentContract, A as InputRespondedPayload, B as PendingApproval, C as GenerationFailedPayload, D as GenerationStartedPayload, E as GenerationRequestedPayload, F as MessageInterruptedPayload, G as SessionClosedPayload, H as ReasoningLevel, I as ModelLimits, J as ToolCalledPayload, K as SessionCreatedPayload, L as ModelMetadataRequestedPayload, M as LanguageModelUsage, N as MessageCompletedPayload, O as GenerationUsage, P as MessageCreatedPayload, Q as UIMessageChunk, R as ModelMetadataResolvedPayload, S as GenerationCompletedPayload, T as GenerationReason, U as RetryGenerationOptions, V as PendingInput, W as RetryRequestedPayload, X as TranscriptMessage, Y as ToolResultPayload, Z as UIMessage, _ as CompactionPart, a as AI_STATE_REDUCER, at as reasoningLevels, b as CompactionState, c as AgentContract, ct as PendingQueueCommand, d as AgentStatus, dt as ControlReceipt, et as createEvents, f as AgentToolContext, ft as InboxItem, g as CompactionCompletedPayload, h as ApprovalRespondedPayload, i as AIState, it as inputs, j as JSONValue, k as InputRequestedPayload, l as AgentContractOptions, lt as ActiveTurn, m as ApprovalRequestedPayload, n as AIInputs, nt as events, o as ActiveGeneration, ot as reduceAIState, p as AgentToolEventDefs, q as ToolActivity, r as AIMessageOf, rt as handlerContext, s as ActiveGenerationProjection, st as isCompactionPart, t as AIEventDefs, tt as deriveUIMessages, u as AgentReducer, ut as ControlCommand, v as CompactionPartData, w as GenerationProgressPayload, x as FinishReason, y as CompactionRequestedPayload, z as ModelMetadataState } from "./ai-BMLlI2Ff.js";
|
|
2
2
|
export { AIEventDefs, AIInputs, AIMessageOf, AIState, AI_STATE_REDUCER, ActiveGeneration, ActiveGenerationProjection, type ActiveTurn, AgentContract, AgentContractOptions, AgentReducer, AgentStatus, AgentToolContext, AgentToolEventDefs, ApprovalRequestedPayload, ApprovalRespondedPayload, CompactionCompletedPayload, CompactionPart, CompactionPartData, CompactionRequestedPayload, CompactionState, type ControlCommand, type ControlReceipt, type FinishReason, GenerationCompletedPayload, GenerationFailedPayload, GenerationProgressPayload, GenerationReason, GenerationRequestedPayload, GenerationStartedPayload, GenerationUsage, type InboxItem, InputRequestedPayload, InputRespondedPayload, type JSONValue, type LanguageModelUsage, MessageCompletedPayload, MessageCreatedPayload, MessageInterruptedPayload, ModelLimits, ModelMetadataRequestedPayload, ModelMetadataResolvedPayload, ModelMetadataState, PendingApproval, PendingInput, type PendingQueueCommand, ReasoningLevel, RetryGenerationOptions, RetryRequestedPayload, SessionClosedPayload, SessionCreatedPayload, ToolActivity, ToolCalledPayload, ToolResultPayload, TranscriptMessage, type UIMessage, type UIMessageChunk, agentContract, createEvents, deriveUIMessages, events, handlerContext, inputs, isCompactionPart, reasoningLevels, reduceAIState };
|
package/dist/ai.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as events, c as reasoningLevels, i as deriveUIMessages, l as reduceAIState, n as agentContract, o as handlerContext, r as createEvents, s as inputs, t as AI_STATE_REDUCER, x as isCompactionPart } from "./ai-
|
|
1
|
+
import { a as events, c as reasoningLevels, i as deriveUIMessages, l as reduceAIState, n as agentContract, o as handlerContext, r as createEvents, s as inputs, t as AI_STATE_REDUCER, x as isCompactionPart } from "./ai-D6mGlO8j.js";
|
|
2
2
|
export { AI_STATE_REDUCER, agentContract, createEvents, deriveUIMessages, events, handlerContext, inputs, isCompactionPart, reasoningLevels, reduceAIState };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/bounded-cache.ts
|
|
2
|
+
function boundedCache({ maxEntries, maxBytes }) {
|
|
3
|
+
const entries = /* @__PURE__ */ new Map();
|
|
4
|
+
let total = 0;
|
|
5
|
+
const remove = (key) => {
|
|
6
|
+
const entry = entries.get(key);
|
|
7
|
+
if (!entry) return;
|
|
8
|
+
entries.delete(key);
|
|
9
|
+
total -= entry.bytes;
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
get(key) {
|
|
13
|
+
const entry = entries.get(key);
|
|
14
|
+
if (!entry) return void 0;
|
|
15
|
+
entries.delete(key);
|
|
16
|
+
entries.set(key, entry);
|
|
17
|
+
return entry.value;
|
|
18
|
+
},
|
|
19
|
+
set(key, value, bytes) {
|
|
20
|
+
remove(key);
|
|
21
|
+
if (bytes > maxBytes / 4) return;
|
|
22
|
+
entries.set(key, {
|
|
23
|
+
value,
|
|
24
|
+
bytes
|
|
25
|
+
});
|
|
26
|
+
total += bytes;
|
|
27
|
+
for (const oldest of entries.keys()) {
|
|
28
|
+
if (entries.size <= maxEntries && total <= maxBytes) break;
|
|
29
|
+
remove(oldest);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
delete: remove,
|
|
33
|
+
deleteWhere(match) {
|
|
34
|
+
for (const key of entries.keys()) if (match(key)) remove(key);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { boundedCache as t };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=bounded-cache-CPHWF-8h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-cache-CPHWF-8h.js","names":[],"sources":["../src/bounded-cache.ts"],"sourcesContent":["/**\n * A least-recently-used map bounded by entry count and total bytes. Callers\n * give each value's size; a value larger than a quarter of the byte budget\n * is not stored. Eviction happens only on insert, so an idle cache does no\n * work and holds no timers.\n */\nexport type BoundedCache<K, V> = {\n get(key: K): V | undefined\n set(key: K, value: V, bytes: number): void\n delete(key: K): void\n /** Remove every entry whose key matches; a scan, for rare invalidations. */\n deleteWhere(match: (key: K) => boolean): void\n}\n\nexport function boundedCache<K, V>({\n maxEntries,\n maxBytes,\n}: {\n maxEntries: number\n maxBytes: number\n}): BoundedCache<K, V> {\n const entries = new Map<K, { value: V; bytes: number }>()\n let total = 0\n\n const remove = (key: K): void => {\n const entry = entries.get(key)\n if (!entry) return\n entries.delete(key)\n total -= entry.bytes\n }\n\n return {\n get(key) {\n const entry = entries.get(key)\n if (!entry) return undefined\n entries.delete(key)\n entries.set(key, entry)\n return entry.value\n },\n set(key, value, bytes) {\n remove(key)\n if (bytes > maxBytes / 4) return\n entries.set(key, { value, bytes })\n total += bytes\n for (const oldest of entries.keys()) {\n if (entries.size <= maxEntries && total <= maxBytes) break\n remove(oldest)\n }\n },\n delete: remove,\n deleteWhere(match) {\n for (const key of entries.keys()) if (match(key)) remove(key)\n },\n }\n}\n"],"mappings":";AAcA,SAAgB,aAAmB,EACjC,YACA,YAIqB;CACrB,MAAM,0BAAU,IAAI,IAAoC;CACxD,IAAI,QAAQ;CAEZ,MAAM,UAAU,QAAiB;EAC/B,MAAM,QAAQ,QAAQ,IAAI,GAAG;EAC7B,IAAI,CAAC,OAAO;EACZ,QAAQ,OAAO,GAAG;EAClB,SAAS,MAAM;CACjB;CAEA,OAAO;EACL,IAAI,KAAK;GACP,MAAM,QAAQ,QAAQ,IAAI,GAAG;GAC7B,IAAI,CAAC,OAAO,OAAO,KAAA;GACnB,QAAQ,OAAO,GAAG;GAClB,QAAQ,IAAI,KAAK,KAAK;GACtB,OAAO,MAAM;EACf;EACA,IAAI,KAAK,OAAO,OAAO;GACrB,OAAO,GAAG;GACV,IAAI,QAAQ,WAAW,GAAG;GAC1B,QAAQ,IAAI,KAAK;IAAE;IAAO;GAAM,CAAC;GACjC,SAAS;GACT,KAAK,MAAM,UAAU,QAAQ,KAAK,GAAG;IACnC,IAAI,QAAQ,QAAQ,cAAc,SAAS,UAAU;IACrD,OAAO,MAAM;GACf;EACF;EACA,QAAQ;EACR,YAAY,OAAO;GACjB,KAAK,MAAM,OAAO,QAAQ,KAAK,GAAG,IAAI,MAAM,GAAG,GAAG,OAAO,GAAG;EAC9D;CACF;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as A2Error, n as isSessionCleared } from "./session-clear-DGI4jTQ5.js";
|
|
2
2
|
import { n as foldEvent, s as validateSync } from "./reducer-BAXc8JyF.js";
|
|
3
3
|
import { r as projectClientState, t as decodeState } from "./reducer-runtime-DQwz_J59.js";
|
|
4
|
-
import {
|
|
5
|
-
import { _ as isWirePresenceSnapshot, a as errorFromWire, c as eventFromCompactWire, f as isCompactWireEvent, g as isWirePresencePatch, h as isWireEvent, l as eventFromWire, p as isStateSnapshotFrame, v as parseSocketFrame, x as presenceSnapshotFromWire, y as presencePatchFromWire } from "./wire-
|
|
4
|
+
import { _ as nullProtoRecord, a as PRESENCE_TIMINGS, l as STREAM_TIMINGS, o as RESERVED_PARTICIPANT_IDS } from "./internal-CscSY7K_.js";
|
|
5
|
+
import { _ as isWirePresenceSnapshot, a as errorFromWire, c as eventFromCompactWire, f as isCompactWireEvent, g as isWirePresencePatch, h as isWireEvent, l as eventFromWire, p as isStateSnapshotFrame, v as parseSocketFrame, x as presenceSnapshotFromWire, y as presencePatchFromWire } from "./wire-BKxH1vbP.js";
|
|
6
6
|
//#region src/client-errors.ts
|
|
7
7
|
var A2ClientError = class extends A2Error {
|
|
8
8
|
status;
|
|
@@ -1721,4 +1721,4 @@ function createClient(options) {
|
|
|
1721
1721
|
//#endregion
|
|
1722
1722
|
export { A2ClientError as a, isInitialPromise as i, createRenderSession as n, resolveInitialForReact as r, createClient as t };
|
|
1723
1723
|
|
|
1724
|
-
//# sourceMappingURL=client-
|
|
1724
|
+
//# sourceMappingURL=client-BhHLoNKF.js.map
|