@promptbook/cli 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.
Files changed (28) hide show
  1. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +4 -1
  2. package/apps/agents-server/src/generated/reservedPaths.ts +1 -0
  3. package/apps/agents-server/src/utils/vpsConfiguration.ts +1 -0
  4. package/esm/index.es.js +15 -10
  5. package/esm/index.es.js.map +1 -1
  6. package/esm/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  7. package/esm/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  8. package/esm/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  9. package/esm/src/version.d.ts +1 -1
  10. package/package.json +1 -1
  11. package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +11 -28
  12. package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +10 -30
  13. package/src/book-components/Chat/Chat/CitationIframePreview.tsx +1 -6
  14. package/src/cli/cli-commands/coder/agentCodingFile.ts +1 -1
  15. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +2 -2
  16. package/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.ts +1 -1
  17. package/src/llm-providers/_common/register/$provideLlmToolsFromEnv.ts +1 -1
  18. package/src/llm-providers/anthropic-claude/register-configuration.ts +6 -3
  19. package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +3 -1
  20. package/src/other/templates/getTemplatesPipelineCollection.ts +956 -700
  21. package/src/version.ts +2 -2
  22. package/src/versions.txt +1 -0
  23. package/umd/index.umd.js +15 -10
  24. package/umd/index.umd.js.map +1 -1
  25. package/umd/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  26. package/umd/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  27. package/umd/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  28. package/umd/src/version.d.ts +1 -1
@@ -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/cli",
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,
@@ -7,10 +7,12 @@ const AGENT_REFERENCE_URL_PATTERN = 'https?:\\/\\/[^\\s{}]+';
7
7
 
8
8
  /**
9
9
  * Regex source for compact `@id` references.
10
+ * The negative lookbehind `(?<!\S)` ensures the `@` is preceded only by whitespace or is at the
11
+ * start of the string, so email addresses like `team@foo.bar` are not treated as agent references.
10
12
  *
11
13
  * @private function of BookEditorMonaco
12
14
  */
13
- const AGENT_REFERENCE_AT_PATTERN = '@[A-Za-z0-9_-]+';
15
+ const AGENT_REFERENCE_AT_PATTERN = '(?<!\\S)@[A-Za-z0-9_-]+';
14
16
 
15
17
  /**
16
18
  * Regex source for braced references (`{Agent}`, `{Agent Name}`, `{https://...}`).
@@ -27,28 +29,15 @@ const AGENT_REFERENCE_BRACED_PATTERN = '\\{[^{}\\r\\n]+\\}';
27
29
  const AGENT_REFERENCE_COMMITMENT_TYPES = ['FROM', 'IMPORT', 'IMPORTS', 'TEAM'] as const;
28
30
 
29
31
  /**
30
- * Commitment types known to the browser editor tokenizer.
32
+ * Regex matching any line that starts with one or more all-uppercase words (minimum 2 characters each).
33
+ * Used to detect commitment line boundaries without a hardcoded list of commitment types.
34
+ *
35
+ * Single-letter uppercase words (e.g. "V", "A") are excluded to avoid false positives with
36
+ * natural-language sentences that start with a short uppercase word.
31
37
  *
32
38
  * @private function of BookEditorMonaco
33
39
  */
