@promptbook/components 0.114.0-0 → 0.114.0-2

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.
@@ -86,9 +86,7 @@ export type BookLanguageManualDictionary = {
86
86
  readonly metadataLabels: {
87
87
  readonly bookLanguageVersion: string;
88
88
  readonly generatedAt: string;
89
- readonly commitmentGroups: string;
90
- readonly implementedCommitments: string;
91
- readonly placeholderCommitments: string;
89
+ readonly commitmentCount: string;
92
90
  };
93
91
  /**
94
92
  * Heading of the table of contents.
@@ -128,7 +126,6 @@ export type BookLanguageManualDictionary = {
128
126
  readonly primitivesSections: {
129
127
  readonly coreSyntax: BookLanguageManualChapter;
130
128
  readonly references: BookLanguageManualChapter;
131
- readonly keywordsTitle: string;
132
129
  };
133
130
  /**
134
131
  * Suffixes distinguishing a server-specific catalog from the portable one.
@@ -141,18 +138,7 @@ export type BookLanguageManualDictionary = {
141
138
  * Labels used in every commitment catalog entry.
142
139
  */
143
140
  readonly commitmentLabels: {
144
- readonly status: string;
145
141
  readonly aliases: string;
146
- readonly semantics: string;
147
- readonly typeSchema: string;
148
- readonly blockSchema: string;
149
- readonly lowLevelNotice: string;
150
- readonly usage: string;
151
- readonly usageOccurrence: string;
152
- readonly usageOccurrences: string;
153
- readonly statusImplemented: string;
154
- readonly statusPlaceholder: string;
155
- readonly noAliases: string;
156
142
  };
157
143
  /**
158
144
  * Labels used by end-to-end example sections.
@@ -16,7 +16,7 @@ export type BookLanguageManualCommitmentGroups = {
16
16
  */
17
17
  readonly documented: ReadonlyArray<BookLanguageManualCommitmentGroup>;
18
18
  /**
19
- * Low-level and unfinished commitments documented in their own closing chapter.
19
+ * Low-level commitments documented in their own closing chapter.
20
20
  */
21
21
  readonly lowLevel: ReadonlyArray<BookLanguageManualCommitmentGroup>;
22
22
  };
