@promptbook/browser 0.114.0-4 → 0.114.0-40
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/README.md +9 -9
- package/esm/index.es.js +531 -107
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +4 -0
- package/esm/src/_packages/types.index.d.ts +4 -0
- package/esm/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/esm/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
- 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/deduplicateSystemMessage.d.ts +14 -0
- package/esm/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
- package/esm/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -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-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
- package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
- package/esm/src/book-3.0/AgentMessageRunReport.d.ts +46 -0
- package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +127 -0
- package/esm/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
- package/esm/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
- package/esm/src/book-3.0/cliAgentEnv.d.ts +3 -3
- package/esm/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
- package/esm/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
- package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
- package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
- package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -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/Chat/ChatProps.d.ts +3 -2
- package/esm/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
- package/esm/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
- package/esm/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
- package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +85 -0
- package/esm/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +68 -3
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +30 -0
- package/esm/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +10 -0
- package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
- package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
- package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
- package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
- package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
- package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
- package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/init.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +8 -5
- package/esm/src/cli/cli-commands/coder/list.d.ts +10 -0
- package/esm/src/cli/cli-commands/coder/list.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
- package/esm/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/server.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/verify.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
- package/esm/src/cli/cli-commands/coder.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/$askForConfirmation.d.ts +11 -0
- package/esm/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +46 -0
- package/esm/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
- package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
- package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
- package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
- package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
- package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +3 -2
- 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 +4 -3
- package/esm/src/cli/cli-commands/common/harness/$resolveHarnessCommandPath.d.ts +14 -0
- package/esm/src/cli/cli-commands/common/harness/$resolveHarnessInstallationOrigin.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$runHarnessInstallationCommand.d.ts +43 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +62 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessInstallationOrigin.d.ts +36 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +8 -2
- package/esm/src/cli/cli-commands/common/harness/HarnessUpdatePlan.d.ts +23 -0
- package/esm/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +4 -1
- package/esm/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.d.ts +8 -0
- package/esm/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.d.ts +31 -0
- package/esm/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +11 -0
- package/{umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
- package/esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/npm/$resolveNpmGlobalPrefixPath.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/projectInitialization.d.ts +6 -0
- package/esm/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +17 -4
- package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +15 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
- package/esm/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +19 -0
- package/esm/src/cli/common/$deprecateCliCommand.d.ts +3 -0
- package/esm/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
- package/esm/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
- package/esm/src/cli/common/$requireCliSubcommand.d.ts +18 -0
- package/esm/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
- package/esm/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +14 -7
- package/esm/src/commitments/index.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
- package/esm/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
- package/esm/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
- package/esm/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
- package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +62 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -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/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
- package/esm/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
- package/esm/src/utils/files/findFilesByGlob.d.ts +28 -0
- package/esm/src/utils/misc/debounce.d.ts +4 -2
- package/esm/src/utils/misc/debounce.test.d.ts +1 -0
- package/esm/src/utils/misc/emojis.d.ts +3 -2
- package/esm/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -7
- package/umd/index.umd.js +530 -106
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +4 -0
- package/umd/src/_packages/types.index.d.ts +4 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.test.d.ts +1 -0
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/umd/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
- 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/createAgentModelRequirements.deduplication.test.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
- package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
- package/umd/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -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-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
- package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
- package/umd/src/book-3.0/AgentMessageRunReport.d.ts +46 -0
- package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +127 -0
- package/umd/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
- package/umd/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
- package/umd/src/book-3.0/cliAgentEnv.d.ts +3 -3
- package/umd/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
- package/umd/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
- package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
- package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
- package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -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/Chat/ChatProps.d.ts +3 -2
- package/umd/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
- package/umd/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
- package/umd/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
- package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +85 -0
- package/umd/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +68 -3
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +30 -0
- package/umd/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +10 -0
- package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
- package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
- package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
- package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
- package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
- package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
- package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/init.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +8 -5
- package/umd/src/cli/cli-commands/coder/list.d.ts +10 -0
- package/umd/src/cli/cli-commands/coder/list.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
- package/umd/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/server.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/verify.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
- package/umd/src/cli/cli-commands/coder.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/$askForConfirmation.d.ts +11 -0
- package/umd/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +46 -0
- package/umd/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
- package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
- package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
- package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
- package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
- package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +3 -2
- 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 +4 -3
- package/umd/src/cli/cli-commands/common/harness/$resolveHarnessCommandPath.d.ts +14 -0
- package/umd/src/cli/cli-commands/common/harness/$resolveHarnessInstallationOrigin.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$runHarnessInstallationCommand.d.ts +43 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +62 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessInstallationOrigin.d.ts +36 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +8 -2
- package/umd/src/cli/cli-commands/common/harness/HarnessUpdatePlan.d.ts +23 -0
- package/umd/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +4 -1
- package/umd/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.d.ts +8 -0
- package/umd/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.d.ts +31 -0
- package/umd/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +11 -0
- package/{esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
- package/umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/$resolveNpmGlobalPrefixPath.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/projectInitialization.d.ts +6 -0
- package/umd/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +17 -4
- package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +15 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
- package/umd/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +19 -0
- package/umd/src/cli/common/$deprecateCliCommand.d.ts +3 -0
- package/umd/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
- package/umd/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
- package/umd/src/cli/common/$requireCliSubcommand.d.ts +18 -0
- package/umd/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
- package/umd/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +14 -7
- package/umd/src/commitments/index.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
- package/umd/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
- package/umd/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
- package/umd/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
- package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +62 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -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/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
- package/umd/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
- package/umd/src/utils/files/findFilesByGlob.d.ts +28 -0
- package/umd/src/utils/misc/debounce.d.ts +4 -2
- package/umd/src/utils/misc/debounce.test.d.ts +1 -0
- package/umd/src/utils/misc/emojis.d.ts +3 -2
- package/umd/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
- package/esm/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +0 -9
- package/esm/src/cli/cli-commands/common/harness/$installHarness.d.ts +0 -13
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
- package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
- package/umd/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +0 -9
- package/umd/src/cli/cli-commands/common/harness/$installHarness.d.ts +0 -13
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
- /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
- /package/esm/src/{cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → esm/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-40';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2603,6 +2603,12 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
2603
2603
|
|
|
2604
2604
|
Inherits agent source from another agent.
|
|
2605
2605
|
|
|
2606
|
+
Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
|
|
2607
|
+
is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
|
|
2608
|
+
|
|
2609
|
+
An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
|
|
2610
|
+
overrides every earlier one.
|
|
2611
|
+
|
|
2606
2612
|
## Examples
|
|
2607
2613
|
|
|
2608
2614
|
\`\`\`book
|
|
@@ -2611,6 +2617,13 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
2611
2617
|
FROM https://s6.ptbk.io/benjamin-white
|
|
2612
2618
|
RULE Speak only in English.
|
|
2613
2619
|
\`\`\`
|
|
2620
|
+
|
|
2621
|
+
\`\`\`book
|
|
2622
|
+
My Standalone Agent
|
|
2623
|
+
|
|
2624
|
+
FROM @Null
|
|
2625
|
+
RULE Speak only in English.
|
|
2626
|
+
\`\`\`
|
|
2614
2627
|
`);
|
|
2615
2628
|
}
|
|
2616
2629
|
applyToAgentModelRequirements(requirements, content) {
|
|
@@ -4115,6 +4128,13 @@ function darken(amount) {
|
|
|
4115
4128
|
}
|
|
4116
4129
|
|
|
4117
4130
|
/* eslint-disable no-magic-numbers */
|
|
4131
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4132
|
+
/**
|
|
4133
|
+
* Default square size used by avatar renderers.
|
|
4134
|
+
*
|
|
4135
|
+
* @private utility of the avatar rendering system
|
|
4136
|
+
*/
|
|
4137
|
+
const DEFAULT_AVATAR_SIZE = 192;
|
|
4118
4138
|
/**
|
|
4119
4139
|
* Corner radius ratio used for the common rounded card frame.
|
|
4120
4140
|
*
|
|
@@ -4485,6 +4505,15 @@ const OUTLINE_GLYPHS = ['#', '%', '@'];
|
|
|
4485
4505
|
* @private helper of `asciiOctopusAvatarVisual`
|
|
4486
4506
|
*/
|
|
4487
4507
|
const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
|
|
4508
|
+
/**
|
|
4509
|
+
* Coordinate space the octopus layout is generated in when it is painted into a terminal.
|
|
4510
|
+
*
|
|
4511
|
+
* The terminal renderer has its own character grid, so the geometry only needs one stable
|
|
4512
|
+
* square coordinate space which the grid is then sampled from.
|
|
4513
|
+
*
|
|
4514
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4515
|
+
*/
|
|
4516
|
+
const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
|
|
4488
4517
|
/**
|
|
4489
4518
|
* AsciiOctopus avatar visual.
|
|
4490
4519
|
*
|
|
@@ -4501,41 +4530,115 @@ const asciiOctopusAvatarVisual = {
|
|
|
4501
4530
|
const staticRandom = createRandom('ascii-octopus-static');
|
|
4502
4531
|
const gridMetrics = createAsciiGridMetrics(size, gridRandom);
|
|
4503
4532
|
const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
|
|
4533
|
+
const glyphGrid = createAsciiOctopusGlyphGrid({
|
|
4534
|
+
sampleGrid: gridMetrics,
|
|
4535
|
+
layout,
|
|
4536
|
+
palette,
|
|
4537
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
4538
|
+
timeMs,
|
|
4539
|
+
});
|
|
4504
4540
|
drawAvatarFrame(context, size, palette);
|
|
4505
4541
|
drawAsciiBackdrop(context, size, palette, layout, timeMs);
|
|
4506
4542
|
context.save();
|
|
4507
4543
|
context.font = `600 ${gridMetrics.fontSize}px monospace`;
|
|
4508
4544
|
context.textAlign = 'center';
|
|
4509
4545
|
context.textBaseline = 'middle';
|
|
4510
|
-
// The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
|
|
4511
|
-
// while the glyph layout remains deterministic for the same avatar input.
|
|
4512
|
-
const cellRandom = createRandom('ascii-octopus-cells');
|
|
4513
4546
|
for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
|
|
4514
4547
|
for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
|
|
4515
|
-
const
|
|
4516
|
-
x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
|
|
4517
|
-
y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
|
|
4518
|
-
};
|
|
4519
|
-
const noise = cellRandom();
|
|
4520
|
-
const glyphDescriptor = resolveAsciiGlyph({
|
|
4521
|
-
point,
|
|
4522
|
-
layout,
|
|
4523
|
-
palette,
|
|
4524
|
-
cellWidth: gridMetrics.cellWidth,
|
|
4525
|
-
cellHeight: gridMetrics.cellHeight,
|
|
4526
|
-
noise,
|
|
4527
|
-
timeMs,
|
|
4528
|
-
});
|
|
4548
|
+
const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
|
|
4529
4549
|
if (!glyphDescriptor) {
|
|
4530
4550
|
continue;
|
|
4531
4551
|
}
|
|
4552
|
+
const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
|
|
4532
4553
|
context.fillStyle = glyphDescriptor.color;
|
|
4533
4554
|
context.fillText(glyphDescriptor.character, point.x, point.y);
|
|
4534
4555
|
}
|
|
4535
4556
|
}
|
|
4536
4557
|
context.restore();
|
|
4537
4558
|
},
|
|
4559
|
+
renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
|
|
4560
|
+
const staticRandom = createRandom('ascii-octopus-static');
|
|
4561
|
+
const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
|
|
4562
|
+
return createAsciiOctopusGlyphGrid({
|
|
4563
|
+
sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
|
|
4564
|
+
layout,
|
|
4565
|
+
palette,
|
|
4566
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
4567
|
+
timeMs,
|
|
4568
|
+
});
|
|
4569
|
+
},
|
|
4538
4570
|
};
|
|
4571
|
+
/**
|
|
4572
|
+
* Resolves the geometry point sampled for one cell of the grid.
|
|
4573
|
+
*
|
|
4574
|
+
* @param sampleGrid Character-cell sampling grid.
|
|
4575
|
+
* @param columnIndex Zero-based cell column.
|
|
4576
|
+
* @param rowIndex Zero-based cell row.
|
|
4577
|
+
* @returns Sampled point in the octopus coordinate space.
|
|
4578
|
+
*
|
|
4579
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4580
|
+
*/
|
|
4581
|
+
function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
|
|
4582
|
+
return {
|
|
4583
|
+
x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
|
|
4584
|
+
y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
|
|
4585
|
+
};
|
|
4586
|
+
}
|
|
4587
|
+
/**
|
|
4588
|
+
* Builds the sampling grid used when the octopus is painted straight into terminal character cells.
|
|
4589
|
+
*
|
|
4590
|
+
* @param columns Available terminal columns.
|
|
4591
|
+
* @param rows Available terminal rows.
|
|
4592
|
+
* @returns Character-cell sampling grid covering the whole octopus coordinate space.
|
|
4593
|
+
*
|
|
4594
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4595
|
+
*/
|
|
4596
|
+
function createAsciiTerminalSampleGrid(columns, rows) {
|
|
4597
|
+
const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
|
|
4598
|
+
const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
|
|
4599
|
+
return {
|
|
4600
|
+
cellWidth,
|
|
4601
|
+
cellHeight,
|
|
4602
|
+
columnCount: columns,
|
|
4603
|
+
rowCount: rows,
|
|
4604
|
+
offsetX: cellWidth / 2,
|
|
4605
|
+
offsetY: cellHeight / 2,
|
|
4606
|
+
};
|
|
4607
|
+
}
|
|
4608
|
+
/**
|
|
4609
|
+
* Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
|
|
4610
|
+
*
|
|
4611
|
+
* The field is sampled on a low-resolution grid so the shape stays organic while the glyph
|
|
4612
|
+
* layout remains deterministic for the same avatar input. Both the canvas visual and the
|
|
4613
|
+
* terminal visual share this single sampling pass so they always describe the same octopus.
|
|
4614
|
+
*
|
|
4615
|
+
* @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
|
|
4616
|
+
* @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
|
|
4617
|
+
*
|
|
4618
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
4619
|
+
*/
|
|
4620
|
+
function createAsciiOctopusGlyphGrid(options) {
|
|
4621
|
+
const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
|
|
4622
|
+
const glyphGrid = [];
|
|
4623
|
+
for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
|
|
4624
|
+
const glyphRow = [];
|
|
4625
|
+
for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
|
|
4626
|
+
const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
|
|
4627
|
+
const noise = cellRandom();
|
|
4628
|
+
glyphRow.push(resolveAsciiGlyph({
|
|
4629
|
+
point,
|
|
4630
|
+
layout,
|
|
4631
|
+
palette,
|
|
4632
|
+
cellWidth: sampleGrid.cellWidth,
|
|
4633
|
+
cellHeight: sampleGrid.cellHeight,
|
|
4634
|
+
noise,
|
|
4635
|
+
timeMs,
|
|
4636
|
+
}));
|
|
4637
|
+
}
|
|
4638
|
+
glyphGrid.push(glyphRow);
|
|
4639
|
+
}
|
|
4640
|
+
return glyphGrid;
|
|
4641
|
+
}
|
|
4539
4642
|
/**
|
|
4540
4643
|
* Draws the dark terminal-like glow behind the ASCII octopus.
|
|
4541
4644
|
*
|
|
@@ -16932,29 +17035,36 @@ class UseUserLocationCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16932
17035
|
/**
|
|
16933
17036
|
* `WRITING RULES` commitment definition.
|
|
16934
17037
|
*
|
|
16935
|
-
*
|
|
16936
|
-
* rather than task-solving behavior.
|
|
17038
|
+
* The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
|
|
17039
|
+
* and presentation rather than task-solving behavior.
|
|
17040
|
+
*
|
|
17041
|
+
* Example usage in agent source:
|
|
17042
|
+
*
|
|
17043
|
+
* ```book
|
|
17044
|
+
* WRITING RULES Keep every response under 120 words
|
|
17045
|
+
* WRITING RULE Always end the message with an emoji
|
|
17046
|
+
* ```
|
|
16937
17047
|
*
|
|
16938
17048
|
* @private [🪔] Maybe export the commitments through some package
|
|
16939
17049
|
*/
|
|
16940
17050
|
class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
16941
|
-
constructor() {
|
|
16942
|
-
super(
|
|
17051
|
+
constructor(type = 'WRITING RULES') {
|
|
17052
|
+
super(type);
|
|
16943
17053
|
}
|
|
16944
17054
|
/**
|
|
16945
|
-
* Short one-line description of `WRITING RULES`.
|
|
17055
|
+
* Short one-line description of `WRITING RULES`/`WRITING RULE`.
|
|
16946
17056
|
*/
|
|
16947
17057
|
get description() {
|
|
16948
17058
|
return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
|
|
16949
17059
|
}
|
|
16950
17060
|
/**
|
|
16951
|
-
* Icon for `WRITING RULES`.
|
|
17061
|
+
* Icon for `WRITING RULES`/`WRITING RULE`.
|
|
16952
17062
|
*/
|
|
16953
17063
|
get icon() {
|
|
16954
17064
|
return '📝';
|
|
16955
17065
|
}
|
|
16956
17066
|
/**
|
|
16957
|
-
* Markdown documentation for `WRITING RULES
|
|
17067
|
+
* Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
|
|
16958
17068
|
*/
|
|
16959
17069
|
get documentation() {
|
|
16960
17070
|
return spaceTrim$1(`
|
|
@@ -16964,6 +17074,7 @@ class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16964
17074
|
|
|
16965
17075
|
## Key aspects
|
|
16966
17076
|
|
|
17077
|
+
- All writing rules are treated equally regardless of singular/plural form.
|
|
16967
17078
|
- Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
|
|
16968
17079
|
- Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
|
|
16969
17080
|
- Newer writing-rules blocks override conflicting earlier writing-rules blocks.
|
|
@@ -17162,7 +17273,8 @@ const COMMITMENT_REGISTRY = [
|
|
|
17162
17273
|
new LanguageCommitmentDefinition('LANGUAGE'),
|
|
17163
17274
|
new LanguageCommitmentDefinition('LANGUAGES'),
|
|
17164
17275
|
new WritingSampleCommitmentDefinition(),
|
|
17165
|
-
new WritingRulesCommitmentDefinition(),
|
|
17276
|
+
new WritingRulesCommitmentDefinition('WRITING RULES'),
|
|
17277
|
+
new WritingRulesCommitmentDefinition('WRITING RULE'),
|
|
17166
17278
|
new SampleCommitmentDefinition('SAMPLE'),
|
|
17167
17279
|
new SampleCommitmentDefinition('EXAMPLE'),
|
|
17168
17280
|
new FormatCommitmentDefinition('FORMAT'),
|
|
@@ -18470,6 +18582,30 @@ function createDefaultAgentName(agentSource) {
|
|
|
18470
18582
|
return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
|
|
18471
18583
|
}
|
|
18472
18584
|
|
|
18585
|
+
/**
|
|
18586
|
+
* Pattern shared by Book parsing and editor highlighting for a commitment-like line.
|
|
18587
|
+
*
|
|
18588
|
+
* A Book commitment keyword consists of one or more all-uppercase words with at least
|
|
18589
|
+
* two characters each. This deliberately mirrors the Book editor syntax rule so an
|
|
18590
|
+
* unknown keyword starts a new source block everywhere it is interpreted.
|
|
18591
|
+
*
|
|
18592
|
+
* @private internal constant of `getBookCommitmentLineType`
|
|
18593
|
+
*/
|
|
18594
|
+
const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
|
|
18595
|
+
/**
|
|
18596
|
+
* Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
|
|
18597
|
+
*
|
|
18598
|
+
* @param line - One raw Book source line.
|
|
18599
|
+
* @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
|
|
18600
|
+
*
|
|
18601
|
+
* @private internal utility of Book parsing and `<BookEditor/>`
|
|
18602
|
+
*/
|
|
18603
|
+
function getBookCommitmentLineType(line) {
|
|
18604
|
+
var _a;
|
|
18605
|
+
const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
|
|
18606
|
+
return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
|
|
18607
|
+
}
|
|
18608
|
+
|
|
18473
18609
|
/**
|
|
18474
18610
|
* Consumes the agent-name prelude from raw source.
|
|
18475
18611
|
*
|
|
@@ -18527,13 +18663,15 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
18527
18663
|
return {
|
|
18528
18664
|
agentName: null,
|
|
18529
18665
|
commitments: [],
|
|
18666
|
+
unknownCommitments: [],
|
|
18530
18667
|
nonCommitmentLines: [],
|
|
18531
18668
|
};
|
|
18532
18669
|
}
|
|
18533
18670
|
const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
|
|
18534
18671
|
const commitments = [];
|
|
18672
|
+
const unknownCommitments = [];
|
|
18535
18673
|
const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
|
|
18536
|
-
// Parse commitments with multiline support
|
|
18674
|
+
// Parse commitments with multiline support.
|
|
18537
18675
|
let currentCommitment = null;
|
|
18538
18676
|
// Process lines starting from after the agent name line
|
|
18539
18677
|
const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
|
|
@@ -18547,25 +18685,11 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
18547
18685
|
// Check if this line starts or ends a code block
|
|
18548
18686
|
if (trimmedLine.startsWith('```')) {
|
|
18549
18687
|
isInsideCodeBlock = !isInsideCodeBlock;
|
|
18550
|
-
|
|
18551
|
-
// If we are inside a commitment, the code block is part of it
|
|
18552
|
-
currentCommitment.contentLines.push(line);
|
|
18553
|
-
}
|
|
18554
|
-
else {
|
|
18555
|
-
// If we are not inside a commitment, the code block is non-commitment
|
|
18556
|
-
nonCommitmentLines.push(line);
|
|
18557
|
-
}
|
|
18688
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
18558
18689
|
continue;
|
|
18559
18690
|
}
|
|
18560
18691
|
if (isInsideCodeBlock) {
|
|
18561
|
-
|
|
18562
|
-
// If we are inside a commitment and a code block, the line is part of the commitment
|
|
18563
|
-
currentCommitment.contentLines.push(line);
|
|
18564
|
-
}
|
|
18565
|
-
else {
|
|
18566
|
-
// If we are inside a code block but not a commitment, the line is non-commitment
|
|
18567
|
-
nonCommitmentLines.push(line);
|
|
18568
|
-
}
|
|
18692
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
18569
18693
|
continue;
|
|
18570
18694
|
}
|
|
18571
18695
|
// Check if this line starts a new commitment
|
|
@@ -18574,22 +18698,14 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
18574
18698
|
const typeRegex = definition.createTypeRegex();
|
|
18575
18699
|
const match = typeRegex.exec(line.trim());
|
|
18576
18700
|
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
18577
|
-
|
|
18578
|
-
if (currentCommitment) {
|
|
18579
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
18580
|
-
commitments.push({
|
|
18581
|
-
type: currentCommitment.type,
|
|
18582
|
-
content: spaceTrim$1(fullContent),
|
|
18583
|
-
originalLine: currentCommitment.originalStartLine,
|
|
18584
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
18585
|
-
});
|
|
18586
|
-
}
|
|
18701
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
18587
18702
|
// Extract the initial content from the commitment line
|
|
18588
18703
|
const fullRegex = definition.createRegex();
|
|
18589
18704
|
const fullMatch = fullRegex.exec(line.trim());
|
|
18590
18705
|
const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
|
|
18591
18706
|
// Start a new commitment
|
|
18592
18707
|
currentCommitment = {
|
|
18708
|
+
kind: 'known',
|
|
18593
18709
|
type: definition.type,
|
|
18594
18710
|
startLineNumber: i + 1,
|
|
18595
18711
|
originalStartLine: line,
|
|
@@ -18599,52 +18715,90 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
18599
18715
|
break;
|
|
18600
18716
|
}
|
|
18601
18717
|
}
|
|
18718
|
+
if (foundNewCommitment) {
|
|
18719
|
+
continue;
|
|
18720
|
+
}
|
|
18721
|
+
const unknownCommitmentType = getBookCommitmentLineType(line);
|
|
18722
|
+
if (unknownCommitmentType) {
|
|
18723
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
18724
|
+
currentCommitment = {
|
|
18725
|
+
kind: 'unknown',
|
|
18726
|
+
type: unknownCommitmentType,
|
|
18727
|
+
startLineNumber: i + 1,
|
|
18728
|
+
originalStartLine: line,
|
|
18729
|
+
sourceLines: [line],
|
|
18730
|
+
};
|
|
18731
|
+
continue;
|
|
18732
|
+
}
|
|
18602
18733
|
// Check if this is a horizontal line (ends any current commitment)
|
|
18603
18734
|
const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
|
|
18604
18735
|
if (isHorizontalLine) {
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
18608
|
-
commitments.push({
|
|
18609
|
-
type: currentCommitment.type,
|
|
18610
|
-
content: spaceTrim$1(fullContent),
|
|
18611
|
-
originalLine: currentCommitment.originalStartLine,
|
|
18612
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
18613
|
-
});
|
|
18614
|
-
currentCommitment = null;
|
|
18615
|
-
}
|
|
18736
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
18737
|
+
currentCommitment = null;
|
|
18616
18738
|
// Add horizontal line to non-commitment lines
|
|
18617
18739
|
nonCommitmentLines.push(line);
|
|
18618
18740
|
continue;
|
|
18619
18741
|
}
|
|
18620
|
-
|
|
18621
|
-
if (currentCommitment) {
|
|
18622
|
-
// This line belongs to the current commitment
|
|
18623
|
-
currentCommitment.contentLines.push(line);
|
|
18624
|
-
}
|
|
18625
|
-
else {
|
|
18626
|
-
// This line is not part of any commitment
|
|
18627
|
-
nonCommitmentLines.push(line);
|
|
18628
|
-
}
|
|
18629
|
-
}
|
|
18630
|
-
}
|
|
18631
|
-
// Don't forget to save the last commitment if it exists
|
|
18632
|
-
if (currentCommitment) {
|
|
18633
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
18634
|
-
commitments.push({
|
|
18635
|
-
type: currentCommitment.type,
|
|
18636
|
-
content: spaceTrim$1(fullContent),
|
|
18637
|
-
originalLine: currentCommitment.originalStartLine,
|
|
18638
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
18639
|
-
});
|
|
18742
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
18640
18743
|
}
|
|
18744
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
18641
18745
|
return {
|
|
18642
18746
|
agentName,
|
|
18643
18747
|
agentNameLineNumber,
|
|
18644
18748
|
commitments,
|
|
18749
|
+
unknownCommitments,
|
|
18645
18750
|
nonCommitmentLines,
|
|
18646
18751
|
};
|
|
18647
18752
|
}
|
|
18753
|
+
/**
|
|
18754
|
+
* Stores the current known or unknown commitment in its appropriate parsed collection.
|
|
18755
|
+
*
|
|
18756
|
+
* @param currentCommitment - Commitment-like block collected so far.
|
|
18757
|
+
* @param commitments - Parsed registered commitments to append to.
|
|
18758
|
+
* @param unknownCommitments - Parsed unregistered commitments to append to.
|
|
18759
|
+
*
|
|
18760
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
18761
|
+
*/
|
|
18762
|
+
function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
|
|
18763
|
+
if (!currentCommitment) {
|
|
18764
|
+
return;
|
|
18765
|
+
}
|
|
18766
|
+
if (currentCommitment.kind === 'unknown') {
|
|
18767
|
+
unknownCommitments.push({
|
|
18768
|
+
type: currentCommitment.type,
|
|
18769
|
+
originalLine: currentCommitment.originalStartLine,
|
|
18770
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
18771
|
+
source: spaceTrim$1(currentCommitment.sourceLines.join('\n')),
|
|
18772
|
+
});
|
|
18773
|
+
return;
|
|
18774
|
+
}
|
|
18775
|
+
commitments.push({
|
|
18776
|
+
type: currentCommitment.type,
|
|
18777
|
+
content: spaceTrim$1(currentCommitment.contentLines.join('\n')),
|
|
18778
|
+
originalLine: currentCommitment.originalStartLine,
|
|
18779
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
18780
|
+
});
|
|
18781
|
+
}
|
|
18782
|
+
/**
|
|
18783
|
+
* Adds one source line to the active commitment-like block, or to plain source content when none is active.
|
|
18784
|
+
*
|
|
18785
|
+
* @param currentCommitment - Commitment-like block currently being collected.
|
|
18786
|
+
* @param line - Source line to append.
|
|
18787
|
+
* @param nonCommitmentLines - Plain source lines to append to when no block is active.
|
|
18788
|
+
*
|
|
18789
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
18790
|
+
*/
|
|
18791
|
+
function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
|
|
18792
|
+
if (!currentCommitment) {
|
|
18793
|
+
nonCommitmentLines.push(line);
|
|
18794
|
+
return;
|
|
18795
|
+
}
|
|
18796
|
+
if (currentCommitment.kind === 'unknown') {
|
|
18797
|
+
currentCommitment.sourceLines.push(line);
|
|
18798
|
+
return;
|
|
18799
|
+
}
|
|
18800
|
+
currentCommitment.contentLines.push(line);
|
|
18801
|
+
}
|
|
18648
18802
|
|
|
18649
18803
|
/**
|
|
18650
18804
|
* Parses parameters from text using both supported notations:
|
|
@@ -19545,7 +19699,7 @@ function validateBook(source) {
|
|
|
19545
19699
|
padBook(validateBook(spaceTrim$1(`
|
|
19546
19700
|
AI Avatar
|
|
19547
19701
|
|
|
19548
|
-
|
|
19702
|
+
GOAL Help users with their tasks as a friendly AI assistant.
|
|
19549
19703
|
`)));
|
|
19550
19704
|
// <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
|
|
19551
19705
|
// <- TODO: [🐱🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
|
|
@@ -26427,7 +26581,8 @@ async function augmentAgentModelRequirementsFromSource(requirements, parseResult
|
|
|
26427
26581
|
requirements = await importReferencedFiles(requirements);
|
|
26428
26582
|
requirements = appendMcpServers(requirements, agentSource);
|
|
26429
26583
|
requirements = appendNonCommitmentContent(requirements, parseResult);
|
|
26430
|
-
|
|
26584
|
+
requirements = appendExampleInteractions(requirements, parseResult);
|
|
26585
|
+
return appendUnknownCommitmentContent(requirements, parseResult);
|
|
26431
26586
|
}
|
|
26432
26587
|
/**
|
|
26433
26588
|
* Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
|
|
@@ -26549,6 +26704,36 @@ function appendNonCommitmentContent(requirements, parseResult) {
|
|
|
26549
26704
|
}
|
|
26550
26705
|
return appendSystemMessageSection(requirements, nonCommitmentContent);
|
|
26551
26706
|
}
|
|
26707
|
+
/**
|
|
26708
|
+
* Appends unknown commitment blocks as final extra context without applying commitment side effects.
|
|
26709
|
+
*
|
|
26710
|
+
* @param requirements - Current requirements snapshot.
|
|
26711
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
26712
|
+
* @returns Requirements with unknown commitment context appended at the end of the system message.
|
|
26713
|
+
*
|
|
26714
|
+
* @private internal utility of `augmentAgentModelRequirementsFromSource`
|
|
26715
|
+
*/
|
|
26716
|
+
function appendUnknownCommitmentContent(requirements, parseResult) {
|
|
26717
|
+
const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
|
|
26718
|
+
if (!unknownCommitmentContent) {
|
|
26719
|
+
return requirements;
|
|
26720
|
+
}
|
|
26721
|
+
return appendSystemMessageSection(requirements, unknownCommitmentContent);
|
|
26722
|
+
}
|
|
26723
|
+
/**
|
|
26724
|
+
* Joins unknown commitment blocks into their final extra-context representation.
|
|
26725
|
+
*
|
|
26726
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
26727
|
+
* @returns Unknown commitment source blocks in their original order.
|
|
26728
|
+
*
|
|
26729
|
+
* @private internal utility of `appendUnknownCommitmentContent`
|
|
26730
|
+
*/
|
|
26731
|
+
function getUnknownCommitmentContent(parseResult) {
|
|
26732
|
+
return parseResult.unknownCommitments
|
|
26733
|
+
.map((commitment) => commitment.source)
|
|
26734
|
+
.filter(Boolean)
|
|
26735
|
+
.join('\n\n');
|
|
26736
|
+
}
|
|
26552
26737
|
/**
|
|
26553
26738
|
* Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
|
|
26554
26739
|
*
|
|
@@ -26876,6 +27061,245 @@ function stripInlineKnowledgeMetadata(metadata) {
|
|
|
26876
27061
|
return Object.keys(rest).length > 0 ? rest : undefined;
|
|
26877
27062
|
}
|
|
26878
27063
|
|
|
27064
|
+
/**
|
|
27065
|
+
* Pattern matching a markdown section heading (`## Title`) that separates system-message sections
|
|
27066
|
+
*
|
|
27067
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
27068
|
+
*/
|
|
27069
|
+
const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
|
|
27070
|
+
/**
|
|
27071
|
+
* Pattern matching a fenced code block delimiter which suspends section and block splitting
|
|
27072
|
+
*
|
|
27073
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
27074
|
+
*/
|
|
27075
|
+
const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
|
|
27076
|
+
/**
|
|
27077
|
+
* Pattern matching a markdown list item which keeps merged bullet lists visually compact
|
|
27078
|
+
*
|
|
27079
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
27080
|
+
*/
|
|
27081
|
+
const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
|
|
27082
|
+
/**
|
|
27083
|
+
* Removes duplicated instructions from a generated system message
|
|
27084
|
+
*
|
|
27085
|
+
* Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
|
|
27086
|
+
* section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
|
|
27087
|
+
* `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
|
|
27088
|
+
* one heading into the position of their first occurrence and keeps every identical block only once.
|
|
27089
|
+
*
|
|
27090
|
+
* @param systemMessage The assembled system message which may contain repeated sections and blocks
|
|
27091
|
+
* @returns The system message where each section heading and each identical block appears exactly once
|
|
27092
|
+
*
|
|
27093
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
27094
|
+
*/
|
|
27095
|
+
function deduplicateSystemMessage(systemMessage) {
|
|
27096
|
+
if (!systemMessage.trim()) {
|
|
27097
|
+
return systemMessage;
|
|
27098
|
+
}
|
|
27099
|
+
return splitSystemMessageIntoRegions(systemMessage)
|
|
27100
|
+
.reduce(mergeRegionSharingHeading, [])
|
|
27101
|
+
.map(removeDuplicateBlocksFromRegion)
|
|
27102
|
+
.map(renderRegion)
|
|
27103
|
+
.filter((renderedRegion) => renderedRegion !== '')
|
|
27104
|
+
.join('\n\n');
|
|
27105
|
+
}
|
|
27106
|
+
/**
|
|
27107
|
+
* Splits the system message into the intro region and one region per `## Title` section
|
|
27108
|
+
*
|
|
27109
|
+
* @param systemMessage The system message to split
|
|
27110
|
+
* @returns Regions in their original order, without empty ones
|
|
27111
|
+
*
|
|
27112
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
27113
|
+
*/
|
|
27114
|
+
function splitSystemMessageIntoRegions(systemMessage) {
|
|
27115
|
+
const regions = [];
|
|
27116
|
+
let headingLine = null;
|
|
27117
|
+
let bodyLines = [];
|
|
27118
|
+
let isInsideCodeFence = false;
|
|
27119
|
+
for (const line of systemMessage.split(/\r?\n/)) {
|
|
27120
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
27121
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
27122
|
+
}
|
|
27123
|
+
if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
|
|
27124
|
+
bodyLines.push(line);
|
|
27125
|
+
continue;
|
|
27126
|
+
}
|
|
27127
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
27128
|
+
headingLine = line;
|
|
27129
|
+
bodyLines = [];
|
|
27130
|
+
}
|
|
27131
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
27132
|
+
return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
|
|
27133
|
+
}
|
|
27134
|
+
/**
|
|
27135
|
+
* Creates one region from its heading line and its raw body lines
|
|
27136
|
+
*
|
|
27137
|
+
* @param headingLine The original `## Title` line, or `null` for the intro before the first heading
|
|
27138
|
+
* @param bodyLines The raw lines following the heading line
|
|
27139
|
+
* @returns The region with its body already split into blocks
|
|
27140
|
+
*
|
|
27141
|
+
* @private internal utility of `splitSystemMessageIntoRegions`
|
|
27142
|
+
*/
|
|
27143
|
+
function createRegion(headingLine, bodyLines) {
|
|
27144
|
+
return {
|
|
27145
|
+
titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
|
|
27146
|
+
headingLine,
|
|
27147
|
+
isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
|
|
27148
|
+
blocks: splitBodyIntoBlocks(bodyLines),
|
|
27149
|
+
};
|
|
27150
|
+
}
|
|
27151
|
+
/**
|
|
27152
|
+
* Normalizes a heading line into a key usable for matching sections which belong together
|
|
27153
|
+
*
|
|
27154
|
+
* @param headingLine The original `## Title` line
|
|
27155
|
+
* @returns Lowercased title without the markdown heading prefix
|
|
27156
|
+
*
|
|
27157
|
+
* @private internal utility of `createRegion`
|
|
27158
|
+
*/
|
|
27159
|
+
function normalizeSectionTitle(headingLine) {
|
|
27160
|
+
var _a, _b;
|
|
27161
|
+
return ((_b = (_a = SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.exec(headingLine)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : headingLine).toLowerCase();
|
|
27162
|
+
}
|
|
27163
|
+
/**
|
|
27164
|
+
* Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
|
|
27165
|
+
*
|
|
27166
|
+
* @param bodyLines The raw lines of one region body
|
|
27167
|
+
* @returns Non-empty blocks in their original order
|
|
27168
|
+
*
|
|
27169
|
+
* @private internal utility of `createRegion`
|
|
27170
|
+
*/
|
|
27171
|
+
function splitBodyIntoBlocks(bodyLines) {
|
|
27172
|
+
const blockTexts = [];
|
|
27173
|
+
let blockLines = [];
|
|
27174
|
+
let isInsideCodeFence = false;
|
|
27175
|
+
for (const line of bodyLines) {
|
|
27176
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
27177
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
27178
|
+
}
|
|
27179
|
+
if (!isInsideCodeFence && line.trim() === '') {
|
|
27180
|
+
blockTexts.push(blockLines.join('\n'));
|
|
27181
|
+
blockLines = [];
|
|
27182
|
+
continue;
|
|
27183
|
+
}
|
|
27184
|
+
blockLines.push(line);
|
|
27185
|
+
}
|
|
27186
|
+
blockTexts.push(blockLines.join('\n'));
|
|
27187
|
+
return blockTexts
|
|
27188
|
+
.filter((blockText) => blockText.trim() !== '')
|
|
27189
|
+
.map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
|
|
27190
|
+
}
|
|
27191
|
+
/**
|
|
27192
|
+
* Appends one region to the already merged regions, merging it into an earlier region with the same heading
|
|
27193
|
+
*
|
|
27194
|
+
* @param mergedRegions Regions merged so far, used as the reducer accumulator
|
|
27195
|
+
* @param region The next region in original order
|
|
27196
|
+
* @returns The accumulator with the region either appended or merged into its earlier twin
|
|
27197
|
+
*
|
|
27198
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
27199
|
+
*/
|
|
27200
|
+
function mergeRegionSharingHeading(mergedRegions, region) {
|
|
27201
|
+
const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
|
|
27202
|
+
if (existingRegionIndex === -1) {
|
|
27203
|
+
return [...mergedRegions, region];
|
|
27204
|
+
}
|
|
27205
|
+
return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
|
|
27206
|
+
? mergedRegion
|
|
27207
|
+
: {
|
|
27208
|
+
...mergedRegion,
|
|
27209
|
+
blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
|
|
27210
|
+
});
|
|
27211
|
+
}
|
|
27212
|
+
/**
|
|
27213
|
+
* Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
|
|
27214
|
+
*
|
|
27215
|
+
* @param blocks The blocks of the section occurrence being merged into an earlier section
|
|
27216
|
+
* @returns The same blocks with the first one marked as opening a merged section
|
|
27217
|
+
*
|
|
27218
|
+
* @private internal utility of `mergeRegionSharingHeading`
|
|
27219
|
+
*/
|
|
27220
|
+
function markFirstBlockAsOpeningMergedSection(blocks) {
|
|
27221
|
+
return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
|
|
27222
|
+
}
|
|
27223
|
+
/**
|
|
27224
|
+
* Keeps only the first occurrence of every identical block inside one region
|
|
27225
|
+
*
|
|
27226
|
+
* @param region The region whose blocks may repeat
|
|
27227
|
+
* @returns The region without repeated blocks
|
|
27228
|
+
*
|
|
27229
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
27230
|
+
*/
|
|
27231
|
+
function removeDuplicateBlocksFromRegion(region) {
|
|
27232
|
+
const alreadyRenderedTexts = new Set();
|
|
27233
|
+
const uniqueBlocks = [];
|
|
27234
|
+
let isMergeSeamPending = false;
|
|
27235
|
+
for (const block of region.blocks) {
|
|
27236
|
+
if (alreadyRenderedTexts.has(block.text)) {
|
|
27237
|
+
// Note: A removed block must still hand its merge seam over to the next block which survives
|
|
27238
|
+
isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
|
|
27239
|
+
continue;
|
|
27240
|
+
}
|
|
27241
|
+
alreadyRenderedTexts.add(block.text);
|
|
27242
|
+
uniqueBlocks.push({
|
|
27243
|
+
text: block.text,
|
|
27244
|
+
isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
|
|
27245
|
+
});
|
|
27246
|
+
isMergeSeamPending = false;
|
|
27247
|
+
}
|
|
27248
|
+
return { ...region, blocks: uniqueBlocks };
|
|
27249
|
+
}
|
|
27250
|
+
/**
|
|
27251
|
+
* Renders one region back into its markdown representation
|
|
27252
|
+
*
|
|
27253
|
+
* @param region The region to render
|
|
27254
|
+
* @returns The heading line together with its joined blocks
|
|
27255
|
+
*
|
|
27256
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
27257
|
+
*/
|
|
27258
|
+
function renderRegion(region) {
|
|
27259
|
+
const body = joinBlocks(region.blocks);
|
|
27260
|
+
if (region.headingLine === null) {
|
|
27261
|
+
return body;
|
|
27262
|
+
}
|
|
27263
|
+
if (body === '') {
|
|
27264
|
+
return region.headingLine;
|
|
27265
|
+
}
|
|
27266
|
+
return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
|
|
27267
|
+
}
|
|
27268
|
+
/**
|
|
27269
|
+
* Joins blocks of one region back together
|
|
27270
|
+
*
|
|
27271
|
+
* @param blocks The blocks to join in their original order
|
|
27272
|
+
* @returns The joined body of one region
|
|
27273
|
+
*
|
|
27274
|
+
* @private internal utility of `renderRegion`
|
|
27275
|
+
*/
|
|
27276
|
+
function joinBlocks(blocks) {
|
|
27277
|
+
return blocks
|
|
27278
|
+
.map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
|
|
27279
|
+
.join('');
|
|
27280
|
+
}
|
|
27281
|
+
/**
|
|
27282
|
+
* Chooses the separator between two neighboring blocks
|
|
27283
|
+
*
|
|
27284
|
+
* Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
|
|
27285
|
+
* merged together their lists are joined into one compact list instead of two separate ones.
|
|
27286
|
+
*
|
|
27287
|
+
* @param previousBlock The block rendered before the separator
|
|
27288
|
+
* @param nextBlock The block rendered after the separator
|
|
27289
|
+
* @returns Either a single or a double newline
|
|
27290
|
+
*
|
|
27291
|
+
* @private internal utility of `joinBlocks`
|
|
27292
|
+
*/
|
|
27293
|
+
function createBlockSeparator(previousBlock, nextBlock) {
|
|
27294
|
+
if (!nextBlock.isOpeningMergedSection) {
|
|
27295
|
+
return '\n\n';
|
|
27296
|
+
}
|
|
27297
|
+
const previousBlockLines = previousBlock.text.split('\n');
|
|
27298
|
+
const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
|
|
27299
|
+
LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
|
|
27300
|
+
return isListContinuing ? '\n' : '\n\n';
|
|
27301
|
+
}
|
|
27302
|
+
|
|
26879
27303
|
/**
|
|
26880
27304
|
* Removes single-hash comment lines (`# Comment`) from a system message
|
|
26881
27305
|
* This is used to clean up the final system message before sending it to the AI model
|
|
@@ -26949,14 +27373,14 @@ function createInitialAgentModelRequirements(agentName, modelName) {
|
|
|
26949
27373
|
* Performs the final system-message cleanup pass after all other augmentation steps are complete.
|
|
26950
27374
|
*
|
|
26951
27375
|
* @param requirements - Fully built requirements before final cleanup.
|
|
26952
|
-
* @returns Requirements with comment lines removed
|
|
27376
|
+
* @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
|
|
26953
27377
|
*
|
|
26954
27378
|
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
26955
27379
|
*/
|
|
26956
27380
|
function finalizeRequirements(requirements) {
|
|
26957
27381
|
return {
|
|
26958
27382
|
...requirements,
|
|
26959
|
-
systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
|
|
27383
|
+
systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
|
|
26960
27384
|
};
|
|
26961
27385
|
}
|
|
26962
27386
|
|
|
@@ -27632,28 +28056,28 @@ function parseToolExecutionEnvelope(rawValue) {
|
|
|
27632
28056
|
*/
|
|
27633
28057
|
function buildToolInvocationScript(options) {
|
|
27634
28058
|
const { functionName, functionArgsExpression } = options;
|
|
27635
|
-
return `
|
|
27636
|
-
|
|
27637
|
-
|
|
27638
|
-
|
|
27639
|
-
|
|
27640
|
-
|
|
27641
|
-
|
|
27642
|
-
|
|
27643
|
-
|
|
27644
|
-
|
|
28059
|
+
return spaceTrim$1((block) => `
|
|
28060
|
+
const args = ${block(functionArgsExpression)};
|
|
28061
|
+
const runtimeContextRaw =
|
|
28062
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
28063
|
+
? undefined
|
|
28064
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
28065
|
+
|
|
28066
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
28067
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
28068
|
+
}
|
|
27645
28069
|
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
|
|
28070
|
+
const toolProgressTokenRaw =
|
|
28071
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
28072
|
+
? undefined
|
|
28073
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
27650
28074
|
|
|
27651
|
-
|
|
27652
|
-
|
|
27653
|
-
|
|
28075
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
28076
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
28077
|
+
}
|
|
27654
28078
|
|
|
27655
|
-
|
|
27656
|
-
|
|
28079
|
+
return await ${functionName}(args);
|
|
28080
|
+
`);
|
|
27657
28081
|
}
|
|
27658
28082
|
|
|
27659
28083
|
/**
|