@promptbook/remote-server 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 +145 -68
  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 +144 -67
  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
@@ -50,7 +50,7 @@
50
50
  * @generated
51
51
  * @see https://github.com/webgptorg/promptbook
52
52
  */
53
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-11';
53
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-13';
54
54
  /**
55
55
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
56
56
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -8737,23 +8737,27 @@
8737
8737
  // TODO: [🧠][♿] Maybe export through `@promptbook/node`
8738
8738
 
8739
8739
  /**
8740
- * Attempts to locate the specified application on a Windows system by searching common installation directories.
8740
+ * Attempts to locate the specified application on a Windows system by searching PATH and common installation directories.
8741
8741
  * Returns the path to the executable if found, or null otherwise.
8742
8742
  *
8743
8743
  * @private within the repository
8744
8744
  */
8745
8745
  async function locateAppOnWindows({ appName, windowsSuffix, }) {
8746
8746
  try {
8747
- const prefixes = [
8747
+ const EXECUTABLE_FILENAME = windowsSuffix.replace(/^.*[\\/]/, '');
8748
+ const PATH_EXECUTABLE_PATHS = (process.env.PATH || '')
8749
+ .split(path.delimiter)
8750
+ .filter(Boolean)
8751
+ .map((pathPrefix) => path.join(pathPrefix, EXECUTABLE_FILENAME));
8752
+ const INSTALLATION_EXECUTABLE_PATHS = [
8748
8753
  process.env.LOCALAPPDATA,
8749
8754
  path.join(process.env.LOCALAPPDATA || '', 'Programs'),
8750
8755
  process.env.PROGRAMFILES,
8751
8756
  process.env['PROGRAMFILES(X86)'],
8752
- ];
8753
- for (const prefix of prefixes) {
8754
- const path = prefix + windowsSuffix;
8755
- if (await isExecutable(path, $provideFilesystemForNode())) {
8756
- return path;
8757
+ ].map((pathPrefix) => pathPrefix + windowsSuffix);
8758
+ for (const executablePath of [...PATH_EXECUTABLE_PATHS, ...INSTALLATION_EXECUTABLE_PATHS]) {
8759
+ if (await isExecutable(executablePath, $provideFilesystemForNode())) {
8760
+ return executablePath;
8757
8761
  }
8758
8762
  }
8759
8763
  throw new Error(`Can not locate app ${appName} on Windows.`);
@@ -29314,6 +29318,30 @@
29314
29318
  return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
29315
29319
  }
29316
29320
 
29321
+ /**
29322
+ * Pattern shared by Book parsing and editor highlighting for a commitment-like line.
29323
+ *
29324
+ * A Book commitment keyword consists of one or more all-uppercase words with at least
29325
+ * two characters each. This deliberately mirrors the Book editor syntax rule so an
29326
+ * unknown keyword starts a new source block everywhere it is interpreted.
29327
+ *
29328
+ * @private internal constant of `getBookCommitmentLineType`
29329
+ */
29330
+ const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
29331
+ /**
29332
+ * Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
29333
+ *
29334
+ * @param line - One raw Book source line.
29335
+ * @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
29336
+ *
29337
+ * @private internal utility of Book parsing and `<BookEditor/>`
29338
+ */
29339
+ function getBookCommitmentLineType(line) {
29340
+ var _a;
29341
+ const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
29342
+ return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
29343
+ }
29344
+
29317
29345
  /**
29318
29346
  * Consumes the agent-name prelude from raw source.
29319
29347
  *
@@ -29371,13 +29399,15 @@
29371
29399
  return {
29372
29400
  agentName: null,
29373
29401
  commitments: [],
29402
+ unknownCommitments: [],
29374
29403
  nonCommitmentLines: [],
29375
29404
  };
29376
29405
  }
29377
29406
  const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
29378
29407
  const commitments = [];
29408
+ const unknownCommitments = [];
29379
29409
  const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
29380
- // Parse commitments with multiline support
29410
+ // Parse commitments with multiline support.
29381
29411
  let currentCommitment = null;
29382
29412
  // Process lines starting from after the agent name line
29383
29413
  const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
@@ -29391,25 +29421,11 @@
29391
29421
  // Check if this line starts or ends a code block
29392
29422
  if (trimmedLine.startsWith('```')) {
29393
29423
  isInsideCodeBlock = !isInsideCodeBlock;
29394
- if (currentCommitment) {
29395
- // If we are inside a commitment, the code block is part of it
29396
- currentCommitment.contentLines.push(line);
29397
- }
29398
- else {
29399
- // If we are not inside a commitment, the code block is non-commitment
29400
- nonCommitmentLines.push(line);
29401
- }
29424
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
29402
29425
  continue;
29403
29426
  }
29404
29427
  if (isInsideCodeBlock) {
29405
- if (currentCommitment) {
29406
- // If we are inside a commitment and a code block, the line is part of the commitment
29407
- currentCommitment.contentLines.push(line);
29408
- }
29409
- else {
29410
- // If we are inside a code block but not a commitment, the line is non-commitment
29411
- nonCommitmentLines.push(line);
29412
- }
29428
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
29413
29429
  continue;
29414
29430
  }
29415
29431
  // Check if this line starts a new commitment
@@ -29418,22 +29434,14 @@
29418
29434
  const typeRegex = definition.createTypeRegex();
29419
29435
  const match = typeRegex.exec(line.trim());
29420
29436
  if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
29421
- // Save the previous commitment if it exists
29422
- if (currentCommitment) {
29423
- const fullContent = currentCommitment.contentLines.join('\n');
29424
- commitments.push({
29425
- type: currentCommitment.type,
29426
- content: _spaceTrim.spaceTrim(fullContent),
29427
- originalLine: currentCommitment.originalStartLine,
29428
- lineNumber: currentCommitment.startLineNumber,
29429
- });
29430
- }
29437
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29431
29438
  // Extract the initial content from the commitment line
29432
29439
  const fullRegex = definition.createRegex();
29433
29440
  const fullMatch = fullRegex.exec(line.trim());
29434
29441
  const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
29435
29442
  // Start a new commitment
29436
29443
  currentCommitment = {
29444
+ kind: 'known',
29437
29445
  type: definition.type,
29438
29446
  startLineNumber: i + 1,
29439
29447
  originalStartLine: line,
@@ -29443,52 +29451,90 @@
29443
29451
  break;
29444
29452
  }
29445
29453
  }
29454
+ if (foundNewCommitment) {
29455
+ continue;
29456
+ }
29457
+ const unknownCommitmentType = getBookCommitmentLineType(line);
29458
+ if (unknownCommitmentType) {
29459
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29460
+ currentCommitment = {
29461
+ kind: 'unknown',
29462
+ type: unknownCommitmentType,
29463
+ startLineNumber: i + 1,
29464
+ originalStartLine: line,
29465
+ sourceLines: [line],
29466
+ };
29467
+ continue;
29468
+ }
29446
29469
  // Check if this is a horizontal line (ends any current commitment)
29447
29470
  const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
29448
29471
  if (isHorizontalLine) {
29449
- // Save the current commitment if it exists
29450
- if (currentCommitment) {
29451
- const fullContent = currentCommitment.contentLines.join('\n');
29452
- commitments.push({
29453
- type: currentCommitment.type,
29454
- content: _spaceTrim.spaceTrim(fullContent),
29455
- originalLine: currentCommitment.originalStartLine,
29456
- lineNumber: currentCommitment.startLineNumber,
29457
- });
29458
- currentCommitment = null;
29459
- }
29472
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29473
+ currentCommitment = null;
29460
29474
  // Add horizontal line to non-commitment lines
29461
29475
  nonCommitmentLines.push(line);
29462
29476
  continue;
29463
29477
  }
29464
- if (!foundNewCommitment) {
29465
- if (currentCommitment) {
29466
- // This line belongs to the current commitment
29467
- currentCommitment.contentLines.push(line);
29468
- }
29469
- else {
29470
- // This line is not part of any commitment
29471
- nonCommitmentLines.push(line);
29472
- }
29473
- }
29474
- }
29475
- // Don't forget to save the last commitment if it exists
29476
- if (currentCommitment) {
29477
- const fullContent = currentCommitment.contentLines.join('\n');
29478
- commitments.push({
29479
- type: currentCommitment.type,
29480
- content: _spaceTrim.spaceTrim(fullContent),
29481
- originalLine: currentCommitment.originalStartLine,
29482
- lineNumber: currentCommitment.startLineNumber,
29483
- });
29478
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
29484
29479
  }
29480
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29485
29481
  return {
29486
29482
  agentName,
29487
29483
  agentNameLineNumber,
29488
29484
  commitments,
29485
+ unknownCommitments,
29489
29486
  nonCommitmentLines,
29490
29487
  };
29491
29488
  }
29489
+ /**
29490
+ * Stores the current known or unknown commitment in its appropriate parsed collection.
29491
+ *
29492
+ * @param currentCommitment - Commitment-like block collected so far.
29493
+ * @param commitments - Parsed registered commitments to append to.
29494
+ * @param unknownCommitments - Parsed unregistered commitments to append to.
29495
+ *
29496
+ * @private internal utility of `parseAgentSourceWithCommitments`
29497
+ */
29498
+ function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
29499
+ if (!currentCommitment) {
29500
+ return;
29501
+ }
29502
+ if (currentCommitment.kind === 'unknown') {
29503
+ unknownCommitments.push({
29504
+ type: currentCommitment.type,
29505
+ originalLine: currentCommitment.originalStartLine,
29506
+ lineNumber: currentCommitment.startLineNumber,
29507
+ source: _spaceTrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
29508
+ });
29509
+ return;
29510
+ }
29511
+ commitments.push({
29512
+ type: currentCommitment.type,
29513
+ content: _spaceTrim.spaceTrim(currentCommitment.contentLines.join('\n')),
29514
+ originalLine: currentCommitment.originalStartLine,
29515
+ lineNumber: currentCommitment.startLineNumber,
29516
+ });
29517
+ }
29518
+ /**
29519
+ * Adds one source line to the active commitment-like block, or to plain source content when none is active.
29520
+ *
29521
+ * @param currentCommitment - Commitment-like block currently being collected.
29522
+ * @param line - Source line to append.
29523
+ * @param nonCommitmentLines - Plain source lines to append to when no block is active.
29524
+ *
29525
+ * @private internal utility of `parseAgentSourceWithCommitments`
29526
+ */
29527
+ function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
29528
+ if (!currentCommitment) {
29529
+ nonCommitmentLines.push(line);
29530
+ return;
29531
+ }
29532
+ if (currentCommitment.kind === 'unknown') {
29533
+ currentCommitment.sourceLines.push(line);
29534
+ return;
29535
+ }
29536
+ currentCommitment.contentLines.push(line);
29537
+ }
29492
29538
 
29493
29539
  /**
29494
29540
  * Parses parameters from text using both supported notations:
@@ -30581,7 +30627,8 @@
30581
30627
  requirements = await importReferencedFiles(requirements);
30582
30628
  requirements = appendMcpServers(requirements, agentSource);
30583
30629
  requirements = appendNonCommitmentContent(requirements, parseResult);
30584
- return appendExampleInteractions(requirements, parseResult);
30630
+ requirements = appendExampleInteractions(requirements, parseResult);
30631
+ return appendUnknownCommitmentContent(requirements, parseResult);
30585
30632
  }
30586
30633
  /**
30587
30634
  * Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
@@ -30703,6 +30750,36 @@
30703
30750
  }
30704
30751
  return appendSystemMessageSection(requirements, nonCommitmentContent);
30705
30752
  }
30753
+ /**
30754
+ * Appends unknown commitment blocks as final extra context without applying commitment side effects.
30755
+ *
30756
+ * @param requirements - Current requirements snapshot.
30757
+ * @param parseResult - Parsed source including unknown commitment blocks.
30758
+ * @returns Requirements with unknown commitment context appended at the end of the system message.
30759
+ *
30760
+ * @private internal utility of `augmentAgentModelRequirementsFromSource`
30761
+ */
30762
+ function appendUnknownCommitmentContent(requirements, parseResult) {
30763
+ const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
30764
+ if (!unknownCommitmentContent) {
30765
+ return requirements;
30766
+ }
30767
+ return appendSystemMessageSection(requirements, unknownCommitmentContent);
30768
+ }
30769
+ /**
30770
+ * Joins unknown commitment blocks into their final extra-context representation.
30771
+ *
30772
+ * @param parseResult - Parsed source including unknown commitment blocks.
30773
+ * @returns Unknown commitment source blocks in their original order.
30774
+ *
30775
+ * @private internal utility of `appendUnknownCommitmentContent`
30776
+ */
30777
+ function getUnknownCommitmentContent(parseResult) {
30778
+ return parseResult.unknownCommitments
30779
+ .map((commitment) => commitment.source)
30780
+ .filter(Boolean)
30781
+ .join('\n\n');
30782
+ }
30706
30783
  /**
30707
30784
  * Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
30708
30785
  *