@promptbook/browser 0.114.0-11 → 0.114.0-13

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 (55) hide show
  1. package/esm/index.es.js +133 -60
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  4. package/esm/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  5. package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
  6. package/esm/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  7. package/esm/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  8. package/esm/src/book-3.0/AgentMessageRunReport.d.ts +28 -0
  9. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +94 -0
  10. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
  11. package/esm/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
  12. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  13. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  14. package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +46 -0
  15. package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +24 -0
  16. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  17. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  18. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -3
  19. package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +3 -2
  20. package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +29 -0
  21. package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts +1 -0
  22. package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  23. package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  24. package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +59 -0
  25. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
  26. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
  27. package/esm/src/version.d.ts +1 -1
  28. package/package.json +2 -2
  29. package/umd/index.umd.js +133 -60
  30. package/umd/index.umd.js.map +1 -1
  31. package/umd/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  32. package/umd/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  33. package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
  34. package/umd/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  35. package/umd/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  36. package/umd/src/book-3.0/AgentMessageRunReport.d.ts +28 -0
  37. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +94 -0
  38. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
  39. package/umd/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
  40. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  41. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  42. package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +46 -0
  43. package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +24 -0
  44. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  45. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  46. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -3
  47. package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +3 -2
  48. package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +29 -0
  49. package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts +1 -0
  50. package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  51. package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  52. package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +59 -0
  53. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
  54. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
  55. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -27,7 +27,7 @@
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-11';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-13';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -18561,6 +18561,30 @@
18561
18561
  return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
18562
18562
  }
18563
18563
 
