@restatedev/agents 0.3.0 → 0.4.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 +89 -49
  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 +466 -0
  18. package/dist/conversation.d.ts.map +1 -0
  19. package/dist/conversation.js +1247 -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 +121 -35
  64. package/dist/object.js.map +1 -1
  65. package/dist/output.d.ts +15 -7
  66. package/dist/output.d.ts.map +1 -1
  67. package/dist/output.js +44 -26
  68. package/dist/output.js.map +1 -1
  69. package/dist/pi/index.d.ts +39 -11
  70. package/dist/pi/index.d.ts.map +1 -1
  71. package/dist/pi/index.js +281 -77
  72. package/dist/pi/index.js.map +1 -1
  73. package/dist/pi/storage.d.ts +29 -4
  74. package/dist/pi/storage.d.ts.map +1 -1
  75. package/dist/pi/storage.js +18 -6
  76. package/dist/pi/storage.js.map +1 -1
  77. package/dist/signals.d.ts +74 -4
  78. package/dist/signals.d.ts.map +1 -1
  79. package/dist/signals.js +144 -15
  80. package/dist/signals.js.map +1 -1
  81. package/dist/steering.d.ts +31 -0
  82. package/dist/steering.d.ts.map +1 -0
  83. package/dist/steering.js +45 -0
  84. package/dist/steering.js.map +1 -0
  85. package/dist/tools.d.ts +28 -0
  86. package/dist/tools.d.ts.map +1 -1
  87. package/dist/tools.js +34 -5
  88. package/dist/tools.js.map +1 -1
  89. package/package.json +33 -37
  90. package/src/calls.ts +107 -15
  91. package/src/claude/README.md +41 -20
  92. package/src/claude/index.ts +266 -178
  93. package/src/client.ts +14 -3
  94. package/src/common.ts +317 -232
  95. package/src/conversation.ts +1527 -0
  96. package/src/deepseek/README.md +78 -11
  97. package/src/deepseek/index.ts +384 -137
  98. package/src/deepseek/persistence.ts +11 -8
  99. package/src/index.ts +13 -4
  100. package/src/langgraph/README.md +115 -25
  101. package/src/langgraph/checkpointer.ts +168 -28
  102. package/src/langgraph/context.ts +27 -0
  103. package/src/langgraph/errors.ts +26 -0
  104. package/src/langgraph/graph.ts +396 -0
  105. package/src/langgraph/index.ts +326 -181
  106. package/src/langgraph/nodes.ts +243 -0
  107. package/src/messages.ts +244 -0
  108. package/src/object.ts +167 -38
  109. package/src/output.ts +52 -31
  110. package/src/pi/README.md +18 -3
  111. package/src/pi/index.ts +346 -78
  112. package/src/pi/storage.ts +20 -7
  113. package/src/signals.ts +225 -19
  114. package/src/steering.ts +67 -0
  115. package/src/tools.ts +61 -8
  116. package/dist/claude/conversation.d.ts +0 -33
  117. package/dist/claude/conversation.d.ts.map +0 -1
  118. package/dist/claude/conversation.js +0 -95
  119. package/dist/claude/conversation.js.map +0 -1
  120. package/dist/log.d.ts +0 -29
  121. package/dist/log.d.ts.map +0 -1
  122. package/dist/log.js +0 -146
  123. package/dist/log.js.map +0 -1
  124. package/dist/opencode/db.d.ts +0 -40
  125. package/dist/opencode/db.d.ts.map +0 -1
  126. package/dist/opencode/db.js +0 -161
  127. package/dist/opencode/db.js.map +0 -1
  128. package/dist/opencode/index.d.ts +0 -100
  129. package/dist/opencode/index.d.ts.map +0 -1
  130. package/dist/opencode/index.js +0 -436
  131. package/dist/opencode/index.js.map +0 -1
  132. package/src/claude/conversation.ts +0 -114
  133. package/src/log.ts +0 -194
  134. package/src/opencode/README.md +0 -125
  135. package/src/opencode/db.ts +0 -223
  136. package/src/opencode/index.ts +0 -559
