@theway-ai/sdk 2.2.2 → 2.3.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/docs/PROTOCOL.md CHANGED
@@ -50,21 +50,24 @@ the supported values.
50
50
 
51
51
  ## Pagination
52
52
 
53
- ### GetHistory
53
+ ### ListSessionMessages
54
54
 
55
- Reads a session feed page by page.
55
+ Reads the full message history of a session's active branch page by page.
56
56
 
57
57
  ```ts
58
- const res = await client.getHistory({
59
- sessionId: 'sess-1',
60
- offset: 0,
61
- limit: 50,
62
- });
63
- // res.blocks: FeedBlock[]
64
- // res.nextOffset
65
- // res.total?
58
+ const page = await client.listSessionMessages('sess-1', 50);
59
+ // page.blocks: FeedBlock[] (oldest → newest within the page)
60
+ // page.nextBeforeEntryId: string | undefined — pass as beforeEntryId for the
61
+ // previous page
62
+ // page.hasMore: boolean
63
+ // page.total: number
64
+
65
+ const older = await client.listSessionMessages('sess-1', 50, page.nextBeforeEntryId);
66
66
  ```
67
67
 
68
+ The server caps `limit` at 500. `GetSnapshot` carries the current feed
69
+ projection only; full history always goes through `ListSessionMessages`.
70
+
68
71
  ### ListSessionGraphNodeMessages
69
72
 
70
73
  Reads one graph node's structured messages (`FeedBlock` list).