18564
+ /**
18565
+ * Pattern shared by Book parsing and editor highlighting for a commitment-like line.
18566
+ *
18567
+ * A Book commitment keyword consists of one or more all-uppercase words with at least
18568
+ * two characters each. This deliberately mirrors the Book editor syntax rule so an
18569
+ * unknown keyword starts a new source block everywhere it is interpreted.
18570
+ *
18571
+ * @private internal constant of `getBookCommitmentLineType`
18572
+ */
18573
+ const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
18574
+ /**
18575
+ * Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
18576
+ *
18577
+ * @param line - One raw Book source line.
18578
+ * @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
18579
+ *
18580
+ * @private internal utility of Book parsing and `<BookEditor/>`
18581
+ */
18582
+ function getBookCommitmentLineType(line) {
18583
+ var _a;
18584
+ const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
18585
+ return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
18586
+ }
18587
+
18564
18588
  /**
18565
18589
  * Consumes the agent-name prelude from raw source.
18566
18590
  *
@@ -18618,13 +18642,15 @@
18618
18642
  return {
18619
18643
  agentName: null,
18620
18644
  commitments: [],
18645
+ unknownCommitments: [],
18621
18646
  nonCommitmentLines: [],
18622
18647
  };
18623
18648
  }
18624
18649
  const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
18625
18650
  const commitments = [];
18651
+ const unknownCommitments = [];
18626
18652
  const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
18627
- // Parse commitments with multiline support
18653
+ // Parse commitments with multiline support.
18628
18654
  let currentCommitment = null;
18629
18655
  // Process lines starting from after the agent name line
18630
18656
  const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
@@ -18638,25 +18664,11 @@
18638
18664
  // Check if this line starts or ends a code block
18639
18665
  if (trimmedLine.startsWith('```')) {
18640
18666
  isInsideCodeBlock = !isInsideCodeBlock;
18641
- if (currentCommitment) {
18642
- // If we are inside a commitment, the code block is part of it
18643
- currentCommitment.contentLines.push(line);
18644
- }
18645
- else {
18646
- // If we are not inside a commitment, the code block is non-commitment
18647
- nonCommitmentLines.push(line);
18648
- }
18667
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
18649
18668
  continue;
18650
18669
  }
18651
18670
  if (isInsideCodeBlock) {
18652
- if (currentCommitment) {
18653
- // If we are inside a commitment and a code block, the line is part of the commitment
18654
- currentCommitment.contentLines.push(line);
18655
- }
18656
- else {
18657
- // If we are inside a code block but not a commitment, the line is non-commitment
18658
- nonCommitmentLines.push(line);
18659
- }
18671
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
18660
18672
  continue;
18661
18673
  }
18662
18674
  // Check if this line starts a new commitment
@@ -18665,22 +18677,14 @@
18665
18677
  const typeRegex = definition.createTypeRegex();
18666
18678
  const match = typeRegex.exec(line.trim());
18667
18679
  if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
18668
- // Save the previous commitment if it exists
18669
- if (currentCommitment) {
18670
- const fullContent = currentCommitment.contentLines.join('\n');
18671
- commitments.push({
18672
- type: currentCommitment.type,
18673
- content: spacetrim.spaceTrim(fullContent),
18674
- originalLine: currentCommitment.originalStartLine,
18675
- lineNumber: currentCommitment.startLineNumber,
18676
- });
18677
- }
18680
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18678
18681
  // Extract the initial content from the commitment line
18679
18682
  const fullRegex = definition.createRegex();
18680
18683
  const fullMatch = fullRegex.exec(line.trim());
18681
18684
  const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
18682
18685
  // Start a new commitment
18683
18686
  currentCommitment = {
18687
+ kind: 'known',
18684
18688
  type: definition.type,
18685
18689
  startLineNumber: i + 1,
18686
18690
  originalStartLine: line,
@@ -18690,52 +18694,90 @@
18690
18694
  break;
18691
18695
  }
18692
18696
  }
18697
+ if (foundNewCommitment) {
18698
+ continue;
18699
+ }
18700
+ const unknownCommitmentType = getBookCommitmentLineType(line);
18701
+ if (unknownCommitmentType) {
18702
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18703
+ currentCommitment = {
18704
+ kind: 'unknown',
18705
+ type: unknownCommitmentType,
18706
+ startLineNumber: i + 1,
18707
+ originalStartLine: line,
18708
+ sourceLines: [line],
18709
+ };
18710
+ continue;
18711
+ }
18693
18712
  // Check if this is a horizontal line (ends any current commitment)
18694
18713
  const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
18695
18714
  if (isHorizontalLine) {
18696
- // Save the current commitment if it exists
18697
- if (currentCommitment) {
18698
- const fullContent = currentCommitment.contentLines.join('\n');
18699
- commitments.push({
18700
- type: currentCommitment.type,
18701
- content: spacetrim.spaceTrim(fullContent),
18702
- originalLine: currentCommitment.originalStartLine,
18703
- lineNumber: currentCommitment.startLineNumber,
18704
- });
18705
- currentCommitment = null;
18706
- }
18715
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18716
+ currentCommitment = null;
18707
18717
  // Add horizontal line to non-commitment lines
18708
18718
  nonCommitmentLines.push(line);
18709
18719
  continue;
18710
18720
  }
18711
- if (!foundNewCommitment) {
18712
- if (currentCommitment) {
18713
- // This line belongs to the current commitment
18714
- currentCommitment.contentLines.push(line);
18715
- }
18716
- else {
18717
- // This line is not part of any commitment
18718
- nonCommitmentLines.push(line);
18719
- }
18720
- }
18721
- }
18722
- // Don't forget to save the last commitment if it exists
18723
- if (currentCommitment) {
18724
- const fullContent = currentCommitment.contentLines.join('\n');
18725
- commitments.push({
18726
- type: currentCommitment.type,
18727
- content: spacetrim.spaceTrim(fullContent),
18728
- originalLine: currentCommitment.originalStartLine,
18729
- lineNumber: currentCommitment.startLineNumber,
18730
- });
18721
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
18731
18722
  }
18723
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18732
18724
  return {
18733
18725
  agentName,
18734
18726
  agentNameLineNumber,
18735
18727
  commitments,
18728
+ unknownCommitments,
18736
18729
  nonCommitmentLines,
18737
18730
  };
18738
18731
  }
18732
+ /**
18733
+ * Stores the current known or unknown commitment in its appropriate parsed collection.
18734
+ *
18735
+ * @param currentCommitment - Commitment-like block collected so far.
18736
+ * @param commitments - Parsed registered commitments to append to.
18737
+ * @param unknownCommitments - Parsed unregistered commitments to append to.
18738
+ *
18739
+ * @private internal utility of `parseAgentSourceWithCommitments`
18740
+ */
18741
+ function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
18742
+ if (!currentCommitment) {
18743
+ return;
18744
+ }
18745
+ if (currentCommitment.kind === 'unknown') {
18746
+ unknownCommitments.push({
18747
+ type: currentCommitment.type,
18748
+ originalLine: currentCommitment.originalStartLine,
18749
+ lineNumber: currentCommitment.startLineNumber,
18750
+ source: spacetrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
18751
+ });
18752
+ return;
18753
+ }
18754
+ commitments.push({
18755
+ type: currentCommitment.type,
18756
+ content: spacetrim.spaceTrim(currentCommitment.contentLines.join('\n')),
18757
+ originalLine: currentCommitment.originalStartLine,
18758
+ lineNumber: currentCommitment.startLineNumber,
18759
+ });
18760
+ }
18761
+ /**
18762
+ * Adds one source line to the active commitment-like block, or to plain source content when none is active.
18763
+ *
18764
+ * @param currentCommitment - Commitment-like block currently being collected.
18765
+ * @param line - Source line to append.
18766
+ * @param nonCommitmentLines - Plain source lines to append to when no block is active.
18767
+ *
18768
+ * @private internal utility of `parseAgentSourceWithCommitments`
18769
+ */
18770
+ function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
18771
+ if (!currentCommitment) {
18772
+ nonCommitmentLines.push(line);
18773
+ return;
18774
+ }
18775
+ if (currentCommitment.kind === 'unknown') {
18776
+ currentCommitment.sourceLines.push(line);
18777
+ return;
18778
+ }
18779
+ currentCommitment.contentLines.push(line);
18780
+ }
18739
18781
 
