@opencode/client 2.2.2 → 2.2.3
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/dist/chunks/{pty-handoff-0e3ghr9a.js → contract-0e3ghr9a.js} +2 -2
- package/dist/chunks/{pty-handoff-8ye1ye6f.js → contract-2ny4vxct.js} +2 -2
- package/dist/chunks/{pty-handoff-15p82y03.js → contract-9j12j8xw.js} +5 -5
- package/dist/chunks/{pty-handoff-5d2vkjb7.js → contract-bhbt909k.js} +9 -9
- package/dist/chunks/{pty-handoff-f6hq5twr.js → contract-fh77hmr5.js} +72 -8
- package/dist/chunks/{pty-handoff-pgwvv4px.js → contract-gcmv0c13.js} +2 -2
- package/dist/chunks/{pty-handoff-gecjxyvt.js → contract-gecjxyvt.js} +1 -1
- package/dist/chunks/{pty-handoff-wcnmkks2.js → contract-gmh1mc73.js} +4 -4
- package/dist/chunks/{pty-handoff-bb4rz2ry.js → contract-gxr0nf8c.js} +6 -6
- package/dist/chunks/{pty-handoff-kdshn947.js → contract-kdshn947.js} +1 -1
- package/dist/chunks/contract-mwrzahmf.js +38 -0
- package/dist/chunks/{pty-handoff-ryy6kscr.js → contract-ryy6kscr.js} +1 -1
- package/dist/chunks/{pty-handoff-gne7h7mq.js → contract-v1h0xkyr.js} +42 -1
- package/dist/contract.js +1 -1
- package/dist/effect/client.d.ts +24 -0
- package/dist/effect/client.js +8 -8
- package/dist/effect/generated/client-error.js +1 -1
- package/dist/effect/generated/client.d.ts +24 -0
- package/dist/effect/generated/client.js +5 -5
- package/dist/effect/generated/index.js +4 -4
- package/dist/effect/index.js +8 -8
- package/dist/effect/rpc.js +4 -4
- package/dist/effect/service.js +6 -6
- package/dist/promise/client.js +7 -7
- package/dist/promise/generated/client-error.js +1 -1
- package/dist/promise/generated/client.js +2 -2
- package/dist/promise/generated/index.js +4 -4
- package/dist/promise/generated/types.d.ts +25 -7
- package/dist/promise/generated/types.js +1 -1
- package/dist/promise/index.d.ts +1 -0
- package/dist/promise/index.js +15 -9
- package/dist/promise/media.d.ts +356 -0
- package/dist/promise/media.js +8 -0
- package/dist/promise/rpc.js +2 -2
- package/dist/promise/service.js +6 -6
- package/dist/pty-handoff.js +4 -4
- package/dist/rpc-runtime.js +1 -1
- package/dist/service-contender.js +1 -1
- package/dist/service-probe.js +3 -3
- package/dist/service-timing.js +1 -1
- package/dist/service-version.js +1 -1
- package/dist/service.js +1 -1
- package/dist/shared-events.js +1 -1
- package/dist/solid/connection.js +1 -1
- package/dist/solid/data.d.ts +2 -0
- package/dist/solid/data.js +10 -9
- package/dist/solid/index.js +20 -13
- package/dist/solid/pty.d.ts +66 -0
- package/dist/solid/pty.js +8 -2
- package/dist/solid/retention.js +1 -1
- package/dist/solid/usage.js +1 -1
- package/package.json +4 -4
- /package/dist/chunks/{pty-handoff-60xe5cbf.js → contract-60xe5cbf.js} +0 -0
- /package/dist/chunks/{pty-handoff-6mptkzbc.js → contract-6mptkzbc.js} +0 -0
- /package/dist/chunks/{pty-handoff-6mq2wh8y.js → contract-6mq2wh8y.js} +0 -0
- /package/dist/chunks/{pty-handoff-m2eywc8w.js → contract-6r38tsk5.js} +0 -0
- /package/dist/chunks/{pty-handoff-8s2anffy.js → contract-8s2anffy.js} +0 -0
- /package/dist/chunks/{pty-handoff-9rqn6x4v.js → contract-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{pty-handoff-cvg5j6d1.js → contract-cvg5j6d1.js} +0 -0
- /package/dist/chunks/{pty-handoff-nwcpakzx.js → contract-nwcpakzx.js} +0 -0
- /package/dist/chunks/{pty-handoff-qav6mfdz.js → contract-qav6mfdz.js} +0 -0
- /package/dist/chunks/{pty-handoff-sxt88q69.js → contract-sxt88q69.js} +0 -0
- /package/dist/chunks/{pty-handoff-ve4aws36.js → contract-ve4aws36.js} +0 -0
- /package/dist/chunks/{pty-handoff-vyas3vgt.js → contract-vyas3vgt.js} +0 -0
- /package/dist/chunks/{pty-handoff-xgnj2w4v.js → contract-xgnj2w4v.js} +0 -0
- /package/dist/chunks/{pty-handoff-y2etg5bs.js → contract-y2etg5bs.js} +0 -0
- /package/dist/chunks/{pty-handoff-ydhz1zrh.js → contract-ydhz1zrh.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultEnsureTiming2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-xgnj2w4v.js";
|
|
4
4
|
import {
|
|
5
5
|
matchesVersion2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-sxt88q69.js";
|
|
7
7
|
|
|
8
8
|
// src/service-probe.ts
|
|
9
9
|
import { homedir } from "node:os";
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
readError2,
|
|
4
4
|
event2,
|
|
5
5
|
eventType2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-ryy6kscr.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./contract-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/effect/rpc.ts
|
|
12
12
|
var exports_rpc = {};
|
|
13
13
|
__export(exports_rpc, {
|
|
14
14
|
RpcClientRuntime: () => exports_rpc,
|
|
15
15
|
aborted: () => aborted2,
|
|
16
|
-
make: () =>
|
|
16
|
+
make: () => make4
|
|
17
17
|
});
|
|
18
18
|
import { Effect, Stream } from "effect";
|
|
19
|
-
function
|
|
19
|
+
function make4(call, subscribe) {
|
|
20
20
|
return (definition) => {
|
|
21
21
|
const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
|
|
22
22
|
name,
|
|
@@ -59,4 +59,4 @@ function aborted2(signal) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export {
|
|
62
|
+
export { make4, aborted2, exports_rpc };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
make7
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-gecjxyvt.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientError2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-y2etg5bs.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./
|
|
8
|
+
make3
|
|
9
|
+
} from "./contract-gxr0nf8c.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
make4,
|
|
12
12
|
aborted2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./contract-9j12j8xw.js";
|
|
14
14
|
import {
|
|
15
15
|
__export
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./contract-9rqn6x4v.js";
|
|
17
17
|
|
|
18
18
|
// src/effect/client.ts
|
|
19
19
|
var exports_client = {};
|
|
@@ -30,7 +30,7 @@ var CurrentHeaders = Context.Reference("@opencode/client/effect/rpc/headers", {
|
|
|
30
30
|
});
|
|
31
31
|
var make2 = Effect.fn("OpenCode.make")(function* (options) {
|
|
32
32
|
const httpClient = yield* HttpClient.HttpClient;
|
|
33
|
-
const raw = yield*
|
|
33
|
+
const raw = yield* make3(options).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.mapRequestEffect(httpClient, (request) => Effect.map(CurrentHeaders, (headers) => headers ? HttpClientRequest.setHeaders(request, new Headers(headers)) : request))));
|
|
34
34
|
const context = yield* Effect.context();
|
|
35
35
|
const native = raw.event.subscribe();
|
|
36
36
|
|
|
@@ -45,7 +45,7 @@ var make2 = Effect.fn("OpenCode.make")(function* (options) {
|
|
|
45
45
|
return {
|
|
46
46
|
...raw,
|
|
47
47
|
event: { ...raw.event, subscribe },
|
|
48
|
-
rpc: Object.assign(
|
|
48
|
+
rpc: Object.assign(make4((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc)
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isSessionNotFoundError2,
|
|
3
|
+
isMessageNotFoundError2,
|
|
2
4
|
isFormNotFoundError2,
|
|
3
5
|
isFormAlreadySettledError2,
|
|
4
6
|
isPermissionNotFoundError2
|
|
5
|
-
} from "./
|
|
7
|
+
} from "./contract-cvg5j6d1.js";
|
|
6
8
|
|
|
7
9
|
// src/solid/data.ts
|
|
8
10
|
import { Worktree } from "@opencode/schema/worktree";
|
|
@@ -127,6 +129,7 @@ function createSync() {
|
|
|
127
129
|
};
|
|
128
130
|
}
|
|
129
131
|
var CHILD_PAGE = 200;
|
|
132
|
+
var DELETED_SESSION_LIMIT = 512;
|
|
130
133
|
function createData2(config) {
|
|
131
134
|
const api = config.api;
|
|
132
135
|
let disposed = false;
|
|
@@ -137,6 +140,12 @@ function createData2(config) {
|
|
|
137
140
|
load().catch((error) => {
|
|
138
141
|
if (disposed || config.connection && config.connection.status() !== "connected")
|
|
139
142
|
return;
|
|
143
|
+
if (isSessionNotFoundError2(error)) {
|
|
144
|
+
markDeleted(error.sessionID);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (isMessageNotFoundError2(error))
|
|
148
|
+
return;
|
|
140
149
|
if (config.onError)
|
|
141
150
|
return config.onError(error);
|
|
142
151
|
console.error("Failed to refresh client data", error);
|
|
@@ -154,6 +163,7 @@ function createData2(config) {
|
|
|
154
163
|
const [store, setStore] = createStore({
|
|
155
164
|
session: {
|
|
156
165
|
info: {},
|
|
166
|
+
missing: {},
|
|
157
167
|
family: {},
|
|
158
168
|
active: {},
|
|
159
169
|
message: {},
|
|
@@ -425,6 +435,35 @@ function createData2(config) {
|
|
|
425
435
|
draft.pending[sessionID] = pending;
|
|
426
436
|
}));
|
|
427
437
|
}
|
|
438
|
+
let deletionEpoch = 0;
|
|
439
|
+
const deletedAt = new Map;
|
|
440
|
+
function clearDeleted(sessionID) {
|
|
441
|
+
deletedAt.delete(sessionID);
|
|
442
|
+
if (store.session.missing[sessionID])
|
|
443
|
+
setStore("session", "missing", sessionID, undefined);
|
|
444
|
+
}
|
|
445
|
+
function markDeleted(sessionID) {
|
|
446
|
+
if (sessionOutbox.has(sessionID))
|
|
447
|
+
return;
|
|
448
|
+
batch(() => {
|
|
449
|
+
deletedAt.delete(sessionID);
|
|
450
|
+
deletedAt.set(sessionID, ++deletionEpoch);
|
|
451
|
+
if (deletedAt.size > DELETED_SESSION_LIMIT) {
|
|
452
|
+
const oldest = deletedAt.keys().next().value;
|
|
453
|
+
if (oldest !== undefined) {
|
|
454
|
+
deletedAt.delete(oldest);
|
|
455
|
+
setStore("session", "missing", oldest, undefined);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
setStore("session", "missing", sessionID, true);
|
|
459
|
+
removeSession(sessionID);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
function evictMissing(error) {
|
|
463
|
+
if (isSessionNotFoundError2(error))
|
|
464
|
+
markDeleted(error.sessionID);
|
|
465
|
+
throw error;
|
|
466
|
+
}
|
|
428
467
|
function removeSession(sessionID) {
|
|
429
468
|
activeUpdates?.set(sessionID, undefined);
|
|
430
469
|
store.session.pending[sessionID]?.forEach((item) => outbox.delete(item.id));
|
|
@@ -489,6 +528,7 @@ function createData2(config) {
|
|
|
489
528
|
setStore("project", "info", event.data.id, reconcile(event.data));
|
|
490
529
|
return;
|
|
491
530
|
case "session.created":
|
|
531
|
+
clearDeleted(event.data.sessionID);
|
|
492
532
|
sessionOutbox.delete(event.data.sessionID);
|
|
493
533
|
result.session.invalidate(event.data.sessionID);
|
|
494
534
|
refresh(() => result.session.sync(event.data.sessionID));
|
|
@@ -496,7 +536,7 @@ function createData2(config) {
|
|
|
496
536
|
sync.complete(`session.message:${event.data.sessionID}`);
|
|
497
537
|
return;
|
|
498
538
|
case "session.deleted":
|
|
499
|
-
|
|
539
|
+
markDeleted(event.data.sessionID);
|
|
500
540
|
return;
|
|
501
541
|
case "session.usage.updated":
|
|
502
542
|
if (store.session.info[event.data.sessionID])
|
|
@@ -1210,11 +1250,18 @@ function createData2(config) {
|
|
|
1210
1250
|
get(sessionID) {
|
|
1211
1251
|
return store.session.info[sessionID];
|
|
1212
1252
|
},
|
|
1253
|
+
missing(sessionID) {
|
|
1254
|
+
return Boolean(store.session.missing[sessionID]);
|
|
1255
|
+
},
|
|
1256
|
+
forget(sessionID) {
|
|
1257
|
+
markDeleted(sessionID);
|
|
1258
|
+
},
|
|
1213
1259
|
creating(sessionID) {
|
|
1214
1260
|
return creating.has(sessionID);
|
|
1215
1261
|
},
|
|
1216
1262
|
remember(info) {
|
|
1217
1263
|
batch(() => {
|
|
1264
|
+
clearDeleted(info.id);
|
|
1218
1265
|
setStore("session", "info", info.id, reconcile(info));
|
|
1219
1266
|
sync.complete(`session:${info.id}`);
|
|
1220
1267
|
registerSession(info.id);
|
|
@@ -1277,10 +1324,13 @@ function createData2(config) {
|
|
|
1277
1324
|
},
|
|
1278
1325
|
sync(sessionID) {
|
|
1279
1326
|
return sync.run(`session.pending:${sessionID}`, async () => {
|
|
1327
|
+
const started = deletionEpoch;
|
|
1280
1328
|
const updates = new Map;
|
|
1281
1329
|
pendingUpdates.set(sessionID, updates);
|
|
1282
1330
|
try {
|
|
1283
|
-
const snapshot = await api().session.inbox.list({ sessionID });
|
|
1331
|
+
const snapshot = await api().session.inbox.list({ sessionID }).catch(evictMissing);
|
|
1332
|
+
if ((deletedAt.get(sessionID) ?? 0) > started)
|
|
1333
|
+
return;
|
|
1284
1334
|
const current = new Map(snapshot.map((item) => [item.id, item]));
|
|
1285
1335
|
updates.forEach((item, id) => {
|
|
1286
1336
|
if (item === undefined)
|
|
@@ -1317,6 +1367,7 @@ function createData2(config) {
|
|
|
1317
1367
|
const id = payload.id ?? SessionID.create();
|
|
1318
1368
|
const location = payload.location ?? defaultLocation();
|
|
1319
1369
|
const fresh = !store.session.info[id];
|
|
1370
|
+
clearDeleted(id);
|
|
1320
1371
|
if (fresh) {
|
|
1321
1372
|
const now = Date.now();
|
|
1322
1373
|
sessionOutbox.add(id);
|
|
@@ -1423,17 +1474,19 @@ function createData2(config) {
|
|
|
1423
1474
|
},
|
|
1424
1475
|
sync(sessionID, options) {
|
|
1425
1476
|
return sync.run(options?.children ? `session.family:${sessionID}` : `session:${sessionID}`, async () => {
|
|
1477
|
+
const started = deletionEpoch;
|
|
1426
1478
|
const [info, children] = await Promise.all([
|
|
1427
|
-
api().session.get({ sessionID }),
|
|
1479
|
+
api().session.get({ sessionID }).catch(evictMissing),
|
|
1428
1480
|
options?.children ? listChildren({ parentID: sessionID, order: "desc", limit: CHILD_PAGE }) : []
|
|
1429
1481
|
]);
|
|
1430
|
-
const sessions = [info, ...children];
|
|
1482
|
+
const sessions = [info, ...children].filter((session) => (deletedAt.get(session.id) ?? 0) <= started);
|
|
1431
1483
|
batch(() => {
|
|
1432
1484
|
setStore("session", "info", produce((draft) => {
|
|
1433
1485
|
for (const session of sessions)
|
|
1434
1486
|
draft[session.id] = session;
|
|
1435
1487
|
}));
|
|
1436
1488
|
for (const session of sessions) {
|
|
1489
|
+
clearDeleted(session.id);
|
|
1437
1490
|
sync.complete(`session:${session.id}`);
|
|
1438
1491
|
registerSession(session.id);
|
|
1439
1492
|
}
|
|
@@ -1454,11 +1507,14 @@ function createData2(config) {
|
|
|
1454
1507
|
},
|
|
1455
1508
|
sync(sessionID) {
|
|
1456
1509
|
return sync.run(`session.message:${sessionID}`, async () => {
|
|
1510
|
+
const started = deletionEpoch;
|
|
1457
1511
|
const response = await api().message.list({
|
|
1458
1512
|
sessionID,
|
|
1459
1513
|
limit: config.initialMessageLimit?.() ?? messagePageLimit,
|
|
1460
1514
|
order: "desc"
|
|
1461
|
-
});
|
|
1515
|
+
}).catch(evictMissing);
|
|
1516
|
+
if ((deletedAt.get(sessionID) ?? 0) > started)
|
|
1517
|
+
return;
|
|
1462
1518
|
const fetched = response.data.toReversed().map(stored);
|
|
1463
1519
|
const ids = new Set(fetched.map((item) => item.id));
|
|
1464
1520
|
const admitted = new Set((store.session.pending[sessionID] ?? []).flatMap((item) => item.type === "user" || item.type === "synthetic" ? [item.id] : []));
|
|
@@ -1547,7 +1603,11 @@ function createData2(config) {
|
|
|
1547
1603
|
},
|
|
1548
1604
|
sync(sessionID) {
|
|
1549
1605
|
return sync.run(`session.permission:${sessionID}`, async () => {
|
|
1550
|
-
|
|
1606
|
+
const started = deletionEpoch;
|
|
1607
|
+
const list = await api().permission.list({ sessionID }).catch(evictMissing);
|
|
1608
|
+
if ((deletedAt.get(sessionID) ?? 0) > started)
|
|
1609
|
+
return;
|
|
1610
|
+
setStore("session", "permission", sessionID, list);
|
|
1551
1611
|
});
|
|
1552
1612
|
},
|
|
1553
1613
|
invalidate(sessionID) {
|
|
@@ -1591,7 +1651,11 @@ function createData2(config) {
|
|
|
1591
1651
|
]);
|
|
1592
1652
|
return;
|
|
1593
1653
|
}
|
|
1594
|
-
|
|
1654
|
+
const started = deletionEpoch;
|
|
1655
|
+
const list = await api().session.form.list({ sessionID }).catch(evictMissing);
|
|
1656
|
+
if ((deletedAt.get(sessionID) ?? 0) > started)
|
|
1657
|
+
return;
|
|
1658
|
+
setStore("session", "form", sessionID, list);
|
|
1595
1659
|
});
|
|
1596
1660
|
},
|
|
1597
1661
|
invalidate(sessionID, ref) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
make7
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-gecjxyvt.js";
|
|
4
4
|
import {
|
|
5
5
|
make6
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-0e3ghr9a.js";
|
|
7
7
|
import {
|
|
8
8
|
makeRpc2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./contract-kdshn947.js";
|
|
10
10
|
import {
|
|
11
11
|
__export
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./contract-9rqn6x4v.js";
|
|
13
13
|
|
|
14
14
|
// src/promise/client.ts
|
|
15
15
|
var exports_client3 = {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientApi2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-60xe5cbf.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientError2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-y2etg5bs.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./contract-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/effect/generated/client.ts
|
|
12
12
|
var exports_client2 = {};
|
|
13
13
|
__export(exports_client2, {
|
|
14
|
-
make: () =>
|
|
14
|
+
make: () => make3
|
|
15
15
|
});
|
|
16
16
|
import { Effect, Stream, Schema } from "effect";
|
|
17
17
|
import { Sse } from "effect/encoding";
|
|
@@ -788,6 +788,6 @@ var adaptClient = (raw) => {
|
|
|
788
788
|
}
|
|
789
789
|
};
|
|
790
790
|
};
|
|
791
|
-
var
|
|
791
|
+
var make3 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
|
|
792
792
|
|
|
793
|
-
export {
|
|
793
|
+
export { make3, exports_client2 };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/promise/media.ts
|
|
2
|
+
var MEDIA_URI_CAPABILITY = "experimental-media-uri";
|
|
3
|
+
var CAPABILITIES_HEADER = "X-OpenCode-Capabilities";
|
|
4
|
+
var MEDIA_REF = /^media:([0-9a-f]{64})$/;
|
|
5
|
+
function mediaHashFromUri2(uri) {
|
|
6
|
+
if (!uri)
|
|
7
|
+
return;
|
|
8
|
+
return MEDIA_REF.exec(uri)?.[1];
|
|
9
|
+
}
|
|
10
|
+
function withMediaRefs2(api) {
|
|
11
|
+
return {
|
|
12
|
+
...api,
|
|
13
|
+
message: {
|
|
14
|
+
...api.message,
|
|
15
|
+
list: (input, options) => api.message.list(input, mediaRefOptions(options))
|
|
16
|
+
},
|
|
17
|
+
session: {
|
|
18
|
+
...api.session,
|
|
19
|
+
message: {
|
|
20
|
+
...api.session.message,
|
|
21
|
+
get: (input, options) => api.session.message.get(input, mediaRefOptions(options))
|
|
22
|
+
},
|
|
23
|
+
inbox: {
|
|
24
|
+
...api.session.inbox,
|
|
25
|
+
list: (input, options) => api.session.inbox.list(input, mediaRefOptions(options))
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function mediaRefOptions(options) {
|
|
31
|
+
if (options?.mediaRefs === false)
|
|
32
|
+
return options;
|
|
33
|
+
const headers = new Headers(options?.headers);
|
|
34
|
+
headers.set(CAPABILITIES_HEADER, MEDIA_URI_CAPABILITY);
|
|
35
|
+
return { ...options, headers };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { mediaHashFromUri2, withMediaRefs2 };
|
|
@@ -1,4 +1,45 @@
|
|
|
1
1
|
// src/solid/pty.ts
|
|
2
|
+
import { PersistentPty } from "@opencode/schema/persistent-pty";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
var PersistentPtyMessage2 = Schema.Union([
|
|
5
|
+
Schema.Struct({
|
|
6
|
+
type: Schema.Literal("attached"),
|
|
7
|
+
inputProtocol: Schema.optional(Schema.Number),
|
|
8
|
+
info: Schema.Struct({ size: PersistentPty.Info.fields.size }),
|
|
9
|
+
role: Schema.optional(Schema.Literals(["controller", "observer"]))
|
|
10
|
+
}),
|
|
11
|
+
Schema.Struct({ type: Schema.Literal("replay_complete") }),
|
|
12
|
+
Schema.Struct({
|
|
13
|
+
type: Schema.Literal("resized"),
|
|
14
|
+
cols: Schema.Number,
|
|
15
|
+
rows: Schema.Number,
|
|
16
|
+
checkpoint: Schema.String
|
|
17
|
+
}),
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal("controller_changed"),
|
|
20
|
+
attachmentID: Schema.optional(Schema.NullOr(Schema.String))
|
|
21
|
+
}),
|
|
22
|
+
Schema.Struct({
|
|
23
|
+
type: Schema.Literal("exited"),
|
|
24
|
+
exitCode: Schema.optional(Schema.NullOr(Schema.Number))
|
|
25
|
+
}),
|
|
26
|
+
Schema.Struct({ type: Schema.Literal("title_changed"), title: Schema.String }),
|
|
27
|
+
Schema.Struct({ type: Schema.Literal("foreground_process_changed"), process: Schema.NullOr(Schema.String) })
|
|
28
|
+
]);
|
|
29
|
+
var decodeMessage = Schema.decodeUnknownOption(Schema.fromJsonString(PersistentPtyMessage2));
|
|
30
|
+
function decodePersistentPtyMessage2(text) {
|
|
31
|
+
return decodeMessage(text);
|
|
32
|
+
}
|
|
33
|
+
function persistentPtyFrame2(size, data) {
|
|
34
|
+
const frame = new Uint8Array(5 + (data?.byteLength ?? 0));
|
|
35
|
+
const view = new DataView(frame.buffer);
|
|
36
|
+
frame[0] = data ? 1 : 0;
|
|
37
|
+
view.setUint16(1, size.cols);
|
|
38
|
+
view.setUint16(3, size.rows);
|
|
39
|
+
if (data)
|
|
40
|
+
frame.set(data, 5);
|
|
41
|
+
return frame;
|
|
42
|
+
}
|
|
2
43
|
function createPtyClient2(api, options) {
|
|
3
44
|
return {
|
|
4
45
|
async connect(input) {
|
|
@@ -47,4 +88,4 @@ function createPersistentPtyClient2(api, options) {
|
|
|
47
88
|
};
|
|
48
89
|
}
|
|
49
90
|
|
|
50
|
-
export { createPtyClient2, createPersistentPtyClient2 };
|
|
91
|
+
export { PersistentPtyMessage2, decodePersistentPtyMessage2, persistentPtyFrame2, createPtyClient2, createPersistentPtyClient2 };
|
package/dist/contract.js
CHANGED
package/dist/effect/client.d.ts
CHANGED
|
@@ -65,6 +65,9 @@ export declare const make: (options?: {
|
|
|
65
65
|
};
|
|
66
66
|
readonly tz: string;
|
|
67
67
|
readonly if?: {
|
|
68
|
+
readonly type: "code";
|
|
69
|
+
readonly code: string;
|
|
70
|
+
} | {
|
|
68
71
|
readonly type: "shell";
|
|
69
72
|
readonly run: string;
|
|
70
73
|
readonly is?: string | undefined;
|
|
@@ -72,6 +75,9 @@ export declare const make: (options?: {
|
|
|
72
75
|
readonly changes?: boolean | undefined;
|
|
73
76
|
} | undefined;
|
|
74
77
|
readonly until?: {
|
|
78
|
+
readonly type: "code";
|
|
79
|
+
readonly code: string;
|
|
80
|
+
} | {
|
|
75
81
|
readonly type: "shell";
|
|
76
82
|
readonly run: string;
|
|
77
83
|
readonly is?: string | undefined;
|
|
@@ -119,6 +125,9 @@ export declare const make: (options?: {
|
|
|
119
125
|
};
|
|
120
126
|
readonly tz: string;
|
|
121
127
|
readonly if?: {
|
|
128
|
+
readonly type: "code";
|
|
129
|
+
readonly code: string;
|
|
130
|
+
} | {
|
|
122
131
|
readonly type: "shell";
|
|
123
132
|
readonly run: string;
|
|
124
133
|
readonly is?: string | undefined;
|
|
@@ -126,6 +135,9 @@ export declare const make: (options?: {
|
|
|
126
135
|
readonly changes?: boolean | undefined;
|
|
127
136
|
} | undefined;
|
|
128
137
|
readonly until?: {
|
|
138
|
+
readonly type: "code";
|
|
139
|
+
readonly code: string;
|
|
140
|
+
} | {
|
|
129
141
|
readonly type: "shell";
|
|
130
142
|
readonly run: string;
|
|
131
143
|
readonly is?: string | undefined;
|
|
@@ -172,6 +184,9 @@ export declare const make: (options?: {
|
|
|
172
184
|
};
|
|
173
185
|
readonly tz: string;
|
|
174
186
|
readonly if?: {
|
|
187
|
+
readonly type: "code";
|
|
188
|
+
readonly code: string;
|
|
189
|
+
} | {
|
|
175
190
|
readonly type: "shell";
|
|
176
191
|
readonly run: string;
|
|
177
192
|
readonly is?: string | undefined;
|
|
@@ -179,6 +194,9 @@ export declare const make: (options?: {
|
|
|
179
194
|
readonly changes?: boolean | undefined;
|
|
180
195
|
} | undefined;
|
|
181
196
|
readonly until?: {
|
|
197
|
+
readonly type: "code";
|
|
198
|
+
readonly code: string;
|
|
199
|
+
} | {
|
|
182
200
|
readonly type: "shell";
|
|
183
201
|
readonly run: string;
|
|
184
202
|
readonly is?: string | undefined;
|
|
@@ -225,6 +243,9 @@ export declare const make: (options?: {
|
|
|
225
243
|
};
|
|
226
244
|
readonly tz: string;
|
|
227
245
|
readonly if?: {
|
|
246
|
+
readonly type: "code";
|
|
247
|
+
readonly code: string;
|
|
248
|
+
} | {
|
|
228
249
|
readonly type: "shell";
|
|
229
250
|
readonly run: string;
|
|
230
251
|
readonly is?: string | undefined;
|
|
@@ -232,6 +253,9 @@ export declare const make: (options?: {
|
|
|
232
253
|
readonly changes?: boolean | undefined;
|
|
233
254
|
} | undefined;
|
|
234
255
|
readonly until?: {
|
|
256
|
+
readonly type: "code";
|
|
257
|
+
readonly code: string;
|
|
258
|
+
} | {
|
|
235
259
|
readonly type: "shell";
|
|
236
260
|
readonly run: string;
|
|
237
261
|
readonly is?: string | undefined;
|
package/dist/effect/client.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
make2,
|
|
3
3
|
exports_client
|
|
4
|
-
} from "../chunks/
|
|
5
|
-
import"../chunks/
|
|
6
|
-
import"../chunks/
|
|
7
|
-
import"../chunks/
|
|
8
|
-
import"../chunks/
|
|
9
|
-
import"../chunks/
|
|
10
|
-
import"../chunks/
|
|
11
|
-
import"../chunks/
|
|
4
|
+
} from "../chunks/contract-bhbt909k.js";
|
|
5
|
+
import"../chunks/contract-6mptkzbc.js";
|
|
6
|
+
import"../chunks/contract-gxr0nf8c.js";
|
|
7
|
+
import"../chunks/contract-y2etg5bs.js";
|
|
8
|
+
import"../chunks/contract-9j12j8xw.js";
|
|
9
|
+
import"../chunks/contract-gecjxyvt.js";
|
|
10
|
+
import"../chunks/contract-60xe5cbf.js";
|
|
11
|
+
import"../chunks/contract-ryy6kscr.js";
|
|
12
12
|
export {
|
|
13
13
|
exports_client as OpenCode,
|
|
14
14
|
make2 as make
|