@parallelworks/code 0.2.0 → 0.4.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 (126) hide show
  1. package/README.md +602 -84
  2. package/dist/accountApi.d.ts +31 -0
  3. package/dist/accountApi.js +182 -0
  4. package/dist/agentSwitcher.d.ts +109 -0
  5. package/dist/agentSwitcher.js +165 -0
  6. package/dist/ago.d.ts +8 -0
  7. package/dist/ago.js +26 -0
  8. package/dist/allocations.d.ts +41 -0
  9. package/dist/allocations.js +76 -0
  10. package/dist/api.d.ts +1213 -66
  11. package/dist/base64.d.ts +3 -0
  12. package/dist/base64.js +15 -0
  13. package/dist/chatHandoff.d.ts +12 -0
  14. package/dist/chatHandoff.js +27 -0
  15. package/dist/chatStrings.d.ts +188 -0
  16. package/dist/chatStrings.js +217 -0
  17. package/dist/claudeAccounts.d.ts +149 -0
  18. package/dist/claudeAccounts.js +328 -0
  19. package/dist/claudeApi.js +1 -1
  20. package/dist/claudeSignIn.d.ts +80 -0
  21. package/dist/claudeSignIn.js +249 -0
  22. package/dist/commandsApi.d.ts +11 -1
  23. package/dist/commandsApi.js +24 -5
  24. package/dist/contextRow.d.ts +25 -0
  25. package/dist/contextRow.js +16 -0
  26. package/dist/createPwCodeApi.d.ts +52 -5
  27. package/dist/createPwCodeApi.js +20 -2
  28. package/dist/directories.d.ts +161 -0
  29. package/dist/directories.js +301 -0
  30. package/dist/goal.d.ts +89 -0
  31. package/dist/goal.js +164 -0
  32. package/dist/howSessionsAppear.d.ts +12 -0
  33. package/dist/howSessionsAppear.js +24 -0
  34. package/dist/imageFit.d.ts +23 -0
  35. package/dist/imageFit.js +27 -0
  36. package/dist/images.d.ts +28 -0
  37. package/dist/images.js +38 -6
  38. package/dist/index.d.ts +41 -3
  39. package/dist/index.js +40 -4
  40. package/dist/loadError.d.ts +8 -0
  41. package/dist/loadError.js +19 -0
  42. package/dist/locales/en/agentTranscript.js +75 -22
  43. package/dist/locales/en/agents.js +76 -14
  44. package/dist/locales/en.d.ts +129 -21
  45. package/dist/locales/es/agentTranscript.js +75 -22
  46. package/dist/locales/es/agents.js +76 -14
  47. package/dist/locales/ja/agentTranscript.js +78 -25
  48. package/dist/locales/ja/agents.js +49 -124
  49. package/dist/locales/ko/agentTranscript.js +75 -22
  50. package/dist/locales/ko/agents.js +76 -14
  51. package/dist/locales/zh/agentTranscript.js +73 -20
  52. package/dist/locales/zh/agents.js +76 -14
  53. package/dist/machine.d.ts +4 -0
  54. package/dist/modelPicker.d.ts +79 -0
  55. package/dist/modelPicker.js +107 -0
  56. package/dist/models.d.ts +47 -0
  57. package/dist/models.js +49 -0
  58. package/dist/notices.d.ts +2 -1
  59. package/dist/notices.js +75 -21
  60. package/dist/platformDefaults.d.ts +22 -0
  61. package/dist/platformDefaults.js +30 -0
  62. package/dist/preferences.d.ts +78 -0
  63. package/dist/preferences.js +128 -0
  64. package/dist/pullRequestList.d.ts +60 -0
  65. package/dist/pullRequestList.js +125 -0
  66. package/dist/query.d.ts +6 -2
  67. package/dist/query.js +85 -10
  68. package/dist/session.d.ts +10 -2
  69. package/dist/session.js +12 -8
  70. package/dist/sessionActions.d.ts +115 -0
  71. package/dist/sessionActions.js +186 -0
  72. package/dist/sessionEvents.d.ts +8 -3
  73. package/dist/sessionEvents.js +10 -5
  74. package/dist/sessionGroups.d.ts +50 -0
  75. package/dist/sessionGroups.js +73 -0
  76. package/dist/sessionHeader.d.ts +14 -0
  77. package/dist/sessionHeader.js +16 -0
  78. package/dist/sessionList.d.ts +182 -0
  79. package/dist/sessionList.js +333 -0
  80. package/dist/sessionScreen.d.ts +193 -0
  81. package/dist/sessionScreen.js +213 -0
  82. package/dist/sessionsApi.d.ts +13 -3
  83. package/dist/sessionsApi.js +90 -33
  84. package/dist/settingsApi.d.ts +38 -0
  85. package/dist/settingsApi.js +151 -0
  86. package/dist/startPage.d.ts +153 -0
  87. package/dist/startPage.js +174 -0
  88. package/dist/startSession.d.ts +172 -0
  89. package/dist/startSession.js +256 -0
  90. package/dist/terminalHandoffPanel.d.ts +30 -0
  91. package/dist/terminalHandoffPanel.js +33 -0
  92. package/dist/transcript.d.ts +2 -0
  93. package/dist/transcript.js +62 -26
  94. package/dist/types.d.ts +11 -1
  95. package/dist/usageLimit.d.ts +8 -0
  96. package/dist/usageLimit.js +13 -0
  97. package/dist/useAwayRecap.d.ts +30 -0
  98. package/dist/useAwayRecap.js +75 -0
  99. package/dist/useComposer.d.ts +145 -0
  100. package/dist/useComposer.js +295 -0
  101. package/dist/useComposerImages.d.ts +71 -0
  102. package/dist/useComposerImages.js +218 -0
  103. package/dist/useComposerPastes.d.ts +70 -0
  104. package/dist/useComposerPastes.js +130 -0
  105. package/dist/useConversation.d.ts +199 -0
  106. package/dist/useConversation.js +314 -0
  107. package/dist/useSubagent.d.ts +104 -0
  108. package/dist/useSubagent.js +212 -0
  109. package/dist/useTranscript.d.ts +23 -3
  110. package/dist/useTranscript.js +76 -19
  111. package/dist/wording.js +2 -2
  112. package/dist/workingDirectories.d.ts +63 -0
  113. package/dist/workingDirectories.js +95 -0
  114. package/dist/worktreeChoice.d.ts +31 -0
  115. package/dist/worktreeChoice.js +38 -0
  116. package/locales/en/agentTranscript.json +69 -21
  117. package/locales/en/agents.json +73 -13
  118. package/locales/es/agentTranscript.json +69 -21
  119. package/locales/es/agents.json +73 -13
  120. package/locales/ja/agentTranscript.json +72 -24
  121. package/locales/ja/agents.json +73 -13
  122. package/locales/ko/agentTranscript.json +69 -21
  123. package/locales/ko/agents.json +73 -13
  124. package/locales/zh/agentTranscript.json +67 -19
  125. package/locales/zh/agents.json +73 -13
  126. package/package.json +6 -3