@@ -1,6 +1,7 @@
1
1
  // Claude agents in Restate virtual objects, on the tool runner of the
2
- // Anthropic SDK (`client.beta.messages.toolRunner`): the conversation is in
3
- // the object's database (conversation.ts).
2
+ // Anthropic SDK (`client.beta.messages.toolRunner`): the conversation is the
3
+ // object's conversation of turns (../conversation.ts), whose items are the
4
+ // SDK's messages (`BetaMessageParam`).
4
5
  //
5
6
  // const assistant = claude.agent({ name: 'assistant', system: 'Answer briefly.', tools: [weather] });
6
7
  //
@@ -12,35 +13,121 @@
12
13
  // with ANTHROPIC_API_KEY.
13
14
  //
14
15
  // The handler is not replayed: a retried attempt (a crash, a lost connection)
15
- // runs again from the start, and starts the runner with the stored messages:
16
+ // runs again from the start, and starts the runner with what the model sees
17
+ // of the conversation (`history()`: the earlier turns as their prompts and
18
+ // answers, the latest whole):
16
19
  // - Each reply of the model is stored before its tools run, and their results
17
20
  // before the next request. So a crash during the tools resumes them with the
18
21
  // same tool call ids (`callId(context)`), without asking the model again,
19
- // and a tool passes the id on to stay idempotent.
20
- // - A tool's error fails the attempt, which Restate retries (by default the
21
- // runner hands it to the model as the tool's result).
22
- // - A message is answered once per invocation: its answer is stored with the
23
- // model's last reply, and a retried attempt returns it.
24
- // - A reply cut off at `maxTokens`, or declined, ends the prompt: its tool
25
- // calls do not run, and the handler fails with a terminal error.
22
+ // and a tool passes the id on to stay idempotent. A stored final reply is
23
+ // the answer: the model is not asked for it again.
24
+ // - A tool's error fails the attempt, which Restate retries; but the SDK's
25
+ // `ToolError`, which is meant for the model, is the tool's result.
26
+ // - A message is answered once per invocation (`answerOnce`).
27
+ // - A reply cut off at `maxTokens`, declined, or past the model's context
28
+ // window ends the turn: its tool calls do not run, and the handler fails
29
+ // with a terminal error.
30
+ // - With `output`, a model with structured outputs is asked for it natively:
31
+ // each request of the run has its JSON schema (`output_config.format`),
32
+ // which holds the final reply to it, and tool calls go on as before. The
33
+ // reply is checked all the same (output.ts).
26
34
  import * as restate from '@restatedev/sessions';
27
35
  import { ScopeKey } from '@restatedev/sessions/internal';
28
36
  import Anthropic from '@anthropic-ai/sdk';
29
- import { aborted, AttemptEnded, CANCELLED, chatHandler, CLAUDE_MODEL, configured, fromTool, messagesHandler, modelIdOf, modelOf, nextPromptId, refusalOf, stopSignalOf, storedAnswer, toolCallEnded, toolCallStarted, transcribing, Transcript, UNANSWERED, } from '../common.js';
30
- import { withOutput } from '../output.js';
37
+ import { betaZodOutputFormat } from '@anthropic-ai/sdk/helpers/beta/zod';
38
+ import { ToolError } from '@anthropic-ai/sdk/lib/tools/ToolError';
39
+ import { chatHandler, CLAUDE_MODEL, configured, fromTool, modelIdOf, modelOf, RETURNED_UNRECORDED, stopSignalOf, toolCallEnded, toolCallStarted, NO_ANSWER, } from '../common.js';
40
+ import { answerOnce } from '../conversation.js';
41
+ import { takeSteers } from '../steering.js';
42
+ import { conversationView } from '../messages.js';
43
+ import { withChecked } from '../output.js';
31
44
  import { sessionObject } from '../object.js';
32
45
  import { isTool, jsonSchemaOf } from '../tools.js';
33
- import { Conversation } from './conversation.js';
34
46
  /** The id of the tool call a tool runs for: the runner always passes it. */
