@maudecode/talaria-web-contracts 1.14.0 → 1.16.1

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.
Files changed (39) hide show
  1. package/dist/router.d.ts +3594 -317
  2. package/dist/routes/automation.d.ts +123 -7
  3. package/dist/routes/automation.js +3 -1
  4. package/dist/routes/automation.js.map +1 -1
  5. package/dist/routes/chat.d.ts +730 -39
  6. package/dist/routes/chat.js +8 -1
  7. package/dist/routes/chat.js.map +1 -1
  8. package/dist/routes/core.d.ts +12 -6
  9. package/dist/routes/core.js +4 -0
  10. package/dist/routes/core.js.map +1 -1
  11. package/dist/routes/sessions.d.ts +3387 -277
  12. package/dist/routes/sessions.js +30 -6
  13. package/dist/routes/sessions.js.map +1 -1
  14. package/dist/routes/settings.d.ts +188 -17
  15. package/dist/routes/settings.js +7 -6
  16. package/dist/routes/settings.js.map +1 -1
  17. package/dist/routes/tools.d.ts +13 -1
  18. package/dist/routes/workspaces.d.ts +5 -5
  19. package/dist/sidecar/methods.d.ts +221 -6
  20. package/dist/sidecar/methods.js +2 -1
  21. package/dist/sidecar/methods.js.map +1 -1
  22. package/dist/sidecar/namespaces.d.ts +287 -15
  23. package/dist/sidecar/namespaces.js +85 -5
  24. package/dist/sidecar/namespaces.js.map +1 -1
  25. package/dist/sidecar/version.d.ts +1 -1
  26. package/dist/sidecar/version.js +1 -1
  27. package/dist/sse.d.ts +60 -6
  28. package/dist/sse.js +16 -6
  29. package/dist/sse.js.map +1 -1
  30. package/dist/views.d.ts +2036 -176
  31. package/dist/views.js +288 -33
  32. package/dist/views.js.map +1 -1
  33. package/fixtures/sidecar/plugins.json +1 -403
  34. package/fixtures/sidecar/process.json +87 -0
  35. package/fixtures/sidecar/rpc.json +11 -1
  36. package/fixtures/sidecar/runtime.json +3 -3
  37. package/fixtures/sidecar/text.json +0 -10
  38. package/fixtures/sidecar/usage.json +13 -0
  39. package/package.json +1 -1
@@ -176,11 +176,22 @@ export declare const CommandSchema: z.ZodObject<{
176
176
  cli_only: z.ZodBoolean;
177
177
  gateway_only: z.ZodBoolean;
178
178
  }, z.core.$strip>;
179
+ /**
180
+ * A model-provider plugin installed and enabled in the profile (TAL-288); bundled providers are built-ins. `setup` is the Agent's
181
+ * own verdict without spawning the plugin's CLI: `not_loaded` means the installed plugin could not be loaded (import failure, or its
182
+ * provider id or directory name is taken by another profile's plugin in this process-wide registry).
183
+ */
179
184
  export declare const PluginProviderSchema: z.ZodObject<{
180
185
  name: z.ZodString;
181
186
  display_name: z.ZodString;
182
- env_vars: z.ZodArray<z.ZodString>;
183
- api_key_env: z.ZodNullable<z.ZodString>;
187
+ auth_type: z.ZodString;
188
+ setup: z.ZodEnum<{
189
+ ready: "ready";
190
+ missing_cli: "missing_cli";
191
+ needs_setup: "needs_setup";
192
+ not_loaded: "not_loaded";
193
+ unavailable: "unavailable";
194
+ }>;
184
195
  }, z.core.$strip>;
185
196
  export declare const COMMANDS_METHODS: {
186
197
  readonly 'commands.registry': {
@@ -230,8 +241,14 @@ export declare const COMMANDS_METHODS: {
230
241
  providers: z.ZodArray<z.ZodObject<{
231
242
  name: z.ZodString;
232
243
  display_name: z.ZodString;
233
- env_vars: z.ZodArray<z.ZodString>;
234
- api_key_env: z.ZodNullable<z.ZodString>;
244
+ auth_type: z.ZodString;
245
+ setup: z.ZodEnum<{
246
+ ready: "ready";
247
+ missing_cli: "missing_cli";
248
+ needs_setup: "needs_setup";
249
+ not_loaded: "not_loaded";
250
+ unavailable: "unavailable";
251
+ }>;
235
252
  }, z.core.$strip>>;
236
253
  }, z.core.$strip>;
237
254
  };
@@ -1232,6 +1249,75 @@ export declare const PROVIDERS_METHODS: {
1232
1249
  }, z.core.$strip>;
1233
1250
  };
1234
1251
  };