package/README.md CHANGED
@@ -1,64 +1,359 @@
1
1
  # @parallelworks/code
2
2
 
3
3
  Shared client logic for pw code sessions on Parallel Works ACTIVATE: the calls
4
- and data hooks a session's pages read through, what a session's daemon sends,
5
- and the transcript its history and live event stream reduce to. Every app that
6
- shows a session uses the same code, so a session reads the same in each.
4
+ and data hooks a session's screens read through, what a session's daemon sends,
5
+ the transcript its history and live event stream reduce to, and what each
6
+ screen around it shows. Every app that shows a session uses the same code, so
7
+ a session reads the same in each.
7
8
 
8
9
  It draws nothing. The host hands it an API client, which carries the
9
10
  platform's address and signs each request, and a way to open its sockets; it
10
11
  renders the messages this package turns the session into, worded in the
11
- reader's language.
12
+ reader's language, with its own components.
12
13
 
13
14
  ```bash
14
- pnpm add @parallelworks/code @parallelworks/ui react openapi-fetch swr use-intl
15
+ pnpm add @parallelworks/code @parallelworks/ui @parallelworks/problem react openapi-fetch swr use-intl
15
16
  ```
16
17
 
17
- `@parallelworks/ui`, `react`, `openapi-fetch`, `swr` and `use-intl` are peer
18
- dependencies. Only `@parallelworks/ui/ai/headless` is imported from the ui
19
- package, for the message and part types and the reducers that build them.
18
+ `@parallelworks/ui` (0.136.0 or newer), `@parallelworks/problem`, `react`,
19
+ `openapi-fetch`, `swr` and `use-intl` are peer dependencies. Only the ui
20
+ package's two entries without a DOM are imported:
21
+ `@parallelworks/ui/ai/headless`, for the message and part types, the reducers
22
+ that build them and the chat's shared rules, such as its paste cards and the
23
+ model it picks first, and `@parallelworks/ui/headless`, for its duration and
24
+ byte formats and its clock. Of `@parallelworks/problem`, only its root, to
25
+ read an error's code as the host's own error messages do.
20
26
 
21
27
  ## What is in it
22
28
 
29
+ Most hooks take the API this package builds over the host's client, and
30
+ callbacks for whatever the host does itself: navigating, asking the reader,
31
+ showing a toast, wording an error. Types are exported beside each.
32
+
33
+ ### The API and the wire
34
+
23
35
  - `createPwCodeApi(client, options)`, the calls and SWR data hooks of pw code
24
36
  sessions over the host's `openapi-fetch` client: the sessions and machines
25
- listed (`useSessions`, `useMachines`), a session's transcript
26
- (`useSessionDetail`), its live event feed (`useSessionEvents`), what can be
27
- done to it (`useSessionMutations`, `sendMessage`, `steer`, `answerApproval`,
28
- `resolveTyped`, ...), its subagents, pull requests and worktree, and the
29
- Claude Code models, accounts and sign-in of its machine.
37
+ listed (`useSessions`, `useMachines`, `useMachine`,
38
+ `useWaitingSessionCount`), a session's transcript (`useSessionDetail`), its
39
+ live event feed (`useSessionEvents`), what can be done to it
40
+ (`useSessionMutations`, `sendMessage`, `steer`, `withdrawQueued`,
41
+ `withdrawDirection`, `answerApproval`, `resolveTyped`, ...), its settings
42
+ (`useSessionSettings`), its commands (`usePalette`,
43
+ `useBackgroundCommands`, `requestRecap`, `runGoal`), its subagents, pull
44
+ requests, worktree, images and pastes, and the Claude Code models, accounts
45
+ and sign-in of its machine, and the machine's directories
46
+ (`useDirectories`, `usePathCompletion`, `useDirectoryTree`). It also reads
47
+ the platform's models (`usePlatformModels`), the reader's allocations
48
+ (`useAllocations`) and the AI chat a new session is to carry on
49
+ (`useChatHandoff(chatId)`), says whether pw code is on for the reader
50
+ (`usePwCodeEnabled`), and keeps the reader's choices in their account
51
+ (`usePreference`).
30
52
  - The wire types (`PwCodeSessionDetail`, `PwCodeStreamEvent`,
31
53
  `PwCodeApprovalRequest`, ...): a session's replayed history, its event
32
54
  frames and the answers it accepts. A host that generates its API types can
33
55
  assert they extend these.
34
- - The transcript reducers, which are pure functions: `initialTranscript` seeds
35
- a `TranscriptState` from a fetched session, `applyStreamEvent` applies one
56
+ - What the hooks build on, for a host that reads the same routes itself: the
57
+ feed's path (`sessionEventsPath`), the SWR key's prefix
58
+ (`QUERY_KEY_PREFIX`), how often lists are read again (`SESSIONS_REFRESH_MS`,
59
+ `pullRequestsRefreshMs`), the patches a listing takes
60
+ (`patchSessionNames`, `patchPullRequestStates`, `reachedByFeed`), which
61
+ frames change a session's subagents (`changesSubagents`), whether a cached
62
+ copy is still current (`cachedCopyCurrent`), when the session was last read
63
+ (`useLastReadAt`), and the part of a paste a message names it by
64
+ (`pasteRefs`).
65
+
66
+ ### The transcript
67
+
68
+ - The reducers, which are pure functions: `initialTranscript` seeds a
69
+ `TranscriptState` from a fetched session, `applyStreamEvent` applies one
36
70
  event frame to it, and `historyToMessages` maps replayed history alone.
71
+ Beside them, what a transcript holds (`pendingMessages`,
72
+ `pendingApprovals`, `turnRunning`, `bashRunning`, `reviewingCount`,
73
+ `liveSessionStatus`), where its feed resumes (`resumeCursor`), a subagent's
74
+ share of it (`subagentFrame`, `subagentSessionDetail`), and the edits the
75
+ reader's own sends make to it (`appendOwnMessage`, `appendSteeredMessage`,
76
+ `dropMessage`, `resolveApprovalEverywhere`).
37
77
  - `usePwCodeTranscript`, the React state those reduce into, with sending,
38
- steering a running turn, and taking back a queued message.
78
+ steering a running turn, and taking back a message the model has not been
79
+ handed yet, queued behind the turn or steered into it (`canRemoveQueued`,
80
+ `removeQueued`), or every one the machine still holds at once, each with
81
+ its pastes and images, and the first refusal, since one the model read
82
+ meanwhile stays sent (`takeBackPending`, each a `PwCodeTakenBack`).
83
+ The `typed` option of its `sendMessage` keeps what was typed when a command
84
+ resolved it to other text, so it comes back as typed.
39
85
  - `approvalToPart` and `approvalAnswerBody`, between a session's approval
