@promptbook/core 0.114.0-4 → 0.114.0-41
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 +586 -127
- 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/HARNESS_DEFAULT_MODELS.d.ts +25 -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 -9
- package/umd/index.umd.js +586 -127
- 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/HARNESS_DEFAULT_MODELS.d.ts +25 -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/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-41';
|
|
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
|
|
@@ -9898,6 +9898,12 @@
|
|
|
9898
9898
|
|
|
9899
9899
|
Inherits agent source from another agent.
|
|
9900
9900
|
|
|
9901
|
+
Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
|
|
9902
|
+
is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
|
|
9903
|
+
|
|
9904
|
+
An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
|
|
9905
|
+
overrides every earlier one.
|
|
9906
|
+
|
|
9901
9907
|
## Examples
|
|
9902
9908
|
|
|
9903
9909
|
\`\`\`book
|
|
@@ -9906,6 +9912,13 @@
|
|
|
9906
9912
|
FROM https://s6.ptbk.io/benjamin-white
|
|
9907
9913
|
RULE Speak only in English.
|
|
9908
9914
|
\`\`\`
|
|
9915
|
+
|
|
9916
|
+
\`\`\`book
|
|
9917
|
+
My Standalone Agent
|
|
9918
|
+
|
|
9919
|
+
FROM @Null
|
|
9920
|
+
RULE Speak only in English.
|
|
9921
|
+
\`\`\`
|
|
9909
9922
|
`);
|
|
9910
9923
|
}
|
|
9911
9924
|
applyToAgentModelRequirements(requirements, content) {
|
|
@@ -11038,6 +11051,13 @@
|
|
|
11038
11051
|
}
|
|
11039
11052
|
|
|
11040
11053
|
/* eslint-disable no-magic-numbers */
|
|
11054
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11055
|
+
/**
|
|
11056
|
+
* Default square size used by avatar renderers.
|
|
11057
|
+
*
|
|
11058
|
+
* @private utility of the avatar rendering system
|
|
11059
|
+
*/
|
|
11060
|
+
const DEFAULT_AVATAR_SIZE = 192;
|
|
11041
11061
|
/**
|
|
11042
11062
|
* Corner radius ratio used for the common rounded card frame.
|
|
11043
11063
|
*
|
|
@@ -11408,6 +11428,15 @@
|
|
|
11408
11428
|
* @private helper of `asciiOctopusAvatarVisual`
|
|
11409
11429
|
*/
|
|
11410
11430
|
const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
|
|
11431
|
+
/**
|
|
11432
|
+
* Coordinate space the octopus layout is generated in when it is painted into a terminal.
|
|
11433
|
+
*
|
|
11434
|
+
* The terminal renderer has its own character grid, so the geometry only needs one stable
|
|
11435
|
+
* square coordinate space which the grid is then sampled from.
|
|
11436
|
+
*
|
|
11437
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
11438
|
+
*/
|
|
11439
|
+
const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
|
|
11411
11440
|
/**
|
|
11412
11441
|
* AsciiOctopus avatar visual.
|
|
11413
11442
|
*
|
|
@@ -11424,41 +11453,115 @@
|
|
|
11424
11453
|
const staticRandom = createRandom('ascii-octopus-static');
|
|
11425
11454
|
const gridMetrics = createAsciiGridMetrics(size, gridRandom);
|
|
11426
11455
|
const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
|
|
11456
|
+
const glyphGrid = createAsciiOctopusGlyphGrid({
|
|
11457
|
+
sampleGrid: gridMetrics,
|
|
11458
|
+
layout,
|
|
11459
|
+
palette,
|
|
11460
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
11461
|
+
timeMs,
|
|
11462
|
+
});
|
|
11427
11463
|
drawAvatarFrame(context, size, palette);
|
|
11428
11464
|
drawAsciiBackdrop(context, size, palette, layout, timeMs);
|
|
11429
11465
|
context.save();
|
|
11430
11466
|
context.font = `600 ${gridMetrics.fontSize}px monospace`;
|
|
11431
11467
|
context.textAlign = 'center';
|
|
11432
11468
|
context.textBaseline = 'middle';
|
|
11433
|
-
// The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
|
|
11434
|
-
// while the glyph layout remains deterministic for the same avatar input.
|
|
11435
|
-
const cellRandom = createRandom('ascii-octopus-cells');
|
|
11436
11469
|
for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
|
|
11437
11470
|
for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
|
|
11438
|
-
const
|
|
11439
|
-
x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
|
|
11440
|
-
y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
|
|
11441
|
-
};
|
|
11442
|
-
const noise = cellRandom();
|
|
11443
|
-
const glyphDescriptor = resolveAsciiGlyph({
|
|
11444
|
-
point,
|
|
11445
|
-
layout,
|
|
11446
|
-
palette,
|
|
11447
|
-
cellWidth: gridMetrics.cellWidth,
|
|
11448
|
-
cellHeight: gridMetrics.cellHeight,
|
|
11449
|
-
noise,
|
|
11450
|
-
timeMs,
|
|
11451
|
-
});
|
|
11471
|
+
const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
|
|
11452
11472
|
if (!glyphDescriptor) {
|
|
11453
11473
|
continue;
|
|
11454
11474
|
}
|
|
11475
|
+
const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
|
|
11455
11476
|
context.fillStyle = glyphDescriptor.color;
|
|
11456
11477
|
context.fillText(glyphDescriptor.character, point.x, point.y);
|
|
11457
11478
|
}
|
|
11458
11479
|
}
|
|
11459
11480
|
context.restore();
|
|
11460
11481
|
},
|
|
11482
|
+
renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
|
|
11483
|
+
const staticRandom = createRandom('ascii-octopus-static');
|
|
11484
|
+
const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
|
|
11485
|
+
return createAsciiOctopusGlyphGrid({
|
|
11486
|
+
sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
|
|
11487
|
+
layout,
|
|
11488
|
+
palette,
|
|
11489
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
11490
|
+
timeMs,
|
|
11491
|
+
});
|
|
11492
|
+
},
|
|
11461
11493
|
};
|
|
11494
|
+
/**
|
|
11495
|
+
* Resolves the geometry point sampled for one cell of the grid.
|
|
11496
|
+
*
|
|
11497
|
+
* @param sampleGrid Character-cell sampling grid.
|
|
11498
|
+
* @param columnIndex Zero-based cell column.
|
|
11499
|
+
* @param rowIndex Zero-based cell row.
|
|
11500
|
+
* @returns Sampled point in the octopus coordinate space.
|
|
11501
|
+
*
|
|
11502
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
11503
|
+
*/
|
|
11504
|
+
function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
|
|
11505
|
+
return {
|
|
11506
|
+
x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
|
|
11507
|
+
y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
|
|
11508
|
+
};
|
|
11509
|
+
}
|
|
11510
|
+
/**
|
|
11511
|
+
* Builds the sampling grid used when the octopus is painted straight into terminal character cells.
|
|
11512
|
+
*
|
|
11513
|
+
* @param columns Available terminal columns.
|
|
11514
|
+
* @param rows Available terminal rows.
|
|
11515
|
+
* @returns Character-cell sampling grid covering the whole octopus coordinate space.
|
|
11516
|
+
*
|
|
11517
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
11518
|
+
*/
|
|
11519
|
+
function createAsciiTerminalSampleGrid(columns, rows) {
|
|
11520
|
+
const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
|
|
11521
|
+
const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
|
|
11522
|
+
return {
|
|
11523
|
+
cellWidth,
|
|
11524
|
+
cellHeight,
|
|
11525
|
+
columnCount: columns,
|
|
11526
|
+
rowCount: rows,
|
|
11527
|
+
offsetX: cellWidth / 2,
|
|
11528
|
+
offsetY: cellHeight / 2,
|
|
11529
|
+
};
|
|
11530
|
+
}
|
|
11531
|
+
/**
|
|
11532
|
+
* Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
|
|
11533
|
+
*
|
|
11534
|
+
* The field is sampled on a low-resolution grid so the shape stays organic while the glyph
|
|
11535
|
+
* layout remains deterministic for the same avatar input. Both the canvas visual and the
|
|
11536
|
+
* terminal visual share this single sampling pass so they always describe the same octopus.
|
|
11537
|
+
*
|
|
11538
|
+
* @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
|
|
11539
|
+
* @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
|
|
11540
|
+
*
|
|
11541
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
11542
|
+
*/
|
|
11543
|
+
function createAsciiOctopusGlyphGrid(options) {
|
|
11544
|
+
const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
|
|
11545
|
+
const glyphGrid = [];
|
|
11546
|
+
for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
|
|
11547
|
+
const glyphRow = [];
|
|
11548
|
+
for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
|
|
11549
|
+
const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
|
|
11550
|
+
const noise = cellRandom();
|
|
11551
|
+
glyphRow.push(resolveAsciiGlyph({
|
|
11552
|
+
point,
|
|
11553
|
+
layout,
|
|
11554
|
+
palette,
|
|
11555
|
+
cellWidth: sampleGrid.cellWidth,
|
|
11556
|
+
cellHeight: sampleGrid.cellHeight,
|
|
11557
|
+
noise,
|
|
11558
|
+
timeMs,
|
|
11559
|
+
}));
|
|
11560
|
+
}
|
|
11561
|
+
glyphGrid.push(glyphRow);
|
|
11562
|
+
}
|
|
11563
|
+
return glyphGrid;
|
|
11564
|
+
}
|
|
11462
11565
|
/**
|
|
11463
11566
|
* Draws the dark terminal-like glow behind the ASCII octopus.
|
|
11464
11567
|
*
|
|
@@ -23762,29 +23865,36 @@
|
|
|
23762
23865
|
/**
|
|
23763
23866
|
* `WRITING RULES` commitment definition.
|
|
23764
23867
|
*
|
|
23765
|
-
*
|
|
23766
|
-
* rather than task-solving behavior.
|
|
23868
|
+
* The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
|
|
23869
|
+
* and presentation rather than task-solving behavior.
|
|
23870
|
+
*
|
|
23871
|
+
* Example usage in agent source:
|
|
23872
|
+
*
|
|
23873
|
+
* ```book
|
|
23874
|
+
* WRITING RULES Keep every response under 120 words
|
|
23875
|
+
* WRITING RULE Always end the message with an emoji
|
|
23876
|
+
* ```
|
|
23767
23877
|
*
|
|
23768
23878
|
* @private [🪔] Maybe export the commitments through some package
|
|
23769
23879
|
*/
|
|
23770
23880
|
class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
23771
|
-
constructor() {
|
|
23772
|
-
super(
|
|
23881
|
+
constructor(type = 'WRITING RULES') {
|
|
23882
|
+
super(type);
|
|
23773
23883
|
}
|
|
23774
23884
|
/**
|
|
23775
|
-
* Short one-line description of `WRITING RULES`.
|
|
23885
|
+
* Short one-line description of `WRITING RULES`/`WRITING RULE`.
|
|
23776
23886
|
*/
|
|
23777
23887
|
get description() {
|
|
23778
23888
|
return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
|
|
23779
23889
|
}
|
|
23780
23890
|
/**
|
|
23781
|
-
* Icon for `WRITING RULES`.
|
|
23891
|
+
* Icon for `WRITING RULES`/`WRITING RULE`.
|
|
23782
23892
|
*/
|
|
23783
23893
|
get icon() {
|
|
23784
23894
|
return '📝';
|
|
23785
23895
|
}
|
|
23786
23896
|
/**
|
|
23787
|
-
* Markdown documentation for `WRITING RULES
|
|
23897
|
+
* Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
|
|
23788
23898
|
*/
|
|
23789
23899
|
get documentation() {
|
|
23790
23900
|
return spacetrim.spaceTrim(`
|
|
@@ -23794,6 +23904,7 @@
|
|
|
23794
23904
|
|
|
23795
23905
|
## Key aspects
|
|
23796
23906
|
|
|
23907
|
+
- All writing rules are treated equally regardless of singular/plural form.
|
|
23797
23908
|
- Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
|
|
23798
23909
|
- Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
|
|
23799
23910
|
- Newer writing-rules blocks override conflicting earlier writing-rules blocks.
|
|
@@ -23992,7 +24103,8 @@
|
|
|
23992
24103
|
new LanguageCommitmentDefinition('LANGUAGE'),
|
|
23993
24104
|
new LanguageCommitmentDefinition('LANGUAGES'),
|
|
23994
24105
|
new WritingSampleCommitmentDefinition(),
|
|
23995
|
-
new WritingRulesCommitmentDefinition(),
|
|
24106
|
+
new WritingRulesCommitmentDefinition('WRITING RULES'),
|
|
24107
|
+
new WritingRulesCommitmentDefinition('WRITING RULE'),
|
|
23996
24108
|
new SampleCommitmentDefinition('SAMPLE'),
|
|
23997
24109
|
new SampleCommitmentDefinition('EXAMPLE'),
|
|
23998
24110
|
new FormatCommitmentDefinition('FORMAT'),
|
|
@@ -24246,6 +24358,30 @@
|
|
|
24246
24358
|
}
|
|
24247
24359
|
}
|
|
24248
24360
|
|
|
24361
|
+
/**
|
|
24362
|
+
* Pattern shared by Book parsing and editor highlighting for a commitment-like line.
|
|
24363
|
+
*
|
|
24364
|
+
* A Book commitment keyword consists of one or more all-uppercase words with at least
|
|
24365
|
+
* two characters each. This deliberately mirrors the Book editor syntax rule so an
|
|
24366
|
+
* unknown keyword starts a new source block everywhere it is interpreted.
|
|
24367
|
+
*
|
|
24368
|
+
* @private internal constant of `getBookCommitmentLineType`
|
|
24369
|
+
*/
|
|
24370
|
+
const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
|
|
24371
|
+
/**
|
|
24372
|
+
* Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
|
|
24373
|
+
*
|
|
24374
|
+
* @param line - One raw Book source line.
|
|
24375
|
+
* @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
|
|
24376
|
+
*
|
|
24377
|
+
* @private internal utility of Book parsing and `<BookEditor/>`
|
|
24378
|
+
*/
|
|
24379
|
+
function getBookCommitmentLineType(line) {
|
|
24380
|
+
var _a;
|
|
24381
|
+
const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
|
|
24382
|
+
return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
|
|
24383
|
+
}
|
|
24384
|
+
|
|
24249
24385
|
/**
|
|
24250
24386
|
* Consumes the agent-name prelude from raw source.
|
|
24251
24387
|
*
|
|
@@ -24303,13 +24439,15 @@
|
|
|
24303
24439
|
return {
|
|
24304
24440
|
agentName: null,
|
|
24305
24441
|
commitments: [],
|
|
24442
|
+
unknownCommitments: [],
|
|
24306
24443
|
nonCommitmentLines: [],
|
|
24307
24444
|
};
|
|
24308
24445
|
}
|
|
24309
24446
|
const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
|
|
24310
24447
|
const commitments = [];
|
|
24448
|
+
const unknownCommitments = [];
|
|
24311
24449
|
const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
|
|
24312
|
-
// Parse commitments with multiline support
|
|
24450
|
+
// Parse commitments with multiline support.
|
|
24313
24451
|
let currentCommitment = null;
|
|
24314
24452
|
// Process lines starting from after the agent name line
|
|
24315
24453
|
const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
|
|
@@ -24323,25 +24461,11 @@
|
|
|
24323
24461
|
// Check if this line starts or ends a code block
|
|
24324
24462
|
if (trimmedLine.startsWith('```')) {
|
|
24325
24463
|
isInsideCodeBlock = !isInsideCodeBlock;
|
|
24326
|
-
|
|
24327
|
-
// If we are inside a commitment, the code block is part of it
|
|
24328
|
-
currentCommitment.contentLines.push(line);
|
|
24329
|
-
}
|
|
24330
|
-
else {
|
|
24331
|
-
// If we are not inside a commitment, the code block is non-commitment
|
|
24332
|
-
nonCommitmentLines.push(line);
|
|
24333
|
-
}
|
|
24464
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
24334
24465
|
continue;
|
|
24335
24466
|
}
|
|
24336
24467
|
if (isInsideCodeBlock) {
|
|
24337
|
-
|
|
24338
|
-
// If we are inside a commitment and a code block, the line is part of the commitment
|
|
24339
|
-
currentCommitment.contentLines.push(line);
|
|
24340
|
-
}
|
|
24341
|
-
else {
|
|
24342
|
-
// If we are inside a code block but not a commitment, the line is non-commitment
|
|
24343
|
-
nonCommitmentLines.push(line);
|
|
24344
|
-
}
|
|
24468
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
24345
24469
|
continue;
|
|
24346
24470
|
}
|
|
24347
24471
|
// Check if this line starts a new commitment
|
|
@@ -24350,22 +24474,14 @@
|
|
|
24350
24474
|
const typeRegex = definition.createTypeRegex();
|
|
24351
24475
|
const match = typeRegex.exec(line.trim());
|
|
24352
24476
|
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
24353
|
-
|
|
24354
|
-
if (currentCommitment) {
|
|
24355
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
24356
|
-
commitments.push({
|
|
24357
|
-
type: currentCommitment.type,
|
|
24358
|
-
content: spacetrim.spaceTrim(fullContent),
|
|
24359
|
-
originalLine: currentCommitment.originalStartLine,
|
|
24360
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
24361
|
-
});
|
|
24362
|
-
}
|
|
24477
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24363
24478
|
// Extract the initial content from the commitment line
|
|
24364
24479
|
const fullRegex = definition.createRegex();
|
|
24365
24480
|
const fullMatch = fullRegex.exec(line.trim());
|
|
24366
24481
|
const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
|
|
24367
24482
|
// Start a new commitment
|
|
24368
24483
|
currentCommitment = {
|
|
24484
|
+
kind: 'known',
|
|
24369
24485
|
type: definition.type,
|
|
24370
24486
|
startLineNumber: i + 1,
|
|
24371
24487
|
originalStartLine: line,
|
|
@@ -24375,52 +24491,90 @@
|
|
|
24375
24491
|
break;
|
|
24376
24492
|
}
|
|
24377
24493
|
}
|
|
24494
|
+
if (foundNewCommitment) {
|
|
24495
|
+
continue;
|
|
24496
|
+
}
|
|
24497
|
+
const unknownCommitmentType = getBookCommitmentLineType(line);
|
|
24498
|
+
if (unknownCommitmentType) {
|
|
24499
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24500
|
+
currentCommitment = {
|
|
24501
|
+
kind: 'unknown',
|
|
24502
|
+
type: unknownCommitmentType,
|
|
24503
|
+
startLineNumber: i + 1,
|
|
24504
|
+
originalStartLine: line,
|
|
24505
|
+
sourceLines: [line],
|
|
24506
|
+
};
|
|
24507
|
+
continue;
|
|
24508
|
+
}
|
|
24378
24509
|
// Check if this is a horizontal line (ends any current commitment)
|
|
24379
24510
|
const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
|
|
24380
24511
|
if (isHorizontalLine) {
|
|
24381
|
-
|
|
24382
|
-
|
|
24383
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
24384
|
-
commitments.push({
|
|
24385
|
-
type: currentCommitment.type,
|
|
24386
|
-
content: spacetrim.spaceTrim(fullContent),
|
|
24387
|
-
originalLine: currentCommitment.originalStartLine,
|
|
24388
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
24389
|
-
});
|
|
24390
|
-
currentCommitment = null;
|
|
24391
|
-
}
|
|
24512
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24513
|
+
currentCommitment = null;
|
|
24392
24514
|
// Add horizontal line to non-commitment lines
|
|
24393
24515
|
nonCommitmentLines.push(line);
|
|
24394
24516
|
continue;
|
|
24395
24517
|
}
|
|
24396
|
-
|
|
24397
|
-
if (currentCommitment) {
|
|
24398
|
-
// This line belongs to the current commitment
|
|
24399
|
-
currentCommitment.contentLines.push(line);
|
|
24400
|
-
}
|
|
24401
|
-
else {
|
|
24402
|
-
// This line is not part of any commitment
|
|
24403
|
-
nonCommitmentLines.push(line);
|
|
24404
|
-
}
|
|
24405
|
-
}
|
|
24406
|
-
}
|
|
24407
|
-
// Don't forget to save the last commitment if it exists
|
|
24408
|
-
if (currentCommitment) {
|
|
24409
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
24410
|
-
commitments.push({
|
|
24411
|
-
type: currentCommitment.type,
|
|
24412
|
-
content: spacetrim.spaceTrim(fullContent),
|
|
24413
|
-
originalLine: currentCommitment.originalStartLine,
|
|
24414
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
24415
|
-
});
|
|
24518
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
24416
24519
|
}
|
|
24520
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
24417
24521
|
return {
|
|
24418
24522
|
agentName,
|
|
24419
24523
|
agentNameLineNumber,
|
|
24420
24524
|
commitments,
|
|
24525
|
+
unknownCommitments,
|
|
24421
24526
|
nonCommitmentLines,
|
|
24422
24527
|
};
|
|
24423
24528
|
}
|
|
24529
|
+
/**
|
|
24530
|
+
* Stores the current known or unknown commitment in its appropriate parsed collection.
|
|
24531
|
+
*
|
|
24532
|
+
* @param currentCommitment - Commitment-like block collected so far.
|
|
24533
|
+
* @param commitments - Parsed registered commitments to append to.
|
|
24534
|
+
* @param unknownCommitments - Parsed unregistered commitments to append to.
|
|
24535
|
+
*
|
|
24536
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
24537
|
+
*/
|
|
24538
|
+
function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
|
|
24539
|
+
if (!currentCommitment) {
|
|
24540
|
+
return;
|
|
24541
|
+
}
|
|
24542
|
+
if (currentCommitment.kind === 'unknown') {
|
|
24543
|
+
unknownCommitments.push({
|
|
24544
|
+
type: currentCommitment.type,
|
|
24545
|
+
originalLine: currentCommitment.originalStartLine,
|
|
24546
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
24547
|
+
source: spacetrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
|
|
24548
|
+
});
|
|
24549
|
+
return;
|
|
24550
|
+
}
|
|
24551
|
+
commitments.push({
|
|
24552
|
+
type: currentCommitment.type,
|
|
24553
|
+
content: spacetrim.spaceTrim(currentCommitment.contentLines.join('\n')),
|
|
24554
|
+
originalLine: currentCommitment.originalStartLine,
|
|
24555
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
24556
|
+
});
|
|
24557
|
+
}
|
|
24558
|
+
/**
|
|
24559
|
+
* Adds one source line to the active commitment-like block, or to plain source content when none is active.
|
|
24560
|
+
*
|
|
24561
|
+
* @param currentCommitment - Commitment-like block currently being collected.
|
|
24562
|
+
* @param line - Source line to append.
|
|
24563
|
+
* @param nonCommitmentLines - Plain source lines to append to when no block is active.
|
|
24564
|
+
*
|
|
24565
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
24566
|
+
*/
|
|
24567
|
+
function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
|
|
24568
|
+
if (!currentCommitment) {
|
|
24569
|
+
nonCommitmentLines.push(line);
|
|
24570
|
+
return;
|
|
24571
|
+
}
|
|
24572
|
+
if (currentCommitment.kind === 'unknown') {
|
|
24573
|
+
currentCommitment.sourceLines.push(line);
|
|
24574
|
+
return;
|
|
24575
|
+
}
|
|
24576
|
+
currentCommitment.contentLines.push(line);
|
|
24577
|
+
}
|
|
24424
24578
|
|
|
24425
24579
|
/**
|
|
24426
24580
|
* Plugin for importing agent books *(`.book` files)*
|
|
@@ -24558,7 +24712,8 @@
|
|
|
24558
24712
|
requirements = await importReferencedFiles(requirements);
|
|
24559
24713
|
requirements = appendMcpServers(requirements, agentSource);
|
|
24560
24714
|
requirements = appendNonCommitmentContent(requirements, parseResult);
|
|
24561
|
-
|
|
24715
|
+
requirements = appendExampleInteractions(requirements, parseResult);
|
|
24716
|
+
return appendUnknownCommitmentContent(requirements, parseResult);
|
|
24562
24717
|
}
|
|
24563
24718
|
/**
|
|
24564
24719
|
* Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
|
|
@@ -24680,6 +24835,36 @@
|
|
|
24680
24835
|
}
|
|
24681
24836
|
return appendSystemMessageSection(requirements, nonCommitmentContent);
|
|
24682
24837
|
}
|
|
24838
|
+
/**
|
|
24839
|
+
* Appends unknown commitment blocks as final extra context without applying commitment side effects.
|
|
24840
|
+
*
|
|
24841
|
+
* @param requirements - Current requirements snapshot.
|
|
24842
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
24843
|
+
* @returns Requirements with unknown commitment context appended at the end of the system message.
|
|
24844
|
+
*
|
|
24845
|
+
* @private internal utility of `augmentAgentModelRequirementsFromSource`
|
|
24846
|
+
*/
|
|
24847
|
+
function appendUnknownCommitmentContent(requirements, parseResult) {
|
|
24848
|
+
const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
|
|
24849
|
+
if (!unknownCommitmentContent) {
|
|
24850
|
+
return requirements;
|
|
24851
|
+
}
|
|
24852
|
+
return appendSystemMessageSection(requirements, unknownCommitmentContent);
|
|
24853
|
+
}
|
|
24854
|
+
/**
|
|
24855
|
+
* Joins unknown commitment blocks into their final extra-context representation.
|
|
24856
|
+
*
|
|
24857
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
24858
|
+
* @returns Unknown commitment source blocks in their original order.
|
|
24859
|
+
*
|
|
24860
|
+
* @private internal utility of `appendUnknownCommitmentContent`
|
|
24861
|
+
*/
|
|
24862
|
+
function getUnknownCommitmentContent(parseResult) {
|
|
24863
|
+
return parseResult.unknownCommitments
|
|
24864
|
+
.map((commitment) => commitment.source)
|
|
24865
|
+
.filter(Boolean)
|
|
24866
|
+
.join('\n\n');
|
|
24867
|
+
}
|
|
24683
24868
|
/**
|
|
24684
24869
|
* Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
|
|
24685
24870
|
*
|
|
@@ -25066,6 +25251,245 @@
|
|
|
25066
25251
|
return Object.keys(rest).length > 0 ? rest : undefined;
|
|
25067
25252
|
}
|
|
25068
25253
|
|
|
25254
|
+
/**
|
|
25255
|
+
* Pattern matching a markdown section heading (`## Title`) that separates system-message sections
|
|
25256
|
+
*
|
|
25257
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
25258
|
+
*/
|
|
25259
|
+
const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
|
|
25260
|
+
/**
|
|
25261
|
+
* Pattern matching a fenced code block delimiter which suspends section and block splitting
|
|
25262
|
+
*
|
|
25263
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
25264
|
+
*/
|
|
25265
|
+
const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
|
|
25266
|
+
/**
|
|
25267
|
+
* Pattern matching a markdown list item which keeps merged bullet lists visually compact
|
|
25268
|
+
*
|
|
25269
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
25270
|
+
*/
|
|
25271
|
+
const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
|
|
25272
|
+
/**
|
|
25273
|
+
* Removes duplicated instructions from a generated system message
|
|
25274
|
+
*
|
|
25275
|
+
* Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
|
|
25276
|
+
* section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
|
|
25277
|
+
* `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
|
|
25278
|
+
* one heading into the position of their first occurrence and keeps every identical block only once.
|
|
25279
|
+
*
|
|
25280
|
+
* @param systemMessage The assembled system message which may contain repeated sections and blocks
|
|
25281
|
+
* @returns The system message where each section heading and each identical block appears exactly once
|
|
25282
|
+
*
|
|
25283
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
25284
|
+
*/
|
|
25285
|
+
function deduplicateSystemMessage(systemMessage) {
|
|
25286
|
+
if (!systemMessage.trim()) {
|
|
25287
|
+
return systemMessage;
|
|
25288
|
+
}
|
|
25289
|
+
return splitSystemMessageIntoRegions(systemMessage)
|
|
25290
|
+
.reduce(mergeRegionSharingHeading, [])
|
|
25291
|
+
.map(removeDuplicateBlocksFromRegion)
|
|
25292
|
+
.map(renderRegion)
|
|
25293
|
+
.filter((renderedRegion) => renderedRegion !== '')
|
|
25294
|
+
.join('\n\n');
|
|
25295
|
+
}
|
|
25296
|
+
/**
|
|
25297
|
+
* Splits the system message into the intro region and one region per `## Title` section
|
|
25298
|
+
*
|
|
25299
|
+
* @param systemMessage The system message to split
|
|
25300
|
+
* @returns Regions in their original order, without empty ones
|
|
25301
|
+
*
|
|
25302
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
25303
|
+
*/
|
|
25304
|
+
function splitSystemMessageIntoRegions(systemMessage) {
|
|
25305
|
+
const regions = [];
|
|
25306
|
+
let headingLine = null;
|
|
25307
|
+
let bodyLines = [];
|
|
25308
|
+
let isInsideCodeFence = false;
|
|
25309
|
+
for (const line of systemMessage.split(/\r?\n/)) {
|
|
25310
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
25311
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
25312
|
+
}
|
|
25313
|
+
if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
|
|
25314
|
+
bodyLines.push(line);
|
|
25315
|
+
continue;
|
|
25316
|
+
}
|
|
25317
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
25318
|
+
headingLine = line;
|
|
25319
|
+
bodyLines = [];
|
|
25320
|
+
}
|
|
25321
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
25322
|
+
return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
|
|
25323
|
+
}
|
|
25324
|
+
/**
|
|
25325
|
+
* Creates one region from its heading line and its raw body lines
|
|
25326
|
+
*
|
|
25327
|
+
* @param headingLine The original `## Title` line, or `null` for the intro before the first heading
|
|
25328
|
+
* @param bodyLines The raw lines following the heading line
|
|
25329
|
+
* @returns The region with its body already split into blocks
|
|
25330
|
+
*
|
|
25331
|
+
* @private internal utility of `splitSystemMessageIntoRegions`
|
|
25332
|
+
*/
|
|
25333
|
+
function createRegion(headingLine, bodyLines) {
|
|
25334
|
+
return {
|
|
25335
|
+
titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
|
|
25336
|
+
headingLine,
|
|
25337
|
+
isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
|
|
25338
|
+
blocks: splitBodyIntoBlocks(bodyLines),
|
|
25339
|
+
};
|
|
25340
|
+
}
|
|
25341
|
+
/**
|
|
25342
|
+
* Normalizes a heading line into a key usable for matching sections which belong together
|
|
25343
|
+
*
|
|
25344
|
+
* @param headingLine The original `## Title` line
|
|
25345
|
+
* @returns Lowercased title without the markdown heading prefix
|
|
25346
|
+
*
|
|
25347
|
+
* @private internal utility of `createRegion`
|
|
25348
|
+
*/
|
|
25349
|
+
function normalizeSectionTitle(headingLine) {
|
|
25350
|
+
var _a, _b;
|
|
25351
|
+
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();
|
|
25352
|
+
}
|
|
25353
|
+
/**
|
|
25354
|
+
* Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
|
|
25355
|
+
*
|
|
25356
|
+
* @param bodyLines The raw lines of one region body
|
|
25357
|
+
* @returns Non-empty blocks in their original order
|
|
25358
|
+
*
|
|
25359
|
+
* @private internal utility of `createRegion`
|
|
25360
|
+
*/
|
|
25361
|
+
function splitBodyIntoBlocks(bodyLines) {
|
|
25362
|
+
const blockTexts = [];
|
|
25363
|
+
let blockLines = [];
|
|
25364
|
+
let isInsideCodeFence = false;
|
|
25365
|
+
for (const line of bodyLines) {
|
|
25366
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
25367
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
25368
|
+
}
|
|
25369
|
+
if (!isInsideCodeFence && line.trim() === '') {
|
|
25370
|
+
blockTexts.push(blockLines.join('\n'));
|
|
25371
|
+
blockLines = [];
|
|
25372
|
+
continue;
|
|
25373
|
+
}
|
|
25374
|
+
blockLines.push(line);
|
|
25375
|
+
}
|
|
25376
|
+
blockTexts.push(blockLines.join('\n'));
|
|
25377
|
+
return blockTexts
|
|
25378
|
+
.filter((blockText) => blockText.trim() !== '')
|
|
25379
|
+
.map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
|
|
25380
|
+
}
|
|
25381
|
+
/**
|
|
25382
|
+
* Appends one region to the already merged regions, merging it into an earlier region with the same heading
|
|
25383
|
+
*
|
|
25384
|
+
* @param mergedRegions Regions merged so far, used as the reducer accumulator
|
|
25385
|
+
* @param region The next region in original order
|
|
25386
|
+
* @returns The accumulator with the region either appended or merged into its earlier twin
|
|
25387
|
+
*
|
|
25388
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
25389
|
+
*/
|
|
25390
|
+
function mergeRegionSharingHeading(mergedRegions, region) {
|
|
25391
|
+
const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
|
|
25392
|
+
if (existingRegionIndex === -1) {
|
|
25393
|
+
return [...mergedRegions, region];
|
|
25394
|
+
}
|
|
25395
|
+
return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
|
|
25396
|
+
? mergedRegion
|
|
25397
|
+
: {
|
|
25398
|
+
...mergedRegion,
|
|
25399
|
+
blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
|
|
25400
|
+
});
|
|
25401
|
+
}
|
|
25402
|
+
/**
|
|
25403
|
+
* Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
|
|
25404
|
+
*
|
|
25405
|
+
* @param blocks The blocks of the section occurrence being merged into an earlier section
|
|
25406
|
+
* @returns The same blocks with the first one marked as opening a merged section
|
|
25407
|
+
*
|
|
25408
|
+
* @private internal utility of `mergeRegionSharingHeading`
|
|
25409
|
+
*/
|
|
25410
|
+
function markFirstBlockAsOpeningMergedSection(blocks) {
|
|
25411
|
+
return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
|
|
25412
|
+
}
|
|
25413
|
+
/**
|
|
25414
|
+
* Keeps only the first occurrence of every identical block inside one region
|
|
25415
|
+
*
|
|
25416
|
+
* @param region The region whose blocks may repeat
|
|
25417
|
+
* @returns The region without repeated blocks
|
|
25418
|
+
*
|
|
25419
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
25420
|
+
*/
|
|
25421
|
+
function removeDuplicateBlocksFromRegion(region) {
|
|
25422
|
+
const alreadyRenderedTexts = new Set();
|
|
25423
|
+
const uniqueBlocks = [];
|
|
25424
|
+
let isMergeSeamPending = false;
|
|
25425
|
+
for (const block of region.blocks) {
|
|
25426
|
+
if (alreadyRenderedTexts.has(block.text)) {
|
|
25427
|
+
// Note: A removed block must still hand its merge seam over to the next block which survives
|
|
25428
|
+
isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
|
|
25429
|
+
continue;
|
|
25430
|
+
}
|
|
25431
|
+
alreadyRenderedTexts.add(block.text);
|
|
25432
|
+
uniqueBlocks.push({
|
|
25433
|
+
text: block.text,
|
|
25434
|
+
isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
|
|
25435
|
+
});
|
|
25436
|
+
isMergeSeamPending = false;
|
|
25437
|
+
}
|
|
25438
|
+
return { ...region, blocks: uniqueBlocks };
|
|
25439
|
+
}
|
|
25440
|
+
/**
|
|
25441
|
+
* Renders one region back into its markdown representation
|
|
25442
|
+
*
|
|
25443
|
+
* @param region The region to render
|
|
25444
|
+
* @returns The heading line together with its joined blocks
|
|
25445
|
+
*
|
|
25446
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
25447
|
+
*/
|
|
25448
|
+
function renderRegion(region) {
|
|
25449
|
+
const body = joinBlocks(region.blocks);
|
|
25450
|
+
if (region.headingLine === null) {
|
|
25451
|
+
return body;
|
|
25452
|
+
}
|
|
25453
|
+
if (body === '') {
|
|
25454
|
+
return region.headingLine;
|
|
25455
|
+
}
|
|
25456
|
+
return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
|
|
25457
|
+
}
|
|
25458
|
+
/**
|
|
25459
|
+
* Joins blocks of one region back together
|
|
25460
|
+
*
|
|
25461
|
+
* @param blocks The blocks to join in their original order
|
|
25462
|
+
* @returns The joined body of one region
|
|
25463
|
+
*
|
|
25464
|
+
* @private internal utility of `renderRegion`
|
|
25465
|
+
*/
|
|
25466
|
+
function joinBlocks(blocks) {
|
|
25467
|
+
return blocks
|
|
25468
|
+
.map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
|
|
25469
|
+
.join('');
|
|
25470
|
+
}
|
|
25471
|
+
/**
|
|
25472
|
+
* Chooses the separator between two neighboring blocks
|
|
25473
|
+
*
|
|
25474
|
+
* Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
|
|
25475
|
+
* merged together their lists are joined into one compact list instead of two separate ones.
|
|
25476
|
+
*
|
|
25477
|
+
* @param previousBlock The block rendered before the separator
|
|
25478
|
+
* @param nextBlock The block rendered after the separator
|
|
25479
|
+
* @returns Either a single or a double newline
|
|
25480
|
+
*
|
|
25481
|
+
* @private internal utility of `joinBlocks`
|
|
25482
|
+
*/
|
|
25483
|
+
function createBlockSeparator(previousBlock, nextBlock) {
|
|
25484
|
+
if (!nextBlock.isOpeningMergedSection) {
|
|
25485
|
+
return '\n\n';
|
|
25486
|
+
}
|
|
25487
|
+
const previousBlockLines = previousBlock.text.split('\n');
|
|
25488
|
+
const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
|
|
25489
|
+
LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
|
|
25490
|
+
return isListContinuing ? '\n' : '\n\n';
|
|
25491
|
+
}
|
|
25492
|
+
|
|
25069
25493
|
/**
|
|
25070
25494
|
* Removes single-hash comment lines (`# Comment`) from a system message
|
|
25071
25495
|
* This is used to clean up the final system message before sending it to the AI model
|
|
@@ -25139,14 +25563,14 @@
|
|
|
25139
25563
|
* Performs the final system-message cleanup pass after all other augmentation steps are complete.
|
|
25140
25564
|
*
|
|
25141
25565
|
* @param requirements - Fully built requirements before final cleanup.
|
|
25142
|
-
* @returns Requirements with comment lines removed
|
|
25566
|
+
* @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
|
|
25143
25567
|
*
|
|
25144
25568
|
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
25145
25569
|
*/
|
|
25146
25570
|
function finalizeRequirements(requirements) {
|
|
25147
25571
|
return {
|
|
25148
25572
|
...requirements,
|
|
25149
|
-
systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
|
|
25573
|
+
systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
|
|
25150
25574
|
};
|
|
25151
25575
|
}
|
|
25152
25576
|
|
|
@@ -25921,7 +26345,7 @@
|
|
|
25921
26345
|
const DEFAULT_BOOK = padBook(validateBook(spacetrim.spaceTrim(`
|
|
25922
26346
|
AI Avatar
|
|
25923
26347
|
|
|
25924
|
-
|
|
26348
|
+
GOAL Help users with their tasks as a friendly AI assistant.
|
|
25925
26349
|
`)));
|
|
25926
26350
|
// <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
|
|
25927
26351
|
// <- TODO: [🐱🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
|
|
@@ -26412,7 +26836,12 @@
|
|
|
26412
26836
|
\`FROM\` odkazuje na zdroj rodičovského agenta. Při vyhodnocení dědičnosti platí:
|
|
26413
26837
|
|
|
26414
26838
|
- Obsah rodiče se sloučí do výsledného zdroje.
|
|
26415
|
-
- \`FROM
|
|
26839
|
+
- Když \`FROM\` není uvedeno vůbec, platí to samé jako \`FROM @Adam\`, tedy jádrový agent, ze kterého dědí každý agent.
|
|
26840
|
+
- \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
|
|
26841
|
+
- Výslovně zvolený rodič nahradí implicitního Adama; vlastní řetězec \`FROM\` tohoto rodiče se pak zdědí běžným způsobem.
|
|
26842
|
+
- \`@Jmeno\` je pro jednoslovné jméno agenta zkratka zápisu \`{Jmeno}\`.
|
|
26843
|
+
- Když je \`FROM\` uvedeno vícekrát, platí poslední a přepíše všechna předchozí.
|
|
26844
|
+
- Adam je kořenový agent a musí výslovně použít \`FROM @Null\` (\`@Void\` je ekvivalentní). Editor knihy upozorní na jiného Adamova rodiče i na lokální cykly dědičnosti.
|
|
26416
26845
|
- Chybějící odkazy se do výsledného zdroje propíší jako poznámky.
|
|
26417
26846
|
`),
|
|
26418
26847
|
},
|
|
@@ -26710,7 +27139,12 @@
|
|
|
26710
27139
|
\`FROM\` points to a parent agent source. During inheritance resolution:
|
|
26711
27140
|
|
|
26712
27141
|
- Parent corpus is merged into effective source.
|
|
26713
|
-
- \`FROM
|
|
27142
|
+
- Writing no \`FROM\` at all is the same as writing \`FROM @Adam\`, the core agent every agent inherits from.
|
|
27143
|
+
- \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
|
|
27144
|
+
- An explicit parent replaces the implicit Adam parent; the selected parent's own \`FROM\` chain is then inherited normally.
|
|
27145
|
+
- \`@Name\` is shorthand for \`{Name}\` when the agent name is one word.
|
|
27146
|
+
- When \`FROM\` is written more than once, the last one wins and overrides every earlier one.
|
|
27147
|
+
- Adam is the root agent and must explicitly use \`FROM @Null\` (\`@Void\` is equivalent). The Book editor warns about a different Adam parent and local inheritance cycles.
|
|
26714
27148
|
- Missing references are surfaced as notes in resolved source.
|
|
26715
27149
|
`),
|
|
26716
27150
|
},
|
|
@@ -26905,7 +27339,7 @@
|
|
|
26905
27339
|
* @param language - Optional info-string language label.
|
|
26906
27340
|
* @returns Fenced code block.
|
|
26907
27341
|
*
|
|
26908
|
-
* @private internal utility of `createStandaloneBookLanguageMarkdown`
|
|
27342
|
+
* @private internal utility of `createStandaloneBookLanguageMarkdown` and of the `ptbk coder` run traces
|
|
26909
27343
|
*/
|
|
26910
27344
|
function getSafeCodeBlock(content, language = 'markdown') {
|
|
26911
27345
|
const maxBacktickCount = Math.max(0, ...(content.match(/`+/g) || []).map((match) => match.length));
|
|
@@ -27108,12 +27542,7 @@
|
|
|
27108
27542
|
const parsedSource = parseAgentSourceWithCommitments(source);
|
|
27109
27543
|
const commitmentTypes = new Set([group.primary.type, ...group.aliases]);
|
|
27110
27544
|
const isOpenClosedCommitmentFamily = commitmentTypes.has(OPEN_COMMITMENT_TYPE) && commitmentTypes.has(CLOSED_COMMITMENT_TYPE);
|
|
27111
|
-
const allowedCommitmentTypes = new Set([
|
|
27112
|
-
group.primary.type,
|
|
27113
|
-
...group.aliases,
|
|
27114
|
-
'GOAL',
|
|
27115
|
-
CLOSED_COMMITMENT_TYPE,
|
|
27116
|
-
]);
|
|
27545
|
+
const allowedCommitmentTypes = new Set([group.primary.type, ...group.aliases, 'GOAL', CLOSED_COMMITMENT_TYPE]);
|
|
27117
27546
|
const canonicalTypeByCommitmentType = createCanonicalCommitmentTypeByCommitmentType(group, isOpenClosedCommitmentFamily);
|
|
27118
27547
|
const focusedCommitments = parsedSource.commitments
|
|
27119
27548
|
.filter((commitment) => allowedCommitmentTypes.has(commitment.type))
|
|
@@ -27220,9 +27649,7 @@
|
|
|
27220
27649
|
if (!isClosedCommitmentIncluded && !isOpenCommitmentIncluded) {
|
|
27221
27650
|
normalizedFocusedCommitments.push(CLOSED_COMMITMENT_TYPE);
|
|
27222
27651
|
}
|
|
27223
|
-
return [agentName, ...normalizedFocusedCommitments]
|
|
27224
|
-
.filter((line) => Boolean(line))
|
|
27225
|
-
.join('\n\n');
|
|
27652
|
+
return [agentName, ...normalizedFocusedCommitments].filter((line) => Boolean(line)).join('\n\n');
|
|
27226
27653
|
}
|
|
27227
27654
|
/**
|
|
27228
27655
|
* Keeps an example title unless the parser interpreted a commitment-only
|
|
@@ -27370,6 +27797,7 @@
|
|
|
27370
27797
|
'LANGUAGES',
|
|
27371
27798
|
'WRITING SAMPLE',
|
|
27372
27799
|
'WRITING RULES',
|
|
27800
|
+
'WRITING RULE',
|
|
27373
27801
|
'SCENARIO',
|
|
27374
27802
|
'SCENARIOS',
|
|
27375
27803
|
'MESSAGE',
|
|
@@ -27514,9 +27942,7 @@
|
|
|
27514
27942
|
|
|
27515
27943
|
${block(dictionary.tutorialSections.checklistBody)}
|
|
27516
27944
|
|
|
27517
|
-
${block(isLowLevelCommitmentsIncluded
|
|
27518
|
-
? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary)
|
|
27519
|
-
: '')}
|
|
27945
|
+
${block(isLowLevelCommitmentsIncluded ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary) : '')}
|
|
27520
27946
|
|
|
27521
27947
|
---
|
|
27522
27948
|
|
|
@@ -28312,16 +28738,49 @@
|
|
|
28312
28738
|
}
|
|
28313
28739
|
/**
|
|
28314
28740
|
* Retrieves the permanent ID of an agent by its name or permanent ID.
|
|
28741
|
+
*
|
|
28742
|
+
* An agent that still exists always wins over a soft-deleted one, so a name that was deleted and
|
|
28743
|
+
* later created again resolves to the agent that is live now instead of to the recycle-bin leftover.
|
|
28744
|
+
* Soft-deleted agents stay resolvable as a fallback because the recycle bin restores them by name
|
|
28745
|
+
* or permanent id.
|
|
28315
28746
|
*/
|
|
28316
28747
|
async getAgentPermanentId(agentNameOrPermanentId) {
|
|
28317
|
-
const
|
|
28748
|
+
const activeAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
|
|
28749
|
+
isDeletedAgentIncluded: false,
|
|
28750
|
+
});
|
|
28751
|
+
if (activeAgentPermanentId !== null) {
|
|
28752
|
+
return activeAgentPermanentId;
|
|
28753
|
+
}
|
|
28754
|
+
const deletedAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
|
|
28755
|
+
isDeletedAgentIncluded: true,
|
|
28756
|
+
});
|
|
28757
|
+
if (deletedAgentPermanentId !== null) {
|
|
28758
|
+
return deletedAgentPermanentId;
|
|
28759
|
+
}
|
|
28760
|
+
throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
|
|
28761
|
+
}
|
|
28762
|
+
/**
|
|
28763
|
+
* Looks up the permanent id of the oldest agent matching one name or permanent id.
|
|
28764
|
+
*
|
|
28765
|
+
* @param agentNameOrPermanentId - Agent name or stable permanent identifier to match.
|
|
28766
|
+
* @param options - Whether soft-deleted agents may be matched as well.
|
|
28767
|
+
* @returns Permanent id of the matched agent, or `null` when nothing matches.
|
|
28768
|
+
*
|
|
28769
|
+
* @private internal helper of `AgentCollectionInSupabase`
|
|
28770
|
+
*/
|
|
28771
|
+
async findAgentPermanentId(agentNameOrPermanentId, options) {
|
|
28772
|
+
const selectQuery = this.supabaseClient
|
|
28318
28773
|
.from(this.getTableName('Agent'))
|
|
28319
28774
|
.select('permanentId')
|
|
28320
|
-
.or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId))
|
|
28775
|
+
.or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId));
|
|
28776
|
+
if (!options.isDeletedAgentIncluded) {
|
|
28777
|
+
selectQuery.is('deletedAt', null);
|
|
28778
|
+
}
|
|
28779
|
+
const selectResult = await selectQuery
|
|
28321
28780
|
.order('createdAt', { ascending: true }) // Pick oldest if multiple match by name
|
|
28322
28781
|
.limit(1);
|
|
28323
28782
|
if (selectResult.error || !selectResult.data || selectResult.data.length === 0) {
|
|
28324
|
-
|
|
28783
|
+
return null;
|
|
28325
28784
|
}
|
|
28326
28785
|
return selectResult.data[0].permanentId;
|
|
28327
28786
|
}
|
|
@@ -29562,8 +30021,8 @@
|
|
|
29562
30021
|
*/
|
|
29563
30022
|
$applyToTaskJson(command, $taskJson) {
|
|
29564
30023
|
if ($taskJson.format !== undefined && command.format !== $taskJson.format) {
|
|
29565
|
-
throw new ParseError(`Format format is already defined to "${$taskJson.format}".
|
|
29566
|
-
Now you try to redefine it by "${command.format}"`);
|
|
30024
|
+
throw new ParseError(spacetrim.spaceTrim(`Format format is already defined to "${$taskJson.format}".
|
|
30025
|
+
Now you try to redefine it by "${command.format}"`));
|
|
29567
30026
|
}
|
|
29568
30027
|
$taskJson.format = command.format;
|
|
29569
30028
|
},
|
|
@@ -34873,28 +35332,28 @@
|
|
|
34873
35332
|
*/
|
|
34874
35333
|
function buildToolInvocationScript(options) {
|
|
34875
35334
|
const { functionName, functionArgsExpression } = options;
|
|
34876
|
-
return `
|
|
34877
|
-
|
|
34878
|
-
|
|
34879
|
-
|
|
34880
|
-
|
|
34881
|
-
|
|
35335
|
+
return spacetrim.spaceTrim((block) => `
|
|
35336
|
+
const args = ${block(functionArgsExpression)};
|
|
35337
|
+
const runtimeContextRaw =
|
|
35338
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
35339
|
+
? undefined
|
|
35340
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
34882
35341
|
|
|
34883
|
-
|
|
34884
|
-
|
|
34885
|
-
|
|
35342
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
35343
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
35344
|
+
}
|
|
34886
35345
|
|
|
34887
|
-
|
|
34888
|
-
|
|
34889
|
-
|
|
34890
|
-
|
|
35346
|
+
const toolProgressTokenRaw =
|
|
35347
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
35348
|
+
? undefined
|
|
35349
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
34891
35350
|
|
|
34892
|
-
|
|
34893
|
-
|
|
34894
|
-
|
|
35351
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
35352
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
35353
|
+
}
|
|
34895
35354
|
|
|
34896
|
-
|
|
34897
|
-
|
|
35355
|
+
return await ${functionName}(args);
|
|
35356
|
+
`);
|
|
34898
35357
|
}
|
|
34899
35358
|
|
|
34900
35359
|
/**
|
|
@@ -48734,7 +49193,7 @@
|
|
|
48734
49193
|
${agentName}
|
|
48735
49194
|
|
|
48736
49195
|
|
|
48737
|
-
|
|
49196
|
+
GOAL ${block(personaDescription)}
|
|
48738
49197
|
${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
|
|
48739
49198
|
CLOSED
|
|
48740
49199
|
`));
|