@parallelworks/code 0.4.0 → 0.6.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.
Files changed (93) hide show
  1. package/README.md +92 -24
  2. package/dist/agentSwitcher.d.ts +13 -2
  3. package/dist/agentSwitcher.js +28 -6
  4. package/dist/ago.d.ts +1 -3
  5. package/dist/ago.js +1 -3
  6. package/dist/api.d.ts +267 -5
  7. package/dist/chatStrings.d.ts +4 -0
  8. package/dist/chatStrings.js +5 -1
  9. package/dist/claudeAccounts.d.ts +20 -2
  10. package/dist/claudeAccounts.js +51 -7
  11. package/dist/claudeApi.d.ts +2 -1
  12. package/dist/claudeApi.js +49 -3
  13. package/dist/command.d.ts +7 -1
  14. package/dist/command.js +11 -2
  15. package/dist/commandsApi.d.ts +8 -3
  16. package/dist/commandsApi.js +25 -4
  17. package/dist/createPwCodeApi.d.ts +92 -58
  18. package/dist/createPwCodeApi.js +4 -2
  19. package/dist/index.d.ts +11 -9
  20. package/dist/index.js +7 -5
  21. package/dist/locales/en/agentTranscript.js +6 -2
  22. package/dist/locales/en/agents.js +50 -6
  23. package/dist/locales/en.d.ts +46 -0
  24. package/dist/locales/es/agentTranscript.js +6 -2
  25. package/dist/locales/es/agents.js +50 -6
  26. package/dist/locales/ja/agentTranscript.js +6 -2
  27. package/dist/locales/ja/agents.js +45 -6
  28. package/dist/locales/ko/agentTranscript.js +6 -2
  29. package/dist/locales/ko/agents.js +50 -6
  30. package/dist/locales/zh/agentTranscript.js +6 -2
  31. package/dist/locales/zh/agents.js +50 -6
  32. package/dist/machine.d.ts +27 -2
  33. package/dist/machine.js +23 -2
  34. package/dist/notices.d.ts +2 -0
  35. package/dist/notices.js +29 -14
  36. package/dist/pwUpdate.d.ts +52 -0
  37. package/dist/pwUpdate.js +115 -0
  38. package/dist/query.d.ts +4 -1
  39. package/dist/query.js +9 -3
  40. package/dist/session.d.ts +7 -1
  41. package/dist/session.js +6 -2
  42. package/dist/sessionActions.js +5 -2
  43. package/dist/sessionEvents.d.ts +39 -5
  44. package/dist/sessionEvents.js +213 -83
  45. package/dist/sessionGroups.d.ts +3 -3
  46. package/dist/sessionGroups.js +3 -3
  47. package/dist/sessionHeader.js +6 -2
  48. package/dist/sessionList.d.ts +13 -8
  49. package/dist/sessionList.js +20 -10
  50. package/dist/sessionScreen.d.ts +8 -3
  51. package/dist/sessionScreen.js +20 -9
  52. package/dist/sessionsApi.d.ts +27 -5
  53. package/dist/sessionsApi.js +128 -17
  54. package/dist/sessionsFeed.d.ts +22 -0
  55. package/dist/sessionsFeed.js +125 -0
  56. package/dist/startPage.d.ts +6 -3
  57. package/dist/startPage.js +34 -12
  58. package/dist/startSession.d.ts +31 -11
  59. package/dist/startSession.js +126 -44
  60. package/dist/terminalHandoffPanel.js +8 -1
  61. package/dist/todos.d.ts +42 -0
  62. package/dist/todos.js +104 -0
  63. package/dist/transcript.d.ts +27 -5
  64. package/dist/transcript.js +148 -112
  65. package/dist/transcriptRead.d.ts +57 -0
  66. package/dist/transcriptRead.js +122 -0
  67. package/dist/types.d.ts +13 -1
  68. package/dist/useComposer.d.ts +36 -15
  69. package/dist/useComposer.js +94 -31
  70. package/dist/useComposerImages.d.ts +38 -1
  71. package/dist/useComposerImages.js +62 -8
  72. package/dist/useComposerPastes.js +3 -8
  73. package/dist/useConversation.d.ts +16 -0
  74. package/dist/useConversation.js +78 -8
  75. package/dist/useMounted.d.ts +3 -0
  76. package/dist/useMounted.js +14 -0
  77. package/dist/useSubagent.d.ts +22 -5
  78. package/dist/useSubagent.js +41 -17
  79. package/dist/useTranscript.d.ts +27 -1
  80. package/dist/useTranscript.js +217 -45
  81. package/dist/wording.d.ts +6 -3
  82. package/dist/wording.js +20 -6
  83. package/locales/en/agentTranscript.json +6 -2
  84. package/locales/en/agents.json +46 -4
  85. package/locales/es/agentTranscript.json +6 -2
  86. package/locales/es/agents.json +46 -4
  87. package/locales/ja/agentTranscript.json +6 -2
  88. package/locales/ja/agents.json +46 -4
  89. package/locales/ko/agentTranscript.json +6 -2
  90. package/locales/ko/agents.json +46 -4
  91. package/locales/zh/agentTranscript.json +6 -2
  92. package/locales/zh/agents.json +46 -4
  93. package/package.json +3 -3