40
86
  requests and the answer it accepts.
41
- - The paths a session's images are served from (`sessionImageUrl`,
42
- `sessionGitHubImageUrl`).
43
- - What a list of sessions and machines means, as pure functions over the
44
- structural `PwCodeSession` and `PwCodeMachine`: which sessions wait on the
45
- reader and in what order they show (`triageSessions`, `newestFirst`,
46
- `needsYou`, `isActiveSession`, `isMidTurn`), the tone a row takes
47
- (`sessionVariant`), whether a machine can be reached or can start a session
48
- (`isMachineDown`, `canStartHere`), the folders a machine's sessions suggest
49
- (`recentDirectories`), and the command that picks a session up in a terminal
50
- (`terminalHandoff`).
51
- - Where typed text goes (`slashAction`, `shellCommand`) and the commands a
52
- session offers (`paletteOptions`), read from the structural `PwCodePalette`.
87
+ - Where a session's images load from: by ref (`sessionImageUrl`,
88
+ `isSessionImageUrl`), and for a GitHub attachment in a pull request the
89
+ session opened, through its machine first (`markdownImageSources`,
90
+ `githubAttachmentAsset`, `sessionGitHubImageUrl`), and the link it becomes
91
+ once none of those loads (`markdownImageLink`).
92
+
93
+ ### An open session
94
+
95
+ - `usePwCodeConversation`, the session's conversation: its live transcript,
96
+ sends routed to its machine and taking them back while they wait, one at a
97
+ time or all at once (`takeBackPending`, which takes nothing while another
98
+ runs), approvals, the notice above the composer, and its subagents.
99
+ - `usePwCodeComposer`, what the composer can do and how the session stands
100
+ for it: typed text goes out as a message, a direction to the running turn,
101
+ a command or a `!` shell run, and the composer locks while the machine is
102
+ unreachable, the session is archived or live elsewhere, or it waits on an
103
+ approval. Its `recall` takes back what waits into the composer, as ↑ or
104
+ Edit under the queue does on the web: `available` says whether anything
105
+ can come back, and `take` resolves to each message's text and pastes, in
106
+ the order they would have reached the model (to none while another `take`
107
+ runs), having put their images back
108
+ through the `images` option's `restore`. It has the shape of the `recall`
109
+ that `@parallelworks/ui/ai`'s composer takes from 0.139.0. A host drawing
110
+ its own composer stops a turn with `stopTurn`, as that composer's stop
111
+ does: while anything can come back, the composer's own take-back runs
112
+ first, then the turn stops, even when the take-back threw, which
113
+ `stopTurn` resolves to. Its command
114
+ outputs (`useCommandOutputs`) and sent prompts (`promptHistory`, per
115
+ person) go with it.
116
+ - `usePwCodeSessionScreen`, the screen around those two: the banner while
117
+ nothing new can reach the transcript (`sessionBanner`, whose `tone` is
118
+ `danger` for a machine that does not answer and `info` for a session live
119
+ elsewhere), the activity line (`sessionActivity`), the goal (`goalLabel`,
120
+ whose dot, a `PwCodeGoalMark`, has the `info` tone, unlit while paused and
121
+ pulsing while a check runs), what shows when the transcript never loaded
122
+ (`loadErrorMessage`), the command menu and the settings row.
123
+ The goal itself is read, edited, paused, resumed and cleared from a panel
124
+ over `useSessionGoal` (a `PwCodeSessionGoal`), which also gives the panel's
125
+ `view` and `note`, the run's `state`, `lastCheck` and `pausedNote`, which
126
+ of pause and resume to offer (`toggle`), when nothing can be asked
127
+ (`busy`), and the draft of a rewritten condition (`draft`, `setDraft`,
128
+ `startEdit`, `empty`, `unchanged`, `canSave`, `saving`, `save`). Its
129
+ working time runs with `useGoalElapsed` and is rounded by `goalElapsed`;
130
+ `goalFacts` says what follows the state.
131
+ Its parts: how stale the transcript is (`useStaleFor`), the draft's key
132
+ (`sessionDraftKey`), which picker the composer opens (`useSessionPicker`),
133
+ the model it runs (`sessionModel`), the settings' options
134
+ (`sessionSettingsOptions`), what the machine allows
135
+ of Claude Code (`claudeOnMachine`), and the account a Claude model runs as
136
+ (`claudeAccountChip`).
137
+ - Images and pastes sent with a message. `useComposerImages` holds the images
138
+ until there is a session to save them with, through the host's encoder,
139
+ which throws `PwCodeImageTooLarge` for one it cannot fit; `fitImageWith`
140
+ works out the sizes an image is written at to fit `IMAGE_MAX_BYTES` and
141
+ `IMAGE_MAX_SIDE`, `IMAGE_TYPES` are the types a session takes, and
142
+ `nextImageSeq` numbers an image's placeholder. `useComposerImages`'
143
+ `restore` puts back the images of a message taken back, already saved with
144
+ the session, and `withoutAppendedImages` takes the placeholders its send
145
+ appended out of that message's text. `useComposerPastes` says where a
146
+ session's long pastes are saved and past what size, set by its model until
147
+ it is live, `usePasteCards` turns
148
+ each one past it into a card that goes as its placeholder, and
149
+ `pasteCardText` words a card.
150
+ - A recap written while the reader is away (`useAwayRecap`), as pw code
151
+ writes one while its terminal is out of focus.
152
+ - Subagents: one subagent's conversation in place of the main one
153
+ (`usePwCodeSubagent`), with what its screen shows: whether it is still
154
+ loading or never loaded (`loading`, and `failed` from its `subagent`
155
+ read's `error`), whether messages show their author (`showAuthor`), its
156
+ activity line (`activity`), where a queued message goes
157
+ (`queueDelivery`), taking one back (`canRemoveQueued`, `removeQueued`) or
158
+ all of them into the composer (`recall`, as the main composer's), its
159
+ composer's draft key (`draftKey`), and the model it runs on (`model`) and
160
+ that model's name (`modelLabel`, from the `modelNames` option, the session
161
+ state's). Beside it, the switcher that lists them
162
+ (`usePwCodeAgentSwitcher`, `switcherAgent`, `usePwCodeAgentLine`,
163
+ `useAgentTypeLabel`), the mark each agent shows for its state
164
+ (`agentMark`), and the tone of its state's word (`stateTone`, a
165
+ `PwCodeStateTone` the host maps to its colors) and whether that word
166
+ shows beside the mark (`flagged`), the main conversation's included.
167
+ - Where typed text goes (`slashAction`, `shellCommand`), the commands a
168
+ session offers (`paletteOptions`), read from the structural
169
+ `PwCodePalette`, whether a direction that got no answer may have landed
170
+ (`steerMayHaveLanded`), and which running tool calls carry the offer to
171
+ move a turn's commands to the background (`offersBackground`,
172
+ `BACKGROUND_TOOL`).
173
+ - What a session's header offers: picking the session up in a terminal
174
+ (`terminalHandoffPanel`, `handoffCommandParts`), the line a turn shows while
175
+ it waits for a usage limit (`useUsageLimitWait`), the worktree the session
176
+ works in, read again when it moves (`useFollowedWorktree`), and how sessions
177
+ get listed (`howSessionsAppear`).
178
+ - A session's working directories: how one is written on its machine
179
+ (`workingDirectoryText`, `PwCodeWorkingDirectoryText`), the path helpers
180
+ that cut a long path to fit (`pathSegments`, `shortestPath`, `cutToFit`,
181
+ `cutSpacing`, `lastSegmentAt`), where a directory is saved
182
+ (`isSavedDirectory`, `directoryScopes`), what an approval allowed in one
183
+ (`allowedAccess`), the added and allowed ones as they are listed
184
+ (`sessionDirectories`, `PwCodeSessionDirectories`,
185
+ `PwCodeAddedDirectoryRow`, `PwCodeAllowedDirectoryRow`), and closing one
186
+ added for the session only (`useRemoveSessionDirectory`).
187
+ - The choice to keep or remove a session's worktree when the session is
188
+ deleted (`useWorktreeChoice`), and what removing it would delete
189
+ (`worktreeWork`).
53
190
  - The short label of a pull or merge request link (`pullRequestLabel`,
54
- `pastedPullRequestLabel`).
191
+ `pastedPullRequestLabel`, `pullRequestShortLabel`, `pullRequestKind`), and
192
+ how a session's pull requests are listed: their order
193
+ (`orderPullRequests`), the tone each state shows in (`pullRequestTone`),
194
+ which fold into a count and how the counts read
195
+ (`foldPullRequests`, `pullRequestGroupState`, `pullRequestWords`), with
196
+ the merged and closed ones folding even when they fit once a row has
197
+ `FOLD_DONE_PULL_REQUESTS_FROM` of them (`donePullRequestsToFold`), and the
198
+ row of directories and pull requests under a session's title
199
+ (`sessionContextRow`), whose states the API's `useSessionPullRequestStates`
200
+ reads for the links the session lists.
201
+
202
+ ### The session list
203
+
204
+ - What a list of sessions and machines means, as pure functions over the
205
+ structural `PwCodeSession` and `PwCodeMachine`: which row is which session
206
+ (`sessionKey`, `isSession`), which sessions wait on the reader and in what
207
+ order they show (`triageSessions`, `newestFirst`, `needsYou`,
208
+ `isActiveSession`, `isMidTurn`), the tone a row takes (`sessionVariant`),
209
+ whether a machine can be reached or can start a session (`isMachineDown`,
210
+ `isConnected`, `canStartHere`), computers apart from resources
211
+ (`isComputer`, `splitMachines`), the folders a machine's sessions suggest
212
+ (`recentDirectories`), and the command that picks a session up in a
213
+ terminal (`terminalHandoff`).
214
+ - `useSessionList`, the list in sections: the pinned sessions, each of the
215
+ reader's groups, then the rest by whether they wait on the reader, are live,
216
+ rest or are archived (`sessionSections`, the one that waits on the reader
217
+ with a `tone`), with folding, dropping a session on a section (`canDrag`,
218
+ `dropSession`), naming a group without the spaces around its name and the
219
+ words of the prompts for it (`renameGroup`, `groupNameWords`,
220
+ `groupDeleteWords`), the menus and keys of a row, a group and the list, and
221
+ the error to show in the list's place while no listing has loaded
222
+ (`loadError`). Beside it, what a search lists (`searchedSessions`), what it
223
+ finds a session by (`sessionSearchText`) and how well
224
+ (`sessionSearchScore`, over the host's own fuzzy scorer, a
225
+ `PwCodeSearchScorer` such as cmdk's `defaultFilter`), the state a result
226
+ shows (`sessionSearchStatus`), each row's mark and second line
227
+ (`sessionMark`, `sessionRowState`), what a session's mark on a collapsed
228
+ list is called (`sessionRailLabel`), and the rows of a machine the listing
229
+ lost, kept so they can say why (`useRetainedSessions`).
230
+ - `useSessionActions`, what can be done to a session from the list and the
231
+ flows behind each: renaming, pinning, grouping, forking, leaving its
232
+ worktree, stopping, archiving, restoring and deleting, asking the reader
233
+ first where it should. Its `rename` carries the words of the prompt for the
234
+ name, and `nameToSave` is the name a prompt saves, or none.
235
+ - The reader's groups (`useSessionGroups`), and the sessions in each
236
+ (`listGroups`, `inFlightFirst`, `groupOf`).
237
+
238
+ ### Starting a session
239
+
240
+ - Hooks a host draws its own start screen over: where it starts
241
+ (`useStartLocation`, `startMachines`, `machineMenu`, and the chip naming
242
+ the machine, `machineChip`, whose `dot` has the `success` tone once one is
243
+ chosen, and which says the machines are still being found while
244
+ `finding`), the permission mode it
245
+ starts in and the machine's bounds on its picker (`useStartPermissionMode`,
246
+ a `PwCodeStartPermission`, `startingMode`), its model, allocation and
247
+ Claude Code account (`useStartModel`), and the start itself with its first
248
+ prompt and images (`useStartSession`). The host passes in its saved
249
+ preferences and opens the session once it starts. `startControls`
250
+ (`PwCodeStartControls`) says which controls are locked while it starts or
251
+ until a machine is chosen, and whether the model picker reads the
252
+ machine's Claude models ahead (`canStart`).
253
+ - Choosing that directory: a machine's directories as it lists them
254
+ (`listDirectories` and `useDirectories` on the API), and the rows a path
255
+ field offers under what is typed, the directory it names, the recent ones
256
+ and the directories inside it (the API's `usePathCompletion`, over
257
+ `pathCompletions`), with the helpers that read typed text as a path
258
+ (`splitTypedPath`, `typedDirectory`, `joinDirectory`, `parentDirectory`,
259
+ `isPathText`, `listedText`), and the refusal of a path that is no
260
+ directory the machine can list (`isUnlistedDirectory`).
261
+ `usePathCompletion` also returns each row as shown (`PwCodePathRow`:
262
+ whether choosing it lists its folders, and the line beside its name), the
263
+ rows in their headed sections (`sections`, from `pathSections`), the line
264
+ under them (`note`, from `pathNote`, which words a failed listing with the
265
+ host's `describeError`), whether to offer browsing, on a machine that lists
266
+ its folders (`canBrowse`), and where browsing opens (`browseFrom`, from
267
+ `browseStart`). `pickedOnClose` is the directory a field closed with an
268
+ edited path picks, and `directoryChip` words the chip naming the directory.
269
+ - Browsing for it: a folder tree of the machine, where it opens, its title
270
+ and the way up (the API's `useDirectoryTree`), and the folders it shows,
271
+ hidden ones only when asked for (`visibleFolders`).
272
+ - The screen around the composer (`useStartScreen`, `PwCodeStartScreen`):
273
+ whether the listing is still loading or never loaded (`loading`,
274
+ `failed`), whether the composer shows or the host says no machine can
275
+ start a session (`showComposer`), whether nothing is listed, so the host
276
+ explains how sessions appear (`explainEmpty`), and answering a listed
277
+ session's question (`answer`).
278
+ - What a start screen offers besides: the sessions to pick back up
279
+ (`startShortlist`, `waitingSince`) with the mark a live one shows
280
+ (`shortlistMark`) and the questions they wait on (`waitingQuestions`); the
281
+ session or chat its address asks for (`startSearch`, `useSessionLink`)
282
+ with the card shown while a linked session is looked for
283
+ (`sessionLinkNotice`, whose `tone` is `warning` once it is missing); the
284
+ composer's commands (`startCommands`) and draft key
285
+ (`newSessionDraftKey`); and a chat handed to a new session, read with the
286
+ API's `useChatHandoff`: the composer's `placeholder`, the `notice` above it
287
+ naming the chat or why it did not load (whose `tone` is then `warning`),
288
+ and its first prompt
289
+ (`chatHandoffStart`, `chatHandoffPrompt`).
290
+ - The models a session can run (`isClaudeModel`, `runsClaude`,
291
+ `canRunModel`, `modelLabel`), the picker a typed command opens
292
+ (`pickerCommand`), and the model picker: the platform's models by provider
293
+ and the machine's Claude ones (`useModelPicker`, `modelGroups`,
294
+ `platformModelStatus`, `providerIssueOf`, `useModelCatalog`). For a host
295
+ with no chat of its own to take them from, `usePlatformDefaults` gives the
296
+ platform model and allocation a chat would select.
297
+ - The allocations a model bills (`useModelAllocations`, `billsAllocation`),
298
+ and the rules behind them (`aiAllocations`, `allocationsForType`,
299
+ `allocationProblem`, `allocationChoice`, `allocationUsage`).
300
+
301
+ ### Claude Code accounts
302
+
303
+ - A machine's accounts as a panel lists them, with adding, signing in,
304
+ removing and choosing one (`useClaudeAccountPanel`, given the
305
+ `machineName` its words name the machine by). It words each view in the
306
+ reader's language: its title and description, why Claude Code can't run on
307
+ the machine, where signing in happens, the question a removal asks, and
308
+ the line under each account's name, its email or how to sign it in on the
309
+ machine (`detail`, a `ClaudeAccountDetail`). It also says which of the
310
+ list's controls show and the row the list starts on, and
311
+ `useClaudeAccountStartRow` moves the host's highlight there, and back
312
+ whenever the selected or first enabled row changes, such as when the
313
+ accounts' sign-in states arrive. Its setter must keep its identity, as a
314
+ `useState` setter does: a new one moves the highlight back too.
315
+ - The sign-in itself, run in the host's terminal (`useClaudeSignIn`, also
316
+ given `machineName`), with the sign-in page to offer opening, what to do,
317
+ a note when earlier output was dropped, the label that leaves it, and,
318
+ once signed in, the host's `onUse` to offer (`use`).
319
+ `canOpenSignInLink` says whether a link in its output may be opened: web
320
+ addresses only, never a script or a local file.
321
+ - The steps of a removal and of naming a new account
322
+ (`useClaudeAccountRemoval`, `useClaudeAccountName`, `claudeAccountName`),
323
+ an account's usage limits (`useClaudeAccountUsage`), and the refusal that
324
+ asks for a sign-in first (`claudeSignInRequired`).
325
+
326
+ ### Preferences
327
+
328
+ Each choice a client keeps for the reader, under the key and fallback every
329
+ client uses (`startModePreference`, `startEffortPreference`,
330
+ `startMachinePreference`, `startAccountPreference`, `lastModelPreference`,
331
+ `chatModelPreference`, `foldedGroupsPreference`, `sessionGroupsPreference`,
332
+ `showHiddenPreference`), and the rules for keeping it
333
+ (`useStartModePreference`, `useStartEffortPreference`,
334
+ `useStartMachinePreference`, `useStartAccountPreference`,
335
+ `useLastModelPreference`). Each rule takes the preference as a `[value, set]`
336
+ pair, from `usePreference` or the host's own store.
337
+ `useStartDefaultsFromSession` takes the start mode, effort and account
338
+ preferences and returns the callbacks for `useSessionSettings` that make a
339
+ pick in an open session where new sessions start.
340
+
341
+ ### Words
342
+
55
343
  - The messages a session is shown in, in English, Spanish, Japanese, Korean
