@restatedev/agents 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +107 -53
  2. package/dist/calls.d.ts +29 -5
  3. package/dist/calls.d.ts.map +1 -1
  4. package/dist/calls.js +77 -10
  5. package/dist/calls.js.map +1 -1
  6. package/dist/claude/index.d.ts +36 -7
  7. package/dist/claude/index.d.ts.map +1 -1
  8. package/dist/claude/index.js +232 -151
  9. package/dist/claude/index.js.map +1 -1
  10. package/dist/client.d.ts +12 -3
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js.map +1 -1
  13. package/dist/common.d.ts +151 -70
  14. package/dist/common.d.ts.map +1 -1
  15. package/dist/common.js +246 -204
  16. package/dist/common.js.map +1 -1
  17. package/dist/conversation.d.ts +478 -0
  18. package/dist/conversation.d.ts.map +1 -0
  19. package/dist/conversation.js +1256 -0
  20. package/dist/conversation.js.map +1 -0
  21. package/dist/deepseek/index.d.ts +38 -5
  22. package/dist/deepseek/index.d.ts.map +1 -1
  23. package/dist/deepseek/index.js +322 -106
  24. package/dist/deepseek/index.js.map +1 -1
  25. package/dist/deepseek/persistence.d.ts +9 -3
  26. package/dist/deepseek/persistence.d.ts.map +1 -1
  27. package/dist/deepseek/persistence.js +12 -6
  28. package/dist/deepseek/persistence.js.map +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/langgraph/checkpointer.d.ts +16 -2
  34. package/dist/langgraph/checkpointer.d.ts.map +1 -1
  35. package/dist/langgraph/checkpointer.js +133 -26
  36. package/dist/langgraph/checkpointer.js.map +1 -1
  37. package/dist/langgraph/context.d.ts +10 -0
  38. package/dist/langgraph/context.d.ts.map +1 -0
  39. package/dist/langgraph/context.js +21 -0
  40. package/dist/langgraph/context.js.map +1 -0
  41. package/dist/langgraph/errors.d.ts +16 -0
  42. package/dist/langgraph/errors.d.ts.map +1 -0
  43. package/dist/langgraph/errors.js +30 -0
  44. package/dist/langgraph/errors.js.map +1 -0
  45. package/dist/langgraph/graph.d.ts +25 -0
  46. package/dist/langgraph/graph.d.ts.map +1 -0
  47. package/dist/langgraph/graph.js +346 -0
  48. package/dist/langgraph/graph.js.map +1 -0
  49. package/dist/langgraph/index.d.ts +65 -12
  50. package/dist/langgraph/index.d.ts.map +1 -1
  51. package/dist/langgraph/index.js +227 -171
  52. package/dist/langgraph/index.js.map +1 -1
  53. package/dist/langgraph/nodes.d.ts +70 -0
  54. package/dist/langgraph/nodes.d.ts.map +1 -0
  55. package/dist/langgraph/nodes.js +145 -0
  56. package/dist/langgraph/nodes.js.map +1 -0
  57. package/dist/messages.d.ts +18 -0
  58. package/dist/messages.d.ts.map +1 -0
  59. package/dist/messages.js +182 -0
  60. package/dist/messages.js.map +1 -0
  61. package/dist/object.d.ts +65 -23
  62. package/dist/object.d.ts.map +1 -1
  63. package/dist/object.js +123 -35
  64. package/dist/object.js.map +1 -1
  65. package/dist/opencode/db.d.ts +51 -10
  66. package/dist/opencode/db.d.ts.map +1 -1
  67. package/dist/opencode/db.js +122 -34
  68. package/dist/opencode/db.js.map +1 -1
  69. package/dist/opencode/index.d.ts +105 -21
  70. package/dist/opencode/index.d.ts.map +1 -1
  71. package/dist/opencode/index.js +827 -279
  72. package/dist/opencode/index.js.map +1 -1
  73. package/dist/output.d.ts +15 -7
  74. package/dist/output.d.ts.map +1 -1
  75. package/dist/output.js +44 -26
  76. package/dist/output.js.map +1 -1
  77. package/dist/pi/index.d.ts +39 -11
  78. package/dist/pi/index.d.ts.map +1 -1
  79. package/dist/pi/index.js +281 -77
  80. package/dist/pi/index.js.map +1 -1
  81. package/dist/pi/storage.d.ts +29 -4
  82. package/dist/pi/storage.d.ts.map +1 -1
  83. package/dist/pi/storage.js +18 -6
  84. package/dist/pi/storage.js.map +1 -1
  85. package/dist/signals.d.ts +74 -4
  86. package/dist/signals.d.ts.map +1 -1
  87. package/dist/signals.js +144 -15
  88. package/dist/signals.js.map +1 -1
  89. package/dist/steering.d.ts +31 -0
  90. package/dist/steering.d.ts.map +1 -0
  91. package/dist/steering.js +45 -0
  92. package/dist/steering.js.map +1 -0
  93. package/dist/tools.d.ts +28 -0
  94. package/dist/tools.d.ts.map +1 -1
  95. package/dist/tools.js +34 -5
  96. package/dist/tools.js.map +1 -1
  97. package/package.json +42 -13
  98. package/src/calls.ts +107 -15
  99. package/src/claude/README.md +41 -20
  100. package/src/claude/index.ts +266 -178
  101. package/src/client.ts +14 -3
  102. package/src/common.ts +317 -232
  103. package/src/conversation.ts +1547 -0
  104. package/src/deepseek/README.md +78 -11
  105. package/src/deepseek/index.ts +384 -137
  106. package/src/deepseek/persistence.ts +11 -8
  107. package/src/index.ts +13 -4
  108. package/src/langgraph/README.md +115 -25
  109. package/src/langgraph/checkpointer.ts +168 -28
  110. package/src/langgraph/context.ts +27 -0
  111. package/src/langgraph/errors.ts +26 -0
  112. package/src/langgraph/graph.ts +396 -0
  113. package/src/langgraph/index.ts +326 -181
  114. package/src/langgraph/nodes.ts +243 -0
  115. package/src/messages.ts +244 -0
  116. package/src/object.ts +169 -38
  117. package/src/opencode/README.md +172 -66
  118. package/src/opencode/db.ts +204 -40
  119. package/src/opencode/index.ts +1010 -325
  120. package/src/output.ts +52 -31
  121. package/src/pi/README.md +18 -3
  122. package/src/pi/index.ts +346 -78
  123. package/src/pi/storage.ts +20 -7
  124. package/src/signals.ts +225 -19
  125. package/src/steering.ts +67 -0
  126. package/src/tools.ts +61 -8
  127. package/dist/claude/conversation.d.ts +0 -33
  128. package/dist/claude/conversation.d.ts.map +0 -1
  129. package/dist/claude/conversation.js +0 -95
  130. package/dist/claude/conversation.js.map +0 -1
  131. package/dist/log.d.ts +0 -29
  132. package/dist/log.d.ts.map +0 -1
  133. package/dist/log.js +0 -146
  134. package/dist/log.js.map +0 -1
  135. package/src/claude/conversation.ts +0 -114
  136. package/src/log.ts +0 -194
