@promptbook/cli 0.113.0-10 → 0.113.0-11
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/{code-runners/CodeRunnersClient.tsx → harness-auth/HarnessAuthClient.tsx} +98 -65
- package/apps/agents-server/src/app/admin/{code-runners → harness-auth}/page.tsx +4 -4
- package/apps/agents-server/src/app/api/admin/{code-runners → harness-auth}/authentication/route.ts +17 -17
- package/apps/agents-server/src/app/api/admin/{code-runners → harness-auth}/route.ts +13 -13
- package/apps/agents-server/src/app/layout.tsx +16 -0
- package/apps/agents-server/src/components/AdminTerminal/AdminTerminalCard.tsx +32 -24
- package/apps/agents-server/src/components/Footer/Footer.tsx +38 -15
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +5 -4
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +4 -1
- package/apps/agents-server/src/constants/harnessAuthRoutes.ts +20 -0
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +1 -1
- package/apps/agents-server/src/languages/translations/czech.yaml +2 -2
- package/apps/agents-server/src/languages/translations/english.yaml +1 -1
- package/apps/agents-server/src/utils/{codeRunnerAuthentication.ts → harnessAuthentication.ts} +72 -56
- package/apps/agents-server/src/utils/{codeRunnerConfiguration.ts → harnessConfiguration.ts} +18 -12
- package/apps/agents-server/src/utils/taskTerminal/resolveAdminTaskTerminalSession.ts +28 -5
- package/apps/agents-server/src/utils/vpsConfiguration.ts +3 -3
- package/apps/agents-server/src/utils/vpsSelfUpdate/readAgentsServerFooterVersion.ts +335 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobHistory.ts +107 -4
- package/esm/index.es.js +697 -591
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +3 -16
- package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +94 -0
- package/esm/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/other/templates/getTemplatesPipelineCollection.ts +790 -807
- package/src/utils/agents/terminalAgentAvatarVisual.ts +261 -0
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +697 -591
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +3 -16
- package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +94 -0
- package/umd/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAvatarDefinitionFromAgentBasicInformation,
|
|
3
|
+
DEFAULT_AVATAR_SIZE,
|
|
4
|
+
} from '../../avatars/avatarRenderingUtils';
|
|
5
|
+
import { resolveAvatarRenderDefinition, type ResolvedAvatarRenderDefinition } from '../../avatars/renderAvatarVisual';
|
|
6
|
+
import {
|
|
7
|
+
renderAvatarVisualAsciiArt,
|
|
8
|
+
type CreateCanvasForAsciiArt,
|
|
9
|
+
} from '../../avatars/renderAvatarVisualAsciiArt';
|
|
10
|
+
import type { AvatarDefinition } from '../../avatars/types/AvatarDefinition';
|
|
11
|
+
import type { AvatarVisualId } from '../../avatars/types/AvatarVisualDefinition';
|
|
12
|
+
import { resolveAvatarVisualId } from '../../avatars/visuals/avatarVisualRegistry';
|
|
13
|
+
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
14
|
+
import { parseAgentSource } from '../../book-2.0/agent-source/parseAgentSource';
|
|
15
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
16
|
+
import type { AsciiArtColorDepth } from '../ascii-art/convertImageDataToAsciiArt';
|
|
17
|
+
import { DEFAULT_AGENT_AVATAR_VISUAL_ID, resolveAgentAvatarVisualId } from './resolveAgentAvatarImageUrl';
|
|
18
|
+
|
|
19
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Output width of the terminal agent avatar visual in character cells.
|
|
23
|
+
*
|
|
24
|
+
* @private shared helper for terminal avatar rendering
|
|
25
|
+
*/
|
|
26
|
+
export const TERMINAL_AGENT_AVATAR_VISUAL_COLUMNS = 48;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Output height of the terminal agent avatar visual in character cells.
|
|
30
|
+
*
|
|
31
|
+
* @private shared helper for terminal avatar rendering
|
|
32
|
+
*/
|
|
33
|
+
export const TERMINAL_AGENT_AVATAR_VISUAL_ROWS = 12;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Refresh cadence used while a terminal agent avatar visual is animated.
|
|
37
|
+
*
|
|
38
|
+
* @private shared helper for terminal avatar rendering
|
|
39
|
+
*/
|
|
40
|
+
export const TERMINAL_AGENT_AVATAR_VISUAL_REFRESH_INTERVAL_MS = 300;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Aspect ratio of the source canvas used for the terminal avatar variant.
|
|
44
|
+
*
|
|
45
|
+
* @private shared helper for terminal avatar rendering
|
|
46
|
+
*/
|
|
47
|
+
const TERMINAL_AGENT_AVATAR_VISUAL_CANVAS_ASPECT_RATIO = 2;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Source canvas width used before the avatar is converted to ASCII art.
|
|
51
|
+
*
|
|
52
|
+
* @private shared helper for terminal avatar rendering
|
|
53
|
+
*/
|
|
54
|
+
const TERMINAL_AGENT_AVATAR_VISUAL_CANVAS_WIDTH =
|
|
55
|
+
DEFAULT_AVATAR_SIZE * TERMINAL_AGENT_AVATAR_VISUAL_CANVAS_ASPECT_RATIO;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Source canvas height used before the avatar is converted to ASCII art.
|
|
59
|
+
*
|
|
60
|
+
* @private shared helper for terminal avatar rendering
|
|
61
|
+
*/
|
|
62
|
+
const TERMINAL_AGENT_AVATAR_VISUAL_CANVAS_HEIGHT = DEFAULT_AVATAR_SIZE;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Options passed when rendering one animated terminal avatar frame.
|
|
66
|
+
*
|
|
67
|
+
* @private shared helper for terminal avatar rendering
|
|
68
|
+
*/
|
|
69
|
+
export type TerminalAgentAvatarVisualFrameOptions = {
|
|
70
|
+
/**
|
|
71
|
+
* Current animation time forwarded to the shared avatar renderer.
|
|
72
|
+
*/
|
|
73
|
+
readonly animationTimeMs: number;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Runtime renderer for an agent avatar visual shown in a terminal.
|
|
78
|
+
*
|
|
79
|
+
* @private shared helper for terminal avatar rendering
|
|
80
|
+
*/
|
|
81
|
+
export type TerminalAgentAvatarVisual = {
|
|
82
|
+
/**
|
|
83
|
+
* Whether the selected built-in visual changes over time.
|
|
84
|
+
*/
|
|
85
|
+
readonly isAnimated: boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Renders one ANSI ASCII-art frame for the current terminal timestamp.
|
|
89
|
+
*/
|
|
90
|
+
readonly renderFrame: (options: TerminalAgentAvatarVisualFrameOptions) => ReadonlyArray<string>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Options for creating a terminal avatar visual renderer from an agent book source.
|
|
95
|
+
*
|
|
96
|
+
* @private shared helper for terminal avatar rendering
|
|
97
|
+
*/
|
|
98
|
+
export type CreateTerminalAgentAvatarVisualOptions = {
|
|
99
|
+
/**
|
|
100
|
+
* Source of the agent book whose metadata controls avatar identity.
|
|
101
|
+
*/
|
|
102
|
+
readonly agentSource: string_book;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Built-in avatar visual used when the agent does not declare `META AVATAR` or `META VISUAL`.
|
|
106
|
+
*/
|
|
107
|
+
readonly defaultAvatarVisualId?: AvatarVisualId;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Color depth of the emitted ANSI escape codes.
|
|
111
|
+
*/
|
|
112
|
+
readonly colorDepth?: AsciiArtColorDepth;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Platform-specific canvas factory used to rasterize the visual.
|
|
116
|
+
*/
|
|
117
|
+
readonly createCanvas: CreateCanvasForAsciiArt;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Stable render inputs derived from an agent source for terminal avatar frames.
|
|
122
|
+
*
|
|
123
|
+
* @private shared helper for terminal avatar rendering
|
|
124
|
+
*/
|
|
125
|
+
type TerminalAgentAvatarVisualRenderInputs = {
|
|
126
|
+
/**
|
|
127
|
+
* Stable identity payload used by the shared avatar renderer.
|
|
128
|
+
*/
|
|
129
|
+
readonly avatarDefinition: AvatarDefinition;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Built-in avatar visual selected for terminal rendering.
|
|
133
|
+
*/
|
|
134
|
+
readonly avatarVisualId: AvatarVisualId;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Resolved render data reused across animation frames.
|
|
138
|
+
*/
|
|
139
|
+
readonly resolvedAvatarRenderDefinition: ResolvedAvatarRenderDefinition;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Resolves the built-in avatar visual selected for terminal rendering of one agent source.
|
|
144
|
+
*
|
|
145
|
+
* @param agentSource Source of the agent book.
|
|
146
|
+
* @param defaultAvatarVisualId Built-in fallback used when the source does not declare an avatar visual.
|
|
147
|
+
* @returns Supported built-in avatar visual id.
|
|
148
|
+
*
|
|
149
|
+
* @private shared helper for terminal avatar rendering
|
|
150
|
+
*/
|
|
151
|
+
export function resolveTerminalAgentAvatarVisualId(
|
|
152
|
+
agentSource: string_book,
|
|
153
|
+
defaultAvatarVisualId: AvatarVisualId = DEFAULT_AGENT_AVATAR_VISUAL_ID,
|
|
154
|
+
): AvatarVisualId {
|
|
155
|
+
const agentBasicInformation = parseAgentSource(agentSource);
|
|
156
|
+
|
|
157
|
+
return resolveTerminalAgentAvatarVisualIdFromAgentBasicInformation(agentBasicInformation, defaultAvatarVisualId);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Creates an ANSI ASCII-art avatar renderer for terminal UIs.
|
|
162
|
+
*
|
|
163
|
+
* The agent's avatar visual is resolved the same way as on the website: `META AVATAR`
|
|
164
|
+
* / `META VISUAL` wins, then the provided fallback visual, then the shared default visual.
|
|
165
|
+
* The terminal variant uses a transparent horizontal canvas instead of the website's framed square surface.
|
|
166
|
+
*
|
|
167
|
+
* @param options Agent source, canvas factory, and optional terminal color settings.
|
|
168
|
+
* @returns Runtime terminal avatar visual renderer.
|
|
169
|
+
*
|
|
170
|
+
* @private shared helper for terminal avatar rendering
|
|
171
|
+
*/
|
|
172
|
+
export function createTerminalAgentAvatarVisual(
|
|
173
|
+
options: CreateTerminalAgentAvatarVisualOptions,
|
|
174
|
+
): TerminalAgentAvatarVisual {
|
|
175
|
+
const renderInputs = createTerminalAgentAvatarVisualRenderInputs(
|
|
176
|
+
options.agentSource,
|
|
177
|
+
options.defaultAvatarVisualId || DEFAULT_AGENT_AVATAR_VISUAL_ID,
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
isAnimated: renderInputs.resolvedAvatarRenderDefinition.avatarVisual.isAnimated,
|
|
182
|
+
renderFrame({ animationTimeMs }) {
|
|
183
|
+
return renderTerminalAgentAvatarVisualFrame({
|
|
184
|
+
...renderInputs,
|
|
185
|
+
animationTimeMs,
|
|
186
|
+
colorDepth: options.colorDepth,
|
|
187
|
+
createCanvas: options.createCanvas,
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Creates stable avatar render inputs from one agent source.
|
|
195
|
+
*
|
|
196
|
+
* @private shared helper for terminal avatar rendering
|
|
197
|
+
*/
|
|
198
|
+
function createTerminalAgentAvatarVisualRenderInputs(
|
|
199
|
+
agentSource: string_book,
|
|
200
|
+
defaultAvatarVisualId: AvatarVisualId,
|
|
201
|
+
): TerminalAgentAvatarVisualRenderInputs {
|
|
202
|
+
const agentBasicInformation = parseAgentSource(agentSource);
|
|
203
|
+
const avatarDefinition = createAvatarDefinitionFromAgentBasicInformation(agentBasicInformation);
|
|
204
|
+
const avatarVisualId = resolveTerminalAgentAvatarVisualIdFromAgentBasicInformation(
|
|
205
|
+
agentBasicInformation,
|
|
206
|
+
defaultAvatarVisualId,
|
|
207
|
+
);
|
|
208
|
+
const resolvedAvatarRenderDefinition = resolveAvatarRenderDefinition({
|
|
209
|
+
avatarDefinition,
|
|
210
|
+
visualId: avatarVisualId,
|
|
211
|
+
surface: 'transparent',
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
avatarDefinition,
|
|
216
|
+
avatarVisualId,
|
|
217
|
+
resolvedAvatarRenderDefinition,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Resolves the terminal avatar visual id from already parsed agent information.
|
|
223
|
+
*
|
|
224
|
+
* @private shared helper for terminal avatar rendering
|
|
225
|
+
*/
|
|
226
|
+
function resolveTerminalAgentAvatarVisualIdFromAgentBasicInformation(
|
|
227
|
+
agentBasicInformation: AgentBasicInformation,
|
|
228
|
+
defaultAvatarVisualId: AvatarVisualId,
|
|
229
|
+
): AvatarVisualId {
|
|
230
|
+
return resolveAgentAvatarVisualId(
|
|
231
|
+
agentBasicInformation,
|
|
232
|
+
resolveAvatarVisualId(agentBasicInformation.meta.visual) || defaultAvatarVisualId,
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Renders one terminal avatar frame through the shared avatar-to-ASCII pipeline.
|
|
238
|
+
*
|
|
239
|
+
* @private shared helper for terminal avatar rendering
|
|
240
|
+
*/
|
|
241
|
+
function renderTerminalAgentAvatarVisualFrame(
|
|
242
|
+
options: TerminalAgentAvatarVisualRenderInputs & {
|
|
243
|
+
readonly animationTimeMs: number;
|
|
244
|
+
readonly colorDepth?: AsciiArtColorDepth;
|
|
245
|
+
readonly createCanvas: CreateCanvasForAsciiArt;
|
|
246
|
+
},
|
|
247
|
+
): ReadonlyArray<string> {
|
|
248
|
+
return renderAvatarVisualAsciiArt({
|
|
249
|
+
avatarDefinition: options.avatarDefinition,
|
|
250
|
+
visualId: options.avatarVisualId,
|
|
251
|
+
surface: 'transparent',
|
|
252
|
+
columns: TERMINAL_AGENT_AVATAR_VISUAL_COLUMNS,
|
|
253
|
+
rows: TERMINAL_AGENT_AVATAR_VISUAL_ROWS,
|
|
254
|
+
canvasWidth: TERMINAL_AGENT_AVATAR_VISUAL_CANVAS_WIDTH,
|
|
255
|
+
canvasHeight: TERMINAL_AGENT_AVATAR_VISUAL_CANVAS_HEIGHT,
|
|
256
|
+
colorDepth: options.colorDepth,
|
|
257
|
+
timeMs: options.animationTimeMs,
|
|
258
|
+
createCanvas: options.createCanvas,
|
|
259
|
+
resolvedAvatarRenderDefinition: options.resolvedAvatarRenderDefinition,
|
|
260
|
+
});
|
|
261
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -16,11 +16,11 @@ export const BOOK_LANGUAGE_VERSION: string_semantic_version = '2.0.0';
|
|
|
16
16
|
* @generated
|
|
17
17
|
* @see https://github.com/webgptorg/promptbook
|
|
18
18
|
*/
|
|
19
|
-
export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.113.0-
|
|
19
|
+
export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.113.0-11';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Represents the version string of the Promptbook engine.
|
|
23
|
-
* It follows semantic versioning (e.g., `0.113.0-
|
|
23
|
+
* It follows semantic versioning (e.g., `0.113.0-10`).
|
|
24
24
|
*
|
|
25
25
|
* @generated
|
|
26
26
|
*/
|
package/src/versions.txt
CHANGED