56
- and Chinese (`loadPwCodeMessages`), and the words built from them: a
57
- session's label and status (`sessionLabel`, `sessionStateText`), why a
58
- machine can't be reached (`machineHint`), what the composer says while it is
59
- locked (`composerState`), and the transcript's own lines
60
- (`useTranscriptWords`, `useCompactionNotice`, `useRecapNotice`,
61
- `useToolStrings`).
344
+ and Chinese (`loadPwCodeMessages`, `pwCodeLocales`, `isPwCodeLocale`), and
345
+ the words built from them: a session's label and status (`sessionLabel`,
346
+ `sessionStateText`, `sessionStatusText`), why a machine can't be reached
347
+ (`machineHint`), what the composer says while it is locked
348
+ (`composerState`), and the transcript's own lines (`useTranscriptWords`,
349
+ `useGoalNotice`, `useCompactionNotice`, `useRecapNotice`, `useResumeTime`,
350
+ `turnDuration`, `useToolStrings`).
351
+ - Every word of `@parallelworks/ui/ai`'s chat a session's screens show, by
352
+ `ChatStrings` section (`usePwCodeChatStrings`), for a host to pass as its
353
+ chat config's `strings`.
354
+ - How long ago something happened, as "5m", for labels passed as strings
355
+ (`useCompactAgo`). It reads the `agents` messages and re-reads every 30
356
+ seconds on the ui package's clock.
62
357
 
