@opencode-ai/client 0.0.0-dev-17534 → 0.0.0-dev-17582

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.
@@ -36,16 +36,6 @@ export declare function createData(config: CreateDataInput): {
36
36
  get(sessionID: string): SessionInfo;
37
37
  remember(info: SessionInfo): void;
38
38
  setStatus(sessionID: string, status: DataSessionStatus): void;
39
- lineage: {
40
- peek(sessionID: string): {
41
- session: SessionInfo;
42
- root: SessionInfo;
43
- } | undefined;
44
- resolve(sessionID: string): Promise<{
45
- session: SessionInfo;
46
- root: SessionInfo;
47
- }>;
48
- };
49
39
  root(sessionID: string): string;
50
40
  family(sessionID: string): string[];
51
41
  cost(sessionID: string): number;
@@ -67,6 +57,9 @@ export declare function createData(config: CreateDataInput): {
67
57
  list(sessionID: string): SessionMessageInfo[];
68
58
  get(sessionID: string, messageID: string): SessionMessageInfo | undefined;
69
59
  sync(sessionID: string): Promise<void>;
60
+ more(sessionID: string): boolean;
61
+ loading(sessionID: string): boolean;
62
+ loadMore(sessionID: string): Promise<void>;
70
63
  invalidate(sessionID: string): void;
71
64
  };
72
65
  permission: {
@@ -56,6 +56,8 @@ export function createData(config) {
56
56
  family: {},
57
57
  active: {},
58
58
  message: {},
59
+ messageCursor: {},
60
+ messageLoading: {},
59
61
  pending: {},
60
62
  input: {},
61
63
  permission: {},
@@ -206,6 +208,8 @@ export function createData(config) {
206
208
  delete draft.info[sessionID];
207
209
  delete draft.active[sessionID];
208
210
  delete draft.message[sessionID];
211
+ delete draft.messageCursor[sessionID];
212
+ delete draft.messageLoading[sessionID];
209
213
  delete draft.pending[sessionID];
210
214
  delete draft.input[sessionID];
211
215
  delete draft.permission[sessionID];
@@ -885,44 +889,6 @@ export function createData(config) {
885
889
  setStatus(sessionID, status) {
886
890
  setSessionActive(sessionID, status);
887
891
  },
888
- lineage: {
889
- peek(sessionID) {
890
- const session = store.session.info[sessionID];
891
- if (!session)
892
- return;
893
- const seen = new Set([session.id]);
894
- let root = session;
895
- while (root.parentID) {
896
- if (seen.has(root.parentID))
897
- return { session, root };
898
- seen.add(root.parentID);
899
- const parent = store.session.info[root.parentID];
900
- if (!parent)
901
- return;
902
- root = parent;
903
- }
904
- return { session, root };
905
- },
906
- async resolve(sessionID) {
907
- await result.session.sync(sessionID);
908
- const session = store.session.info[sessionID];
909
- if (!session)
910
- throw new Error(`Session not found: ${sessionID}`);
911
- const seen = new Set([session.id]);
912
- let root = session;
913
- while (root.parentID) {
914
- if (seen.has(root.parentID))
915
- return { session, root };
916
- seen.add(root.parentID);
917
- await result.session.sync(root.parentID);
918
- const parent = store.session.info[root.parentID];
919
- if (!parent)
920
- throw new Error(`Session not found: ${root.parentID}`);
921
- root = parent;
922
- }
923
- return { session, root };
924
- },
925
- },
926
892
  root(sessionID) {
927
893
  return resolveRoot(sessionID);
928
894
  },
@@ -998,11 +964,35 @@ export function createData(config) {
998
964
  },
999
965
  sync(sessionID) {
1000
966
  return sync.run(`session.message:${sessionID}`, async () => {
1001
- const messages = (await api().message.list({ sessionID, limit: 200, order: "desc" })).data.toReversed();
967
+ const response = await api().message.list({ sessionID, limit: 200, order: "desc" });
968
+ const messages = response.data.toReversed();
1002
969
  messageIndex.set(sessionID, new Map(messages.map((message, index) => [message.id, index])));
1003
970
  setStore("session", "message", sessionID, reconcile(messages));
971
+ setStore("session", "messageCursor", sessionID, response.cursor.next ?? undefined);
1004
972
  });
1005
973
  },
974
+ more(sessionID) {
975
+ return store.session.messageCursor[sessionID] !== undefined;
976
+ },
977
+ loading(sessionID) {
978
+ return store.session.messageLoading[sessionID] ?? false;
979
+ },
980
+ async loadMore(sessionID) {
981
+ const cursor = store.session.messageCursor[sessionID];
982
+ if (!cursor || store.session.messageLoading[sessionID])
983
+ return;
984
+ setStore("session", "messageLoading", sessionID, true);
985
+ const response = await api()
986
+ .message.list({ sessionID, limit: 200, order: "desc", cursor })
987
+ .finally(() => setStore("session", "messageLoading", sessionID, false));
988
+ const older = response.data.toReversed();
989
+ const existing = store.session.message[sessionID] ?? [];
990
+ const ids = new Set(existing.map((item) => item.id));
991
+ const messages = [...older.filter((item) => !ids.has(item.id)), ...existing];
992
+ messageIndex.set(sessionID, new Map(messages.map((item, position) => [item.id, position])));
993
+ setStore("session", "message", sessionID, reconcile(messages));
994
+ setStore("session", "messageCursor", sessionID, response.cursor.next ?? undefined);
995
+ },
1006
996
  invalidate(sessionID) {
1007
997
  sync.invalidate(`session.message:${sessionID}`);
1008
998
  },
@@ -1303,6 +1293,8 @@ export function createData(config) {
1303
1293
  const response = await api().model.list({ location: locationQuery(ref ?? defaultLocation()) });
1304
1294
  const key = locationKey(response.location);
1305
1295
  setStore("location", key, { ...store.location[key], model: response.data });
1296
+ if (key !== id)
1297
+ setStore("location", id, { ...store.location[id], model: response.data });
1306
1298
  });
1307
1299
  },
1308
1300
  invalidate(ref) {
@@ -1319,6 +1311,8 @@ export function createData(config) {
1319
1311
  const response = await api().provider.list({ location: locationQuery(ref ?? defaultLocation()) });
1320
1312
  const key = locationKey(response.location);
1321
1313
  setStore("location", key, { ...store.location[key], provider: response.data });
1314
+ if (key !== id)
1315
+ setStore("location", id, { ...store.location[id], provider: response.data });
1322
1316
  });
1323
1317
  },
1324
1318
  invalidate(ref) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/client",
4
- "version": "0.0.0-dev-17534",
4
+ "version": "0.0.0-dev-17582",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -57,11 +57,11 @@
57
57
  "typecheck": "tsgo --noEmit"
58
58
  },
59
59
  "dependencies": {
60
- "@opencode-ai/schema": "0.0.0-dev-17534",
61
- "@opencode-ai/protocol": "0.0.0-dev-17534"
60
+ "@opencode-ai/schema": "0.0.0-dev-17582",
61
+ "@opencode-ai/protocol": "0.0.0-dev-17582"
62
62
  },
63
63
  "peerDependencies": {
64
- "effect": "4.0.0-beta.101",
64
+ "effect": "4.0.0-beta.107",
65
65
  "solid-js": ">=1.9.0"
66
66
  },
67
67
  "peerDependenciesMeta": {
@@ -73,12 +73,12 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@effect/platform-node": "4.0.0-beta.101",
77
- "@opencode-ai/httpapi-codegen": "0.0.0-dev-17534",
76
+ "@effect/platform-node": "4.0.0-beta.107",
77
+ "@opencode-ai/httpapi-codegen": "0.0.0-dev-17582",
78
78
  "@tsconfig/bun": "1.0.9",
79
79
  "@types/bun": "1.3.13",
80
80
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
81
- "effect": "4.0.0-beta.101",
81
+ "effect": "4.0.0-beta.107",
82
82
  "solid-js": "1.9.10"
83
83
  }
84
84
  }