@theway-ai/sdk 2.0.0 → 2.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theway-ai/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.2.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": {
@@ -180,6 +180,43 @@ message GraphListResponse {
180
180
  repeated DagRunSnapshot runs = 1;
181
181
  }
182
182
 
183
+ // Node type in a session graph.
184
+ enum SessionGraphNodeType {
185
+ SESSION_GRAPH_NODE_TYPE_UNSPECIFIED = 0;
186
+ SESSION_GRAPH_NODE_TYPE_SESSION = 1;
187
+ SESSION_GRAPH_NODE_TYPE_COLLAPSED = 2;
188
+ }
189
+
190
+ // A node in the session graph. Session nodes represent live sessions;
191
+ // collapsed nodes represent archived sessions folded into another session.
192
+ message SessionGraphNode {
193
+ string id = 1;
194
+ string session_id = 2;
195
+ SessionGraphNodeType type = 3;
196
+ string title = 4;
197
+ string summary = 5;
198
+ optional string parent_node_id = 6;
199
+ repeated string child_node_ids = 7;
200
+ optional string collapsed_session_id = 8;
201
+ optional string collapsed_at = 9; // RFC3339 / ISO-8601 with offset (UTC).
202
+ optional string created_at = 10;
203
+ optional string updated_at = 11;
204
+ uint32 message_count = 12;
205
+ }
206
+
207
+ // Detailed record for a session that has been collapsed into another session.
208
+ message CollapsedSessionNode {
209
+ string node_id = 1;
210
+ string session_id = 2;
211
+ string title = 3;
212
+ string summary = 4;
213
+ uint32 message_count = 5;
214
+ optional string collapsed_at = 6; // RFC3339 / ISO-8601 with offset (UTC).
215
+ optional string collapsed_into_session_id = 7;
216
+ optional string collapsed_into_node_id = 8;
217
+ repeated string original_session_ids = 9;
218
+ }
219
+
183
220
  service GraphEngineService {
184
221
  // Fetch a DAG node's full output from an offset (P3).
185
222
  rpc GetNodeOutput(GetNodeOutputRequest) returns (GetNodeOutputResponse);
@@ -195,49 +195,188 @@ message FeedBlock {
195
195
 
196
196
  message UserBlock {
197
197
  string text = 1;
198
- optional string timestamp = 2;
198
+ optional string timestamp = 2; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
199
199
  }
200
200
 
201
201
  message AssistantBlock {
202
202
  string text = 1;
203
- optional string timestamp = 2;
203
+ optional string timestamp = 2; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
204
204
  }
205
205
 
206
206
  message ThinkingBlock {
207
207
  string text = 1;
208
- optional string timestamp = 2;
208
+ optional string timestamp = 2; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
209
209
  }
210
210
 
211
211
  message ToolBlock {
212
212
  string name = 1;
213
213
  string args = 2;
214
- optional string timestamp = 3;
214
+ optional string timestamp = 3; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
215
215
  }
216
216
 
217
217
  message ToolResultBlock {
218
218
  repeated string lines = 1;
219
219
  bool is_error = 2;
220
- optional string timestamp = 3;
220
+ optional string timestamp = 3; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
221
221
  }
222
222
 
223
223
  message PlainBlock {
224
224
  string text = 1;
225
225
  string level = 2; // "output" | "system" | "error" | "note" (serde snake_case variant names)
226
- optional string timestamp = 3;
226
+ optional string timestamp = 3; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
227
227
  }
228
228
 
229
229
  message SessionSummary {
230
+ // Canonical session id. New clients should use this field; `session_id`
231
+ // remains as a deprecated alias for compatibility with older consumers.
232
+ string id = 13;
233
+ // Compatibility alias; new clients should read `id`.
230
234
  string session_id = 1;
231
235
  string name = 2;
232
236
  string cwd = 3;
233
237
  string model = 4;
234
- string created_at = 5;
235
- int64 last_activity_at = 6;
238
+ string created_at = 5; // RFC3339 / ISO-8601 with offset (UTC).
239
+ int64 last_activity_at = 6; // Deprecated epoch milliseconds; use last_activity_at_rfc3339.
236
240
  uint32 graph_count = 7;
237
241
  uint32 active_graph_count = 8;
238
242
  bool busy = 9;
239
243
  optional string preview = 10;
240
244
  map<string, string> metadata = 11;
245
+ optional string last_activity_at_rfc3339 = 12; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
246
+ }
247
+
248
+ // Thinking levels supported by the runtime.
249
+ enum ThinkingLevel {
250
+ THINKING_LEVEL_UNSPECIFIED = 0;
251
+ THINKING_LEVEL_OFF = 1;
252
+ THINKING_LEVEL_MINIMAL = 2;
253
+ THINKING_LEVEL_LOW = 3;
254
+ THINKING_LEVEL_MEDIUM = 4;
255
+ THINKING_LEVEL_HIGH = 5;
256
+ THINKING_LEVEL_XHIGH = 6;
257
+ }
258
+
259
+ // A resolved model reference in a session runtime.
260
+ message ModelRef {
261
+ string provider = 1;
262
+ string model = 2;
263
+ optional string base_url = 3;
264
+ }
265
+
266
+ // Static/dynamic session identity and display metadata.
267
+ message SessionInfo {
268
+ string id = 1;
269
+ string name = 2;
270
+ string cwd = 3;
271
+ string created_at = 4; // RFC3339 / ISO-8601 with offset (UTC).
272
+ int64 last_activity_at = 5; // Deprecated epoch milliseconds.
273
+ optional string last_activity_at_rfc3339 = 6; // RFC3339 / ISO-8601 with offset (UTC), null when absent.
274
+ bool busy = 7;
275
+ optional string preview = 8;
276
+ map<string, string> metadata = 9;
277
+ uint32 graph_count = 10;
278
+ uint32 active_graph_count = 11;
279
+ uint32 queued_count = 12;
280
+ SidebarSnapshot sidebar = 13;
281
+ }
282
+
283
+ // Live runtime configuration and model/context metadata.
284
+ message SessionRuntime {
285
+ ModelRef model = 1;
286
+ ThinkingLevel thinking_level = 2;
287
+ repeated ThinkingLevel supported_thinking_levels = 3;
288
+ optional ContextUsage context_usage = 4;
289
+ optional ContextUsage session_context_usage = 5;
290
+ optional uint32 tui_max_feed_lines = 6;
291
+ repeated ProviderGroup model_catalog = 7;
292
+ optional TriggerPollStatus latest_trigger_poll = 8;
293
+ optional GoalSnapshot goal = 9;
294
+ optional ControlPlanePromptSnapshot control_plane_prompt = 10;
295
+ ExtensionSnapshot extensions = 11;
296
+ }
297
+
298
+ // Transcript plane of a session snapshot.
299
+ message SessionFeed {
300
+ repeated FeedBlock blocks = 1;
301
+ repeated string lines = 2;
302
+ uint64 blocks_base = 3;
303
+ uint64 lines_base = 4;
304
+ repeated FeedBlockPatch block_patches = 5;
305
+ }
306
+
307
+ // Graph-mode state mounted under a session snapshot.
308
+ message SessionGraphState {
309
+ repeated DagRunSnapshot dags = 1;
310
+ repeated SubagentJobSnapshot subagents = 2;
311
+ repeated SessionGraphNode nodes = 3;
312
+ optional string active_node_id = 4;
313
+ }
314
+
315
+ // Session lineage for fork/collapse ancestry.
316
+ message SessionLineage {
317
+ optional string parent_session_id = 1;
318
+ optional string root_session_id = 2;
319
+ repeated string ancestor_session_ids = 3;
320
+ repeated string child_session_ids = 4;
321
+ optional string collapsed_from_session_id = 5;
322
+ optional string collapsed_into_session_id = 6;
323
+ }
324
+
325
+ // Full structured session snapshot: the nested successor of SessionState.
326
+ message SessionSnapshot {
327
+ string session_id = 1;
328
+ SessionInfo info = 2;
329
+ SessionRuntime runtime = 3;
330
+ SessionFeed feed = 4;
331
+ SessionGraphState graph_state = 5;
332
+ SessionLineage lineage = 6;
333
+ }
334
+
335
+ // Collapse a session into a graph node, optionally under another session.
336
+ message CollapseSessionRequest {
337
+ string session_id = 1;
338
+ optional string into_session_id = 2;
339
+ optional string title = 3;
340
+ optional string summary = 4;
341
+ }
342
+
343
+ message CollapseSessionResponse {
344
+ string session_id = 1;
345
+ SessionGraphNode node = 2;
346
+ CollapsedSessionNode collapsed = 3;
347
+ }
348
+
349
+ message GetSessionGraphNodeRequest {
350
+ string session_id = 1;
351
+ string node_id = 2;
352
+ }
353
+
354
+ message GetSessionGraphNodeResponse {
355
+ SessionGraphNode node = 1;
356
+ }
357
+
358
+ message ListSessionGraphNodeMessagesRequest {
359
+ string session_id = 1;
360
+ string node_id = 2;
361
+ uint32 offset = 3;
362
+ uint32 limit = 4;
363
+ }
364
+
365
+ message ListSessionGraphNodeMessagesResponse {
366
+ repeated FeedBlock blocks = 1;
367
+ }
368
+
369
+ message StreamSessionGraphNodeRequest {
370
+ string session_id = 1;
371
+ string node_id = 2;
372
+ }
373
+
374
+ // Streaming frame for node changes and message appends.
375
+ message SessionGraphNodeStreamFrame {
376
+ oneof payload {
377
+ SessionGraphNode node = 1;
378
+ FeedBlock block = 2;
379
+ }
241
380
  }
242
381
 
243
382
  message SessionStateRequest {
@@ -326,8 +465,18 @@ message ClearCredentialRequest {
326
465
  }
327
466
 
328
467
  service SessionService {
329
- // Full structured state (binary protobuf).
468
+ // Full structured state (binary protobuf). Kept for compatibility; new
469
+ // clients should use GetSnapshot / GetHistory.
330
470
  rpc GetState(SessionStateRequest) returns (SessionState);
471
+ // Full nested session snapshot (session-snapshot-collapse contract).
472
+ rpc GetSnapshot(SessionStateRequest) returns (SessionSnapshot);
473
+ // Session history as a snapshot-shaped transcript (session-snapshot-collapse).
474
+ rpc GetHistory(SessionStateRequest) returns (SessionSnapshot);
475
+ // Collapse a session into a graph node (session-snapshot-collapse).
476
+ rpc CollapseSession(CollapseSessionRequest) returns (CollapseSessionResponse);
477
+ rpc GetSessionGraphNode(GetSessionGraphNodeRequest) returns (GetSessionGraphNodeResponse);
478
+ rpc ListSessionGraphNodeMessages(ListSessionGraphNodeMessagesRequest) returns (ListSessionGraphNodeMessagesResponse);
479
+ rpc StreamSessionGraphNode(StreamSessionGraphNodeRequest) returns (stream SessionGraphNodeStreamFrame);
331
480
  // Session resources: list (with current marker) / create / rename /
332
481
  // delete. DeleteSession reports the offending run ids when refused because
333
482
  // the session still has running graphs.