@theway-ai/sdk 2.2.1 → 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/README.md +2 -2
- package/dist/client.d.ts +3 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -10
- package/dist/client.js.map +1 -1
- package/dist/generated/events.d.ts +3 -3
- package/dist/generated/events.d.ts.map +1 -1
- package/dist/generated/events.js +6 -6
- package/dist/generated/events.js.map +1 -1
- package/dist/generated/graph_engine.d.ts +1 -1
- package/dist/generated/session.d.ts +78 -102
- package/dist/generated/session.d.ts.map +1 -1
- package/dist/generated/session.js +562 -588
- package/dist/generated/session.js.map +1 -1
- package/docs/PROTOCOL.md +15 -12
- package/package.json +1 -1
- package/proto/events.proto +1 -1
- package/proto/graph_engine.proto +1 -1
- package/proto/session.proto +55 -58
package/docs/PROTOCOL.md
CHANGED
|
@@ -50,21 +50,24 @@ the supported values.
|
|
|
50
50
|
|
|
51
51
|
## Pagination
|
|
52
52
|
|
|
53
|
-
###
|
|
53
|
+
### ListSessionMessages
|
|
54
54
|
|
|
55
|
-
Reads a session
|
|
55
|
+
Reads the full message history of a session's active branch page by page.
|
|
56
56
|
|
|
57
57
|
```ts
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
-
|
|
125
|
-
|
|
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.
|
|
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": {
|
package/proto/events.proto
CHANGED
|
@@ -10,7 +10,7 @@ import "session.proto";
|
|
|
10
10
|
// Unified envelope for StreamEvents / WebSocket frames.
|
|
11
11
|
message StreamFrame {
|
|
12
12
|
oneof payload {
|
|
13
|
-
|
|
13
|
+
SessionSnapshot snapshot = 1; // connection start + full resync frames
|
|
14
14
|
StreamEvent event = 2; // high-frequency increment
|
|
15
15
|
}
|
|
16
16
|
}
|
package/proto/graph_engine.proto
CHANGED
|
@@ -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 `
|
|
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 {
|
package/proto/session.proto
CHANGED
|
@@ -9,62 +9,25 @@ import "commands.proto";
|
|
|
9
9
|
import "extensions.proto";
|
|
10
10
|
import "graph_engine.proto";
|
|
11
11
|
|
|
12
|
-
//
|
|
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
|
|
15
|
+
// is a gap and requires a full snapshot resync.
|
|
56
16
|
uint64 index = 1;
|
|
57
17
|
FeedBlock block = 2;
|
|
58
18
|
}
|
|
59
19
|
|
|
60
20
|
// Token usage for the current/last turn, plus the model's context window size.
|
|
61
21
|
message ContextUsage {
|
|
62
|
-
uint64
|
|
63
|
-
uint64
|
|
64
|
-
uint64
|
|
65
|
-
uint64
|
|
66
|
-
uint64
|
|
67
|
-
|
|
22
|
+
uint64 cached_tokens = 1;
|
|
23
|
+
uint64 new_tokens = 2;
|
|
24
|
+
uint64 total_input_tokens = 3;
|
|
25
|
+
uint64 output_tokens = 4;
|
|
26
|
+
uint64 cache_write_tokens = 5;
|
|
27
|
+
optional double provider_cache_hit_rate = 6;
|
|
28
|
+
optional double prefix_cache_hit_rate = 7;
|
|
29
|
+
optional uint64 prefix_hit_tokens = 8;
|
|
30
|
+
uint32 context_window = 9;
|
|
68
31
|
}
|
|
69
32
|
|
|
70
33
|
message ProviderGroup {
|
|
@@ -187,9 +150,10 @@ message FeedBlock {
|
|
|
187
150
|
UserBlock user = 1;
|
|
188
151
|
AssistantBlock assistant = 2;
|
|
189
152
|
ThinkingBlock thinking = 3;
|
|
190
|
-
ToolBlock tool = 4;
|
|
191
153
|
ToolResultBlock tool_result = 5;
|
|
192
154
|
PlainBlock plain = 6;
|
|
155
|
+
ToolCallBlock tool_call = 7;
|
|
156
|
+
ErrorBlock error = 8;
|
|
193
157
|
}
|
|
194
158
|
}
|
|
195
159
|
|
|
@@ -208,10 +172,18 @@ message ThinkingBlock {
|
|
|
208
172
|
optional string timestamp = 2; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
|
|
209
173
|
}
|
|
210
174
|
|
|
211
|
-
message
|
|
175
|
+
message ToolCallBlock {
|
|
212
176
|
string name = 1;
|
|
213
177
|
string args = 2;
|
|
214
|
-
optional string
|
|
178
|
+
optional string metadata = 3; // Optional tool-call metadata (JSON string).
|
|
179
|
+
optional string timestamp = 4; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
message ErrorBlock {
|
|
183
|
+
string message = 1;
|
|
184
|
+
optional string code = 2;
|
|
185
|
+
bool recoverable = 3;
|
|
186
|
+
optional string timestamp = 4; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
|
|
215
187
|
}
|
|
216
188
|
|
|
217
189
|
message ToolResultBlock {
|
|
@@ -243,6 +215,7 @@ message SessionSummary {
|
|
|
243
215
|
optional string preview = 10;
|
|
244
216
|
map<string, string> metadata = 11;
|
|
245
217
|
optional string last_activity_at_rfc3339 = 12; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
|
|
218
|
+
string tree_prefix = 14; // Pi-style tree prefix (`├─ ` / `└─ ` / `│ `) for fork-lineage display.
|
|
246
219
|
}
|
|
247
220
|
|
|
248
221
|
// Thinking levels supported by the runtime.
|
|
@@ -293,6 +266,10 @@ message SessionRuntime {
|
|
|
293
266
|
optional GoalSnapshot goal = 9;
|
|
294
267
|
optional ControlPlanePromptSnapshot control_plane_prompt = 10;
|
|
295
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;
|
|
296
273
|
}
|
|
297
274
|
|
|
298
275
|
// Transcript plane of a session snapshot.
|
|
@@ -322,7 +299,8 @@ message SessionLineage {
|
|
|
322
299
|
optional string collapsed_into_session_id = 6;
|
|
323
300
|
}
|
|
324
301
|
|
|
325
|
-
// Full structured session snapshot: the
|
|
302
|
+
// Full structured session snapshot: the single-version authoritative current
|
|
303
|
+
// state shape served by GetSnapshot and StreamEvents snapshot frames.
|
|
326
304
|
message SessionSnapshot {
|
|
327
305
|
string session_id = 1;
|
|
328
306
|
SessionInfo info = 2;
|
|
@@ -332,6 +310,28 @@ message SessionSnapshot {
|
|
|
332
310
|
SessionLineage lineage = 6;
|
|
333
311
|
}
|
|
334
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
|
+
|
|
335
335
|
// Collapse a session into a graph node, optionally under another session.
|
|
336
336
|
message CollapseSessionRequest {
|
|
337
337
|
string session_id = 1;
|
|
@@ -465,13 +465,10 @@ message ClearCredentialRequest {
|
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
service SessionService {
|
|
468
|
-
// Full
|
|
469
|
-
// clients should use GetSnapshot / GetHistory.
|
|
470
|
-
rpc GetState(SessionStateRequest) returns (SessionState);
|
|
471
|
-
// Full nested session snapshot (session-snapshot-collapse contract).
|
|
468
|
+
// Full nested session snapshot: the single authoritative current snapshot.
|
|
472
469
|
rpc GetSnapshot(SessionStateRequest) returns (SessionSnapshot);
|
|
473
|
-
//
|
|
474
|
-
rpc
|
|
470
|
+
// Cursor-paginated full message history on the session's active branch.
|
|
471
|
+
rpc ListSessionMessages(ListSessionMessagesRequest) returns (SessionMessagePage);
|
|
475
472
|
// Collapse a session into a graph node (session-snapshot-collapse).
|
|
476
473
|
rpc CollapseSession(CollapseSessionRequest) returns (CollapseSessionResponse);
|
|
477
474
|
rpc GetSessionGraphNode(GetSessionGraphNodeRequest) returns (GetSessionGraphNodeResponse);
|