@promptbook/pdf 0.112.0-69 → 0.112.0-71

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 (27) hide show
  1. package/esm/index.es.js +28 -26
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
  4. package/esm/src/avatars/visuals/avatar3dProjectionShared.d.ts +141 -0
  5. package/esm/src/avatars/visuals/octopus3dAvatarVisual.d.ts +7 -0
  6. package/esm/src/cli/cli-commands/agent/agentProjectPaths.d.ts +2 -2
  7. package/esm/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +22 -0
  8. package/esm/src/cli/cli-commands/agent/runMultiple.d.ts +10 -0
  9. package/esm/src/cli/cli-commands/agent.d.ts +3 -2
  10. package/esm/src/cli/other/install.test.d.ts +1 -0
  11. package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +1 -1
  12. package/esm/src/commitments/WALLET/WALLET.d.ts +1 -1
  13. package/esm/src/version.d.ts +1 -1
  14. package/package.json +2 -2
  15. package/umd/index.umd.js +28 -26
  16. package/umd/index.umd.js.map +1 -1
  17. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
  18. package/umd/src/avatars/visuals/avatar3dProjectionShared.d.ts +141 -0
  19. package/umd/src/avatars/visuals/octopus3dAvatarVisual.d.ts +7 -0
  20. package/umd/src/cli/cli-commands/agent/agentProjectPaths.d.ts +2 -2
  21. package/umd/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +22 -0
  22. package/umd/src/cli/cli-commands/agent/runMultiple.d.ts +10 -0
  23. package/umd/src/cli/cli-commands/agent.d.ts +3 -2
  24. package/umd/src/cli/other/install.test.d.ts +1 -0
  25. package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +1 -1
  26. package/umd/src/commitments/WALLET/WALLET.d.ts +1 -1
  27. package/umd/src/version.d.ts +1 -1
@@ -7,7 +7,7 @@ import type { AvatarDefinition } from './AvatarDefinition';
7
7
  *
8
8
  * @private shared contract for the avatar rendering system
9
9
  */
