@promptbook/templates 0.104.0 → 0.105.0-0

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.
@@ -47,6 +47,7 @@ import { PENDING_VALUE_PLACEHOLDER } from '../config';
47
47
  import { MAX_FILENAME_LENGTH } from '../config';
48
48
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
49
49
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
50
+ import { DEFAULT_MAX_RECURSION } from '../config';
50
51
  import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config';
51
52
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config';
52
53
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config';
@@ -244,6 +245,7 @@ export { PENDING_VALUE_PLACEHOLDER };
244
245
  export { MAX_FILENAME_LENGTH };
245
246
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
246
247
  export { DEFAULT_MAX_PARALLEL_COUNT };
248
+ export { DEFAULT_MAX_RECURSION };
247
249
  export { DEFAULT_MAX_EXECUTION_ATTEMPTS };
248
250
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH };
249
251
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL };
@@ -28,6 +28,10 @@ export type AgentModelRequirements = {
28
28
  * - 3) `parentAgentUrl` is not defined `undefined`, the default ancestor agent, Adam, will be used
29
29
  */
30
30
  readonly parentAgentUrl?: string_agent_url | null;
31
+ /**
32
+ * List of imported agent URLs
33
+ */
34
+ readonly importedAgentUrls?: ReadonlyArray<string_agent_url>;
31
35
  /**
32
36
  * Optional list of knowledge source links that the agent can use
33
37
  */
@@ -33,6 +33,23 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
33
33
  * Indicates if the message was sent via a voice call
34
34
  */
35
35
  isVoiceCall?: boolean;
36
+ /**
37
+ * Optional file attachments
38
+ */
39
+ attachments?: Array<{
40
+ /**
41
+ * The name of the file
42
+ */
43
+ name: string;
44
+ /**
45
+ * The type of the file
46
+ */
47
+ type: string;
48
+ /**
49
+ * The URL where the file is stored
50
+ */
51
+ url: string;
52
+ }>;
36
53
  };
37
54
  /**
38
55
  * TODO: Make all fields readonly
@@ -0,0 +1,34 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * IMPORT commitment definition
5
+ *
6
+ * The IMPORT commitment tells the agent to import content from another agent at the current location.
7
+ *
8
+ * Example usage in agent source:
9
+ *
10
+ * ```book
11
+ * IMPORT https://s6.ptbk.io/benjamin-white
12
+ * ```
13
+ *
14
+ * @private [🪔] Maybe export the commitments through some package
15
+ */
16
+ export declare class ImportCommitmentDefinition extends BaseCommitmentDefinition<'IMPORT' | 'IMPORTS'> {
17
+ constructor(type?: 'IMPORT' | 'IMPORTS');
18
+ /**
19
+ * Short one-line description of IMPORT.
20
+ */
21
+ get description(): string;
22
+ /**
23
+ * Icon for this commitment.
24
+ */
25
+ get icon(): string;
26
+ /**
27
+ * Markdown documentation for IMPORT commitment.
28
+ */
29
+ get documentation(): string;
30
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
31
+ }
32
+ /**
33
+ * Note: [💞] Ignore a discrepancy between file name and entity name
34
+ */
@@ -7,6 +7,7 @@ import { DeleteCommitmentDefinition } from './DELETE/DELETE';
7
7
  import { DictionaryCommitmentDefinition } from './DICTIONARY/DICTIONARY';
8
8
  import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
9
9
  import { FromCommitmentDefinition } from './FROM/FROM';
10
+ import { ImportCommitmentDefinition } from './IMPORT/IMPORT';
10
11
  import { GoalCommitmentDefinition } from './GOAL/GOAL';
11
12
  import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
12
13
  import { LanguageCommitmentDefinition } from './LANGUAGE/LANGUAGE';
@@ -40,7 +41,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
40
41
  *
41
42
  * @private Use functions to access commitments instead of this array directly
42
43
  */
43
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
44
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
44
45
  /**
45
46
  * Gets a commitment definition by its type
46
47
  * @param type The commitment type to look up
@@ -213,6 +213,12 @@ export declare const DEFAULT_INTERMEDIATE_FILES_STRATEGY: IntermediateFilesStrat
213
213
  * @public exported from `@promptbook/core`
214
214
  */
215
215
  export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
216
+ /**
217
+ * The maximum depth to which recursion can occur
218
+ *
219
+ * @public exported from `@promptbook/core`
220
+ */
221
+ export declare const DEFAULT_MAX_RECURSION = 10;
216
222
  /**
217
223
  * The maximum number of attempts to execute LLM task before giving up
218
224
  *
@@ -4,4 +4,4 @@ import type { ErrorJson } from './ErrorJson';
4
4
  *
5
5
  * @public exported from `@promptbook/utils`
6
6
  */