18740
18782
  /**
18741
18783
  * Parses parameters from text using both supported notations:
@@ -26518,7 +26560,8 @@
26518
26560
  requirements = await importReferencedFiles(requirements);
26519
26561
  requirements = appendMcpServers(requirements, agentSource);
26520
26562
  requirements = appendNonCommitmentContent(requirements, parseResult);
26521
- return appendExampleInteractions(requirements, parseResult);
26563
+ requirements = appendExampleInteractions(requirements, parseResult);
26564
+ return appendUnknownCommitmentContent(requirements, parseResult);
26522
26565
  }
26523
26566
  /**
26524
26567
  * Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
@@ -26640,6 +26683,36 @@
26640
26683
  }
26641
26684
  return appendSystemMessageSection(requirements, nonCommitmentContent);
26642
26685
  }
26686
+ /**
26687
+ * Appends unknown commitment blocks as final extra context without applying commitment side effects.
26688
+ *
26689
+ * @param requirements - Current requirements snapshot.
26690
+ * @param parseResult - Parsed source including unknown commitment blocks.
26691
+ * @returns Requirements with unknown commitment context appended at the end of the system message.
26692
+ *
26693
+ * @private internal utility of `augmentAgentModelRequirementsFromSource`
26694
+ */
26695
+ function appendUnknownCommitmentContent(requirements, parseResult) {
26696
+ const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
26697
+ if (!unknownCommitmentContent) {
26698
+ return requirements;
26699
+ }
26700
+ return appendSystemMessageSection(requirements, unknownCommitmentContent);
26701
+ }
26702
+ /**
26703
+ * Joins unknown commitment blocks into their final extra-context representation.
26704
+ *
26705
+ * @param parseResult - Parsed source including unknown commitment blocks.
26706
+ * @returns Unknown commitment source blocks in their original order.
26707
+ *
26708
+ * @private internal utility of `appendUnknownCommitmentContent`
26709
+ */
26710
+ function getUnknownCommitmentContent(parseResult) {
26711
+ return parseResult.unknownCommitments
26712
+ .map((commitment) => commitment.source)
26713
+ .filter(Boolean)
26714
+ .join('\n\n');
26715
+ }
26643
26716
  /**
26644
26717
  * Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
26645
26718
  *