@promptbook/cli 0.113.0-5 → 0.113.0-6

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.
Files changed (36) hide show
  1. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +13 -1
  2. package/apps/agents-server/src/search/createDefaultServerSearchProviders/loadLocalOrganizationSearchDataset.ts +12 -1
  3. package/apps/agents-server/src/utils/agentOrganization/loadAgentOrganizationState.ts +13 -1
  4. package/apps/agents-server/src/utils/createLocalAgentSourceImporter.ts +159 -0
  5. package/apps/agents-server/src/utils/createMissingImportedAgentFallback.ts +60 -0
  6. package/apps/agents-server/src/utils/customDomainRouting.ts +157 -12
  7. package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +1 -1
  8. package/apps/agents-server/src/utils/importAgentWithFallback.ts +1 -58
  9. package/apps/agents-server/src/utils/localAgentRouteReferences.ts +167 -0
  10. package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +1 -1
  11. package/apps/agents-server/src/utils/managementApi/managementApiAgents.ts +17 -3
  12. package/apps/agents-server/src/utils/resolveAgentStateFromSource.ts +7 -1
  13. package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +54 -5
  14. package/apps/agents-server/src/utils/resolveServerAgentContext.ts +12 -1
  15. package/apps/agents-server/src/utils/resolveStoredAgentState.ts +2 -1
  16. package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +39 -9
  17. package/apps/agents-server/tests/e2e/support/ChatHistoryNavigationSupport.ts +5 -0
  18. package/esm/index.es.js +24 -36
  19. package/esm/index.es.js.map +1 -1
  20. package/esm/src/version.d.ts +1 -1
  21. package/package.json +1 -1
  22. package/src/avatars/avatarAnimationScheduler.ts +2 -1
  23. package/src/avatars/visuals/octopus3d3AvatarVisual.ts +6 -2
  24. package/src/avatars/visuals/octopus3d4AvatarVisual.ts +14 -18
  25. package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +3 -1
  26. package/src/cli/cli-commands/coder/boilerplateTemplates.ts +14 -21
  27. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +1 -4
  28. package/src/cli/cli-commands/coder/run.ts +2 -9
  29. package/src/commitments/TEAM/TEAM.ts +5 -5
  30. package/src/other/templates/getTemplatesPipelineCollection.ts +845 -662
  31. package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +1 -4
  32. package/src/version.ts +2 -2
  33. package/src/versions.txt +1 -0
  34. package/umd/index.umd.js +24 -36
  35. package/umd/index.umd.js.map +1 -1
  36. package/umd/src/version.d.ts +1 -1
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.113.0-4`).
18
+ * It follows semantic versioning (e.g., `0.113.0-5`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.113.0-5",
3
+ "version": "0.113.0-6",
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,
@@ -133,7 +133,8 @@ function ensureAvatarAnimationLoop(): void {
133
133
  // Run the most stale listeners first so each avatar keeps its target FPS even when
134
134
  // total work exceeds the per-frame budget.
135
135
  dueListenerEntries.sort(
136
- (firstListenerEntry, secondListenerEntry) => firstListenerEntry.lastRunAtMs - secondListenerEntry.lastRunAtMs,
136
+ (firstListenerEntry, secondListenerEntry) =>
137
+ firstListenerEntry.lastRunAtMs - secondListenerEntry.lastRunAtMs,
137
138
  );
138
139
 
139
140
  const listenersToRunCount = Math.min(dueListenerEntries.length, MAX_AVATAR_LISTENERS_PER_FRAME);
@@ -502,12 +502,16 @@ function resolveVisibleContinuousOctopusPatches(
502
502
  }
503
503
 
504
504
  for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
505
- const patchCenterLongitude = (longitudeBoundaries[longitudeIndex]! + longitudeBoundaries[longitudeIndex + 1]!) / 2;
505
+ const patchCenterLongitude =
506
+ (longitudeBoundaries[longitudeIndex]! + longitudeBoundaries[longitudeIndex + 1]!) / 2;
506
507
  cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex] = resolveContinuousTentacleInfluence(
507
508
  options,
508
509
  patchCenterLongitude,
509
510
  );
510
- cachedLobeWavesByPatchCenterLongitude[longitudeIndex] = resolveContinuousLobeWave(options, patchCenterLongitude);
511
+ cachedLobeWavesByPatchCenterLongitude[longitudeIndex] = resolveContinuousLobeWave(
512
+ options,
513
+ patchCenterLongitude,
514
+ );
511
515
  cachedCosByPatchCenterLongitude[longitudeIndex] = Math.max(0, Math.cos(patchCenterLongitude));
512
516
  }
513
517
 
@@ -193,8 +193,14 @@ export const octopus3d4AvatarVisual: AvatarVisualDefinition = {
193
193
  isAnimated: true,
194
194
  supportsPointerTracking: true,
195
195
  render({ context, size, palette, createRandom, timeMs, interaction }) {
196
- const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles, skinSpots } =
197
- getOctopus3d4StableState(createRandom);
196
+ const {
197
+ morphologyProfile,
198
+ animationPhase,
199
+ leftEyePhaseOffset,
200
+ rightEyePhaseOffset,
201
+ tentacleProfiles,
202
+ skinSpots,
203
+ } = getOctopus3d4StableState(createRandom);
198
204
  const sceneCenterX = size * 0.5;
199
205
  const sceneCenterY = size * 0.535;
200
206
  const bob = Math.sin(timeMs / 980 + animationPhase) * size * 0.013;
@@ -568,7 +574,8 @@ function resolveVisibleBlobbyContinuousPatches(
568
574
  }
569
575
 
570
576
  for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
571
- const patchCenterLongitude = (longitudeBoundaries[longitudeIndex]! + longitudeBoundaries[longitudeIndex + 1]!) / 2;
577
+ const patchCenterLongitude =
578
+ (longitudeBoundaries[longitudeIndex]! + longitudeBoundaries[longitudeIndex + 1]!) / 2;
572
579
  cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex] = resolveBlobbyTentacleInfluence(
573
580
  options,
574
581
  patchCenterLongitude,
@@ -702,8 +709,7 @@ function sampleBlobbyContinuousSurfacePointWithLongitudeCache(
702
709
  const lowerBlend = smoothStep(0.34, 1, verticalProgress);
703
710
  const tipBlend = smoothStep(0.66, 1, verticalProgress);
704
711
  const centerPull = resolveSignedAngularDistance(longitude, tentacleInfluence.centerLongitude);
705
- const effectiveLongitude =
706
- longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.26 + tipBlend * 0.22);
712
+ const effectiveLongitude = longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.26 + tipBlend * 0.22);
707
713
  const mantleRipple =
708
714
  Math.sin(
709
715
  longitude * morphologyProfile.body.lobeCount +
@@ -742,10 +748,7 @@ function sampleBlobbyContinuousSurfacePointWithLongitudeCache(
742
748
  lowerBlend * tentacleInfluence.core * (0.12 + tentacleInfluence.depthScale * 0.07) -
743
749
  Math.max(0, -Math.cos(effectiveLongitude)) * 0.05;
744
750
  const tentacleTubeRadius =
745
- lowerBlend *
746
- tentacleInfluence.core *
747
- (0.12 + tipBlend * 0.07 + tentacleInfluence.widthScale * 0.028) *
748
- radiusX;
751
+ lowerBlend * tentacleInfluence.core * (0.12 + tipBlend * 0.07 + tentacleInfluence.widthScale * 0.028) * radiusX;
749
752
  const planarRadiusX = cosineLatitude * radiusX * horizontalScale + tentacleTubeRadius;
750
753
  const planarRadiusZ = cosineLatitude * radiusZ * depthScale + tentacleTubeRadius * 0.74;
751
754
  const lowerDrop =
@@ -759,10 +762,7 @@ function sampleBlobbyContinuousSurfacePointWithLongitudeCache(
759
762
  const combinedTentacleSway = (primaryTentacleWave + secondaryTentacleWave) * radiusX * (0.06 + tipBlend * 0.06);
760
763
 
761
764
  return {
762
- x:
763
- Math.sin(effectiveLongitude) * planarRadiusX +
764
- combinedTentacleSway +
765
- tentacleCurl * radiusX * 0.18,
765
+ x: Math.sin(effectiveLongitude) * planarRadiusX + combinedTentacleSway + tentacleCurl * radiusX * 0.18,
766
766
  y:
767
767
  Math.sin(latitude) * radiusY * (1 + upperBlend * 0.14) -
768
768
  upperBlend * radiusY * 0.12 +
@@ -911,11 +911,7 @@ function drawBlobbyContinuousSurfacePatch(
911
911
  drawProjectedQuad(context, surfacePatch.corners, surfacePatch.fillStyle);
912
912
 
913
913
  if (surfacePatch.lightIntensity > 0) {
914
- drawProjectedQuad(
915
- context,
916
- surfacePatch.corners,
917
- `rgba(255, 255, 255, ${0.2 * surfacePatch.lightIntensity})`,
918
- );
914
+ drawProjectedQuad(context, surfacePatch.corners, `rgba(255, 255, 255, ${0.2 * surfacePatch.lightIntensity})`);
919
915
  } else if (surfacePatch.lightIntensity < 0) {
920
916
  drawProjectedQuad(
921
917
  context,
@@ -739,7 +739,9 @@ function isNextBuildTerminationRetryable(exitStatus: NextBuildExitStatus): boole
739
739
  * Creates one visible retry message for a killed Next.js build attempt.
740
740
  */
741
741
  function createNextBuildRetryMessage(exitStatus: NextBuildExitStatus, nextAttempt: number): string {
742
- return `\nAgents Server Next build was terminated by ${describeNextBuildExitStatus(exitStatus)}. Retrying attempt ${nextAttempt}/${AGENTS_SERVER_BUILD_MAX_ATTEMPTS}.\n`;
742
+ return `\nAgents Server Next build was terminated by ${describeNextBuildExitStatus(
743
+ exitStatus,
744
+ )}. Retrying attempt ${nextAttempt}/${AGENTS_SERVER_BUILD_MAX_ATTEMPTS}.\n`;
743
745
  }
744
746
 
745
747
  /**
@@ -120,26 +120,26 @@ const DEFAULT_CODER_PROMPT_TEMPLATE_DEFINITIONS = [
120
120
  id: 'common',
121
121
  relativeFilePath: join(PROMPTS_TEMPLATES_DIRECTORY_PATH, 'common.md'),
122
122
  slugPrefix: null,
123
- content: buildCoderPromptTemplateContent([
124
- '- @@@',
125
- "- Keep in mind the DRY _(don't repeat yourself)_ principle.",
126
- '- Do a proper analysis of the current functionality before you start implementing.',
127
- '- Add the changes into the [changelog](changelog/_current-preversion.md)',
128
- ]),
123
+ content: spaceTrim(`
124
+ - @@@
125
+ - Keep in mind the DRY _(don't repeat yourself)_ principle.
126
+ - Do a proper analysis of the current functionality before you start implementing.
127
+ - Add the changes into the [changelog](changelog/_current-preversion.md)
128
+ `),
129
129
  isDefaultProjectTemplate: true,
130
130
  },
131
131
  {
132
132
  id: 'agents-server',
133
133
  relativeFilePath: join(PROMPTS_TEMPLATES_DIRECTORY_PATH, 'agents-server.md'),
134
134
  slugPrefix: 'agents-server',
135
- content: buildCoderPromptTemplateContent([
136
- '- @@@',
137
- "- Keep in mind the DRY _(don't repeat yourself)_ principle.",
138
- '- Do a proper analysis of the current functionality before you start implementing.',
139
- '- You are working with the [Agents Server](apps/agents-server)',
140
- '- If you need to do the database migration, do it',
141
- '- Add the changes into the [changelog](changelog/_current-preversion.md)',
142
- ]),
135
+ content: spaceTrim(`
136
+ - @@@
137
+ - Keep in mind the DRY _(don't repeat yourself)_ principle.
138
+ - Do a proper analysis of the current functionality before you start implementing.
139
+ - You are working with the [Agents Server](apps/agents-server)
140
+ - If you need to do the database migration, do it
141
+ - Add the changes into the [changelog](changelog/_current-preversion.md)
142
+ `),
143
143
  isDefaultProjectTemplate: false,
144
144
  },
145
145
  ] as const satisfies ReadonlyArray<CoderPromptTemplateDefinition>;
@@ -288,13 +288,6 @@ function getDefaultCoderPromptTemplateDefinitionOrUndefined(
288
288
  return DEFAULT_CODER_PROMPT_TEMPLATE_DEFINITIONS.find((definition) => definition.id === template);
289
289
  }
290
290
 
291
- /**
292
- * Builds stable markdown content for one coder prompt template without indentation drift.
293
- */
294
- function buildCoderPromptTemplateContent(lines: ReadonlyArray<string>): string {
295
- return lines.join('\n');
296
- }
297
-
298
291
  /**
299
292
  * Creates a fully resolved template payload from one built-in definition.
300
293
  */
@@ -8,10 +8,7 @@ import {
8
8
  PROMPTS_TEMPLATES_DIRECTORY_PATH,
9
9
  } from './boilerplateTemplates';
10
10
  import { ensureCoderEnvFile } from './ensureCoderEnvFile';
11
- import {
12
- CODER_AGENTS_DIRECTORY_PATH,
13
- ensureCoderDeveloperAgentFile,
14
- } from './ensureCoderDeveloperAgentFile';
11
+ import { CODER_AGENTS_DIRECTORY_PATH, ensureCoderDeveloperAgentFile } from './ensureCoderDeveloperAgentFile';
15
12
  import { ensureCoderGitignoreFile } from './ensureCoderGitignoreFile';
16
13
  import { ensureCoderMarkdownFile } from './ensureCoderMarkdownFile';
17
14
  import { ensureCoderPackageJsonFile } from './ensureCoderPackageJsonFile';
@@ -12,10 +12,7 @@ import {
12
12
  normalizePromptRunnerCliOptions,
13
13
  PROMPT_RUNNER_DESCRIPTION,
14
14
  } from '../common/promptRunnerCliOptions';
15
- import {
16
- DEFAULT_WAIT_AFTER_ERROR_MS,
17
- parseOptionalWaitDuration,
18
- } from './waitOptions';
15
+ import { DEFAULT_WAIT_AFTER_ERROR_MS, parseOptionalWaitDuration } from './waitOptions';
19
16
 
20
17
  /**
21
18
  * Initializes `coder run` command for Promptbook CLI utilities
@@ -66,11 +63,7 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
66
63
  );
67
64
  addPromptRunnerExecutionOptions(command);
68
65
  command.option('--priority <minimum-priority>', 'Filter prompts by minimum priority level', parseIntOption, 0);
69
- command.option(
70
- '--limit <run-count>',
71
- 'Stop after processing this many prompt runs',
72
- parsePositiveIntegerOption,
73
- );
66
+ command.option('--limit <run-count>', 'Stop after processing this many prompt runs', parsePositiveIntegerOption);
74
67
  command.option(
75
68
  '--wait-after-prompt <duration>',
76
69
  spaceTrim(`
@@ -113,10 +113,10 @@ const teamToolTitles: Record<string_javascript_name, string> = {};
113
113
  *
114
114
  * @private
115
115
  */
116
- const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
117
- '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
118
- '- Do not ask the user for information that a listed teammate can provide directly.',
119
- ] as const;
116
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE = spaceTrim(`
117
+ - If a teammate is relevant to the request, consult that teammate using the matching tool.
118
+ - Do not ask the user for information that a listed teammate can provide directly.
119
+ `);
120
120
  /**
121
121
  * Constant for remote agents by Url.
122
122
  */
@@ -352,7 +352,7 @@ function buildTeamSystemMessageBody(teamEntries: ReadonlyArray<TeamToolEntry>):
352
352
 
353
353
  return spaceTrim(
354
354
  (block) => `
355
- ${block(TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES.join('\n'))}
355
+ ${block(TEAM_SYSTEM_MESSAGE_GUIDANCE)}
356
356
 
357
357
  ${block(teammateSections.join('\n\n'))}
358
358
  `,