7
- export declare function deserializeError(error: ErrorJson): Error;
7
+ export declare function deserializeError(error: ErrorJson, isStackAddedToMessage?: boolean): Error;
@@ -1,4 +1,5 @@
1
1
  import type { string_date_iso8601, string_model_name, string_prompt } from '../types/typeAliases';
2
+ import type { TODO_any } from '../utils/organization/TODO_any';
2
3
  import type { TODO_object } from '../utils/organization/TODO_object';
3
4
  import type { EmbeddingVector } from './EmbeddingVector';
4
5
  import type { Usage } from './Usage';
@@ -21,7 +22,29 @@ export type CompletionPromptResult = CommonPromptResult;
21
22
  *
22
23
  * Note: [🚉] This is fully serializable as JSON
23
24
  */
24
- export type ChatPromptResult = CommonPromptResult & {};
25
+ export type ChatPromptResult = CommonPromptResult & {
26
+ /**
27
+ * Optional tool calls made during the execution
28
+ */
29
+ readonly toolCalls?: ReadonlyArray<{
30
+ /**
31
+ * Name of the tool
32
+ */
33
+ readonly name: string;
34
+ /**
35
+ * Arguments of the tool call
36
+ */
37
+ readonly arguments: string;
38
+ /**
39
+ * Result of the tool call
40
+ */
41
+ readonly result: string;
42
+ /**
43
+ * Raw tool call from the model
44
+ */
45
+ readonly rawToolCall: TODO_any;
46
+ }>;
47
+ };
25
48
  /**
26
49
  * Image prompt result
27
50
  *
@@ -1,5 +1,6 @@
1
1
  import type { ClientOptions } from 'openai';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
3
4
  import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
4
5
  /**
5
6
  * Options for `createOpenAiCompatibleExecutionTools` and `OpenAiCompatibleExecutionTools`
@@ -28,6 +29,10 @@ export type OpenAiCompatibleExecutionToolsNonProxiedOptions = CommonToolsOptions
28
29
  * @example 'https://api.deepseek.com/v1' (DeepSeek)
29
30
  */
30
31
  baseURL?: string;
32
+ /**
33
+ * Tools for executing the scripts
34
+ */
35
+ readonly executionTools?: Pick<ExecutionTools, 'script'>;
31
36
  isProxied?: false;
32
37
  };
33
38
  /**
@@ -16,5 +16,12 @@ export type LlmToolDefinition = {
16
16
  /**
17
17
  * Parameters of the tool in JSON Schema format
18
18
  */
19
- readonly parameters: Record<string, unknown>;
19
+ readonly parameters: {
20
+ readonly type: 'object';
21
+ readonly properties: Record<string, {
22
+ type: string;
23
+ description?: string;
24
+ }>;
25
+ readonly required?: string[];
26
+ };
20
27
  };
@@ -1,6 +1,7 @@
1
1
  import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
2
2
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
3
3
  import type { Expectations } from '../pipeline/PipelineJson/Expectations';
4
+ import type { LlmToolDefinition } from './LlmToolDefinition';
4
5
  import type { ChatModelRequirements } from './ModelRequirements';
5
6
  import type { CompletionModelRequirements } from './ModelRequirements';
6
7
  import type { EmbeddingModelRequirements } from './ModelRequirements';
@@ -44,6 +45,18 @@ export type ChatPrompt = CommonPrompt & {
44
45
  * Optional chat thread (history of previous messages)
45
46
  */
46
47
  thread?: ChatMessage[];
48
+ /**
49
+ * Optional file attachments
50
+ */
51
+ attachments?: Array<{
52
+ name: string;
53
+ type: string;
54
+ url: string;
55
+ }>;
56
+ /**
57
+ * Optional tools that can be called by the model
58
+ */
59
+ tools?: Array<LlmToolDefinition>;
47
60
  };
48
61
  /**
49
62
  * Image prompt
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @public exported from `@promptbook/utils`
12
12
  */
13
- export declare function parseNumber(value: string | number): number;
13
+ export declare function parseNumber(value: string | number | null | undefined): number;
14
14
  /**
15
15
  * TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
16
16
  * TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
@@ -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.104.0-19`).
18
+ * It follows semantic versioning (e.g., `0.104.0`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/templates",
3
- "version": "0.104.0",
3
+ "version": "0.105.0-0",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/templates.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.104.0"
98
+ "@promptbook/core": "0.105.0-0"
99
99
  },
100
100
  "dependencies": {
101
101
  "spacetrim": "0.11.60"