63
358
  ## Messages
64
359
 
@@ -123,84 +418,307 @@ Create it once per client, at module level. Its hooks key SWR's cache as
123
418
  `@parallelworks/client/swr`'s hooks do (`['api', path, init]`, or `null` for a
124
419
  read they skip), and throw the client's error as those do, so a host that reads
125
420
  the same routes through those shares their cache entries, and revalidating one
126
- revalidates the other. `hidden`, when given, says the app is out of sight,
127
- where animation frames do not run and feed frames are applied as they arrive.
421
+ revalidates the other. Only `usePwCodeEnabled` keys its read by the path alone,
422
+ `'/api/previews'`, as a host reading previews with plain SWR keys it.
423
+ `useSessionDetail` gives up a read still on its way once it no longer shows
424
+ that session, so the connection goes to the one the reader moved on to.
425
+
426
+ Its other options:
427
+
428
+ - `hidden`, when given, says the app is out of sight, where animation frames
429
+ do not run, so feed frames are applied as they arrive.
430
+ - `onPreferenceError` hears a preference that failed to save; it shows its
431
+ saved value again.
432
+ - `previewsByRef` reads a transcript with each image's preview left to its
433
+ ref, to be loaded when it is drawn. Set it only where the host loads an
434
+ image from its URL on the platform's API signed in as the API client is, as
435
+ a browser on the platform's origin does.
128
436
 
