@parallelworks/code 0.3.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.
- package/README.md +598 -113
- package/dist/accountApi.d.ts +31 -0
- package/dist/accountApi.js +182 -0
- package/dist/agentSwitcher.d.ts +109 -0
- package/dist/agentSwitcher.js +165 -0
- package/dist/ago.d.ts +3 -3
- package/dist/ago.js +10 -10
- package/dist/allocations.d.ts +41 -0
- package/dist/allocations.js +76 -0
- package/dist/api.d.ts +1080 -11
- package/dist/chatStrings.d.ts +188 -0
- package/dist/chatStrings.js +217 -0
- package/dist/claudeAccounts.d.ts +38 -1
- package/dist/claudeAccounts.js +98 -4
- package/dist/claudeApi.js +1 -1
- package/dist/claudeSignIn.d.ts +19 -1
- package/dist/claudeSignIn.js +12 -2
- package/dist/commandsApi.d.ts +11 -1
- package/dist/commandsApi.js +24 -5
- package/dist/createPwCodeApi.d.ts +44 -5
- package/dist/createPwCodeApi.js +18 -2
- package/dist/directories.d.ts +161 -0
- package/dist/directories.js +301 -0
- package/dist/goal.d.ts +89 -0
- package/dist/goal.js +164 -0
- package/dist/imageFit.d.ts +23 -0
- package/dist/imageFit.js +27 -0
- package/dist/images.d.ts +28 -0
- package/dist/images.js +38 -6
- package/dist/index.d.ts +27 -12
- package/dist/index.js +26 -12
- package/dist/loadError.d.ts +8 -0
- package/dist/loadError.js +19 -0
- package/dist/locales/en/agentTranscript.js +73 -12
- package/dist/locales/en/agents.js +71 -9
- package/dist/locales/en.d.ts +124 -8
- package/dist/locales/es/agentTranscript.js +73 -12
- package/dist/locales/es/agents.js +71 -9
- package/dist/locales/ja/agentTranscript.js +76 -15
- package/dist/locales/ja/agents.js +45 -120
- package/dist/locales/ko/agentTranscript.js +73 -12
- package/dist/locales/ko/agents.js +71 -9
- package/dist/locales/zh/agentTranscript.js +71 -10
- package/dist/locales/zh/agents.js +71 -9
- package/dist/machine.d.ts +2 -0
- package/dist/modelPicker.d.ts +79 -0
- package/dist/modelPicker.js +107 -0
- package/dist/notices.js +47 -19
- package/dist/platformDefaults.d.ts +22 -0
- package/dist/platformDefaults.js +30 -0
- package/dist/preferences.d.ts +78 -0
- package/dist/preferences.js +128 -0
- package/dist/pullRequestList.d.ts +10 -2
- package/dist/pullRequestList.js +41 -22
- package/dist/query.d.ts +6 -2
- package/dist/query.js +85 -10
- package/dist/session.d.ts +5 -2
- package/dist/session.js +12 -8
- package/dist/sessionActions.d.ts +11 -1
- package/dist/sessionActions.js +14 -6
- package/dist/sessionEvents.d.ts +8 -3
- package/dist/sessionEvents.js +10 -5
- package/dist/sessionGroups.d.ts +3 -2
- package/dist/sessionGroups.js +4 -3
- package/dist/sessionList.d.ts +57 -9
- package/dist/sessionList.js +74 -12
- package/dist/sessionScreen.d.ts +193 -0
- package/dist/sessionScreen.js +213 -0
- package/dist/sessionsApi.d.ts +13 -3
- package/dist/sessionsApi.js +88 -29
- package/dist/settingsApi.d.ts +3 -1
- package/dist/startPage.d.ts +153 -0
- package/dist/startPage.js +174 -0
- package/dist/startSession.d.ts +41 -7
- package/dist/startSession.js +26 -4
- package/dist/transcript.js +48 -15
- package/dist/types.d.ts +11 -1
- package/dist/useComposer.d.ts +25 -1
- package/dist/useComposer.js +54 -3
- package/dist/useComposerImages.d.ts +5 -0
- package/dist/useComposerImages.js +24 -1
- package/dist/useComposerPastes.d.ts +70 -0
- package/dist/useComposerPastes.js +130 -0
- package/dist/useConversation.d.ts +10 -1
- package/dist/useConversation.js +32 -5
- package/dist/useSubagent.d.ts +49 -3
- package/dist/useSubagent.js +70 -7
- package/dist/useTranscript.d.ts +23 -3
- package/dist/useTranscript.js +76 -19
- package/dist/wording.js +2 -2
- package/dist/workingDirectories.d.ts +31 -0
- package/dist/workingDirectories.js +25 -1
- package/locales/en/agentTranscript.json +67 -11
- package/locales/en/agents.json +68 -8
- package/locales/es/agentTranscript.json +67 -11
- package/locales/es/agents.json +68 -8
- package/locales/ja/agentTranscript.json +70 -14
- package/locales/ja/agents.json +68 -8
- package/locales/ko/agentTranscript.json +67 -11
- package/locales/ko/agents.json +68 -8
- package/locales/zh/agentTranscript.json +65 -9
- package/locales/zh/agents.json +68 -8
- package/package.json +6 -3
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { ToolStrings } from '@parallelworks/ui/ai/headless';
|
|
2
|
+
import { type PwCodeTranslator } from './messages.js';
|
|
3
|
+
declare function chatStrings(t: PwCodeTranslator<'agentTranscript'>, tAgents: PwCodeTranslator<'agents'>, tools: ToolStrings): {
|
|
4
|
+
agentTranscript: {
|
|
5
|
+
running: string;
|
|
6
|
+
done: string;
|
|
7
|
+
failed: string;
|
|
8
|
+
failedWith: (reason: string) => string;
|
|
9
|
+
callGroup: (tool: string, count: number) => string;
|
|
10
|
+
editGroup: (count: number) => string;
|
|
11
|
+
writeGroup: (files: number) => string;
|
|
12
|
+
failedGroup: (tool: string, count: number) => string;
|
|
13
|
+
failedCount: (count: number) => string;
|
|
14
|
+
interrupted: string;
|
|
15
|
+
interruptedReason: string;
|
|
16
|
+
reviewing: (count: number) => string;
|
|
17
|
+
backgroundLaunched: (count: number) => string;
|
|
18
|
+
argsRewritten: string;
|
|
19
|
+
noOutput: string;
|
|
20
|
+
diffTruncated: string;
|
|
21
|
+
moreLines: (count: number) => string;
|
|
22
|
+
allowOnce: string;
|
|
23
|
+
allowDirectory: string;
|
|
24
|
+
deny: string;
|
|
25
|
+
allowCode: string;
|
|
26
|
+
denyCode: string;
|
|
27
|
+
allowPath: string;
|
|
28
|
+
denyPath: string;
|
|
29
|
+
allowCall: string;
|
|
30
|
+
denyCall: string;
|
|
31
|
+
denyWithFeedback: string;
|
|
32
|
+
feedbackPlaceholder: string;
|
|
33
|
+
answered: string;
|
|
34
|
+
allowedBy: (name: string) => string;
|
|
35
|
+
allowedWithChangesBy: (name: string) => string;
|
|
36
|
+
deniedBy: (name: string) => string;
|
|
37
|
+
allowed: string;
|
|
38
|
+
allowedWithChanges: string;
|
|
39
|
+
denied: string;
|
|
40
|
+
allowedByReviewer: string;
|
|
41
|
+
deniedByReviewer: string;
|
|
42
|
+
approvalExpired: string;
|
|
43
|
+
approvalTimedOut: string;
|
|
44
|
+
reviewTimedOut: string;
|
|
45
|
+
reviewFailed: string;
|
|
46
|
+
writeOwnAnswer: string;
|
|
47
|
+
subagent: string;
|
|
48
|
+
tasks: string;
|
|
49
|
+
planPending: string;
|
|
50
|
+
approvalPending: string;
|
|
51
|
+
approvalOptions: string;
|
|
52
|
+
approvalLabel: string;
|
|
53
|
+
approvalAllowed: string;
|
|
54
|
+
approvalDenied: string;
|
|
55
|
+
approvalRequestExpired: string;
|
|
56
|
+
approvalWaitingOn: (name: string) => string;
|
|
57
|
+
feedbackLabel: string;
|
|
58
|
+
ownAnswerLabel: string;
|
|
59
|
+
typeYourAnswer: string;
|
|
60
|
+
questionsLabel: string;
|
|
61
|
+
questionTab: (n: number) => string;
|
|
62
|
+
answeredCount: (answered: number, total: number) => string;
|
|
63
|
+
submitAnswers: string;
|
|
64
|
+
chatAboutThis: string;
|
|
65
|
+
noAnswer: string;
|
|
66
|
+
noPreview: string;
|
|
67
|
+
previewOf: (label: string) => string;
|
|
68
|
+
notesLabel: string;
|
|
69
|
+
notesPlaceholder: string;
|
|
70
|
+
notesOnly: string;
|
|
71
|
+
todoPending: string;
|
|
72
|
+
todoInProgress: string;
|
|
73
|
+
todoCompleted: string;
|
|
74
|
+
};
|
|
75
|
+
tools: ToolStrings;
|
|
76
|
+
queue: {
|
|
77
|
+
remove: string;
|
|
78
|
+
waiting: string;
|
|
79
|
+
waitingNextStep: string;
|
|
80
|
+
handedOver: string;
|
|
81
|
+
edit: string;
|
|
82
|
+
editLabel: string;
|
|
83
|
+
editHint: string;
|
|
84
|
+
};
|
|
85
|
+
paste: {
|
|
86
|
+
title: string;
|
|
87
|
+
lines: (count: number) => string;
|
|
88
|
+
saving: string;
|
|
89
|
+
remove: string;
|
|
90
|
+
};
|
|
91
|
+
thinking: {
|
|
92
|
+
label: string;
|
|
93
|
+
ellipsis: string;
|
|
94
|
+
thoughtFor: (duration: string) => string;
|
|
95
|
+
thoughtProcess: string;
|
|
96
|
+
activity: string;
|
|
97
|
+
ranToolCalls: (count: number) => string;
|
|
98
|
+
ranToolCallsAs: (count: number, name: string) => string;
|
|
99
|
+
};
|
|
100
|
+
activity: {
|
|
101
|
+
tokens: (input: string, output: string) => string;
|
|
102
|
+
stop: string;
|
|
103
|
+
};
|
|
104
|
+
input: {
|
|
105
|
+
stopGenerating: string;
|
|
106
|
+
loadingCommands: string;
|
|
107
|
+
};
|
|
108
|
+
thread: {
|
|
109
|
+
jumpToPrompt: (text: string) => string;
|
|
110
|
+
};
|
|
111
|
+
find: {
|
|
112
|
+
label: string;
|
|
113
|
+
count: (current: number, total: number) => string;
|
|
114
|
+
countCapped: (current: number, total: number) => string;
|
|
115
|
+
none: string;
|
|
116
|
+
previous: string;
|
|
117
|
+
next: string;
|
|
118
|
+
close: string;
|
|
119
|
+
};
|
|
120
|
+
chrome: {
|
|
121
|
+
jumpToLatest: string;
|
|
122
|
+
};
|
|
123
|
+
messageMeta: {
|
|
124
|
+
copyLabel: string;
|
|
125
|
+
};
|
|
126
|
+
attachmentManager: {
|
|
127
|
+
unnamedImage: string;
|
|
128
|
+
unnamedFile: string;
|
|
129
|
+
open: (name: string) => string;
|
|
130
|
+
download: (name: string) => string;
|
|
131
|
+
previousImage: string;
|
|
132
|
+
nextImage: string;
|
|
133
|
+
imagePosition: (position: number, total: number) => string;
|
|
134
|
+
fullImageFailed: string;
|
|
135
|
+
};
|
|
136
|
+
sidebar: {
|
|
137
|
+
openSidebar: string;
|
|
138
|
+
closeSidebar: string;
|
|
139
|
+
manageProviders: string;
|
|
140
|
+
};
|
|
141
|
+
modelPicker: {
|
|
142
|
+
choose: string;
|
|
143
|
+
select: string;
|
|
144
|
+
search: string;
|
|
145
|
+
loading: string;
|
|
146
|
+
failed: string;
|
|
147
|
+
none: string;
|
|
148
|
+
sharedBy: (owner: string) => string;
|
|
149
|
+
};
|
|
150
|
+
allocationPicker: {
|
|
151
|
+
choose: string;
|
|
152
|
+
placeholder: string;
|
|
153
|
+
search: string;
|
|
154
|
+
};
|
|
155
|
+
providerIssue: {
|
|
156
|
+
keyRejected: string;
|
|
157
|
+
unreachable: string;
|
|
158
|
+
};
|
|
159
|
+
permissions: {
|
|
160
|
+
choose: string;
|
|
161
|
+
readOnly: string;
|
|
162
|
+
acceptEdits: string;
|
|
163
|
+
auto: string;
|
|
164
|
+
bypassPermissions: string;
|
|
165
|
+
plan: string;
|
|
166
|
+
readOnlyHint: string;
|
|
167
|
+
acceptEditsHint: string;
|
|
168
|
+
autoHint: string;
|
|
169
|
+
bypassPermissionsHint: string;
|
|
170
|
+
planHint: string;
|
|
171
|
+
};
|
|
172
|
+
effort: {
|
|
173
|
+
choose: string;
|
|
174
|
+
named: (level: string) => string;
|
|
175
|
+
low: string;
|
|
176
|
+
medium: string;
|
|
177
|
+
high: string;
|
|
178
|
+
xhigh: string;
|
|
179
|
+
max: string;
|
|
180
|
+
faster: string;
|
|
181
|
+
smarter: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/** pw code's words for `@parallelworks/ui`'s chat, by its `ChatStrings` sections. */
|
|
185
|
+
export type PwCodeChatStrings = ReturnType<typeof chatStrings>;
|
|
186
|
+
/** Every word of `@parallelworks/ui`'s chat a pw code page shows, in the reader's language. */
|
|
187
|
+
export declare function usePwCodeChatStrings(): PwCodeChatStrings;
|
|
188
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { usePwCodeTranslations } from "./messages.js";
|
|
2
|
+
import { useToolStrings } from "./toolStrings.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
// src/chatStrings.ts
|
|
5
|
+
function chatStrings(t, tAgents, tools) {
|
|
6
|
+
return {
|
|
7
|
+
agentTranscript: {
|
|
8
|
+
running: t("transcript.running"),
|
|
9
|
+
done: t("transcript.done"),
|
|
10
|
+
failed: t("transcript.failed"),
|
|
11
|
+
failedWith: (reason) => t("transcript.failedWith", { reason }),
|
|
12
|
+
callGroup: (tool, count) => t("transcript.callGroup", {
|
|
13
|
+
tool,
|
|
14
|
+
count
|
|
15
|
+
}),
|
|
16
|
+
editGroup: (count) => t("transcript.editGroup", { count }),
|
|
17
|
+
writeGroup: (files) => t("transcript.writeGroup", { count: files }),
|
|
18
|
+
failedGroup: (tool, count) => t("transcript.failedGroup", {
|
|
19
|
+
tool,
|
|
20
|
+
count
|
|
21
|
+
}),
|
|
22
|
+
failedCount: (count) => t("transcript.failedCount", { count }),
|
|
23
|
+
interrupted: t("transcript.interrupted"),
|
|
24
|
+
interruptedReason: t("transcript.interruptedReason"),
|
|
25
|
+
reviewing: (count) => t("transcript.reviewing", { count }),
|
|
26
|
+
backgroundLaunched: (count) => t("transcript.backgroundLaunched", { count }),
|
|
27
|
+
argsRewritten: t("transcript.argsRewritten"),
|
|
28
|
+
noOutput: t("transcript.noOutput"),
|
|
29
|
+
diffTruncated: t("transcript.diffTruncated"),
|
|
30
|
+
moreLines: (count) => t("transcript.moreLines", { count }),
|
|
31
|
+
allowOnce: t("transcript.allowOnce"),
|
|
32
|
+
allowDirectory: t("transcript.allowDirectory"),
|
|
33
|
+
deny: t("transcript.deny"),
|
|
34
|
+
allowCode: t("transcript.allowCode"),
|
|
35
|
+
denyCode: t("transcript.denyCode"),
|
|
36
|
+
allowPath: t("transcript.allowPath"),
|
|
37
|
+
denyPath: t("transcript.denyPath"),
|
|
38
|
+
allowCall: t("transcript.allowCall"),
|
|
39
|
+
denyCall: t("transcript.denyCall"),
|
|
40
|
+
denyWithFeedback: t("transcript.denyWithFeedback"),
|
|
41
|
+
feedbackPlaceholder: t("transcript.feedbackPlaceholder"),
|
|
42
|
+
answered: t("transcript.answered"),
|
|
43
|
+
allowedBy: (name) => t("transcript.allowedBy", { name }),
|
|
44
|
+
allowedWithChangesBy: (name) => t("transcript.allowedWithChangesBy", { name }),
|
|
45
|
+
deniedBy: (name) => t("transcript.deniedBy", { name }),
|
|
46
|
+
allowed: t("transcript.allowed"),
|
|
47
|
+
allowedWithChanges: t("transcript.allowedWithChanges"),
|
|
48
|
+
denied: t("transcript.denied"),
|
|
49
|
+
allowedByReviewer: t("transcript.allowedByReviewer"),
|
|
50
|
+
deniedByReviewer: t("transcript.deniedByReviewer"),
|
|
51
|
+
approvalExpired: t("transcript.approvalExpired"),
|
|
52
|
+
approvalTimedOut: t("transcript.approvalTimedOut"),
|
|
53
|
+
reviewTimedOut: t("transcript.reviewTimedOut"),
|
|
54
|
+
reviewFailed: t("transcript.reviewFailed"),
|
|
55
|
+
writeOwnAnswer: t("transcript.writeOwnAnswer"),
|
|
56
|
+
subagent: t("transcript.subagent"),
|
|
57
|
+
tasks: t("transcript.tasks"),
|
|
58
|
+
planPending: t("transcript.planPending"),
|
|
59
|
+
approvalPending: t("transcript.approvalPending"),
|
|
60
|
+
approvalOptions: t("transcript.approvalOptions"),
|
|
61
|
+
approvalLabel: t("transcript.approvalLabel"),
|
|
62
|
+
approvalAllowed: t("transcript.approvalAllowed"),
|
|
63
|
+
approvalDenied: t("transcript.approvalDenied"),
|
|
64
|
+
approvalRequestExpired: t("transcript.approvalRequestExpired"),
|
|
65
|
+
approvalWaitingOn: (name) => t("transcript.approvalWaitingOn", { name }),
|
|
66
|
+
feedbackLabel: t("transcript.feedbackLabel"),
|
|
67
|
+
ownAnswerLabel: t("transcript.ownAnswerLabel"),
|
|
68
|
+
typeYourAnswer: t("transcript.typeYourAnswer"),
|
|
69
|
+
questionsLabel: t("transcript.questionsLabel"),
|
|
70
|
+
questionTab: (n) => t("transcript.questionTab", { n }),
|
|
71
|
+
answeredCount: (answered, total) => t("transcript.answeredCount", {
|
|
72
|
+
answered,
|
|
73
|
+
total
|
|
74
|
+
}),
|
|
75
|
+
submitAnswers: t("transcript.submitAnswers"),
|
|
76
|
+
chatAboutThis: t("transcript.chatAboutThis"),
|
|
77
|
+
noAnswer: t("transcript.noAnswer"),
|
|
78
|
+
noPreview: t("transcript.noPreview"),
|
|
79
|
+
previewOf: (label) => t("transcript.previewOf", { label }),
|
|
80
|
+
notesLabel: t("transcript.notesLabel"),
|
|
81
|
+
notesPlaceholder: t("transcript.notesPlaceholder"),
|
|
82
|
+
notesOnly: t("transcript.notesOnly"),
|
|
83
|
+
todoPending: t("transcript.todoPending"),
|
|
84
|
+
todoInProgress: t("transcript.todoInProgress"),
|
|
85
|
+
todoCompleted: t("transcript.todoCompleted")
|
|
86
|
+
},
|
|
87
|
+
tools,
|
|
88
|
+
queue: {
|
|
89
|
+
remove: t("queue.remove"),
|
|
90
|
+
waiting: t("queue.waiting"),
|
|
91
|
+
waitingNextStep: t("queue.waitingNextStep"),
|
|
92
|
+
handedOver: t("queue.handedOver"),
|
|
93
|
+
edit: t("queue.edit"),
|
|
94
|
+
editLabel: t("queue.editLabel"),
|
|
95
|
+
editHint: t("queue.editHint")
|
|
96
|
+
},
|
|
97
|
+
paste: {
|
|
98
|
+
title: t("paste.title"),
|
|
99
|
+
lines: (count) => t("paste.lines", { count }),
|
|
100
|
+
saving: t("paste.saving"),
|
|
101
|
+
remove: t("paste.remove")
|
|
102
|
+
},
|
|
103
|
+
thinking: {
|
|
104
|
+
label: t("thinking.label"),
|
|
105
|
+
ellipsis: t("thinking.ellipsis"),
|
|
106
|
+
thoughtFor: (duration) => t("thinking.thoughtFor", { duration }),
|
|
107
|
+
thoughtProcess: t("thinking.thoughtProcess"),
|
|
108
|
+
activity: t("thinking.activity"),
|
|
109
|
+
ranToolCalls: (count) => t("thinking.ranToolCalls", { count }),
|
|
110
|
+
ranToolCallsAs: (count, name) => t("thinking.ranToolCallsAs", {
|
|
111
|
+
count,
|
|
112
|
+
name
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
activity: {
|
|
116
|
+
tokens: (input, output) => t("activity.tokens", {
|
|
117
|
+
input,
|
|
118
|
+
output
|
|
119
|
+
}),
|
|
120
|
+
stop: t("activity.stop")
|
|
121
|
+
},
|
|
122
|
+
input: {
|
|
123
|
+
stopGenerating: t("input.stopGenerating"),
|
|
124
|
+
loadingCommands: t("input.loadingCommands")
|
|
125
|
+
},
|
|
126
|
+
thread: { jumpToPrompt: (text) => t("thread.jumpToPrompt", { text }) },
|
|
127
|
+
find: {
|
|
128
|
+
label: t("find.label"),
|
|
129
|
+
count: (current, total) => t("find.count", {
|
|
130
|
+
current,
|
|
131
|
+
total
|
|
132
|
+
}),
|
|
133
|
+
countCapped: (current, total) => t("find.countCapped", {
|
|
134
|
+
current,
|
|
135
|
+
total
|
|
136
|
+
}),
|
|
137
|
+
none: t("find.none"),
|
|
138
|
+
previous: t("find.previous"),
|
|
139
|
+
next: t("find.next"),
|
|
140
|
+
close: t("find.close")
|
|
141
|
+
},
|
|
142
|
+
chrome: { jumpToLatest: t("chrome.jumpToLatest") },
|
|
143
|
+
messageMeta: { copyLabel: t("messageMeta.copyLabel") },
|
|
144
|
+
attachmentManager: {
|
|
145
|
+
unnamedImage: t("attachmentManager.unnamedImage"),
|
|
146
|
+
unnamedFile: t("attachmentManager.unnamedFile"),
|
|
147
|
+
open: (name) => t("attachmentManager.open", { name }),
|
|
148
|
+
download: (name) => t("attachmentManager.download", { name }),
|
|
149
|
+
previousImage: t("attachmentManager.previousImage"),
|
|
150
|
+
nextImage: t("attachmentManager.nextImage"),
|
|
151
|
+
imagePosition: (position, total) => t("attachmentManager.imagePosition", {
|
|
152
|
+
position,
|
|
153
|
+
total
|
|
154
|
+
}),
|
|
155
|
+
fullImageFailed: t("attachmentManager.fullImageFailed")
|
|
156
|
+
},
|
|
157
|
+
sidebar: {
|
|
158
|
+
openSidebar: t("sidebar.openSidebar"),
|
|
159
|
+
closeSidebar: t("sidebar.closeSidebar"),
|
|
160
|
+
manageProviders: t("sidebar.manageProviders")
|
|
161
|
+
},
|
|
162
|
+
modelPicker: {
|
|
163
|
+
choose: t("modelPicker.choose"),
|
|
164
|
+
select: t("modelPicker.select"),
|
|
165
|
+
search: t("modelPicker.search"),
|
|
166
|
+
loading: t("modelPicker.loading"),
|
|
167
|
+
failed: t("modelPicker.failed"),
|
|
168
|
+
none: t("modelPicker.none"),
|
|
169
|
+
sharedBy: (owner) => t("modelPicker.sharedBy", { owner })
|
|
170
|
+
},
|
|
171
|
+
allocationPicker: {
|
|
172
|
+
choose: t("allocationPicker.choose"),
|
|
173
|
+
placeholder: t("allocationPicker.placeholder"),
|
|
174
|
+
search: t("allocationPicker.search")
|
|
175
|
+
},
|
|
176
|
+
providerIssue: {
|
|
177
|
+
keyRejected: t("providerIssue.keyRejected"),
|
|
178
|
+
unreachable: t("providerIssue.unreachable")
|
|
179
|
+
},
|
|
180
|
+
permissions: {
|
|
181
|
+
choose: tAgents("start.choosePermission"),
|
|
182
|
+
readOnly: tAgents("permission.read-only"),
|
|
183
|
+
acceptEdits: tAgents("permission.accept-edits"),
|
|
184
|
+
auto: tAgents("permission.auto"),
|
|
185
|
+
bypassPermissions: tAgents("permission.bypass-permissions"),
|
|
186
|
+
plan: tAgents("permission.plan"),
|
|
187
|
+
readOnlyHint: tAgents("permission.hint.read-only"),
|
|
188
|
+
acceptEditsHint: tAgents("permission.hint.accept-edits"),
|
|
189
|
+
autoHint: tAgents("permission.hint.auto"),
|
|
190
|
+
bypassPermissionsHint: tAgents("permission.hint.bypass-permissions"),
|
|
191
|
+
planHint: tAgents("permission.hint.plan")
|
|
192
|
+
},
|
|
193
|
+
effort: {
|
|
194
|
+
choose: tAgents("effort.label"),
|
|
195
|
+
named: (level) => tAgents("effort.named", { level }),
|
|
196
|
+
low: tAgents("effort.low"),
|
|
197
|
+
medium: tAgents("effort.medium"),
|
|
198
|
+
high: tAgents("effort.high"),
|
|
199
|
+
xhigh: tAgents("effort.xhigh"),
|
|
200
|
+
max: tAgents("effort.max"),
|
|
201
|
+
faster: tAgents("effort.faster"),
|
|
202
|
+
smarter: tAgents("effort.smarter")
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/** Every word of `@parallelworks/ui`'s chat a pw code page shows, in the reader's language. */
|
|
207
|
+
function usePwCodeChatStrings() {
|
|
208
|
+
const t = usePwCodeTranslations("agentTranscript");
|
|
209
|
+
const tAgents = usePwCodeTranslations("agents");
|
|
210
|
+
const tools = useToolStrings();
|
|
211
|
+
return useMemo(() => chatStrings(t, tAgents, tools), [
|
|
212
|
+
t,
|
|
213
|
+
tAgents,
|
|
214
|
+
tools
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
export { usePwCodeChatStrings };
|
package/dist/claudeAccounts.d.ts
CHANGED
|
@@ -22,10 +22,29 @@ export interface ClaudeAccountAction {
|
|
|
22
22
|
destructive: boolean;
|
|
23
23
|
run: () => void;
|
|
24
24
|
}
|
|
25
|
+
/** The line under an account's name: its email, or, for a signed-out account
|
|
26
|
+
* the machine can't sign in from here, how to sign it in on the machine. */
|
|
27
|
+
export interface ClaudeAccountDetail {
|
|
28
|
+
kind: 'email' | 'signInHint';
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
25
31
|
export interface ClaudeAccountPanelState {
|
|
26
32
|
/** Claude Code is allowed and installed on the machine. */
|
|
27
33
|
available: boolean;
|
|
34
|
+
/** Why Claude Code can't run on the machine, shown in place of the view;
|
|
35
|
+
* null when it can. */
|
|
36
|
+
notice: string | null;
|
|
28
37
|
view: ClaudeAccountView;
|
|
38
|
+
title: string;
|
|
39
|
+
/** The machine, or the account on it that the view acts on. */
|
|
40
|
+
description: string;
|
|
41
|
+
/** Where signing in happens, beside the list's description; null on the
|
|
42
|
+
* other views. */
|
|
43
|
+
signInNote: string | null;
|
|
44
|
+
/** The question a removal is confirmed with; null on the other views. */
|
|
45
|
+
removeBody: string | null;
|
|
46
|
+
/** Said under an empty list when the machine can't sign in from here. */
|
|
47
|
+
emptyHint: string | null;
|
|
29
48
|
accounts: ClaudeAccount[];
|
|
30
49
|
loading: boolean;
|
|
31
50
|
loadedUsage: boolean;
|
|
@@ -35,7 +54,20 @@ export interface ClaudeAccountPanelState {
|
|
|
35
54
|
empty: boolean;
|
|
36
55
|
refreshing: boolean;
|
|
37
56
|
canAdd: boolean;
|
|
57
|
+
/** The list is shown and an account can be added from it. */
|
|
58
|
+
showAdd: boolean;
|
|
59
|
+
/** The list is shown on a machine that runs Claude Code. */
|
|
60
|
+
showRefresh: boolean;
|
|
61
|
+
/** The row a list starts on: the selected account's, else the first that
|
|
62
|
+
* is signed in or can sign in from here; -1 when there is none. */
|
|
63
|
+
startIndex: number;
|
|
64
|
+
/** The selected account's row; -1 when it isn't listed. */
|
|
65
|
+
selectedIndex: number;
|
|
66
|
+
/** The first row that is signed in or can sign in from here, whether or
|
|
67
|
+
* not the setting can change now; -1 when there is none. */
|
|
68
|
+
firstEnabledIndex: number;
|
|
38
69
|
isDisabled: (account: ClaudeAccount) => boolean;
|
|
70
|
+
detail: (account: ClaudeAccount) => ClaudeAccountDetail | null;
|
|
39
71
|
/** Picks a row: an account that needs signing in opens its sign-in. */
|
|
40
72
|
choose: (account: ClaudeAccount) => void;
|
|
41
73
|
/** Makes the account the setting's value and closes the panel. */
|
|
@@ -60,11 +92,16 @@ export declare function claudeSignInRequired(error: unknown): boolean;
|
|
|
60
92
|
/** The account name `input` gives once trimmed, or null when Claude Code
|
|
61
93
|
* can't take it. */
|
|
62
94
|
export declare function claudeAccountName(input: string): string | null;
|
|
95
|
+
/** Moves a host's highlight to the list's start row, then back to it each
|
|
96
|
+
* time the selected or first enabled row changes, such as when the
|
|
97
|
+
* accounts' sign-in states arrive. */
|
|
98
|
+
export declare function useClaudeAccountStartRow(panel: Pick<ClaudeAccountPanelState, 'selectedIndex' | 'firstEnabledIndex'>, setActive: (index: number) => void): void;
|
|
63
99
|
/** The Claude Code accounts on a machine, and the steps a panel listing them
|
|
64
100
|
* takes: adding, signing in, removing after a confirmation the host shows,
|
|
65
101
|
* and choosing one for the `account` setting. */
|
|
66
|
-
export declare function useClaudeAccountPanel(calls: ClaudeAccountCalls, { machine, sessionId, claudeInstalled, claudeAllowed, claudeLogin, claudeAccountRemove, account, onClose, }: {
|
|
102
|
+
export declare function useClaudeAccountPanel(calls: ClaudeAccountCalls, { machine, machineName, sessionId, claudeInstalled, claudeAllowed, claudeLogin, claudeAccountRemove, account, onClose, }: {
|
|
67
103
|
machine: string;
|
|
104
|
+
machineName: string;
|
|
68
105
|
sessionId?: string | undefined;
|
|
69
106
|
claudeInstalled: boolean;
|
|
70
107
|
claudeAllowed: boolean;
|
package/dist/claudeAccounts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { usePwCodeTranslations } from "./messages.js";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { DateTime } from "luxon";
|
|
4
3
|
import { useFormatter } from "use-intl";
|
|
4
|
+
import { DateTime } from "luxon";
|
|
5
5
|
// src/claudeAccounts.ts
|
|
6
6
|
var signInRequiredCode = "agents_claude_sign_in_required";
|
|
7
7
|
/** The refusal of a read that needs the account signed in first. */
|
|
@@ -15,10 +15,96 @@ function claudeAccountName(input) {
|
|
|
15
15
|
if (!/^[a-zA-Z0-9_.@-]{1,64}$/.test(name) || name === "." || name === ".." || name.endsWith(".lock")) return null;
|
|
16
16
|
return name;
|
|
17
17
|
}
|
|
18
|
+
function unavailableNotice(allowed, installed, t) {
|
|
19
|
+
if (!allowed) return t("claude.disabled");
|
|
20
|
+
return installed ? null : t("claude.notInstalled");
|
|
21
|
+
}
|
|
22
|
+
function viewWords(view, host, hint, t) {
|
|
23
|
+
switch (view.kind) {
|
|
24
|
+
case "signIn": return {
|
|
25
|
+
title: t("claude.signInTitle"),
|
|
26
|
+
description: t("claude.profileOnHost", {
|
|
27
|
+
account: view.account,
|
|
28
|
+
host
|
|
29
|
+
}),
|
|
30
|
+
signInNote: null,
|
|
31
|
+
removeBody: null
|
|
32
|
+
};
|
|
33
|
+
case "remove": return {
|
|
34
|
+
title: t("claude.removeAccount"),
|
|
35
|
+
description: t("claude.profileOnHost", {
|
|
36
|
+
account: view.account,
|
|
37
|
+
host
|
|
38
|
+
}),
|
|
39
|
+
signInNote: null,
|
|
40
|
+
removeBody: t("claude.removeBody", {
|
|
41
|
+
account: view.account,
|
|
42
|
+
host
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
case "add": return {
|
|
46
|
+
title: t("claude.addAccount"),
|
|
47
|
+
description: t("claude.hostAccounts", { host }),
|
|
48
|
+
signInNote: null,
|
|
49
|
+
removeBody: null
|
|
50
|
+
};
|
|
51
|
+
default: return {
|
|
52
|
+
title: t("claude.accounts"),
|
|
53
|
+
description: t("claude.hostAccounts", { host }),
|
|
54
|
+
signInNote: hint ?? t("claude.loginStaysOnHost", { host }),
|
|
55
|
+
removeBody: null
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function listControls(view, available, canAdd) {
|
|
60
|
+
const showRefresh = available && view.kind === "list";
|
|
61
|
+
return {
|
|
62
|
+
showAdd: showRefresh && canAdd,
|
|
63
|
+
showRefresh
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function startRows(accounts, selected, claudeLogin) {
|
|
67
|
+
const selectedIndex = accounts.findIndex((a) => a.name === selected);
|
|
68
|
+
const firstEnabledIndex = accounts.findIndex((a) => claudeLogin || !a.signInRequired);
|
|
69
|
+
return {
|
|
70
|
+
startIndex: startIndexOf(selectedIndex, firstEnabledIndex),
|
|
71
|
+
selectedIndex,
|
|
72
|
+
firstEnabledIndex
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function startIndexOf(selectedIndex, firstEnabledIndex) {
|
|
76
|
+
return selectedIndex < 0 ? firstEnabledIndex : selectedIndex;
|
|
77
|
+
}
|
|
78
|
+
/** Moves a host's highlight to the list's start row, then back to it each
|
|
79
|
+
* time the selected or first enabled row changes, such as when the
|
|
80
|
+
* accounts' sign-in states arrive. */
|
|
81
|
+
function useClaudeAccountStartRow(panel, setActive) {
|
|
82
|
+
const { selectedIndex, firstEnabledIndex } = panel;
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
setActive(startIndexOf(selectedIndex, firstEnabledIndex));
|
|
85
|
+
}, [
|
|
86
|
+
selectedIndex,
|
|
87
|
+
firstEnabledIndex,
|
|
88
|
+
setActive
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
function signInHint(claudeLogin, t) {
|
|
92
|
+
return claudeLogin ? null : t("claude.loginOnHost");
|
|
93
|
+
}
|
|
94
|
+
function accountDetail(account, hint) {
|
|
95
|
+
if (account.signInRequired && hint !== null) return {
|
|
96
|
+
kind: "signInHint",
|
|
97
|
+
text: hint
|
|
98
|
+
};
|
|
99
|
+
return account.email ? {
|
|
100
|
+
kind: "email",
|
|
101
|
+
text: account.email
|
|
102
|
+
} : null;
|
|
103
|
+
}
|
|
18
104
|
/** The Claude Code accounts on a machine, and the steps a panel listing them
|
|
19
105
|
* takes: adding, signing in, removing after a confirmation the host shows,
|
|
20
106
|
* and choosing one for the `account` setting. */
|
|
21
|
-
function useClaudeAccountPanel(calls, { machine, sessionId, claudeInstalled, claudeAllowed, claudeLogin = false, claudeAccountRemove = false, account, onClose }) {
|
|
107
|
+
function useClaudeAccountPanel(calls, { machine, machineName, sessionId, claudeInstalled, claudeAllowed, claudeLogin = false, claudeAccountRemove = false, account, onClose }) {
|
|
22
108
|
const t = usePwCodeTranslations("agents");
|
|
23
109
|
const [adding, setAdding] = useState(false);
|
|
24
110
|
const [signIn, setSignIn] = useState(null);
|
|
@@ -96,17 +182,25 @@ function useClaudeAccountPanel(calls, { machine, sessionId, claudeInstalled, cla
|
|
|
96
182
|
kind: "remove",
|
|
97
183
|
account: removing
|
|
98
184
|
} : { kind: "list" };
|
|
185
|
+
const hint = signInHint(claudeLogin, t);
|
|
186
|
+
const canAdd = claudeLogin && !account.disabled;
|
|
99
187
|
return {
|
|
100
188
|
available,
|
|
189
|
+
notice: unavailableNotice(claudeAllowed, claudeInstalled, t),
|
|
101
190
|
view,
|
|
191
|
+
...viewWords(view, machineName, hint, t),
|
|
192
|
+
emptyHint: hint,
|
|
102
193
|
accounts: catalog.accounts,
|
|
103
194
|
loading: catalog.loading,
|
|
104
195
|
loadedUsage: catalog.loadedUsage,
|
|
105
196
|
error: catalog.error || refreshError,
|
|
106
197
|
empty: !catalog.loading && !catalog.error && catalog.accounts.length === 0,
|
|
107
198
|
refreshing: catalog.refreshing || refreshingModels,
|
|
108
|
-
canAdd
|
|
199
|
+
canAdd,
|
|
200
|
+
...listControls(view, available, canAdd),
|
|
201
|
+
...startRows(catalog.accounts, account.value, claudeLogin),
|
|
109
202
|
isDisabled: (a) => !!account.disabled || !!a.signInRequired && !claudeLogin,
|
|
203
|
+
detail: (a) => accountDetail(a, hint),
|
|
110
204
|
choose: (a) => {
|
|
111
205
|
if (a.signInRequired && claudeLogin) {
|
|
112
206
|
setSignIn(a.name);
|
|
@@ -231,4 +325,4 @@ function useClaudeAccountUsage(account, loaded) {
|
|
|
231
325
|
}]
|
|
232
326
|
};
|
|
233
327
|
}
|
|
234
|
-
export { claudeAccountName, claudeSignInRequired, useClaudeAccountName, useClaudeAccountPanel, useClaudeAccountRemoval, useClaudeAccountUsage };
|
|
328
|
+
export { claudeAccountName, claudeSignInRequired, useClaudeAccountName, useClaudeAccountPanel, useClaudeAccountRemoval, useClaudeAccountStartRow, useClaudeAccountUsage };
|
package/dist/claudeApi.js
CHANGED
|
@@ -59,7 +59,7 @@ function claudeLoginFinished(status) {
|
|
|
59
59
|
return status !== "running" && status !== "checking";
|
|
60
60
|
}
|
|
61
61
|
/** Aborts after `ms`, or with `signal`. Built by hand where AbortSignal has no
|
|
62
|
-
* `timeout` or `any`, as React Native's
|
|
62
|
+
* `timeout` or `any`, as React Native's before 0.87 had neither. */
|
|
63
63
|
function deadline(ms, signal) {
|
|
64
64
|
if (typeof AbortSignal.timeout === "function" && (!signal || typeof AbortSignal.any === "function")) {
|
|
65
65
|
const timeout = AbortSignal.timeout(ms);
|
package/dist/claudeSignIn.d.ts
CHANGED
|
@@ -30,12 +30,23 @@ export interface ClaudeSignInState {
|
|
|
30
30
|
inputTooLong: boolean;
|
|
31
31
|
/** The sign-in page's address, as Claude Code last printed it. */
|
|
32
32
|
link: string | null;
|
|
33
|
+
/** The address to offer opening the sign-in page at: `link`, while the
|
|
34
|
+
* sign-in runs. */
|
|
35
|
+
signInPage: string | null;
|
|
36
|
+
/** What to do, until the sign-in completes. */
|
|
37
|
+
instructions: string | null;
|
|
38
|
+
/** That earlier output was dropped, until the sign-in completes. */
|
|
39
|
+
truncatedNote: string | null;
|
|
40
|
+
/** Leaving the view: back once the sign-in finished, cancelling it before. */
|
|
41
|
+
closeLabel: string;
|
|
33
42
|
/** The last 8192 characters of output since the screen was last cleared. */
|
|
34
43
|
output: string;
|
|
35
44
|
acceptsInput: boolean;
|
|
36
45
|
starting: boolean;
|
|
37
46
|
signedIn: boolean;
|
|
38
47
|
finished: boolean;
|
|
48
|
+
/** `onUse`, offered only once the account is signed in. */
|
|
49
|
+
use: (() => void) | undefined;
|
|
39
50
|
/** Following broke while the sign-in still runs. */
|
|
40
51
|
canReconnect: boolean;
|
|
41
52
|
/** The sign-in never started or ended without signing in. */
|
|
@@ -50,13 +61,20 @@ export interface ClaudeSignInState {
|
|
|
50
61
|
reconnect: () => void;
|
|
51
62
|
retry: () => void;
|
|
52
63
|
}
|
|
64
|
+
/** Whether a link in the sign-in's output may be opened: web addresses only,
|
|
65
|
+
* never a script or a local file. */
|
|
66
|
+
export declare function canOpenSignInLink(uri: string): boolean;
|
|
53
67
|
/** Runs Claude Code's sign-in for `account` on a machine: starts it at the
|
|
54
68
|
* terminal's size, follows its output into the terminal, sends what is typed,
|
|
55
69
|
* and cancels it when the host leaves before it finishes. */
|
|
56
|
-
export declare function useClaudeSignIn(calls: ClaudeSignInCalls, { machine, sessionId, account, terminal, onSignedIn, }: {
|
|
70
|
+
export declare function useClaudeSignIn(calls: ClaudeSignInCalls, { machine, machineName, sessionId, account, terminal, onSignedIn, onUse, }: {
|
|
57
71
|
machine: string;
|
|
72
|
+
machineName: string;
|
|
58
73
|
sessionId: string | undefined;
|
|
59
74
|
account: string;
|
|
60
75
|
terminal: ClaudeSignInTerminal;
|
|
61
76
|
onSignedIn?: (() => void) | undefined;
|
|
77
|
+
/** Makes the account the one in use, such as `useClaudeAccountPanel`'s
|
|
78
|
+
* `selectSignedIn`; unset where it can't be. */
|
|
79
|
+
onUse?: (() => void) | undefined;
|
|
62
80
|
}): ClaudeSignInState;
|