10
- export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'octopus3' | 'ascii-octopus' | 'minecraft' | 'minecraft2' | 'fractal' | 'orb';
10
+ export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'octopus3' | 'octopus3d' | 'ascii-octopus' | 'minecraft' | 'minecraft2' | 'fractal' | 'orb';
11
11
  /**
12
12
  * Derived color palette used by avatar visuals.
13
13
  *
@@ -0,0 +1,141 @@
1
+ /**
2
+ * One 3D point used by the shared avatar projection helpers.
3
+ *
4
+ * @private helper of the 3D avatar visuals
5
+ */
6
+ export type Point3D = {
7
+ readonly x: number;
8
+ readonly y: number;
9
+ readonly z: number;
10
+ };
11
+ /**
12
+ * One projected 2D point derived from scene-space 3D coordinates.
13
+ *
14
+ * @private helper of the 3D avatar visuals
15
+ */
16
+ export type ProjectedPoint = {
17
+ readonly x: number;
18
+ readonly y: number;
19
+ readonly z: number;
20
+ };
21
+ /**
22
+ * Default camera distance ratio shared by the proper-3D avatar visuals.
23
+ *
24
+ * @private helper of the 3D avatar visuals
25
+ */
26
+ export declare const DEFAULT_3D_CAMERA_DISTANCE_RATIO = 1.4;
27
+ /**
28
+ * Clamps one number into the provided range.
29
+ *
30
+ * @param value Input value.
31
+ * @param minimumValue Inclusive lower bound.
32
+ * @param maximumValue Inclusive upper bound.
33
+ * @returns Clamped value.
34
+ *
35
+ * @private helper of the 3D avatar visuals
36
+ */
37
+ export declare function clampNumber(value: number, minimumValue: number, maximumValue: number): number;
38
+ /**
39
+ * Rotates one point around the local Y axis.
40
+ *
41
+ * @param point Source point.
42
+ * @param angle Rotation angle in radians.
43
+ * @returns Rotated point.
44
+ *
45
+ * @private helper of the 3D avatar visuals
46
+ */
47
+ export declare function rotatePointAroundY(point: Point3D, angle: number): Point3D;
48
+ /**
49
+ * Rotates one point around the local X axis.
50
+ *
51
+ * @param point Source point.
52
+ * @param angle Rotation angle in radians.
53
+ * @returns Rotated point.
54
+ *
55
+ * @private helper of the 3D avatar visuals
56
+ */
57
+ export declare function rotatePointAroundX(point: Point3D, angle: number): Point3D;
58
+ /**
59
+ * Applies the local rotations and translation to one scene point.
60
+ *
61
+ * @param localPoint Point in local object space.
62
+ * @param center Object center in scene space.
63
+ * @param rotationX Object pitch in radians.
64
+ * @param rotationY Object yaw in radians.
65
+ * @returns Transformed scene-space point.
66
+ *
67
+ * @private helper of the 3D avatar visuals
68
+ */
69
+ export declare function transformScenePoint(localPoint: Point3D, center: Point3D, rotationX: number, rotationY: number): Point3D;
70
+ /**
71
+ * Projects one scene point into canvas coordinates.
72
+ *
73
+ * @param point Scene-space point.
74
+ * @param size Canvas size in CSS pixels.
75
+ * @param sceneCenterX Horizontal scene center.
76
+ * @param sceneCenterY Vertical scene center.
77
+ * @param cameraDistanceRatio Optional camera distance ratio.
78
+ * @returns Projected point.
79
+ *
80
+ * @private helper of the 3D avatar visuals
81
+ */
82
+ export declare function projectScenePoint(point: Point3D, size: number, sceneCenterX: number, sceneCenterY: number, cameraDistanceRatio?: number): ProjectedPoint;
83
+ /**
84
+ * Interpolates between two projected points.
85
+ *
86
+ * @param startPoint Start point.
87
+ * @param endPoint End point.
88
+ * @param ratio Interpolation ratio in the range `[0, 1]`.
89
+ * @returns Interpolated projected point.
90
+ *
91
+ * @private helper of the 3D avatar visuals
92
+ */
93
+ export declare function interpolateProjectedPoint(startPoint: ProjectedPoint, endPoint: ProjectedPoint, ratio: number): ProjectedPoint;
94
+ /**
95
+ * Subtracts one 3D point from another.
96
+ *
97
+ * @param leftPoint Left point.
98
+ * @param rightPoint Right point.
99
+ * @returns Difference vector.
100
+ *
101
+ * @private helper of the 3D avatar visuals
102
+ */
103
+ export declare function subtractPoint3D(leftPoint: Point3D, rightPoint: Point3D): Point3D;
104
+ /**
105
+ * Computes the 3D cross product of two vectors.
106
+ *
107
+ * @param leftVector Left vector.
108
+ * @param rightVector Right vector.
109
+ * @returns Cross product.
110
+ *
111
+ * @private helper of the 3D avatar visuals
112
+ */
113
+ export declare function crossProduct3D(leftVector: Point3D, rightVector: Point3D): Point3D;
114
+ /**
115
+ * Computes the 3D dot product of two vectors.
116
+ *
117
+ * @param leftVector Left vector.
118
+ * @param rightVector Right vector.
119
+ * @returns Dot product.
120
+ *
121
+ * @private helper of the 3D avatar visuals
122
+ */
123
+ export declare function dotProduct3D(leftVector: Point3D, rightVector: Point3D): number;
124
+ /**
125
+ * Normalizes one 3D vector while keeping zero vectors stable.
126
+ *
127
+ * @param vector Source vector.
128
+ * @returns Normalized vector.
129
+ *
130
+ * @private helper of the 3D avatar visuals
131
+ */
132
+ export declare function normalizeVector3(vector: Point3D): Point3D;
133
+ /**
134
+ * Measures the perimeter of one projected quad.
135
+ *
136
+ * @param corners Quad corners.
137
+ * @returns Perimeter length.
138
+ *
139
+ * @private helper of the 3D avatar visuals
140
+ */
141
+ export declare function getProjectedQuadPerimeter(corners: readonly [ProjectedPoint, ProjectedPoint, ProjectedPoint, ProjectedPoint]): number;
@@ -0,0 +1,7 @@
1
+ import type { AvatarVisualDefinition } from '../types/AvatarVisualDefinition';
2
+ /**
3
+ * Proper 3D Octopus visual built from projected organic meshes and tentacles.
4
+ *
5
+ * @private built-in avatar visual
6
+ */
7
+ export declare const octopus3dAvatarVisual: AvatarVisualDefinition;
@@ -11,13 +11,13 @@ export declare const AGENT_BOOK_FILE_PATH = "agent.book";
11
11
  */