129
437
  The package carries the types of the routes it calls (`PwCodePaths`), generated
130
438
  from the platform's OpenAPI spec. A client whose own API types lack one of
131
439
  those routes, or type one differently, is refused at compile time, naming the
132
440
  routes it lacks; regenerate the host's types from a newer spec.
133
441
 
134
- ## Using the hook
442
+ pw code is a preview (`PW_CODE_PREVIEW`). Its routes answer 404 for a reader
443
+ without it, so check
444
+ `pwCode.usePwCodeEnabled()`, undefined until the reader's previews load,
445
+ before offering it; `pwCodeEnabled(previews)` answers the same from previews
446
+ the host has already read.
447
+
448
+ ## An open session
135
449
 
136
450
  ```tsx
137
451
  import {
138
- pasteRefs,
139
- pendingMessages,
140
- turnRunning,
141
- usePwCodeTranscript,
452
+ isSession,
453
+ sessionSettingsOptions,
454
+ useGoalNotice,
455
+ usePwCodeComposer,
456
+ usePwCodeConversation,
457
+ usePwCodeSessionScreen,
458
+ useStaleFor,
142
459
  } from '@parallelworks/code'
143
460
  import { pwCode } from './pwCode'
144
461
 
145
- function useSession(machine: string, sessionId: string) {
146
- // The session's status, history and last seq.
147
- const { data: detail, mutate } = pwCode.useSessionDetail(
462
+ function useOpenSession(machine: string, sessionId: string, host: Host) {
463
+ const sessions = pwCode.useSessions()
464
+ const listed = sessions.data?.sessions?.find(s =>
465
+ isSession(s, machine, sessionId)
466
+ )
467
+ const read = pwCode.useSessionDetail(machine, sessionId, listed)
468
+ const machineRead = pwCode.useMachine(machine)
469
+ const conversation = usePwCodeConversation({
470
+ api: pwCode,
471
+ machine,
472
+ sessionId,
473
+ sessions,
474
+ detail: read,
475
+ describeError: host.describeError,
476
+ notify: host.toast,
477
+ onCleared: id => host.openSession(machine, id),
478
+ onMoved: copy => host.openSession(copy.machineId, copy.id),
479
+ // Without it, a goal's progress takes no line in the transcript.
480
+ goalNotice: useGoalNotice(),
481
+ })
482
+ // Resumed from the cursor once this visit has read the session itself: a
483
+ // copy cached by an earlier visit trails the feed.
484
+ const feed = pwCode.useSessionEvents(
148
485
  machine,
149
486
  sessionId,
150
- undefined
487
+ read.fresh ? conversation.cursor : undefined,
488
+ conversation.onEvent
151
489
  )
152
- const { transcript, onEvent, cursor, sendMessage } = usePwCodeTranscript({
490
+ const staleFor = useStaleFor(read.data, feed.connected)
491
+ const composer = usePwCodeComposer({
492
+ api: pwCode,
493
+ machine,
153
494
  sessionId,
154
- detail,
155
- // Resolves to { turnId, queued } once accepted, or { error } to show.
156
- send: async (text, pastes, images) => {
157
- const { data, error } = await pwCode.sendMessage(machine, sessionId, {
158
- text,
159
- ...pasteRefs(pastes),
160
- ...(images ? { images } : {}),
161
- })
162
- return error ? { error: error.message } : data
163
- },
164
- onEffect: effect => {
165
- // What a frame asks of the host: 'refetch', 'cleared', 'state' or 'notice'.
166
- if (effect.type === 'refetch') {
167
- void mutate()
168
- }
169
- },
495
+ conversation,
496
+ machineInfo: machineRead.machine,
497
+ feed,
498
+ staleFor,
499
+ notify: host.toast,
500
+ onCleared: id => host.openSession(machine, id),
501
+ onArchived: host.showList,
502
+ })
503
+ const settings = pwCode.useSessionSettings({
504
+ ...sessionSettingsOptions(machine, conversation, composer),
505
+ onPatched: () => void read.mutate(),
506
+ onError: conversation.showError,
170
507
  })
171
- // The feed reconnects from cursor(), the last seq applied.
172
- pwCode.useSessionEvents(machine, sessionId, cursor, onEvent)
173
-
174
- return {
175
- messages: transcript?.messages ?? [],
176
- streaming: transcript?.streaming ?? null,
177
- queued: transcript ? pendingMessages(transcript) : [],
178
- running: turnRunning(transcript),
179
- sendMessage,
180
- }
508
+ const screen = usePwCodeSessionScreen({
509
+ conversation,
510
+ composer,
511
+ read,
512
+ machine: machineRead,
513
+ staleFor,
514
+ settings,
515
+ images: [],
516
+ describeError: host.describeError,
517
+ })
518
+ return { conversation, composer, settings, screen }
181
519
  }
182
520
  ```
183
521
 
