@promptbook/core 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.
- package/esm/index.es.js +133 -60
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
- package/esm/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
- package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
- package/esm/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
- package/esm/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
- package/esm/src/book-3.0/AgentMessageRunReport.d.ts +28 -0
- package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +94 -0
- package/esm/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
- package/esm/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
- package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
- package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +46 -0
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +24 -0
- package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
- package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -3
- package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +3 -2
- package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +29 -0
- package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts +1 -0
- package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
- package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +59 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +133 -60
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
- package/umd/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
- package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
- package/umd/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
- package/umd/src/book-3.0/AgentMessageRunReport.d.ts +28 -0
- package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +94 -0
- package/umd/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
- package/umd/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
- package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
- package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +46 -0
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +24 -0
- package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
- package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -3
- package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +3 -2
- package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +29 -0
- package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts +1 -0
- package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
- package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +59 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-13';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -24336,6 +24336,30 @@
|
|
|
24336
24336
|
}
|
|
24337
24337
|
}
|
|
24338
24338
|
|
|
24339
|
+
/**
|
|
24340
|
+
* Pattern shared by Book parsing and editor highlighting for a commitment-like line.
|
|
24341
|
+
*
|
|
24342
|
+
* A Book commitment keyword consists of one or more all-uppercase words with at least
|
|
24343
|
+
* two characters each. This deliberately mirrors the Book editor syntax rule so an
|
|
24344
|
+
* unknown keyword starts a new source block everywhere it is interpreted.
|
|
24345
|
+
*
|
|
24346
|
+
* @private internal constant of `getBookCommitmentLineType`
|
|
24347
|
+
*/
|
|
24348
|
+
const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
|
|
24349
|
+
/**
|
|
24350
|
+
* Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
|
|
24351
|
+
*
|
|
24352
|
+
* @param line - One raw Book source line.
|
|
24353
|
+
* @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
|
|
24354
|
+
*
|
|
24355
|
+
* @private internal utility of Book parsing and `<BookEditor/>`
|
|
24356
|
+
*/
|
|
24357
|
+
function getBookCommitmentLineType(line) {
|
|
24358
|
+
var _a;
|
|
24359
|
+
const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
|
|
24360
|
+
return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
|
|
24361
|
+
}
|
|
24362
|
+
|
|
24339
24363
|
/**
|
|
24340
24364
|
* Consumes the agent-name prelude from raw source.
|
|
24341
24365
|
*
|
|
@@ -24393,13 +24417,15 @@
|
|
|
24393
24417
|
return {
|
|
24394
24418
|
agentName: null,
|
|
24395
24419
|
commitments: [],
|
|
24420
|
+
unknownCommitments: [],
|
|
24396
24421
|
nonCommitmentLines: [],
|
|
24397
24422
|
};
|
|
24398
24423
|
}
|
|
24399
24424
|
const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
|
|
24400
24425
|
const commitments = [];
|
|
24426
|
+
const unknownCommitments = [];
|
|
24401
24427
|
const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
|
|
24402
|
-
// Parse commitments with multiline support
|
|
24428
|
+
// Parse commitments with multiline support.
|
|
24403
24429
|
let currentCommitment = null;
|
|
24404
24430
|
// Process lines starting from after the agent name line
|
|
24405
24431
|
const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
|
|
@@ -24413,25 +24439,11 @@
|
|
|
24413
24439
|
// Check if this line starts or ends a code block
|
|
24414
24440
|
if (trimmedLine.startsWith('```')) {
|
|
24415
24441
|
isInsideCodeBlock = !isInsideCodeBlock;
|
|
24416
|
-
|
|
24417
|
-
// If we are inside a commitment, the code block is part of it
|
|
24418
|
-
currentCommitment.contentLines.push(line);
|
|
24419
|
-
}
|
|
24420
|
-
else {
|
|
24421
|
-
// If we are not inside a commitment, the code block is non-commitment
|
|
24422
|
-
nonCommitmentLines.push(line);
|
|
24423
|
-
}
|
|
24442
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
24424
24443
|
continue;
|
|
24425
24444
|
}
|
|
24426
24445
|
if (isInsideCodeBlock) {
|
|
24427
|
-
|
|
24428
|
-
// If we are inside a commitment and a code block, the line is part of the commitment
|
|
24429
|
-
currentCommitment.contentLines.push(line);
|
|
24430
|
-
}
|
|
24431
|
-
else {
|
|
24432
|
-
// If we are inside a code block but not a commitment, the line is non-commitment
|
|
24433
|
-
nonCommitmentLines.push(line);
|
|
24434
|
-
}
|
|
24446
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
24435
24447
|
continue;
|
|
24436
24448
|
}
|
|
24437
24449
|
// Check if this line starts a new commitment
|
|
@@ -24440,22 +24452,14 @@
|
|
|
24440
24452
|
const typeRegex = definition.createTypeRegex();
|
|
24441
24453
|
const match = typeRegex.exec(line.trim());
|
|
24442
24454
|
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
24443
|
-
|
|
24444
|
-
if (currentCommitment) {
|
|
24445
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
24446
|
-
commitments.push({
|
|
24447
|
-
type: currentCommitment.type,
|
|
24448
|
-
content: spacetrim.spaceTrim(fullContent),
|
|
24449
|
-
originalLine: currentCommitment.originalStartLine,
|
|
24450
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
24451
|
-
});
|
|
24452
|
-
}
|
|
24455
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24453
24456
|
// Extract the initial content from the commitment line
|
|
24454
24457
|
const fullRegex = definition.createRegex();
|
|
24455
24458
|
const fullMatch = fullRegex.exec(line.trim());
|
|
24456
24459
|
const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
|
|
24457
24460
|
// Start a new commitment
|
|
24458
24461
|
currentCommitment = {
|
|
24462
|
+
kind: 'known',
|
|
24459
24463
|
type: definition.type,
|
|
24460
24464
|
startLineNumber: i + 1,
|
|
24461
24465
|
originalStartLine: line,
|
|
@@ -24465,52 +24469,90 @@
|
|
|
24465
24469
|
break;
|
|
24466
24470
|
}
|
|
24467
24471
|
}
|
|
24472
|
+
if (foundNewCommitment) {
|
|
24473
|
+
continue;
|
|
24474
|
+
}
|
|
24475
|
+
const unknownCommitmentType = getBookCommitmentLineType(line);
|
|
24476
|
+
if (unknownCommitmentType) {
|
|
24477
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24478
|
+
currentCommitment = {
|
|
24479
|
+
kind: 'unknown',
|
|
24480
|
+
type: unknownCommitmentType,
|
|
24481
|
+
startLineNumber: i + 1,
|
|
24482
|
+
originalStartLine: line,
|
|
24483
|
+
sourceLines: [line],
|
|
24484
|
+
};
|
|
24485
|
+
continue;
|
|
24486
|
+
}
|
|
24468
24487
|
// Check if this is a horizontal line (ends any current commitment)
|
|
24469
24488
|
const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
|
|
24470
24489
|
if (isHorizontalLine) {
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
24474
|
-
commitments.push({
|
|
24475
|
-
type: currentCommitment.type,
|
|
24476
|
-
content: spacetrim.spaceTrim(fullContent),
|
|
24477
|
-
originalLine: currentCommitment.originalStartLine,
|
|
24478
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
24479
|
-
});
|
|
24480
|
-
currentCommitment = null;
|
|
24481
|
-
}
|
|
24490
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24491
|
+
currentCommitment = null;
|
|
24482
24492
|
// Add horizontal line to non-commitment lines
|
|
24483
24493
|
nonCommitmentLines.push(line);
|
|
24484
24494
|
continue;
|
|
24485
24495
|
}
|
|
24486
|
-
|
|
24487
|
-
if (currentCommitment) {
|
|
24488
|
-
// This line belongs to the current commitment
|
|
24489
|
-
currentCommitment.contentLines.push(line);
|
|
24490
|
-
}
|
|
24491
|
-
else {
|
|
24492
|
-
// This line is not part of any commitment
|
|
24493
|
-
nonCommitmentLines.push(line);
|
|
24494
|
-
}
|
|
24495
|
-
}
|
|
24496
|
-
}
|
|
24497
|
-
// Don't forget to save the last commitment if it exists
|
|
24498
|
-
if (currentCommitment) {
|
|
24499
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
24500
|
-
commitments.push({
|
|
24501
|
-
type: currentCommitment.type,
|
|
24502
|
-
content: spacetrim.spaceTrim(fullContent),
|
|
24503
|
-
originalLine: currentCommitment.originalStartLine,
|
|
24504
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
24505
|
-
});
|
|
24496
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
24506
24497
|
}
|
|
24498
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24507
24499
|
return {
|
|
24508
24500
|
agentName,
|
|
24509
24501
|
agentNameLineNumber,
|
|
24510
24502
|
commitments,
|
|
24503
|
+
unknownCommitments,
|
|
24511
24504
|
nonCommitmentLines,
|
|
24512
24505
|
};
|
|
24513
24506
|
}
|
|
24507
|
+
/**
|
|
24508
|
+
* Stores the current known or unknown commitment in its appropriate parsed collection.
|
|
24509
|
+
*
|
|
24510
|
+
* @param currentCommitment - Commitment-like block collected so far.
|
|
24511
|
+
* @param commitments - Parsed registered commitments to append to.
|
|
24512
|
+
* @param unknownCommitments - Parsed unregistered commitments to append to.
|
|
24513
|
+
*
|
|
24514
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
24515
|
+
*/
|
|
24516
|
+
function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
|
|
24517
|
+
if (!currentCommitment) {
|
|
24518
|
+
return;
|
|
24519
|
+
}
|
|
24520
|
+
if (currentCommitment.kind === 'unknown') {
|
|
24521
|
+
unknownCommitments.push({
|
|
24522
|
+
type: currentCommitment.type,
|
|
24523
|
+
originalLine: currentCommitment.originalStartLine,
|
|
24524
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
24525
|
+
source: spacetrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
|
|
24526
|
+
});
|
|
24527
|
+
return;
|
|
24528
|
+
}
|
|
24529
|
+
commitments.push({
|
|
24530
|
+
type: currentCommitment.type,
|
|
24531
|
+
content: spacetrim.spaceTrim(currentCommitment.contentLines.join('\n')),
|
|
24532
|
+
originalLine: currentCommitment.originalStartLine,
|
|
24533
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
24534
|
+
});
|
|
24535
|
+
}
|
|
24536
|
+
/**
|
|
24537
|
+
* Adds one source line to the active commitment-like block, or to plain source content when none is active.
|
|
24538
|
+
*
|
|
24539
|
+
* @param currentCommitment - Commitment-like block currently being collected.
|
|
24540
|
+
* @param line - Source line to append.
|
|
24541
|
+
* @param nonCommitmentLines - Plain source lines to append to when no block is active.
|
|
24542
|
+
*
|
|
24543
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
24544
|
+
*/
|
|
24545
|
+
function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
|
|
24546
|
+
if (!currentCommitment) {
|
|
24547
|
+
nonCommitmentLines.push(line);
|
|
24548
|
+
return;
|
|
24549
|
+
}
|
|
24550
|
+
if (currentCommitment.kind === 'unknown') {
|
|
24551
|
+
currentCommitment.sourceLines.push(line);
|
|
24552
|
+
return;
|
|
24553
|
+
}
|
|
24554
|
+
currentCommitment.contentLines.push(line);
|
|
24555
|
+
}
|
|
24514
24556
|
|
|
24515
24557
|
/**
|
|
24516
24558
|
* Plugin for importing agent books *(`.book` files)*
|
|
@@ -24648,7 +24690,8 @@
|
|
|
24648
24690
|
requirements = await importReferencedFiles(requirements);
|
|
24649
24691
|
requirements = appendMcpServers(requirements, agentSource);
|
|
24650
24692
|
requirements = appendNonCommitmentContent(requirements, parseResult);
|
|
24651
|
-
|
|
24693
|
+
requirements = appendExampleInteractions(requirements, parseResult);
|
|
24694
|
+
return appendUnknownCommitmentContent(requirements, parseResult);
|
|
24652
24695
|
}
|
|
24653
24696
|
/**
|
|
24654
24697
|
* Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
|
|
@@ -24770,6 +24813,36 @@
|
|
|
24770
24813
|
}
|
|
24771
24814
|
return appendSystemMessageSection(requirements, nonCommitmentContent);
|
|
24772
24815
|
}
|
|
24816
|
+
/**
|
|
24817
|
+
* Appends unknown commitment blocks as final extra context without applying commitment side effects.
|
|
24818
|
+
*
|
|
24819
|
+
* @param requirements - Current requirements snapshot.
|
|
24820
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
24821
|
+
* @returns Requirements with unknown commitment context appended at the end of the system message.
|
|
24822
|
+
*
|
|
24823
|
+
* @private internal utility of `augmentAgentModelRequirementsFromSource`
|
|
24824
|
+
*/
|
|
24825
|
+
function appendUnknownCommitmentContent(requirements, parseResult) {
|
|
24826
|
+
const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
|
|
24827
|
+
if (!unknownCommitmentContent) {
|
|
24828
|
+
return requirements;
|
|
24829
|
+
}
|
|
24830
|
+
return appendSystemMessageSection(requirements, unknownCommitmentContent);
|
|
24831
|
+
}
|
|
24832
|
+
/**
|
|
24833
|
+
* Joins unknown commitment blocks into their final extra-context representation.
|
|
24834
|
+
*
|
|
24835
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
24836
|
+
* @returns Unknown commitment source blocks in their original order.
|
|
24837
|
+
*
|
|
24838
|
+
* @private internal utility of `appendUnknownCommitmentContent`
|
|
24839
|
+
*/
|
|
24840
|
+
function getUnknownCommitmentContent(parseResult) {
|
|
24841
|
+
return parseResult.unknownCommitments
|
|
24842
|
+
.map((commitment) => commitment.source)
|
|
24843
|
+
.filter(Boolean)
|
|
24844
|
+
.join('\n\n');
|
|
24845
|
+
}
|
|
24773
24846
|
/**
|
|
24774
24847
|
* Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
|
|
24775
24848
|
*
|