1252
+ /**
1253
+ * TAL-398: an Agent device-code sign-in (Nous Portal, OpenAI Codex, xAI, MiniMax) the sidecar runs for one profile home.
1254
+ * `oauth.start` answers the code to show; a sidecar thread polls the provider and writes the credential through the
1255
+ * Agent's own auth store. A flow belongs to the profile home that started it: poll and cancel from another home do not
1256
+ * find it. `error` is the Agent's reason for a flow that ended without a credential.
1257
+ */
1258
+ export declare const OAuthFlowStatusSchema: z.ZodEnum<{
1259
+ error: "error";
1260
+ cancelled: "cancelled";
1261
+ pending: "pending";
1262
+ approved: "approved";
1263
+ denied: "denied";
1264
+ expired: "expired";
1265
+ }>;
1266
+ export declare const OAUTH_METHODS: {
1267
+ readonly 'oauth.start': {
1268
+ readonly params: z.ZodObject<{
1269
+ profile_home: z.ZodString;
1270
+ provider: z.ZodString;
1271
+ }, z.core.$strip>;
1272
+ readonly result: z.ZodObject<{
1273
+ flow_id: z.ZodString;
1274
+ provider: z.ZodString;
1275
+ status: z.ZodLiteral<"pending">;
1276
+ user_code: z.ZodString;
1277
+ verification_url: z.ZodString;
1278
+ expires_in: z.ZodNumber;
1279
+ interval: z.ZodNumber;
1280
+ }, z.core.$strip>;
1281
+ };
1282
+ readonly 'oauth.poll': {
1283
+ readonly params: z.ZodObject<{
1284
+ profile_home: z.ZodString;
1285
+ flow_id: z.ZodString;
1286
+ }, z.core.$strip>;
1287
+ readonly result: z.ZodObject<{
1288
+ flow_id: z.ZodString;
1289
+ provider: z.ZodString;
1290
+ status: z.ZodEnum<{
1291
+ error: "error";
1292
+ cancelled: "cancelled";
1293
+ pending: "pending";
1294
+ approved: "approved";
1295
+ denied: "denied";
1296
+ expired: "expired";
1297
+ }>;
1298
+ error: z.ZodNullable<z.ZodString>;
1299
+ }, z.core.$strip>;
1300
+ };
1301
+ readonly 'oauth.cancel': {
1302
+ readonly params: z.ZodObject<{
1303
+ profile_home: z.ZodString;
1304
+ flow_id: z.ZodString;
1305
+ }, z.core.$strip>;
1306
+ readonly result: z.ZodObject<{
1307
+ flow_id: z.ZodString;
1308
+ provider: z.ZodString;
1309
+ status: z.ZodEnum<{
1310
+ error: "error";
1311
+ cancelled: "cancelled";
1312
+ pending: "pending";
1313
+ approved: "approved";
1314
+ denied: "denied";
1315
+ expired: "expired";
1316
+ }>;
1317
+ error: z.ZodNullable<z.ZodString>;
1318
+ }, z.core.$strip>;
1319
+ };
1320
+ };
1235
1321
  export declare const AuxUsageSchema: z.ZodObject<{
1236
1322
  prompt_tokens: z.ZodOptional<z.ZodNumber>;
1237
1323
  completion_tokens: z.ZodOptional<z.ZodNumber>;
@@ -1278,15 +1364,6 @@ export declare const AUX_METHODS: {
1278
1364
  };
1279
1365
  };