184
- `steer` hands text to the turn that is running and `withdraw` takes a queued
185
- message back; without them every message sent during a turn waits for it to
186
- end. `goalNotice`, `compactionNotice`, `recapNotice` and `words` supply the
187
- transcript's own lines in the reader's language: `useCompactionNotice()`,
188
- `useRecapNotice()` and `useTranscriptWords()` give them from this package's
189
- messages. `imageUrl` turns an image's `ref` into the URL the host serves it
190
- from.
522
+ Call it from a component mounted once per session, keyed by machine and
523
+ session as the web's session page is. Its reads and its transcript keep what
524
+ they learned of the session they first showed, so a screen that moves to
525
+ another session in place shows that session's copy cached by an earlier
526
+ visit, resumes its feed from that copy, and carries over messages still on
527
+ their way to the old one.
528
+
529
+ `conversation.all` is what the transcript draws: its messages, the one
530
+ streaming, then those queued behind the turn. `composer.send` sends what was
531
+ typed, and `screen` says what goes around them. A host that wants only the
532
+ transcript runs `usePwCodeTranscript` over the same detail and feed, with its
533
+ own `send` and `steer`, `withdraw` and `withdrawDirection` to take back a
534
+ queued or a steered message by the `turnId` its `send` or the `id` its `steer`
535
+ resolved to, and an `onEffect` that does what a frame asks:
536
+ `refetch`, `cleared`, `state` or `notice`. `goalNotice`, `compactionNotice`,
537
+ `recapNotice` and `words` supply the transcript's own lines in the reader's
538
+ language, from `useGoalNotice()`, `useCompactionNotice()`, `useRecapNotice()`
539
+ and `useTranscriptWords()`; without them those lines are missing or in
540
+ English. `imageUrl` turns an
541
+ image's `ref` into the URL it loads from, as
542
+ `ref => sessionImageUrl(machine, sessionId, ref)` does; without it an image
543
+ opens only at its preview's size, and one read with `previewsByRef` does not
544
+ show.
191
545
 
192
546
  On the web, `SessionView` from `@parallelworks/ui/ai` draws these messages. A
193
547
  host with its own components renders `ChatMessage` and its parts itself.
194
548
 