12
12
  export declare const AGENT_MESSAGES_DIRECTORY_PATH = "messages";
13
13
  /**
14
- * Relative path to queued user messages consumed by `ptbk agent tick`.
14
+ * Relative path to queued user messages consumed by `ptbk agent run-once`.
15
15
  *
16
16
  * @private internal utility of `ptbk agent`
17
17
  */
18
18
  export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
19
19
  /**
20
- * Relative path to answered messages written by `ptbk agent tick`.
20
+ * Relative path to answered messages written by `ptbk agent run-once`.
21
21
  *
22
22
  * @private internal utility of `ptbk agent`
23
23
  */
@@ -0,0 +1,22 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ import { createAgentRunOptionsFromCliOptions } from './agentRunCliOptions';
4
+ /**
5
+ * Shared command-registration options for `ptbk agent` runner subcommands.
6
+ *
7
+ * @private internal utility of `ptbk agent`
8
+ */
9
+ type InitializeAgentRunnerCommandOptions = {
10
+ readonly commandName: string;
11
+ readonly aliases?: ReadonlyArray<string>;
12
+ readonly summary: string;
13
+ readonly featureLines: ReadonlyArray<string>;
14
+ readonly loadExecutor: () => Promise<(runOptions: ReturnType<typeof createAgentRunOptionsFromCliOptions>) => Promise<unknown>>;
15
+ };
16
+ /**
17
+ * Registers one runner-backed `ptbk agent` subcommand with the shared option and error handling flow.
18
+ *
19
+ * @private internal utility of `ptbk agent`
20
+ */
21
+ export declare function $initializeAgentRunnerCommand(program: Program, options: InitializeAgentRunnerCommandOptions): $side_effect;
22
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent run-multiple` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentRunMultipleCommand(program: Program): $side_effect;
@@ -5,8 +5,9 @@ import type { $side_effect } from '../../utils/organization/$side_effect';
5
5
  *
6
6
  * The agent command provides utilities for repository-backed message queues:
7
7
  * - init: Initialize local agent queue and instruction files
8
- * - tick: Answer one queued message and exit
9
- * - run: Watch the queue and answer messages one by one
8
+ * - run-once (alias: tick): Answer one queued message and exit
9
+ * - run-agent (alias: run): Watch one queue and answer messages one by one
10
+ * - run-multiple: Watch direct child agent repositories in one shared session
10
11
  *
11
12
  * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
12
13
  *
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,7 @@ import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutio
3
3
  import type { string_javascript_name } from '../../types/string_person_fullname';
4
4
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
5
5
  export { setTimeoutToolRuntimeAdapter } from './setTimeoutToolRuntimeAdapter';
6
- export type { CancelTimeoutToolResult, ListTimeoutsToolResult, SetTimeoutToolResult, TimeoutToolListItem, TimeoutToolRuntimeAdapter, TimeoutToolRuntimeContext, UpdateTimeoutToolResult } from './TimeoutToolRuntimeAdapter';
6
+ export type { CancelTimeoutToolResult, ListTimeoutsToolResult, SetTimeoutToolResult, TimeoutToolListItem, TimeoutToolRuntimeAdapter, TimeoutToolRuntimeContext, UpdateTimeoutToolResult, } from './TimeoutToolRuntimeAdapter';
7
7
  /**
8
8
  * `USE TIMEOUT` commitment definition.
9
9
  *
@@ -3,7 +3,7 @@ import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutio
3
3
  import type { string_javascript_name } from '../../types/string_person_fullname';
4
4
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
5
5
  export { setWalletToolRuntimeAdapter } from './setWalletToolRuntimeAdapter';
6
- export type { WalletRecordType, WalletToolRecord, WalletToolRuntimeAdapter, WalletToolRuntimeContext } from './WalletToolRuntimeAdapter';
6
+ export type { WalletRecordType, WalletToolRecord, WalletToolRuntimeAdapter, WalletToolRuntimeContext, } from './WalletToolRuntimeAdapter';
7
7
  /**
8
8
  * WALLET commitment definition.
9
9
  *
@@ -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.112.0-68`).
18
+ * It follows semantic versioning (e.g., `0.112.0-70`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/pdf",
3
- "version": "0.112.0-69",
3
+ "version": "0.112.0-71",
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,
@@ -98,7 +98,7 @@
98
98
  "types": "./esm/src/_packages/pdf.index.d.ts",
99
99
  "typings": "./esm/src/_packages/pdf.index.d.ts",
100
100
  "peerDependencies": {
101
- "@promptbook/core": "0.112.0-69"
101
+ "@promptbook/core": "0.112.0-71"
102
102
  },
103
103
  "dependencies": {
104
104
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-69';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-71';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2080,11 +2080,11 @@
2080
2080
  */
2081
2081
  function pipelineJsonToString(pipelineJson) {
2082
2082
  const { title, pipelineUrl, bookVersion, description, parameters, tasks } = pipelineJson;
2083
- let pipelineString = `# ${title}`;
2084
- if (description) {
2085
- pipelineString += '\n\n';
2086
- pipelineString += description;
2087
- }
2083
+ let pipelineString = spacetrim.spaceTrim((block) => `
2084
+ # ${title}
2085
+
2086
+ ${block(description || '')}
2087
+ `);
2088
2088
  const commands = [];
2089
2089
  if (pipelineUrl) {
2090
2090
  commands.push(`PIPELINE URL ${pipelineUrl}`);
@@ -2100,20 +2100,17 @@
2100
2100
  for (const parameter of parameters.filter(({ isOutput }) => isOutput)) {
2101
2101
  commands.push(`OUTPUT PARAMETER ${taskParameterJsonToString(parameter)}`);
2102
2102
  }
2103
- pipelineString += '\n\n';
2104
- pipelineString += commands.map((command) => `- ${command}`).join('\n');
2103
+ pipelineString = spacetrim.spaceTrim((block) => `
2104
+ ${block(pipelineString)}
2105
+
2106
+ ${block(commands.map((command) => `- ${command}`).join('\n'))}
2107
+ `);
2105
2108
  for (const task of tasks) {
2106
2109
  const {
2107
2110
  /* Note: Not using:> name, */
2108
2111
  title, description,
2109
2112
  /* Note: dependentParameterNames, */
2110
2113
  jokerParameterNames: jokers, taskType, content, postprocessingFunctionNames: postprocessing, expectations, format, resultingParameterName, } = task;
2111
- pipelineString += '\n\n';
2112
- pipelineString += `## ${title}`;
2113
- if (description) {
2114
- pipelineString += '\n\n';
2115
- pipelineString += description;
2116
- }
2117
2114
  const commands = [];
2118
2115
  let contentLanguage = 'text';
2119
2116
  if (taskType === 'PROMPT_TASK') {
@@ -2176,18 +2173,23 @@
2176
2173
  commands.push(`FORMAT JSON`);
2177
2174
  }
2178
2175
  } /* not else */
2179
- pipelineString += '\n\n';
2180
- pipelineString += commands.map((command) => `- ${command}`).join('\n');
2181
- pipelineString += '\n\n';
2182
- pipelineString += '```' + contentLanguage;
2183
- pipelineString += '\n';
2184
- pipelineString += spacetrim.spaceTrim(content);
2185
- // <- TODO: [main] !!3 Escape
2186
- // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2187
- pipelineString += '\n';
2188
- pipelineString += '```';
2189
- pipelineString += '\n\n';
2190
- pipelineString += `\`-> {${resultingParameterName}}\``; // <- TODO: [main] !!3 If the parameter here has description, add it and use taskParameterJsonToString
2176
+ pipelineString = spacetrim.spaceTrim((block) => `
2177
+ ${block(pipelineString)}
2178
+
2179
+ ## ${title}
2180
+
2181
+ ${block(description || '')}
2182
+
2183
+ ${block(commands.map((command) => `- ${command}`).join('\n'))}
2184
+
2185
+ \`\`\`${contentLanguage}
2186
+ ${block(spacetrim.spaceTrim(content))}
2187
+ \`\`\`
2188
+
2189
+ \`-> {${resultingParameterName}}\`
2190
+ `); // <- TODO: [main] !!3 If the parameter here has description, add it and use taskParameterJsonToString
2191
+ // <- TODO: [main] !!3 Escape
2192
+ // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2191
2193
  }
2192
2194
  return validatePipelineString(pipelineString);
2193
2195
  }