@parallelworks/code 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +171 -24
  2. package/dist/ago.d.ts +8 -0
  3. package/dist/ago.js +26 -0
  4. package/dist/api.d.ts +3547 -0
  5. package/dist/apiClient.d.ts +26 -0
  6. package/dist/apiClient.js +5 -0
  7. package/dist/base64.d.ts +3 -0
  8. package/dist/base64.js +15 -0
  9. package/dist/chatHandoff.d.ts +12 -0
  10. package/dist/chatHandoff.js +27 -0
  11. package/dist/claudeAccounts.d.ts +112 -0
  12. package/dist/claudeAccounts.js +234 -0
  13. package/dist/claudeApi.d.ts +27 -0
  14. package/dist/claudeApi.js +250 -0
  15. package/dist/claudeSignIn.d.ts +62 -0
  16. package/dist/claudeSignIn.js +239 -0
  17. package/dist/command.d.ts +47 -0
  18. package/dist/command.js +64 -0
  19. package/dist/commandsApi.d.ts +64 -0
  20. package/dist/commandsApi.js +267 -0
  21. package/dist/contextRow.d.ts +25 -0
  22. package/dist/contextRow.js +16 -0
  23. package/dist/createPwCodeApi.d.ts +696 -0
  24. package/dist/createPwCodeApi.js +33 -0
  25. package/dist/howSessionsAppear.d.ts +12 -0
  26. package/dist/howSessionsAppear.js +24 -0
  27. package/dist/index.d.ts +39 -3
  28. package/dist/index.js +38 -3
  29. package/dist/locales/en/agentTranscript.js +162 -0
  30. package/dist/locales/en/agents.js +380 -0
  31. package/dist/locales/en.d.ts +523 -0
  32. package/dist/locales/en.js +8 -0
  33. package/dist/locales/es/agentTranscript.js +162 -0
  34. package/dist/locales/es/agents.js +380 -0
  35. package/dist/locales/es.d.ts +3 -0
  36. package/dist/locales/es.js +8 -0
  37. package/dist/locales/ja/agentTranscript.js +162 -0
  38. package/dist/locales/ja/agents.js +380 -0
  39. package/dist/locales/ja.d.ts +3 -0
  40. package/dist/locales/ja.js +8 -0
  41. package/dist/locales/ko/agentTranscript.js +162 -0
  42. package/dist/locales/ko/agents.js +380 -0
  43. package/dist/locales/ko.d.ts +3 -0
  44. package/dist/locales/ko.js +8 -0
  45. package/dist/locales/zh/agentTranscript.js +162 -0
  46. package/dist/locales/zh/agents.js +380 -0
  47. package/dist/locales/zh.d.ts +3 -0
  48. package/dist/locales/zh.js +8 -0
  49. package/dist/machine.d.ts +51 -0
  50. package/dist/machine.js +60 -0
  51. package/dist/messages.d.ts +17 -0
  52. package/dist/messages.js +31 -0
  53. package/dist/models.d.ts +47 -0
  54. package/dist/models.js +49 -0
  55. package/dist/notices.d.ts +12 -0
  56. package/dist/notices.js +120 -0
  57. package/dist/pullRequest.d.ts +8 -0
  58. package/dist/pullRequest.js +29 -0
  59. package/dist/pullRequestList.d.ts +52 -0
  60. package/dist/pullRequestList.js +106 -0
  61. package/dist/query.d.ts +28 -0
  62. package/dist/query.js +25 -0
  63. package/dist/session.d.ts +75 -1
  64. package/dist/session.js +101 -1
  65. package/dist/sessionActions.d.ts +105 -0
  66. package/dist/sessionActions.js +178 -0
  67. package/dist/sessionEvents.d.ts +27 -0
  68. package/dist/sessionEvents.js +212 -0
  69. package/dist/sessionGroups.d.ts +49 -0
  70. package/dist/sessionGroups.js +72 -0
  71. package/dist/sessionHeader.d.ts +14 -0
  72. package/dist/sessionHeader.js +16 -0
  73. package/dist/sessionList.d.ts +134 -0
  74. package/dist/sessionList.js +271 -0
  75. package/dist/sessionsApi.d.ts +105 -0
  76. package/dist/sessionsApi.js +511 -0
  77. package/dist/settingsApi.d.ts +36 -0
  78. package/dist/settingsApi.js +151 -0
  79. package/dist/startSession.d.ts +138 -0
  80. package/dist/startSession.js +234 -0
  81. package/dist/terminalHandoffPanel.d.ts +30 -0
  82. package/dist/terminalHandoffPanel.js +33 -0
  83. package/dist/toolStrings.d.ts +4 -0
  84. package/dist/toolStrings.js +95 -0
  85. package/dist/transcript.d.ts +14 -1
  86. package/dist/transcript.js +55 -14
  87. package/dist/types.d.ts +20 -1
  88. package/dist/usageLimit.d.ts +8 -0
  89. package/dist/usageLimit.js +13 -0
  90. package/dist/useAwayRecap.d.ts +30 -0
  91. package/dist/useAwayRecap.js +75 -0
  92. package/dist/useComposer.d.ts +121 -0
  93. package/dist/useComposer.js +244 -0
  94. package/dist/useComposerImages.d.ts +66 -0
  95. package/dist/useComposerImages.js +195 -0
  96. package/dist/useConversation.d.ts +190 -0
  97. package/dist/useConversation.js +287 -0
  98. package/dist/useSubagent.d.ts +58 -0
  99. package/dist/useSubagent.js +149 -0
  100. package/dist/useTranscript.d.ts +4 -1
  101. package/dist/useTranscript.js +54 -11
  102. package/dist/wording.d.ts +43 -0
  103. package/dist/wording.js +101 -0
  104. package/dist/workingDirectories.d.ts +32 -0
  105. package/dist/workingDirectories.js +71 -0
  106. package/dist/worktreeChoice.d.ts +31 -0
  107. package/dist/worktreeChoice.js +38 -0
  108. package/locales/en/agentTranscript.json +154 -0
  109. package/locales/en/agents.json +366 -0
  110. package/locales/es/agentTranscript.json +154 -0
  111. package/locales/es/agents.json +366 -0
  112. package/locales/ja/agentTranscript.json +154 -0
  113. package/locales/ja/agents.json +366 -0
  114. package/locales/ko/agentTranscript.json +154 -0
  115. package/locales/ko/agents.json +366 -0
  116. package/locales/zh/agentTranscript.json +154 -0
  117. package/locales/zh/agents.json +366 -0
  118. package/package.json +24 -9