549
+ ## On React Native
550
+
551
+ The package runs on the Hermes that React Native 0.88 ships, once four
552
+ FormatJS polyfills have loaded. Load them before anything imports
553
+ `@parallelworks/ui` or `@parallelworks/code`, in this order: each needs the
554
+ ones above it, and `@parallelworks/ui` builds formatters when it loads. The
555
+ last three carry the data of the five languages the messages come in. In an
556
+ Expo Router app, that is an entry file, named as `main` in the app's
557
+ `package.json`, that imports them and then `expo-router/entry`:
558
+
559
+ ```js
560
+ import '@formatjs/intl-locale/polyfill.js'
561
+ import '@formatjs/intl-pluralrules/polyfill-force.js'
562
+ import '@formatjs/intl-pluralrules/locale-data/en.js'
563
+ import '@formatjs/intl-pluralrules/locale-data/es.js'
564
+ import '@formatjs/intl-pluralrules/locale-data/ja.js'
565
+ import '@formatjs/intl-pluralrules/locale-data/ko.js'
566
+ import '@formatjs/intl-pluralrules/locale-data/zh.js'
567
+ import '@formatjs/intl-numberformat/polyfill-force.js'
568
+ import '@formatjs/intl-numberformat/locale-data/en.js'
569
+ import '@formatjs/intl-numberformat/locale-data/es.js'
570
+ import '@formatjs/intl-numberformat/locale-data/ja.js'
571
+ import '@formatjs/intl-numberformat/locale-data/ko.js'
572
+ import '@formatjs/intl-numberformat/locale-data/zh.js'
573
+ import '@formatjs/intl-listformat/polyfill-force.js'
574
+ import '@formatjs/intl-listformat/locale-data/en.js'
575
+ import '@formatjs/intl-listformat/locale-data/es.js'
576
+ import '@formatjs/intl-listformat/locale-data/ja.js'
577
+ import '@formatjs/intl-listformat/locale-data/ko.js'
578
+ import '@formatjs/intl-listformat/locale-data/zh.js'
579
+ import 'expo-router/entry'
580
+ ```
581
+
582
+ These versions were checked: `@formatjs/intl-locale` 5.4.3,
583
+ `@formatjs/intl-pluralrules` 7.0.4, `@formatjs/intl-numberformat` 10.0.4 and
584
+ `@formatjs/intl-listformat` 9.0.3. NumberFormat is forced because Hermes' own
585
+ ignores compact notation and unit display: a token count reads "12,345" for
586
+ "12.3K", and a reset "360 sec" for "6m".
587
+
588
+ Dates follow the device's own formatter by design, with no polyfill, so they
589
+ read as the phone writes them, which differs slightly from the web. On iOS,
590
+ English puts a narrow no-break space before AM and PM and "at" between the
591
+ date and the time ("Nov 14, 2026 at 3:30 PM" where the web writes "Nov 14,
592
+ 2026, 3:30 PM"), Japanese puts the weekday before the time, and Japanese and
593
+ Chinese put a space beside the weekday. Android's formatter is not checked,
594
+ and can differ in other ways.
595
+
596
+ The package opens no socket, keeps nothing on the device, encodes no image
597
+ and navigates nowhere. The host supplies each:
598
+
599
+ - The event feed's socket, as `createPwCodeApi`'s `openSocket`. The platform
600
+ takes its credential only from an `Authorization` header or its session
601
+ cookie, never from a query parameter, so open it with the header React
602
+ Native's `WebSocket` takes in its third argument:
603
+
604
+ ```ts
605
+ openSocket: async path =>
606
+ new WebSocket(`wss://activate.example.com${path}`, undefined, {
607
+ headers: { Authorization: `Bearer ${await accessToken()}` },
608
+ }),
609
+ ```
610
+
611
+ - Whether the app is out of sight, as `hidden`, and whether the reader is away
612
+ from a session, as `useAwayRecap`'s `presence` (`away`, and `watch`, which
613
+ calls `leave` and `back` as that changes), both read from the app's state.
614
+ - Images: `useComposerImages`' `encode`, which writes a picked image as base64
615
+ within `IMAGE_MAX_BYTES` and `IMAGE_MAX_SIDE` and throws
616
+ `PwCodeImageTooLarge` for one it cannot fit (`fitImageWith` works out the
617
+ sizes over the host's own `write`), and its `preview` and `release`. A
618
+ transcript names a full-size image by its path on the platform's API
619
+ (`sessionImageUrl`, and `markdownImageSources` for a GitHub attachment),
620
+ which the host loads from the platform's address, signed in as its API
621
+ client is.
622
+ - Preferences:
623
+ `pwCode.usePreference(startModePreference.key, startModePreference.fallback)`
624
+ keeps a choice in the reader's account, as every client does; a host that
625
+ keeps them itself passes its own `[value, set]` pair to the rules, to
626
+ `useSessionGroups`, and to `useSessionList` as `folded`, whose `set` takes
627
+ an update function.
628
+ - Navigation, through callbacks: `useStartSession`'s `onStarted`,
629
+ `useSessionActions`' `showStart` and `showSession`,
630
+ `usePwCodeConversation`'s `onCleared` and `onMoved`, `usePwCodeComposer`'s
631
+ `onCleared` and `onArchived`, `useSessionLink`'s `open`, `useSessionList`'s
632
+ `newSession`, `useModelPicker`'s `onAccounts` and
633
+ `useClaudeAccountPanel`'s `onClose`.
634
+ - What the reader is told and asked: `describeError`, `notify`, and
635
+ `useSessionActions`' `confirm`; Claude Code's sign-in runs in the host's
636
+ terminal, `useClaudeSignIn`'s `terminal`.
637
+
638
+ The package is checked on the Hermes React Native 0.88.1 ships for iOS, with
639
+ this setup: it loads before any polyfill does, and once they have loaded its
640
+ functions, hooks and messages print what they print on the web, but for the
641
+ date differences above.
642
+
195
643
  ## No DOM
196
644
 
197
645
  The build imports `react`, `luxon`, `swr`, `use-intl`, `gemoji` (for the
198
- emoji shortcodes in a session's name) and `@parallelworks/ui/ai/headless`, and
199
- its declarations `openapi-fetch` too, and nothing else, so it loads where there
200
- is no DOM: a React Native bundle, a server, a test. It opens sockets only
201
- through the host's `openSocket`. The reducers need no React at all.
646
+ emoji shortcodes in a session's name), `@parallelworks/ui/ai/headless`,
647
+ `@parallelworks/ui/headless` and `@parallelworks/problem`, and its
648
+ declarations `openapi-fetch` too, and nothing else, so it loads where there is
649
+ no DOM: a React Native bundle, a server, a test. Nor does it use what Hermes
650
+ lacks, such as `URL.canParse`, `structuredClone` or `Intl.Segmenter`. It opens
651
+ sockets only through the host's `openSocket`. The reducers need no React at
652
+ all.
202
653
 
203
654
  ## Versions
204
655
 
205
656
  The wire types follow the pw code daemon. Before 1.0 a minor release can
206
657
  change them.
658
+
659
+ ### Breaking changes since 0.3.0
660
+
661
+ - `usePwCodeSubagent` takes `listed`, the subagent's switcher row
662
+ (`switcherAgent`), and `usage`, its tokens as the session's feed last
663
+ counted them, and no longer takes `name`: it names the subagent itself and
664
+ returns it as `agent`.
665
+ - `useSessionList`'s `folded` setter is handed an update function,
666
+ `(previous) => string[]`, in place of the new keys, so a store that has not
667
+ loaded them yet applies it to them rather than to its fallback. A
668
+ `[value, set]` pair from `useState` or `usePreference` takes it as it is.
669
+ - `useSessionList`'s `dropSession` leaves an archived session where it was,
670
+ and its `renameGroup` saves the name without the spaces around it, and
671
+ nothing for a blank one. The API's `useSessionPullRequestStates` takes the
672
+ links a session lists and returns the states of only the pull and merge
673
+ requests among them, leaving any other link out.
674
+ - `useClaudeAccountPanel` and `useClaudeSignIn` require a `machineName`
675
+ option, the machine's name as the reader knows it, which their words name
676
+ the machine by.
677
+ - `usePwCodeComposer`'s `images` option requires `restore` beside `take`
678
+ and `taking`, to put back the images of a message taken back.
679
+ `useComposerImages` returns it, so a host passing what that returns
680
+ changes nothing; one passing its own `{ take, taking }` adds it.
681
+ - Peer dependencies: `@parallelworks/problem` (`>=0.6.1 <1`) is new, and
682
+ `@parallelworks/ui` needs 0.136.0 or newer, up from 0.132.0.
683
+ - The host's API types must include eight more routes, which
684
+ `createPwCodeApi` now calls: `/api/allocations`, `/api/openai/v1/models`,
685
+ `/api/previews`, `/api/user/preferences`,
686
+ `/api/aichat/conversations/{id}`,
687
+ `/api/code/machines/{machine}/directories`,
688
+ `/api/code/machines/{machine}/sessions/{id}/direction/withdraw` and
689
+ `/api/code/machines/{machine}/sessions/{id}/subagents/{subId}/direction/withdraw`.
690
+ - `sessionSections`, `listGroups` and `inFlightFirst` take sessions with an
691
+ `id`, and list live sessions newest begun first (`createdAt`) rather than
692
+ newest updated, so a row holds still while its session works.
693
+ - `useCompactAgo` words its ages from the `agents` messages, not from
694
+ `@parallelworks/ui`'s `time` strings, and counts days past a year ("400d",
695
+ not "1y").
696
+ - `answerApproval` resolves to what was thrown when the request failed,
697
+ rather than rejecting.
698
+ - `useSessionMutations`' `pinSession`, `groupSession` and `restoreSession`
699
+ show the change in the list before the machine answers, and take it back if
700
+ it refuses.
701
+ - The main conversation's author has `kind: 'agent'`, so it is drawn as an
702
+ agent rather than a person.
703
+ - The approval messages in `agentTranscript` now read as ACTIVATE's AI chat
704
+ words them. In English and Spanish: `transcript.denyWithFeedback` ("No, and
705
+ tell the assistant why"), `transcript.feedbackPlaceholder`,
706
+ `transcript.feedbackLabel`, `transcript.allowedBy` ("{name} approved"),
707
+ `transcript.deniedBy` ("{name} denied"), `transcript.allowedByReviewer`
708
+ ("Auto-reviewer approved"), `transcript.deniedByReviewer`,
709
+ `transcript.reviewTimedOut` ("Auto-review timed out") and
710
+ `transcript.reviewFailed`. In Japanese, Korean and Chinese:
711
+ `transcript.denyWithFeedback`, `transcript.feedbackPlaceholder`,
712
+ `transcript.feedbackLabel`, `transcript.reviewTimedOut` and
713
+ `transcript.reviewFailed`, and also `transcript.allowCall`,
714
+ `transcript.denyCall`, `transcript.allowed`, `transcript.approvalLabel`,
715
+ `transcript.approvalAllowed`, `transcript.approvalDenied` and
716
+ `transcript.approvalWaitingOn` in Japanese, `transcript.allowCall`,
717
+ `transcript.denyCall`, `transcript.approvalDenied` and
718
+ `transcript.approvalWaitingOn` in Korean, and `transcript.approvalLabel` and
719
+ `transcript.approvalWaitingOn` in Chinese.
720
+ - `start.otherPath` is gone from the `agents` messages in every language,
721
+ since the start screen's path field now lists a machine's directories.
722
+ So are `claude.current`, `claude.fiveHour`, `claude.week`,
723
+ `sidebar.groupRunning`, `sidebar.groupWaiting`, `sidebar.moreOptions` and
724
+ `detail.loading`, which nothing in the package said.