@promptbook/cli 0.112.0-132 → 0.112.0-133
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/apps/agents-server/src/app/admin/api-tokens/ApiTokensClient.tsx +4 -1
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +3 -0
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackTable.tsx +13 -8
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +3 -0
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryTable.tsx +13 -8
- package/apps/agents-server/src/app/admin/custom-css/CustomCssClient.tsx +4 -0
- package/apps/agents-server/src/app/admin/custom-css/CustomCssEditorPanel.tsx +7 -1
- package/apps/agents-server/src/app/admin/custom-css/CustomCssFilesPanel.tsx +7 -1
- package/apps/agents-server/src/app/admin/custom-js/CustomJsClient.tsx +4 -0
- package/apps/agents-server/src/app/admin/custom-js/CustomJsEditorPanel.tsx +7 -1
- package/apps/agents-server/src/app/admin/custom-js/CustomJsFilesPanel.tsx +7 -1
- package/apps/agents-server/src/app/admin/files/FilesGalleryClient.tsx +4 -0
- package/apps/agents-server/src/app/admin/files/FilesGalleryGrid.tsx +9 -11
- package/apps/agents-server/src/app/admin/files/FilesGalleryTable.tsx +9 -8
- package/apps/agents-server/src/app/admin/images/ImagesGalleryClient.tsx +4 -0
- package/apps/agents-server/src/app/admin/images/ImagesGalleryGrid.tsx +16 -11
- package/apps/agents-server/src/app/admin/images/ImagesGalleryTable.tsx +18 -9
- package/apps/agents-server/src/app/admin/login-methods/shibboleth/page.tsx +9 -9
- package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +7 -6
- package/apps/agents-server/src/app/admin/servers/ServersRegistryTable.tsx +11 -10
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +4 -2
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +14 -15
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTasksCard.tsx +4 -1
- package/apps/agents-server/src/app/admin/task-manager/useTaskManagerState.ts +6 -9
- package/apps/agents-server/src/app/admin/update/CustomCommitPicker.tsx +258 -0
- package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +305 -108
- package/apps/agents-server/src/app/admin/usage/UsageClient.tsx +4 -2
- package/apps/agents-server/src/app/admin/usage/UsageClientAnalyticsPanels.tsx +6 -4
- package/apps/agents-server/src/app/admin/usage/UsageClientFormatting.ts +6 -12
- package/apps/agents-server/src/app/admin/usage/UsageClientTimelineChart.tsx +6 -3
- package/apps/agents-server/src/app/admin/usage/useUsageClientState.ts +12 -4
- package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +8 -3
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +6 -20
- package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorHistory.ts +9 -2
- package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatHistoryClientState.ts +2 -15
- package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +6 -1
- package/apps/agents-server/src/app/agents/[agentName]/integration/CalendarIntegrationSection.tsx +23 -5
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsClient.tsx +4 -2
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsFiltersCard.tsx +9 -4
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableCard.tsx +4 -1
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableRow.tsx +10 -3
- package/apps/agents-server/src/app/api/admin/update/commits/route.ts +35 -0
- package/apps/agents-server/src/app/api/admin/update/route.ts +10 -2
- package/apps/agents-server/src/app/api/internal/user-chat-jobs/run/route.ts +14 -2
- package/apps/agents-server/src/app/dashboard/page.tsx +11 -16
- package/apps/agents-server/src/app/swagger/SwaggerApiKeysPanel.tsx +4 -1
- package/apps/agents-server/src/app/system/user-memory/UserMemoryClient.tsx +4 -2
- package/apps/agents-server/src/app/system/user-wallet/UserWalletClient.tsx +3 -0
- package/apps/agents-server/src/app/system/user-wallet/UserWalletRecordsTable.tsx +5 -1
- package/apps/agents-server/src/app/system/utilities/mocked-chats/MockedChatsEditorClient.tsx +3 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/MockedChatsEditorSidebar.tsx +7 -8
- package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +4 -2
- package/apps/agents-server/src/components/UsersList/UsersList.tsx +4 -2
- package/apps/agents-server/src/tools/createAgentProgressTools.ts +8 -6
- package/apps/agents-server/src/utils/localization/formatServerLanguageHumanReadableDate.ts +70 -0
- package/apps/agents-server/src/utils/localization/getRequestServerLanguage.ts +32 -0
- package/apps/agents-server/src/utils/userChat/createRunUserChatJobExecutionContext.ts +17 -0
- package/apps/agents-server/src/utils/userChat/createRunUserChatJobPersistenceController.ts +0 -21
- package/apps/agents-server/src/utils/userChat/persistUserChatJobProgressCard.ts +31 -0
- package/apps/agents-server/src/utils/userChat/retryUserChatJob.ts +0 -4
- package/apps/agents-server/src/utils/userChat/runUserChatJob.ts +29 -0
- package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +2 -2
- package/apps/agents-server/src/utils/userChat/userChatProgressCard.ts +99 -401
- package/apps/agents-server/src/utils/vpsSelfUpdate.ts +625 -51
- package/esm/index.es.js +252 -41
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +5 -1
- package/esm/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/common/coderRunEstimateCache.d.ts +31 -0
- package/esm/scripts/run-codex-prompts/common/progressFormatting.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +7 -0
- package/esm/src/book-3.0/cliAgentEnv.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/book-3.0/cliAgentEnv.ts +1 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer.ts +1 -1
- package/src/cli/cli-commands/coder/ThinkingLevel.ts +3 -1
- package/src/other/templates/getTemplatesPipelineCollection.ts +711 -791
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +254 -44
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +5 -1
- package/umd/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/common/coderRunEstimateCache.d.ts +31 -0
- package/umd/scripts/run-codex-prompts/common/progressFormatting.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +7 -0
- package/umd/src/book-3.0/cliAgentEnv.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Loader2, RefreshCcw, Search, Tag } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import type { ServerLanguageCode } from '../../../languages/ServerLanguageRegistry';
|
|
6
|
+
import { formatServerLanguageHumanReadableDate } from '../../../utils/localization/formatServerLanguageHumanReadableDate';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* One commit candidate returned from the custom-target picker API.
|
|
10
|
+
*/
|
|
11
|
+
export type CustomCommitPickerCandidate = {
|
|
12
|
+
readonly commitSha: string;
|
|
13
|
+
readonly shortCommitSha: string;
|
|
14
|
+
readonly subject: string;
|
|
15
|
+
readonly authorName: string;
|
|
16
|
+
readonly authorEmail: string;
|
|
17
|
+
readonly authoredAt: string;
|
|
18
|
+
readonly branches: ReadonlyArray<string>;
|
|
19
|
+
readonly tags: ReadonlyArray<string>;
|
|
20
|
+
readonly isReleaseTag: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Props for the standalone-VPS self-update custom commit picker.
|
|
25
|
+
*
|
|
26
|
+
* @private internal component of `<UpdateClient/>`
|
|
27
|
+
*/
|
|
28
|
+
type CustomCommitPickerProps = {
|
|
29
|
+
readonly language: ServerLanguageCode;
|
|
30
|
+
readonly selectedRef: string;
|
|
31
|
+
readonly onSelectRef: (nextRef: string, matchedCandidate: CustomCommitPickerCandidate | null) => void;
|
|
32
|
+
readonly isDisabled: boolean;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Debounce delay (ms) applied between filter input and the candidate list refresh.
|
|
37
|
+
*/
|
|
38
|
+
const SEARCH_DEBOUNCE_MILLISECONDS = 300;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Maximum number of commits the picker requests from the server at once.
|
|
42
|
+
*/
|
|
43
|
+
const COMMIT_PICKER_LIMIT = 200;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Lets the super admin pick an arbitrary commit, tag, or branch for the standalone VPS self-update.
|
|
47
|
+
*
|
|
48
|
+
* @private internal component of `<UpdateClient/>`
|
|
49
|
+
*/
|
|
50
|
+
export function CustomCommitPicker({ language, selectedRef, onSelectRef, isDisabled }: CustomCommitPickerProps) {
|
|
51
|
+
const [searchText, setSearchText] = useState<string>('');
|
|
52
|
+
const [authoredAfter, setAuthoredAfter] = useState<string>('');
|
|
53
|
+
const [authoredBefore, setAuthoredBefore] = useState<string>('');
|
|
54
|
+
const [candidates, setCandidates] = useState<ReadonlyArray<CustomCommitPickerCandidate>>([]);
|
|
55
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
56
|
+
const [loadErrorMessage, setLoadErrorMessage] = useState<string | null>(null);
|
|
57
|
+
const debounceTimeoutRef = useRef<number | null>(null);
|
|
58
|
+
|
|
59
|
+
const loadCandidates = useCallback(async (): Promise<void> => {
|
|
60
|
+
try {
|
|
61
|
+
setIsLoading(true);
|
|
62
|
+
setLoadErrorMessage(null);
|
|
63
|
+
|
|
64
|
+
const searchParams = new URLSearchParams();
|
|
65
|
+
if (searchText.trim()) {
|
|
66
|
+
searchParams.set('search', searchText.trim());
|
|
67
|
+
}
|
|
68
|
+
if (authoredAfter) {
|
|
69
|
+
searchParams.set('after', authoredAfter);
|
|
70
|
+
}
|
|
71
|
+
if (authoredBefore) {
|
|
72
|
+
searchParams.set('before', authoredBefore);
|
|
73
|
+
}
|
|
74
|
+
searchParams.set('limit', String(COMMIT_PICKER_LIMIT));
|
|
75
|
+
|
|
76
|
+
const response = await fetch(`/api/admin/update/commits?${searchParams.toString()}`, {
|
|
77
|
+
cache: 'no-store',
|
|
78
|
+
});
|
|
79
|
+
const payload = (await response.json()) as {
|
|
80
|
+
readonly commits?: ReadonlyArray<CustomCommitPickerCandidate>;
|
|
81
|
+
readonly error?: string;
|
|
82
|
+
};
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
throw new Error(payload.error || 'Failed to load candidate commits.');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setCandidates(payload.commits ?? []);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
setLoadErrorMessage(error instanceof Error ? error.message : 'Failed to load candidate commits.');
|
|
90
|
+
setCandidates([]);
|
|
91
|
+
} finally {
|
|
92
|
+
setIsLoading(false);
|
|
93
|
+
}
|
|
94
|
+
}, [authoredAfter, authoredBefore, searchText]);
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (debounceTimeoutRef.current !== null) {
|
|
98
|
+
window.clearTimeout(debounceTimeoutRef.current);
|
|
99
|
+
}
|
|
100
|
+
debounceTimeoutRef.current = window.setTimeout(() => {
|
|
101
|
+
void loadCandidates();
|
|
102
|
+
}, SEARCH_DEBOUNCE_MILLISECONDS);
|
|
103
|
+
|
|
104
|
+
return () => {
|
|
105
|
+
if (debounceTimeoutRef.current !== null) {
|
|
106
|
+
window.clearTimeout(debounceTimeoutRef.current);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}, [loadCandidates]);
|
|
110
|
+
|
|
111
|
+
const normalizedSelectedRef = selectedRef.trim().toLowerCase();
|
|
112
|
+
const matchingCandidate = useMemo(
|
|
113
|
+
() =>
|
|
114
|
+
candidates.find(
|
|
115
|
+
(candidate) =>
|
|
116
|
+
candidate.commitSha.toLowerCase().startsWith(normalizedSelectedRef) ||
|
|
117
|
+
candidate.tags.some((tag) => tag.toLowerCase() === normalizedSelectedRef) ||
|
|
118
|
+
candidate.branches.some((branch) => branch.toLowerCase() === normalizedSelectedRef),
|
|
119
|
+
) ?? null,
|
|
120
|
+
[candidates, normalizedSelectedRef],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div className="space-y-3">
|
|
125
|
+
<div className="grid gap-3 sm:grid-cols-[1fr_auto_auto]">
|
|
126
|
+
<label className="relative block">
|
|
127
|
+
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400" />
|
|
128
|
+
<input
|
|
129
|
+
type="search"
|
|
130
|
+
value={searchText}
|
|
131
|
+
onChange={(event) => setSearchText(event.target.value)}
|
|
132
|
+
disabled={isDisabled}
|
|
133
|
+
placeholder="Search by hash, message, author, branch, tag..."
|
|
134
|
+
className="w-full rounded-md border border-slate-300 bg-white py-2 pl-9 pr-3 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60"
|
|
135
|
+
/>
|
|
136
|
+
</label>
|
|
137
|
+
<input
|
|
138
|
+
type="date"
|
|
139
|
+
value={authoredAfter}
|
|
140
|
+
onChange={(event) => setAuthoredAfter(event.target.value)}
|
|
141
|
+
disabled={isDisabled}
|
|
142
|
+
className="rounded-md border border-slate-300 bg-white px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-60"
|
|
143
|
+
title="Authored after"
|
|
144
|
+
/>
|
|
145
|
+
<input
|
|
146
|
+
type="date"
|
|
147
|
+
value={authoredBefore}
|
|
148
|
+
onChange={(event) => setAuthoredBefore(event.target.value)}
|
|
149
|
+
disabled={isDisabled}
|
|
150
|
+
className="rounded-md border border-slate-300 bg-white px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-60"
|
|
151
|
+
title="Authored before"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div className="flex items-center justify-between gap-3">
|
|
156
|
+
<label className="flex-1 text-xs text-slate-500">
|
|
157
|
+
<span className="block font-semibold uppercase tracking-wide">Or paste a ref directly</span>
|
|
158
|
+
<input
|
|
159
|
+
type="text"
|
|
160
|
+
value={selectedRef}
|
|
161
|
+
onChange={(event) => onSelectRef(event.target.value, null)}
|
|
162
|
+
disabled={isDisabled}
|
|
163
|
+
placeholder="commit hash, tag name, or branch name"
|
|
164
|
+
className="mt-1 w-full rounded-md border border-slate-300 bg-white px-3 py-2 font-mono text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60"
|
|
165
|
+
/>
|
|
166
|
+
</label>
|
|
167
|
+
<button
|
|
168
|
+
type="button"
|
|
169
|
+
onClick={() => void loadCandidates()}
|
|
170
|
+
disabled={isDisabled || isLoading}
|
|
171
|
+
className="self-end inline-flex items-center gap-2 rounded-md border border-slate-300 bg-white px-3 py-2 text-xs font-semibold text-slate-700 hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60"
|
|
172
|
+
>
|
|
173
|
+
<RefreshCcw className={`h-3.5 w-3.5 ${isLoading ? 'animate-spin' : ''}`} />
|
|
174
|
+
Refresh
|
|
175
|
+
</button>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
{loadErrorMessage && (
|
|
179
|
+
<div className="rounded-md border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700">
|
|
180
|
+
{loadErrorMessage}
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
|
|
184
|
+
<div className="max-h-96 overflow-y-auto rounded-xl border border-slate-200 bg-white">
|
|
185
|
+
{isLoading && candidates.length === 0 ? (
|
|
186
|
+
<div className="flex items-center justify-center gap-2 px-4 py-6 text-sm text-slate-500">
|
|
187
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
188
|
+
Loading candidate commits...
|
|
189
|
+
</div>
|
|
190
|
+
) : candidates.length === 0 ? (
|
|
191
|
+
<div className="px-4 py-6 text-center text-sm text-slate-500">
|
|
192
|
+
No commits match the current filter.
|
|
193
|
+
</div>
|
|
194
|
+
) : (
|
|
195
|
+
<ul className="divide-y divide-slate-100">
|
|
196
|
+
{candidates.map((candidate) => {
|
|
197
|
+
const isSelected = candidate === matchingCandidate;
|
|
198
|
+
const authoredAtLabel = formatServerLanguageHumanReadableDate(
|
|
199
|
+
candidate.authoredAt,
|
|
200
|
+
language,
|
|
201
|
+
{
|
|
202
|
+
isExactDateIncluded: true,
|
|
203
|
+
},
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<li key={candidate.commitSha}>
|
|
208
|
+
<button
|
|
209
|
+
type="button"
|
|
210
|
+
onClick={() => onSelectRef(candidate.commitSha, candidate)}
|
|
211
|
+
disabled={isDisabled}
|
|
212
|
+
className={`w-full px-4 py-3 text-left transition ${
|
|
213
|
+
isSelected
|
|
214
|
+
? 'bg-blue-50 ring-1 ring-inset ring-blue-300'
|
|
215
|
+
: 'hover:bg-slate-50'
|
|
216
|
+
} disabled:cursor-not-allowed disabled:opacity-60`}
|
|
217
|
+
>
|
|
218
|
+
<div className="flex items-center gap-2">
|
|
219
|
+
<span className="font-mono text-xs text-slate-500">
|
|
220
|
+
{candidate.shortCommitSha}
|
|
221
|
+
</span>
|
|
222
|
+
{candidate.isReleaseTag && (
|
|
223
|
+
<span className="inline-flex items-center gap-1 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700">
|
|
224
|
+
<Tag className="h-3 w-3" />
|
|
225
|
+
Release
|
|
226
|
+
</span>
|
|
227
|
+
)}
|
|
228
|
+
{candidate.tags.map((tag) => (
|
|
229
|
+
<span
|
|
230
|
+
key={`tag-${tag}`}
|
|
231
|
+
className="inline-flex rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[10px] font-mono text-amber-800"
|
|
232
|
+
>
|
|
233
|
+
{tag}
|
|
234
|
+
</span>
|
|
235
|
+
))}
|
|
236
|
+
{candidate.branches.map((branch) => (
|
|
237
|
+
<span
|
|
238
|
+
key={`branch-${branch}`}
|
|
239
|
+
className="inline-flex rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-[10px] font-mono text-sky-800"
|
|
240
|
+
>
|
|
241
|
+
{branch}
|
|
242
|
+
</span>
|
|
243
|
+
))}
|
|
244
|
+
</div>
|
|
245
|
+
<div className="mt-1 truncate text-sm text-slate-900">{candidate.subject}</div>
|
|
246
|
+
<div className="mt-0.5 text-xs text-slate-500">
|
|
247
|
+
{candidate.authorName} - {authoredAtLabel}
|
|
248
|
+
</div>
|
|
249
|
+
</button>
|
|
250
|
+
</li>
|
|
251
|
+
);
|
|
252
|
+
})}
|
|
253
|
+
</ul>
|
|
254
|
+
)}
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
);
|
|
258
|
+
}
|