35
47
  export const callId = (context) => {
36
48
  if (!context)
37
49
  throw new Error('a tool call without its context');
38
50
  return context.toolUse.id;
39
51
  };
52
+ /**
53
+ * `messages` as the API takes them: it refuses an empty text, and an
54
+ * assistant's message with no content but the last. The model may reply
55
+ * with nothing (stored as it came): sent back, such a reply says so.
56
+ */
57
+ const sendable = (messages) => messages.map((m) => {
58
+ if (m.role !== 'assistant')
59
+ return m;
60
+ if (typeof m.content === 'string')
61
+ return m.content.trim() ? m : { ...m, content: NO_ANSWER };
62
+ const content = m.content.filter((b) => b.type !== 'text' || b.text.trim() !== '');
63
+ if (content.length === 0)
64
+ return { ...m, content: NO_ANSWER };
65
+ return content.length === m.content.length ? m : { ...m, content };
66
+ });
67
+ /** The text of stored content, without its tool calls and results. */
68
+ const storedText = (content) => typeof content === 'string' ? content : (content ?? []).flatMap((b) => (b.type === 'text' ? [b.text] : [])).join('');
69
+ /**
70
+ * Claude's items: the SDK's messages, as JSON. A user's text is said by the
71
+ * user, an assistant's by the assistant, and its `tool_use` blocks are its
72
+ * calls; a `tool_result` is a result. A server tool's blocks (and a
73
+ * `system` message) say nothing: they leave no open call the API would
74
+ * refuse a result for.
75
+ */
76
+ export const items = {
77
+ dump: (message) => JSON.stringify(message),
78
+ load: (stored) => {
79
+ // Only a message of the API's (a role and its content): another framework's row is not one.
80
+ const message = JSON.parse(stored);
81
+ const { role, content, ...rest } = message;
82
+ if ((role !== 'user' && role !== 'assistant') || (typeof content !== 'string' && !Array.isArray(content)))
83
+ throw new Error('not a message of the Claude API (a role and its content)');
84
+ if (Object.keys(rest).length > 0)
85
+ throw new Error(`not a message of the Claude API: ${Object.keys(rest).join(', ')}`);
86
+ return message;
87
+ },
88
+ prompt: (text) => ({ role: 'user', content: text }),
89
+ // The API refuses an empty text: an empty answer, as the model sees it later, says so.
90
+ reply: (text) => ({ role: 'assistant', content: text.trim() ? text : NO_ANSWER }),
91
+ // Every result of a reply in one message, as the API wants them.
92
+ results: (results) => results.length === 0
93
+ ? []
94
+ : [
95
+ {
96
+ role: 'user',
97
+ content: results.map(([call, output]) => ({
98
+ type: 'tool_result',
99
+ tool_use_id: call.id,
100
+ content: output,
101
+ ...(output === RETURNED_UNRECORDED ? {} : { is_error: true }),
102
+ })),
103
+ },
104
+ ],
105
+ read: (message) => {
106
+ if (message.role !== 'user' && message.role !== 'assistant')
107
+ return {};
108
+ const { role, content } = message;
109
+ if (typeof content === 'string')
110
+ return { said: [role, content] };
111
+ const texts = content.filter((b) => b.type === 'text');
112
+ const calls = content.flatMap((b) => (b.type === 'tool_use' ? [{ id: b.id, name: b.name, input: b.input }] : []));
113
+ const results = content.flatMap((b) => b.type === 'tool_result'
114
+ ? [{ id: b.tool_use_id, output: storedText(b.content), error: b.is_error === true }]
115
+ : []);
116
+ // Each reply of the model is a message of its own, its tool calls' too (as
117
+ // the views gave them before); a message of results only says nothing.
118
+ const said = role === 'assistant' || texts.length > 0;
119
+ return {
120
+ ...(said ? { said: [role, texts.map((b) => b.text).join('')] } : {}),
121
+ calls,
122
+ results,
123
+ };
124
+ },
125
+ };
40
126
  /**
41
127
  * `tools`, whose errors fail the attempt: the runner would hand a thrown error
42
128
  * to the model as the tool's result, so each one is kept, for `check()` to
43
- * throw once the tools ran.
129
+ * throw once the tools ran. The SDK's `ToolError` is for the model: the
130
+ * runner hands it over as the tool's result.
44
131
  */
