@restatedev/agents 0.4.0 → 0.6.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/README.md +104 -38
- package/dist/calls.d.ts +20 -1
- package/dist/calls.d.ts.map +1 -1
- package/dist/calls.js +46 -7
- package/dist/calls.js.map +1 -1
- package/dist/claude/index.d.ts +11 -11
- package/dist/claude/index.d.ts.map +1 -1
- package/dist/claude/index.js +9 -6
- package/dist/claude/index.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/common.d.ts +62 -23
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +67 -38
- package/dist/common.js.map +1 -1
- package/dist/{signals.d.ts → companion.d.ts} +106 -43
- package/dist/companion.d.ts.map +1 -0
- package/dist/companion.js +463 -0
- package/dist/companion.js.map +1 -0
- package/dist/conversation.d.ts +115 -5
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +308 -79
- package/dist/conversation.js.map +1 -1
- package/dist/deepseek/index.d.ts +11 -11
- package/dist/deepseek/index.d.ts.map +1 -1
- package/dist/deepseek/index.js +23 -26
- package/dist/deepseek/index.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/langgraph/checkpointer.d.ts +2 -0
- package/dist/langgraph/checkpointer.d.ts.map +1 -1
- package/dist/langgraph/checkpointer.js +1 -1
- package/dist/langgraph/checkpointer.js.map +1 -1
- package/dist/langgraph/graph.d.ts.map +1 -1
- package/dist/langgraph/graph.js +32 -13
- package/dist/langgraph/graph.js.map +1 -1
- package/dist/langgraph/index.d.ts +11 -11
- package/dist/langgraph/index.d.ts.map +1 -1
- package/dist/langgraph/index.js +19 -13
- package/dist/langgraph/index.js.map +1 -1
- package/dist/langgraph/nodes.d.ts +2 -1
- package/dist/langgraph/nodes.d.ts.map +1 -1
- package/dist/langgraph/nodes.js +23 -20
- package/dist/langgraph/nodes.js.map +1 -1
- package/dist/object.d.ts +24 -22
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +16 -11
- package/dist/object.js.map +1 -1
- package/dist/opencode/db.d.ts +81 -0
- package/dist/opencode/db.d.ts.map +1 -0
- package/dist/opencode/db.js +249 -0
- package/dist/opencode/db.js.map +1 -0
- package/dist/opencode/index.d.ts +184 -0
- package/dist/opencode/index.d.ts.map +1 -0
- package/dist/opencode/index.js +982 -0
- package/dist/opencode/index.js.map +1 -0
- package/dist/pi/index.d.ts +11 -11
- package/dist/pi/index.d.ts.map +1 -1
- package/dist/pi/index.js +16 -17
- package/dist/pi/index.js.map +1 -1
- package/dist/steering.d.ts +2 -1
- package/dist/steering.d.ts.map +1 -1
- package/dist/steering.js +2 -2
- package/dist/steering.js.map +1 -1
- package/dist/tools.d.ts +21 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +54 -14
- package/dist/tools.js.map +1 -1
- package/dist/webhook.js +1 -1
- package/dist/webhook.js.map +1 -1
- package/package.json +37 -4
- package/src/calls.ts +52 -11
- package/src/claude/README.md +4 -2
- package/src/claude/index.ts +9 -7
- package/src/client.ts +1 -1
- package/src/common.ts +99 -40
- package/src/companion.ts +674 -0
- package/src/conversation.ts +377 -105
- package/src/deepseek/README.md +7 -1
- package/src/deepseek/index.ts +22 -24
- package/src/index.ts +10 -4
- package/src/langgraph/README.md +8 -5
- package/src/langgraph/checkpointer.ts +1 -1
- package/src/langgraph/graph.ts +30 -16
- package/src/langgraph/index.ts +24 -17
- package/src/langgraph/nodes.ts +24 -20
- package/src/object.ts +45 -40
- package/src/opencode/README.md +234 -0
- package/src/opencode/db.ts +387 -0
- package/src/opencode/index.ts +1243 -0
- package/src/pi/README.md +6 -1
- package/src/pi/index.ts +16 -15
- package/src/steering.ts +8 -7
- package/src/tools.ts +60 -18
- package/src/webhook.ts +1 -1
- package/dist/signals.d.ts.map +0 -1
- package/dist/signals.js +0 -383
- package/dist/signals.js.map +0 -1
- package/src/signals.ts +0 -590
package/dist/object.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as restate from '@restatedev/sessions';
|
|
2
|
-
import { type Answering, type Messages, type MessagesRequest, type Summarize, type Window } from './common.ts';
|
|
2
|
+
import { type AgentContext, type AgentViewContext, type Answering, type Messages, type MessagesRequest, type Summarize, type Window } from './common.ts';
|
|
3
3
|
import { type Items } from './conversation.ts';
|
|
4
|
-
import { type Notifications, type Resolved, type Signal, type Steered, type Steering, type Waiting, type Watch } from './
|
|
4
|
+
import { type Notifications, type Resolved, type Signal, type Steered, type Steering, type Waiting, type Watch } from './companion.ts';
|
|
5
5
|
/** What an object is doing: the message it answers, if any, and what its tools wait for. */
|
|
6
6
|
export interface Status {
|
|
7
7
|
/** The message being answered (by a `chat` handler), or null. */
|
|
@@ -22,17 +22,19 @@ export interface Stopped {
|
|
|
22
22
|
* it answers, and `notifications` and `watch`, the revision of its
|
|
23
23
|
* conversation, and a wait for a newer one (an agent's
|
|
24
24
|
* has `clear` and `sync` too: {@link FOLLOWED}). Each asks the object's
|
|
25
|
-
*
|
|
26
|
-
* object's handler works.
|
|
25
|
+
* companion (its own `<name>.prebuilt.restate`, at the same key), which
|
|
26
|
+
* knows what the object does: they run while the object's handler works.
|
|
27
|
+
* They are the only way a client reaches the companion, whose handlers
|
|
28
|
+
* Restate's ingress refuses.
|
|
27
29
|
*/
|
|
28
30
|
declare const BUILT_IN: {
|
|
29
|
-
signal: (ctx:
|
|
30
|
-
pending: (ctx:
|
|
31
|
-
status: (ctx:
|
|
31
|
+
signal: (ctx: AgentViewContext, signal: Signal) => Promise<Resolved>;
|
|
32
|
+
pending: (ctx: AgentViewContext) => Promise<Waiting[]>;
|
|
33
|
+
status: (ctx: AgentViewContext) => Promise<Status>;
|
|
32
34
|
/** Cancel the invocation of the message being answered (`status`'s), as Restate's admin API cancels one. */
|
|
33
|
-
stop: (ctx:
|
|
35
|
+
stop: (ctx: AgentViewContext) => Promise<Stopped>;
|
|
34
36
|
/** The revision of the conversation: each change of what `messages` and `status` give increases it. */
|
|
35
|
-
notifications: (ctx:
|
|
37
|
+
notifications: (ctx: AgentViewContext) => Promise<Notifications>;
|
|
36
38
|
/**
|
|
37
39
|
* The revision, once there is one newer than `revision`, or at the timeout (50 s by
|
|
38
40
|
* default, at most 60 s), whichever comes first: a client then reads what
|
|
@@ -43,14 +45,14 @@ declare const BUILT_IN: {
|
|
|
43
45
|
inactivityTimeout: {
|
|
44
46
|
minutes: number;
|
|
45
47
|
};
|
|
46
|
-
handler: (ctx:
|
|
48
|
+
handler: (ctx: AgentViewContext, watch: Watch) => Promise<Notifications>;
|
|
47
49
|
};
|
|
48
50
|
};
|
|
49
51
|
/** The views of every agent: {@link followed}'s. */
|
|
50
52
|
declare const FOLLOWED: {
|
|
51
53
|
/**
|
|
52
54
|
* Forget the conversation: stop the message being answered (as `stop`),
|
|
53
|
-
* then empty the key's database, and what its
|
|
55
|
+
* then empty the key's database, and what its companion holds (waits and
|
|
54
56
|
* kept signals). The conversation's ids and cursors go on (see
|
|
55
57
|
* conversation.ts), so a follower reads on, and drops the messages before `first`.
|
|
56
58
|
* A message sent before it is answered first, then forgotten too; one sent
|
|
@@ -60,7 +62,7 @@ declare const FOLLOWED: {
|
|
|
60
62
|
inactivityTimeout: {
|
|
61
63
|
minutes: number;
|
|
62
64
|
};
|
|
63
|
-
handler: (ctx:
|
|
65
|
+
handler: (ctx: AgentViewContext) => Promise<Stopped>;
|
|
64
66
|
};
|
|
65
67
|
/**
|
|
66
68
|
* Send a message to the agent while it answers another: the turn being
|
|
@@ -75,26 +77,26 @@ declare const FOLLOWED: {
|
|
|
75
77
|
steer: {
|
|
76
78
|
input: restate.Serde<string>;
|
|
77
79
|
accept: string;
|
|
78
|
-
handler: (ctx:
|
|
80
|
+
handler: (ctx: AgentViewContext, text: string) => Promise<Steered>;
|
|
79
81
|
};
|
|
80
82
|
sync: {
|
|
81
83
|
inactivityTimeout: {
|
|
82
84
|
minutes: number;
|
|
83
85
|
};
|
|
84
|
-
handler: (ctx:
|
|
86
|
+
handler: (ctx: AgentViewContext, { cursor, revision, timeoutSeconds, limit, view }?: SyncRequest) => Promise<Synced>;
|
|
85
87
|
};
|
|
86
88
|
};
|
|
87
89
|
/**
|
|
88
90
|
* The agents' handlers that only their own views call (Restate's ingress
|
|
89
91
|
* refuses them), and their types leave out: `erase`, `clear`'s work, once
|
|
90
|
-
* the handlers before it are done. It empties the key's database and its
|
|
91
|
-
*
|
|
92
|
+
* the handlers before it are done. It empties the key's database and what its
|
|
93
|
+
* companion holds, and the conversation's ids and cursors go on where they got to
|
|
92
94
|
* (conversation.ts).
|
|
93
95
|
*/
|
|
94
96
|
declare const internal: (items: Items<unknown> | undefined) => {
|
|
95
97
|
erase: {
|
|
96
98
|
ingressPrivate: boolean;
|
|
97
|
-
handler: (ctx:
|
|
99
|
+
handler: (ctx: AgentContext) => Promise<void>;
|
|
98
100
|
};
|
|
99
101
|
/**
|
|
100
102
|
* Close the latest turn, unanswered, if invocation `invocationId` ran it
|
|
@@ -105,12 +107,12 @@ declare const internal: (items: Items<unknown> | undefined) => {
|
|
|
105
107
|
*/
|
|
106
108
|
settle: {
|
|
107
109
|
ingressPrivate: boolean;
|
|
108
|
-
handler: (ctx:
|
|
110
|
+
handler: (ctx: AgentContext, invocationId: string) => Promise<boolean>;
|
|
109
111
|
};
|
|
110
112
|
/** Summarize the earliest turns, past the agent's budget. Whether it did. */
|
|
111
113
|
compact: {
|
|
112
114
|
ingressPrivate: boolean;
|
|
113
|
-
handler: (ctx:
|
|
115
|
+
handler: (ctx: AgentContext) => Promise<boolean>;
|
|
114
116
|
};
|
|
115
117
|
};
|
|
116
118
|
/**
|
|
@@ -138,8 +140,8 @@ export interface Definition<P extends string> {
|
|
|
138
140
|
description?: string;
|
|
139
141
|
schema?: readonly restate.Step[];
|
|
140
142
|
/**
|
|
141
|
-
* Whether it works unwatched, such as a subagent: its turn
|
|
142
|
-
*
|
|
143
|
+
* Whether it works unwatched, such as a subagent: its turn publishes to its
|
|
144
|
+
* companion only at its end, not at each step, so a client that follows it
|
|
143
145
|
* sees each turn once it ended. `messages` has every turn as before.
|
|
144
146
|
*/
|
|
145
147
|
background?: boolean;
|
|
@@ -201,7 +203,7 @@ type With<H, V> = Functions<typeof BUILT_IN> & (V extends {
|
|
|
201
203
|
* `options` and `metadata` add to (or replace) the ones set here, such as
|
|
202
204
|
* `options: { retryPolicy: ... }`.
|
|
203
205
|
*/
|
|
204
|
-
export declare const sessionObject: <P extends string, H extends Record<string, restate.Entry<
|
|
206
|
+
export declare const sessionObject: <P extends string, H extends Record<string, restate.Entry<AgentContext>>, V extends Record<string, restate.Entry<AgentViewContext>>>(definition: Definition<P> & {
|
|
205
207
|
handlers?: H & Reserved;
|
|
206
208
|
views?: V & Reserved;
|
|
207
209
|
metadata?: Record<string, string>;
|
package/dist/object.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,KAAK,SAAS,EAUd,KAAK,QAAQ,EACb,KAAK,eAAe,EAGpB,KAAK,SAAS,EAEd,KAAK,MAAM,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAW,KAAK,KAAK,EAAmD,MAAM,mBAAmB,CAAC;AACzG,OAAO,
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAUd,KAAK,QAAQ,EACb,KAAK,eAAe,EAGpB,KAAK,SAAS,EAEd,KAAK,MAAM,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAW,KAAK,KAAK,EAAmD,MAA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package/dist/object.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as restate from '@restatedev/sessions';
|
|
|
3
3
|
import { reset } from '@restatedev/sessions/internal';
|
|
4
4
|
import { BUDGET, chatOf, chatTurn, checkWindow, isAgent, ITEMS, messageSerde, publish, refusalOf, WINDOW, } from './common.js';
|
|
5
5
|
import { compact, nextStart, restart, SCHEMA, settle, steerStored } from './conversation.js';
|
|
6
|
-
import {
|
|
6
|
+
import { companionAt, withCompanion, } from './companion.js';
|
|
7
7
|
/**
|
|
8
8
|
* The options of every object here, beside a session object's: retries for
|
|
9
9
|
* weeks, since each attempt resumes from the database: soon after a crash,
|
|
@@ -14,11 +14,12 @@ const OPTIONS = {
|
|
|
14
14
|
retryPolicy: { initialInterval: 50, exponentiationFactor: 2, maxInterval: 10_000, maxAttempts: 100_000 },
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* A call of the companion
|
|
18
|
-
* request and `step`: a restarted view joins
|
|
19
|
-
* key: asked again, it answers again, and
|
|
17
|
+
* A call of the companion of the object of `ctx` (its own, at its key); with
|
|
18
|
+
* `step`, a change, keyed by the request and `step`: a restarted view joins
|
|
19
|
+
* the same call. A read has no key: asked again, it answers again, and
|
|
20
|
+
* Restate keeps nothing of it.
|
|
20
21
|
*/
|
|
21
|
-
const companion = (ctx, step) => ctx.rpc(
|
|
22
|
+
const companion = (ctx, step) => ctx.rpc(companionAt(ctx), ctx.key, step === undefined ? {} : { idempotencyKey: `${ctx.request.id}:${step}` });
|
|
22
23
|
/**
|
|
23
24
|
* Cancel the invocation of the message being answered, if any, and say
|
|
24
25
|
* which. The companion's `status` says which, with a key of the request and
|
|
@@ -46,8 +47,10 @@ const WAITS = { inactivityTimeout: { minutes: 5 } };
|
|
|
46
47
|
* it answers, and `notifications` and `watch`, the revision of its
|
|
47
48
|
* conversation, and a wait for a newer one (an agent's
|
|
48
49
|
* has `clear` and `sync` too: {@link FOLLOWED}). Each asks the object's
|
|
49
|
-
*
|
|
50
|
-
* object's handler works.
|
|
50
|
+
* companion (its own `<name>.prebuilt.restate`, at the same key), which
|
|
51
|
+
* knows what the object does: they run while the object's handler works.
|
|
52
|
+
* They are the only way a client reaches the companion, whose handlers
|
|
53
|
+
* Restate's ingress refuses.
|
|
51
54
|
*/
|
|
52
55
|
const BUILT_IN = {
|
|
53
56
|
signal: async (ctx, signal) => companion(ctx, 'signal').resolve(signal),
|
|
@@ -82,7 +85,7 @@ const BUILT_IN = {
|
|
|
82
85
|
const followed = (steerable) => ({
|
|
83
86
|
/**
|
|
84
87
|
* Forget the conversation: stop the message being answered (as `stop`),
|
|
85
|
-
* then empty the key's database, and what its
|
|
88
|
+
* then empty the key's database, and what its companion holds (waits and
|
|
86
89
|
* kept signals). The conversation's ids and cursors go on (see
|
|
87
90
|
* conversation.ts), so a follower reads on, and drops the messages before `first`.
|
|
88
91
|
* A message sent before it is answered first, then forgotten too; one sent
|
|
@@ -151,8 +154,8 @@ const FOLLOWED = followed(false);
|
|
|
151
154
|
/**
|
|
152
155
|
* The agents' handlers that only their own views call (Restate's ingress
|
|
153
156
|
* refuses them), and their types leave out: `erase`, `clear`'s work, once
|
|
154
|
-
* the handlers before it are done. It empties the key's database and its
|
|
155
|
-
*
|
|
157
|
+
* the handlers before it are done. It empties the key's database and what its
|
|
158
|
+
* companion holds, and the conversation's ids and cursors go on where they got to
|
|
156
159
|
* (conversation.ts).
|
|
157
160
|
*/
|
|
158
161
|
const internal = (items) => ({
|
|
@@ -162,11 +165,13 @@ const internal = (items) => ({
|
|
|
162
165
|
// Read first, which also makes the reset apply the conversation's schema again.
|
|
163
166
|
await SCHEMA.ensure(ctx.db);
|
|
164
167
|
const start = await nextStart(ctx.db);
|
|
168
|
+
// A framework's database of its own first: the conversation's rows say what is left.
|
|
169
|
+
await items?.erase?.(ctx);
|
|
165
170
|
await ctx.db.transaction(async (tx) => {
|
|
166
171
|
await reset(tx);
|
|
167
172
|
await restart(tx, start);
|
|
168
173
|
});
|
|
169
|
-
await ctx.rpc(
|
|
174
|
+
await ctx.rpc(companionAt(ctx), ctx.key, { idempotencyKey: `${ctx.request.id}:reset` }).reset();
|
|
170
175
|
},
|
|
171
176
|
},
|
|
172
177
|
/**
|
package/dist/object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAIL,MAAM,EAEN,MAAM,EAEN,QAAQ,EACR,WAAW,EACX,OAAO,EACP,KAAK,EACL,YAAY,EAGZ,OAAO,EACP,SAAS,EAET,MAAM,GAEP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAc,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzG,OAAO,EACL,WAAW,EAOX,aAAa,GAGd,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,OAAO,GAAG;IACd,WAAW,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE;CACzE,CAAC;AAiBlC;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,GAAqB,EAAE,IAAa,EAAE,EAAE,CACzD,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAA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K,CAAC;IACzF,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,KAAK,EAAE,GAAiB,EAAE,KAAc,EAAE,EAAE;YACnD,IAAI,CAAC;gBACH,OAAO,MAAM,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC;YACvC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Effect, Layer } from 'effect';
|
|
2
|
+
import { SqlClient } from 'effect/sql';
|
|
3
|
+
import { OpenCode } from '@opencode/sdk/effect';
|
|
4
|
+
import type { Plugin } from '@opencode/plugin';
|
|
5
|
+
import type { Database } from '@restatedev/sessions';
|
|
6
|
+
/** Closed: every later statement fails. */
|
|
7
|
+
export interface Fence {
|
|
8
|
+
closed: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* An Effect SqlClient over `db`, with its statements refused once `fence`
|
|
12
|
+
* closes. `committed` runs after each write is committed: a transaction that
|
|
13
|
+
* wrote, or a statement that writes outside one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function sqlClient(db: Database, fence: Fence, committed?: () => void): Layer.Layer<SqlClient.SqlClient>;
|
|
16
|
+
/**
|
|
17
|
+
* What a boot does with the turns a previous process left claimed (OpenCode's
|
|
18
|
+
* execution claims), before any prompt of its own:
|
|
19
|
+
*
|
|
20
|
+
* - `resume`: OpenCode's own restart, however often the turn was resumed
|
|
21
|
+
* before (Restate's retry policy decides): a synthetic "Continue" message,
|
|
22
|
+
* its running tool calls failed, and a new step. A crashed attempt's turn
|
|
23
|
+
* goes on.
|
|
24
|
+
* - `close`: each is closed without asking the model: an idle marker
|
|
25
|
+
* (`Execution.Failed`) and the claim released. A killed invocation's turn
|
|
26
|
+
* is over. How, `closer` says.
|
|
27
|
+
* - `none`: nothing; the claims stay. A reader beside a running turn.
|
|
28
|
+
*/
|
|
29
|
+
export type Restart = 'resume' | 'close' | 'none';
|
|
30
|
+
/**
|
|
31
|
+
* How `restart: 'close'` closes a claimed turn:
|
|
32
|
+
*
|
|
33
|
+
* - `own`: a `SessionRestart` of ours. Each streaming or running tool call
|
|
34
|
+
* fails with `cutOff(toolCallId, name)` as its result, then the turn with
|
|
35
|
+
* `ended`, the claim released in the same transaction.
|
|
36
|
+
* - `budget`: OpenCode's own restart with no resumes left
|
|
37
|
+
* (`maxAttempts: 0`): the idle marker with OpenCode's text, the claim
|
|
38
|
+
* released; the running tool calls stay running until the next drain fails
|
|
39
|
+
* them ("Tool execution interrupted").
|
|
40
|
+
*/
|
|
41
|
+
export type Closer = 'own' | 'budget';
|
|
42
|
+
export interface OpenOptions {
|
|
43
|
+
/** OpenCode plugins: models, tools, agents. */
|
|
44
|
+
plugins?: Plugin.Plugin[];
|
|
45
|
+
/** OpenCode's config (opencode.json), inline. */
|
|
46
|
+
config?: Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* OpenCode's own filesystem, search and shell, on the local machine, for
|
|
49
|
+
* its built-in tools (read, write, edit, bash, glob, grep...) in a
|
|
50
|
+
* session's directory. Without it, the workerd profile has none.
|
|
51
|
+
*/
|
|
52
|
+
local?: boolean;
|
|
53
|
+
/** What this boot does with the turns left claimed (default `resume`). */
|
|
54
|
+
restart?: Restart;
|
|
55
|
+
/** How `close` closes them (default `budget`: the spike found ours buys little over it). */
|
|
56
|
+
closer?: Closer;
|
|
57
|
+
/** The result of a tool call that a closed turn left running (`own` only). */
|
|
58
|
+
cutOff?: (toolCallId: string, name: string) => string;
|
|
59
|
+
/** The error a closed turn ends with (`own` only). */
|
|
60
|
+
ended?: string;
|
|
61
|
+
/** Runs after each of OpenCode's writes is committed: for a copy of what it wrote. */
|
|
62
|
+
committed?: () => void;
|
|
63
|
+
}
|
|
64
|
+
/** A booted OpenCode: `call` runs one of `client`'s calls (which return Effects); `close` shuts it down. */
|
|
65
|
+
export interface Host {
|
|
66
|
+
client: OpenCode.Interface;
|
|
67
|
+
call<A, E, R>(effect: Effect.Effect<A, E, R>): Promise<A>;
|
|
68
|
+
/**
|
|
69
|
+
* Settles once the boot's sweep of claimed turns is done: closed, for
|
|
70
|
+
* `close`; their resumes started, for `resume`. The host forks the sweep, so
|
|
71
|
+
* a prompt submitted before it settles may join a claimed turn.
|
|
72
|
+
*/
|
|
73
|
+
swept: Promise<void>;
|
|
74
|
+
close(): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Boot OpenCode with its database in `db`; the boot sweeps the turns left
|
|
78
|
+
* claimed as `restart` says. Close the host when done.
|
|
79
|
+
*/
|
|
80
|
+
export declare function openOpenCode(db: Database, fence: Fence, { plugins, config, local, restart, closer, committed, cutOff, ended, }: OpenOptions): Promise<Host>;
|
|
81
|
+
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/opencode/db.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAqB,MAAM,EAAQ,KAAK,EAAiB,MAAM,QAAQ,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAclD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAkB,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAE/E,2CAA2C;AAC3C,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB;AAqDD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,KAAK,EACZ,SAAS,GAAE,MAAM,IAAe,GAC/B,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAyElC;AAED;;;;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,EACT,MAAsB,EACtB,KAAa,GACd,EAAE,WAAW,GACb,OAAO,CAAC,IAAI,CAAC,CAqCf"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// OpenCode on the object's database: `openOpenCode(db, fence, options)` boots
|
|
2
|
+
// OpenCode 2.2's embedded host (@opencode/sdk) with its database in a SQL
|
|
3
|
+
// session, `ctx.db`.
|
|
4
|
+
//
|
|
5
|
+
// The host is OpenCode's workerd profile, the one it boots in a Cloudflare
|
|
6
|
+
// Durable Object: no local filesystem, shell, terminal, npm or version
|
|
7
|
+
// control, config given inline, plugins given in code. Only its database
|
|
8
|
+
// differs. The workerd profile reads a Durable Object's SQLite, whose `exec`
|
|
9
|
+
// is synchronous; here OpenCode gets an Effect SqlClient instead, which is
|
|
10
|
+
// asynchronous, through `Database.configuredClient` (OpenCode's), the seam
|
|
11
|
+
// OpenCode keeps for an injected client. Each transaction is an SQL
|
|
12
|
+
// transaction, and the session runs statements one at a time, as OpenCode's
|
|
13
|
+
// own clients do.
|
|
14
|
+
//
|
|
15
|
+
// `fence.closed` refuses every statement from then on: an attempt that is
|
|
16
|
+
// giving up stores nothing more, as Restate fences an attempt that a newer
|
|
17
|
+
// one replaced.
|
|
18
|
+
//
|
|
19
|
+
// At boot, OpenCode sweeps the turns a previous process left claimed
|
|
20
|
+
// (`SessionRestart`): `restart` says what this boot does with them (see
|
|
21
|
+
// {@link Restart}), and `Host.swept` settles once the sweep is done.
|
|
22
|
+
//
|
|
23
|
+
// Step 0 of docs/opencode.md (the spike) found its seams; `./opencode/db` exports it.
|
|
24
|
+
import { Context, Deferred, Effect, Exit, Layer, Option, Scope } from 'effect';
|
|
25
|
+
import { Reactivity } from 'effect/reactivity';
|
|
26
|
+
import { SqlClient, Statement } from 'effect/sql';
|
|
27
|
+
import { SqlError, UnknownError } from 'effect/sql/SqlError';
|
|
28
|
+
import { Bus } from '@opencode/core/bus';
|
|
29
|
+
import { Database as OpenCodeDatabase } from '@opencode/core/database/database';
|
|
30
|
+
import { fromPromise } from '@opencode/core/plugin/promise';
|
|
31
|
+
import { SessionEvent } from '@opencode/core/session/event';
|
|
32
|
+
import { SessionExecution } from '@opencode/core/session/execution';
|
|
33
|
+
import { SessionRestart } from '@opencode/core/session/execution/restart';
|
|
34
|
+
import { SessionStore } from '@opencode/core/session/store';
|
|
35
|
+
import { ConfigPluginSource } from '@opencode/core/config/plugin/source';
|
|
36
|
+
import { Pty } from '@opencode/core/pty';
|
|
37
|
+
import { Snapshot } from '@opencode/core/snapshot';
|
|
38
|
+
import { ServerWorkerd } from '@opencode/server/workerd';
|
|
39
|
+
import { OpenCode } from '@opencode/sdk/effect';
|
|
40
|
+
const error = (operation, cause) => new SqlError({
|
|
41
|
+
reason: new UnknownError({
|
|
42
|
+
cause,
|
|
43
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
44
|
+
operation,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
/** The connection inside a transaction, for statements of that transaction. */
|
|
48
|
+
const InTransaction = Context.Service('@restatedev/agents/OpenCodeTransaction');
|
|
49
|
+
/** A statement that writes. */
|
|
50
|
+
const WRITE = /^\s*(INSERT|UPDATE|DELETE|REPLACE)\b/i;
|
|
51
|
+
/**
|
|
52
|
+
* A connection whose statements go to `target`: the session, which runs one
|
|
53
|
+
* call at a time and holds them while a transaction runs, or that
|
|
54
|
+
* transaction's database. Each is refused once `fence` closes; `wrote` is
|
|
55
|
+
* told of each statement that writes.
|
|
56
|
+
*/
|
|
57
|
+
function connection(target, fence, wrote = () => { }) {
|
|
58
|
+
// Effect binds what the compiler made of OpenCode's values: SQL values.
|
|
59
|
+
const exec = (read, sql, params) => Effect.tryPromise({
|
|
60
|
+
try: async () => {
|
|
61
|
+
if (fence.closed)
|
|
62
|
+
throw new Error('the attempt is over');
|
|
63
|
+
const result = await read(sql, params);
|
|
64
|
+
if (WRITE.test(sql))
|
|
65
|
+
wrote();
|
|
66
|
+
return result;
|
|
67
|
+
},
|
|
68
|
+
catch: (cause) => error('execute', cause),
|
|
69
|
+
});
|
|
70
|
+
const run = (sql, params = []) => exec((s, p) => target.query(s, p), sql, params);
|
|
71
|
+
const runValues = (sql, params = []) => exec((s, p) => target.values(s, p), sql, params);
|
|
72
|
+
const transformed = (sql, params, transformRows) => transformRows ? Effect.map(run(sql, params), transformRows) : run(sql, params);
|
|
73
|
+
return {
|
|
74
|
+
execute: transformed,
|
|
75
|
+
executeRaw: (sql, params) => run(sql, params),
|
|
76
|
+
executeValues: (sql, params) => runValues(sql, params),
|
|
77
|
+
executeValuesUnprepared: (sql, params) => runValues(sql, params),
|
|
78
|
+
executeUnprepared: transformed,
|
|
79
|
+
executeStream: () => {
|
|
80
|
+
throw new Error('executeStream is not supported');
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* An Effect SqlClient over `db`, with its statements refused once `fence`
|
|
86
|
+
* closes. `committed` runs after each write is committed: a transaction that
|
|
87
|
+
* wrote, or a statement that writes outside one.
|
|
88
|
+
*/
|
|
89
|
+
export function sqlClient(db, fence, committed = () => { }) {
|
|
90
|
+
// `effect` as one SQL transaction: it commits when `effect` succeeds
|
|
91
|
+
// and rolls back when it fails. Its statements go to the transaction's
|
|
92
|
+
// database.
|
|
93
|
+
const withTransaction = (effect) => Effect.withFiber((fiber) => {
|
|
94
|
+
if (Option.isSome(Context.getOption(fiber.context, InTransaction))) {
|
|
95
|
+
return Effect.fail(error('transaction', new Error('nested transactions are not supported')));
|
|
96
|
+
}
|
|
97
|
+
return Effect.callback((resume) => {
|
|
98
|
+
const rollback = new Error('rollback');
|
|
99
|
+
let interrupted = false;
|
|
100
|
+
let resumed = false;
|
|
101
|
+
let wrote = false;
|
|
102
|
+
// Settles when the transaction has committed, or rejects: with
|
|
103
|
+
// `rollback` once `effect` failed, or with the error of BEGIN or COMMIT.
|
|
104
|
+
const ended = db.transaction((tx) => new Promise((resolve, reject) => {
|
|
105
|
+
if (interrupted)
|
|
106
|
+
return reject(rollback);
|
|
107
|
+
const inner = Effect.provideContext(effect, Context.add(fiber.context, InTransaction, [connection(tx, fence, () => (wrote = true)), 0]));
|
|
108
|
+
resumed = true;
|
|
109
|
+
resume(
|
|
110
|
+
// A finalizer, so that the body settles however `effect`
|
|
111
|
+
// ends, an interruption included: otherwise the transaction
|
|
112
|
+
// would hold the session for good.
|
|
113
|
+
Effect.onExit(inner, (exit) => {
|
|
114
|
+
if (Exit.isSuccess(exit)) {
|
|
115
|
+
resolve();
|
|
116
|
+
return Effect.void;
|
|
117
|
+
}
|
|
118
|
+
reject(rollback);
|
|
119
|
+
return Effect.promise(() => settled);
|
|
120
|
+
}).pipe(
|
|
121
|
+
// The commit is part of the transaction: if it fails, so
|
|
122
|
+
// does the transaction.
|
|
123
|
+
Effect.flatMap((value) => Effect.as(Effect.tryPromise({ try: () => ended, catch: (e) => error('commit', e) }), value))));
|
|
124
|
+
}));
|
|
125
|
+
ended.then(() => (wrote ? committed() : undefined), () => undefined);
|
|
126
|
+
const settled = ended.catch((cause) => {
|
|
127
|
+
// BEGIN failed: `effect` never ran.
|
|
128
|
+
if (!resumed && cause !== rollback)
|
|
129
|
+
resume(Effect.fail(error('transaction', cause)));
|
|
130
|
+
});
|
|
131
|
+
return Effect.suspend(() => {
|
|
132
|
+
interrupted = true;
|
|
133
|
+
return Effect.promise(() => settled);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
const make = Effect.gen(function* () {
|
|
138
|
+
const client = yield* SqlClient.make({
|
|
139
|
+
// Outside a transaction, a statement commits as it runs.
|
|
140
|
+
acquirer: Effect.succeed(connection(db, fence, committed)),
|
|
141
|
+
compiler: Statement.makeCompilerSqlite(),
|
|
142
|
+
driver: 'sqlite-restate',
|
|
143
|
+
spanAttributes: [['db.system.name', 'sqlite']],
|
|
144
|
+
transactionService: InTransaction,
|
|
145
|
+
});
|
|
146
|
+
return Object.assign(client, { withTransaction, transactionStatements: false });
|
|
147
|
+
});
|
|
148
|
+
return Layer.effect(SqlClient.SqlClient, make).pipe(Layer.provide(Reactivity.layer));
|
|
149
|
+
}
|
|
150
|
+
/** The result `own` gives a running tool call of a closed turn, by default. */
|
|
151
|
+
const CUT_OFF = 'The turn ended before this call returned: it may or may not have happened.';
|
|
152
|
+
/** The error `own` closes a turn with, by default. */
|
|
153
|
+
const ENDED = 'Ended: the turn was killed before it finished.';
|
|
154
|
+
/**
|
|
155
|
+
* A `SessionRestart` that closes each claimed top-level session this process
|
|
156
|
+
* does not run: OpenCode's budget's events (`Execution.Failed`, the release
|
|
157
|
+
* as its commit), and before them a `Tool.Failed` of our result for each
|
|
158
|
+
* streaming or running tool part. No synthetic message, no drain, no model.
|
|
159
|
+
*/
|
|
160
|
+
const closing = (cutOff, ended) => Layer.effect(SessionRestart.Service, Effect.gen(function* () {
|
|
161
|
+
const store = yield* SessionStore.Service;
|
|
162
|
+
const execution = yield* SessionExecution.Service;
|
|
163
|
+
const bus = yield* Bus.Service;
|
|
164
|
+
const close = Effect.fnUntraced(function* (sessionID) {
|
|
165
|
+
for (const message of yield* Effect.orDie(store.context(sessionID))) {
|
|
166
|
+
if (message.type !== 'assistant')
|
|
167
|
+
continue;
|
|
168
|
+
for (const part of message.content) {
|
|
169
|
+
if (part.type !== 'tool')
|
|
170
|
+
continue;
|
|
171
|
+
if (part.state.status !== 'streaming' && part.state.status !== 'running')
|
|
172
|
+
continue;
|
|
173
|
+
yield* bus.publish(SessionEvent.Tool.Failed, {
|
|
174
|
+
sessionID,
|
|
175
|
+
assistantMessageID: message.id,
|
|
176
|
+
id: part.id,
|
|
177
|
+
error: { type: 'aborted', message: cutOff(part.id, part.name) },
|
|
178
|
+
executed: part.executed === true,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
yield* bus.publish(SessionEvent.Execution.Failed, { sessionID, error: { type: 'aborted', message: ended } }, { commit: () => store.release(sessionID) });
|
|
183
|
+
});
|
|
184
|
+
return SessionRestart.Service.of({
|
|
185
|
+
resumeSuspendedSessions: Effect.gen(function* () {
|
|
186
|
+
const active = yield* execution.active;
|
|
187
|
+
// Child sessions' claims: v1 has no background subagents to recover.
|
|
188
|
+
yield* store.releaseChildClaims([]);
|
|
189
|
+
const claimed = (yield* store.listSuspended()).filter((id) => !active.has(id));
|
|
190
|
+
yield* Effect.forEach(claimed, close, { discard: true });
|
|
191
|
+
}),
|
|
192
|
+
});
|
|
193
|
+
}));
|
|
194
|
+
/** The sweep's service for `restart` and `closer`. */
|
|
195
|
+
const restarts = (restart, closer, cutOff, ended) => {
|
|
196
|
+
if (restart === 'none')
|
|
197
|
+
return Layer.succeed(SessionRestart.Service, { resumeSuspendedSessions: Effect.void });
|
|
198
|
+
if (restart === 'resume')
|
|
199
|
+
return SessionRestart.layer({ maxAttempts: Infinity });
|
|
200
|
+
return closer === 'budget' ? SessionRestart.layer({ maxAttempts: 0 }) : closing(cutOff, ended);
|
|
201
|
+
};
|
|
202
|
+
/** `service`, whose sweep completes `done` as it ends, however it ends. */
|
|
203
|
+
const observed = (layer, done) => Layer.effect(SessionRestart.Service, Effect.map(SessionRestart.Service, (inner) => SessionRestart.Service.of({
|
|
204
|
+
resumeSuspendedSessions: inner.resumeSuspendedSessions.pipe(Effect.onExit((exit) => Effect.asVoid(Deferred.done(done, Exit.asVoid(exit))))),
|
|
205
|
+
}))).pipe(Layer.provide(layer));
|
|
206
|
+
/** What a replacement replaces: `LayerNode`'s own record of it (its source node). */
|
|
207
|
+
const sourceOf = (replacement) => {
|
|
208
|
+
const key = Object.getOwnPropertySymbols(replacement).find((s) => s.description === 'LayerNode.Replacement');
|
|
209
|
+
return key && replacement[key]?.source;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Boot OpenCode with its database in `db`; the boot sweeps the turns left
|
|
213
|
+
* claimed as `restart` says. Close the host when done.
|
|
214
|
+
*/
|
|
215
|
+
export async function openOpenCode(db, fence, { plugins = [], config = {}, local = false, restart = 'resume', closer = 'budget', committed, cutOff = () => CUT_OFF, ended = ENDED, }) {
|
|
216
|
+
// The workerd profile, but for its database, which comes first. (The
|
|
217
|
+
// Promise API's OpenCode.create takes no replacements; the Effect API's does.)
|
|
218
|
+
const profile = { storage: undefined, models: { fetch: false } };
|
|
219
|
+
// Taken by the node each replaces, not by position (2.1 added Npm's). Local
|
|
220
|
+
// keeps the stubs of snapshots, the pty and plugin discovery only.
|
|
221
|
+
const kept = local ? new Set([Snapshot.node, Pty.node, ConfigPluginSource.node]) : undefined;
|
|
222
|
+
const rest = ServerWorkerd.replacements(profile).filter((r) => {
|
|
223
|
+
const source = sourceOf(r);
|
|
224
|
+
if (source === undefined)
|
|
225
|
+
throw new Error('OpenCode: a workerd replacement of unknown node');
|
|
226
|
+
return source !== OpenCodeDatabase.node && (kept === undefined || kept.has(source));
|
|
227
|
+
});
|
|
228
|
+
const scope = Scope.makeUnsafe();
|
|
229
|
+
const done = Deferred.makeUnsafe();
|
|
230
|
+
const sweep = observed(restarts(restart, closer, cutOff, ended), done);
|
|
231
|
+
const client = await Effect.runPromise(OpenCode.create({
|
|
232
|
+
...ServerWorkerd.serverOptions({ ...profile, config: { content: JSON.stringify(config) } }),
|
|
233
|
+
plugins: plugins.map(fromPromise),
|
|
234
|
+
}, {
|
|
235
|
+
overrides: [
|
|
236
|
+
OpenCodeDatabase.node.replace(OpenCodeDatabase.configuredClient(sqlClient(db, fence, committed))),
|
|
237
|
+
...rest,
|
|
238
|
+
SessionRestart.node.replace(SessionRestart.node.mapLayer(() => sweep)),
|
|
239
|
+
],
|
|
240
|
+
}).pipe(Scope.provide(scope)));
|
|
241
|
+
return {
|
|
242
|
+
client,
|
|
243
|
+
// The client's calls need nothing more: OpenCode provided it all.
|
|
244
|
+
call: (effect) => Effect.runPromise(effect),
|
|
245
|
+
swept: Effect.runPromise(Deferred.await(done)),
|
|
246
|
+
close: () => Effect.runPromise(Scope.close(scope, Exit.void)),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
//#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