package/dist/common.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as restate from '@restatedev/sessions';
2
- import type { Said } from './log.ts';
2
+ import { Link } from '@restatedev/sessions/internal';
3
+ import { type Published, type Steer } from './signals.ts';
3
4
  /**
4
5
  * A value, or a function of the invocation's context that gives it: the
5
6
  * same for every message, or each user's (from the object's database, say).
@@ -16,7 +17,7 @@ export declare const configured: <T>(value: Configure<T>, ctx: restate.SessionCo
16
17
  * order, so each gets the same id again, and its answer.
17
18
  */
18
19
  export declare const nextPromptId: (ctx: restate.SessionContext) => string;
19
- /** The default model of pi, OpenCode and LangGraph, with OPENAI_API_KEY. */
20
+ /** The default model of pi and LangGraph, with OPENAI_API_KEY. */
20
21
  export declare const DEFAULT_MODEL = "openai/gpt-6-sol";
21
22
  /** The default model of Claude agents, with ANTHROPIC_API_KEY. */
22
23
  export declare const CLAUDE_MODEL = "anthropic/claude-sonnet-5-5";
@@ -52,6 +53,11 @@ export declare const checkModelName: (framework: string, model: string | undefin
52
53
  export declare const modelIdOf: (model: string, provider: string) => string;
53
54
  /** A chat message: the request's body as text, or the string it is as JSON (`"Hi"`). */
54
55
  export declare const messageSerde: restate.Serde<string>;
56
+ /**
57
+ * What an empty answer says, as the model sees it later in the conversation:
58
+ * a provider's API may refuse an empty text (Anthropic's does).
59
+ */
60
+ export declare const NO_ANSWER = "(no answer)";
55
61
  /**
56
62
  * What a cancelled turn answers, and each tool call it cut off: the model
57
63
  * sees it in the conversation that goes on.
@@ -63,8 +69,43 @@ export declare const CANCELLED = "Cancelled: the turn was stopped before it fini
63
69
  * conversation that goes on, rather than answer it with the next message.
64
70
  */
65
71
  export declare const UNANSWERED = "Unanswered: the model's provider refused the request.";
72
+ /**
73
+ * What a turn whose invocation ended without answering it (killed, say)
74
+ * answers, and each tool call it cut off: the next message, or the companion
75
+ * once it finds the invocation gone (`settle`), closes it with this.
76
+ */
77
+ export declare const ENDED = "Ended: the turn ended before it finished, and was not answered.";
78
+ /** The result of a tool call a stopped turn cut off once its Restate call had answered: it happened. */
79
+ export declare const RETURNED_UNRECORDED = "Done, but the turn was stopped before this call's result was recorded: it did happen, so check its effect before doing it again.";
80
+ /**
81
+ * What a stopped turn records as the result of its tool call `callId`, which
82
+ * has none: `text` (cancelled, say), unless the call's Restate call answered
83
+ * (`outcomes` of calls.ts), which the model would take for undone, and do
84
+ * again: then the error it answered with, or {@link RETURNED_UNRECORDED}.
85
+ */
86
+ export declare function cutOffResult(outcomes: ReadonlyMap<string, string | undefined>, callId: string, text: string): string;
87
+ /** How many of the latest answered turns the model sees whole (with their tool calls and results), or `'all'`. */
88
+ export type Window = number | 'all';
89
+ /** The window by default: the previous turn's tool calls and results stay in view, for a follow-up. */
90
+ export declare const WINDOW: Window;
91
+ /** How many tokens of the turns before the window the model sees, by default, counted as 4 characters each. */
92
+ export declare const BUDGET = 32000;
93
+ /** How an agent summarizes earlier turns: from the request ({@link SUMMARIZE} and the turns, as text) to the summary. */
94
+ export type Summarize = (ctx: restate.SessionContext, request: string) => Promise<string>;
95
+ /** What a request to summarize earlier turns starts with, before the turns themselves. */
96
+ export declare const SUMMARIZE = "Summarize the conversation below, for the assistant who carries it on: keep the facts, names, numbers, decisions, the user's preferences, and what is still open. Answer with the summary only.\n\n";
97
+ /**
98
+ * What a turn checks its answer with: nothing if the answer is what was
99
+ * asked for, else the message that asks the model again, once, within the
100
+ * turn (`answerOnce`'s `check`). With `last`, the model was asked again
101
+ * already: a check that throws a terminal error then fails the turn, which
102
+ * is closed with it.
103
+ */
104
+ export type Check = (answer: string, last?: boolean) => string | undefined;
105
+ /** `window`, if it is one: a whole number of turns (0 or more), or `'all'`. */
106
+ export declare function checkWindow(window: Window): Window;
66
107
  /** The message a `chat` handler is answering: its invocation, and when it started. */
67
- export interface Turn {
108
+ export interface Answering {
68
109
  /** The invocation's id: `/restate/invocation/<id>/attach` waits for its answer. */
69
110
  invocationId: string;
70
111
  /** When it started, as an ISO date. */
@@ -88,24 +129,67 @@ export declare class AttemptEnded extends Error {
88
129
  * answers nothing).
89
130
  */
90
131
  export declare const stopSignalOf: (ctx: restate.SessionContext) => AbortSignal | undefined;
91
- /** What `clear` also empties, beside the agent's database. */
92
- type Clear = (ctx: restate.SessionContext) => Promise<void>;
93
132
  /**
94
- * The `messages` view `view` of a framework that keeps a conversation apart
95
- * (OpenCode, in a database of its own): `clear` empties it too, as an agent
96
- * with this view is cleared.
133
+ * An agent's settings: whether it runs in the background (`background:
134
+ * true`: no one follows it as it works), and, for an agent on the
135
+ * conversation of turns (conversation.ts), its framework's items, how much
136
+ * of the conversation its model sees (`window` and `budget`), and how it
137
+ * summarizes the earliest turns (`summarize`).
97
138
  */
98
- export declare const alsoClearing: <V extends object>(view: V, clear: Clear) => V;
99
- /**
100
- * `definition` is an agent's: whether it runs in the background, and its
101
- * `messages` view, whose clearing (`alsoClearing`) its `clear` does too.
102
- */
103
- export declare const isAgent: <D extends object>(definition: D, { background, messages }: {
139
+ export interface Settings {
140
+ background: boolean;
141
+ /** The items of its framework, if it keeps the conversation of turns (its `messages` view is `conversationView`'s). */
142
+ items?: object;
143
+ window: Window;
144
+ budget: number;
145
+ summarize?: Summarize;
146
+ }
147
+ /** The items of a framework's `messages` view on the conversation of turns. */
148
+ export declare const ITEMS: Link<object>;
149
+ /** `definition` is an agent's, with these settings: its framework's items, if it is on the conversation of turns. */
150
+ export declare const isAgent: <D extends object>(definition: D, { background, items, window, budget, summarize, }: {
104
151
  background?: boolean | undefined;
105
- messages?: object | undefined;
152
+ budget?: number | undefined;
153
+ items?: object | undefined;
154
+ summarize?: Summarize | undefined;
155
+ window?: Window | undefined;
106
156
  }) => D;
107
- /** Clear what the agent of `ctx` keeps beside its database. */
108
- export declare const cleared: (ctx: restate.SessionContext) => Promise<void | undefined>;
157
+ /** The settings of the agent of `ctx`: the defaults, for an object that is no agent. */
158
+ export declare const settingsOf: (ctx: restate.SessionContext) => Settings;
159
+ /**
160
+ * The messages steered to a `chat` turn that it has not taken yet, as the
161
+ * companion last published them. The companion answers them to every
162
+ * `publish`, which a turn makes at each tool call's start and end: so the
163
+ * turn knows of them without a call of its own, and finds them at its next
164
+ * step (`takeSteers`). The newest revision wins, as tool calls that run at
165
+ * once publish at once.
166
+ */
167
+ export declare class Inbox {
168
+ #private;
169
+ revision: number;
170
+ messages: Steer[];
171
+ /** Keep what `publish` answered, if it is newer than what is kept, and tell the listeners if it lists messages. */
172
+ saw(published: Published | undefined): void;
173
+ /**
174
+ * Call `listener` after each publish that lists messages, until the
175
+ * returned function is called: for a framework that takes steered
176
+ * messages through an inbox of its own (pi's, DeepSeek's), handed to it as
177
+ * they come.
178
+ */
179
+ listen(listener: () => void): () => void;
180
+ }
181
+ /** The inbox of the `chat` turn running on `ctx`, if it takes steered messages: none outside one. */
182
+ export declare const inboxOf: (ctx: restate.SessionContext) => Inbox | undefined;
183
+ /**
184
+ * The conversation of `ctx` changed (see `watch` in object.ts): its revision
185
+ * increases, and the clients that follow it read it again; while a framework
186
+ * answers ({@link answering}), the calls whose results it stored are
187
+ * forgotten first. It is a call to Restate, so it also sends what the
188
+ * handler wrote before, for them to read.
189
+ */
190
+ export declare const publish: (ctx: restate.SessionContext) => Promise<void>;
191
+ /** A step of a turn of `ctx`: {@link publish} it, unless the agent runs in the background, which publishes the turn's end only. */
192
+ export declare const stepped: (ctx: restate.SessionContext) => Promise<void>;
109
193
  /**
110
194
  * A tool call of the turn of `ctx` starts: {@link publish} it, which forgets
111
195
  * the calls whose results are stored (calls.ts) before the tool makes its
@@ -115,8 +199,30 @@ export declare const cleared: (ctx: restate.SessionContext) => Promise<void | un
115
199
  export declare function toolCallStarted(ctx: restate.SessionContext): Promise<void>;
116
200
  /** A tool call of the turn of `ctx` (a `chat` handler's) ended: {@link publish} it, unless the agent runs in the background. */
117
201
  export declare function toolCallEnded(ctx: restate.SessionContext): Promise<void>;
202
+ /** Whether a tool call's result is stored: `stored(callId, failed)`, `failed` the error the call answered with. */
203
+ export type Stored = (callId: string, failed?: string) => boolean;
204
+ /**
205
+ * Run `work`, a framework's turn on the conversation of turns, forgetting
206
+ * the calls whose results it stores as it goes: each publish while it runs
207
+ * (a tool call's start and end), and its end, forget the Restate calls of
208
+ * the tool calls whose results `stored` says are stored (calls.ts).
209
+ */
210
+ export declare function answering<T>(ctx: restate.SessionContext, stored: Stored, work: () => Promise<T>): Promise<T>;
118
211
  /** A promise that rejects with `signal`'s reason once it aborts. */
119
212
  export declare const aborted: (signal: AbortSignal) => Promise<never>;
213
+ /** A `chat` handler's answer to a message: a framework's prompt, say. */
214
+ export type Chat<A = unknown> = (ctx: restate.SessionContext, message: string) => Promise<A>;
215
+ /**
216
+ * Whether a `chat` handler's turns take steered messages: for every message,
217
+ * or for each, as the invocation's context says (a framework's options that
218
+ * a function gives, say).
219
+ */
220
+ export type Steers = boolean | ((ctx: restate.SessionContext) => boolean | Promise<boolean>);
221
+ /** The answer of `entry`, a handler that `chatHandler` made, and whether it takes steered messages. */
222
+ export declare const chatOf: (entry: object) => {
223
+ answer: Chat;
224
+ steers: Steers;
225
+ } | undefined;
120
226
  /**
121
227
  * `answer` as a chat handler, which takes its message as plain text or as a
122
228
  * JSON string, so that both of these work:
@@ -124,7 +230,7 @@ export declare const aborted: (signal: AbortSignal) => Promise<never>;
124
230
  * curl localhost:8080/assistant/alice/chat -d 'Hi'
125
231
  * curl localhost:8080/assistant/alice/chat --json '"Hi"'
126
232
  *
127
- * While it answers, the object's `status` says so (its {@link Turn}). Its
233
+ * While it answers, the object's `status` says so (its {@link Answering}). Its
128
234
  * invocation's cancellation (Restate's, explicit: `cancelled(ctx)` of
129
235
  * @restatedev/sessions/internal) aborts {@link stopSignalOf} its
130
236
  * context, whenever it comes, and cancels the calls its tools made
@@ -135,13 +241,27 @@ export declare const aborted: (signal: AbortSignal) => Promise<never>;
135
241
  *
136
242
  * It publishes when it starts and ends ({@link publish}), for the clients
137
243
  * that follow the conversation.
244
+ *
245
+ * As the `chat` handler of an agent, it also answers each message sent to
246
+ * the agent's `steer` view that no turn took, as a turn of its own (the
247
+ * private `steered` handler). With `steers` (a framework's integration says
248
+ * so), its turns take steered messages at their steps (`takeSteers`).
138
249
  */
139
- export declare const chatHandler: <A = string>(answer: (ctx: restate.SessionContext, message: string) => Promise<A>) => {
250
+ export declare const chatHandler: <A = string>(answer: Chat<A>, { steers }?: {
251
+ steers?: Steers;
252
+ }) => {
140
253
  input: restate.Serde<string>;
141
254
  accept: string;
142
255
  explicitCancellation: boolean;
143
256
  handler: (ctx: restate.SessionContext, text: string) => Promise<A>;
144
257
  };
258
+ /**
259
+ * Answer `text` as a turn of the agent of `ctx`, with `answer`: the body of a
260
+ * `chat` handler ({@link chatHandler}), and of `steered`. With `steers`, the
261
+ * turn takes the messages steered to it at its steps (unless the agent runs
262
+ * in the background).
263
+ */
264
+ export declare function chatTurn<A>(ctx: restate.SessionContext, text: string, answer: Chat<A>, steers?: Steers): Promise<A>;
145
265
  /** A tool's error, which fails the attempt (Restate retries it): the error `cause` of tool `tool`. */
146
266
  export declare class ToolError extends Error {
147
267
  readonly tool: string;
@@ -162,11 +282,13 @@ export declare function refusalOf(ctx: restate.SessionContext, error: unknown):
162
282
  */
163
283
  export declare function refusal(error: unknown): restate.TerminalError | undefined;
164
284
  /**
165
- * A prompt's stored answer, as the prompt returns it: {@link UNANSWERED},
166
- * stored as its provider refused it, fails as the prompt did then
167
- * ({@link REFUSED}), also in a retry after a crash right after it was stored.
285
+ * A prompt's stored answer, as the prompt returns it, by how its turn ended
286
+ * (`status`): a turn refused ({@link UNANSWERED}) fails with
287
+ * {@link REFUSED}, one failed for good with its error, one cancelled with
288
+ * the cancellation, one another invocation ended with its note; so that a
289
+ * retry after a crash right after the close fails as the prompt did.
168
290
  */
169
- export declare function storedAnswer(answer: string): string;
291
+ export declare function storedAnswer(answer: string, status?: string): string;
170
292
  /** A message of a conversation, as an agent's `messages` handler returns it. */
171
293
  export interface ChatMessage {
172
294
  /** Its id, from 0, in the order of the conversation; the same however it changes. `before` takes it. */
@@ -196,6 +318,12 @@ export type Part = {
196
318
  * follow it.
197
319
  */
198
320
  export interface MessagesRequest {
321
+ /**
322
+ * `full` (the default): every message, with its tool calls; `summary`:
323
+ * each turn's message of the user and its answer, under the ids they have
324
+ * in the full view.
325
+ */
326
+ view?: 'full' | 'summary';
199
327
  /** At most this many messages (default 50). */
200
328
  limit?: number;
201
329
  /** The messages before this one (its `id`): older ones, such as for scrolling back. */
@@ -220,51 +348,4 @@ export interface Messages {
220
348
  */
221
349
  first?: number;
222
350
  }
223
- /**
224
- * A conversation as `messages` gives it, built from a framework's transcript:
225
- * each message is started by `say`, a tool call goes to the assistant's
226
- * message, and its result to its call. Messages without parts are left out.
227
- *
228
- * A message, once given out by `messages()`, is never changed: a change
229
- * makes a new one in its place. So a framework can keep its transcript and
230
- * add to it as its conversation grows, and the log stores only the messages
231
- * that are not the ones it stored last (see log.ts).
232
- */
233
- export declare class Transcript {
234
- #private;
235
- /** A new message of `role`, with `text` if there is any. */
236
- say(role: ChatMessage['role'], text?: string): void;
237
- /** Tool call `id` of the assistant's message. */
238
- call(id: string, name: string, input: unknown): void;
239
- /** The output of tool call `id`; an error's if the framework says so, or it is a tool's `Error: <message>`. */
240
- result(id: string, output: string, error?: boolean): void;
241
- /**
242
- * Whether tool call `id` has its output: not an error's, unless it is
243
- * `failed`, the error the call answered with.
244
- */
245
- answered(id: string, failed?: string): boolean;
246
- /** Its messages, in order: those with parts. */
247
- messages(): Said[];
248
- }
249
- /**
250
- * A framework's transcript as it stands, while it answers (see
251
- * {@link transcribing}): a new one, or the one it keeps and adds to.
252
- */
253
- export type Read = () => Promise<Transcript>;
254
- /**
255
- * Run `work`, a framework's turn (or a compaction, a reset), with `read`
256
- * giving the framework's transcript as it stands, from the framework as
257
- * `work` holds it open: each publish meanwhile (a tool call's start and end)
258
- * takes it into the conversation's log, and so does `work`'s end, before the
259
- * framework closes. `messages` and `sync` read the log.
260
- */
261
- export declare function transcribing<T>(ctx: restate.SessionContext, read: Read, work: () => Promise<T>): Promise<T>;
262
- /**
263
- * The handler of an agent's conversation as clients read it, from its log:
264
- * a page of it (`{limit, before}`), or what is new or changed since a cursor
265
- * (`{cursor}`). It is a view: it answers while a message is answered, with
266
- * what was stored so far, and stores nothing.
267
- */
268
- export declare const messagesHandler: () => (ctx: restate.ViewContext, request?: MessagesRequest) => Promise<Messages>;
269
- export {};
270
351
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAIhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjF,2CAA2C;AAC3C,eAAO,MAAM,UAAU,GAAU,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,cAAc,KAAG,OAAO,CAAC,CAAC,CACO,CAAC;AAKxG;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAS,OAAO,CAAC,cAAc,WAIvD,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,aAAa,qBAAqB,CAAC;AAEhD,kEAAkE;AAClE,eAAO,MAAM,YAAY,gCAAgC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,GAAG,SAAS,8BAAqE,CAAC;AAEvH,kHAAkH;AAClH,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAGvE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,MAAM,CAAC;AAE3B,+DAA+D;AAC/D,eAAO,MAAM,WAAW,sFAAsF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