@promptbook/components 0.112.0-119 → 0.112.0-121

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.
@@ -15,6 +15,7 @@ type AgentReferenceMatch = {
15
15
  * @private function of BookEditorMonaco
16
16
  */
17
17
  export declare const BookEditorMonacoTokenization: {
18
+ DYNAMIC_COMMITMENT_REGEX: RegExp;
18
19
  AGENT_URL_REFERENCE_REGEX: RegExp;
19
20
  AGENT_REFERENCE_TOKEN_REGEX: RegExp;
20
21
  AGENT_REFERENCE_BRACED_REGEX: RegExp;
@@ -6,7 +6,7 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
6
6
  *
7
7
  * It looks for environment variables:
8
8
  * - `process.env.OPENAI_API_KEY`
9
- * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
9
+ * - `process.env.ANTHROPIC_API_KEY` (or the deprecated `process.env.ANTHROPIC_CLAUDE_API_KEY`)
10
10
  * - ...
11
11
  *
12
12
  * @see Environment variables documentation or .env file for required variables.
@@ -13,7 +13,7 @@ import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFro
13
13
  *
14
14
  * It looks for environment variables:
15
15
  * - `process.env.OPENAI_API_KEY`
16
- * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
16
+ * - `process.env.ANTHROPIC_API_KEY` (or the deprecated `process.env.ANTHROPIC_CLAUDE_API_KEY`)
17
17
  * - ...
18
18
  *
19
19
  * @param options Configuration options for the LLM tools
@@ -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-118`).
18
+ * It follows semantic versioning (e.g., `0.112.0-119`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/components",
3
- "version": "0.112.0-119",
3
+ "version": "0.112.0-121",
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,
package/umd/index.umd.js CHANGED
@@ -34,7 +34,7 @@
34
34
  * @generated
35
35
  * @see https://github.com/webgptorg/promptbook
36
36
  */
37
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-119';
37
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-121';
38
38
  /**
39
39
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
40
40
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -22700,10 +22700,12 @@
22700
22700
  const AGENT_REFERENCE_URL_PATTERN = 'https?:\\/\\/[^\\s{}]+';
22701
22701
  /**
22702
22702
  * Regex source for compact `@id` references.
22703
+ * The negative lookbehind `(?<!\S)` ensures the `@` is preceded only by whitespace or is at the
22704
+ * start of the string, so email addresses like `team@foo.bar` are not treated as agent references.
22703
22705
  *
22704
22706
  * @private function of BookEditorMonaco
22705
22707
  */
22706
- const AGENT_REFERENCE_AT_PATTERN = '@[A-Za-z0-9_-]+';
22708
+ const AGENT_REFERENCE_AT_PATTERN = '(?<!\\S)@[A-Za-z0-9_-]+';
22707
22709
  /**
22708
22710
  * Regex source for braced references (`{Agent}`, `{Agent Name}`, `{https://...}`).
22709
22711
  *
@@ -22717,35 +22719,22 @@
22717
22719
  */
22718
22720
  const AGENT_REFERENCE_COMMITMENT_TYPES = ['FROM', 'IMPORT', 'IMPORTS', 'TEAM'];
22719
22721
  /**
22720
- * Commitment types known to the browser editor tokenizer.
22722
+ * Regex matching any line that starts with one or more all-uppercase words (minimum 2 characters each).
22723
+ * Used to detect commitment line boundaries without a hardcoded list of commitment types.
22724
+ *
22725
+ * Single-letter uppercase words (e.g. "V", "A") are excluded to avoid false positives with
22726
+ * natural-language sentences that start with a short uppercase word.
22721
22727
  *
22722
22728
  * @private function of BookEditorMonaco
22723
22729
  */
22724
- const BOOK_EDITOR_COMMITMENT_TYPES = [
22725
- 'PERSONA',
22726
- 'KNOWLEDGE',
22727
- 'TASK',
22728
- 'PROMPT',
22729
- 'EXPECT',
22730
- 'FORMAT',
22731
- 'MODEL',
22732
- 'SAMPLE',
22733
- 'FROM',
22734
- 'IMPORT',
22735
- 'IMPORTS',
22736
- 'TEAM',
22737
- 'TODO',
22738
- 'NOTE',
22739
- 'NOTES',
22740
- 'NONCE',
22741
- ];
22730
+ const DYNAMIC_COMMITMENT_REGEX = /^\s*[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*(?=\s|$)/;
22742
22731
  /**
22743
22732
  * Regex pattern to match horizontal lines.
22744
22733
  *
22745
22734
  * @private function of BookEditorMonaco
22746
22735
  */
22747
22736
  const HORIZONTAL_LINE_PATTERN$1 = /^[\s]*[-_*][\s]*[-_*][\s]*[-_*][\s]*[-_*]*[\s]*$/;
22748
- const BOOK_EDITOR_COMMITMENT_LINE_REGEX = createCommitmentLineRegex(BOOK_EDITOR_COMMITMENT_TYPES);
22737
+ const BOOK_EDITOR_COMMITMENT_LINE_REGEX = DYNAMIC_COMMITMENT_REGEX;
22749
22738
  const AGENT_REFERENCE_COMMITMENT_LINE_REGEX = createCommitmentLineRegex(AGENT_REFERENCE_COMMITMENT_TYPES);
22750
22739
  /**
22751
22740
  * Agent reference helpers for `BookEditorMonaco`.
@@ -22844,12 +22833,6 @@
22844
22833
  continue;
22845
22834
  }
22846
22835
  const absoluteIndex = lineStartOffset + indexInLine;
22847
- if (token.startsWith('@') && absoluteIndex > 0) {
22848
- const previousChar = content[absoluteIndex - 1] || '';
22849
- if (/[A-Za-z0-9_.-]/.test(previousChar)) {
22850
- continue;
22851
- }
22852
- }
22853
22836
  const value = extractAgentReferenceValue(token);
22854
22837
  const url = resolveAgentReferenceToUrl(value);
22855
22838
  if (!url) {
@@ -22961,6 +22944,7 @@
22961
22944
  * @private function of BookEditorMonaco
22962
22945
  */
22963
22946
  const BookEditorMonacoTokenization = {
22947
+ DYNAMIC_COMMITMENT_REGEX,
22964
22948
  AGENT_URL_REFERENCE_REGEX,
22965
22949
  AGENT_REFERENCE_TOKEN_REGEX,
22966
22950
  AGENT_REFERENCE_BRACED_REGEX,
@@ -23109,28 +23093,18 @@
23109
23093
  return new RegExp(`^\\s*(${commitmentPatterns})(?=\\s|$)`);
23110
23094
  }
23111
23095
  /**
23112
- * Creates regex-token-state triples for note-like commitment groups available in this runtime.
23096
+ * Creates regex-token-state triples for note-like commitment groups (TODO/NOTE/NOTES/NONCE).
23113
23097
  *
23114
- * @param commitmentTypes - All known commitment types.
23115
23098
  * @returns Tokenization metadata for TODO/NOTE-like commitment groups.
23116
23099
  *
23117
23100
  * @private function of BookEditorMonaco
23118
23101
  */
23119
- function createNoteLikeCommitmentStates(commitmentTypes) {
23120
- const commitmentTypeSet = new Set(commitmentTypes.map((type) => type.toUpperCase()));
23121
- return NOTE_LIKE_COMMITMENT_GROUPS.flatMap((group) => {
23122
- const matchingCommitmentTypes = group.commitmentTypes.filter((type) => commitmentTypeSet.has(type.toUpperCase()));
23123
- if (matchingCommitmentTypes.length === 0) {
23124
- return [];
23125
- }
23126
- return [
23127
- {
23128
- regex: createCommitmentRegex(matchingCommitmentTypes),
23129
- token: group.token,
23130
- state: group.state,
23131
- },
23132
- ];
23133
- });
23102
+ function createNoteLikeCommitmentStates() {
23103
+ return NOTE_LIKE_COMMITMENT_GROUPS.map((group) => ({
23104
+ regex: createCommitmentRegex([...group.commitmentTypes]),
23105
+ token: group.token,
23106
+ state: group.state,
23107
+ }));
23134
23108
  }
23135
23109
  /**
23136
23110
  * Builds tokenizer rules that switch between commitment-level Monaco states.
@@ -23182,7 +23156,7 @@
23182
23156
  monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG] = true;
23183
23157
  monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
23184
23158
  monaco.languages.register({ id: BookEditorMonacoConstants.BOOK_LANGUAGE_ID });
23185
- const commitmentTypes = [
23159
+ const completionCommitmentTypes = [
23186
23160
  'GOAL',
23187
23161
  'RULE',
23188
23162
  'PERSONA',
@@ -23201,11 +23175,8 @@
23201
23175
  ...NOTE_COMMITMENT_TYPES,
23202
23176
  'REMOVE',
23203
23177
  ];
23204
- const completionCommitmentTypes = [...commitmentTypes];
23205
- const noteLikeCommitmentTypeSet = new Set([...TODO_COMMITMENT_TYPES, ...NOTE_COMMITMENT_TYPES]);
23206
- const noteLikeCommitmentStates = createNoteLikeCommitmentStates(commitmentTypes);
23207
- const executableCommitmentTypes = commitmentTypes.filter((type) => !noteLikeCommitmentTypeSet.has(type.toUpperCase()));
23208
- const commitmentRegex = createCommitmentRegex(executableCommitmentTypes);
23178
+ const noteLikeCommitmentStates = createNoteLikeCommitmentStates();
23179
+ const commitmentRegex = BookEditorMonacoTokenization.DYNAMIC_COMMITMENT_REGEX;
23209
23180
  const agentReferenceCommitmentRegex = /^\s*(FROM|IMPORT|IMPORTS|TEAM)(?=\s|$)/;
23210
23181
  const commitmentTransitionRules = createCommitmentTransitionRules(noteLikeCommitmentStates, agentReferenceCommitmentRegex, commitmentRegex);
23211
23182
  const parameterRegex = /@([a-zA-Z0-9_á-žÁ-Žč-řČ-Řš-žŠ-Žа-яА-ЯёЁ]+)/;
@@ -23231,7 +23202,6 @@
23231
23202
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23232
23203
  const todoCommitmentBodyRules = createNoteLikeBodyRules('todo-commitment', commitmentTransitionRules);
23233
23204
  monaco.languages.setMonarchTokensProvider(BookEditorMonacoConstants.BOOK_LANGUAGE_ID, {
23234
- ignoreCase: true,
23235
23205
  tokenizer: {
23236
23206
  root: [
23237
23207
  [/^\s*$/, 'empty'],
@@ -50120,7 +50090,9 @@
50120
50090
  if (!executionTools || !executionTools.script) {
50121
50091
  throw new PipelineExecutionError(`Model requested tools but no executionTools.script were provided in OpenAiAgentKitExecutionTools options`);
50122
50092
  }
50123
- return Array.isArray(executionTools.script) ? executionTools.script : [executionTools.script];
50093
+ return Array.isArray(executionTools.script)
50094
+ ? executionTools.script
50095
+ : [executionTools.script];
50124
50096
  }
50125
50097
  /**
50126
50098
  * Resolves the assistant-visible AgentKit tool response while preserving structured tool result data.