45
132
  function failing(ctx, tools) {
46
133
  let failure;
@@ -52,6 +139,8 @@ function failing(ctx, tools) {
52
139
  return await tool.run(args, context);
53
140
  }
54
141
  catch (e) {
142
+ if (e instanceof ToolError)
143
+ throw e;
55
144
  fromTool(ctx, e);
56
145
  failure ??= e;
57
146
  throw e;
@@ -69,72 +158,100 @@ const textOf = (content) => content
69
158
  .map((c) => c.text)
70
159
  .join('');
71
160
  /**
72
- * Run prompt `id` of `conversation` until it is answered, from its stored
73
- * messages; each round of tool calls published as it starts and ends (for
74
- * the clients that follow the conversation).
161
+ * The run of `agent` on the conversation: from the stored turn on, each
162
+ * reply stored before its tools run, and their results after; each round of
163
+ * tool calls published as it starts and ends (for the clients that follow
164
+ * the conversation). At each step (before a request that follows the
165
+ * prompt or the tools' results), it takes the messages steered to the turn
166
+ * (`takeSteers`): the request then goes out from the conversation's
167
+ * history, which has them after the tools' results.
75
168
  */
76
- async function run(ctx, { client, model, maxTokens, effort, system, tools: all }, conversation, id, signal) {
77
- const { tools, check } = failing(ctx, all);
78
- const runner = client.beta.messages.toolRunner({
79
- model,
80
- max_tokens: maxTokens,
81
- ...(effort === undefined ? {} : { output_config: { effort } }),
82
- ...(system === undefined ? {} : { system }),
83
- tools,
84
- messages: await conversation.messages(),
85
- }, { signal });
86
- // A reply whose tools did not finish (a crash): run them, with the same ids,
87
- // once the calls whose results are stored are settled, as for any reply:
88
- // else one of its calls could take the id of an identical call answered before.
89
- if (runner.params.messages.at(-1)?.role === 'assistant') {
90
- await toolCallStarted(ctx);
91
- const results = await runner.generateToolResponse();
92
- check();
93
- if (results) {
94
- await conversation.append(id, [results]);
95
- runner.pushMessages(results);
96
- }
97
- await toolCallEnded(ctx);
98
- }
99
- for await (const message of runner) {
100
- const reply = { role: 'assistant', content: message.content };
101
- // A reply that cannot go on ends the prompt, whose tool calls do not run.
102
- const stopped = stoppedShort(message, maxTokens);
103
- if (stopped) {
104
- await conversation.close(id, stopped.text, reply);
105
- throw new restate.TerminalError(stopped.error);
169
+ const runOf = (ctx, agent) => async (conversation) => {
170
+ const { client, model, maxTokens, effort, system, format } = agent;
171
+ const turn = conversation.turn;
172
+ for (;;) {
173
+ // A stored final reply is the answer: the model is not asked for it again.
174
+ const final = turn.finalReply();
175
+ if (final !== undefined)
176
+ return final;
177
+ // A paused reply goes back as the last message, which a steered one would not leave it.
178
+ if (turn.entries.at(-1).parsed?.said?.[0] !== 'assistant')
179
+ await takeSteers(ctx, conversation);
180
+ const { tools, check } = failing(ctx, agent.tools);
181
+ const runner = client.beta.messages.toolRunner({
182
+ model,
183
+ max_tokens: maxTokens,
184
+ ...(effort === undefined && format === undefined ? {} : { output_config: { effort, format } }),
185
+ ...(system === undefined ? {} : { system }),
186
+ tools,
187
+ messages: sendable(conversation.history()),
188
+ }, { signal: stopSignalOf(ctx) });
189
+ /** A step: the messages steered to the turn go into the next request, after the tools' results. */
190
+ const step = async () => {
191
+ if ((await takeSteers(ctx, conversation)).length === 0)
192
+ return;
193
+ // The runner leaves the history to its caller, who changed it: the reply, its results and the messages.
194
+ runner.setMessagesParams((params) => ({ ...params, messages: sendable(conversation.history()) }));
195
+ };
196
+ // A reply whose tools did not finish (a crash): run them, with the same
197
+ // ids, once the calls whose results are stored are settled, as for any
198
+ // reply: else one of its calls could take the id of an identical call
199
+ // answered before.
200
+ if (turn.openCalls().length > 0) {
201
+ await toolCallStarted(ctx);
202
+ const results = await runner.generateToolResponse();
203
+ check();
204
+ if (results) {
205
+ await turn.append(results);
206
+ runner.pushMessages(results);
207
+ }
208
+ await toolCallEnded(ctx);
209
+ await step();
106
210
  }
107
- if (!message.content.some((c) => c.type === 'tool_use')) {
108
- await conversation.append(id, [reply], textOf(message.content));
109
- return;
211
+ let paused = false;
212
+ for await (const message of runner) {
213
+ // A reply that cannot go on ends the turn, whose tool calls do not run.
214
+ const stopped = stoppedShort(message, maxTokens);
215
+ if (stopped)
216
+ throw new restate.TerminalError(stopped);
217
+ const said = { role: 'assistant', content: message.content };
218
+ // Paused (a server tool's long turn): a step of the turn, not a reply to
219
+ // end it with, and the model goes on from it.
220
+ if (message.stop_reason === 'pause_turn') {
221
+ await turn.append(said);
222
+ paused = true;
223
+ break;
224
+ }
225
+ await turn.appendReply([said]);
226
+ if (!message.content.some((c) => c.type === 'tool_use'))
227
+ return textOf(message.content);
228
+ await toolCallStarted(ctx);
229
+ const results = await runner.generateToolResponse();
230
+ check();
231
+ if (results)
232
+ await turn.append(results);
233
+ await toolCallEnded(ctx);
234
+ await step();
110
235
  }
111
- // The reply first, then its tools.
112
- await conversation.append(id, [reply]);
113
- await toolCallStarted(ctx);
114
- const results = await runner.generateToolResponse();
115
- check();
116
- if (results)
117
- await conversation.append(id, [results]);
118
- await toolCallEnded(ctx);
236
+ if (!paused)
237
+ throw new Error('the tool runner ended without a reply');
119
238
  }
120
- }
239
+ };
121
240
  /**
122
241
  * Why the model's `message` stopped short of a reply to go on from: cut off
123
- * at `maxTokens` (its text, or a tool call's input, unfinished), or declined.
242
+ * at `maxTokens` (its text, or a tool call's input, unfinished), declined, or
243
+ * past the model's context window: a terminal error's message.
124
244
  */
125
245
  function stoppedShort(message, maxTokens) {
126
246
  if (message.stop_reason === 'max_tokens') {
127
- return {
128
- text: `Cut off: the reply reached ${maxTokens} tokens before it ended.`,
129
- error: `the model's reply reached maxTokens (${maxTokens}) before it ended: raise the agent's maxTokens`,
130
- };
247
+ return `the model's reply reached maxTokens (${maxTokens}) before it ended: raise the agent's maxTokens`;
131
248
  }
132
249
  if (message.stop_reason === 'refusal') {
133
250
  const category = message.stop_details?.category;
134
- return {
135
- text: 'Declined: the model did not answer.',
136
- error: `the model declined to answer${category ? ` (${category})` : ''}`,
137
- };
251
+ return `the model declined to answer${category ? ` (${category})` : ''}`;
252
+ }
253
+ if (message.stop_reason === 'model_context_window_exceeded') {
254
+ return "the conversation outgrew the model's context window: lower the agent's window or budget";
138
255
  }
139
256
  return undefined;
140
257
  }
@@ -147,71 +264,47 @@ const native = (t, ctx) => ({
147
264
  parse: (args) => args,
148
265
  run: (args, context) => t.run(args, { ctx, callId: callId(context) }),
149
266
  });
267
+ /**
268
+ * The Claude models with structured outputs: of each family, the 4.5 models
269
+ * and later (and Mythos Preview); not Claude 3, Opus 4 and 4.1, or Sonnet 4.
270
+ */
271
+ const STRUCTURED_OUTPUTS = /claude-(?:(?:opus|sonnet|haiku)-4-[5-9](?!\d)|(?:opus|sonnet|haiku|fable|mythos)-(?:[5-9]|[1-9]\d)|mythos-preview)/;
272
+ /** Whether an agent of `options` asks the model for its `output` natively (see `nativeOutput`). */
273
+ const asksNatively = ({ model, output, nativeOutput }) => output !== undefined &&
274
+ (nativeOutput ?? STRUCTURED_OUTPUTS.test(modelIdOf(modelOf(model, CLAUDE_MODEL), 'anthropic')));
275
+ /**
276
+ * `output`'s JSON schema, as the API takes it (the SDK's helper's): what the
277
+ * API does not take (a string's `minLength`, say) goes to a description, and
278
+ * is left to the check of the reply.
279
+ */
280
+ const formatOf = (output) => {
281
+ const { type, schema } = betaZodOutputFormat(output);
282
+ return { type, schema };
283
+ };
150
284
  /** The client of an agent without one of its own, on the context of the turn it answers. */
151
285
  const CLIENT = new ScopeKey('the Anthropic client');
152
- /** {@link prompt}, answering with the agent's text. */
153
- const promptText = (ctx, text, options) => transcribing(ctx, () => transcribe(ctx), () => answerOnce(ctx, text, options));
154
- const answerOnce = async (ctx, text, { model: named, system, tools = [], client, maxTokens = 16_000, effort }) => {
155
- const agent = {
286
+ /** The agent of `options`, for the turn of `ctx`. */
287
+ const agentOf = (ctx, options) => {
288
+ const { model, system, tools = [], client, maxTokens = 16_000, effort, output } = options;
289
+ return {
156
290
  client: client ?? CLIENT.of(ctx, () => new Anthropic()),
157
- model: modelIdOf(modelOf(named, CLAUDE_MODEL), 'anthropic'),
291
+ model: modelIdOf(modelOf(model, CLAUDE_MODEL), 'anthropic'),
158
292
  maxTokens,
159
293
  effort,
160
294
  system,
161
295
  tools: tools.map((t) => (isTool(t) ? native(t, ctx) : t)),
296
+ ...(output !== undefined && asksNatively(options) ? { format: formatOf(output) } : {}),
162
297
  };
163
- const id = nextPromptId(ctx);
164
- const conversation = await Conversation.open(ctx.db);
165
- for (;;) {
166
- const answer = await conversation.answer(id);
167
- if (answer !== undefined)
168
- return storedAnswer(answer);
169
- // Finish an interrupted prompt first (this one's, after a crash), then
170
- // start this one.
171
- let pending = await conversation.pending();
172
- if (pending === undefined) {
173
- await conversation.append(id, [{ role: 'user', content: text }]);
174
- pending = id;
175
- }
176
- const turn = stopSignalOf(ctx);
177
- try {
178
- const running = run(ctx, agent, conversation, pending, turn);
179
- running.catch(() => { });
180
- await (turn ? Promise.race([running, aborted(turn)]) : running);
181
- }
182
- catch (error) {
183
- // The attempt ended: it stops, and the next attempt goes on with the prompt.
184
- if (turn?.reason instanceof AttemptEnded)
185
- throw turn.reason;
186
- // Cancelled: the prompt ends, and the next one starts afresh.
187
- if (turn?.aborted || error instanceof restate.CancelledError) {
188
- await conversation.cancel(pending, CANCELLED);
189
- throw turn?.aborted ? turn.reason : error;
190
- }
191
- // An earlier prompt that ended (cut off, or declined): this one goes on.
192
- if (pending !== id &&
193
- error instanceof restate.TerminalError &&
194
- (await conversation.answer(pending)) !== undefined) {
195
- continue;
196
- }
197
- // Refused for good (a wrong API key): the prompt ends unanswered, and
198
- // fails as terminal. An earlier one's, this one goes on.
199
- const refused = refusalOf(ctx, error);
200
- if (!refused)
201
- throw error;
202
- await conversation.close(pending, UNANSWERED);
203
- if (pending === id)
204
- throw refused;
205
- }
206
- }
207
298
  };
208
299
  /**
209
300
  * Answer `text`, once: a retried attempt resumes the same prompt. Each prompt
210
301
  * of an invocation is a prompt of its own.
211
302
  * With `output`, it answers with the value the agent replies with (see
212
- * output.ts), not its text.
303
+ * output.ts), not its text: a reply that is not one is asked again within
304
+ * its turn, once. A model with structured outputs is asked for it natively
305
+ * (`nativeOutput`), else in the prompt.
213
306
  */
214
- export const prompt = (ctx, text, options = {}) => withOutput(text, options, (t, o) => promptText(ctx, t, o));
307
+ export const prompt = async (ctx, text, options = {}) => withChecked(text, options, (t, o, check, reminder) => answerOnce(ctx, t, items, runOf(ctx, agentOf(ctx, o)), { check, reminder }), asksNatively(options));
215
308
  /**
216
309
  * A chat handler: each message an invocation, the conversation in the
217
310
  * object's database, with `options`, or the options a function of the
@@ -221,49 +314,37 @@ export const prompt = (ctx, text, options = {}) => withOutput(text, options, (t,
221
314
  export const chat = (options = {}) => {
222
315
  if (typeof options === 'object')
223
316
  modelIdOf(modelOf(options.model, CLAUDE_MODEL), 'anthropic');
224
- return chatHandler(async (ctx, message) => prompt(ctx, message, await configured(options, ctx)));
317
+ return chatHandler(async (ctx, message) => prompt(ctx, message, await configured(options, ctx)), { steers: true });
225
318
  };
226
- /** The text of stored content, without its tool calls and results. */
227
- const storedText = (content) => typeof content === 'string' ? content : (content ?? []).flatMap((b) => (b.type === 'text' ? [b.text] : [])).join('');
228
319
  /**
229
- * A handler of the conversation as clients read it: a page at a time, or
230
- * what is new or changed since a cursor, from the log each change writes
231
- * (log.ts). It answers while a message is answered.
320
+ * A view of the conversation as clients read it: a page at a time, or what
321
+ * is new or changed since a cursor; `view: 'summary'` for each turn's
322
+ * message and answer. It answers while a message is answered.
232
323
  */
233
- export const messages = () => messagesHandler();
324
+ export const messages = () => conversationView(items);
234
325
  /**
235
- * The transcript of each session's conversation (`ctx.db`, one per
236
- * attempt), as far as it was read: the conversation only grows, so each
237
- * read adds the messages stored since.
326
+ * How an agent of `options` summarizes the earliest turns, past its budget:
327
+ * with its own client and model (`agent()` gives it; for an object of your
328
+ * own, `sessionObject`'s `summarize`).
238
329
  */
239
- const TRANSCRIPT = new ScopeKey('the transcript');
240
- /** The conversation in the database of `ctx`, as `messages` gives it. */
241
- const transcribe = async (ctx) => {
242
- const { db } = ctx;
243
- const read = TRANSCRIPT.of(ctx, () => ({ seq: 0, transcript: new Transcript() }));
244
- const { transcript } = read;
245
- for (const [seq, m] of await (await Conversation.open(db)).since(read.seq)) {
246
- read.seq = seq;
247
- if (m.role === 'system')
248
- continue;
249
- transcript.say(m.role, storedText(m.content));
250
- if (typeof m.content === 'string')
251
- continue;
252
- for (const block of m.content) {
253
- if (block.type === 'tool_use')
254
- transcript.call(block.id, block.name, block.input);
255
- if (block.type === 'tool_result')
256
- transcript.result(block.tool_use_id, storedText(block.content), block.is_error === true);
257
- }
258
- }
259
- return transcript;
330
+ export const summarizer = (options = {}) => async (ctx, request) => {
331
+ const { client, model, maxTokens } = agentOf(ctx, { ...options, tools: [] });
332
+ const message = await client.beta.messages.create({
333
+ model,
334
+ max_tokens: maxTokens,
335
+ messages: [{ role: 'user', content: request }],
336
+ });
337
+ return textOf(message.content);
260
338
  };
261
339
  /** An agent: a virtual object `name`, one per key, whose `chat` handler is {@link chat}, and `messages` {@link messages}. */
262
- export const agent = ({ name, description, schema, background, ...options }) => sessionObject({
340
+ export const agent = ({ name, description, schema, background, window, budget, summarize, ...options }) => sessionObject({
263
341
  name,
264
342
  description,
265
343
  schema,
266
344
  background,
345
+ window,
346
+ budget,
347
+ summarize: summarize ?? summarizer(options),
267
348
  handlers: { chat: chat(options) },
268
349
  views: { messages: messages() },
269
350
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/claude/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,4EAA4E;AAC5E,2CAA2C;AAC3C,EAAE;AACF,wGAAwG;AACxG,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,uEAAuE;AACvE,EAAE;AACF,4EAA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AAE,EAAE,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAChD,KAAK;QACL,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;KAC/C,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC;AAEJ,6HAA6H;AAC7H,MAAM,CAAC,MAAM,KAAK,GAAG,CAAkE,EACrF,IAAI,EACJ,WAAW,EACX,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,SAAS,EACT,GAAG,OAAO,EACiB,EAAE,EAAE,CAC/B,aAAa,CAAC;IACZ,IAAI;IACJ,WAAW;IACX,MAAM;IACN,UAAU;IACV,MAAM;IACN,MAAM;IACN,SAAS,EAAE,SAAS,IAAI,UAAU,CAAC,OAAO,CAAC;IAC3C,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;IACjC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;CAChC,CAAC,CAAC"}
package/dist/client.d.ts CHANGED
@@ -1,13 +1,22 @@
1
1
  import * as clients from '@restatedev/restate-sdk-clients';
2
2
  import type { VirtualObjectDefinition } from '@restatedev/restate-sdk-core';
3
- import type { ChatMessage, Messages, MessagesRequest, Part, Turn } from './common.ts';
3
+ import type { Answering, ChatMessage, Messages, MessagesRequest, Part } from './common.ts';
4
4
  import type { Status, Stopped, Synced, SyncRequest } from './object.ts';
5
- import type { Notifications, Resolved, Signal, Waiting, Watch } from './signals.ts';
6
- export type { ChatMessage, Messages, MessagesRequest, Notifications, Part, Resolved, Signal, Status, Stopped, Synced, SyncRequest, Turn, Waiting, Watch, };
5
+ import type { Notifications, Resolved, Signal, Steered, Steering, Waiting, Watch } from './signals.ts';
6
+ export type { Answering, ChatMessage, Messages, MessagesRequest, Notifications, Part, Resolved, Signal, Status, Steered, Steering, Stopped, Synced, SyncRequest, Waiting, Watch, };
7
7
  /** The handlers of an agent (`agent()` of any framework), as Restate's client calls them. */
8
8
  export interface Agent {
9
9
  /** Answer `message`. */
10
10
  chat(ctx: unknown, message: string): Promise<string>;
11
+ /**
12
+ * Send `message` while the agent answers another: the turn being answered
13
+ * takes it at its next step (once its model's tool calls have their
14
+ * results), and its answer covers it; else it is answered as a turn of its
15
+ * own, after the messages before it. Either way it is answered once: send
16
+ * it with an idempotency key, made once per message, so that sending it
17
+ * again is the same message.
18
+ */
19
+ steer(ctx: unknown, message: string): Promise<Steered>;
11
20
  /** The conversation, a page at a time, or what is new or changed since a cursor, also while a message is answered. */
12
21
  messages(ctx: unknown, request?: MessagesRequest): Promise<Messages>;
13
22
  /** The conversation since a cursor, the status and the revision; with `revision`, once there is a newer one. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEpF,YAAY,EACV,WAAW,EACX,QAAQ,EACR,eAAe,EACf,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,WAAW,EACX,IAAI,EACJ,OAAO,EACP,KAAK,GACN,CAAC;A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