@promptbook/node 0.114.0-5 → 0.114.0-7
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/esm/index.es.js +199 -39
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +7 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentTeamPromptSection.d.ts +12 -0
- package/esm/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/esm/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +12 -3
- package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.d.ts → npm/$askForNpmPackageInstallationApproval.d.ts} +2 -2
- package/esm/src/cli/cli-commands/common/{harness/$resolveLatestHarnessVersion.d.ts → npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
- package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +14 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +39 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
- package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
- package/esm/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
- package/esm/src/utils/misc/debounce.d.ts +4 -2
- package/esm/src/utils/misc/debounce.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +199 -39
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +7 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentTeamPromptSection.d.ts +12 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.test.d.ts +1 -0
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/umd/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +12 -3
- package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.d.ts → npm/$askForNpmPackageInstallationApproval.d.ts} +2 -2
- package/umd/src/cli/cli-commands/common/{harness/$resolveLatestHarnessVersion.d.ts → npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
- package/umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +14 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +39 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
- package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
- package/umd/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
- package/umd/src/utils/misc/debounce.d.ts +4 -2
- package/umd/src/utils/misc/debounce.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
- /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
- /package/esm/src/cli/cli-commands/common/{harness/isHarnessVersionOutdated.test.d.ts → npm/$resolveLatestNpmPackageVersion.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.114.0-
|
|
3
|
+
"version": "0.114.0-7",
|
|
4
4
|
"description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"types": "./esm/src/_packages/node.index.d.ts",
|
|
98
98
|
"typings": "./esm/src/_packages/node.index.d.ts",
|
|
99
99
|
"peerDependencies": {
|
|
100
|
-
"@promptbook/core": "0.114.0-
|
|
100
|
+
"@promptbook/core": "0.114.0-7"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@openai/agents": "0.4.15",
|
package/umd/index.umd.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-7';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5148,6 +5148,65 @@
|
|
|
5148
5148
|
`);
|
|
5149
5149
|
}
|
|
5150
5150
|
|
|
5151
|
+
// Note: [💞] This file defines the shared TEAM workspace convention rather than one standalone entity.
|
|
5152
|
+
/**
|
|
5153
|
+
* Relative directory for an active TEAM conversation workspace.
|
|
5154
|
+
*
|
|
5155
|
+
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
5156
|
+
*/
|
|
5157
|
+
path.join(AGENT_MESSAGES_DIRECTORY_PATH, 'team');
|
|
5158
|
+
/**
|
|
5159
|
+
* Relative directory where completed TEAM conversation transcripts are retained.
|
|
5160
|
+
*
|
|
5161
|
+
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
5162
|
+
*/
|
|
5163
|
+
path.join(AGENT_FINISHED_MESSAGES_DIRECTORY_PATH, 'team');
|
|
5164
|
+
/**
|
|
5165
|
+
* Name of the read-only teammate-source directory inside one TEAM workspace.
|
|
5166
|
+
*
|
|
5167
|
+
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
5168
|
+
*/
|
|
5169
|
+
const AGENT_TEAMMATE_SOURCES_DIRECTORY_NAME = 'teammates';
|
|
5170
|
+
|
|
5171
|
+
/**
|
|
5172
|
+
* Builds the optional single-run TEAM consultation instructions for a coding harness.
|
|
5173
|
+
*/
|
|
5174
|
+
function buildAgentTeamPromptSection(workspace) {
|
|
5175
|
+
if (!workspace || workspace.manifest.teammates.length === 0) {
|
|
5176
|
+
return '';
|
|
5177
|
+
}
|
|
5178
|
+
const teammateSections = workspace.manifest.teammates.map((teammate) => {
|
|
5179
|
+
const sourcePath = toPromptPath(path.join(workspace.relativeWorkspacePath, AGENT_TEAMMATE_SOURCES_DIRECTORY_NAME, teammate.sourceFileName));
|
|
5180
|
+
const transcriptPath = toPromptPath(path.join(workspace.relativeWorkspacePath, `${teammate.permanentId}--01.book`));
|
|
5181
|
+
const instructions = teammate.instructions.trim() || 'No additional TEAM instructions were provided.';
|
|
5182
|
+
return _spaceTrim.spaceTrim(`
|
|
5183
|
+
- ${teammate.agentName}
|
|
5184
|
+
- TEAM instructions: ${instructions}
|
|
5185
|
+
- Read-only source: \`${sourcePath}\`
|
|
5186
|
+
- First transcript file: \`${transcriptPath}\`
|
|
5187
|
+
`);
|
|
5188
|
+
});
|
|
5189
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
5190
|
+
## Team consultations
|
|
5191
|
+
|
|
5192
|
+
The following teammates are available for this user turn:
|
|
5193
|
+
|
|
5194
|
+
${block(teammateSections.join('\n'))}
|
|
5195
|
+
|
|
5196
|
+
- The underlying coding harness is already executing this turn **exactly once**. Never start, queue, or invoke another coding harness, agent runner, or \`ptbk\` command to consult a teammate.
|
|
5197
|
+
- The primary agent remains responsible for the final user-facing \`MESSAGE @Agent\` answer.
|
|
5198
|
+
- Teammate source files are read-only context. When a teammate consultation occurs, record the actual exchange in a new top-level \`.book\` file in \`${toPromptPath(workspace.relativeWorkspacePath)}\`.
|
|
5199
|
+
- Name each transcript \`<teammate permanent id>--<sequence>.book\`, for example \`${workspace.manifest.teammates[0].permanentId}--01.book\`.
|
|
5200
|
+
- Every transcript must contain alternating \`MESSAGE @${workspace.manifest.primaryAgent.agentName}\` and \`MESSAGE @<teammate name>\` blocks. Do not create a transcript for a teammate that was not consulted.
|
|
5201
|
+
`);
|
|
5202
|
+
}
|
|
5203
|
+
/**
|
|
5204
|
+
* Converts a filesystem-relative path into the portable path notation used in prompts.
|
|
5205
|
+
*/
|
|
5206
|
+
function toPromptPath(path) {
|
|
5207
|
+
return path.replace(/\\/gu, '/');
|
|
5208
|
+
}
|
|
5209
|
+
|
|
5151
5210
|
/**
|
|
5152
5211
|
* Builds the prompt sent to the selected coding runner for one queued user-thread book.
|
|
5153
5212
|
*/
|
|
@@ -5157,7 +5216,7 @@
|
|
|
5157
5216
|
|
|
5158
5217
|
- Read \`${messageRelativePath}\` and answer the most recent \`MESSAGE @User\`
|
|
5159
5218
|
- Only change the queued message file by appending one new \`MESSAGE @Agent\` block
|
|
5160
|
-
|
|
5219
|
+
${block(buildAllowedFileChangesPromptLine(options.teamWorkspace))}
|
|
5161
5220
|
|
|
5162
5221
|
## Rules for the answering
|
|
5163
5222
|
|
|
@@ -5195,11 +5254,22 @@
|
|
|
5195
5254
|
|
|
5196
5255
|
${block(buildAgentProjectsPromptSection(options))}
|
|
5197
5256
|
|
|
5257
|
+
${block(buildAgentTeamPromptSection(options.teamWorkspace))}
|
|
5258
|
+
|
|
5198
5259
|
## This is how you should behave
|
|
5199
5260
|
|
|
5200
5261
|
${block(agentSystemMessage)}
|
|
5201
5262
|
`);
|
|
5202
5263
|
}
|
|
5264
|
+
/**
|
|
5265
|
+
* Explains the exact files that one coding harness may change for a user turn.
|
|
5266
|
+
*/
|
|
5267
|
+
function buildAllowedFileChangesPromptLine(teamWorkspace) {
|
|
5268
|
+
if (!teamWorkspace) {
|
|
5269
|
+
return `- Do not modify any other file in the repository, except files inside your own \`${AGENT_PROJECTS_DIRECTORY_PATH}/\` directory`;
|
|
5270
|
+
}
|
|
5271
|
+
return `- Do not modify any other file in the repository, except files inside your own \`${AGENT_PROJECTS_DIRECTORY_PATH}/\` directory and new consultation transcripts inside \`${teamWorkspace.relativeWorkspacePath.replace(/\\/gu, '/')}\``;
|
|
5272
|
+
}
|
|
5203
5273
|
|
|
5204
5274
|
/**
|
|
5205
5275
|
* Temporary subdirectory used for agent-message runner shell scripts.
|
|
@@ -13915,6 +13985,13 @@
|
|
|
13915
13985
|
}
|
|
13916
13986
|
|
|
13917
13987
|
/* eslint-disable no-magic-numbers */
|
|
13988
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13989
|
+
/**
|
|
13990
|
+
* Default square size used by avatar renderers.
|
|
13991
|
+
*
|
|
13992
|
+
* @private utility of the avatar rendering system
|
|
13993
|
+
*/
|
|
13994
|
+
const DEFAULT_AVATAR_SIZE = 192;
|
|
13918
13995
|
/**
|
|
13919
13996
|
* Corner radius ratio used for the common rounded card frame.
|
|
13920
13997
|
*
|
|
@@ -14285,6 +14362,15 @@
|
|
|
14285
14362
|
* @private helper of `asciiOctopusAvatarVisual`
|
|
14286
14363
|
*/
|
|
14287
14364
|
const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
|
|
14365
|
+
/**
|
|
14366
|
+
* Coordinate space the octopus layout is generated in when it is painted into a terminal.
|
|
14367
|
+
*
|
|
14368
|
+
* The terminal renderer has its own character grid, so the geometry only needs one stable
|
|
14369
|
+
* square coordinate space which the grid is then sampled from.
|
|
14370
|
+
*
|
|
14371
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
14372
|
+
*/
|
|
14373
|
+
const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
|
|
14288
14374
|
/**
|
|
14289
14375
|
* AsciiOctopus avatar visual.
|
|
14290
14376
|
*
|
|
@@ -14301,41 +14387,115 @@
|
|
|
14301
14387
|
const staticRandom = createRandom('ascii-octopus-static');
|
|
14302
14388
|
const gridMetrics = createAsciiGridMetrics(size, gridRandom);
|
|
14303
14389
|
const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
|
|
14390
|
+
const glyphGrid = createAsciiOctopusGlyphGrid({
|
|
14391
|
+
sampleGrid: gridMetrics,
|
|
14392
|
+
layout,
|
|
14393
|
+
palette,
|
|
14394
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
14395
|
+
timeMs,
|
|
14396
|
+
});
|
|
14304
14397
|
drawAvatarFrame(context, size, palette);
|
|
14305
14398
|
drawAsciiBackdrop(context, size, palette, layout, timeMs);
|
|
14306
14399
|
context.save();
|
|
14307
14400
|
context.font = `600 ${gridMetrics.fontSize}px monospace`;
|
|
14308
14401
|
context.textAlign = 'center';
|
|
14309
14402
|
context.textBaseline = 'middle';
|
|
14310
|
-
// The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
|
|
14311
|
-
// while the glyph layout remains deterministic for the same avatar input.
|
|
14312
|
-
const cellRandom = createRandom('ascii-octopus-cells');
|
|
14313
14403
|
for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
|
|
14314
14404
|
for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
|
|
14315
|
-
const
|
|
14316
|
-
x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
|
|
14317
|
-
y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
|
|
14318
|
-
};
|
|
14319
|
-
const noise = cellRandom();
|
|
14320
|
-
const glyphDescriptor = resolveAsciiGlyph({
|
|
14321
|
-
point,
|
|
14322
|
-
layout,
|
|
14323
|
-
palette,
|
|
14324
|
-
cellWidth: gridMetrics.cellWidth,
|
|
14325
|
-
cellHeight: gridMetrics.cellHeight,
|
|
14326
|
-
noise,
|
|
14327
|
-
timeMs,
|
|
14328
|
-
});
|
|
14405
|
+
const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
|
|
14329
14406
|
if (!glyphDescriptor) {
|
|
14330
14407
|
continue;
|
|
14331
14408
|
}
|
|
14409
|
+
const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
|
|
14332
14410
|
context.fillStyle = glyphDescriptor.color;
|
|
14333
14411
|
context.fillText(glyphDescriptor.character, point.x, point.y);
|
|
14334
14412
|
}
|
|
14335
14413
|
}
|
|
14336
14414
|
context.restore();
|
|
14337
14415
|
},
|
|
14416
|
+
renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
|
|
14417
|
+
const staticRandom = createRandom('ascii-octopus-static');
|
|
14418
|
+
const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
|
|
14419
|
+
return createAsciiOctopusGlyphGrid({
|
|
14420
|
+
sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
|
|
14421
|
+
layout,
|
|
14422
|
+
palette,
|
|
14423
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
14424
|
+
timeMs,
|
|
14425
|
+
});
|
|
14426
|
+
},
|
|
14338
14427
|
};
|
|
14428
|
+
/**
|
|
14429
|
+
* Resolves the geometry point sampled for one cell of the grid.
|
|
14430
|
+
*
|
|
14431
|
+
* @param sampleGrid Character-cell sampling grid.
|
|
14432
|
+
* @param columnIndex Zero-based cell column.
|
|
14433
|
+
* @param rowIndex Zero-based cell row.
|
|
14434
|
+
* @returns Sampled point in the octopus coordinate space.
|
|
14435
|
+
*
|
|
14436
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
14437
|
+
*/
|
|
14438
|
+
function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
|
|
14439
|
+
return {
|
|
14440
|
+
x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
|
|
14441
|
+
y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
|
|
14442
|
+
};
|
|
14443
|
+
}
|
|
14444
|
+
/**
|
|
14445
|
+
* Builds the sampling grid used when the octopus is painted straight into terminal character cells.
|
|
14446
|
+
*
|
|
14447
|
+
* @param columns Available terminal columns.
|
|
14448
|
+
* @param rows Available terminal rows.
|
|
14449
|
+
* @returns Character-cell sampling grid covering the whole octopus coordinate space.
|
|
14450
|
+
*
|
|
14451
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
14452
|
+
*/
|
|
14453
|
+
function createAsciiTerminalSampleGrid(columns, rows) {
|
|
14454
|
+
const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
|
|
14455
|
+
const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
|
|
14456
|
+
return {
|
|
14457
|
+
cellWidth,
|
|
14458
|
+
cellHeight,
|
|
14459
|
+
columnCount: columns,
|
|
14460
|
+
rowCount: rows,
|
|
14461
|
+
offsetX: cellWidth / 2,
|
|
14462
|
+
offsetY: cellHeight / 2,
|
|
14463
|
+
};
|
|
14464
|
+
}
|
|
14465
|
+
/**
|
|
14466
|
+
* Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
|
|
14467
|
+
*
|
|
14468
|
+
* The field is sampled on a low-resolution grid so the shape stays organic while the glyph
|
|
14469
|
+
* layout remains deterministic for the same avatar input. Both the canvas visual and the
|
|
14470
|
+
* terminal visual share this single sampling pass so they always describe the same octopus.
|
|
14471
|
+
*
|
|
14472
|
+
* @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
|
|
14473
|
+
* @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
|
|
14474
|
+
*
|
|
14475
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
14476
|
+
*/
|
|
14477
|
+
function createAsciiOctopusGlyphGrid(options) {
|
|
14478
|
+
const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
|
|
14479
|
+
const glyphGrid = [];
|
|
14480
|
+
for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
|
|
14481
|
+
const glyphRow = [];
|
|
14482
|
+
for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
|
|
14483
|
+
const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
|
|
14484
|
+
const noise = cellRandom();
|
|
14485
|
+
glyphRow.push(resolveAsciiGlyph({
|
|
14486
|
+
point,
|
|
14487
|
+
layout,
|
|
14488
|
+
palette,
|
|
14489
|
+
cellWidth: sampleGrid.cellWidth,
|
|
14490
|
+
cellHeight: sampleGrid.cellHeight,
|
|
14491
|
+
noise,
|
|
14492
|
+
timeMs,
|
|
14493
|
+
}));
|
|
14494
|
+
}
|
|
14495
|
+
glyphGrid.push(glyphRow);
|
|
14496
|
+
}
|
|
14497
|
+
return glyphGrid;
|
|
14498
|
+
}
|
|
14339
14499
|
/**
|
|
14340
14500
|
* Draws the dark terminal-like glow behind the ASCII octopus.
|
|
14341
14501
|
*
|
|
@@ -29398,28 +29558,28 @@
|
|
|
29398
29558
|
*/
|
|
29399
29559
|
function buildToolInvocationScript(options) {
|
|
29400
29560
|
const { functionName, functionArgsExpression } = options;
|
|
29401
|
-
return `
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
-
|
|
29406
|
-
|
|
29561
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
29562
|
+
const args = ${block(functionArgsExpression)};
|
|
29563
|
+
const runtimeContextRaw =
|
|
29564
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
29565
|
+
? undefined
|
|
29566
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
29407
29567
|
|
|
29408
|
-
|
|
29409
|
-
|
|
29410
|
-
|
|
29568
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
29569
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
29570
|
+
}
|
|
29411
29571
|
|
|
29412
|
-
|
|
29413
|
-
|
|
29414
|
-
|
|
29415
|
-
|
|
29572
|
+
const toolProgressTokenRaw =
|
|
29573
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
29574
|
+
? undefined
|
|
29575
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
29416
29576
|
|
|
29417
|
-
|
|
29418
|
-
|
|
29419
|
-
|
|
29577
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
29578
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
29579
|
+
}
|
|
29420
29580
|
|
|
29421
|
-
|
|
29422
|
-
|
|
29581
|
+
return await ${functionName}(args);
|
|
29582
|
+
`);
|
|
29423
29583
|
}
|
|
29424
29584
|
|
|
29425
29585
|
/**
|
|
@@ -36260,8 +36420,8 @@
|
|
|
36260
36420
|
*/
|
|
36261
36421
|
$applyToTaskJson(command, $taskJson) {
|
|
36262
36422
|
if ($taskJson.format !== undefined && command.format !== $taskJson.format) {
|
|
36263
|
-
throw new ParseError(`Format format is already defined to "${$taskJson.format}".
|
|
36264
|
-
Now you try to redefine it by "${command.format}"`);
|
|
36423
|
+
throw new ParseError(_spaceTrim.spaceTrim(`Format format is already defined to "${$taskJson.format}".
|
|
36424
|
+
Now you try to redefine it by "${command.format}"`));
|
|
36265
36425
|
}
|
|
36266
36426
|
$taskJson.format = command.format;
|
|
36267
36427
|
},
|