package/dist/api.d.ts CHANGED
@@ -292,6 +292,28 @@ export interface paths {
292
292
  patch?: never;
293
293
  trace?: never;
294
294
  };
295
+ "/api/code/machines/{machine}/claude-code/accounts/{name}/move": {
296
+ parameters: {
297
+ query?: never;
298
+ header?: never;
299
+ path?: never;
300
+ cookie?: never;
301
+ };
302
+ get?: never;
303
+ put?: never;
304
+ /**
305
+ * Move a Claude Code account's sessions to another account
306
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
307
+ *
308
+ * Move a Claude Code account's sessions to another account. Switches every live session running Claude Code on the account to another, as the session settings route does for one: a turn waiting at the account's usage limit continues at once, and a running one switches after it. Every session on an account shares its usage limit, so this moves them off a spent one together. The daemon enforces each session's control policy.
309
+ */
310
+ post: operations["move-agent-machine-claude-account-sessions"];
311
+ delete?: never;
312
+ options?: never;
313
+ head?: never;
314
+ patch?: never;
315
+ trace?: never;
316
+ };
295
317
  "/api/code/machines/{machine}/claude-code/logins": {
296
318
  parameters: {
297
319
  query?: never;
@@ -609,7 +631,7 @@ export interface paths {
609
631
  * Copy a pw code session
610
632
  * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
611
633
  *
612
- * Copies the session and its subagent transcripts into a new one on the same machine, leaving the original untouched. Refused while the session is mid-turn, and while another host holds it live.
634
+ * Copies the session and its subagent transcripts into a new one on the same machine, leaving the original untouched. While a turn runs, the copy ends with the reply before it, and a machine whose pw predates forkMidTurn refuses it. Refused while another host holds the session live.
613
635
  */
614
636
  post: operations["fork-agent-session"];
615
637
  delete?: never;
@@ -1070,6 +1092,28 @@ export interface paths {
1070
1092
  patch?: never;
1071
1093
  trace?: never;
1072
1094
  };
1095
+ "/api/code/machines/{machine}/sessions/{id}/subagents/{subId}/dismiss": {
1096
+ parameters: {
1097
+ query?: never;
1098
+ header?: never;
1099
+ path?: never;
1100
+ cookie?: never;
1101
+ };
1102
+ get?: never;
1103
+ put?: never;
1104
+ /**
1105
+ * Take a pw code subagent off the session's list
1106
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
1107
+ *
1108
+ * Takes a subagent that is not running off the session's list for every window showing the session, and says so with a subagent_dismissed event on its feed. It is not deleted: its transcript still opens, a message or the session's model can still give it work, and running again lists it again. Refused with 409 while it runs; stop it first. Like stop, it is not held to the remote permission ceiling.
1109
+ */
1110
+ post: operations["dismiss-agent-session-subagent"];
1111
+ delete?: never;
1112
+ options?: never;
1113
+ head?: never;
1114
+ patch?: never;
1115
+ trace?: never;
1116
+ };
1073
1117
  "/api/code/machines/{machine}/sessions/{id}/subagents/{subId}/messages": {
1074
1118
  parameters: {
1075
1119
  query?: never;
@@ -1136,6 +1180,28 @@ export interface paths {
1136
1180
  patch?: never;
1137
1181
  trace?: never;
1138
1182
  };
1183
+ "/api/code/machines/{machine}/sessions/{id}/transcript": {
1184
+ parameters: {
1185
+ query?: never;
1186
+ header?: never;
1187
+ path?: never;
1188
+ cookie?: never;
1189
+ };
1190
+ /**
1191
+ * Get a pw code session transcript, its end first
1192
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
1193
+ *
1194
+ * Returns the session as get-agent-session does, with its history in two parts: tail holds the session and the end of its history, and older the history before it. The tail is written first, so a reader on a slow connection can show where the conversation stands while the rest arrives.
1195
+ */
1196
+ get: operations["get-agent-session-transcript"];
1197
+ put?: never;
1198
+ post?: never;
1199
+ delete?: never;
1200
+ options?: never;
1201
+ head?: never;
1202
+ patch?: never;
1203
+ trace?: never;
1204
+ };
1139
1205
  "/api/code/machines/{machine}/sessions/{id}/worktree": {
1140
1206
  parameters: {
1141
1207
  query?: never;
@@ -1230,6 +1296,7 @@ export interface components {
1230
1296
  name: string;
1231
1297
  plan?: string;
1232
1298
  refreshing?: boolean;
1299
+ sessions?: string[] | null;
1233
1300
  signInRequired?: boolean;
1234
1301
  usage?: string;
1235
1302
  /** Format: date-time */
@@ -1237,6 +1304,16 @@ export interface components {
1237
1304
  /** Format: double */
1238
1305
  weeklyUsedPercent?: number;
1239
1306
  };
1307
+ AgentClaudeAccountMoveBody: {
1308
+ /** @description Session id to leave on its account, such as the one the caller switches itself. */
1309
+ except?: string;
1310
+ /** @description Claude Code account on the machine to move the sessions to. */
1311
+ to: string;
1312
+ };
1313
+ AgentClaudeAccountMoved: {
1314
+ /** @description Ids of the sessions now on the account moved to. A session the caller may not drive stays where it is. */
1315
+ moved: string[] | null;
1316
+ };
1240
1317
  AgentClaudeLoginEvent: {
1241
1318
  data?: string;
1242
1319
  login: components["schemas"]["ClaudeLogin"];
@@ -1281,6 +1358,8 @@ export interface components {
1281
1358
  output: string;
1282
1359
  };
1283
1360
  AgentCompactBody: {
1361
+ /** @description Names this request on the session's event feed, whose command_started event carries it once the compaction begins. */
1362
+ client?: string;
1284
1363
  /** @description What the summary should keep. */
1285
1364
  focus?: string;
1286
1365
  };
@@ -1387,32 +1466,52 @@ export interface components {
1387
1466
  claudeInstalled?: boolean;
1388
1467
  /** @description The daemon supports signing in to Claude Code from the web. */
1389
1468
  claudeLogin?: boolean;
1469
+ /** @description Cloud provider of a cloud cluster or instance. */
1470
+ csp?: string;
1390
1471
  /** @description Machine id the pw code daemon reported, when it answered. A local computer with the same id as a resource is the same host and is listed only as the resource. */
1391
1472
  daemonId?: string;
1392
1473
  /** @description The daemon lists the machine's folders, for choosing where a session starts. */
1393
1474
  directories?: boolean;
1394
1475
  error?: string;
1476
+ /** @description The daemon can fork a session while a turn runs, copying it up to its last reply. */
1477
+ forkMidTurn?: boolean;
1478
+ /** @description Home directory of the daemon's user, when it answered, where a session starts on a machine with no recent directory. */
1479
+ home?: string;
1395
1480
  /** @description Hostname the daemon reported, when it answered. */
1396
1481
  hostname?: string;
1397
- /** @description Hex ObjectID of the cluster, pool, or instance document; for a local computer, the id its pw code daemon registered. */
1482
+ /** @description Hex ObjectID of the cluster, pool, or instance document; for a local computer, the id its pw code daemon registered; workspace for the caller's own workspace. */
1398
1483
  id: string;
1484
+ /** @description The icon uploaded for the resource. */
1485
+ imageUrl?: string;
1399
1486
  /**
1400
- * @description local is a computer whose pw code daemon connected itself; the others are resources reached through their pw agent.
1487
+ * @description local is a computer whose pw code daemon connected itself; workspace is the caller's own workspace, which is always listed; the others are resources reached through their pw agent.
1401
1488
  * @enum {string}
1402
1489
  */
1403
- kind: "cloud" | "existing" | "instance" | "local";
1490
+ kind: "cloud" | "existing" | "instance" | "local" | "workspace";
1404
1491
  name: string;
1492
+ /** @description Operating system as Go names it (darwin, linux, windows): the one the machine's pw code daemon reported when it answered, else the one an existing cluster's agent reported. */
1493
+ os?: string;
1405
1494
  /** @description Platform username of the resource owner. */
1406
1495
  owner: string;
1407
1496
  /** @description Modes the machine's pw code daemon accepts. Absent when the daemon predates the list, in which case it accepts read-only, accept-edits, bypass-permissions and plan. */
1408
1497
  permissionModes?: ("read-only" | "accept-edits" | "auto" | "bypass-permissions" | "plan")[] | null;
1498
+ /** @description The pw build the machine's pw code daemon runs, when it answered. Canary builds share a release, so only the build tells two of them apart. */
1499
+ pwBuild?: string;
1500
+ /** @description A newer pw than the machine's pw code daemon runs, and how far installing it got. Absent when its pw is the newest, or the daemon predates reporting one. */
1501
+ pwUpdate?: components["schemas"]["PwUpdate"];
1502
+ /** @description The daemon installs the platform's newest pw when a session on it runs /upgrade. */
1503
+ pwUpgrade?: boolean;
1504
+ /** @description The pw release the machine's pw code daemon runs, when it answered. */
1505
+ pwVersion?: string;
1409
1506
  /** @enum {string} */
1410
1507
  remoteMaxPermissionMode?: "" | "read-only" | "accept-edits" | "auto" | "bypass-permissions" | "plan";
1411
1508
  remoteStart?: boolean;
1509
+ /** @description Scheduler of an existing cluster. */
1510
+ schedulerType?: string;
1412
1511
  /** @description The daemon stores which of the reader's groups a session is in. */
1413
1512
  sessionGroups?: boolean;
1414
1513
  /** @enum {string} */
1415
- status: "connected" | "no_daemon" | "no_agent" | "unreachable" | "unsupported_agent";
1514
+ status: "connected" | "no_daemon" | "no_agent" | "unreachable" | "unsupported_agent" | "starting";
1416
1515
  /** @description Session store the pw code daemon reported, when it answered. Machines with the same store list the same sessions, which are listed once. */
1417
1516
  storeId?: string;
1418
1517
  };
@@ -1517,6 +1616,9 @@ export interface components {
1517
1616
  turnStartedAt?: string;
1518
1617
  /** Format: date-time */
1519
1618
  updatedAt: string;
1619
+ /** Format: date-time */
1620
+ usageLimitResumeAt?: string;
1621
+ waitingForUsageLimit?: boolean;
1520
1622
  workspace: string;
1521
1623
  };
1522
1624
  AgentSessionCleared: {
@@ -1539,6 +1641,11 @@ export interface components {
1539
1641
  goal?: components["schemas"]["GoalStatus"];
1540
1642
  group?: string;
1541
1643
  history: components["schemas"]["HistoryItem"][] | null;
1644
+ /**
1645
+ * Format: int64
1646
+ * @description Where history begins in the session's whole history: on the tail of a transcript, how many items older holds. Absent when history is the whole of it.
1647
+ */
1648
+ historyStart?: number;
1542
1649
  id: string;
1543
1650
  /** Format: int64 */
1544
1651
  inputTokens?: number;
@@ -1675,6 +1782,7 @@ export interface components {
1675
1782
  result?: string;
1676
1783
  /** Format: date-time */
1677
1784
  resumeAt?: string;
1785
+ scheduled?: components["schemas"]["ScheduledRun"];
1678
1786
  /** Format: int64 */
1679
1787
  seq: number;
1680
1788
  shellProgress?: components["schemas"]["ShellProgress"];
@@ -1690,6 +1798,12 @@ export interface components {
1690
1798
  /** @description The session's subagents in the order they started. Their status is empty when the machine's pw code is too old to say how its subagents stand. */
1691
1799
  subagents: components["schemas"]["Subagent"][] | null;
1692
1800
  };
1801
+ AgentTranscript: {
1802
+ /** @description The history before the tail's, oldest first. The whole history is older followed by tail.history. */
1803
+ older: components["schemas"]["HistoryItem"][] | null;
1804
+ /** @description The session, with the end of its history: what a reader sees first. */
1805
+ tail: components["schemas"]["AgentSessionDetail"];
1806
+ };
1693
1807
  AgentWorktreeLeft: {
1694
1808
  /**
1695
1809
  * @description left keeps the worktree on the machine; remove_failed is a session that left it, but whose worktree could not be removed and stays.
@@ -1948,6 +2062,8 @@ export interface components {
1948
2062
  * @description Creation timestamp
1949
2063
  */
1950
2064
  createdAt: string;
2065
+ /** @description The reply still being written, when one is */
2066
+ generating?: components["schemas"]["GeneratingReply"];
1951
2067
  /** @description Conversation ID */
1952
2068
  id: string;
1953
2069
  /** @description Whether the current user owns this conversation */
@@ -2021,6 +2137,23 @@ export interface components {
2021
2137
  } & {
2022
2138
  [key: string]: unknown;
2023
2139
  };
2140
+ GeneratingReply: {
2141
+ /** @description Text written so far */
2142
+ content: string;
2143
+ /** @description ID the reply's message will have */
2144
+ messageId: string;
2145
+ /** @description Model writing the reply */
2146
+ model: string;
2147
+ /** @description Message the reply answers */
2148
+ parentId: string | null;
2149
+ /** @description Reasoning written so far */
2150
+ reasoning: string;
2151
+ /**
2152
+ * Format: date-time
2153
+ * @description When the reply started
2154
+ */
2155
+ startedAt: string;
2156
+ };
2024
2157
  GoalProgress: {
2025
2158
  condition?: string;
2026
2159
  /** Format: int64 */
@@ -2056,6 +2189,7 @@ export interface components {
2056
2189
  kind: "user" | "assistant" | "thinking" | "tool_call" | "tool_result" | "notice" | "warning" | "error" | "plan_view" | "goal_view" | "goal_progress" | "turn_end" | "recap" | "compaction";
2057
2190
  pastes?: components["schemas"]["PasteView"][] | null;
2058
2191
  planBody?: string;
2192
+ scheduled?: components["schemas"]["ScheduledRun"];
2059
2193
  /** Format: int64 */
2060
2194
  startLine?: number;
2061
2195
  text?: string;
@@ -2258,6 +2392,17 @@ export interface components {
2258
2392
  */
2259
2393
  status: "unauthorized" | "unreachable";
2260
2394
  };
2395
+ PwUpdate: {
2396
+ canary?: boolean;
2397
+ error?: string;
2398
+ host?: string;
2399
+ path?: string;
2400
+ /** Format: int64 */
2401
+ progress?: number;
2402
+ /** @enum {string} */
2403
+ state: "available" | "installing" | "installed" | "needs_admin";
2404
+ version: string;
2405
+ };
2261
2406
  RemotePolicy: {
2262
2407
  maxPermissionMode: string;
2263
2408
  newSessions: boolean;
@@ -2268,6 +2413,9 @@ export interface components {
2268
2413
  /** @enum {string} */
2269
2414
  state: "connected" | "connecting" | "off";
2270
2415
  };
2416
+ ScheduledRun: {
2417
+ taskId?: string;
2418
+ };
2271
2419
  SendMessageBody: {
2272
2420
  /** @description Images uploaded to the session with upload-agent-session-image, each named in the text by its placeholder. */
2273
2421
  images?: components["schemas"]["AgentImageRef"][] | null;
@@ -3017,6 +3165,42 @@ export interface operations {
3017
3165
  };
3018
3166
  };
3019
3167
  };
3168
+ "move-agent-machine-claude-account-sessions": {
3169
+ parameters: {
3170
+ query?: never;
3171
+ header?: never;
3172
+ path: {
3173
+ machine: string;
3174
+ name: string;
3175
+ };
3176
+ cookie?: never;
3177
+ };
3178
+ requestBody: {
3179
+ content: {
3180
+ "application/json": components["schemas"]["AgentClaudeAccountMoveBody"];
3181
+ };
3182
+ };
3183
+ responses: {
3184
+ /** @description OK */
3185
+ 200: {
3186
+ headers: {
3187
+ [name: string]: unknown;
3188
+ };
3189
+ content: {
3190
+ "application/json": components["schemas"]["AgentClaudeAccountMoved"];
3191
+ };
3192
+ };
3193
+ /** @description Error */
3194
+ default: {
3195
+ headers: {
3196
+ [name: string]: unknown;
3197
+ };
3198
+ content: {
3199
+ "application/json": components["schemas"]["Error"];
3200
+ };
3201
+ };
3202
+ };
3203
+ };
3020
3204
  "start-agent-claude-login": {
3021
3205
  parameters: {
3022
3206
  query?: never;
@@ -4409,6 +4593,40 @@ export interface operations {
4409
4593
  };
4410
4594
  };
4411
4595
  };
4596
+ "dismiss-agent-session-subagent": {
4597
+ parameters: {
4598
+ query?: never;
4599
+ header?: never;
4600
+ path: {
4601
+ /** @description Machine id from the machines list. */
4602
+ machine: string;
4603
+ /** @description Session id as the daemon reports it. */
4604
+ id: string;
4605
+ /** @description Subagent id from the session's subagents. */
4606
+ subId: string;
4607
+ };
4608
+ cookie?: never;
4609
+ };
4610
+ requestBody?: never;
4611
+ responses: {
4612
+ /** @description No Content */
4613
+ 204: {
4614
+ headers: {
4615
+ [name: string]: unknown;
4616
+ };
4617
+ content?: never;
4618
+ };
4619
+ /** @description Error */
4620
+ default: {
4621
+ headers: {
4622
+ [name: string]: unknown;
4623
+ };
4624
+ content: {
4625
+ "application/json": components["schemas"]["Error"];
4626
+ };
4627
+ };
4628
+ };
4629
+ };
4412
4630
  "send-agent-session-subagent-message": {
4413
4631
  parameters: {
4414
4632
  query?: never;
@@ -4521,6 +4739,50 @@ export interface operations {
4521
4739
  };
4522
4740
  };
4523
4741
  };
4742
+ "get-agent-session-transcript": {
4743
+ parameters: {
4744
+ query?: {
4745
+ /** @description Set to refs, each image in the history that has a ref comes with empty data: its preview is read from the session's image route with preview=true. */
4746
+ previews?: "refs";
4747
+ /** @description About how many history items the tail holds. It is longer when no item that near the end starts cleanly: a tool result is never parted from its call. */
4748
+ tail?: number;
4749
+ };
4750
+ header?: {
4751
+ /** @description The ETag of a transcript you hold. While the session has not changed, the answer is 304 with no body, and its machine does not send the transcript again. */
4752
+ "If-None-Match"?: string;
4753
+ };
4754
+ path: {
4755
+ /** @description Machine id from the machines list. */
4756
+ machine: string;
4757
+ /** @description Session id as the daemon reports it. */
4758
+ id: string;
4759
+ };
4760
+ cookie?: never;
4761
+ };
4762
+ requestBody?: never;
4763
+ responses: {
4764
+ /** @description OK */
4765
+ 200: {
4766
+ headers: {
4767
+ "Cache-Control"?: string;
4768
+ ETag?: string;
4769
+ [name: string]: unknown;
4770
+ };
4771
+ content: {
4772
+ "application/json": components["schemas"]["AgentTranscript"];
4773
+ };
4774
+ };
4775
+ /** @description Error */
4776
+ default: {
4777
+ headers: {
4778
+ [name: string]: unknown;
4779
+ };
4780
+ content: {
4781
+ "application/json": components["schemas"]["Error"];
4782
+ };
4783
+ };
4784
+ };
4785
+ };
4524
4786
  "get-agent-session-worktree": {
4525
4787
  parameters: {
4526
4788
  query?: never;
@@ -67,6 +67,7 @@ declare function chatStrings(t: PwCodeTranslator<'agentTranscript'>, tAgents: Pw
67
67
  previewOf: (label: string) => string;
68
68
  notesLabel: string;
69
69
  notesPlaceholder: string;
70
+ addNotes: string;
70
71
  notesOnly: string;
71
72
  todoPending: string;
72
73
  todoInProgress: string;
@@ -104,6 +105,9 @@ declare function chatStrings(t: PwCodeTranslator<'agentTranscript'>, tAgents: Pw
104
105
  input: {
105
106
  stopGenerating: string;
106
107
  loadingCommands: string;
108
+ emoji: string;
109
+ shellMode: string;
110
+ shellHint: string;
107
111
  };
108
112
  thread: {
109
113
  jumpToPrompt: (text: string) => string;
@@ -79,6 +79,7 @@ function chatStrings(t, tAgents, tools) {
79
79
  previewOf: (label) => t("transcript.previewOf", { label }),
80
80
  notesLabel: t("transcript.notesLabel"),
81
81
  notesPlaceholder: t("transcript.notesPlaceholder"),
82
+ addNotes: t("transcript.addNotes"),
82
83
  notesOnly: t("transcript.notesOnly"),
83
84
  todoPending: t("transcript.todoPending"),
84
85
  todoInProgress: t("transcript.todoInProgress"),
@@ -121,7 +122,10 @@ function chatStrings(t, tAgents, tools) {
121
122
  },
122
123
  input: {
123
124
  stopGenerating: t("input.stopGenerating"),
124
- loadingCommands: t("input.loadingCommands")
125
+ loadingCommands: t("input.loadingCommands"),
126
+ emoji: t("input.emoji"),
127
+ shellMode: t("input.shellMode"),
128
+ shellHint: t("input.shellHint")
125
129
  },
126
130
  thread: { jumpToPrompt: (text) => t("thread.jumpToPrompt", { text }) },
127
131
  find: {
@@ -3,7 +3,7 @@ import type { Schemas } from './apiClient.js';
3
3
  import type { claudeApi } from './claudeApi.js';
4
4
  export type ClaudeAccount = Schemas['AgentClaudeAccount'];
5
5
  /** The account hooks of `createPwCodeApi`. */
6
- export type ClaudeAccountCalls = Pick<ReturnType<typeof claudeApi>, 'useClaudeAccounts' | 'useRefreshClaudeModels' | 'useRemoveClaudeAccount'>;
6
+ export type ClaudeAccountCalls = Pick<ReturnType<typeof claudeApi>, 'useClaudeAccounts' | 'useRefreshClaudeModels' | 'useRemoveClaudeAccount' | 'useMoveClaudeAccountSessions'>;
7
7
  /** What the account panel shows: the list, or one step taken from it. */
8
8
  export type ClaudeAccountView = {
9
9
  kind: 'list';
@@ -86,6 +86,15 @@ export interface ClaudeAccountPanelState {
86
86
  /** Signs the account out and deletes it, then returns to the list. A
87
87
  * selected account falls back to `default`. */
88
88
  removeAccount: (name: string) => Promise<void>;
89
+ /** The session waits at its account's usage limit, so a pick continues it at once. */
90
+ handoff: boolean;
91
+ /** The other sessions on the selected account a pick in a handoff can take along, which share its limit. */
92
+ others: number;
93
+ /** The label of the option to take them along, offered with the list while
94
+ * the setting can change; null when it isn't. */
95
+ moveOthersLabel: string | null;
96
+ moveOthers: boolean;
97
+ setMoveOthers: (move: boolean) => void;
89
98
  }
90
99
  /** The refusal of a read that needs the account signed in first. */
91
100
  export declare function claudeSignInRequired(error: unknown): boolean;
@@ -99,7 +108,7 @@ export declare function useClaudeAccountStartRow(panel: Pick<ClaudeAccountPanelS
99
108
  /** The Claude Code accounts on a machine, and the steps a panel listing them
100
109
  * takes: adding, signing in, removing after a confirmation the host shows,
101
110
  * and choosing one for the `account` setting. */
102
- export declare function useClaudeAccountPanel(calls: ClaudeAccountCalls, { machine, machineName, sessionId, claudeInstalled, claudeAllowed, claudeLogin, claudeAccountRemove, account, onClose, }: {
111
+ export declare function useClaudeAccountPanel(calls: ClaudeAccountCalls, { machine, machineName, sessionId, claudeInstalled, claudeAllowed, claudeLogin, claudeAccountRemove, waitingAtLimit, account, onClose, onMovedOthers, onMoveError, }: {
103
112
  machine: string;
104
113
  machineName: string;
105
114
  sessionId?: string | undefined;
@@ -109,8 +118,15 @@ export declare function useClaudeAccountPanel(calls: ClaudeAccountCalls, { machi
109
118
  claudeLogin?: boolean | undefined;
110
119
  /** The machine can remove accounts from here. */
111
120
  claudeAccountRemove?: boolean | undefined;
121
+ /** The session's turn waits at its account's usage limit, as
122
+ * `usePwCodeSessionScreen`'s `waitingAtLimit` says. */
123
+ waitingAtLimit?: boolean | undefined;
112
124
  account: BoundSetting;
113
125
  onClose: () => void;
126
+ /** Called once a pick has taken other sessions along, with the words to
127
+ * tell the reader, how many moved and the account they moved to. */
128
+ onMovedOthers?: ((message: string, moved: number, account: string) => void) | undefined;
129
+ onMoveError?: ((error: unknown) => void) | undefined;
114
130
  }): ClaudeAccountPanelState;
115
131
  /** The confirmation of a removal: whether it runs, and why it last failed. */
116
132
  export declare function useClaudeAccountRemoval(remove: () => Promise<void>): {
@@ -123,6 +139,8 @@ export declare function useClaudeAccountRemoval(remove: () => Promise<void>): {
123
139
  export declare function useClaudeAccountName(onContinue: (name: string) => void): {
124
140
  name: string;
125
141
  invalid: boolean;
142
+ /** The longest name Claude Code takes, for the field to stop at. */
143
+ maxLength: number;
126
144
  change: (value: string) => void;
127
145
  submit: () => void;
128
146
  };
@@ -8,18 +8,19 @@ var signInRequiredCode = "agents_claude_sign_in_required";
8
8
  function claudeSignInRequired(error) {
9
9
  return error?.code === signInRequiredCode;
10
10
  }
11
+ var ACCOUNT_NAME_MAX = 64;
11
12
  /** The account name `input` gives once trimmed, or null when Claude Code
12
13
  * can't take it. */
13
14
  function claudeAccountName(input) {
14
15
  const name = input.trim();
15
- if (!/^[a-zA-Z0-9_.@-]{1,64}$/.test(name) || name === "." || name === ".." || name.endsWith(".lock")) return null;
16
+ if (!/^[a-zA-Z0-9_.@-]+$/.test(name) || name.length > ACCOUNT_NAME_MAX || name === "." || name === ".." || name.endsWith(".lock")) return null;
16
17
  return name;
17
18
  }
18
19
  function unavailableNotice(allowed, installed, t) {
19
20
  if (!allowed) return t("claude.disabled");
20
21
  return installed ? null : t("claude.notInstalled");
21
22
  }
22
- function viewWords(view, host, hint, t) {
23
+ function viewWords(view, host, hint, handoff, t) {
23
24
  switch (view.kind) {
24
25
  case "signIn": return {
25
26
  title: t("claude.signInTitle"),
@@ -49,7 +50,7 @@ function viewWords(view, host, hint, t) {
49
50
  removeBody: null
50
51
  };
51
52
  default: return {
52
- title: t("claude.accounts"),
53
+ title: handoff ? t("claude.continueOnAnother") : t("claude.accounts"),
53
54
  description: t("claude.hostAccounts", { host }),
54
55
  signInNote: hint ?? t("claude.loginStaysOnHost", { host }),
55
56
  removeBody: null
@@ -104,7 +105,7 @@ function accountDetail(account, hint) {
104
105
  /** The Claude Code accounts on a machine, and the steps a panel listing them
105
106
  * takes: adding, signing in, removing after a confirmation the host shows,
106
107
  * and choosing one for the `account` setting. */
107
- function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeInstalled, claudeAllowed, claudeLogin = false, claudeAccountRemove = false, account, onClose }) {
108
+ function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeInstalled, claudeAllowed, claudeLogin = false, claudeAccountRemove = false, waitingAtLimit, account, onClose, onMovedOthers, onMoveError }) {
108
109
  const t = usePwCodeTranslations("agents");
109
110
  const [adding, setAdding] = useState(false);
110
111
  const [signIn, setSignIn] = useState(null);
@@ -112,10 +113,19 @@ function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeI
112
113
  const [refreshError, setRefreshError] = useState(null);
113
114
  const [refreshingModels, setRefreshingModels] = useState(false);
114
115
  const available = claudeAllowed && claudeInstalled;
115
- const catalog = calls.useClaudeAccounts(machine, sessionId, available);
116
+ const catalog = calls.useClaudeAccounts(machine, sessionId, available, waitingAtLimit);
116
117
  const refreshModels = calls.useRefreshClaudeModels(machine, sessionId);
117
118
  const deleteAccount = calls.useRemoveClaudeAccount(machine, sessionId);
118
119
  const selected = account.value || void 0;
120
+ const takeAlong = useTakeAlong(calls, {
121
+ machine,
122
+ sessionId,
123
+ waitingAtLimit,
124
+ selected,
125
+ accounts: catalog.accounts,
126
+ onMovedOthers,
127
+ onMoveError
128
+ });
119
129
  const disabled = useRef(account.disabled);
120
130
  disabled.current = account.disabled;
121
131
  useEffect(() => {
@@ -147,6 +157,7 @@ function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeI
147
157
  };
148
158
  const select = (name) => {
149
159
  account.onChange(name);
160
+ takeAlong.to(name);
150
161
  onClose();
151
162
  };
152
163
  const unlessDisabled = (run) => () => {
@@ -184,11 +195,12 @@ function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeI
184
195
  } : { kind: "list" };
185
196
  const hint = signInHint(claudeLogin, t);
186
197
  const canAdd = claudeLogin && !account.disabled;
198
+ const controls = listControls(view, available, canAdd);
187
199
  return {
188
200
  available,
189
201
  notice: unavailableNotice(claudeAllowed, claudeInstalled, t),
190
202
  view,
191
- ...viewWords(view, machineName, hint, t),
203
+ ...viewWords(view, machineName, hint, takeAlong.handoff, t),
192
204
  emptyHint: hint,
193
205
  accounts: catalog.accounts,
194
206
  loading: catalog.loading,
@@ -197,7 +209,7 @@ function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeI
197
209
  empty: !catalog.loading && !catalog.error && catalog.accounts.length === 0,
198
210
  refreshing: catalog.refreshing || refreshingModels,
199
211
  canAdd,
200
- ...listControls(view, available, canAdd),
212
+ ...controls,
201
213
  ...startRows(catalog.accounts, account.value, claudeLogin),
202
214
  isDisabled: (a) => !!account.disabled || !!a.signInRequired && !claudeLogin,
203
215
  detail: (a) => accountDetail(a, hint),
@@ -231,6 +243,37 @@ function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeI
231
243
  await deleteAccount(name);
232
244
  if (account.value === name && !account.disabled) account.onChange("default");
233
245
  setRemoving(null);
246
+ },
247
+ handoff: takeAlong.handoff,
248
+ others: takeAlong.others,
249
+ moveOthersLabel: controls.showRefresh && takeAlong.others > 0 && !account.disabled ? t("claude.moveOthers", {
250
+ count: takeAlong.others,
251
+ account: takeAlong.from
252
+ }) : null,
253
+ moveOthers: takeAlong.moveOthers,
254
+ setMoveOthers: takeAlong.setMoveOthers
255
+ };
256
+ }
257
+ /** The other sessions on the account a session leaves, which share its limit,
258
+ * and their move along with it while the reader leaves them ticked. */
259
+ function useTakeAlong(calls, { machine, sessionId, waitingAtLimit, selected, accounts, onMovedOthers, onMoveError }) {
260
+ const t = usePwCodeTranslations("agents");
261
+ const [moveOthers, setMoveOthers] = useState(true);
262
+ const moveSessions = calls.useMoveClaudeAccountSessions(machine, sessionId);
263
+ const handoff = !!sessionId && waitingAtLimit === true;
264
+ const from = selected ?? "default";
265
+ const others = handoff ? accounts.find((a) => a.name === from)?.sessions?.filter((id) => id !== sessionId).length ?? 0 : 0;
266
+ return {
267
+ handoff,
268
+ from,
269
+ others,
270
+ moveOthers,
271
+ setMoveOthers,
272
+ to: (name) => {
273
+ if (moveOthers && others > 0 && name !== from) moveSessions(from, name).then((moved) => onMovedOthers?.(t("claude.movedOthers", {
274
+ count: moved.length,
275
+ account: name
276
+ }), moved.length, name), (cause) => onMoveError?.(cause));
234
277
  }
235
278
  };
236
279
  }
@@ -263,6 +306,7 @@ function useClaudeAccountName(onContinue) {
263
306
  return {
264
307
  name,
265
308
  invalid,
309
+ maxLength: ACCOUNT_NAME_MAX,
266
310
  change: (value) => {
267
311
  setName(value);
268
312
  setInvalid(false);