@@ -10,10 +10,6 @@ export type RenderCommitmentCatalogSectionOptions = {
10
10
  * Grouped commitment definition with aliases.
11
11
  */
12
12
  readonly groupedCommitment: BookLanguageManualCommitmentGroup;
13
- /**
14
- * Number of uses across the selected server agents.
15
- */
16
- readonly usageCount: number;
17
13
  /**
18
14
  * Translated labels of the manual.
19
15
  */
@@ -25,6 +25,13 @@ export type MarkdownInlineReference = {
25
25
  * Link target for the rendered reference.
26
26
  */
27
27
  readonly href: string;
28
+ /**
29
+ * Markdown link destination prefixes that should render as this reference as well.
30
+ *
31
+ * This supports legacy links such as an Agents Server project file URL while keeping
32
+ * `reference` as the canonical `[[project]]` token.
33
+ */
34
+ readonly sourceHrefPrefixes?: ReadonlyArray<string>;
28
35
  /**
29
36
  * Optional hover title for the rendered reference.
30
37
  */
@@ -1,3 +1,4 @@
1
+ import { string_markdown } from '../../../types/typeAliases';
1
2
  /**
2
3
  * Relative path to the Promptbook Coder quick-reference file initialized in project roots.
3
4
  *
@@ -9,6 +10,4 @@ export declare const AGENT_CODING_FILE_PATH = "AGENT_CODING.md";
9
10
  *
10
11
  * @private internal utility of `ptbk coder`
11
12
  */
12
- export declare function getDefaultCoderAgentCodingFileContent({ packageJsonScripts, }: {
13
- readonly packageJsonScripts: Readonly<Record<string, string>>;
14
- }): string;
13
+ export declare function getDefaultCoderAgentCodingFileContent(): string_markdown;
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `coder ping` command for Promptbook CLI utilities.
5
+ *
6
+ * The command makes one small, isolated harness/model call, prints its result
7
+ * and reports how long the harness/model turn took.
8
+ *
9
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
10
+ *
11
+ * @private internal function of `promptbookCli`
12
+ */
13
+ export declare function $initializeCoderPingCommand(program: Program): $side_effect;
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import type { $side_effect } from '../../utils/organization/$side_effect';
8
8
  * - add: Add one ready-to-run prompt file to the queue
9
9
  * - generate-boilerplates: Generate prompt boilerplate files
10
10
  * - find-refactor-candidates: Find files that need refactoring
11
+ * - ping: Test one harness and model connection with a disposable task
11
12
  * - run: Run coding prompts with AI agents
12
13
  * - verify: Verify completed prompts
13
14
  * - find-fresh-emoji-tags: Find unused emoji tags
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/components",
3
- "version": "0.114.0-0",
3
+ "version": "0.114.0-2",
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.114.0-0';
37
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-2';
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
@@ -28086,6 +28086,14 @@
28086
28086
  * @private utility of `renderMarkdown`
28087
28087
  */
28088
28088
  const INLINE_REFERENCE_REGEX = /\[\[([^\]\r\n]+?)\]\]/g;
28089
+ /**
28090
+ * Pattern matching ordinary markdown links that can be promoted to inline reference chips.
28091
+ *
28092
+ * Images are intentionally captured separately and left unchanged by the replacement helper.
28093
+ *
28094
+ * @private utility of `renderMarkdown`
28095
+ */
28096
+ const MARKDOWN_INLINE_REFERENCE_LINK_REGEX = /(!?)\[([^\]\r\n]*)\]\(\s*(<[^>\r\n]+>|[^)\s]+)(?:\s+(?:"[^"\r\n]*"|'[^'\r\n]*'|\([^)]*\)))?\s*\)/g;
28089
28097
  /**
28090
28098
  * Collection of math delimiter definitions.
28091
28099
  */
@@ -28323,11 +28331,12 @@
28323
28331
  * outer `<details>` and optional `<summary>` markup untouched.
28324
28332
  *
28325
28333
  * @param detailsBlock - Raw `<details>...</details>` HTML captured from markdown.
28334
+ * @param options - Markdown rendering options to reuse for the details body.
28326
28335
  * @returns `<details>` HTML whose body has been converted from markdown to HTML.
28327
28336
  *
28328
28337
  * @private utility of `renderMarkdown`
28329
28338
  */
28330
- function renderDetailsBlock(detailsBlock) {
28339
+ function renderDetailsBlock(detailsBlock, options) {
28331
28340
  var _a, _b;
28332
28341
  const openTagMatch = detailsBlock.match(/^<details\b[^>]*>/i);
28333
28342
  const closeTagMatch = detailsBlock.match(/<\/details\s*>$/i);
@@ -28340,7 +28349,7 @@
28340
28349
  const summaryMatch = innerContent.match(/^(\s*<summary\b[^>]*>[\s\S]*?<\/summary\s*>)([\s\S]*)$/i);
28341
28350
  const summaryHtml = (_a = summaryMatch === null || summaryMatch === void 0 ? void 0 : summaryMatch[1]) !== null && _a !== void 0 ? _a : '';
28342
28351
  const bodyMarkdown = ((_b = summaryMatch === null || summaryMatch === void 0 ? void 0 : summaryMatch[2]) !== null && _b !== void 0 ? _b : innerContent);
28343
- const renderedBody = renderMarkdown(bodyMarkdown);
28352
+ const renderedBody = renderMarkdown(bodyMarkdown, options);
28344
28353
  return `${openTag}${summaryHtml}${renderedBody}${closeTag}`;
28345
28354
  }
28346
28355
  /**
@@ -28377,16 +28386,17 @@
28377
28386
  * processes their content.
28378
28387
  *
28379
28388
  * @param markdown - Markdown text that may contain raw HTML `<details>` blocks.
28389
+ * @param options - Markdown rendering options to reuse for the details body.
28380
28390
  * @returns Masked markdown and a restore helper that returns `string_html`.
28381
28391
  *
28382
28392
  * @private utility of `renderMarkdown`
28383
28393
  */
28384
- function maskDetailsBlocks(markdown) {
28394
+ function maskDetailsBlocks(markdown, options) {
28385
28395
  const blocks = [];
28386
28396
  DETAILS_BLOCK_REGEX.lastIndex = 0;
28387
28397
  const masked = markdown.replace(DETAILS_BLOCK_REGEX, (match) => {
28388
28398
  const placeholder = `${DETAILS_PLACEHOLDER_PREFIX}${blocks.length}__`;
28389
- blocks.push(renderDetailsBlock(match));
28399
+ blocks.push(renderDetailsBlock(match, options));
28390
28400
  return placeholder;
28391
28401
  });
28392
28402
  return {
@@ -28487,6 +28497,79 @@
28487
28497
  }
28488
28498
  return referenceByKey;
28489
28499
  }
28500
+ /**
28501
+ * Returns whether a href starts with a configured source href prefix.
28502
+ *
28503
+ * @param href - Markdown link destination.
28504
+ * @param sourceHrefPrefix - Configured source href prefix.
28505
+ * @returns Whether the href belongs to the source prefix.
28506
+ *
28507
+ * @private utility of `renderMarkdown`
28508
+ */
28509
+ function doesHrefStartWithSourceHrefPrefix(href, sourceHrefPrefix) {
28510
+ if (href === sourceHrefPrefix) {
28511
+ return true;
28512
+ }
28513
+ const normalizedSourceHrefPrefix = sourceHrefPrefix.endsWith('/') ? sourceHrefPrefix : `${sourceHrefPrefix}/`;
28514
+ return href.startsWith(normalizedSourceHrefPrefix);
28515
+ }
28516
+ /**
28517
+ * Returns a comparable path for an absolute href when the configured source prefix is relative.
28518
+ *
28519
+ * @param href - Href to normalize.
28520
+ * @returns Absolute URL pathname or the original href when it is relative/invalid.
28521
+ *
28522
+ * @private utility of `renderMarkdown`
28523
+ */
28524
+ function resolveAbsoluteHrefPath(href) {
28525
+ try {
28526
+ return new URL(href).pathname;
28527
+ }
28528
+ catch (_a) {
28529
+ return href;
28530
+ }
28531
+ }
28532
+ /**
28533
+ * Returns whether one markdown link destination belongs to one inline reference.
28534
+ *
28535
+ * Relative project paths also match absolute URLs on the current server, which keeps
28536
+ * server-generated relative links and model-generated absolute links consistent.
28537
+ *
28538
+ * @param reference - Candidate inline reference.
28539
+ * @param href - Markdown link destination.
28540
+ * @returns Whether the href should render as the reference chip.
28541
+ *
28542
+ * @private utility of `renderMarkdown`
28543
+ */
28544
+ function doesMarkdownInlineReferenceMatchHref(reference, href) {
28545
+ const normalizedHref = href.trim();
28546
+ return (reference.sourceHrefPrefixes || []).some((sourceHrefPrefix) => {
28547
+ const normalizedSourceHrefPrefix = sourceHrefPrefix.trim();
28548
+ if (!normalizedSourceHrefPrefix) {
28549
+ return false;
28550
+ }
28551
+ if (doesHrefStartWithSourceHrefPrefix(normalizedHref, normalizedSourceHrefPrefix)) {
28552
+ return true;
28553
+ }
28554
+ const isRelativeSourceHrefPrefix = !/^[a-z][a-z0-9+.-]*:/i.test(normalizedSourceHrefPrefix);
28555
+ const isAbsoluteHref = /^[a-z][a-z0-9+.-]*:/i.test(normalizedHref);
28556
+ return (isRelativeSourceHrefPrefix &&
28557
+ isAbsoluteHref &&
28558
+ doesHrefStartWithSourceHrefPrefix(resolveAbsoluteHrefPath(normalizedHref), normalizedSourceHrefPrefix));
28559
+ });
28560
+ }
28561
+ /**
28562
+ * Finds the inline reference represented by a markdown link destination.
28563
+ *
28564
+ * @param references - Inline references available to the markdown renderer.
28565
+ * @param href - Markdown link destination.
28566
+ * @returns Matching reference or `undefined` when the href is unrelated.
28567
+ *
28568
+ * @private utility of `renderMarkdown`
28569
+ */
28570
+ function findMarkdownInlineReferenceByHref(references, href) {
28571
+ return references.find((reference) => doesMarkdownInlineReferenceMatchHref(reference, href));
28572
+ }
28490
28573
  /**
28491
28574
  * Renders one inline reference as raw HTML that is sanitized by the shared markdown sanitizer.
28492
28575
  *
@@ -28566,10 +28649,18 @@
28566
28649
  if (referenceByKey.size === 0) {
28567
28650
  return markdown;
28568
28651
  }
28569
- return markdown.replace(INLINE_REFERENCE_REGEX, (match, rawReference) => {
28652
+ const markdownWithInlineReferenceTokens = markdown.replace(INLINE_REFERENCE_REGEX, (match, rawReference) => {
28570
28653
  const reference = referenceByKey.get(normalizeMarkdownInlineReferenceKey(rawReference));
28571
28654
  return reference ? renderMarkdownInlineReferenceHtml(reference, className) : match;
28572
28655
  });
28656
+ return markdownWithInlineReferenceTokens.replace(MARKDOWN_INLINE_REFERENCE_LINK_REGEX, (match, imageMarker, _linkLabel, rawHref) => {
28657
+ if (imageMarker) {
28658
+ return match;
28659
+ }
28660
+ const href = rawHref.replace(/^<|>$/g, '');
28661
+ const reference = findMarkdownInlineReferenceByHref(references, href);
28662
+ return reference ? renderMarkdownInlineReferenceHtml(reference, className) : match;
28663
+ });
28573
28664
  }
28574
28665
  /**
28575
28666
  * Loads KaTeX CSS in browser environments that need to display math output.
@@ -28607,7 +28698,7 @@
28607
28698
  const converter = options ? createChatMarkdownConverter(options) : CHAT_MARKDOWN_CONVERTER;
28608
28699
  try {
28609
28700
  const normalizedMarkdown = normalizeMarkdownSublists(markdown);
28610
- const { masked: maskedMarkdown, restore: restoreDetails } = maskDetailsBlocks(normalizedMarkdown);
28701
+ const { masked: maskedMarkdown, restore: restoreDetails } = maskDetailsBlocks(normalizedMarkdown, options);
28611
28702
  const { masked: codeMaskedMarkdown, restore: restoreCode } = maskMarkdownCodeSegments(maskedMarkdown);
28612
28703
  const referencedMarkdown = applyMarkdownInlineReferences(codeMaskedMarkdown, options);
28613
28704
  const inlineReferenceMarkdown = restoreCode(referencedMarkdown);