@promptbook/remote-server 0.114.0-5 → 0.114.0-50
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 +50 -31
- package/esm/index.es.js +587 -124
- 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/CreateAgentModelRequirementsOptions.d.ts +2 -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/add.d.ts +22 -1
- package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +27 -0
- package/esm/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -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/coderAgentRole.d.ts +21 -0
- package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +34 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
- package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +5 -2
- package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
- 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/findLegacyCoderCheckCallers.d.ts +5 -0
- package/esm/src/cli/cli-commands/coder/fix.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +2 -2
- package/esm/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
- 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 +18 -6
- 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 +21 -1
- package/esm/src/cli/cli-commands/coder/plan.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
- package/esm/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
- package/esm/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
- package/esm/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
- package/esm/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
- package/esm/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +24 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.d.ts +12 -0
- package/esm/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
- package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
- package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/server.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
- package/esm/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder.d.ts +3 -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 +48 -0
- package/esm/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +21 -0
- package/esm/src/cli/cli-commands/common/coderCheckCliOptions.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
- 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/ensureProjectTextFile.d.ts +7 -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 +6 -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/projectCliOptions.d.ts +30 -0
- package/esm/src/cli/cli-commands/common/projectCliOptions.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 +26 -0
- package/esm/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
- package/esm/src/cli/cli-commands/common/workspaceRepository.d.ts +48 -0
- package/esm/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -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/TEAM/TEAM.test.d.ts +1 -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/conversion/archive/loadJsZipModule.d.ts +10 -0
- package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
- package/esm/src/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 +4 -8
- package/umd/index.umd.js +585 -122
- 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/CreateAgentModelRequirementsOptions.d.ts +2 -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/add.d.ts +22 -1
- package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +27 -0
- package/umd/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -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/coderAgentRole.d.ts +21 -0
- package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +34 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
- package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +5 -2
- package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
- 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/findLegacyCoderCheckCallers.d.ts +5 -0
- package/umd/src/cli/cli-commands/coder/fix.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +2 -2
- package/umd/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
- 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 +18 -6
- 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 +21 -1
- package/umd/src/cli/cli-commands/coder/plan.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
- package/umd/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
- package/umd/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
- package/umd/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
- package/umd/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
- package/umd/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +24 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.d.ts +12 -0
- package/umd/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
- package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
- package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/server.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
- package/umd/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder.d.ts +3 -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 +48 -0
- package/umd/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +21 -0
- package/umd/src/cli/cli-commands/common/coderCheckCliOptions.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
- 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/ensureProjectTextFile.d.ts +7 -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 +6 -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/projectCliOptions.d.ts +30 -0
- package/umd/src/cli/cli-commands/common/projectCliOptions.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 +26 -0
- package/umd/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
- package/umd/src/cli/cli-commands/common/workspaceRepository.d.ts +48 -0
- package/umd/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -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/TEAM/TEAM.test.d.ts +1 -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/conversion/archive/loadJsZipModule.d.ts +10 -0
- package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
- package/umd/src/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
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @generated
|
|
51
51
|
* @see https://github.com/webgptorg/promptbook
|
|
52
52
|
*/
|
|
53
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-50';
|
|
54
54
|
/**
|
|
55
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
56
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1483,8 +1483,9 @@
|
|
|
1483
1483
|
resolve(_spaceTrim.spaceTrim(output.join('\n')));
|
|
1484
1484
|
}
|
|
1485
1485
|
};
|
|
1486
|
+
// `exit` can arrive before the stdout/stderr pipes finish. Git metadata and hook diagnostics
|
|
1487
|
+
// must be complete before a following repository inspection uses the command's result.
|
|
1486
1488
|
commandProcess.on('close', finishWithCode);
|
|
1487
|
-
commandProcess.on('exit', finishWithCode);
|
|
1488
1489
|
commandProcess.on('disconnect', () => {
|
|
1489
1490
|
// Note: Unexpected disconnection should always result in rejection
|
|
1490
1491
|
reject(new Error(`Command "${humanReadableCommand}" disconnected`));
|
|
@@ -8737,23 +8738,27 @@
|
|
|
8737
8738
|
// TODO: [🧠][♿] Maybe export through `@promptbook/node`
|
|
8738
8739
|
|
|
8739
8740
|
/**
|
|
8740
|
-
* Attempts to locate the specified application on a Windows system by searching common installation directories.
|
|
8741
|
+
* Attempts to locate the specified application on a Windows system by searching PATH and common installation directories.
|
|
8741
8742
|
* Returns the path to the executable if found, or null otherwise.
|
|
8742
8743
|
*
|
|
8743
8744
|
* @private within the repository
|
|
8744
8745
|
*/
|
|
8745
8746
|
async function locateAppOnWindows({ appName, windowsSuffix, }) {
|
|
8746
8747
|
try {
|
|
8747
|
-
const
|
|
8748
|
+
const EXECUTABLE_FILENAME = windowsSuffix.replace(/^.*[\\/]/, '');
|
|
8749
|
+
const PATH_EXECUTABLE_PATHS = (process.env.PATH || '')
|
|
8750
|
+
.split(path.delimiter)
|
|
8751
|
+
.filter(Boolean)
|
|
8752
|
+
.map((pathPrefix) => path.join(pathPrefix, EXECUTABLE_FILENAME));
|
|
8753
|
+
const INSTALLATION_EXECUTABLE_PATHS = [
|
|
8748
8754
|
process.env.LOCALAPPDATA,
|
|
8749
8755
|
path.join(process.env.LOCALAPPDATA || '', 'Programs'),
|
|
8750
8756
|
process.env.PROGRAMFILES,
|
|
8751
8757
|
process.env['PROGRAMFILES(X86)'],
|
|
8752
|
-
];
|
|
8753
|
-
for (const
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
return path;
|
|
8758
|
+
].map((pathPrefix) => pathPrefix + windowsSuffix);
|
|
8759
|
+
for (const executablePath of [...PATH_EXECUTABLE_PATHS, ...INSTALLATION_EXECUTABLE_PATHS]) {
|
|
8760
|
+
if (await isExecutable(executablePath, $provideFilesystemForNode())) {
|
|
8761
|
+
return executablePath;
|
|
8757
8762
|
}
|
|
8758
8763
|
}
|
|
8759
8764
|
throw new Error(`Can not locate app ${appName} on Windows.`);
|
|
@@ -10451,6 +10456,12 @@
|
|
|
10451
10456
|
|
|
10452
10457
|
Inherits agent source from another agent.
|
|
10453
10458
|
|
|
10459
|
+
Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
|
|
10460
|
+
is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
|
|
10461
|
+
|
|
10462
|
+
An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
|
|
10463
|
+
overrides every earlier one.
|
|
10464
|
+
|
|
10454
10465
|
## Examples
|
|
10455
10466
|
|
|
10456
10467
|
\`\`\`book
|
|
@@ -10459,6 +10470,13 @@
|
|
|
10459
10470
|
FROM https://s6.ptbk.io/benjamin-white
|
|
10460
10471
|
RULE Speak only in English.
|
|
10461
10472
|
\`\`\`
|
|
10473
|
+
|
|
10474
|
+
\`\`\`book
|
|
10475
|
+
My Standalone Agent
|
|
10476
|
+
|
|
10477
|
+
FROM @Null
|
|
10478
|
+
RULE Speak only in English.
|
|
10479
|
+
\`\`\`
|
|
10462
10480
|
`);
|
|
10463
10481
|
}
|
|
10464
10482
|
applyToAgentModelRequirements(requirements, content) {
|
|
@@ -11591,6 +11609,13 @@
|
|
|
11591
11609
|
}
|
|
11592
11610
|
|
|
11593
11611
|
/* eslint-disable no-magic-numbers */
|
|
11612
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11613
|
+
/**
|
|
11614
|
+
* Default square size used by avatar renderers.
|
|
11615
|
+
*
|
|
11616
|
+
* @private utility of the avatar rendering system
|
|
11617
|
+
*/
|
|
11618
|
+
const DEFAULT_AVATAR_SIZE = 192;
|
|
11594
11619
|
/**
|
|
11595
11620
|
* Corner radius ratio used for the common rounded card frame.
|
|
11596
11621
|
*
|
|
@@ -11961,6 +11986,15 @@
|
|
|
11961
11986
|
* @private helper of `asciiOctopusAvatarVisual`
|
|
11962
11987
|
*/
|
|
11963
11988
|
const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
|
|
11989
|
+
/**
|
|
11990
|
+
* Coordinate space the octopus layout is generated in when it is painted into a terminal.
|
|
11991
|
+
*
|
|
11992
|
+
* The terminal renderer has its own character grid, so the geometry only needs one stable
|
|
11993
|
+
* square coordinate space which the grid is then sampled from.
|
|
11994
|
+
*
|
|
11995
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
11996
|
+
*/
|
|
11997
|
+
const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
|
|
11964
11998
|
/**
|
|
11965
11999
|
* AsciiOctopus avatar visual.
|
|
11966
12000
|
*
|
|
@@ -11977,41 +12011,115 @@
|
|
|
11977
12011
|
const staticRandom = createRandom('ascii-octopus-static');
|
|
11978
12012
|
const gridMetrics = createAsciiGridMetrics(size, gridRandom);
|
|
11979
12013
|
const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
|
|
12014
|
+
const glyphGrid = createAsciiOctopusGlyphGrid({
|
|
12015
|
+
sampleGrid: gridMetrics,
|
|
12016
|
+
layout,
|
|
12017
|
+
palette,
|
|
12018
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
12019
|
+
timeMs,
|
|
12020
|
+
});
|
|
11980
12021
|
drawAvatarFrame(context, size, palette);
|
|
11981
12022
|
drawAsciiBackdrop(context, size, palette, layout, timeMs);
|
|
11982
12023
|
context.save();
|
|
11983
12024
|
context.font = `600 ${gridMetrics.fontSize}px monospace`;
|
|
11984
12025
|
context.textAlign = 'center';
|
|
11985
12026
|
context.textBaseline = 'middle';
|
|
11986
|
-
// The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
|
|
11987
|
-
// while the glyph layout remains deterministic for the same avatar input.
|
|
11988
|
-
const cellRandom = createRandom('ascii-octopus-cells');
|
|
11989
12027
|
for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
|
|
11990
12028
|
for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
|
|
11991
|
-
const
|
|
11992
|
-
x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
|
|
11993
|
-
y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
|
|
11994
|
-
};
|
|
11995
|
-
const noise = cellRandom();
|
|
11996
|
-
const glyphDescriptor = resolveAsciiGlyph({
|
|
11997
|
-
point,
|
|
11998
|
-
layout,
|
|
11999
|
-
palette,
|
|
12000
|
-
cellWidth: gridMetrics.cellWidth,
|
|
12001
|
-
cellHeight: gridMetrics.cellHeight,
|
|
12002
|
-
noise,
|
|
12003
|
-
timeMs,
|
|
12004
|
-
});
|
|
12029
|
+
const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
|
|
12005
12030
|
if (!glyphDescriptor) {
|
|
12006
12031
|
continue;
|
|
12007
12032
|
}
|
|
12033
|
+
const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
|
|
12008
12034
|
context.fillStyle = glyphDescriptor.color;
|
|
12009
12035
|
context.fillText(glyphDescriptor.character, point.x, point.y);
|
|
12010
12036
|
}
|
|
12011
12037
|
}
|
|
12012
12038
|
context.restore();
|
|
12013
12039
|
},
|
|
12040
|
+
renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
|
|
12041
|
+
const staticRandom = createRandom('ascii-octopus-static');
|
|
12042
|
+
const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
|
|
12043
|
+
return createAsciiOctopusGlyphGrid({
|
|
12044
|
+
sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
|
|
12045
|
+
layout,
|
|
12046
|
+
palette,
|
|
12047
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
12048
|
+
timeMs,
|
|
12049
|
+
});
|
|
12050
|
+
},
|
|
12014
12051
|
};
|
|
12052
|
+
/**
|
|
12053
|
+
* Resolves the geometry point sampled for one cell of the grid.
|
|
12054
|
+
*
|
|
12055
|
+
* @param sampleGrid Character-cell sampling grid.
|
|
12056
|
+
* @param columnIndex Zero-based cell column.
|
|
12057
|
+
* @param rowIndex Zero-based cell row.
|
|
12058
|
+
* @returns Sampled point in the octopus coordinate space.
|
|
12059
|
+
*
|
|
12060
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
12061
|
+
*/
|
|
12062
|
+
function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
|
|
12063
|
+
return {
|
|
12064
|
+
x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
|
|
12065
|
+
y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
|
|
12066
|
+
};
|
|
12067
|
+
}
|
|
12068
|
+
/**
|
|
12069
|
+
* Builds the sampling grid used when the octopus is painted straight into terminal character cells.
|
|
12070
|
+
*
|
|
12071
|
+
* @param columns Available terminal columns.
|
|
12072
|
+
* @param rows Available terminal rows.
|
|
12073
|
+
* @returns Character-cell sampling grid covering the whole octopus coordinate space.
|
|
12074
|
+
*
|
|
12075
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
12076
|
+
*/
|
|
12077
|
+
function createAsciiTerminalSampleGrid(columns, rows) {
|
|
12078
|
+
const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
|
|
12079
|
+
const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
|
|
12080
|
+
return {
|
|
12081
|
+
cellWidth,
|
|
12082
|
+
cellHeight,
|
|
12083
|
+
columnCount: columns,
|
|
12084
|
+
rowCount: rows,
|
|
12085
|
+
offsetX: cellWidth / 2,
|
|
12086
|
+
offsetY: cellHeight / 2,
|
|
12087
|
+
};
|
|
12088
|
+
}
|
|
12089
|
+
/**
|
|
12090
|
+
* Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
|
|
12091
|
+
*
|
|
12092
|
+
* The field is sampled on a low-resolution grid so the shape stays organic while the glyph
|
|
12093
|
+
* layout remains deterministic for the same avatar input. Both the canvas visual and the
|
|
12094
|
+
* terminal visual share this single sampling pass so they always describe the same octopus.
|
|
12095
|
+
*
|
|
12096
|
+
* @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
|
|
12097
|
+
* @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
|
|
12098
|
+
*
|
|
12099
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
12100
|
+
*/
|
|
12101
|
+
function createAsciiOctopusGlyphGrid(options) {
|
|
12102
|
+
const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
|
|
12103
|
+
const glyphGrid = [];
|
|
12104
|
+
for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
|
|
12105
|
+
const glyphRow = [];
|
|
12106
|
+
for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
|
|
12107
|
+
const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
|
|
12108
|
+
const noise = cellRandom();
|
|
12109
|
+
glyphRow.push(resolveAsciiGlyph({
|
|
12110
|
+
point,
|
|
12111
|
+
layout,
|
|
12112
|
+
palette,
|
|
12113
|
+
cellWidth: sampleGrid.cellWidth,
|
|
12114
|
+
cellHeight: sampleGrid.cellHeight,
|
|
12115
|
+
noise,
|
|
12116
|
+
timeMs,
|
|
12117
|
+
}));
|
|
12118
|
+
}
|
|
12119
|
+
glyphGrid.push(glyphRow);
|
|
12120
|
+
}
|
|
12121
|
+
return glyphGrid;
|
|
12122
|
+
}
|
|
12015
12123
|
/**
|
|
12016
12124
|
* Draws the dark terminal-like glow behind the ASCII octopus.
|
|
12017
12125
|
*
|
|
@@ -20124,6 +20232,18 @@
|
|
|
20124
20232
|
|
|
20125
20233
|
Registers teammate agents that the current agent can consult via tools.
|
|
20126
20234
|
|
|
20235
|
+
The primary agent sends a question and relevant context to a teammate and receives an attributed answer.
|
|
20236
|
+
Each teammate uses its own Book. Declaring a team makes advisers available when relevant; it does not
|
|
20237
|
+
merge their rules into the primary agent or start every teammate automatically.
|
|
20238
|
+
|
|
20239
|
+
In \`ptbk coder run\` and \`ptbk coder plan\`, TEAM entries in the selected Book, its ancestors and imports
|
|
20240
|
+
use the existing reference rules: \`@Name\`, \`{Agent Name}\`, \`{./lawyer.book}\`, project paths such as
|
|
20241
|
+
\`{agents/lawyer.book}\`, and HTTP(S) Book URLs. Local advisers require no Agents Server. A remote Book
|
|
20242
|
+
must be readable through its normal endpoint; private or inaccessible sources return errors.
|
|
20243
|
+
Coding harnesses expose scoped command tools; planning uses restricted host tools and currently requires
|
|
20244
|
+
OpenAI Codex. Planning restrictions apply to every adviser, including custom Developer Books.
|
|
20245
|
+
The primary agent retains responsibility for the task, PRD proposals and final output.
|
|
20246
|
+
|
|
20127
20247
|
## Examples
|
|
20128
20248
|
|
|
20129
20249
|
\`\`\`book
|
|
@@ -20135,7 +20255,7 @@
|
|
|
20135
20255
|
`);
|
|
20136
20256
|
}
|
|
20137
20257
|
applyToAgentModelRequirements(requirements, content) {
|
|
20138
|
-
var _a, _b, _c;
|
|
20258
|
+
var _a, _b, _c, _d;
|
|
20139
20259
|
const trimmedContent = content.trim();
|
|
20140
20260
|
if (!trimmedContent) {
|
|
20141
20261
|
return requirements;
|
|
@@ -20149,20 +20269,30 @@
|
|
|
20149
20269
|
const existingTeammates = ((_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.teammates) || [];
|
|
20150
20270
|
const preResolvedProfiles = (((_c = requirements._metadata) === null || _c === void 0 ? void 0 : _c.preResolvedTeammateProfiles) || {});
|
|
20151
20271
|
const resolvedTeammates = resolveTeamTeammateLabels(trimmedContent, teammates);
|
|
20272
|
+
const toolUrls = new Map(existingTeammates.map((teammate) => [teammate.toolName, teammate.url]));
|
|
20152
20273
|
const teamEntries = resolvedTeammates.map((teammate) => {
|
|
20153
20274
|
const profile = preResolvedProfiles[teammate.url];
|
|
20154
20275
|
const resolvedLabel = (profile === null || profile === void 0 ? void 0 : profile.agentName) || teammate.label;
|
|
20155
20276
|
const existingTeammate = existingTeammates.find((entry) => entry.url === teammate.url);
|
|
20277
|
+
const baseToolName = (existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) || createTeamToolName(teammate.url, resolvedLabel);
|
|
20278
|
+
let toolName = baseToolName;
|
|
20279
|
+
let suffix = 1;
|
|
20280
|
+
// Explicit paths can identify distinct Books with the same display name or normalized label.
|
|
20281
|
+
while (toolUrls.has(toolName) && toolUrls.get(toolName) !== teammate.url) {
|
|
20282
|
+
toolName = `${baseToolName}_${++suffix}`;
|
|
20283
|
+
}
|
|
20284
|
+
toolUrls.set(toolName, teammate.url);
|
|
20156
20285
|
return {
|
|
20157
|
-
toolName:
|
|
20158
|
-
createTeamToolName(teammate.url, resolvedLabel)),
|
|
20286
|
+
toolName: toolName,
|
|
20159
20287
|
teammate: { ...teammate, label: resolvedLabel },
|
|
20160
20288
|
agentName,
|
|
20161
20289
|
description: (profile === null || profile === void 0 ? void 0 : profile.personaDescription) || null,
|
|
20162
20290
|
};
|
|
20163
20291
|
});
|
|
20164
|
-
|
|
20165
|
-
|
|
20292
|
+
if (!((_d = requirements._metadata) === null || _d === void 0 ? void 0 : _d.isTeamToolRegistrationDisabled)) {
|
|
20293
|
+
for (const entry of teamEntries) {
|
|
20294
|
+
registerTeamTool(entry);
|
|
20295
|
+
}
|
|
20166
20296
|
}
|
|
20167
20297
|
const existingTools = requirements.tools || [];
|
|
20168
20298
|
const updatedTools = [...existingTools];
|
|
@@ -24315,29 +24445,36 @@
|
|
|
24315
24445
|
/**
|
|
24316
24446
|
* `WRITING RULES` commitment definition.
|
|
24317
24447
|
*
|
|
24318
|
-
*
|
|
24319
|
-
* rather than task-solving behavior.
|
|
24448
|
+
* The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
|
|
24449
|
+
* and presentation rather than task-solving behavior.
|
|
24450
|
+
*
|
|
24451
|
+
* Example usage in agent source:
|
|
24452
|
+
*
|
|
24453
|
+
* ```book
|
|
24454
|
+
* WRITING RULES Keep every response under 120 words
|
|
24455
|
+
* WRITING RULE Always end the message with an emoji
|
|
24456
|
+
* ```
|
|
24320
24457
|
*
|
|
24321
24458
|
* @private [🪔] Maybe export the commitments through some package
|
|
24322
24459
|
*/
|
|
24323
24460
|
class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
24324
|
-
constructor() {
|
|
24325
|
-
super(
|
|
24461
|
+
constructor(type = 'WRITING RULES') {
|
|
24462
|
+
super(type);
|
|
24326
24463
|
}
|
|
24327
24464
|
/**
|
|
24328
|
-
* Short one-line description of `WRITING RULES`.
|
|
24465
|
+
* Short one-line description of `WRITING RULES`/`WRITING RULE`.
|
|
24329
24466
|
*/
|
|
24330
24467
|
get description() {
|
|
24331
24468
|
return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
|
|
24332
24469
|
}
|
|
24333
24470
|
/**
|
|
24334
|
-
* Icon for `WRITING RULES`.
|
|
24471
|
+
* Icon for `WRITING RULES`/`WRITING RULE`.
|
|
24335
24472
|
*/
|
|
24336
24473
|
get icon() {
|
|
24337
24474
|
return '📝';
|
|
24338
24475
|
}
|
|
24339
24476
|
/**
|
|
24340
|
-
* Markdown documentation for `WRITING RULES
|
|
24477
|
+
* Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
|
|
24341
24478
|
*/
|
|
24342
24479
|
get documentation() {
|
|
24343
24480
|
return _spaceTrim.spaceTrim(`
|
|
@@ -24347,6 +24484,7 @@
|
|
|
24347
24484
|
|
|
24348
24485
|
## Key aspects
|
|
24349
24486
|
|
|
24487
|
+
- All writing rules are treated equally regardless of singular/plural form.
|
|
24350
24488
|
- Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
|
|
24351
24489
|
- Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
|
|
24352
24490
|
- Newer writing-rules blocks override conflicting earlier writing-rules blocks.
|
|
@@ -24545,7 +24683,8 @@
|
|
|
24545
24683
|
new LanguageCommitmentDefinition('LANGUAGE'),
|
|
24546
24684
|
new LanguageCommitmentDefinition('LANGUAGES'),
|
|
24547
24685
|
new WritingSampleCommitmentDefinition(),
|
|
24548
|
-
new WritingRulesCommitmentDefinition(),
|
|
24686
|
+
new WritingRulesCommitmentDefinition('WRITING RULES'),
|
|
24687
|
+
new WritingRulesCommitmentDefinition('WRITING RULE'),
|
|
24549
24688
|
new SampleCommitmentDefinition('SAMPLE'),
|
|
24550
24689
|
new SampleCommitmentDefinition('EXAMPLE'),
|
|
24551
24690
|
new FormatCommitmentDefinition('FORMAT'),
|
|
@@ -28829,7 +28968,7 @@
|
|
|
28829
28968
|
padBook(validateBook(_spaceTrim.spaceTrim(`
|
|
28830
28969
|
AI Avatar
|
|
28831
28970
|
|
|
28832
|
-
|
|
28971
|
+
GOAL Help users with their tasks as a friendly AI assistant.
|
|
28833
28972
|
`)));
|
|
28834
28973
|
// <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
|
|
28835
28974
|
// <- TODO: [🐱🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
|
|
@@ -29224,6 +29363,30 @@
|
|
|
29224
29363
|
return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
|
|
29225
29364
|
}
|
|
29226
29365
|
|
|
29366
|
+
/**
|
|
29367
|
+
* Pattern shared by Book parsing and editor highlighting for a commitment-like line.
|
|
29368
|
+
*
|
|
29369
|
+
* A Book commitment keyword consists of one or more all-uppercase words with at least
|
|
29370
|
+
* two characters each. This deliberately mirrors the Book editor syntax rule so an
|
|
29371
|
+
* unknown keyword starts a new source block everywhere it is interpreted.
|
|
29372
|
+
*
|
|
29373
|
+
* @private internal constant of `getBookCommitmentLineType`
|
|
29374
|
+
*/
|
|
29375
|
+
const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
|
|
29376
|
+
/**
|
|
29377
|
+
* Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
|
|
29378
|
+
*
|
|
29379
|
+
* @param line - One raw Book source line.
|
|
29380
|
+
* @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
|
|
29381
|
+
*
|
|
29382
|
+
* @private internal utility of Book parsing and `<BookEditor/>`
|
|
29383
|
+
*/
|
|
29384
|
+
function getBookCommitmentLineType(line) {
|
|
29385
|
+
var _a;
|
|
29386
|
+
const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
|
|
29387
|
+
return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
|
|
29388
|
+
}
|
|
29389
|
+
|
|
29227
29390
|
/**
|
|
29228
29391
|
* Consumes the agent-name prelude from raw source.
|
|
29229
29392
|
*
|
|
@@ -29281,13 +29444,15 @@
|
|
|
29281
29444
|
return {
|
|
29282
29445
|
agentName: null,
|
|
29283
29446
|
commitments: [],
|
|
29447
|
+
unknownCommitments: [],
|
|
29284
29448
|
nonCommitmentLines: [],
|
|
29285
29449
|
};
|
|
29286
29450
|
}
|
|
29287
29451
|
const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
|
|
29288
29452
|
const commitments = [];
|
|
29453
|
+
const unknownCommitments = [];
|
|
29289
29454
|
const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
|
|
29290
|
-
// Parse commitments with multiline support
|
|
29455
|
+
// Parse commitments with multiline support.
|
|
29291
29456
|
let currentCommitment = null;
|
|
29292
29457
|
// Process lines starting from after the agent name line
|
|
29293
29458
|
const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
|
|
@@ -29301,25 +29466,11 @@
|
|
|
29301
29466
|
// Check if this line starts or ends a code block
|
|
29302
29467
|
if (trimmedLine.startsWith('```')) {
|
|
29303
29468
|
isInsideCodeBlock = !isInsideCodeBlock;
|
|
29304
|
-
|
|
29305
|
-
// If we are inside a commitment, the code block is part of it
|
|
29306
|
-
currentCommitment.contentLines.push(line);
|
|
29307
|
-
}
|
|
29308
|
-
else {
|
|
29309
|
-
// If we are not inside a commitment, the code block is non-commitment
|
|
29310
|
-
nonCommitmentLines.push(line);
|
|
29311
|
-
}
|
|
29469
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
29312
29470
|
continue;
|
|
29313
29471
|
}
|
|
29314
29472
|
if (isInsideCodeBlock) {
|
|
29315
|
-
|
|
29316
|
-
// If we are inside a commitment and a code block, the line is part of the commitment
|
|
29317
|
-
currentCommitment.contentLines.push(line);
|
|
29318
|
-
}
|
|
29319
|
-
else {
|
|
29320
|
-
// If we are inside a code block but not a commitment, the line is non-commitment
|
|
29321
|
-
nonCommitmentLines.push(line);
|
|
29322
|
-
}
|
|
29473
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
29323
29474
|
continue;
|
|
29324
29475
|
}
|
|
29325
29476
|
// Check if this line starts a new commitment
|
|
@@ -29328,22 +29479,14 @@
|
|
|
29328
29479
|
const typeRegex = definition.createTypeRegex();
|
|
29329
29480
|
const match = typeRegex.exec(line.trim());
|
|
29330
29481
|
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
29331
|
-
|
|
29332
|
-
if (currentCommitment) {
|
|
29333
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
29334
|
-
commitments.push({
|
|
29335
|
-
type: currentCommitment.type,
|
|
29336
|
-
content: _spaceTrim.spaceTrim(fullContent),
|
|
29337
|
-
originalLine: currentCommitment.originalStartLine,
|
|
29338
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
29339
|
-
});
|
|
29340
|
-
}
|
|
29482
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29341
29483
|
// Extract the initial content from the commitment line
|
|
29342
29484
|
const fullRegex = definition.createRegex();
|
|
29343
29485
|
const fullMatch = fullRegex.exec(line.trim());
|
|
29344
29486
|
const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
|
|
29345
29487
|
// Start a new commitment
|
|
29346
29488
|
currentCommitment = {
|
|
29489
|
+
kind: 'known',
|
|
29347
29490
|
type: definition.type,
|
|
29348
29491
|
startLineNumber: i + 1,
|
|
29349
29492
|
originalStartLine: line,
|
|
@@ -29353,52 +29496,90 @@
|
|
|
29353
29496
|
break;
|
|
29354
29497
|
}
|
|
29355
29498
|
}
|
|
29499
|
+
if (foundNewCommitment) {
|
|
29500
|
+
continue;
|
|
29501
|
+
}
|
|
29502
|
+
const unknownCommitmentType = getBookCommitmentLineType(line);
|
|
29503
|
+
if (unknownCommitmentType) {
|
|
29504
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29505
|
+
currentCommitment = {
|
|
29506
|
+
kind: 'unknown',
|
|
29507
|
+
type: unknownCommitmentType,
|
|
29508
|
+
startLineNumber: i + 1,
|
|
29509
|
+
originalStartLine: line,
|
|
29510
|
+
sourceLines: [line],
|
|
29511
|
+
};
|
|
29512
|
+
continue;
|
|
29513
|
+
}
|
|
29356
29514
|
// Check if this is a horizontal line (ends any current commitment)
|
|
29357
29515
|
const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
|
|
29358
29516
|
if (isHorizontalLine) {
|
|
29359
|
-
|
|
29360
|
-
|
|
29361
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
29362
|
-
commitments.push({
|
|
29363
|
-
type: currentCommitment.type,
|
|
29364
|
-
content: _spaceTrim.spaceTrim(fullContent),
|
|
29365
|
-
originalLine: currentCommitment.originalStartLine,
|
|
29366
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
29367
|
-
});
|
|
29368
|
-
currentCommitment = null;
|
|
29369
|
-
}
|
|
29517
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29518
|
+
currentCommitment = null;
|
|
29370
29519
|
// Add horizontal line to non-commitment lines
|
|
29371
29520
|
nonCommitmentLines.push(line);
|
|
29372
29521
|
continue;
|
|
29373
29522
|
}
|
|
29374
|
-
|
|
29375
|
-
if (currentCommitment) {
|
|
29376
|
-
// This line belongs to the current commitment
|
|
29377
|
-
currentCommitment.contentLines.push(line);
|
|
29378
|
-
}
|
|
29379
|
-
else {
|
|
29380
|
-
// This line is not part of any commitment
|
|
29381
|
-
nonCommitmentLines.push(line);
|
|
29382
|
-
}
|
|
29383
|
-
}
|
|
29384
|
-
}
|
|
29385
|
-
// Don't forget to save the last commitment if it exists
|
|
29386
|
-
if (currentCommitment) {
|
|
29387
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
29388
|
-
commitments.push({
|
|
29389
|
-
type: currentCommitment.type,
|
|
29390
|
-
content: _spaceTrim.spaceTrim(fullContent),
|
|
29391
|
-
originalLine: currentCommitment.originalStartLine,
|
|
29392
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
29393
|
-
});
|
|
29523
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
29394
29524
|
}
|
|
29525
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29395
29526
|
return {
|
|
29396
29527
|
agentName,
|
|
29397
29528
|
agentNameLineNumber,
|
|
29398
29529
|
commitments,
|
|
29530
|
+
unknownCommitments,
|
|
29399
29531
|
nonCommitmentLines,
|
|
29400
29532
|
};
|
|
29401
29533
|
}
|
|
29534
|
+
/**
|
|
29535
|
+
* Stores the current known or unknown commitment in its appropriate parsed collection.
|
|
29536
|
+
*
|
|
29537
|
+
* @param currentCommitment - Commitment-like block collected so far.
|
|
29538
|
+
* @param commitments - Parsed registered commitments to append to.
|
|
29539
|
+
* @param unknownCommitments - Parsed unregistered commitments to append to.
|
|
29540
|
+
*
|
|
29541
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
29542
|
+
*/
|
|
29543
|
+
function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
|
|
29544
|
+
if (!currentCommitment) {
|
|
29545
|
+
return;
|
|
29546
|
+
}
|
|
29547
|
+
if (currentCommitment.kind === 'unknown') {
|
|
29548
|
+
unknownCommitments.push({
|
|
29549
|
+
type: currentCommitment.type,
|
|
29550
|
+
originalLine: currentCommitment.originalStartLine,
|
|
29551
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
29552
|
+
source: _spaceTrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
|
|
29553
|
+
});
|
|
29554
|
+
return;
|
|
29555
|
+
}
|
|
29556
|
+
commitments.push({
|
|
29557
|
+
type: currentCommitment.type,
|
|
29558
|
+
content: _spaceTrim.spaceTrim(currentCommitment.contentLines.join('\n')),
|
|
29559
|
+
originalLine: currentCommitment.originalStartLine,
|
|
29560
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
29561
|
+
});
|
|
29562
|
+
}
|
|
29563
|
+
/**
|
|
29564
|
+
* Adds one source line to the active commitment-like block, or to plain source content when none is active.
|
|
29565
|
+
*
|
|
29566
|
+
* @param currentCommitment - Commitment-like block currently being collected.
|
|
29567
|
+
* @param line - Source line to append.
|
|
29568
|
+
* @param nonCommitmentLines - Plain source lines to append to when no block is active.
|
|
29569
|
+
*
|
|
29570
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
29571
|
+
*/
|
|
29572
|
+
function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
|
|
29573
|
+
if (!currentCommitment) {
|
|
29574
|
+
nonCommitmentLines.push(line);
|
|
29575
|
+
return;
|
|
29576
|
+
}
|
|
29577
|
+
if (currentCommitment.kind === 'unknown') {
|
|
29578
|
+
currentCommitment.sourceLines.push(line);
|
|
29579
|
+
return;
|
|
29580
|
+
}
|
|
29581
|
+
currentCommitment.contentLines.push(line);
|
|
29582
|
+
}
|
|
29402
29583
|
|
|
29403
29584
|
/**
|
|
29404
29585
|
* Parses parameters from text using both supported notations:
|
|
@@ -30299,9 +30480,15 @@
|
|
|
30299
30480
|
if (preResolvedTeammateProfiles[teammate.url]) {
|
|
30300
30481
|
continue;
|
|
30301
30482
|
}
|
|
30302
|
-
|
|
30303
|
-
|
|
30304
|
-
|
|
30483
|
+
try {
|
|
30484
|
+
const profile = await profileResolver.resolveTeammateProfile(teammate.url);
|
|
30485
|
+
if (profile) {
|
|
30486
|
+
preResolvedTeammateProfiles[teammate.url] = profile;
|
|
30487
|
+
}
|
|
30488
|
+
}
|
|
30489
|
+
catch (error) {
|
|
30490
|
+
// One inaccessible adviser must not erase the names and roles of other callable teammates.
|
|
30491
|
+
console.warn(`Failed to resolve TEAM profile for ${teammate.url}:`, error);
|
|
30305
30492
|
}
|
|
30306
30493
|
}
|
|
30307
30494
|
return {
|
|
@@ -30491,7 +30678,8 @@
|
|
|
30491
30678
|
requirements = await importReferencedFiles(requirements);
|
|
30492
30679
|
requirements = appendMcpServers(requirements, agentSource);
|
|
30493
30680
|
requirements = appendNonCommitmentContent(requirements, parseResult);
|
|
30494
|
-
|
|
30681
|
+
requirements = appendExampleInteractions(requirements, parseResult);
|
|
30682
|
+
return appendUnknownCommitmentContent(requirements, parseResult);
|
|
30495
30683
|
}
|
|
30496
30684
|
/**
|
|
30497
30685
|
* Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
|
|
@@ -30613,6 +30801,36 @@
|
|
|
30613
30801
|
}
|
|
30614
30802
|
return appendSystemMessageSection(requirements, nonCommitmentContent);
|
|
30615
30803
|
}
|
|
30804
|
+
/**
|
|
30805
|
+
* Appends unknown commitment blocks as final extra context without applying commitment side effects.
|
|
30806
|
+
*
|
|
30807
|
+
* @param requirements - Current requirements snapshot.
|
|
30808
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
30809
|
+
* @returns Requirements with unknown commitment context appended at the end of the system message.
|
|
30810
|
+
*
|
|
30811
|
+
* @private internal utility of `augmentAgentModelRequirementsFromSource`
|
|
30812
|
+
*/
|
|
30813
|
+
function appendUnknownCommitmentContent(requirements, parseResult) {
|
|
30814
|
+
const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
|
|
30815
|
+
if (!unknownCommitmentContent) {
|
|
30816
|
+
return requirements;
|
|
30817
|
+
}
|
|
30818
|
+
return appendSystemMessageSection(requirements, unknownCommitmentContent);
|
|
30819
|
+
}
|
|
30820
|
+
/**
|
|
30821
|
+
* Joins unknown commitment blocks into their final extra-context representation.
|
|
30822
|
+
*
|
|
30823
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
30824
|
+
* @returns Unknown commitment source blocks in their original order.
|
|
30825
|
+
*
|
|
30826
|
+
* @private internal utility of `appendUnknownCommitmentContent`
|
|
30827
|
+
*/
|
|
30828
|
+
function getUnknownCommitmentContent(parseResult) {
|
|
30829
|
+
return parseResult.unknownCommitments
|
|
30830
|
+
.map((commitment) => commitment.source)
|
|
30831
|
+
.filter(Boolean)
|
|
30832
|
+
.join('\n\n');
|
|
30833
|
+
}
|
|
30616
30834
|
/**
|
|
30617
30835
|
* Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
|
|
30618
30836
|
*
|
|
@@ -30940,6 +31158,245 @@
|
|
|
30940
31158
|
return Object.keys(rest).length > 0 ? rest : undefined;
|
|
30941
31159
|
}
|
|
30942
31160
|
|
|
31161
|
+
/**
|
|
31162
|
+
* Pattern matching a markdown section heading (`## Title`) that separates system-message sections
|
|
31163
|
+
*
|
|
31164
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
31165
|
+
*/
|
|
31166
|
+
const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
|
|
31167
|
+
/**
|
|
31168
|
+
* Pattern matching a fenced code block delimiter which suspends section and block splitting
|
|
31169
|
+
*
|
|
31170
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
31171
|
+
*/
|
|
31172
|
+
const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
|
|
31173
|
+
/**
|
|
31174
|
+
* Pattern matching a markdown list item which keeps merged bullet lists visually compact
|
|
31175
|
+
*
|
|
31176
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
31177
|
+
*/
|
|
31178
|
+
const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
|
|
31179
|
+
/**
|
|
31180
|
+
* Removes duplicated instructions from a generated system message
|
|
31181
|
+
*
|
|
31182
|
+
* Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
|
|
31183
|
+
* section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
|
|
31184
|
+
* `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
|
|
31185
|
+
* one heading into the position of their first occurrence and keeps every identical block only once.
|
|
31186
|
+
*
|
|
31187
|
+
* @param systemMessage The assembled system message which may contain repeated sections and blocks
|
|
31188
|
+
* @returns The system message where each section heading and each identical block appears exactly once
|
|
31189
|
+
*
|
|
31190
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
31191
|
+
*/
|
|
31192
|
+
function deduplicateSystemMessage(systemMessage) {
|
|
31193
|
+
if (!systemMessage.trim()) {
|
|
31194
|
+
return systemMessage;
|
|
31195
|
+
}
|
|
31196
|
+
return splitSystemMessageIntoRegions(systemMessage)
|
|
31197
|
+
.reduce(mergeRegionSharingHeading, [])
|
|
31198
|
+
.map(removeDuplicateBlocksFromRegion)
|
|
31199
|
+
.map(renderRegion)
|
|
31200
|
+
.filter((renderedRegion) => renderedRegion !== '')
|
|
31201
|
+
.join('\n\n');
|
|
31202
|
+
}
|
|
31203
|
+
/**
|
|
31204
|
+
* Splits the system message into the intro region and one region per `## Title` section
|
|
31205
|
+
*
|
|
31206
|
+
* @param systemMessage The system message to split
|
|
31207
|
+
* @returns Regions in their original order, without empty ones
|
|
31208
|
+
*
|
|
31209
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31210
|
+
*/
|
|
31211
|
+
function splitSystemMessageIntoRegions(systemMessage) {
|
|
31212
|
+
const regions = [];
|
|
31213
|
+
let headingLine = null;
|
|
31214
|
+
let bodyLines = [];
|
|
31215
|
+
let isInsideCodeFence = false;
|
|
31216
|
+
for (const line of systemMessage.split(/\r?\n/)) {
|
|
31217
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
31218
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
31219
|
+
}
|
|
31220
|
+
if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
|
|
31221
|
+
bodyLines.push(line);
|
|
31222
|
+
continue;
|
|
31223
|
+
}
|
|
31224
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
31225
|
+
headingLine = line;
|
|
31226
|
+
bodyLines = [];
|
|
31227
|
+
}
|
|
31228
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
31229
|
+
return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
|
|
31230
|
+
}
|
|
31231
|
+
/**
|
|
31232
|
+
* Creates one region from its heading line and its raw body lines
|
|
31233
|
+
*
|
|
31234
|
+
* @param headingLine The original `## Title` line, or `null` for the intro before the first heading
|
|
31235
|
+
* @param bodyLines The raw lines following the heading line
|
|
31236
|
+
* @returns The region with its body already split into blocks
|
|
31237
|
+
*
|
|
31238
|
+
* @private internal utility of `splitSystemMessageIntoRegions`
|
|
31239
|
+
*/
|
|
31240
|
+
function createRegion(headingLine, bodyLines) {
|
|
31241
|
+
return {
|
|
31242
|
+
titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
|
|
31243
|
+
headingLine,
|
|
31244
|
+
isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
|
|
31245
|
+
blocks: splitBodyIntoBlocks(bodyLines),
|
|
31246
|
+
};
|
|
31247
|
+
}
|
|
31248
|
+
/**
|
|
31249
|
+
* Normalizes a heading line into a key usable for matching sections which belong together
|
|
31250
|
+
*
|
|
31251
|
+
* @param headingLine The original `## Title` line
|
|
31252
|
+
* @returns Lowercased title without the markdown heading prefix
|
|
31253
|
+
*
|
|
31254
|
+
* @private internal utility of `createRegion`
|
|
31255
|
+
*/
|
|
31256
|
+
function normalizeSectionTitle(headingLine) {
|
|
31257
|
+
var _a, _b;
|
|
31258
|
+
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();
|
|
31259
|
+
}
|
|
31260
|
+
/**
|
|
31261
|
+
* Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
|
|
31262
|
+
*
|
|
31263
|
+
* @param bodyLines The raw lines of one region body
|
|
31264
|
+
* @returns Non-empty blocks in their original order
|
|
31265
|
+
*
|
|
31266
|
+
* @private internal utility of `createRegion`
|
|
31267
|
+
*/
|
|
31268
|
+
function splitBodyIntoBlocks(bodyLines) {
|
|
31269
|
+
const blockTexts = [];
|
|
31270
|
+
let blockLines = [];
|
|
31271
|
+
let isInsideCodeFence = false;
|
|
31272
|
+
for (const line of bodyLines) {
|
|
31273
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
31274
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
31275
|
+
}
|
|
31276
|
+
if (!isInsideCodeFence && line.trim() === '') {
|
|
31277
|
+
blockTexts.push(blockLines.join('\n'));
|
|
31278
|
+
blockLines = [];
|
|
31279
|
+
continue;
|
|
31280
|
+
}
|
|
31281
|
+
blockLines.push(line);
|
|
31282
|
+
}
|
|
31283
|
+
blockTexts.push(blockLines.join('\n'));
|
|
31284
|
+
return blockTexts
|
|
31285
|
+
.filter((blockText) => blockText.trim() !== '')
|
|
31286
|
+
.map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
|
|
31287
|
+
}
|
|
31288
|
+
/**
|
|
31289
|
+
* Appends one region to the already merged regions, merging it into an earlier region with the same heading
|
|
31290
|
+
*
|
|
31291
|
+
* @param mergedRegions Regions merged so far, used as the reducer accumulator
|
|
31292
|
+
* @param region The next region in original order
|
|
31293
|
+
* @returns The accumulator with the region either appended or merged into its earlier twin
|
|
31294
|
+
*
|
|
31295
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31296
|
+
*/
|
|
31297
|
+
function mergeRegionSharingHeading(mergedRegions, region) {
|
|
31298
|
+
const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
|
|
31299
|
+
if (existingRegionIndex === -1) {
|
|
31300
|
+
return [...mergedRegions, region];
|
|
31301
|
+
}
|
|
31302
|
+
return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
|
|
31303
|
+
? mergedRegion
|
|
31304
|
+
: {
|
|
31305
|
+
...mergedRegion,
|
|
31306
|
+
blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
|
|
31307
|
+
});
|
|
31308
|
+
}
|
|
31309
|
+
/**
|
|
31310
|
+
* Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
|
|
31311
|
+
*
|
|
31312
|
+
* @param blocks The blocks of the section occurrence being merged into an earlier section
|
|
31313
|
+
* @returns The same blocks with the first one marked as opening a merged section
|
|
31314
|
+
*
|
|
31315
|
+
* @private internal utility of `mergeRegionSharingHeading`
|
|
31316
|
+
*/
|
|
31317
|
+
function markFirstBlockAsOpeningMergedSection(blocks) {
|
|
31318
|
+
return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
|
|
31319
|
+
}
|
|
31320
|
+
/**
|
|
31321
|
+
* Keeps only the first occurrence of every identical block inside one region
|
|
31322
|
+
*
|
|
31323
|
+
* @param region The region whose blocks may repeat
|
|
31324
|
+
* @returns The region without repeated blocks
|
|
31325
|
+
*
|
|
31326
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31327
|
+
*/
|
|
31328
|
+
function removeDuplicateBlocksFromRegion(region) {
|
|
31329
|
+
const alreadyRenderedTexts = new Set();
|
|
31330
|
+
const uniqueBlocks = [];
|
|
31331
|
+
let isMergeSeamPending = false;
|
|
31332
|
+
for (const block of region.blocks) {
|
|
31333
|
+
if (alreadyRenderedTexts.has(block.text)) {
|
|
31334
|
+
// Note: A removed block must still hand its merge seam over to the next block which survives
|
|
31335
|
+
isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
|
|
31336
|
+
continue;
|
|
31337
|
+
}
|
|
31338
|
+
alreadyRenderedTexts.add(block.text);
|
|
31339
|
+
uniqueBlocks.push({
|
|
31340
|
+
text: block.text,
|
|
31341
|
+
isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
|
|
31342
|
+
});
|
|
31343
|
+
isMergeSeamPending = false;
|
|
31344
|
+
}
|
|
31345
|
+
return { ...region, blocks: uniqueBlocks };
|
|
31346
|
+
}
|
|
31347
|
+
/**
|
|
31348
|
+
* Renders one region back into its markdown representation
|
|
31349
|
+
*
|
|
31350
|
+
* @param region The region to render
|
|
31351
|
+
* @returns The heading line together with its joined blocks
|
|
31352
|
+
*
|
|
31353
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31354
|
+
*/
|
|
31355
|
+
function renderRegion(region) {
|
|
31356
|
+
const body = joinBlocks(region.blocks);
|
|
31357
|
+
if (region.headingLine === null) {
|
|
31358
|
+
return body;
|
|
31359
|
+
}
|
|
31360
|
+
if (body === '') {
|
|
31361
|
+
return region.headingLine;
|
|
31362
|
+
}
|
|
31363
|
+
return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
|
|
31364
|
+
}
|
|
31365
|
+
/**
|
|
31366
|
+
* Joins blocks of one region back together
|
|
31367
|
+
*
|
|
31368
|
+
* @param blocks The blocks to join in their original order
|
|
31369
|
+
* @returns The joined body of one region
|
|
31370
|
+
*
|
|
31371
|
+
* @private internal utility of `renderRegion`
|
|
31372
|
+
*/
|
|
31373
|
+
function joinBlocks(blocks) {
|
|
31374
|
+
return blocks
|
|
31375
|
+
.map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
|
|
31376
|
+
.join('');
|
|
31377
|
+
}
|
|
31378
|
+
/**
|
|
31379
|
+
* Chooses the separator between two neighboring blocks
|
|
31380
|
+
*
|
|
31381
|
+
* Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
|
|
31382
|
+
* merged together their lists are joined into one compact list instead of two separate ones.
|
|
31383
|
+
*
|
|
31384
|
+
* @param previousBlock The block rendered before the separator
|
|
31385
|
+
* @param nextBlock The block rendered after the separator
|
|
31386
|
+
* @returns Either a single or a double newline
|
|
31387
|
+
*
|
|
31388
|
+
* @private internal utility of `joinBlocks`
|
|
31389
|
+
*/
|
|
31390
|
+
function createBlockSeparator(previousBlock, nextBlock) {
|
|
31391
|
+
if (!nextBlock.isOpeningMergedSection) {
|
|
31392
|
+
return '\n\n';
|
|
31393
|
+
}
|
|
31394
|
+
const previousBlockLines = previousBlock.text.split('\n');
|
|
31395
|
+
const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
|
|
31396
|
+
LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
|
|
31397
|
+
return isListContinuing ? '\n' : '\n\n';
|
|
31398
|
+
}
|
|
31399
|
+
|
|
30943
31400
|
/**
|
|
30944
31401
|
* Removes single-hash comment lines (`# Comment`) from a system message
|
|
30945
31402
|
* This is used to clean up the final system message before sending it to the AI model
|
|
@@ -30978,6 +31435,12 @@
|
|
|
30978
31435
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
30979
31436
|
const filteredCommitments = filterCommitmentsForAgentModelRequirements(parseResult.commitments);
|
|
30980
31437
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
31438
|
+
if (options === null || options === void 0 ? void 0 : options.isTeamToolRegistrationDisabled) {
|
|
31439
|
+
requirements = {
|
|
31440
|
+
...requirements,
|
|
31441
|
+
_metadata: { ...requirements._metadata, isTeamToolRegistrationDisabled: true },
|
|
31442
|
+
};
|
|
31443
|
+
}
|
|
30981
31444
|
requirements = await applyCommitmentsToAgentModelRequirements(requirements, filteredCommitments, options);
|
|
30982
31445
|
requirements = await augmentAgentModelRequirementsFromSource(requirements, parseResult, agentSource);
|
|
30983
31446
|
requirements = await materializeInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
@@ -31013,14 +31476,14 @@
|
|
|
31013
31476
|
* Performs the final system-message cleanup pass after all other augmentation steps are complete.
|
|
31014
31477
|
*
|
|
31015
31478
|
* @param requirements - Fully built requirements before final cleanup.
|
|
31016
|
-
* @returns Requirements with comment lines removed
|
|
31479
|
+
* @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
|
|
31017
31480
|
*
|
|
31018
31481
|
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
31019
31482
|
*/
|
|
31020
31483
|
function finalizeRequirements(requirements) {
|
|
31021
31484
|
return {
|
|
31022
31485
|
...requirements,
|
|
31023
|
-
systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
|
|
31486
|
+
systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
|
|
31024
31487
|
};
|
|
31025
31488
|
}
|
|
31026
31489
|
|
|
@@ -31683,28 +32146,28 @@
|
|
|
31683
32146
|
*/
|
|
31684
32147
|
function buildToolInvocationScript(options) {
|
|
31685
32148
|
const { functionName, functionArgsExpression } = options;
|
|
31686
|
-
return `
|
|
31687
|
-
|
|
31688
|
-
|
|
31689
|
-
|
|
31690
|
-
|
|
31691
|
-
|
|
32149
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
32150
|
+
const args = ${block(functionArgsExpression)};
|
|
32151
|
+
const runtimeContextRaw =
|
|
32152
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
32153
|
+
? undefined
|
|
32154
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
31692
32155
|
|
|
31693
|
-
|
|
31694
|
-
|
|
31695
|
-
|
|
32156
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
32157
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
32158
|
+
}
|
|
31696
32159
|
|
|
31697
|
-
|
|
31698
|
-
|
|
31699
|
-
|
|
31700
|
-
|
|
32160
|
+
const toolProgressTokenRaw =
|
|
32161
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
32162
|
+
? undefined
|
|
32163
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
31701
32164
|
|
|
31702
|
-
|
|
31703
|
-
|
|
31704
|
-
|
|
32165
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
32166
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
32167
|
+
}
|
|
31705
32168
|
|
|
31706
|
-
|
|
31707
|
-
|
|
32169
|
+
return await ${functionName}(args);
|
|
32170
|
+
`);
|
|
31708
32171
|
}
|
|
31709
32172
|
|
|
31710
32173
|
/**
|