1280
1366
  export declare const TEXT_METHODS: {
1281
- readonly 'text.redact': {
1282
- readonly params: z.ZodObject<{
1283
- text: z.ZodString;
1284
- force: z.ZodOptional<z.ZodBoolean>;
1285
- }, z.core.$strip>;
1286
- readonly result: z.ZodObject<{
1287
- text: z.ZodString;
1288
- }, z.core.$strip>;
1289
- };
1290
1367
  readonly 'text.image_mode': {
1291
1368
  readonly params: z.ZodObject<{
1292
1369
  profile_home: z.ZodString;
@@ -1354,6 +1431,48 @@ export declare const PROCESS_METHODS: {
1354
1431
  ok: z.ZodBoolean;
1355
1432
  }, z.core.$strip>;
1356
1433
  };
1434
+ /** TAL-459: the Agent's durable delivery ledger. A null claim means another consumer delivered (or holds) it; "" means nothing durable to acknowledge. */
1435
+ readonly 'process.claim_delivery': {
1436
+ readonly params: z.ZodObject<{
1437
+ profile_home: z.ZodString;
1438
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1439
+ consumer: z.ZodString;
1440
+ }, z.core.$strip>;
1441
+ readonly result: z.ZodObject<{
1442
+ claim_id: z.ZodNullable<z.ZodString>;
1443
+ }, z.core.$strip>;
1444
+ };
1445
+ readonly 'process.complete_delivery': {
1446
+ readonly params: z.ZodObject<{
1447
+ profile_home: z.ZodString;
1448
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1449
+ claim_id: z.ZodString;
1450
+ }, z.core.$strip>;
1451
+ readonly result: z.ZodObject<{
1452
+ ok: z.ZodBoolean;
1453
+ }, z.core.$strip>;
1454
+ };
1455
+ readonly 'process.release_delivery': {
1456
+ readonly params: z.ZodObject<{
1457
+ profile_home: z.ZodString;
1458
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1459
+ claim_id: z.ZodString;
1460
+ }, z.core.$strip>;
1461
+ readonly result: z.ZodObject<{
1462
+ ok: z.ZodBoolean;
1463
+ }, z.core.$strip>;
1464
+ };
1465
+ /** Hands back a claim the busy target never admitted, without spending one of the Agent's delivery attempts. */
1466
+ readonly 'process.defer_delivery': {
1467
+ readonly params: z.ZodObject<{
1468
+ profile_home: z.ZodString;
1469
+ event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1470
+ claim_id: z.ZodString;
1471
+ }, z.core.$strip>;
1472
+ readonly result: z.ZodObject<{
1473
+ ok: z.ZodBoolean;
1474
+ }, z.core.$strip>;
1475
+ };
1357
1476
  readonly 'process.format_notification': {
1358
1477
  readonly params: z.ZodObject<{
1359
1478
  event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -1370,6 +1489,52 @@ export declare const PROCESS_METHODS: {
1370
1489
  sessions: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1371
1490
  }, z.core.$strip>;
1372
1491
  };
1492
+ /** TAL-372: the Agent's view of these WebUI sessions' background work: ledger delegations (with live status) and notified processes. */
1493
+ readonly 'process.background_list': {
1494
+ readonly params: z.ZodObject<{
1495
+ profile_home: z.ZodString;
1496
+ session_ids: z.ZodArray<z.ZodString>;
1497
+ }, z.core.$strip>;
1498
+ readonly result: z.ZodObject<{
1499
+ delegations: z.ZodArray<z.ZodObject<{
1500
+ delegation_id: z.ZodString;
1501
+ origin_ui_session_id: z.ZodString;
1502
+ state: z.ZodString;
1503
+ dispatched_at: z.ZodNullable<z.ZodNumber>;
1504
+ completed_at: z.ZodNullable<z.ZodNumber>;
1505
+ updated_at: z.ZodNullable<z.ZodNumber>;
1506
+ goals: z.ZodArray<z.ZodString>;
1507
+ child_statuses: z.ZodArray<z.ZodString>;
1508
+ has_result: z.ZodBoolean;
1509
+ live_status: z.ZodNullable<z.ZodString>;
1510
+ children: z.ZodOptional<z.ZodArray<z.ZodObject<{
1511
+ goal: z.ZodString;
1512
+ session_id: z.ZodString;
1513
+ }, z.core.$strip>>>;
1514
+ }, z.core.$strip>>;
1515
+ processes: z.ZodArray<z.ZodObject<{
1516
+ process_id: z.ZodString;
1517
+ session_key: z.ZodString;
1518
+ command: z.ZodString;
1519
+ started_at: z.ZodNullable<z.ZodNumber>;
1520
+ exited: z.ZodBoolean;
1521
+ exited_at: z.ZodNullable<z.ZodNumber>;
1522
+ exit_code: z.ZodNullable<z.ZodNumber>;
1523
+ completion_reason: z.ZodString;
1524
+ watched: z.ZodBoolean;
1525
+ }, z.core.$strip>>;
1526
+ }, z.core.$strip>;
1527
+ };
1528
+ readonly 'process.delegation_result': {
1529
+ readonly params: z.ZodObject<{
1530
+ profile_home: z.ZodString;
1531
+ session_id: z.ZodString;
1532
+ delegation_id: z.ZodString;
1533
+ }, z.core.$strip>;
1534
+ readonly result: z.ZodObject<{
1535
+ text: z.ZodString;
1536
+ }, z.core.$strip>;
1537
+ };
1373
1538
  };
1374
1539
  export declare const AccountUsageSnapshotSchema: z.ZodObject<{
1375
1540
  provider: z.ZodNullable<z.ZodString>;
@@ -1453,6 +1618,7 @@ export declare const ChatUsageSchema: z.ZodObject<{
1453
1618
  cache_write_tokens: z.ZodNumber;
1454
1619
  estimated_cost_usd: z.ZodNullable<z.ZodNumber>;
1455
1620
  }, z.core.$strip>;
1621
+ /** `failed`, `partial`, and `compression_exhausted` are the Agent's own turn-result flags, forwarded as sent; `failed` also sets `status: 'error'`. */
1456
1622
  export declare const ChatStartResultSchema: z.ZodObject<{
1457
1623
  status: z.ZodEnum<{
1458
1624
  error: "error";
@@ -1462,7 +1628,9 @@ export declare const ChatStartResultSchema: z.ZodObject<{
1462
1628
  messages: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1463
1629
  final_response: z.ZodString;
1464
1630
  error: z.ZodNullable<z.ZodString>;
1465
- result_status: z.ZodString;
1631
+ failed: z.ZodBoolean;
1632
+ partial: z.ZodBoolean;
1633
+ compression_exhausted: z.ZodBoolean;
1466
1634
  tool_limit_reached: z.ZodBoolean;
1467
1635
  usage: z.ZodObject<{
1468
1636
  prompt_tokens: z.ZodNumber;
@@ -1529,6 +1697,13 @@ export declare const ChatStreamSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1529
1697
  }, z.core.$strip>, z.ZodObject<{
1530
1698
  event: z.ZodLiteral<"clarify_resolved">;
1531
1699
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1700
+ }, z.core.$strip>, z.ZodObject<{
1701
+ event: z.ZodLiteral<"approval_resolved">;
1702
+ data: z.ZodObject<{
1703
+ approval_id: z.ZodString;
1704
+ session_id: z.ZodOptional<z.ZodString>;
1705
+ reason: z.ZodOptional<z.ZodString>;
1706
+ }, z.core.$loose>;
1532
1707
  }, z.core.$strip>, z.ZodObject<{
1533
1708
  event: z.ZodLiteral<"compressing">;
1534
1709
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -1570,7 +1745,9 @@ export declare const CHAT_METHODS: {
1570
1745
  messages: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1571
1746
  final_response: z.ZodString;
1572
1747
  error: z.ZodNullable<z.ZodString>;
1573
- result_status: z.ZodString;
1748
+ failed: z.ZodBoolean;
1749
+ partial: z.ZodBoolean;
1750
+ compression_exhausted: z.ZodBoolean;
1574
1751
  tool_limit_reached: z.ZodBoolean;
1575
1752
  usage: z.ZodObject<{
1576
1753
  prompt_tokens: z.ZodNumber;
@@ -1637,6 +1814,13 @@ export declare const CHAT_METHODS: {
1637
1814
  }, z.core.$strip>, z.ZodObject<{
1638
1815
  event: z.ZodLiteral<"clarify_resolved">;
1639
1816
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1817
+ }, z.core.$strip>, z.ZodObject<{
1818
+ event: z.ZodLiteral<"approval_resolved">;
1819
+ data: z.ZodObject<{
1820
+ approval_id: z.ZodString;
1821
+ session_id: z.ZodOptional<z.ZodString>;
1822
+ reason: z.ZodOptional<z.ZodString>;
1823
+ }, z.core.$loose>;
1640
1824
  }, z.core.$strip>, z.ZodObject<{
1641
1825
  event: z.ZodLiteral<"compressing">;
1642
1826
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -1661,6 +1845,7 @@ export declare const CHAT_METHODS: {
1661
1845
  checkpoint: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1662
1846
  }, z.core.$strip>;
1663
1847
  };
1848
+ /** `can_redirect`: the Agent can deliver a pending steer now (TAL-424 Send now). */
1664
1849
  readonly 'chat.steer': {
1665
1850
  readonly params: z.ZodObject<{
1666
1851
  stream_id: z.ZodOptional<z.ZodString>;
@@ -1670,11 +1855,98 @@ export declare const CHAT_METHODS: {
1670
1855
  readonly result: z.ZodObject<{
1671
1856
  accepted: z.ZodBoolean;
1672
1857
  fallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1858
+ can_redirect: z.ZodOptional<z.ZodBoolean>;
1859
+ }, z.core.$strip>;
1860
+ };
1861
+ /**
1862
+ * TAL-424: take `pending[index]` back out of the Agent's pending steer slot (Edit, Cancel). `pending` is the server's
1863
+ * not-yet-consumed steer texts, oldest first. `withdrawn: false` when the Agent already took it; the slot is untouched.
1864
+ */
1865
+ readonly 'chat.steer_withdraw': {
1866
+ readonly params: z.ZodObject<{
1867
+ stream_id: z.ZodOptional<z.ZodString>;
1868
+ session_id: z.ZodOptional<z.ZodString>;
1869
+ pending: z.ZodArray<z.ZodString>;
1870
+ index: z.ZodNumber;
1871
+ }, z.core.$strip>;
1872
+ readonly result: z.ZodObject<{
1873
+ withdrawn: z.ZodBoolean;
1874
+ }, z.core.$strip>;
1875
+ };
1876
+ /**
1877
+ * TAL-424: deliver `pending[index]` now with the Agent's `redirect`: `delivery: redirect` restarts the model request with
1878
+ * it, `delivery: steer` puts it last on the slot while tools yield. Not redirected: it stays pending, `requeued` in its
1879
+ * place (`kept`) or last (`last`); `withdrawn: false` when the Agent already took it.
1880
+ */
1881
+ readonly 'chat.steer_now': {
1882
+ readonly params: z.ZodObject<{
1883
+ stream_id: z.ZodOptional<z.ZodString>;
1884
+ session_id: z.ZodOptional<z.ZodString>;
1885
+ pending: z.ZodArray<z.ZodString>;
1886
+ index: z.ZodNumber;
1887
+ }, z.core.$strip>;
1888
+ readonly result: z.ZodObject<{
1889
+ redirected: z.ZodBoolean;
1890
+ withdrawn: z.ZodBoolean;
1891
+ delivery: z.ZodOptional<z.ZodEnum<{
1892
+ redirect: "redirect";
1893
+ steer: "steer";
1894
+ }>>;
1895
+ requeued: z.ZodOptional<z.ZodEnum<{
1896
+ kept: "kept";
1897
+ last: "last";
1898
+ }>>;
1899
+ }, z.core.$strip>;
1900
+ };
1901
+ /**
1902
+ * TAL-255: manual `/compress` of `conversation_history` through the Agent's `compress_now` on a throwaway agent. Nothing is
1903
+ * persisted: the server installs `messages` as the session's model context. `message` is the Agent's text for a result
1904
+ * that did not compress; `agent_session_id` is the state.db id after a possible rotation. A compressed result holds its
1905
+ * Agent's context-engine notification until `chat.compress_finalize` reports whether the server installed it.
1906
+ */
1907
+ readonly 'chat.compress': {
1908
+ readonly params: z.ZodObject<{
1909
+ profile_home: z.ZodString;
1910
+ session_id: z.ZodString;
1911
+ model: z.ZodString;
1912
+ model_provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1913
+ conversation_history: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1914
+ focus_topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1915
+ enabled_toolsets: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1916
+ }, z.core.$strip>;
1917
+ readonly result: z.ZodObject<{
1918
+ status: z.ZodEnum<{
1919
+ compressed: "compressed";
1920
+ lock_skipped: "lock_skipped";
1921
+ nothing_to_do: "nothing_to_do";
1922
+ }>;
1923
+ messages: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1924
+ before_tokens: z.ZodNumber;
1925
+ after_tokens: z.ZodNumber;
1926
+ summary: z.ZodNullable<z.ZodObject<{
1927
+ headline: z.ZodOptional<z.ZodString>;
1928
+ token_line: z.ZodOptional<z.ZodString>;
1929
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1930
+ }, z.core.$loose>>;
1931
+ message: z.ZodNullable<z.ZodString>;
1932
+ agent_session_id: z.ZodString;
1933
+ commit_token: z.ZodNullable<z.ZodString>;
1934
+ }, z.core.$strip>;
1935
+ };
1936
+ /** TAL-255: second phase of `chat.compress`; `finalized: false` when the token is unknown or already expired. */
1937
+ readonly 'chat.compress_finalize': {
1938
+ readonly params: z.ZodObject<{
1939
+ commit_token: z.ZodString;
1940
+ committed: z.ZodBoolean;
1941
+ }, z.core.$strip>;
1942
+ readonly result: z.ZodObject<{
1943
+ finalized: z.ZodBoolean;
1673
1944
  }, z.core.$strip>;
1674
1945
  };
1675
1946
  readonly 'chat.evict_agent': {
1676
1947
  readonly params: z.ZodObject<{
1677
1948
  session_id: z.ZodString;
1949
+ clear_session: z.ZodOptional<z.ZodBoolean>;
1678
1950
  }, z.core.$strip>;
1679
1951
  readonly result: z.ZodObject<{
1680
1952
  evicted: z.ZodBoolean;
@@ -32,7 +32,12 @@ export const CommandSchema = z.object({
32
32
  name: z.string(), description: z.string(), category: z.string(), aliases: z.array(z.string()), args_hint: z.string(), subcommands: z.array(z.string()),
33
33
  cli_only: z.boolean(), gateway_only: z.boolean(),
34
34
  });
35
- export const PluginProviderSchema = z.object({ name: z.string(), display_name: z.string(), env_vars: z.array(z.string()), api_key_env: z.string().nullable() });
35
+ /**
36
+ * A model-provider plugin installed and enabled in the profile (TAL-288); bundled providers are built-ins. `setup` is the Agent's
37
+ * own verdict without spawning the plugin's CLI: `not_loaded` means the installed plugin could not be loaded (import failure, or its
38
+ * provider id or directory name is taken by another profile's plugin in this process-wide registry).
39
+ */
40
+ export const PluginProviderSchema = z.object({ name: z.string(), display_name: z.string(), auth_type: z.string(), setup: z.enum(['ready', 'missing_cli', 'needs_setup', 'not_loaded', 'unavailable']) });
36
41
  export const COMMANDS_METHODS = {
37
42
  'commands.registry': { params: ProfileHomeParams, result: z.object({ commands: z.array(CommandSchema) }) },
38
43
  'commands.exec': { params: ProfileHomeParams.extend({ command: z.string().min(1) }), result: z.object({ output: z.string(), source: z.enum(['agent', 'plugin']) }) },
@@ -155,6 +160,21 @@ export const PROVIDERS_METHODS = {
155
160
  'models.estimate_tokens': { params: z.object({ messages: z.array(Loose) }), result: z.object({ tokens: z.number().int() }) },
156
161
  'models.capabilities': { params: ProfileHomeParams.extend({ provider: z.string(), model: z.string() }), result: z.object({ capabilities: Loose.nullable() }) },
157
162
  };
163
+ // ── oauth ──────────────────────────────────────────────────────────────
164
+ /**
165
+ * TAL-398: an Agent device-code sign-in (Nous Portal, OpenAI Codex, xAI, MiniMax) the sidecar runs for one profile home.
166
+ * `oauth.start` answers the code to show; a sidecar thread polls the provider and writes the credential through the
167
+ * Agent's own auth store. A flow belongs to the profile home that started it: poll and cancel from another home do not
168
+ * find it. `error` is the Agent's reason for a flow that ended without a credential.
169
+ */
170
+ export const OAuthFlowStatusSchema = z.enum(['pending', 'approved', 'denied', 'expired', 'cancelled', 'error']);
171
+ const OAuthFlow = z.object({ flow_id: z.string(), provider: z.string(), status: OAuthFlowStatusSchema, error: z.string().nullable() });
172
+ const OAuthFlowParams = ProfileHomeParams.extend({ flow_id: z.string().min(1) });
173
+ export const OAUTH_METHODS = {
174
+ 'oauth.start': { params: ProfileHomeParams.extend({ provider: z.string().min(1) }), result: z.object({ flow_id: z.string(), provider: z.string(), status: z.literal('pending'), user_code: z.string(), verification_url: z.string(), expires_in: z.number().int(), interval: z.number().int() }) },
175
+ 'oauth.poll': { params: OAuthFlowParams, result: OAuthFlow },
176
+ 'oauth.cancel': { params: OAuthFlowParams, result: OAuthFlow },
177
+ };
158
178
  // ── aux / text / process / usage / gateway ─────────────────────────────
159
179
  export const AuxUsageSchema = z.object({ prompt_tokens: z.number().int().optional(), completion_tokens: z.number().int().optional(), total_tokens: z.number().int().optional() });
160
180
  export const AUX_METHODS = {
@@ -162,7 +182,6 @@ export const AUX_METHODS = {
162
182
  'aux.resolve': { params: ProfileHomeParams.extend({ task: z.string().min(1), main_runtime: Loose.nullable().optional() }), result: z.object({ configured: z.boolean(), model: z.string().nullable(), error: z.string().optional() }) },
163
183
  };
164
184
  export const TEXT_METHODS = {
165
- 'text.redact': { params: z.object({ text: z.string(), force: z.boolean().optional() }), result: z.object({ text: z.string() }) },
166
185
  'text.image_mode': { params: ProfileHomeParams.extend({ provider: z.string(), model: z.string(), cfg: Loose.nullable().optional(), requested_provider: z.string().optional() }), result: z.object({ mode: z.enum(['native', 'text']), reason: z.string(), supports_vision: z.boolean().nullable() }) },
167
186
  'text.portal_tags': { params: ProfileHomeParams, result: z.object({ client_tag: z.string().nullable(), conversation_tag: z.string().nullable(), tags: z.union([z.array(z.string()), Loose]) }) },
168
187
  };
@@ -171,8 +190,31 @@ export const PROCESS_METHODS = {
171
190
  'process.drain': { params: ProfileHomeParams.extend({ max_events: z.number().int().positive().optional() }), result: z.object({ events: z.array(ProcessEventSchema) }) },
172
191
  'process.requeue': { params: z.object({ events: z.array(Loose) }), result: z.object({ requeued: z.number().int() }) },
173
192
  'process.mark_consumed': { params: z.object({ process_id: z.string().min(1) }), result: Ok },
193
+ /** TAL-459: the Agent's durable delivery ledger. A null claim means another consumer delivered (or holds) it; "" means nothing durable to acknowledge. */
194
+ 'process.claim_delivery': { params: ProfileHomeParams.extend({ event: Loose, consumer: z.string().min(1) }), result: z.object({ claim_id: z.string().nullable() }) },
195
+ 'process.complete_delivery': { params: ProfileHomeParams.extend({ event: Loose, claim_id: z.string() }), result: Ok },
196
+ 'process.release_delivery': { params: ProfileHomeParams.extend({ event: Loose, claim_id: z.string() }), result: Ok },
197
+ /** Hands back a claim the busy target never admitted, without spending one of the Agent's delivery attempts. */
198
+ 'process.defer_delivery': { params: ProfileHomeParams.extend({ event: Loose, claim_id: z.string() }), result: Ok },
174
199
  'process.format_notification': { params: z.object({ event: Loose }), result: z.object({ text: z.string() }) },
175
200
  'process.list': { params: ProfileHomeParams, result: z.object({ sessions: z.array(Loose) }) },
201
+ /** TAL-372: the Agent's view of these WebUI sessions' background work: ledger delegations (with live status) and notified processes. */
202
+ 'process.background_list': {
203
+ params: ProfileHomeParams.extend({ session_ids: z.array(z.string().min(1)) }),
204
+ result: z.object({
205
+ delegations: z.array(z.object({
206
+ delegation_id: z.string(), origin_ui_session_id: z.string(), state: z.string(), dispatched_at: z.number().nullable(), completed_at: z.number().nullable(),
207
+ updated_at: z.number().nullable(), goals: z.array(z.string()), child_statuses: z.array(z.string()), has_result: z.boolean(), live_status: z.string().nullable(),
208
+ /** TAL-494: the subagent sessions this unit ran (absent from a sidecar before TAL-494). */
209
+ children: z.array(z.object({ goal: z.string(), session_id: z.string() })).optional(),
210
+ })),
211
+ processes: z.array(z.object({
212
+ process_id: z.string(), session_key: z.string(), command: z.string(), started_at: z.number().nullable(), exited: z.boolean(), exited_at: z.number().nullable(),
213
+ exit_code: z.number().int().nullable(), completion_reason: z.string(), watched: z.boolean(),
214
+ })),
215
+ }),
216
+ },
217
+ 'process.delegation_result': { params: ProfileHomeParams.extend({ session_id: z.string().min(1), delegation_id: z.string().min(1) }), result: z.object({ text: z.string() }) },
176
218
  };
177
219
  export const AccountUsageSnapshotSchema = z.object({ provider: z.string().nullable(), available: z.boolean(), unavailable_reason: z.string().nullable().optional(), windows: z.array(Loose), details: z.array(Json) }).catchall(Json);
178
220
  export const USAGE_METHODS = {
@@ -189,8 +231,10 @@ export const WORKTREE_METHODS = {
189
231
  };
190
232
  // ── chat / approval / clarify ──────────────────────────────────────────
191
233
  export const ChatUsageSchema = z.object({ prompt_tokens: z.number().int(), completion_tokens: z.number().int(), cache_read_tokens: z.number().int(), cache_write_tokens: z.number().int(), estimated_cost_usd: z.number().nullable() });
234
+ /** `failed`, `partial`, and `compression_exhausted` are the Agent's own turn-result flags, forwarded as sent; `failed` also sets `status: 'error'`. */
192
235
  export const ChatStartResultSchema = z.object({
193
- status: z.enum(['completed', 'cancelled', 'error']), messages: z.array(Loose), final_response: z.string(), error: z.string().nullable(), result_status: z.string(),
236
+ status: z.enum(['completed', 'cancelled', 'error']), messages: z.array(Loose), final_response: z.string(), error: z.string().nullable(),
237
+ failed: z.boolean(), partial: z.boolean(), compression_exhausted: z.boolean(),
194
238
  tool_limit_reached: z.boolean(), usage: ChatUsageSchema, context: Loose, model: z.string(), provider: z.string(), compressed: z.boolean(), agent_session_id: z.string(),
195
239
  token_sent: z.boolean(), pending_steer: z.string(), live_tool_calls: z.array(Loose),
196
240
  });
@@ -211,6 +255,8 @@ export const ChatStreamSchema = z.discriminatedUnion('event', [
211
255
  z.object({ event: z.literal('approval'), data: Loose }),
212
256
  z.object({ event: z.literal('clarify'), data: Loose }),
213
257
  z.object({ event: z.literal('clarify_resolved'), data: Loose }),
258
+ /** The Agent stopped waiting on an approval: `reason` is its settle cause (`resolved`, `timeout`, `interrupted`, `session_closed`). */
259
+ z.object({ event: z.literal('approval_resolved'), data: z.looseObject({ approval_id: z.string(), session_id: z.string().optional(), reason: z.string().optional() }) }),
214
260
  z.object({ event: z.literal('compressing'), data: Loose }),
215
261
  z.object({ event: z.literal('warning'), data: Loose }),
216
262
  z.object({ event: z.literal('status'), data: Loose }),
@@ -233,8 +279,42 @@ export const CHAT_METHODS = {
233
279
  /** `checkpoint`: the Agent's canonical transcript for the stopped turn, captured before the interrupt (absent until it has one). */
234
280
  result: z.object({ ok: z.boolean(), reason: z.string().optional(), pending_steer: z.string().optional(), checkpoint: z.array(Loose).optional() }),
235
281
  },
236
- 'chat.steer': { params: z.object({ stream_id: z.string().optional(), session_id: z.string().optional(), text: z.string().min(1) }), result: z.object({ accepted: z.boolean(), fallback: z.string().nullable().optional() }) },
237
- 'chat.evict_agent': { params: z.object({ session_id: z.string().min(1) }), result: z.object({ evicted: z.boolean() }) },
282
+ /** `can_redirect`: the Agent can deliver a pending steer now (TAL-424 Send now). */
283
+ 'chat.steer': { params: z.object({ stream_id: z.string().optional(), session_id: z.string().optional(), text: z.string().min(1) }), result: z.object({ accepted: z.boolean(), fallback: z.string().nullable().optional(), can_redirect: z.boolean().optional() }) },
284
+ /**
285
+ * TAL-424: take `pending[index]` back out of the Agent's pending steer slot (Edit, Cancel). `pending` is the server's
286
+ * not-yet-consumed steer texts, oldest first. `withdrawn: false` when the Agent already took it; the slot is untouched.
287
+ */
288
+ 'chat.steer_withdraw': { params: z.object({ stream_id: z.string().optional(), session_id: z.string().optional(), pending: z.array(z.string().min(1)).min(1), index: z.number().int().nonnegative() }), result: z.object({ withdrawn: z.boolean() }) },
289
+ /**
290
+ * TAL-424: deliver `pending[index]` now with the Agent's `redirect`: `delivery: redirect` restarts the model request with
291
+ * it, `delivery: steer` puts it last on the slot while tools yield. Not redirected: it stays pending, `requeued` in its
292
+ * place (`kept`) or last (`last`); `withdrawn: false` when the Agent already took it.
293
+ */
294
+ 'chat.steer_now': {
295
+ params: z.object({ stream_id: z.string().optional(), session_id: z.string().optional(), pending: z.array(z.string().min(1)).min(1), index: z.number().int().nonnegative() }),
296
+ result: z.object({ redirected: z.boolean(), withdrawn: z.boolean(), delivery: z.enum(['redirect', 'steer']).optional(), requeued: z.enum(['kept', 'last']).optional() }),
297
+ },
298
+ /**
299
+ * TAL-255: manual `/compress` of `conversation_history` through the Agent's `compress_now` on a throwaway agent. Nothing is
300
+ * persisted: the server installs `messages` as the session's model context. `message` is the Agent's text for a result
301
+ * that did not compress; `agent_session_id` is the state.db id after a possible rotation. A compressed result holds its
302
+ * Agent's context-engine notification until `chat.compress_finalize` reports whether the server installed it.
303
+ */
304
+ 'chat.compress': {
305
+ params: ProfileHomeParams.extend({
306
+ session_id: z.string().min(1), model: z.string(), model_provider: z.string().nullable().optional(), conversation_history: z.array(Loose),
307
+ focus_topic: z.string().nullable().optional(), enabled_toolsets: z.array(z.string()).nullable().optional(),
308
+ }),
309
+ result: z.object({
310
+ status: z.enum(['compressed', 'lock_skipped', 'nothing_to_do']), messages: z.array(Loose), before_tokens: z.number().int(), after_tokens: z.number().int(),
311
+ summary: z.looseObject({ headline: z.string().optional(), token_line: z.string().optional(), note: z.string().nullable().optional() }).nullable(), message: z.string().nullable(), agent_session_id: z.string(),
312
+ commit_token: z.string().nullable(),
313
+ }),
314
+ },
315
+ /** TAL-255: second phase of `chat.compress`; `finalized: false` when the token is unknown or already expired. */
316
+ 'chat.compress_finalize': { params: z.object({ commit_token: z.string().min(1), committed: z.boolean() }), result: z.object({ finalized: z.boolean() }) },
317
+ 'chat.evict_agent': { params: z.object({ session_id: z.string().min(1), clear_session: z.boolean().optional() }), result: z.object({ evicted: z.boolean() }) },
238
318
  'chat.commit_memory': { params: z.object({ session_id: z.string().min(1) }), result: z.object({ committed: z.boolean() }) },
239
319
  'approval.respond': { params: ProfileHomeParams.extend({ session_id: z.string().min(1), choice: z.enum(['once', 'session', 'always', 'deny']), request_id: z.string().nullable().optional() }), result: z.object({ ok: z.boolean(), resolved: z.number().int(), choice: z.string() }) },
240
320
  'approval.pending': { params: z.object({ session_id: z.string().min(1) }), result: z.object({ pending: z.array(Loose) }) },