@@ -0,0 +1,380 @@
1
+ // locales/zh/agents.json
2
+ var title = "pw code";
3
+ var sidebar = {
4
+ "label": "会话",
5
+ "listNoun": "会话",
6
+ "newSession": "新会话",
7
+ "search": "搜索会话",
8
+ "find": "在此会话中查找",
9
+ "noSessions": "还没有打开的会话",
10
+ "open": "打开侧边栏",
11
+ "close": "关闭侧边栏",
12
+ "untitled": "未命名",
13
+ "deleteTitle": "删除会话",
14
+ "deleteBody": "“{name}”及其记录将从 {machine} 中删除。此操作无法撤销。",
15
+ "deleteAction": "删除",
16
+ "worktree": "工作树",
17
+ "worktreeBranch": "分支 {branch}",
18
+ "worktreeChoice": "如何处理工作树",
19
+ "keepWorktree": "保留工作树",
20
+ "keepWorktreeBody": "它会连同其分支留在电脑上,可以继续在其中工作,或以后再移除。",
21
+ "removeWorktree": "移除工作树",
22
+ "removeWorktreeBody": "删除工作树及其分支,以及其中的所有内容。",
23
+ "worktreeStays": "此工作树会留在电脑上。如果不再需要,请在电脑上移除它。",
24
+ "worktreeUnchecked": "git 无法检查工作树中的工作,因此移除它可能会删除更改。",
25
+ "worktreeFiles": "移除它会删除 {count, plural, other {# 个}}未提交的文件:",
26
+ "worktreeCommits": "移除它会删除其分支上的 {count, plural, other {# 个}}提交:",
27
+ "worktreeMore": "{count, plural, other {… 还有 # 个}}",
28
+ "renameTitle": "重命名会话",
29
+ "renameLabel": "会话名称",
30
+ "renamePlaceholder": "输入新名称",
31
+ "renameAction": "重命名",
32
+ "moreOptions": "更多选项",
33
+ "groupNeedsYou": "需要你处理",
34
+ "groupActive": "活跃",
35
+ "groupInactive": "非活跃",
36
+ "groupArchived": "已归档",
37
+ "moveToGroup": "移至分组",
38
+ "newGroup": "新建分组…",
39
+ "newGroupName": "新分组",
40
+ "renameGroup": "重命名分组",
41
+ "deleteGroup": "删除分组",
42
+ "renameGroupTitle": "命名分组",
43
+ "groupNameLabel": "分组名称",
44
+ "groupNamePlaceholder": "输入名称",
45
+ "deleteGroupTitle": "删除分组",
46
+ "deleteGroupBody": "将删除“{name}”。其中的会话仍保留在列表中。",
47
+ "groupsNeedUpdate": "请更新 {machine} 上的 pw,才能将其会话放入分组",
48
+ "groupWaiting": "{count, plural, other {# 个会话需要你处理}}",
49
+ "groupRunning": "{count, plural, other {# 个会话正在运行}}",
50
+ "pin": "固定",
51
+ "unpin": "取消固定",
52
+ "pinned": "已固定",
53
+ "fork": "派生",
54
+ "forkMidTurn": "当前轮次结束后可用",
55
+ "leaveWorktree": "离开工作树",
56
+ "leaveWorktreeTitle": "离开工作树?",
57
+ "leaveWorktreeBody": "会话将回到 {workspace} 中工作。其对话保持不变。",
58
+ "leaveWorktreeKept": "会话已离开工作树,但无法移除该工作树,它仍留在电脑上。",
59
+ "stop": "停止",
60
+ "archive": "归档",
61
+ "restore": "恢复",
62
+ "archiveTitle": "归档“{name}”?",
63
+ "archiveBody": "此会话及其子智能体正在运行的工作将停止,其计划任务也会暂停。要再次使用,请从“已归档”分组中恢复。",
64
+ "resize": "调整会话列表大小",
65
+ "resizeHint": "拖动以调整大小;双击以重置",
66
+ "moreActions": "更多操作"
67
+ };
68
+ var start = {
69
+ "heading": "启动 pw code 会话",
70
+ "subheading": "选择机器和目录,然后描述任务。",
71
+ "workspaceLabel": "工作目录",
72
+ "workspacePlaceholder": "/home/you/your-repo",
73
+ "startButton": "启动会话",
74
+ "chooseMachine": "选择机器",
75
+ "notAnswering": "无响应({count})",
76
+ "chooseDirectory": "选择目录",
77
+ "otherPath": "使用其他路径…",
78
+ "composerPlaceholder": "描述任务或提出问题",
79
+ "choosePermission": "选择代理可以执行的操作",
80
+ "howTitle": "你打开的会话会显示在这里",
81
+ "howLabel": "会话如何显示在这里",
82
+ "howRemoteBefore": "在运行中的 pw code 会话里执行",
83
+ "howRemoteAfter": ",几秒钟内它就会列在这里。",
84
+ "howNewBefore": "要启动一个从第一轮起就打开的新会话,运行",
85
+ "howAllBefore": "要打开某台机器上的每个新会话,在那里运行",
86
+ "howAllAfter": "并开启 Remote control for new sessions。",
87
+ "linkResolving": "正在查找会话 {id}…",
88
+ "linkMissing": "会话 {id} 的远程控制已关闭。在该会话中运行 /rc,它就会列在这里。",
89
+ "startHereNone": "目前还没有机器允许远程启动会话。在你使用的机器上的 pw code 中运行 /settings 并开启 Allow remote session start,它就会列在这里。",
90
+ "handoffCard": "以聊天“{title}”开始",
91
+ "handoffUntitled": "未命名",
92
+ "handoffLoading": "正在加载聊天…",
93
+ "handoffPlaceholder": "智能体应如何处理这段聊天?",
94
+ "handoffDefaultTask": "继续下面对话中讨论的工作。",
95
+ "handoffIntro": "这是 AI 聊天“{title}”的延续。目前的对话:",
96
+ "handoffOmitted": "为保持简短,省略了前 {count} 条消息。",
97
+ "handoffUser": "用户",
98
+ "handoffAssistant": "助手"
99
+ };
100
+ var status = {
101
+ "idle": "空闲",
102
+ "running": "运行中",
103
+ "awaiting_approval": "需要批准",
104
+ "awaiting_answer": "需要回答",
105
+ "live_elsewhere": "在 {host} 上运行"
106
+ };
107
+ var machine = {
108
+ "connected": "已连接",
109
+ "no_daemon": "pw code 未运行",
110
+ "no_agent": "无代理",
111
+ "unreachable": "无法连接",
112
+ "unsupported_agent": "代理版本过旧",
113
+ "noDaemonHint": "这台机器上没有运行 pw code。请在该机器的终端中运行 pw code 来启动它。",
114
+ "noAgentHint": "这台机器没有连接 pw 代理。",
115
+ "unreachableHint": "无响应。在恢复之前无法读取其会话。",
116
+ "unsupportedHint": "该机器上的代理版本过旧。无法从中读取会话。",
117
+ "unsupportedHintVersion": "代理 {version} 版本过旧。无法从中读取会话。",
118
+ "computer": "电脑",
119
+ "resource": "资源"
120
+ };
121
+ var detail = {
122
+ "commandsLabel": "命令",
123
+ "archiveCommand": "归档此会话;之后可以恢复",
124
+ "planOnMachine": "计划保存在该机器的 {path}。请在该机器的终端中通过 pw code 打开。",
125
+ "shellWhileRunning": "请等待本轮结束后再运行 ! 命令。",
126
+ "archiveWhileRunning": "请等待本轮结束后再运行 /archive。",
127
+ "archived": "已归档“{name}”。要再次使用,请从“已归档”分组中恢复。",
128
+ "steerUncertain": "没有收到回应,这条消息可能已送达智能体。再次发送前请先查看记录。",
129
+ "shellStopped": "钩子阻止了智能体作出回应:{reason}",
130
+ "backgroundHint": "(按 {key} 在后台运行)",
131
+ "backgroundTitle": "命令继续运行,智能体无需等待它即可继续工作",
132
+ "liveOn": "在 {host} 上运行",
133
+ "pullRequest": "此会话创建的{kind, select, mergeRequest {合并请求} other {拉取请求}} {pr}",
134
+ "pullRequestOpen": "此会话的{kind, select, mergeRequest {合并请求} other {拉取请求}} {pr} 处于开启状态",
135
+ "pullRequestDraft": "此会话的{kind, select, mergeRequest {合并请求} other {拉取请求}} {pr} 是草稿",
136
+ "pullRequestMerged": "此会话的{kind, select, mergeRequest {合并请求} other {拉取请求}} {pr} 已合并",
137
+ "pullRequestClosed": "此会话的{kind, select, mergeRequest {合并请求} other {拉取请求}} {pr} 已关闭",
138
+ "pullRequestsMore": "+{count}",
139
+ "pullRequestsShowMoreOpen": "{count, plural, other {再显示 # 个开启的拉取请求}}",
140
+ "pullRequestsShowMoreDone": "{count, plural, other {再显示 # 个已合并或已关闭的拉取请求}}",
141
+ "pullRequestsMoreOpenTitle": "{count, plural, other {另外 # 个开启的拉取请求}}",
142
+ "pullRequestsMoreDoneTitle": "{count, plural, other {另外 # 个已合并或已关闭的拉取请求}}",
143
+ "pullRequestsMoreAllTitle": "{count, plural, other {另外 # 个拉取请求}}",
144
+ "pullRequestState": {
145
+ "open": "开启",
146
+ "draft": "草稿",
147
+ "merged": "已合并",
148
+ "closed": "已关闭"
149
+ },
150
+ "liveElsewhereBody": "该会话正在 {host} 上的 pw code 中运行。你可以阅读,但此处的记录是快照,不会被更新。",
151
+ "refresh": "刷新",
152
+ "unreachableTitle": "{machine} 已有 {when} 无响应",
153
+ "unreachableBody": "会话是从机器实时读取的,在恢复连接前无法显示新内容。",
154
+ "checkAgain": "再次检查",
155
+ "transcriptEnds": "记录结束。这是从 {machine} 读取的最后状态。",
156
+ "untrusted": "此工作区尚未受信任,因此未加载设置、技能和钩子。请在机器上通过 pw code 信任它,然后继续。",
157
+ "reconnecting": "实时更新已断开,正在重新连接…",
158
+ "waitingForUsageLimit": "正在等待用量上限重置",
159
+ "waitingForUsageLimitUntil": "正在等待用量上限于 {time} 重置",
160
+ "switchClaudeAccount": "切换账户",
161
+ "loading": "正在加载记录…",
162
+ "cleared": "会话已清空,正在显示新会话。",
163
+ "dismiss": "关闭",
164
+ "transcriptLabel": "会话记录",
165
+ "transcriptNoun": "记录",
166
+ "retry": "重试",
167
+ "composerPlaceholder": "向此会话发送消息",
168
+ "composerLabel": "向此会话发消息",
169
+ "composerAwaiting": "回复审批请求以继续",
170
+ "composerAwaitingAnswer": "回答问题以继续",
171
+ "composerLiveElsewhere": "正在 {host} 上的 pw code 中运行",
172
+ "composerArchived": "此会话已归档",
173
+ "footerArchived": "归档期间为只读。要再次使用,请从“已归档”分组中恢复",
174
+ "composerUnreachable": "无法连接 {machine},消息无法送达",
175
+ "footerAwaiting": "在你批准或拒绝前,会话处于暂停状态",
176
+ "footerAwaitingAnswer": "在你回答前,会话处于暂停状态",
177
+ "composerShellRunning": "请等待 ! 命令完成",
178
+ "footerShellRunning": "正在机器上运行 ! {command}…",
179
+ "footerLiveElsewhere": "此会话在其他机器上运行时为只读",
180
+ "footerUnreachable": "只读,最后读取于{when}",
181
+ "send": "发送",
182
+ "imagesLabel": "要发送的图片",
183
+ "removeImage": "移除 {placeholder}",
184
+ "imageTooLarge": "此图片太大,无法附加。",
185
+ "imageUnsupported": "只能附加 PNG、JPEG、GIF 和 WebP 图片。",
186
+ "savingSettings": "保存中…",
187
+ "goalAchieved": "✓ 目标已达成({elapsed} · {turns, plural, other {# 轮}} · {tokens} 个令牌)",
188
+ "goalContinuing": "○ 目标尚未达成……继续中",
189
+ "goalCheckFailed": "目标检查失败:{error}。目标仍然有效,将在下一轮结束后再次检查。",
190
+ "goalUsageLimit": "已达到用量上限。将在 {time} 再次检查目标。",
191
+ "goalActive": "目标进行中",
192
+ "goalPaused": "目标已暂停",
193
+ "addedDirectory": "已添加的工作目录:{path}",
194
+ "addedDirectoryAndMore": "{path} 及{count, plural, other {另外 # 个工作目录}}",
195
+ "workingDirectory": "工作目录:{path}",
196
+ "directoriesMore": "+{count}",
197
+ "directoriesTitle": "工作目录",
198
+ "originalDirectory": "原始工作目录",
199
+ "directoryScope": {
200
+ "session": "本次会话",
201
+ "local": "已保存在本地设置中",
202
+ "project": "已保存在项目设置中",
203
+ "user": "已保存在用户设置中"
204
+ },
205
+ "removeDirectory": "从本次会话中移除 {path}",
206
+ "savedDirectoriesNote": "保存在设置中的目录需在运行此会话的电脑上用 /permissions 移除。",
207
+ "allowedDirectoriesTitle": "本次会话已允许",
208
+ "allowedAccess": {
209
+ "read": "读取",
210
+ "edit": "读取和编辑",
211
+ "readFolder": "读取,仅此文件夹",
212
+ "editFolder": "读取和编辑,仅此文件夹"
213
+ },
214
+ "checkingGoal": "正在检查目标",
215
+ "compacted": "已压缩",
216
+ "compactedAutomatically": "✻ 已压缩对话",
217
+ "recap": "回顾:{recap}",
218
+ "goalDetail": "目标:{condition}\n\n原因:{reason}",
219
+ "turnEnd": "✻ {verb, select, baked {烘焙了} brewed {酝酿了} churned {搅拌了} cogitated {思考了} cooked {烹饪了} crunched {嚼碎了} sauteed {翻炒了} other {工作了}} {duration} · {time} 完成",
220
+ "turnEndWaiting": "✻ 正在等待 {count, plural, other {# 个后台代理}}完成",
221
+ "turnSeconds": "{seconds} 秒",
222
+ "turnMinutes": "{minutes} 分 {seconds} 秒",
223
+ "turnHours": "{hours} 小时 {minutes} 分",
224
+ "planOpened": "已在编辑器中打开计划:{path}",
225
+ "subagentMessage": "来自 {name} 的消息",
226
+ "commandCompleted": "后台命令“{name}”已完成(退出码 0)",
227
+ "commandFailed": "后台命令“{name}”失败,退出码 {code}",
228
+ "agentEnded": "代理“{name}”{outcome, select, failed {失败} other {已完成}}",
229
+ "agentEndedAfter": "代理“{name}”{outcome, select, failed {失败} other {已完成}} · {elapsed}",
230
+ "expandAll": "全部展开",
231
+ "collapseAll": "全部折叠"
232
+ };
233
+ var switcher = {
234
+ "title": "代理",
235
+ "main": "主对话",
236
+ "runningCount": "{count} 个运行中",
237
+ "doneCount": "{count} 个已完成",
238
+ "stoppedCount": "{count} 个已停止",
239
+ "earlierOnly": "{count} 个较早的代理",
240
+ "approvals": "{count} 项待批准",
241
+ "failedCount": "{count} 个失败",
242
+ "stopAll": "全部停止",
243
+ "showEarlier": "显示 {count} 个较早的代理",
244
+ "hideEarlier": "隐藏 {count} 个较早的代理",
245
+ "agentName": "{type}: {description}",
246
+ "stop": "停止 {name}",
247
+ "stopThis": "停止",
248
+ "back": "返回主对话",
249
+ "tokens": "{tokens} 个令牌",
250
+ "approval": "需要批准",
251
+ "running": "运行中",
252
+ "failed": "失败",
253
+ "stopped": "已停止",
254
+ "done": "已完成",
255
+ "idle": "空闲",
256
+ "composer": "向 {name} 发消息",
257
+ "steerHint": "代理运行期间,消息会作为指示发送。",
258
+ "commandsOnMain": "命令和 ! 在主对话中运行。请返回主对话后使用。",
259
+ "transcriptLabel": "代理记录"
260
+ };
261
+ var effort = {
262
+ "label": "推理强度",
263
+ "named": "推理强度:{level}",
264
+ "low": "低",
265
+ "medium": "中",
266
+ "high": "高",
267
+ "xhigh": "超高",
268
+ "max": "最高",
269
+ "faster": "更快",
270
+ "smarter": "更智能"
271
+ };
272
+ var permission = {
273
+ "read-only": "只读",
274
+ "accept-edits": "接受编辑",
275
+ "auto": "自动",
276
+ "bypass-permissions": "绕过权限",
277
+ "plan": "计划",
278
+ "hint": {
279
+ "read-only": "工作区可以被读取,但不能被更改。",
280
+ "accept-edits": "文件编辑会在不询问的情况下被应用。工作区可能在未经你审查的情况下被更改。",
281
+ "auto": "文件编辑会在不询问的情况下被应用。大多数需要询问你的操作都由自动审查器批准或拒绝。",
282
+ "bypass-permissions": "所有操作都会在不询问的情况下执行,包括会更改系统的命令。",
283
+ "plan": "在制定计划期间,工作区不会被更改。"
284
+ }
285
+ };
286
+ var dash = {
287
+ "needsYou": "需要你处理",
288
+ "waitingFor": "已等待 {when}",
289
+ "answerInSession": "正在等待回答。打开会话进行回复。"
290
+ };
291
+ var claude = {
292
+ "disabled": "您的组织已禁用 Claude Code。请使用获批的平台模型或推理端点模型。",
293
+ "notInstalled": "此代理主机未安装 Claude Code。要使用 /claude-code,请用官方安装程序安装它,或将 claude 添加到 pw code 运行时使用的 PATH 中。",
294
+ "models": "Claude 订阅",
295
+ "loadingModels": "正在加载 Claude 模型…",
296
+ "refreshModels": "刷新模型",
297
+ "accounts": "Claude Code 账户",
298
+ "close": "关闭 Claude Code 账户",
299
+ "noAccounts": "此机器上尚未配置 Claude Code 账户。",
300
+ "selected": "Claude Code · {account}",
301
+ "choose": "Claude Code 账户",
302
+ "hostAccounts": "{host} 上的账户",
303
+ "loadingAccounts": "正在加载账户…",
304
+ "loadingUsage": "正在加载用量…",
305
+ "signedOut": "未登录",
306
+ "usageUnavailable": "用量不可用",
307
+ "current": "已选择的账户",
308
+ "loginOnHost": "如需登录,请在此主机的 pw code 中运行 /claude-code。",
309
+ "fiveHour": "5 小时已使用 {percent}",
310
+ "week": "本周已使用 {percent}",
311
+ "resets": "于 {time} 重置",
312
+ "platformModels": "平台模型",
313
+ "shortAccount": "账户",
314
+ "fiveHourColumn": "5 小时用量",
315
+ "weekColumn": "本周用量",
316
+ "resetsIn": "{time}后重置",
317
+ "resetsInShort": "{time}后",
318
+ "addAccount": "添加账号",
319
+ "signIn": "登录",
320
+ "signInAgain": "重新登录",
321
+ "signInTitle": "登录 Claude Code",
322
+ "profileOnHost": "{host} 上的 {account}",
323
+ "accountName": "账号名称",
324
+ "accountNameHelp": "使用 1–64 个字母、数字、点、@、连字符或下划线。这是账号的本地标签。",
325
+ "invalidAccountName": "名称应为 1–64 个字母、数字、点、@、连字符或下划线,不能仅包含一个点或两个点,也不能以 .lock 结尾。",
326
+ "continueSignIn": "继续登录",
327
+ "backToAccounts": "返回账号列表",
328
+ "loginStaysOnHost": "您的 Claude Code 登录信息保存在 {host} 上。",
329
+ "loadingTerminal": "正在加载登录终端…",
330
+ "signInTerminal": "Claude Code 登录终端",
331
+ "startingSignIn": "正在开始登录…",
332
+ "signInInstructions": "打开登录页面并按照 Claude 的提示操作。如果 Claude 给出代码,请将其粘贴到终端中。你的登录信息保留在 {host} 上。",
333
+ "openSignInPage": "打开登录页面",
334
+ "inputTooLong": "粘贴内容过长。请仅粘贴验证码。",
335
+ "terminalTruncated": "较早的终端输出已不可用。",
336
+ "reconnectSignIn": "重新连接",
337
+ "retrySignIn": "重试",
338
+ "cancelSignIn": "取消登录",
339
+ "useThisAccount": "使用此账号",
340
+ "remove": "移除",
341
+ "removeAccount": "移除账号",
342
+ "removeBody": "将 {account} 退出登录并从 {host} 上移除?",
343
+ "signInStatus": {
344
+ "running": "请按终端提示操作。",
345
+ "checking": "正在验证登录…",
346
+ "signed_in": "已登录为 {email}。",
347
+ "failed": "无法验证登录。请检查终端输出并重试。",
348
+ "canceled": "登录已取消。",
349
+ "expired": "登录已过期。请重试。"
350
+ },
351
+ "useAccount": "使用",
352
+ "accountActions": "{account} 的操作"
353
+ };
354
+ var terminal = {
355
+ "title": "在终端中继续",
356
+ "resourceBody": "在 pw code 中接续此对话。会话继续在 {machine} 上运行,此页面会同步更新。",
357
+ "computerBody": "此会话在 {host} 上运行。在那台机器的终端中运行此命令,即可在 pw code 中接续。此页面会同步更新。",
358
+ "anyTerminal": "可在任何已登录 pw 的终端中运行。",
359
+ "archived": "接续后,它会从已归档中恢复。",
360
+ "open": "在终端中打开",
361
+ "offline": "工作区终端未连接。请复制命令,在其他终端中运行。",
362
+ "commandLabel": "终端命令",
363
+ "machineLoading": "正在查找此会话所在的机器…",
364
+ "machineMissing": "此会话所在的机器目前未列出,因此暂时无法提供命令。"
365
+ };
366
+ var agents_default = {
367
+ title,
368
+ sidebar,
369
+ start,
370
+ status,
371
+ machine,
372
+ detail,
373
+ switcher,
374
+ effort,
375
+ permission,
376
+ dash,
377
+ claude,
378
+ terminal
379
+ };
380
+ export { claude, dash, agents_default as default, detail, effort, machine, permission, sidebar, start, status, switcher, terminal, title };
@@ -0,0 +1,3 @@
1
+ import type { PwCodeMessages } from '../messages.js';
2
+ declare const messages: PwCodeMessages;
3
+ export default messages;
@@ -0,0 +1,8 @@
1
+ import agentTranscript_default from "./zh/agentTranscript.js";
2
+ import agents_default from "./zh/agents.js";
3
+ // src/locales/zh.ts
4
+ var messages = {
5
+ agentTranscript: agentTranscript_default,
6
+ agents: agents_default
7
+ };
8
+ export { messages as default };
@@ -0,0 +1,51 @@
1
+ /** A machine as the sessions listing has it, as far as the shared logic reads
2
+ * it. A host that types its API from a spec asserts its type extends this. */
3
+ export interface PwCodeMachine {
4
+ id: string;
5
+ name: string;
6
+ /** `local` for a computer; anything else is a resource. */
7
+ kind: string;
8
+ /** `connected`, or why the machine cannot be reached. */
9
+ status: string;
10
+ /** What reaching the machine failed with, in its own words. */
11
+ error?: string | undefined;
12
+ /** The version of the pw agent the machine runs. */
13
+ agentVersion?: string | undefined;
14
+ owner?: string | undefined;
15
+ hostname?: string | undefined;
16
+ daemonId?: string | undefined;
17
+ storeId?: string | undefined;
18
+ /** The daemon stores which of the reader's groups a session is in. */
19
+ sessionGroups?: boolean | undefined;
20
+ remoteStart?: boolean | undefined;
21
+ }
22
+ /** A computer's daemon connected itself; every other machine is a resource
23
+ * reached through its pw agent. */
24
+ export declare function isComputer(machine: Pick<PwCodeMachine, 'kind'>): boolean;
25
+ export type TerminalHandoff = {
26
+ on: 'resource';
27
+ command: string;
28
+ args: string[];
29
+ resource: string;
30
+ } | {
31
+ on: 'computer';
32
+ command: string;
33
+ host: string;
34
+ };
35
+ /** The pw code command that picks a session up. A resource's daemon answers
36
+ * any terminal signed in to pw; a computer's only that computer. */
37
+ export declare function terminalHandoff(machine: PwCodeMachine, sessionId: string, username: string | undefined): TerminalHandoff;
38
+ export declare function splitMachines<M extends Pick<PwCodeMachine, 'kind'>>(machines: readonly M[]): {
39
+ computers: M[];
40
+ resources: M[];
41
+ };
42
+ export declare function isConnected(machine: Pick<PwCodeMachine, 'status'> | undefined): boolean;
43
+ /** A machine the listing does not know is not down: only one that reports a
44
+ * status other than connected is. */
45
+ export declare function isMachineDown<M extends Pick<PwCodeMachine, 'status'>>(machine: M | undefined): machine is M;
46
+ /** A request that failed because pw code on the machine could not be reached. */
47
+ export declare function isUnreachableError(error: unknown): boolean;
48
+ export declare function machinesById<M extends Pick<PwCodeMachine, 'id'>>(machines: readonly M[]): Map<string, M>;
49
+ /** Only a machine whose owner turned on starting from another client lets one
50
+ * start a session; every other machine only shows what its owner opened. */
51
+ export declare function canStartHere(machine: Pick<PwCodeMachine, 'status' | 'remoteStart'>): boolean;
@@ -0,0 +1,60 @@
1
+ // src/machine.ts
2
+ /** A computer's daemon connected itself; every other machine is a resource
3
+ * reached through its pw agent. */
4
+ function isComputer(machine) {
5
+ return machine.kind === "local";
6
+ }
7
+ /** The pw code command that picks a session up. A resource's daemon answers
8
+ * any terminal signed in to pw; a computer's only that computer. */
9
+ function terminalHandoff(machine, sessionId, username) {
10
+ if (isComputer(machine)) return {
11
+ on: "computer",
12
+ command: `pw code -r ${sessionId}`,
13
+ host: machine.hostname || machine.name
14
+ };
15
+ const resource = machine.owner && machine.owner !== username ? `pw://${machine.owner}/${machine.name}` : machine.name;
16
+ const args = [
17
+ "code",
18
+ "attach",
19
+ `${resource}/${sessionId}`
20
+ ];
21
+ return {
22
+ on: "resource",
23
+ command: `pw ${args.join(" ")}`,
24
+ args,
25
+ resource
26
+ };
27
+ }
28
+ function splitMachines(machines) {
29
+ return {
30
+ computers: machines.filter(isComputer),
31
+ resources: machines.filter((m) => !isComputer(m))
32
+ };
33
+ }
34
+ function isConnected(machine) {
35
+ return machine?.status === "connected";
36
+ }
37
+ /** A machine the listing does not know is not down: only one that reports a
38
+ * status other than connected is. */
39
+ function isMachineDown(machine) {
40
+ return !!machine && !isConnected(machine);
41
+ }
42
+ var unreachableCodes = /* @__PURE__ */ new Set([
43
+ "agents_unreachable",
44
+ "agents_no_daemon",
45
+ "agents_no_agent"
46
+ ]);
47
+ /** A request that failed because pw code on the machine could not be reached. */
48
+ function isUnreachableError(error) {
49
+ const code = error?.code;
50
+ return typeof code === "string" && unreachableCodes.has(code);
51
+ }
52
+ function machinesById(machines) {
53
+ return new Map(machines.map((m) => [m.id, m]));
54
+ }
55
+ /** Only a machine whose owner turned on starting from another client lets one
56
+ * start a session; every other machine only shows what its owner opened. */
57
+ function canStartHere(machine) {
58
+ return isConnected(machine) && !!machine.remoteStart;
59
+ }
60
+ export { canStartHere, isComputer, isConnected, isMachineDown, isUnreachableError, machinesById, splitMachines, terminalHandoff };
@@ -0,0 +1,17 @@
1
+ import { type createTranslator } from 'use-intl';
2
+ import type en from './locales/en.js';
3
+ /** pw code's messages in one language, by namespace, for a host to merge into
4
+ * its own. Typed from the English catalogs, which every language matches. */
5
+ export type PwCodeMessages = typeof en;
6
+ export type PwCodeNamespace = keyof PwCodeMessages;
7
+ /** A use-intl translator over one of pw code's namespaces. */
8
+ export type PwCodeTranslator<N extends PwCodeNamespace> = ReturnType<typeof createTranslator<PwCodeMessages, N>>;
9
+ export declare const pwCodeNamespaces: readonly ["agentTranscript", "agents"];
10
+ export declare const pwCodeLocales: readonly ['en', 'es', 'ja', 'ko', 'zh'];
11
+ export type PwCodeLocale = (typeof pwCodeLocales)[number];
12
+ export declare function isPwCodeLocale(locale: string): locale is PwCodeLocale;
13
+ /** pw code's messages in one of `pwCodeLocales`; any other locale rejects. */
14
+ export declare function loadPwCodeMessages(locale: string): Promise<PwCodeMessages>;
15
+ /** use-intl's useTranslations, typed from pw code's catalogs whatever
16
+ * messages the host declares to use-intl. */
17
+ export declare function usePwCodeTranslations<N extends PwCodeNamespace>(namespace: N): PwCodeTranslator<N>;
@@ -0,0 +1,31 @@
1
+ import { useTranslations } from "use-intl";
2
+ // src/messages.ts
3
+ var pwCodeNamespaces = ["agentTranscript", "agents"];
4
+ var pwCodeLocales = [
5
+ "en",
6
+ "es",
7
+ "ja",
8
+ "ko",
9
+ "zh"
10
+ ];
11
+ var catalogs = {
12
+ en: () => import("./locales/en.js"),
13
+ es: () => import("./locales/es.js"),
14
+ ja: () => import("./locales/ja.js"),
15
+ ko: () => import("./locales/ko.js"),
16
+ zh: () => import("./locales/zh.js")
17
+ };
18
+ function isPwCodeLocale(locale) {
19
+ return pwCodeLocales.includes(locale);
20
+ }
21
+ /** pw code's messages in one of `pwCodeLocales`; any other locale rejects. */
22
+ function loadPwCodeMessages(locale) {
23
+ if (!isPwCodeLocale(locale)) return Promise.reject(/* @__PURE__ */ new Error(`no pw code messages for ${locale}`));
24
+ return catalogs[locale]().then((module) => module.default);
25
+ }
26
+ /** use-intl's useTranslations, typed from pw code's catalogs whatever
27
+ * messages the host declares to use-intl. */
28
+ function usePwCodeTranslations(namespace) {
29
+ return useTranslations(namespace);
30
+ }
31
+ export { isPwCodeLocale, loadPwCodeMessages, pwCodeLocales, pwCodeNamespaces, usePwCodeTranslations };
@@ -0,0 +1,47 @@
1
+ import type { PwCodeApiError, Schemas } from './apiClient.js';
2
+ import type { PwCodeApi } from './createPwCodeApi.js';
3
+ /** A Claude Code subscription model, which bills no allocation. */
4
+ export declare const isClaudeModel: (model: string | null | undefined) => boolean;
5
+ /** Claude Code runs only where it is installed and its owner allows it. */
6
+ export declare function runsClaude(machine: {
7
+ claudeInstalled?: boolean | undefined;
8
+ claudeCodeAllowed?: boolean | undefined;
9
+ } | undefined): boolean;
10
+ /** Whether `model` is one the session could start on. A list still loading,
11
+ * or one that failed to load, is passed as undefined and keeps it. */
12
+ export declare function canRunModel(model: string | undefined, claudeReady: boolean, platformModels: readonly {
13
+ id: string;
14
+ }[] | undefined, claudeModels: readonly {
15
+ id: string;
16
+ }[] | undefined): boolean;
17
+ /** A model's name, or its id without the provider when it has none. */
18
+ export declare function modelLabel(id: string, name?: string, fallback?: string): string;
19
+ /** The picker a composer opens in place of sending: the model picker, or the
20
+ * Claude Code accounts. */
21
+ export type PwCodePicker = 'models' | 'claude' | null;
22
+ /** The picker a prompt typed as a command opens instead of being sent. */
23
+ export declare function pickerCommand(text: string): PwCodePicker;
24
+ /** The Claude models a model picker offers on a machine, and how their list stands. */
25
+ export interface PwCodeModelCatalog {
26
+ models: Schemas['AgentClaudeModel'][];
27
+ error: PwCodeApiError | undefined;
28
+ isLoading: boolean;
29
+ /** Asks for the list once the picker is opened, and keeps it after. */
30
+ request: () => void;
31
+ /** Asks the machine for its list again rather than the copy it keeps. */
32
+ refresh: () => void;
33
+ }
34
+ /** The machine's Claude models for a model picker. A session's own list is
35
+ * read only once the picker opens, since reading it adopts the session, which
36
+ * viewing it must not do; until then a Claude model chosen where a session
37
+ * could start reads the machine's. */
38
+ export declare function useModelCatalog(api: Pick<PwCodeApi, 'useClaudeModels'>, { machine, sessionId, claudeReady, canStart, model, account, open, }: {
39
+ machine: string;
40
+ sessionId?: string | undefined;
41
+ claudeReady: boolean;
42
+ canStart: boolean;
43
+ model: string | null | undefined;
44
+ account: string | undefined;
45
+ /** The picker is showing. */
46
+ open: boolean;
47
+ }): PwCodeModelCatalog;
package/dist/models.js ADDED
@@ -0,0 +1,49 @@
1
+ import { useState } from "react";
2
+ // src/models.ts
3
+ /** A Claude Code subscription model, which bills no allocation. */
4
+ var isClaudeModel = (model) => !!model?.startsWith("claude-code/");
5
+ /** Claude Code runs only where it is installed and its owner allows it. */
6
+ function runsClaude(machine) {
7
+ return machine?.claudeInstalled === true && machine.claudeCodeAllowed === true;
8
+ }
9
+ /** Whether `model` is one the session could start on. A list still loading,
10
+ * or one that failed to load, is passed as undefined and keeps it. */
11
+ function canRunModel(model, claudeReady, platformModels, claudeModels) {
12
+ if (isClaudeModel(model) && !claudeReady) return false;
13
+ const offered = isClaudeModel(model) ? claudeModels : platformModels;
14
+ return !offered || offered.some((m) => m.id === model);
15
+ }
16
+ /** A model's name, or its id without the provider when it has none. */
17
+ function modelLabel(id, name, fallback = "") {
18
+ return name || id.slice(id.indexOf("/") + 1) || fallback;
19
+ }
20
+ /** The picker a prompt typed as a command opens instead of being sent. */
21
+ function pickerCommand(text) {
22
+ switch (text.trim()) {
23
+ case "/model": return "models";
24
+ case "/claude-code":
25
+ case "/claude-code use": return "claude";
26
+ default: return null;
27
+ }
28
+ }
29
+ /** The machine's Claude models for a model picker. A session's own list is
30
+ * read only once the picker opens, since reading it adopts the session, which
31
+ * viewing it must not do; until then a Claude model chosen where a session
32
+ * could start reads the machine's. */
33
+ function useModelCatalog(api, { machine, sessionId, claudeReady, canStart, model, account, open }) {
34
+ const [requested, setRequested] = useState(false);
35
+ const [forceRefresh, setForceRefresh] = useState(false);
36
+ const hostCatalog = api.useClaudeModels(machine, void 0, account, claudeReady && canStart && isClaudeModel(model));
37
+ const local = api.useClaudeModels(machine, sessionId, account, claudeReady && (requested || open), forceRefresh);
38
+ return {
39
+ models: local.data ?? hostCatalog.data ?? [],
40
+ error: local.error,
41
+ isLoading: local.isLoading,
42
+ request: () => setRequested(true),
43
+ refresh: () => {
44
+ if (forceRefresh) local.mutate();
45
+ else setForceRefresh(true);
46
+ }
47
+ };
48
+ }
49
+ export { canRunModel, isClaudeModel, modelLabel, pickerCommand, runsClaude, useModelCatalog };