@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.
- package/README.md +89 -49
- package/dist/calls.d.ts +29 -5
- package/dist/calls.d.ts.map +1 -1
- package/dist/calls.js +77 -10
- package/dist/calls.js.map +1 -1
- package/dist/claude/index.d.ts +36 -7
- package/dist/claude/index.d.ts.map +1 -1
- package/dist/claude/index.js +232 -151
- package/dist/claude/index.js.map +1 -1
- package/dist/client.d.ts +12 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js.map +1 -1
- package/dist/common.d.ts +151 -70
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +246 -204
- package/dist/common.js.map +1 -1
- package/dist/conversation.d.ts +466 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +1247 -0
- package/dist/conversation.js.map +1 -0
- package/dist/deepseek/index.d.ts +38 -5
- package/dist/deepseek/index.d.ts.map +1 -1
- package/dist/deepseek/index.js +322 -106
- package/dist/deepseek/index.js.map +1 -1
- package/dist/deepseek/persistence.d.ts +9 -3
- package/dist/deepseek/persistence.d.ts.map +1 -1
- package/dist/deepseek/persistence.js +12 -6
- package/dist/deepseek/persistence.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/langgraph/checkpointer.d.ts +16 -2
- package/dist/langgraph/checkpointer.d.ts.map +1 -1
- package/dist/langgraph/checkpointer.js +133 -26
- package/dist/langgraph/checkpointer.js.map +1 -1
- package/dist/langgraph/context.d.ts +10 -0
- package/dist/langgraph/context.d.ts.map +1 -0
- package/dist/langgraph/context.js +21 -0
- package/dist/langgraph/context.js.map +1 -0
- package/dist/langgraph/errors.d.ts +16 -0
- package/dist/langgraph/errors.d.ts.map +1 -0
- package/dist/langgraph/errors.js +30 -0
- package/dist/langgraph/errors.js.map +1 -0
- package/dist/langgraph/graph.d.ts +25 -0
- package/dist/langgraph/graph.d.ts.map +1 -0
- package/dist/langgraph/graph.js +346 -0
- package/dist/langgraph/graph.js.map +1 -0
- package/dist/langgraph/index.d.ts +65 -12
- package/dist/langgraph/index.d.ts.map +1 -1
- package/dist/langgraph/index.js +227 -171
- package/dist/langgraph/index.js.map +1 -1
- package/dist/langgraph/nodes.d.ts +70 -0
- package/dist/langgraph/nodes.d.ts.map +1 -0
- package/dist/langgraph/nodes.js +145 -0
- package/dist/langgraph/nodes.js.map +1 -0
- package/dist/messages.d.ts +18 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +182 -0
- package/dist/messages.js.map +1 -0
- package/dist/object.d.ts +65 -23
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +121 -35
- package/dist/object.js.map +1 -1
- package/dist/output.d.ts +15 -7
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +44 -26
- package/dist/output.js.map +1 -1
- package/dist/pi/index.d.ts +39 -11
- package/dist/pi/index.d.ts.map +1 -1
- package/dist/pi/index.js +281 -77
- package/dist/pi/index.js.map +1 -1
- package/dist/pi/storage.d.ts +29 -4
- package/dist/pi/storage.d.ts.map +1 -1
- package/dist/pi/storage.js +18 -6
- package/dist/pi/storage.js.map +1 -1
- package/dist/signals.d.ts +74 -4
- package/dist/signals.d.ts.map +1 -1
- package/dist/signals.js +144 -15
- package/dist/signals.js.map +1 -1
- package/dist/steering.d.ts +31 -0
- package/dist/steering.d.ts.map +1 -0
- package/dist/steering.js +45 -0
- package/dist/steering.js.map +1 -0
- package/dist/tools.d.ts +28 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +34 -5
- package/dist/tools.js.map +1 -1
- package/package.json +33 -37
- package/src/calls.ts +107 -15
- package/src/claude/README.md +41 -20
- package/src/claude/index.ts +266 -178
- package/src/client.ts +14 -3
- package/src/common.ts +317 -232
- package/src/conversation.ts +1527 -0
- package/src/deepseek/README.md +78 -11
- package/src/deepseek/index.ts +384 -137
- package/src/deepseek/persistence.ts +11 -8
- package/src/index.ts +13 -4
- package/src/langgraph/README.md +115 -25
- package/src/langgraph/checkpointer.ts +168 -28
- package/src/langgraph/context.ts +27 -0
- package/src/langgraph/errors.ts +26 -0
- package/src/langgraph/graph.ts +396 -0
- package/src/langgraph/index.ts +326 -181
- package/src/langgraph/nodes.ts +243 -0
- package/src/messages.ts +244 -0
- package/src/object.ts +167 -38
- package/src/output.ts +52 -31
- package/src/pi/README.md +18 -3
- package/src/pi/index.ts +346 -78
- package/src/pi/storage.ts +20 -7
- package/src/signals.ts +225 -19
- package/src/steering.ts +67 -0
- package/src/tools.ts +61 -8
- package/dist/claude/conversation.d.ts +0 -33
- package/dist/claude/conversation.d.ts.map +0 -1
- package/dist/claude/conversation.js +0 -95
- package/dist/claude/conversation.js.map +0 -1
- package/dist/log.d.ts +0 -29
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -146
- package/dist/log.js.map +0 -1
- package/dist/opencode/db.d.ts +0 -40
- package/dist/opencode/db.d.ts.map +0 -1
- package/dist/opencode/db.js +0 -161
- package/dist/opencode/db.js.map +0 -1
- package/dist/opencode/index.d.ts +0 -100
- package/dist/opencode/index.d.ts.map +0 -1
- package/dist/opencode/index.js +0 -436
- package/dist/opencode/index.js.map +0 -1
- package/src/claude/conversation.ts +0 -114
- package/src/log.ts +0 -194
- package/src/opencode/README.md +0 -125
- package/src/opencode/db.ts +0 -223
- package/src/opencode/index.ts +0 -559
package/dist/log.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Schema, ScopeKey } from '@restatedev/sessions/internal';
|
|
2
|
-
const TABLE = 'restate_agent_log';
|
|
3
|
-
const SCHEMA = new Schema('restate-agents.log', [
|
|
4
|
-
`CREATE TABLE ${TABLE} (
|
|
5
|
-
id INTEGER PRIMARY KEY,
|
|
6
|
-
seq INTEGER NOT NULL UNIQUE,
|
|
7
|
-
position INTEGER UNIQUE,
|
|
8
|
-
message TEXT NOT NULL
|
|
9
|
-
)`,
|
|
10
|
-
// Where the log starts, which `clear` sets: no row before.
|
|
11
|
-
`CREATE TABLE ${TABLE}_start (
|
|
12
|
-
row INTEGER PRIMARY KEY CHECK (row = 0),
|
|
13
|
-
seq INTEGER NOT NULL,
|
|
14
|
-
id INTEGER NOT NULL
|
|
15
|
-
)`,
|
|
16
|
-
]);
|
|
17
|
-
/** Where the log of `db` starts, if `clear` set it. */
|
|
18
|
-
const startOf = async (db) => db.get(`SELECT seq, id FROM ${TABLE}_start`);
|
|
19
|
-
/**
|
|
20
|
-
* Start the log at `start`, in the transaction `tx` of `clear` that emptied
|
|
21
|
-
* the database: the next conversation's ids and cursors go on from there.
|
|
22
|
-
*/
|
|
23
|
-
export async function restart(tx, start) {
|
|
24
|
-
await tx.execute(`INSERT OR REPLACE INTO ${TABLE}_start (row, seq, id) VALUES (0, ?, ?)`, [start.seq, start.id]);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The log's head, as the attempt's last `sync` stored it: the next compares
|
|
28
|
-
* the transcript with it, rather than read the whole log again at each step.
|
|
29
|
-
*/
|
|
30
|
-
const HEAD = new ScopeKey('the log');
|
|
31
|
-
/** The log's head in the attempt of `ctx`: as it stored it last, or else as the log has it. */
|
|
32
|
-
async function headOf(ctx) {
|
|
33
|
-
const cached = HEAD.get(ctx);
|
|
34
|
-
if (cached)
|
|
35
|
-
return cached;
|
|
36
|
-
const { db } = ctx;
|
|
37
|
-
const rows = (await db.values(`SELECT id, message FROM ${TABLE} WHERE position IS NOT NULL ORDER BY position`)).map(([id, json]) => ({ id: Number(id), message: JSON.parse(String(json)), json: String(json) }));
|
|
38
|
-
const { last, next } = (await db.get(`SELECT MAX(seq) AS last, MAX(id) + 1 AS next FROM ${TABLE}`));
|
|
39
|
-
if (last !== null)
|
|
40
|
-
return { rows, seq: last, next: next };
|
|
41
|
-
const from = (await startOf(db)) ?? { seq: 0, id: 0 };
|
|
42
|
-
return { rows, seq: from.seq, next: from.id };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Store the transcript's `messages`, in order, in the log: those that
|
|
46
|
-
* changed since the last time, in one transaction.
|
|
47
|
-
*/
|
|
48
|
-
export async function sync(ctx, messages) {
|
|
49
|
-
const { db } = ctx;
|
|
50
|
-
await SCHEMA.ensure(db);
|
|
51
|
-
const head = await headOf(ctx);
|
|
52
|
-
// A message the transcript did not change is the one stored (see Transcript in common.ts):
|
|
53
|
-
// only the others are compared, as JSON.
|
|
54
|
-
const jsons = [];
|
|
55
|
-
const jsonOf = (position) => (jsons[position] ??= JSON.stringify(messages[position]));
|
|
56
|
-
const unchanged = (position) => {
|
|
57
|
-
const row = head.rows[position];
|
|
58
|
-
return row.message === messages[position] || row.json === jsonOf(position);
|
|
59
|
-
};
|
|
60
|
-
const both = Math.min(head.rows.length, messages.length);
|
|
61
|
-
let same = 0;
|
|
62
|
-
while (same < both && unchanged(same))
|
|
63
|
-
same += 1;
|
|
64
|
-
let grown = same;
|
|
65
|
-
while (grown < both && grownFrom(messages[grown], head.rows[grown].message))
|
|
66
|
-
grown += 1;
|
|
67
|
-
if (same === head.rows.length && same === messages.length)
|
|
68
|
-
return;
|
|
69
|
-
let { seq, next: id } = head;
|
|
70
|
-
const rows = head.rows.slice(0, same);
|
|
71
|
-
try {
|
|
72
|
-
await db.transaction(async (tx) => {
|
|
73
|
-
for (let position = same; position < grown; position += 1) {
|
|
74
|
-
const row = { id: head.rows[position].id, message: messages[position], json: jsonOf(position) };
|
|
75
|
-
await tx.execute(`UPDATE ${TABLE} SET seq = ?, message = ? WHERE id = ?`, [(seq += 1), row.json, row.id]);
|
|
76
|
-
rows.push(row);
|
|
77
|
-
}
|
|
78
|
-
// The rest of the transcript as it was is replaced: its messages stay in the log, out of it.
|
|
79
|
-
await tx.execute(`UPDATE ${TABLE} SET position = NULL WHERE position >= ?`, [grown]);
|
|
80
|
-
for (let position = grown; position < messages.length; position += 1) {
|
|
81
|
-
const row = { id: id++, message: messages[position], json: jsonOf(position) };
|
|
82
|
-
await tx.execute(`INSERT INTO ${TABLE} VALUES (?, ?, ?, ?)`, [row.id, (seq += 1), position, row.json]);
|
|
83
|
-
rows.push(row);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
// Rolled back: the log is as it was, which the next sync reads again.
|
|
89
|
-
HEAD.delete(ctx);
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
HEAD.set(ctx, { rows, seq, next: id });
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* A page of the log. With `cursor`: the messages new or changed since it,
|
|
96
|
-
* by when they changed, and the cursor to read on from. Without: the latest
|
|
97
|
-
* `limit` messages (or those before `before`, an id), oldest first, and the
|
|
98
|
-
* cursor to follow the conversation from.
|
|
99
|
-
*/
|
|
100
|
-
export async function page(db, { limit = 50, before, cursor }) {
|
|
101
|
-
await SCHEMA.ensure(db);
|
|
102
|
-
const start = await startOf(db);
|
|
103
|
-
const first = start ? { first: start.id } : {};
|
|
104
|
-
if (cursor !== undefined) {
|
|
105
|
-
const rows = await db.values(`SELECT id, message, seq FROM ${TABLE} WHERE seq > ? ORDER BY seq LIMIT ?`, [
|
|
106
|
-
cursor,
|
|
107
|
-
limit + 1,
|
|
108
|
-
]);
|
|
109
|
-
const shown = rows.slice(0, limit);
|
|
110
|
-
return {
|
|
111
|
-
messages: shown.map(message),
|
|
112
|
-
more: rows.length > limit,
|
|
113
|
-
cursor: shown.length > 0 ? Number(shown.at(-1)[2]) : cursor,
|
|
114
|
-
...first,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
const { now } = (await db.get(`SELECT COALESCE(MAX(seq), ?) AS now FROM ${TABLE}`, [
|
|
118
|
-
start?.seq ?? 0,
|
|
119
|
-
]));
|
|
120
|
-
const rows = await db.values(`SELECT id, message FROM ${TABLE} WHERE id < ? ORDER BY id DESC LIMIT ?`, [
|
|
121
|
-
before ?? Number.MAX_SAFE_INTEGER,
|
|
122
|
-
limit + 1,
|
|
123
|
-
]);
|
|
124
|
-
return {
|
|
125
|
-
messages: rows.slice(0, limit).toReversed().map(message),
|
|
126
|
-
more: rows.length > limit,
|
|
127
|
-
cursor: now,
|
|
128
|
-
...first,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/** A row of the log, as `messages` gives it. */
|
|
132
|
-
const message = ([id, m]) => ({ id: Number(id), ...JSON.parse(String(m)) });
|
|
133
|
-
/** Whether `now` is `was` grown in place: the same role and parts, with more (a tool call's output, say). */
|
|
134
|
-
function grownFrom(now, was) {
|
|
135
|
-
if (was.role !== now.role || now.parts.length < was.parts.length)
|
|
136
|
-
return false;
|
|
137
|
-
return was.parts.every((part, i) => {
|
|
138
|
-
const other = now.parts[i];
|
|
139
|
-
if (part.type !== other.type)
|
|
140
|
-
return false;
|
|
141
|
-
if (part.type === 'text')
|
|
142
|
-
return other.type === 'text' && other.text.startsWith(part.text);
|
|
143
|
-
return other.type === 'tool' && other.id === part.id;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,KAAK,GAAG,mBAAmB,CAAC;AAalC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,oBAAoB,EAAE;IAC9C,gBAAgB,KAAK;;;;;IAKnB;IACF,2DAA2D;IAC3D,gBAAgB,KAAK;;;;IAInB;CACH,CAAC,CAAC;AAEH,uDAAuD;AACvD,MAAM,OAAO,GAAG,KAAK,EAAE,EAAkB,EAA8B,EAAE,CACvE,EAAE,CAAC,GAAG,CAAQ,uBAAuB,KAAK,QAAQ,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,KAAK,UA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AAE,OAAO,KAAK,CAAC;IAC/E,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACjC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAC3C,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3F,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/opencode/db.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
/** An Effect SqlClient over `db`, with its statements refused once `fence` closes. */
|
|
11
|
-
export declare function sqlClient(db: Database, fence: Fence): Layer.Layer<SqlClient.SqlClient>;
|
|
12
|
-
export interface OpenOptions {
|
|
13
|
-
/** OpenCode plugins: models, tools, agents. */
|
|
14
|
-
plugins?: Plugin.Plugin[];
|
|
15
|
-
/** OpenCode's config (opencode.json), inline. */
|
|
16
|
-
config?: Record<string, unknown>;
|
|
17
|
-
/**
|
|
18
|
-
* OpenCode's own filesystem, search and shell, on the local machine, for
|
|
19
|
-
* its built-in tools (read, write, edit, bash, glob, grep...) in a
|
|
20
|
-
* session's directory. Without it, the workerd profile has none.
|
|
21
|
-
*/
|
|
22
|
-
local?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Resume the turns a previous attempt left unfinished, as OpenCode does
|
|
25
|
-
* when it boots (default true). A reader beside a running turn does not.
|
|
26
|
-
*/
|
|
27
|
-
resume?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/** A booted OpenCode: `call` runs one of `client`'s calls (which return Effects); `close` shuts it down. */
|
|
30
|
-
export interface Host {
|
|
31
|
-
client: OpenCode.Interface;
|
|
32
|
-
call<A, E, R>(effect: Effect.Effect<A, E, R>): Promise<A>;
|
|
33
|
-
close(): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Boot OpenCode with its database in `db`. Booting resumes the turns a
|
|
37
|
-
* previous attempt left unfinished. Close the host when done.
|
|
38
|
-
*/
|
|
39
|
-
export declare function openOpenCode(db: Database, fence: Fence, { plugins, config, local, resume }: OpenOptions): Promise<Host>;
|
|
40
|
-
//# sourceMappingURL=db.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/opencode/db.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAW,MAAM,EAAQ,KAAK,EAAiB,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAOlD,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;AA+CD,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAkEtF;AAED,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,4GAA4G;AAC5G,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAYD;;;GAGG;AACH,wBAAsB,YAAY,CAChC,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,KAAK,EACZ,EAAE,OAAY,EAAE,MAAW,EAAE,KAAa,EAAE,MAAa,EAAE,EAAE,WAAW,GACvE,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/opencode/db.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// OpenCode on the object's database: `openOpenCode(db, fence, options)` boots
|
|
2
|
-
// OpenCode 2.0's embedded host (@opencode/sdk) with its database in a
|
|
3
|
-
// SQL 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 or version control,
|
|
7
|
-
// config given inline, plugins given in code. Only its database differs. The
|
|
8
|
-
// workerd profile reads a Durable Object's SQLite, whose `exec` is
|
|
9
|
-
// synchronous; here OpenCode gets an Effect SqlClient instead, which is
|
|
10
|
-
// asynchronous, through `Database.configuredClient` (OpenCode's), the seam OpenCode keeps
|
|
11
|
-
// for an injected client. Each transaction is an SQL transaction, and the
|
|
12
|
-
// session runs statements one at a time, as OpenCode's own clients do.
|
|
13
|
-
//
|
|
14
|
-
// `fence.closed` refuses every statement from then on: an attempt that is
|
|
15
|
-
// giving up stores nothing more, as Restate fences an attempt that a newer
|
|
16
|
-
// one replaced.
|
|
17
|
-
import { Context, Effect, Exit, Layer, Option, Scope } from 'effect';
|
|
18
|
-
import { Reactivity } from 'effect/reactivity';
|
|
19
|
-
import { SqlClient, Statement } from 'effect/sql';
|
|
20
|
-
import { SqlError, UnknownError } from 'effect/sql/SqlError';
|
|
21
|
-
import { Database as OpenCodeDatabase } from '@opencode/core/database/database';
|
|
22
|
-
import { SessionRestart } from '@opencode/core/session/execution/restart';
|
|
23
|
-
import { ServerWorkerd } from '@opencode/server/workerd';
|
|
24
|
-
import { fromPromise } from '@opencode/core/plugin/promise';
|
|
25
|
-
import { OpenCode } from '@opencode/sdk/effect';
|
|
26
|
-
const error = (operation, cause) => new SqlError({
|
|
27
|
-
reason: new UnknownError({
|
|
28
|
-
cause,
|
|
29
|
-
message: cause instanceof Error ? cause.message : String(cause),
|
|
30
|
-
operation,
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
33
|
-
/** The connection inside a transaction, for statements of that transaction. */
|
|
34
|
-
const InTransaction = Context.Service('@restatedev/agents/OpenCodeTransaction');
|
|
35
|
-
/**
|
|
36
|
-
* A connection whose statements go to `target`: the session, which runs one
|
|
37
|
-
* call at a time and holds them while a transaction runs, or that
|
|
38
|
-
* transaction's database. Each is refused once `fence` closes.
|
|
39
|
-
*/
|
|
40
|
-
function connection(target, fence) {
|
|
41
|
-
// Effect binds what the compiler made of OpenCode's values: SQL values.
|
|
42
|
-
const exec = (read, sql, params) => Effect.tryPromise({
|
|
43
|
-
try: async () => {
|
|
44
|
-
if (fence.closed)
|
|
45
|
-
throw new Error('the attempt is over');
|
|
46
|
-
return read(sql, params);
|
|
47
|
-
},
|
|
48
|
-
catch: (cause) => error('execute', cause),
|
|
49
|
-
});
|
|
50
|
-
const run = (sql, params = []) => exec((s, p) => target.query(s, p), sql, params);
|
|
51
|
-
const runValues = (sql, params = []) => exec((s, p) => target.values(s, p), sql, params);
|
|
52
|
-
const transformed = (sql, params, transformRows) => transformRows ? Effect.map(run(sql, params), transformRows) : run(sql, params);
|
|
53
|
-
return {
|
|
54
|
-
execute: transformed,
|
|
55
|
-
executeRaw: (sql, params) => run(sql, params),
|
|
56
|
-
executeValues: (sql, params) => runValues(sql, params),
|
|
57
|
-
executeValuesUnprepared: (sql, params) => runValues(sql, params),
|
|
58
|
-
executeUnprepared: transformed,
|
|
59
|
-
executeStream: () => {
|
|
60
|
-
throw new Error('executeStream is not supported');
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/** An Effect SqlClient over `db`, with its statements refused once `fence` closes. */
|
|
65
|
-
export function sqlClient(db, fence) {
|
|
66
|
-
// `effect` as one SQL transaction: it commits when `effect` succeeds
|
|
67
|
-
// and rolls back when it fails. Its statements go to the transaction's
|
|
68
|
-
// database.
|
|
69
|
-
const withTransaction = (effect) => Effect.withFiber((fiber) => {
|
|
70
|
-
if (Option.isSome(Context.getOption(fiber.context, InTransaction))) {
|
|
71
|
-
return Effect.fail(error('transaction', new Error('nested transactions are not supported')));
|
|
72
|
-
}
|
|
73
|
-
return Effect.callback((resume) => {
|
|
74
|
-
const rollback = new Error('rollback');
|
|
75
|
-
let interrupted = false;
|
|
76
|
-
let resumed = false;
|
|
77
|
-
// Settles when the transaction has committed, or rejects: with
|
|
78
|
-
// `rollback` once `effect` failed, or with the error of BEGIN or COMMIT.
|
|
79
|
-
const ended = db.transaction((tx) => new Promise((resolve, reject) => {
|
|
80
|
-
if (interrupted)
|
|
81
|
-
return reject(rollback);
|
|
82
|
-
const inner = Effect.provideContext(effect, Context.add(fiber.context, InTransaction, [connection(tx, fence), 0]));
|
|
83
|
-
resumed = true;
|
|
84
|
-
resume(
|
|
85
|
-
// A finalizer, so that the body settles however `effect`
|
|
86
|
-
// ends, an interruption included: otherwise the transaction
|
|
87
|
-
// would hold the session for good.
|
|
88
|
-
Effect.onExit(inner, (exit) => {
|
|
89
|
-
if (Exit.isSuccess(exit)) {
|
|
90
|
-
resolve();
|
|
91
|
-
return Effect.void;
|
|
92
|
-
}
|
|
93
|
-
reject(rollback);
|
|
94
|
-
return Effect.promise(() => settled);
|
|
95
|
-
}).pipe(
|
|
96
|
-
// The commit is part of the transaction: if it fails, so
|
|
97
|
-
// does the transaction.
|
|
98
|
-
Effect.flatMap((value) => Effect.as(Effect.tryPromise({ try: () => ended, catch: (e) => error('commit', e) }), value))));
|
|
99
|
-
}));
|
|
100
|
-
const settled = ended.catch((cause) => {
|
|
101
|
-
// BEGIN failed: `effect` never ran.
|
|
102
|
-
if (!resumed && cause !== rollback)
|
|
103
|
-
resume(Effect.fail(error('transaction', cause)));
|
|
104
|
-
});
|
|
105
|
-
return Effect.suspend(() => {
|
|
106
|
-
interrupted = true;
|
|
107
|
-
return Effect.promise(() => settled);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
const make = Effect.gen(function* () {
|
|
112
|
-
const client = yield* SqlClient.make({
|
|
113
|
-
acquirer: Effect.succeed(connection(db, fence)),
|
|
114
|
-
compiler: Statement.makeCompilerSqlite(),
|
|
115
|
-
spanAttributes: [['db.system.name', 'sqlite']],
|
|
116
|
-
transactionService: InTransaction,
|
|
117
|
-
});
|
|
118
|
-
return Object.assign(client, { withTransaction, transactionStatements: false });
|
|
119
|
-
});
|
|
120
|
-
return Layer.effect(SqlClient.SqlClient, make).pipe(Layer.provide(Reactivity.layer));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* How OpenCode resumes the turns a previous attempt left unfinished when it
|
|
124
|
-
* boots: each, however often it crashed (Restate's retry policy decides how
|
|
125
|
-
* often an attempt is retried), or, without `resume`, none.
|
|
126
|
-
*/
|
|
127
|
-
const restarts = (resume) => resume
|
|
128
|
-
? SessionRestart.layer({ maxAttempts: Infinity })
|
|
129
|
-
: Layer.succeed(SessionRestart.Service, { resumeSuspendedSessions: Effect.void });
|
|
130
|
-
/**
|
|
131
|
-
* Boot OpenCode with its database in `db`. Booting resumes the turns a
|
|
132
|
-
* previous attempt left unfinished. Close the host when done.
|
|
133
|
-
*/
|
|
134
|
-
export async function openOpenCode(db, fence, { plugins = [], config = {}, local = false, resume = true }) {
|
|
135
|
-
// The workerd profile, but for its database, which comes first. (The
|
|
136
|
-
// Promise API's OpenCode.create takes no replacements; the Effect API's does.)
|
|
137
|
-
const profile = { storage: undefined, models: { fetch: false } };
|
|
138
|
-
// In 2.0.27's order: database, process spawner, snapshot, version control,
|
|
139
|
-
// filesystem, filesystem search, pty, plugin discovery. Local keeps the
|
|
140
|
-
// stubs of snapshots, the pty and plugin discovery only.
|
|
141
|
-
const [, spawner, snapshot, vcs, fs, search, pty, discovery] = ServerWorkerd.replacements(profile);
|
|
142
|
-
const rest = local ? [snapshot, pty, discovery] : [spawner, snapshot, vcs, fs, search, pty, discovery];
|
|
143
|
-
const scope = Scope.makeUnsafe();
|
|
144
|
-
const client = await Effect.runPromise(OpenCode.create({
|
|
145
|
-
...ServerWorkerd.serverOptions({ ...profile, config: { content: JSON.stringify(config) } }),
|
|
146
|
-
plugins: plugins.map(fromPromise),
|
|
147
|
-
}, {
|
|
148
|
-
overrides: [
|
|
149
|
-
OpenCodeDatabase.node.replace(OpenCodeDatabase.configuredClient(sqlClient(db, fence))),
|
|
150
|
-
...rest,
|
|
151
|
-
SessionRestart.node.replace(SessionRestart.node.mapLayer(() => restarts(resume))),
|
|
152
|
-
],
|
|
153
|
-
}).pipe(Scope.provide(scope)));
|
|
154
|
-
return {
|
|
155
|
-
client,
|
|
156
|
-
// The client's calls need nothing more: OpenCode provided it all.
|
|
157
|
-
call: (effect) => Effect.runPromise(effect),
|
|
158
|
-
close: () => Effect.runPromise(Scope.close(scope, Exit.void)),
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=db.js.map
|
package/dist/opencode/db.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/opencode/db.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,sEAAsE;AACtE,yBAAyB;AACzB,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,mEAAmE;AACnE,wEAAwE;AACxE,0FAA0F;AAC1F,0EAA0E;AAC1E,uEAAuE;AACvE,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAShD,MAAM,KAAK,GAAG,CAAC,SAAiB,EAAE,KAAc,EAAE,EAAE,CAClD,IAAI,QAAQ,CAAC;IACX,MAAM,EAAE,IAAI,YAAY,CAAC;QACvB,KAAK;QACL,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CA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AO,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YACtF,GAAG,IAAI;YACP,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAU,CAAC,CAAC;SAC3F;KACF,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO;QACL,MAAM;QACN,kEAAkE;QAClE,IAAI,EAAE,CAAU,MAA8B,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,MAA6B,CAAC;QACnG,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;KAC9D,CAAC;AACJ,CAAC"}
|
package/dist/opencode/index.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as restate from '@restatedev/sessions';
|
|
2
|
-
import type { Plugin } from '@opencode/plugin';
|
|
3
|
-
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
-
import { type Configure } from '../common.ts';
|
|
5
|
-
import { type Answer } from '../output.ts';
|
|
6
|
-
import type { z } from 'zod';
|
|
7
|
-
import { type Definition } from '../object.ts';
|
|
8
|
-
import { type Tool as AnyTool } from '../tools.ts';
|
|
9
|
-
import { type Host } from './db.ts';
|
|
10
|
-
/** An OpenCode model reference. */
|
|
11
|
-
export interface ModelRef {
|
|
12
|
-
providerID: string;
|
|
13
|
-
id: string;
|
|
14
|
-
}
|
|
15
|
-
/** An OpenCode tool of your own: `execute` gets the input and the tool call's id. */
|
|
16
|
-
export interface OpenCodeTool<Input = unknown> {
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
input: StandardSchemaV1<unknown, Input>;
|
|
20
|
-
execute(input: Input, callId: string): Promise<string>;
|
|
21
|
-
}
|
|
22
|
-
/** What `work` gets: `prompt(text)`, and the OpenCode `host` for anything else. */
|
|
23
|
-
export interface OpenCodeSession {
|
|
24
|
-
host: Host;
|
|
25
|
-
/** Answer `text`, once per prompt `id`, with the answer's text. By default, each prompt of an invocation has an id of its own, the same on every attempt. */
|
|
26
|
-
prompt: (text: string, id?: string) => Promise<string>;
|
|
27
|
-
}
|
|
28
|
-
/** An agent's options: `chat`, `prompt` and `withOpenCode` take them. */
|
|
29
|
-
export interface Options<O extends z.ZodObject | undefined = z.ZodObject | undefined> {
|
|
30
|
-
/** The model of the session, as `provider/model-id`: MODEL, or else openai/gpt-6-sol. */
|
|
31
|
-
model?: string | ModelRef;
|
|
32
|
-
/** The system prompt: who the agent is, and how it answers. */
|
|
33
|
-
system?: string;
|
|
34
|
-
/** The agent's tools, which replace OpenCode's own: `tool()`s, Restate's (`call`, `signal`...), or OpenCode tools of your own. */
|
|
35
|
-
tools?: (AnyTool | OpenCodeTool)[];
|
|
36
|
-
/**
|
|
37
|
-
* A directory of the local machine, made if missing: OpenCode keeps its own tools (read,
|
|
38
|
-
* write, edit, bash, glob, grep...) there, besides `tools`, and the
|
|
39
|
-
* session works in it. Or a function of the invocation's context that
|
|
40
|
-
* gives one: `(ctx) => \`/work/${ctx.key}\``, a directory per key; or makes
|
|
41
|
-
* one, such as a git worktree (it runs at each attempt: make it idempotent).
|
|
42
|
-
*/
|
|
43
|
-
workspace?: string | ((ctx: restate.SessionContext) => string | Promise<string>);
|
|
44
|
-
/** OpenCode plugins, such as the one of the model. */
|
|
45
|
-
plugins?: Plugin.Plugin[];
|
|
46
|
-
/**
|
|
47
|
-
* The answer as data: a zod object, whose JSON the agent replies with
|
|
48
|
-
* (checked), and `chat` and `prompt` answer with (see output.ts).
|
|
49
|
-
*/
|
|
50
|
-
output?: O;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Run `work(opencode)` with OpenCode over the object's database: `model` is
|
|
54
|
-
* the session's model, `plugins` OpenCode plugins (such as the model's), and
|
|
55
|
-
* `tools` the agent's tools. `opencode` has `prompt(text)`, and the
|
|
56
|
-
* OpenCode `host` for anything else.
|
|
57
|
-
*/
|
|
58
|
-
export declare const withOpenCode: <T>(ctx: restate.SessionContext, { plugins, model: named, system, tools, workspace: where }: Options, work: (opencode: OpenCodeSession) => Promise<T>) => Promise<T>;
|
|
59
|
-
/**
|
|
60
|
-
* Answer `text`, once: a retried attempt resumes the same prompt. Each prompt
|
|
61
|
-
* of an invocation is a prompt of its own.
|
|
62
|
-
* With `output`, it answers with the value the agent replies with (see
|
|
63
|
-
* output.ts), not its text.
|
|
64
|
-
*/
|
|
65
|
-
export declare const prompt: <O extends z.ZodObject | undefined = undefined>(ctx: restate.SessionContext, text: string, options?: Options<O>) => Promise<Answer<O>>;
|
|
66
|
-
/**
|
|
67
|
-
* A chat handler: each message an invocation, the session in the object's
|
|
68
|
-
* database, with `options`, or the options a function of the invocation's
|
|
69
|
-
* context gives (each user's workspace, say). It takes the message as plain
|
|
70
|
-
* text (`curl -d 'Hi'`) or as a JSON string (`curl --json '"Hi"'`).
|
|
71
|
-
*/
|
|
72
|
-
export declare const chat: <O extends z.ZodObject | undefined = undefined>(options?: Configure<Options<O>>) => {
|
|
73
|
-
input: restate.Serde<string>;
|
|
74
|
-
accept: string;
|
|
75
|
-
explicitCancellation: boolean;
|
|
76
|
-
handler: (ctx: restate.SessionContext, text: string) => Promise<Answer<O>>;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* A handler of the conversation as clients read it: a page at a time, or
|
|
80
|
-
* what is new or changed since a cursor, from the log each change writes
|
|
81
|
-
* (log.ts). It answers while a message is answered.
|
|
82
|
-
*/
|
|
83
|
-
export declare const messages: () => (ctx: restate.ViewContext, request?: import("../common.ts").MessagesRequest) => Promise<import("../common.ts").Messages>;
|
|
84
|
-
/** An agent: a virtual object `name`, one per key, whose `chat` handler is {@link chat}, and `messages` {@link messages}. */
|
|
85
|
-
export declare const agent: <P extends string, O extends z.ZodObject | undefined = undefined>({ name, description, schema, background, ...options }: Options<O> & Definition<P>) => restate.VirtualObjectDefinition<P, {
|
|
86
|
-
signal: (ctx: restate.ViewContext, signal: import("../signals.ts").Signal) => Promise<import("../signals.ts").Resolved>;
|
|
87
|
-
pending: (ctx: restate.ViewContext) => Promise<import("../signals.ts").Waiting[]>;
|
|
88
|
-
status: (ctx: restate.ViewContext) => Promise<import("../object.ts").Status>;
|
|
89
|
-
stop: (ctx: restate.ViewContext) => Promise<import("../object.ts").Stopped>;
|
|
90
|
-
notifications: (ctx: restate.ViewContext) => Promise<import("../signals.ts").Notifications>;
|
|
91
|
-
watch: (ctx: restate.ViewContext, watch: import("../signals.ts").Watch) => Promise<import("../signals.ts").Notifications>;
|
|
92
|
-
} & {
|
|
93
|
-
clear: (ctx: restate.ViewContext) => Promise<import("../object.ts").Stopped>;
|
|
94
|
-
sync: (ctx: restate.ViewContext, { cursor, revision, timeoutSeconds, limit }?: import("../object.ts").SyncRequest) => Promise<import("../object.ts").Synced>;
|
|
95
|
-
} & {
|
|
96
|
-
chat: (ctx: restate.SessionContext, text: string) => Promise<Answer<O>>;
|
|
97
|
-
} & {
|
|
98
|
-
messages: (ctx: restate.ViewContext, request?: import("../common.ts").MessagesRequest) => Promise<import("../common.ts").Messages>;
|
|
99
|
-
}>;
|
|
100
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/opencode/index.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAGhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAKL,KAAK,SAAS,EAaf,MAAM,cAAc,CAAC;AACtB,OAAO,EA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