@@ -121,6 +124,6 @@ const res = await client.collapseSession({
121
124
 
122
125
  ## Compatibility
123
126
 
124
- - `getState()` remains available and returns the legacy `SessionState`.
125
- - New code should prefer `getSnapshot()`.
127
+ - The previous flat state / snapshot-shaped history client methods were
128
+ removed; use `getSnapshot()` + `listSessionMessages()`.
126
129
  - `session_id` fields on request messages remain the routing identifier.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theway-ai/sdk",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "TypeScript SDK for the theway gRPC daemon (five theway.grpc.v1 domain services + grpc.health.v1). Typed client for all RPCs, generated from the domain proto files via ts-proto.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,7 +10,7 @@ import "session.proto";
10
10
  // Unified envelope for StreamEvents / WebSocket frames.
11
11
  message StreamFrame {
12
12
  oneof payload {
13
- SessionState snapshot = 1; // connection start + periodic full state
13
+ SessionSnapshot snapshot = 1; // connection start + full resync frames
14
14
  StreamEvent event = 2; // high-frequency increment
15
15
  }
16
16
  }
@@ -138,7 +138,7 @@ message GraphSkipResponse {
138
138
  }
139
139
 
140
140
  // Checkpoints are organized by session: a session owns its runs
141
- // (DagRun.session_id), and `SessionState.dags` mounts the live graph status
141
+ // (DagRun.session_id), and `SessionSnapshot.graph_state.dags` mounts the live graph status
142
142
  // under that session. Checkpoint exports one run or the session's whole graph
143
143
  // set as portable JSON snapshots; restore revives them back under the session.
144
144
  message GraphCheckpointRequest {
@@ -9,50 +9,10 @@ import "commands.proto";
9
9
  import "extensions.proto";
10
10
  import "graph_engine.proto";
11
11
 
12
- // Full session state (the structured form of the former WireSnapshot JSON).
13
- // Low-frequency, whole-replacement: GetState / stream snapshot frames.
14
- message SessionState {
15
- string session_id = 1;
16
- string model = 2;
17
- repeated ProviderGroup model_catalog = 3;
18
- string cwd = 4;
19
- bool busy = 5;
20
- uint32 queued_count = 6;
21
- optional TriggerPollStatus latest_trigger_poll = 7;
22
- optional GoalSnapshot goal = 8;
23
- optional ControlPlanePromptSnapshot control_plane_prompt = 9;
24
- SidebarSnapshot sidebar = 10;
25
- repeated FeedBlock feed_blocks = 11;
26
- repeated string feed_lines = 12;
27
- // graph mode (P1/P2 fill these):
28
- repeated DagRunSnapshot dags = 13;
29
- repeated SubagentJobSnapshot subagents = 14;
30
- // TUI display settings pushed from the daemon (read from config.toml).
31
- optional uint32 tui_max_feed_lines = 15;
32
- // Token usage + context window for the live session.
33
- optional ContextUsage context_usage = 16;
34
- // Absolute index of feed_lines[0] in the full transcript (issue #35):
35
- // stream snapshots carry only rows appended since the last publish; the
36
- // initial get_state snapshot carries everything (base 0).
37
- uint64 feed_lines_base = 17;
38
- // Incremental gRPC snapshot frames require this many blocks to already be
39
- // present on the consumer. Zero denotes a full replacement frame.
40
- uint64 feed_blocks_base = 18;
41
- // Appends/replacements since feed_blocks_base. Full frames leave this empty.
42
- repeated FeedBlockPatch feed_block_patches = 19;
43
- // Runtime-extension status is additive; older clients ignore this field.
44
- ExtensionSnapshot extensions = 20;
45
- // Session-cumulative token usage: total input, cached input, non-cached
46
- // input, output, and cache write totals for the current session.
47
- ContextUsage session_context_usage = 21;
48
- // Active thinking level ("off" | "minimal" | "low" | "medium" | "high" |
49
- // "xhigh"); empty for older daemons.
50
- string thinking_level = 22;
51
- }
52
-
12
+ // Incremental transcript patch: appends/replacements since a consumer cursor.
53
13
  message FeedBlockPatch {
54
14
  // index == consumer length appends; index < length replaces; index > length
55
- // is a gap and requires a full GetState resync.
15
+ // is a gap and requires a full snapshot resync.
56
16
  uint64 index = 1;
57
17
  FeedBlock block = 2;
58
18
  }
@@ -306,6 +266,10 @@ message SessionRuntime {
306
266
  optional GoalSnapshot goal = 9;
307
267
  optional ControlPlanePromptSnapshot control_plane_prompt = 10;
308
268
  ExtensionSnapshot extensions = 11;
269
+ // Full rendered system context for the next request (base prompt + skills +
270
+ // tool inventory + working directory + memory + lineage). Mirrors the
271
+ // request/header epoch snapshot in deepseek-harness session logs.
272
+ string system_context = 12;
309
273
  }
310
274
 
311
275
  // Transcript plane of a session snapshot.
@@ -335,7 +299,8 @@ message SessionLineage {
335
299
  optional string collapsed_into_session_id = 6;
336
300
  }
337
301
 
338
- // Full structured session snapshot: the nested successor of SessionState.
302
+ // Full structured session snapshot: the single-version authoritative current
303
+ // state shape served by GetSnapshot and StreamEvents snapshot frames.
339
304
  message SessionSnapshot {
340
305
  string session_id = 1;
341
306
  SessionInfo info = 2;
@@ -345,6 +310,28 @@ message SessionSnapshot {
345
310
  SessionLineage lineage = 6;
346
311
  }
347
312
 
313
+ // Cursor-paginated read of the session's full message history. Entries are
314
+ // addressed by storage entry id; `before_entry_id` returns the page of
315
+ // message blocks strictly older than that entry.
316
+ message ListSessionMessagesRequest {
317
+ string session_id = 1;
318
+ // Omitted = newest page of the active branch.
319
+ optional string before_entry_id = 2;
320
+ // Page size; server caps at 500.
321
+ uint32 limit = 3;
322
+ }
323
+
324
+ message SessionMessagePage {
325
+ string session_id = 1;
326
+ // Oldest → newest within the page.
327
+ repeated FeedBlock blocks = 2;
328
+ // Entry id of the oldest message in this page; empty when no older page.
329
+ optional string next_before_entry_id = 3;
330
+ bool has_more = 4;
331
+ // Total message count on the active branch.
332
+ uint64 total = 5;
333
+ }
334
+
348
335
  // Collapse a session into a graph node, optionally under another session.
349
336
  message CollapseSessionRequest {
350
337
  string session_id = 1;
@@ -478,13 +465,10 @@ message ClearCredentialRequest {
478
465
  }
479
466
 
480
467
  service SessionService {
481
- // Full structured state (binary protobuf). Kept for compatibility; new
482
- // clients should use GetSnapshot / GetHistory.
483
- rpc GetState(SessionStateRequest) returns (SessionState);
484
- // Full nested session snapshot (session-snapshot-collapse contract).
468
+ // Full nested session snapshot: the single authoritative current snapshot.
485
469
  rpc GetSnapshot(SessionStateRequest) returns (SessionSnapshot);
486
- // Session history as a snapshot-shaped transcript (session-snapshot-collapse).
487
- rpc GetHistory(SessionStateRequest) returns (SessionSnapshot);
470
+ // Cursor-paginated full message history on the session's active branch.
471
+ rpc ListSessionMessages(ListSessionMessagesRequest) returns (SessionMessagePage);
488
472
  // Collapse a session into a graph node (session-snapshot-collapse).
489
473
  rpc CollapseSession(CollapseSessionRequest) returns (CollapseSessionResponse);
490
474
  rpc GetSessionGraphNode(GetSessionGraphNodeRequest) returns (GetSessionGraphNodeResponse);