@promptbook/browser 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 +127 -37
- package/esm/index.es.js.map +1 -1
- 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 +126 -36
- package/umd/index.umd.js.map +1 -1
- 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/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-7';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4116,6 +4116,13 @@
|
|
|
4116
4116
|
}
|
|
4117
4117
|
|
|
4118
4118
|
/* eslint-disable no-magic-numbers */
|
|
4119
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4120
|
+
/**
|
|
4121
|
+
* Default square size used by avatar renderers.
|
|
4122
|
+
*
|
|
4123
|
+
* @private utility of the avatar rendering system
|
|
4124
|
+
*/
|
|
4125
|
+
const DEFAULT_AVATAR_SIZE = 192;
|
|
4119
4126
|
/**
|
|
4120
4127
|
* Corner radius ratio used for the common rounded card frame.
|
|
4121
4128
|
*
|
|
@@ -4486,6 +4493,15 @@
|
|
|
4486
4493
|
* @private helper of `asciiOctopusAvatarVisual`
|
|
4487
4494
|
*/
|
|
4488
4495
|
const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
|
|
4496
|
+
/**
|
|
4497
|
+
* Coordinate space the octopus layout is generated in when it is painted into a terminal.
|
|
4498
|
+
*
|
|
4499
|
+
* The terminal renderer has its own character grid, so the geometry only needs one stable
|
|
4500
|
+
* square coordinate space which the grid is then sampled from.
|
|
4501
|
+
*
|
|
4502
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4503
|
+
*/
|
|
4504
|
+
const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
|
|
4489
4505
|
/**
|
|
4490
4506
|
* AsciiOctopus avatar visual.
|
|
4491
4507
|
*
|
|
@@ -4502,41 +4518,115 @@
|
|
|
4502
4518
|
const staticRandom = createRandom('ascii-octopus-static');
|
|
4503
4519
|
const gridMetrics = createAsciiGridMetrics(size, gridRandom);
|
|
4504
4520
|
const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
|
|
4521
|
+
const glyphGrid = createAsciiOctopusGlyphGrid({
|
|
4522
|
+
sampleGrid: gridMetrics,
|
|
4523
|
+
layout,
|
|
4524
|
+
palette,
|
|
4525
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
4526
|
+
timeMs,
|
|
4527
|
+
});
|
|
4505
4528
|
drawAvatarFrame(context, size, palette);
|
|
4506
4529
|
drawAsciiBackdrop(context, size, palette, layout, timeMs);
|
|
4507
4530
|
context.save();
|
|
4508
4531
|
context.font = `600 ${gridMetrics.fontSize}px monospace`;
|
|
4509
4532
|
context.textAlign = 'center';
|
|
4510
4533
|
context.textBaseline = 'middle';
|
|
4511
|
-
// The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
|
|
4512
|
-
// while the glyph layout remains deterministic for the same avatar input.
|
|
4513
|
-
const cellRandom = createRandom('ascii-octopus-cells');
|
|
4514
4534
|
for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
|
|
4515
4535
|
for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
|
|
4516
|
-
const
|
|
4517
|
-
x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
|
|
4518
|
-
y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
|
|
4519
|
-
};
|
|
4520
|
-
const noise = cellRandom();
|
|
4521
|
-
const glyphDescriptor = resolveAsciiGlyph({
|
|
4522
|
-
point,
|
|
4523
|
-
layout,
|
|
4524
|
-
palette,
|
|
4525
|
-
cellWidth: gridMetrics.cellWidth,
|
|
4526
|
-
cellHeight: gridMetrics.cellHeight,
|
|
4527
|
-
noise,
|
|
4528
|
-
timeMs,
|
|
4529
|
-
});
|
|
4536
|
+
const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
|
|
4530
4537
|
if (!glyphDescriptor) {
|
|
4531
4538
|
continue;
|
|
4532
4539
|
}
|
|
4540
|
+
const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
|
|
4533
4541
|
context.fillStyle = glyphDescriptor.color;
|
|
4534
4542
|
context.fillText(glyphDescriptor.character, point.x, point.y);
|
|
4535
4543
|
}
|
|
4536
4544
|
}
|
|
4537
4545
|
context.restore();
|
|
4538
4546
|
},
|
|
4547
|
+
renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
|
|
4548
|
+
const staticRandom = createRandom('ascii-octopus-static');
|
|
4549
|
+
const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
|
|
4550
|
+
return createAsciiOctopusGlyphGrid({
|
|
4551
|
+
sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
|
|
4552
|
+
layout,
|
|
4553
|
+
palette,
|
|
4554
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
4555
|
+
timeMs,
|
|
4556
|
+
});
|
|
4557
|
+
},
|
|
4539
4558
|
};
|
|
4559
|
+
/**
|
|
4560
|
+
* Resolves the geometry point sampled for one cell of the grid.
|
|
4561
|
+
*
|
|
4562
|
+
* @param sampleGrid Character-cell sampling grid.
|
|
4563
|
+
* @param columnIndex Zero-based cell column.
|
|
4564
|
+
* @param rowIndex Zero-based cell row.
|
|
4565
|
+
* @returns Sampled point in the octopus coordinate space.
|
|
4566
|
+
*
|
|
4567
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4568
|
+
*/
|
|
4569
|
+
function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
|
|
4570
|
+
return {
|
|
4571
|
+
x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
|
|
4572
|
+
y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
|
|
4573
|
+
};
|
|
4574
|
+
}
|
|
4575
|
+
/**
|
|
4576
|
+
* Builds the sampling grid used when the octopus is painted straight into terminal character cells.
|
|
4577
|
+
*
|
|
4578
|
+
* @param columns Available terminal columns.
|
|
4579
|
+
* @param rows Available terminal rows.
|
|
4580
|
+
* @returns Character-cell sampling grid covering the whole octopus coordinate space.
|
|
4581
|
+
*
|
|
4582
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4583
|
+
*/
|
|
4584
|
+
function createAsciiTerminalSampleGrid(columns, rows) {
|
|
4585
|
+
const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
|
|
4586
|
+
const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
|
|
4587
|
+
return {
|
|
4588
|
+
cellWidth,
|
|
4589
|
+
cellHeight,
|
|
4590
|
+
columnCount: columns,
|
|
4591
|
+
rowCount: rows,
|
|
4592
|
+
offsetX: cellWidth / 2,
|
|
4593
|
+
offsetY: cellHeight / 2,
|
|
4594
|
+
};
|
|
4595
|
+
}
|
|
4596
|
+
/**
|
|
4597
|
+
* Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
|
|
4598
|
+
*
|
|
4599
|
+
* The field is sampled on a low-resolution grid so the shape stays organic while the glyph
|
|
4600
|
+
* layout remains deterministic for the same avatar input. Both the canvas visual and the
|
|
4601
|
+
* terminal visual share this single sampling pass so they always describe the same octopus.
|
|
4602
|
+
*
|
|
4603
|
+
* @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
|
|
4604
|
+
* @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
|
|
4605
|
+
*
|
|
4606
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4607
|
+
*/
|
|
4608
|
+
function createAsciiOctopusGlyphGrid(options) {
|
|
4609
|
+
const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
|
|
4610
|
+
const glyphGrid = [];
|
|
4611
|
+
for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
|
|
4612
|
+
const glyphRow = [];
|
|
4613
|
+
for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
|
|
4614
|
+
const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
|
|
4615
|
+
const noise = cellRandom();
|
|
4616
|
+
glyphRow.push(resolveAsciiGlyph({
|
|
4617
|
+
point,
|
|
4618
|
+
layout,
|
|
4619
|
+
palette,
|
|
4620
|
+
cellWidth: sampleGrid.cellWidth,
|
|
4621
|
+
cellHeight: sampleGrid.cellHeight,
|
|
4622
|
+
noise,
|
|
4623
|
+
timeMs,
|
|
4624
|
+
}));
|
|
4625
|
+
}
|
|
4626
|
+
glyphGrid.push(glyphRow);
|
|
4627
|
+
}
|
|
4628
|
+
return glyphGrid;
|
|
4629
|
+
}
|
|
4540
4630
|
/**
|
|
4541
4631
|
* Draws the dark terminal-like glow behind the ASCII octopus.
|
|
4542
4632
|
*
|
|
@@ -27633,28 +27723,28 @@
|
|
|
27633
27723
|
*/
|
|
27634
27724
|
function buildToolInvocationScript(options) {
|
|
27635
27725
|
const { functionName, functionArgsExpression } = options;
|
|
27636
|
-
return `
|
|
27637
|
-
|
|
27638
|
-
|
|
27639
|
-
|
|
27640
|
-
|
|
27641
|
-
|
|
27726
|
+
return spacetrim.spaceTrim((block) => `
|
|
27727
|
+
const args = ${block(functionArgsExpression)};
|
|
27728
|
+
const runtimeContextRaw =
|
|
27729
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
27730
|
+
? undefined
|
|
27731
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
27642
27732
|
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27733
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
27734
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
27735
|
+
}
|
|
27646
27736
|
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
|
|
27650
|
-
|
|
27737
|
+
const toolProgressTokenRaw =
|
|
27738
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
27739
|
+
? undefined
|
|
27740
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
27651
27741
|
|
|
27652
|
-
|
|
27653
|
-
|
|
27654
|
-
|
|
27742
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
27743
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
27744
|
+
}
|
|
27655
27745
|
|
|
27656
|
-
|
|
27657
|
-
|
|
27746
|
+
return await ${functionName}(args);
|
|
27747
|
+
`);
|
|
27658
27748
|
}
|
|
27659
27749
|
|
|
27660
27750
|
/**
|