34
- const BOOK_EDITOR_COMMITMENT_TYPES = [
35
- 'PERSONA',
36
- 'KNOWLEDGE',
37
- 'TASK',
38
- 'PROMPT',
39
- 'EXPECT',
40
- 'FORMAT',
41
- 'MODEL',
42
- 'SAMPLE',
43
- 'FROM',
44
- 'IMPORT',
45
- 'IMPORTS',
46
- 'TEAM',
47
- 'TODO',
48
- 'NOTE',
49
- 'NOTES',
50
- 'NONCE',
51
- ] as const;
40
+ const DYNAMIC_COMMITMENT_REGEX = /^\s*[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*(?=\s|$)/;
52
41
 
53
42
  /**
54
43
  * Regex pattern to match horizontal lines.
@@ -57,7 +46,7 @@ const BOOK_EDITOR_COMMITMENT_TYPES = [
57
46
  */
58
47
  const HORIZONTAL_LINE_PATTERN = /^[\s]*[-_*][\s]*[-_*][\s]*[-_*][\s]*[-_*]*[\s]*$/;
59
48
 
60
- const BOOK_EDITOR_COMMITMENT_LINE_REGEX = createCommitmentLineRegex(BOOK_EDITOR_COMMITMENT_TYPES);
49
+ const BOOK_EDITOR_COMMITMENT_LINE_REGEX = DYNAMIC_COMMITMENT_REGEX;
61
50
  const AGENT_REFERENCE_COMMITMENT_LINE_REGEX = createCommitmentLineRegex(AGENT_REFERENCE_COMMITMENT_TYPES);
62
51
 
63
52
  /**
@@ -204,13 +193,6 @@ const extractAgentReferenceMatches = (content: string): Array<AgentReferenceMatc
204
193
 
205
194
  const absoluteIndex = lineStartOffset + indexInLine;
206
195
 
207
- if (token.startsWith('@') && absoluteIndex > 0) {
208
- const previousChar = content[absoluteIndex - 1] || '';
209
- if (/[A-Za-z0-9_.-]/.test(previousChar)) {
210
- continue;
211
- }
212
- }
213
-
214
196
  const value = extractAgentReferenceValue(token);
215
197
  const url = resolveAgentReferenceToUrl(value);
216
198
 
@@ -348,6 +330,7 @@ function findBookBodyStartLineIndex(sourceLines: ReadonlyArray<string>): number
348
330
  * @private function of BookEditorMonaco
349
331
  */
350
332
  export const BookEditorMonacoTokenization = {
333
+ DYNAMIC_COMMITMENT_REGEX,
351
334
  AGENT_URL_REFERENCE_REGEX,
352
335
  AGENT_REFERENCE_TOKEN_REGEX,
353
336
  AGENT_REFERENCE_BRACED_REGEX,
@@ -204,32 +204,18 @@ function createCommitmentRegex(commitmentTypes: ReadonlyArray<string>): RegExp {
204
204
  }
205
205
 
206
206
  /**
207
- * Creates regex-token-state triples for note-like commitment groups available in this runtime.
207
+ * Creates regex-token-state triples for note-like commitment groups (TODO/NOTE/NOTES/NONCE).
208
208
  *
209
- * @param commitmentTypes - All known commitment types.
210
209
  * @returns Tokenization metadata for TODO/NOTE-like commitment groups.
211
210
  *
212
211
  * @private function of BookEditorMonaco
213
212
  */
214
- function createNoteLikeCommitmentStates(commitmentTypes: ReadonlyArray<string>): Array<NoteLikeCommitmentState> {
215
- const commitmentTypeSet = new Set(commitmentTypes.map((type) => type.toUpperCase()));
216
-
217
- return NOTE_LIKE_COMMITMENT_GROUPS.flatMap((group) => {
218
- const matchingCommitmentTypes = group.commitmentTypes.filter((type) =>
219
- commitmentTypeSet.has(type.toUpperCase()),
220
- );
221
- if (matchingCommitmentTypes.length === 0) {
222
- return [];
223
- }
224
-
225
- return [
226
- {
227
- regex: createCommitmentRegex(matchingCommitmentTypes),
228
- token: group.token,
229
- state: group.state,
230
- } satisfies NoteLikeCommitmentState,
231
- ];
232
- });
213
+ function createNoteLikeCommitmentStates(): Array<NoteLikeCommitmentState> {
214
+ return NOTE_LIKE_COMMITMENT_GROUPS.map((group) => ({
215
+ regex: createCommitmentRegex([...group.commitmentTypes]),
216
+ token: group.token,
217
+ state: group.state,
218
+ }));
233
219
  }
234
220
 
235
221
  /**
@@ -298,7 +284,7 @@ export function ensureBookEditorMonacoLanguage(
298
284
 
299
285
  monaco.languages.register({ id: BookEditorMonacoConstants.BOOK_LANGUAGE_ID });
300
286
 
301
- const commitmentTypes = [
287
+ const completionCommitmentTypes = [
302
288
  'GOAL',
303
289
  'RULE',
304
290
  'PERSONA',
@@ -317,13 +303,8 @@ export function ensureBookEditorMonacoLanguage(
317
303
  ...NOTE_COMMITMENT_TYPES,
318
304
  'REMOVE',
319
305
  ];
320
- const completionCommitmentTypes = [...commitmentTypes];
321
- const noteLikeCommitmentTypeSet = new Set<string>([...TODO_COMMITMENT_TYPES, ...NOTE_COMMITMENT_TYPES]);
322
- const noteLikeCommitmentStates = createNoteLikeCommitmentStates(commitmentTypes);
323
- const executableCommitmentTypes = commitmentTypes.filter(
324
- (type) => !noteLikeCommitmentTypeSet.has(type.toUpperCase()),
325
- );
326
- const commitmentRegex = createCommitmentRegex(executableCommitmentTypes);
306
+ const noteLikeCommitmentStates = createNoteLikeCommitmentStates();
307
+ const commitmentRegex = BookEditorMonacoTokenization.DYNAMIC_COMMITMENT_REGEX;
327
308
  const agentReferenceCommitmentRegex = /^\s*(FROM|IMPORT|IMPORTS|TEAM)(?=\s|$)/;
328
309
  const commitmentTransitionRules = createCommitmentTransitionRules(
329
310
  noteLikeCommitmentStates,
@@ -359,7 +340,6 @@ export function ensureBookEditorMonacoLanguage(
359
340
  const todoCommitmentBodyRules: any = createNoteLikeBodyRules('todo-commitment', commitmentTransitionRules);
360
341
 
361
342
  monaco.languages.setMonarchTokensProvider(BookEditorMonacoConstants.BOOK_LANGUAGE_ID, {
362
- ignoreCase: true,
363
343
  tokenizer: {
364
344
  root: [
365
345
  [/^\s*$/, 'empty'],
@@ -67,12 +67,7 @@ export function CitationIframePreview({ src, title }: CitationIframePreviewProps
67
67
  alt={`Screenshot of ${title}`}
68
68
  className={styles.citationScreenshotImage}
69
69
  />
70
- <a
71
- href={src}
72
- target="_blank"
73
- rel="noopener noreferrer"
74
- className={styles.citationScreenshotLink}
75
- >
70
+ <a href={src} target="_blank" rel="noopener noreferrer" className={styles.citationScreenshotLink}>
76
71
  Open in new tab ↗
77
72
  </a>
78
73
  </div>
@@ -45,7 +45,7 @@ export function getDefaultCoderAgentCodingFileContent({
45
45
  6. Use \`npm run coder:verify\` to archive finished prompts into \`${formatDisplayPath(
46
46
  PROMPTS_DONE_DIRECTORY_PATH,
47
47
  )}/\` and append repair follow-up prompts when more work is needed.
48
- 7. Use \`npm run coder:find-refactor-candidates\` when you want Promptbook to suggest refactor prompts automatically.
48
+ 7. Use \`ptbk coder find-refactor-candidates\` when you want Promptbook to suggest refactor prompts automatically.
49
49
 
50
50
  ## Templates
51
51
  - Project-owned templates created by \`ptbk coder init\`: ${formatInlineCodeList(
@@ -4,8 +4,8 @@
4
4
  const DEFAULT_CODER_PACKAGE_JSON_SCRIPTS = {
5
5
  'coder:generate-boilerplates': 'ptbk coder generate-boilerplates --template ./prompts/templates/common.md',
6
6
  'coder:run':
7
- 'ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --no-wait',
8
- 'coder:find-refactor-candidates': 'ptbk coder find-refactor-candidates',
7
+ 'ptbk coder run --harness openai-codex --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --no-wait',
8
+ // 'coder:find-refactor-candidates': 'ptbk coder find-refactor-candidates',
9
9
  'coder:verify': 'ptbk coder verify',
10
10
  } as const satisfies Readonly<Record<string, string>>;
11
11
 
@@ -13,7 +13,7 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
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
  * @see Environment variables documentation or .env file for required variables.
@@ -22,7 +22,7 @@ import { createLlmToolsFromConfiguration } from './createLlmToolsFromConfigurati
22
22
  *
23
23
  * It looks for environment variables:
24
24
  * - `process.env.OPENAI_API_KEY`
25
- * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
25
+ * - `process.env.ANTHROPIC_API_KEY` (or the deprecated `process.env.ANTHROPIC_CLAUDE_API_KEY`)
26
26
  * - ...
27
27
  *
28
28
  * @param options Configuration options for the LLM tools
@@ -19,7 +19,7 @@ export const _AnthropicClaudeMetadataRegistration: Registration = $llmToolsMetad
19
19
  title: 'Anthropic Claude',
20
20
  packageName: '@promptbook/anthropic-claude',
21
21
  className: 'AnthropicClaudeExecutionTools',
22
- envVariables: ['ANTHROPIC_CLAUDE_API_KEY'],
22
+ envVariables: ['ANTHROPIC_API_KEY', 'ANTHROPIC_CLAUDE_API_KEY'],
23
23
  trustLevel: 'CLOSED',
24
24
  order: MODEL_ORDERS.TOP_TIER,
25
25
 
@@ -39,13 +39,16 @@ export const _AnthropicClaudeMetadataRegistration: Registration = $llmToolsMetad
39
39
 
40
40
  createConfigurationFromEnv(env: Record<string_name, string>): LlmToolsConfiguration[number] | null {
41
41
  // Note: Note using `process.env` BUT `env` to pass in the environment variables dynamically
42
- if (typeof env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
42
+ // Note: `ANTHROPIC_API_KEY` takes precedence over the deprecated `ANTHROPIC_CLAUDE_API_KEY`
43
+ const apiKey = env.ANTHROPIC_API_KEY ?? env.ANTHROPIC_CLAUDE_API_KEY;
44
+
45
+ if (typeof apiKey === 'string') {
43
46
  return {
44
47
  title: 'Claude (from env)',
45
48
  packageName: '@promptbook/anthropic-claude',
46
49
  className: 'AnthropicClaudeExecutionTools',
47
50
  options: {
48
- apiKey: env.ANTHROPIC_CLAUDE_API_KEY!,
51
+ apiKey,
49
52
  } satisfies AnthropicClaudeExecutionToolsOptions,
50
53
  };
51
54
  }
@@ -449,7 +449,9 @@ export class OpenAiAgentKitExecutionToolsToolBuilder {
449
449
  );
450
450
  }
451
451
 
452
- return Array.isArray(executionTools.script) ? executionTools.script : [executionTools.script as ScriptExecutionTools];
452
+ return Array.isArray(executionTools.script)
453
+ ? executionTools.script
454
+ : [executionTools.script as ScriptExecutionTools];
453
455
  }
454
456
 
455
457
  /**