@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/esm/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { join, basename, dirname, isAbsolute } from 'path';
|
|
1
|
+
import { join, basename, dirname, isAbsolute, delimiter } from 'path';
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
3
|
import colors from 'colors';
|
|
4
4
|
import _spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
@@ -34,7 +34,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
34
34
|
* @generated
|
|
35
35
|
* @see https://github.com/webgptorg/promptbook
|
|
36
36
|
*/
|
|
37
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
37
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-50';
|
|
38
38
|
/**
|
|
39
39
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
40
40
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1467,8 +1467,9 @@ function $execCommand(options) {
|
|
|
1467
1467
|
resolve(spaceTrim$1(output.join('\n')));
|
|
1468
1468
|
}
|
|
1469
1469
|
};
|
|
1470
|
+
// `exit` can arrive before the stdout/stderr pipes finish. Git metadata and hook diagnostics
|
|
1471
|
+
// must be complete before a following repository inspection uses the command's result.
|
|
1470
1472
|
commandProcess.on('close', finishWithCode);
|
|
1471
|
-
commandProcess.on('exit', finishWithCode);
|
|
1472
1473
|
commandProcess.on('disconnect', () => {
|
|
1473
1474
|
// Note: Unexpected disconnection should always result in rejection
|
|
1474
1475
|
reject(new Error(`Command "${humanReadableCommand}" disconnected`));
|
|
@@ -8721,23 +8722,27 @@ async function locateAppOnMacOs({ macOsName, }) {
|
|
|
8721
8722
|
// TODO: [🧠][♿] Maybe export through `@promptbook/node`
|
|
8722
8723
|
|
|
8723
8724
|
/**
|
|
8724
|
-
* Attempts to locate the specified application on a Windows system by searching common installation directories.
|
|
8725
|
+
* Attempts to locate the specified application on a Windows system by searching PATH and common installation directories.
|
|
8725
8726
|
* Returns the path to the executable if found, or null otherwise.
|
|
8726
8727
|
*
|
|
8727
8728
|
* @private within the repository
|
|
8728
8729
|
*/
|
|
8729
8730
|
async function locateAppOnWindows({ appName, windowsSuffix, }) {
|
|
8730
8731
|
try {
|
|
8731
|
-
const
|
|
8732
|
+
const EXECUTABLE_FILENAME = windowsSuffix.replace(/^.*[\\/]/, '');
|
|
8733
|
+
const PATH_EXECUTABLE_PATHS = (process.env.PATH || '')
|
|
8734
|
+
.split(delimiter)
|
|
8735
|
+
.filter(Boolean)
|
|
8736
|
+
.map((pathPrefix) => join(pathPrefix, EXECUTABLE_FILENAME));
|
|
8737
|
+
const INSTALLATION_EXECUTABLE_PATHS = [
|
|
8732
8738
|
process.env.LOCALAPPDATA,
|
|
8733
8739
|
join(process.env.LOCALAPPDATA || '', 'Programs'),
|
|
8734
8740
|
process.env.PROGRAMFILES,
|
|
8735
8741
|
process.env['PROGRAMFILES(X86)'],
|
|
8736
|
-
];
|
|
8737
|
-
for (const
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
return path;
|
|
8742
|
+
].map((pathPrefix) => pathPrefix + windowsSuffix);
|
|
8743
|
+
for (const executablePath of [...PATH_EXECUTABLE_PATHS, ...INSTALLATION_EXECUTABLE_PATHS]) {
|
|
8744
|
+
if (await isExecutable(executablePath, $provideFilesystemForNode())) {
|
|
8745
|
+
return executablePath;
|
|
8741
8746
|
}
|
|
8742
8747
|
}
|
|
8743
8748
|
throw new Error(`Can not locate app ${appName} on Windows.`);
|
|
@@ -10435,6 +10440,12 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10435
10440
|
|
|
10436
10441
|
Inherits agent source from another agent.
|
|
10437
10442
|
|
|
10443
|
+
Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
|
|
10444
|
+
is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
|
|
10445
|
+
|
|
10446
|
+
An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
|
|
10447
|
+
overrides every earlier one.
|
|
10448
|
+
|
|
10438
10449
|
## Examples
|
|
10439
10450
|
|
|
10440
10451
|
\`\`\`book
|
|
@@ -10443,6 +10454,13 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10443
10454
|
FROM https://s6.ptbk.io/benjamin-white
|
|
10444
10455
|
RULE Speak only in English.
|
|
10445
10456
|
\`\`\`
|
|
10457
|
+
|
|
10458
|
+
\`\`\`book
|
|
10459
|
+
My Standalone Agent
|
|
10460
|
+
|
|
10461
|
+
FROM @Null
|
|
10462
|
+
RULE Speak only in English.
|
|
10463
|
+
\`\`\`
|
|
10446
10464
|
`);
|
|
10447
10465
|
}
|
|
10448
10466
|
applyToAgentModelRequirements(requirements, content) {
|
|
@@ -11575,6 +11593,13 @@ function darken(amount) {
|
|
|
11575
11593
|
}
|
|
11576
11594
|
|
|
11577
11595
|
/* eslint-disable no-magic-numbers */
|
|
11596
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11597
|
+
/**
|
|
11598
|
+
* Default square size used by avatar renderers.
|
|
11599
|
+
*
|
|
11600
|
+
* @private utility of the avatar rendering system
|
|
11601
|
+
*/
|
|
11602
|
+
const DEFAULT_AVATAR_SIZE = 192;
|
|
11578
11603
|
/**
|
|
11579
11604
|
* Corner radius ratio used for the common rounded card frame.
|
|
11580
11605
|
*
|
|
@@ -11945,6 +11970,15 @@ const OUTLINE_GLYPHS = ['#', '%', '@'];
|
|
|
11945
11970
|
* @private helper of `asciiOctopusAvatarVisual`
|
|
11946
11971
|
*/
|
|
11947
11972
|
const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
|
|
11973
|
+
/**
|
|
11974
|
+
* Coordinate space the octopus layout is generated in when it is painted into a terminal.
|
|
11975
|
+
*
|
|
11976
|
+
* The terminal renderer has its own character grid, so the geometry only needs one stable
|
|
11977
|
+
* square coordinate space which the grid is then sampled from.
|
|
11978
|
+
*
|
|
11979
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
11980
|
+
*/
|
|
11981
|
+
const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
|
|
11948
11982
|
/**
|
|
11949
11983
|
* AsciiOctopus avatar visual.
|
|
11950
11984
|
*
|
|
@@ -11961,41 +11995,115 @@ const asciiOctopusAvatarVisual = {
|
|
|
11961
11995
|
const staticRandom = createRandom('ascii-octopus-static');
|
|
11962
11996
|
const gridMetrics = createAsciiGridMetrics(size, gridRandom);
|
|
11963
11997
|
const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
|
|
11998
|
+
const glyphGrid = createAsciiOctopusGlyphGrid({
|
|
11999
|
+
sampleGrid: gridMetrics,
|
|
12000
|
+
layout,
|
|
12001
|
+
palette,
|
|
12002
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
12003
|
+
timeMs,
|
|
12004
|
+
});
|
|
11964
12005
|
drawAvatarFrame(context, size, palette);
|
|
11965
12006
|
drawAsciiBackdrop(context, size, palette, layout, timeMs);
|
|
11966
12007
|
context.save();
|
|
11967
12008
|
context.font = `600 ${gridMetrics.fontSize}px monospace`;
|
|
11968
12009
|
context.textAlign = 'center';
|
|
11969
12010
|
context.textBaseline = 'middle';
|
|
11970
|
-
// The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
|
|
11971
|
-
// while the glyph layout remains deterministic for the same avatar input.
|
|
11972
|
-
const cellRandom = createRandom('ascii-octopus-cells');
|
|
11973
12011
|
for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
|
|
11974
12012
|
for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
|
|
11975
|
-
const
|
|
11976
|
-
x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
|
|
11977
|
-
y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
|
|
11978
|
-
};
|
|
11979
|
-
const noise = cellRandom();
|
|
11980
|
-
const glyphDescriptor = resolveAsciiGlyph({
|
|
11981
|
-
point,
|
|
11982
|
-
layout,
|
|
11983
|
-
palette,
|
|
11984
|
-
cellWidth: gridMetrics.cellWidth,
|
|
11985
|
-
cellHeight: gridMetrics.cellHeight,
|
|
11986
|
-
noise,
|
|
11987
|
-
timeMs,
|
|
11988
|
-
});
|
|
12013
|
+
const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
|
|
11989
12014
|
if (!glyphDescriptor) {
|
|
11990
12015
|
continue;
|
|
11991
12016
|
}
|
|
12017
|
+
const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
|
|
11992
12018
|
context.fillStyle = glyphDescriptor.color;
|
|
11993
12019
|
context.fillText(glyphDescriptor.character, point.x, point.y);
|
|
11994
12020
|
}
|
|
11995
12021
|
}
|
|
11996
12022
|
context.restore();
|
|
11997
12023
|
},
|
|
12024
|
+
renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
|
|
12025
|
+
const staticRandom = createRandom('ascii-octopus-static');
|
|
12026
|
+
const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
|
|
12027
|
+
return createAsciiOctopusGlyphGrid({
|
|
12028
|
+
sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
|
|
12029
|
+
layout,
|
|
12030
|
+
palette,
|
|
12031
|
+
cellRandom: createRandom('ascii-octopus-cells'),
|
|
12032
|
+
timeMs,
|
|
12033
|
+
});
|
|
12034
|
+
},
|
|
11998
12035
|
};
|
|
12036
|
+
/**
|
|
12037
|
+
* Resolves the geometry point sampled for one cell of the grid.
|
|
12038
|
+
*
|
|
12039
|
+
* @param sampleGrid Character-cell sampling grid.
|
|
12040
|
+
* @param columnIndex Zero-based cell column.
|
|
12041
|
+
* @param rowIndex Zero-based cell row.
|
|
12042
|
+
* @returns Sampled point in the octopus coordinate space.
|
|
12043
|
+
*
|
|
12044
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
12045
|
+
*/
|
|
12046
|
+
function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
|
|
12047
|
+
return {
|
|
12048
|
+
x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
|
|
12049
|
+
y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
|
|
12050
|
+
};
|
|
12051
|
+
}
|
|
12052
|
+
/**
|
|
12053
|
+
* Builds the sampling grid used when the octopus is painted straight into terminal character cells.
|
|
12054
|
+
*
|
|
12055
|
+
* @param columns Available terminal columns.
|
|
12056
|
+
* @param rows Available terminal rows.
|
|
12057
|
+
* @returns Character-cell sampling grid covering the whole octopus coordinate space.
|
|
12058
|
+
*
|
|
12059
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
12060
|
+
*/
|
|
12061
|
+
function createAsciiTerminalSampleGrid(columns, rows) {
|
|
12062
|
+
const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
|
|
12063
|
+
const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
|
|
12064
|
+
return {
|
|
12065
|
+
cellWidth,
|
|
12066
|
+
cellHeight,
|
|
12067
|
+
columnCount: columns,
|
|
12068
|
+
rowCount: rows,
|
|
12069
|
+
offsetX: cellWidth / 2,
|
|
12070
|
+
offsetY: cellHeight / 2,
|
|
12071
|
+
};
|
|
12072
|
+
}
|
|
12073
|
+
/**
|
|
12074
|
+
* Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
|
|
12075
|
+
*
|
|
12076
|
+
* The field is sampled on a low-resolution grid so the shape stays organic while the glyph
|
|
12077
|
+
* layout remains deterministic for the same avatar input. Both the canvas visual and the
|
|
12078
|
+
* terminal visual share this single sampling pass so they always describe the same octopus.
|
|
12079
|
+
*
|
|
12080
|
+
* @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
|
|
12081
|
+
* @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
|
|
12082
|
+
*
|
|
12083
|
+
* @private helper of `asciiOctopusAvatarVisual`
|
|
12084
|
+
*/
|
|
12085
|
+
function createAsciiOctopusGlyphGrid(options) {
|
|
12086
|
+
const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
|
|
12087
|
+
const glyphGrid = [];
|
|
12088
|
+
for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
|
|
12089
|
+
const glyphRow = [];
|
|
12090
|
+
for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
|
|
12091
|
+
const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
|
|
12092
|
+
const noise = cellRandom();
|
|
12093
|
+
glyphRow.push(resolveAsciiGlyph({
|
|
12094
|
+
point,
|
|
12095
|
+
layout,
|
|
12096
|
+
palette,
|
|
12097
|
+
cellWidth: sampleGrid.cellWidth,
|
|
12098
|
+
cellHeight: sampleGrid.cellHeight,
|
|
12099
|
+
noise,
|
|
12100
|
+
timeMs,
|
|
12101
|
+
}));
|
|
12102
|
+
}
|
|
12103
|
+
glyphGrid.push(glyphRow);
|
|
12104
|
+
}
|
|
12105
|
+
return glyphGrid;
|
|
12106
|
+
}
|
|
11999
12107
|
/**
|
|
12000
12108
|
* Draws the dark terminal-like glow behind the ASCII octopus.
|
|
12001
12109
|
*
|
|
@@ -20108,6 +20216,18 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
20108
20216
|
|
|
20109
20217
|
Registers teammate agents that the current agent can consult via tools.
|
|
20110
20218
|
|
|
20219
|
+
The primary agent sends a question and relevant context to a teammate and receives an attributed answer.
|
|
20220
|
+
Each teammate uses its own Book. Declaring a team makes advisers available when relevant; it does not
|
|
20221
|
+
merge their rules into the primary agent or start every teammate automatically.
|
|
20222
|
+
|
|
20223
|
+
In \`ptbk coder run\` and \`ptbk coder plan\`, TEAM entries in the selected Book, its ancestors and imports
|
|
20224
|
+
use the existing reference rules: \`@Name\`, \`{Agent Name}\`, \`{./lawyer.book}\`, project paths such as
|
|
20225
|
+
\`{agents/lawyer.book}\`, and HTTP(S) Book URLs. Local advisers require no Agents Server. A remote Book
|
|
20226
|
+
must be readable through its normal endpoint; private or inaccessible sources return errors.
|
|
20227
|
+
Coding harnesses expose scoped command tools; planning uses restricted host tools and currently requires
|
|
20228
|
+
OpenAI Codex. Planning restrictions apply to every adviser, including custom Developer Books.
|
|
20229
|
+
The primary agent retains responsibility for the task, PRD proposals and final output.
|
|
20230
|
+
|
|
20111
20231
|
## Examples
|
|
20112
20232
|
|
|
20113
20233
|
\`\`\`book
|
|
@@ -20119,7 +20239,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
20119
20239
|
`);
|
|
20120
20240
|
}
|
|
20121
20241
|
applyToAgentModelRequirements(requirements, content) {
|
|
20122
|
-
var _a, _b, _c;
|
|
20242
|
+
var _a, _b, _c, _d;
|
|
20123
20243
|
const trimmedContent = content.trim();
|
|
20124
20244
|
if (!trimmedContent) {
|
|
20125
20245
|
return requirements;
|
|
@@ -20133,20 +20253,30 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
20133
20253
|
const existingTeammates = ((_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.teammates) || [];
|
|
20134
20254
|
const preResolvedProfiles = (((_c = requirements._metadata) === null || _c === void 0 ? void 0 : _c.preResolvedTeammateProfiles) || {});
|
|
20135
20255
|
const resolvedTeammates = resolveTeamTeammateLabels(trimmedContent, teammates);
|
|
20256
|
+
const toolUrls = new Map(existingTeammates.map((teammate) => [teammate.toolName, teammate.url]));
|
|
20136
20257
|
const teamEntries = resolvedTeammates.map((teammate) => {
|
|
20137
20258
|
const profile = preResolvedProfiles[teammate.url];
|
|
20138
20259
|
const resolvedLabel = (profile === null || profile === void 0 ? void 0 : profile.agentName) || teammate.label;
|
|
20139
20260
|
const existingTeammate = existingTeammates.find((entry) => entry.url === teammate.url);
|
|
20261
|
+
const baseToolName = (existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) || createTeamToolName(teammate.url, resolvedLabel);
|
|
20262
|
+
let toolName = baseToolName;
|
|
20263
|
+
let suffix = 1;
|
|
20264
|
+
// Explicit paths can identify distinct Books with the same display name or normalized label.
|
|
20265
|
+
while (toolUrls.has(toolName) && toolUrls.get(toolName) !== teammate.url) {
|
|
20266
|
+
toolName = `${baseToolName}_${++suffix}`;
|
|
20267
|
+
}
|
|
20268
|
+
toolUrls.set(toolName, teammate.url);
|
|
20140
20269
|
return {
|
|
20141
|
-
toolName:
|
|
20142
|
-
createTeamToolName(teammate.url, resolvedLabel)),
|
|
20270
|
+
toolName: toolName,
|
|
20143
20271
|
teammate: { ...teammate, label: resolvedLabel },
|
|
20144
20272
|
agentName,
|
|
20145
20273
|
description: (profile === null || profile === void 0 ? void 0 : profile.personaDescription) || null,
|
|
20146
20274
|
};
|
|
20147
20275
|
});
|
|
20148
|
-
|
|
20149
|
-
|
|
20276
|
+
if (!((_d = requirements._metadata) === null || _d === void 0 ? void 0 : _d.isTeamToolRegistrationDisabled)) {
|
|
20277
|
+
for (const entry of teamEntries) {
|
|
20278
|
+
registerTeamTool(entry);
|
|
20279
|
+
}
|
|
20150
20280
|
}
|
|
20151
20281
|
const existingTools = requirements.tools || [];
|
|
20152
20282
|
const updatedTools = [...existingTools];
|
|
@@ -24299,29 +24429,36 @@ class UseUserLocationCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24299
24429
|
/**
|
|
24300
24430
|
* `WRITING RULES` commitment definition.
|
|
24301
24431
|
*
|
|
24302
|
-
*
|
|
24303
|
-
* rather than task-solving behavior.
|
|
24432
|
+
* The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
|
|
24433
|
+
* and presentation rather than task-solving behavior.
|
|
24434
|
+
*
|
|
24435
|
+
* Example usage in agent source:
|
|
24436
|
+
*
|
|
24437
|
+
* ```book
|
|
24438
|
+
* WRITING RULES Keep every response under 120 words
|
|
24439
|
+
* WRITING RULE Always end the message with an emoji
|
|
24440
|
+
* ```
|
|
24304
24441
|
*
|
|
24305
24442
|
* @private [🪔] Maybe export the commitments through some package
|
|
24306
24443
|
*/
|
|
24307
24444
|
class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
24308
|
-
constructor() {
|
|
24309
|
-
super(
|
|
24445
|
+
constructor(type = 'WRITING RULES') {
|
|
24446
|
+
super(type);
|
|
24310
24447
|
}
|
|
24311
24448
|
/**
|
|
24312
|
-
* Short one-line description of `WRITING RULES`.
|
|
24449
|
+
* Short one-line description of `WRITING RULES`/`WRITING RULE`.
|
|
24313
24450
|
*/
|
|
24314
24451
|
get description() {
|
|
24315
24452
|
return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
|
|
24316
24453
|
}
|
|
24317
24454
|
/**
|
|
24318
|
-
* Icon for `WRITING RULES`.
|
|
24455
|
+
* Icon for `WRITING RULES`/`WRITING RULE`.
|
|
24319
24456
|
*/
|
|
24320
24457
|
get icon() {
|
|
24321
24458
|
return '📝';
|
|
24322
24459
|
}
|
|
24323
24460
|
/**
|
|
24324
|
-
* Markdown documentation for `WRITING RULES
|
|
24461
|
+
* Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
|
|
24325
24462
|
*/
|
|
24326
24463
|
get documentation() {
|
|
24327
24464
|
return spaceTrim$1(`
|
|
@@ -24331,6 +24468,7 @@ class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24331
24468
|
|
|
24332
24469
|
## Key aspects
|
|
24333
24470
|
|
|
24471
|
+
- All writing rules are treated equally regardless of singular/plural form.
|
|
24334
24472
|
- Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
|
|
24335
24473
|
- Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
|
|
24336
24474
|
- Newer writing-rules blocks override conflicting earlier writing-rules blocks.
|
|
@@ -24529,7 +24667,8 @@ const COMMITMENT_REGISTRY = [
|
|
|
24529
24667
|
new LanguageCommitmentDefinition('LANGUAGE'),
|
|
24530
24668
|
new LanguageCommitmentDefinition('LANGUAGES'),
|
|
24531
24669
|
new WritingSampleCommitmentDefinition(),
|
|
24532
|
-
new WritingRulesCommitmentDefinition(),
|
|
24670
|
+
new WritingRulesCommitmentDefinition('WRITING RULES'),
|
|
24671
|
+
new WritingRulesCommitmentDefinition('WRITING RULE'),
|
|
24533
24672
|
new SampleCommitmentDefinition('SAMPLE'),
|
|
24534
24673
|
new SampleCommitmentDefinition('EXAMPLE'),
|
|
24535
24674
|
new FormatCommitmentDefinition('FORMAT'),
|
|
@@ -28813,7 +28952,7 @@ function validateBook(source) {
|
|
|
28813
28952
|
padBook(validateBook(spaceTrim$1(`
|
|
28814
28953
|
AI Avatar
|
|
28815
28954
|
|
|
28816
|
-
|
|
28955
|
+
GOAL Help users with their tasks as a friendly AI assistant.
|
|
28817
28956
|
`)));
|
|
28818
28957
|
// <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
|
|
28819
28958
|
// <- TODO: [🐱🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
|
|
@@ -29208,6 +29347,30 @@ function createDefaultAgentName(agentSource) {
|
|
|
29208
29347
|
return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
|
|
29209
29348
|
}
|
|
29210
29349
|
|
|
29350
|
+
/**
|
|
29351
|
+
* Pattern shared by Book parsing and editor highlighting for a commitment-like line.
|
|
29352
|
+
*
|
|
29353
|
+
* A Book commitment keyword consists of one or more all-uppercase words with at least
|
|
29354
|
+
* two characters each. This deliberately mirrors the Book editor syntax rule so an
|
|
29355
|
+
* unknown keyword starts a new source block everywhere it is interpreted.
|
|
29356
|
+
*
|
|
29357
|
+
* @private internal constant of `getBookCommitmentLineType`
|
|
29358
|
+
*/
|
|
29359
|
+
const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
|
|
29360
|
+
/**
|
|
29361
|
+
* Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
|
|
29362
|
+
*
|
|
29363
|
+
* @param line - One raw Book source line.
|
|
29364
|
+
* @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
|
|
29365
|
+
*
|
|
29366
|
+
* @private internal utility of Book parsing and `<BookEditor/>`
|
|
29367
|
+
*/
|
|
29368
|
+
function getBookCommitmentLineType(line) {
|
|
29369
|
+
var _a;
|
|
29370
|
+
const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
|
|
29371
|
+
return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
|
|
29372
|
+
}
|
|
29373
|
+
|
|
29211
29374
|
/**
|
|
29212
29375
|
* Consumes the agent-name prelude from raw source.
|
|
29213
29376
|
*
|
|
@@ -29265,13 +29428,15 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
29265
29428
|
return {
|
|
29266
29429
|
agentName: null,
|
|
29267
29430
|
commitments: [],
|
|
29431
|
+
unknownCommitments: [],
|
|
29268
29432
|
nonCommitmentLines: [],
|
|
29269
29433
|
};
|
|
29270
29434
|
}
|
|
29271
29435
|
const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
|
|
29272
29436
|
const commitments = [];
|
|
29437
|
+
const unknownCommitments = [];
|
|
29273
29438
|
const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
|
|
29274
|
-
// Parse commitments with multiline support
|
|
29439
|
+
// Parse commitments with multiline support.
|
|
29275
29440
|
let currentCommitment = null;
|
|
29276
29441
|
// Process lines starting from after the agent name line
|
|
29277
29442
|
const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
|
|
@@ -29285,25 +29450,11 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
29285
29450
|
// Check if this line starts or ends a code block
|
|
29286
29451
|
if (trimmedLine.startsWith('```')) {
|
|
29287
29452
|
isInsideCodeBlock = !isInsideCodeBlock;
|
|
29288
|
-
|
|
29289
|
-
// If we are inside a commitment, the code block is part of it
|
|
29290
|
-
currentCommitment.contentLines.push(line);
|
|
29291
|
-
}
|
|
29292
|
-
else {
|
|
29293
|
-
// If we are not inside a commitment, the code block is non-commitment
|
|
29294
|
-
nonCommitmentLines.push(line);
|
|
29295
|
-
}
|
|
29453
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
29296
29454
|
continue;
|
|
29297
29455
|
}
|
|
29298
29456
|
if (isInsideCodeBlock) {
|
|
29299
|
-
|
|
29300
|
-
// If we are inside a commitment and a code block, the line is part of the commitment
|
|
29301
|
-
currentCommitment.contentLines.push(line);
|
|
29302
|
-
}
|
|
29303
|
-
else {
|
|
29304
|
-
// If we are inside a code block but not a commitment, the line is non-commitment
|
|
29305
|
-
nonCommitmentLines.push(line);
|
|
29306
|
-
}
|
|
29457
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
29307
29458
|
continue;
|
|
29308
29459
|
}
|
|
29309
29460
|
// Check if this line starts a new commitment
|
|
@@ -29312,22 +29463,14 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
29312
29463
|
const typeRegex = definition.createTypeRegex();
|
|
29313
29464
|
const match = typeRegex.exec(line.trim());
|
|
29314
29465
|
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
29315
|
-
|
|
29316
|
-
if (currentCommitment) {
|
|
29317
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
29318
|
-
commitments.push({
|
|
29319
|
-
type: currentCommitment.type,
|
|
29320
|
-
content: spaceTrim$1(fullContent),
|
|
29321
|
-
originalLine: currentCommitment.originalStartLine,
|
|
29322
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
29323
|
-
});
|
|
29324
|
-
}
|
|
29466
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29325
29467
|
// Extract the initial content from the commitment line
|
|
29326
29468
|
const fullRegex = definition.createRegex();
|
|
29327
29469
|
const fullMatch = fullRegex.exec(line.trim());
|
|
29328
29470
|
const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
|
|
29329
29471
|
// Start a new commitment
|
|
29330
29472
|
currentCommitment = {
|
|
29473
|
+
kind: 'known',
|
|
29331
29474
|
type: definition.type,
|
|
29332
29475
|
startLineNumber: i + 1,
|
|
29333
29476
|
originalStartLine: line,
|
|
@@ -29337,52 +29480,90 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
29337
29480
|
break;
|
|
29338
29481
|
}
|
|
29339
29482
|
}
|
|
29483
|
+
if (foundNewCommitment) {
|
|
29484
|
+
continue;
|
|
29485
|
+
}
|
|
29486
|
+
const unknownCommitmentType = getBookCommitmentLineType(line);
|
|
29487
|
+
if (unknownCommitmentType) {
|
|
29488
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29489
|
+
currentCommitment = {
|
|
29490
|
+
kind: 'unknown',
|
|
29491
|
+
type: unknownCommitmentType,
|
|
29492
|
+
startLineNumber: i + 1,
|
|
29493
|
+
originalStartLine: line,
|
|
29494
|
+
sourceLines: [line],
|
|
29495
|
+
};
|
|
29496
|
+
continue;
|
|
29497
|
+
}
|
|
29340
29498
|
// Check if this is a horizontal line (ends any current commitment)
|
|
29341
29499
|
const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
|
|
29342
29500
|
if (isHorizontalLine) {
|
|
29343
|
-
|
|
29344
|
-
|
|
29345
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
29346
|
-
commitments.push({
|
|
29347
|
-
type: currentCommitment.type,
|
|
29348
|
-
content: spaceTrim$1(fullContent),
|
|
29349
|
-
originalLine: currentCommitment.originalStartLine,
|
|
29350
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
29351
|
-
});
|
|
29352
|
-
currentCommitment = null;
|
|
29353
|
-
}
|
|
29501
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29502
|
+
currentCommitment = null;
|
|
29354
29503
|
// Add horizontal line to non-commitment lines
|
|
29355
29504
|
nonCommitmentLines.push(line);
|
|
29356
29505
|
continue;
|
|
29357
29506
|
}
|
|
29358
|
-
|
|
29359
|
-
if (currentCommitment) {
|
|
29360
|
-
// This line belongs to the current commitment
|
|
29361
|
-
currentCommitment.contentLines.push(line);
|
|
29362
|
-
}
|
|
29363
|
-
else {
|
|
29364
|
-
// This line is not part of any commitment
|
|
29365
|
-
nonCommitmentLines.push(line);
|
|
29366
|
-
}
|
|
29367
|
-
}
|
|
29368
|
-
}
|
|
29369
|
-
// Don't forget to save the last commitment if it exists
|
|
29370
|
-
if (currentCommitment) {
|
|
29371
|
-
const fullContent = currentCommitment.contentLines.join('\n');
|
|
29372
|
-
commitments.push({
|
|
29373
|
-
type: currentCommitment.type,
|
|
29374
|
-
content: spaceTrim$1(fullContent),
|
|
29375
|
-
originalLine: currentCommitment.originalStartLine,
|
|
29376
|
-
lineNumber: currentCommitment.startLineNumber,
|
|
29377
|
-
});
|
|
29507
|
+
appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
|
|
29378
29508
|
}
|
|
29509
|
+
appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
|
|
29379
29510
|
return {
|
|
29380
29511
|
agentName,
|
|
29381
29512
|
agentNameLineNumber,
|
|
29382
29513
|
commitments,
|
|
29514
|
+
unknownCommitments,
|
|
29383
29515
|
nonCommitmentLines,
|
|
29384
29516
|
};
|
|
29385
29517
|
}
|
|
29518
|
+
/**
|
|
29519
|
+
* Stores the current known or unknown commitment in its appropriate parsed collection.
|
|
29520
|
+
*
|
|
29521
|
+
* @param currentCommitment - Commitment-like block collected so far.
|
|
29522
|
+
* @param commitments - Parsed registered commitments to append to.
|
|
29523
|
+
* @param unknownCommitments - Parsed unregistered commitments to append to.
|
|
29524
|
+
*
|
|
29525
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
29526
|
+
*/
|
|
29527
|
+
function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
|
|
29528
|
+
if (!currentCommitment) {
|
|
29529
|
+
return;
|
|
29530
|
+
}
|
|
29531
|
+
if (currentCommitment.kind === 'unknown') {
|
|
29532
|
+
unknownCommitments.push({
|
|
29533
|
+
type: currentCommitment.type,
|
|
29534
|
+
originalLine: currentCommitment.originalStartLine,
|
|
29535
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
29536
|
+
source: spaceTrim$1(currentCommitment.sourceLines.join('\n')),
|
|
29537
|
+
});
|
|
29538
|
+
return;
|
|
29539
|
+
}
|
|
29540
|
+
commitments.push({
|
|
29541
|
+
type: currentCommitment.type,
|
|
29542
|
+
content: spaceTrim$1(currentCommitment.contentLines.join('\n')),
|
|
29543
|
+
originalLine: currentCommitment.originalStartLine,
|
|
29544
|
+
lineNumber: currentCommitment.startLineNumber,
|
|
29545
|
+
});
|
|
29546
|
+
}
|
|
29547
|
+
/**
|
|
29548
|
+
* Adds one source line to the active commitment-like block, or to plain source content when none is active.
|
|
29549
|
+
*
|
|
29550
|
+
* @param currentCommitment - Commitment-like block currently being collected.
|
|
29551
|
+
* @param line - Source line to append.
|
|
29552
|
+
* @param nonCommitmentLines - Plain source lines to append to when no block is active.
|
|
29553
|
+
*
|
|
29554
|
+
* @private internal utility of `parseAgentSourceWithCommitments`
|
|
29555
|
+
*/
|
|
29556
|
+
function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
|
|
29557
|
+
if (!currentCommitment) {
|
|
29558
|
+
nonCommitmentLines.push(line);
|
|
29559
|
+
return;
|
|
29560
|
+
}
|
|
29561
|
+
if (currentCommitment.kind === 'unknown') {
|
|
29562
|
+
currentCommitment.sourceLines.push(line);
|
|
29563
|
+
return;
|
|
29564
|
+
}
|
|
29565
|
+
currentCommitment.contentLines.push(line);
|
|
29566
|
+
}
|
|
29386
29567
|
|
|
29387
29568
|
/**
|
|
29388
29569
|
* Parses parameters from text using both supported notations:
|
|
@@ -30283,9 +30464,15 @@ async function preResolveTeammateProfilesForTeamCommitment(requirements, commitm
|
|
|
30283
30464
|
if (preResolvedTeammateProfiles[teammate.url]) {
|
|
30284
30465
|
continue;
|
|
30285
30466
|
}
|
|
30286
|
-
|
|
30287
|
-
|
|
30288
|
-
|
|
30467
|
+
try {
|
|
30468
|
+
const profile = await profileResolver.resolveTeammateProfile(teammate.url);
|
|
30469
|
+
if (profile) {
|
|
30470
|
+
preResolvedTeammateProfiles[teammate.url] = profile;
|
|
30471
|
+
}
|
|
30472
|
+
}
|
|
30473
|
+
catch (error) {
|
|
30474
|
+
// One inaccessible adviser must not erase the names and roles of other callable teammates.
|
|
30475
|
+
console.warn(`Failed to resolve TEAM profile for ${teammate.url}:`, error);
|
|
30289
30476
|
}
|
|
30290
30477
|
}
|
|
30291
30478
|
return {
|
|
@@ -30475,7 +30662,8 @@ async function augmentAgentModelRequirementsFromSource(requirements, parseResult
|
|
|
30475
30662
|
requirements = await importReferencedFiles(requirements);
|
|
30476
30663
|
requirements = appendMcpServers(requirements, agentSource);
|
|
30477
30664
|
requirements = appendNonCommitmentContent(requirements, parseResult);
|
|
30478
|
-
|
|
30665
|
+
requirements = appendExampleInteractions(requirements, parseResult);
|
|
30666
|
+
return appendUnknownCommitmentContent(requirements, parseResult);
|
|
30479
30667
|
}
|
|
30480
30668
|
/**
|
|
30481
30669
|
* Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
|
|
@@ -30597,6 +30785,36 @@ function appendNonCommitmentContent(requirements, parseResult) {
|
|
|
30597
30785
|
}
|
|
30598
30786
|
return appendSystemMessageSection(requirements, nonCommitmentContent);
|
|
30599
30787
|
}
|
|
30788
|
+
/**
|
|
30789
|
+
* Appends unknown commitment blocks as final extra context without applying commitment side effects.
|
|
30790
|
+
*
|
|
30791
|
+
* @param requirements - Current requirements snapshot.
|
|
30792
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
30793
|
+
* @returns Requirements with unknown commitment context appended at the end of the system message.
|
|
30794
|
+
*
|
|
30795
|
+
* @private internal utility of `augmentAgentModelRequirementsFromSource`
|
|
30796
|
+
*/
|
|
30797
|
+
function appendUnknownCommitmentContent(requirements, parseResult) {
|
|
30798
|
+
const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
|
|
30799
|
+
if (!unknownCommitmentContent) {
|
|
30800
|
+
return requirements;
|
|
30801
|
+
}
|
|
30802
|
+
return appendSystemMessageSection(requirements, unknownCommitmentContent);
|
|
30803
|
+
}
|
|
30804
|
+
/**
|
|
30805
|
+
* Joins unknown commitment blocks into their final extra-context representation.
|
|
30806
|
+
*
|
|
30807
|
+
* @param parseResult - Parsed source including unknown commitment blocks.
|
|
30808
|
+
* @returns Unknown commitment source blocks in their original order.
|
|
30809
|
+
*
|
|
30810
|
+
* @private internal utility of `appendUnknownCommitmentContent`
|
|
30811
|
+
*/
|
|
30812
|
+
function getUnknownCommitmentContent(parseResult) {
|
|
30813
|
+
return parseResult.unknownCommitments
|
|
30814
|
+
.map((commitment) => commitment.source)
|
|
30815
|
+
.filter(Boolean)
|
|
30816
|
+
.join('\n\n');
|
|
30817
|
+
}
|
|
30600
30818
|
/**
|
|
30601
30819
|
* Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
|
|
30602
30820
|
*
|
|
@@ -30924,6 +31142,245 @@ function stripInlineKnowledgeMetadata(metadata) {
|
|
|
30924
31142
|
return Object.keys(rest).length > 0 ? rest : undefined;
|
|
30925
31143
|
}
|
|
30926
31144
|
|
|
31145
|
+
/**
|
|
31146
|
+
* Pattern matching a markdown section heading (`## Title`) that separates system-message sections
|
|
31147
|
+
*
|
|
31148
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
31149
|
+
*/
|
|
31150
|
+
const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
|
|
31151
|
+
/**
|
|
31152
|
+
* Pattern matching a fenced code block delimiter which suspends section and block splitting
|
|
31153
|
+
*
|
|
31154
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
31155
|
+
*/
|
|
31156
|
+
const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
|
|
31157
|
+
/**
|
|
31158
|
+
* Pattern matching a markdown list item which keeps merged bullet lists visually compact
|
|
31159
|
+
*
|
|
31160
|
+
* @private internal constant of `deduplicateSystemMessage`
|
|
31161
|
+
*/
|
|
31162
|
+
const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
|
|
31163
|
+
/**
|
|
31164
|
+
* Removes duplicated instructions from a generated system message
|
|
31165
|
+
*
|
|
31166
|
+
* Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
|
|
31167
|
+
* section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
|
|
31168
|
+
* `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
|
|
31169
|
+
* one heading into the position of their first occurrence and keeps every identical block only once.
|
|
31170
|
+
*
|
|
31171
|
+
* @param systemMessage The assembled system message which may contain repeated sections and blocks
|
|
31172
|
+
* @returns The system message where each section heading and each identical block appears exactly once
|
|
31173
|
+
*
|
|
31174
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
31175
|
+
*/
|
|
31176
|
+
function deduplicateSystemMessage(systemMessage) {
|
|
31177
|
+
if (!systemMessage.trim()) {
|
|
31178
|
+
return systemMessage;
|
|
31179
|
+
}
|
|
31180
|
+
return splitSystemMessageIntoRegions(systemMessage)
|
|
31181
|
+
.reduce(mergeRegionSharingHeading, [])
|
|
31182
|
+
.map(removeDuplicateBlocksFromRegion)
|
|
31183
|
+
.map(renderRegion)
|
|
31184
|
+
.filter((renderedRegion) => renderedRegion !== '')
|
|
31185
|
+
.join('\n\n');
|
|
31186
|
+
}
|
|
31187
|
+
/**
|
|
31188
|
+
* Splits the system message into the intro region and one region per `## Title` section
|
|
31189
|
+
*
|
|
31190
|
+
* @param systemMessage The system message to split
|
|
31191
|
+
* @returns Regions in their original order, without empty ones
|
|
31192
|
+
*
|
|
31193
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31194
|
+
*/
|
|
31195
|
+
function splitSystemMessageIntoRegions(systemMessage) {
|
|
31196
|
+
const regions = [];
|
|
31197
|
+
let headingLine = null;
|
|
31198
|
+
let bodyLines = [];
|
|
31199
|
+
let isInsideCodeFence = false;
|
|
31200
|
+
for (const line of systemMessage.split(/\r?\n/)) {
|
|
31201
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
31202
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
31203
|
+
}
|
|
31204
|
+
if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
|
|
31205
|
+
bodyLines.push(line);
|
|
31206
|
+
continue;
|
|
31207
|
+
}
|
|
31208
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
31209
|
+
headingLine = line;
|
|
31210
|
+
bodyLines = [];
|
|
31211
|
+
}
|
|
31212
|
+
regions.push(createRegion(headingLine, bodyLines));
|
|
31213
|
+
return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
|
|
31214
|
+
}
|
|
31215
|
+
/**
|
|
31216
|
+
* Creates one region from its heading line and its raw body lines
|
|
31217
|
+
*
|
|
31218
|
+
* @param headingLine The original `## Title` line, or `null` for the intro before the first heading
|
|
31219
|
+
* @param bodyLines The raw lines following the heading line
|
|
31220
|
+
* @returns The region with its body already split into blocks
|
|
31221
|
+
*
|
|
31222
|
+
* @private internal utility of `splitSystemMessageIntoRegions`
|
|
31223
|
+
*/
|
|
31224
|
+
function createRegion(headingLine, bodyLines) {
|
|
31225
|
+
return {
|
|
31226
|
+
titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
|
|
31227
|
+
headingLine,
|
|
31228
|
+
isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
|
|
31229
|
+
blocks: splitBodyIntoBlocks(bodyLines),
|
|
31230
|
+
};
|
|
31231
|
+
}
|
|
31232
|
+
/**
|
|
31233
|
+
* Normalizes a heading line into a key usable for matching sections which belong together
|
|
31234
|
+
*
|
|
31235
|
+
* @param headingLine The original `## Title` line
|
|
31236
|
+
* @returns Lowercased title without the markdown heading prefix
|
|
31237
|
+
*
|
|
31238
|
+
* @private internal utility of `createRegion`
|
|
31239
|
+
*/
|
|
31240
|
+
function normalizeSectionTitle(headingLine) {
|
|
31241
|
+
var _a, _b;
|
|
31242
|
+
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();
|
|
31243
|
+
}
|
|
31244
|
+
/**
|
|
31245
|
+
* Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
|
|
31246
|
+
*
|
|
31247
|
+
* @param bodyLines The raw lines of one region body
|
|
31248
|
+
* @returns Non-empty blocks in their original order
|
|
31249
|
+
*
|
|
31250
|
+
* @private internal utility of `createRegion`
|
|
31251
|
+
*/
|
|
31252
|
+
function splitBodyIntoBlocks(bodyLines) {
|
|
31253
|
+
const blockTexts = [];
|
|
31254
|
+
let blockLines = [];
|
|
31255
|
+
let isInsideCodeFence = false;
|
|
31256
|
+
for (const line of bodyLines) {
|
|
31257
|
+
if (CODE_FENCE_PATTERN.test(line)) {
|
|
31258
|
+
isInsideCodeFence = !isInsideCodeFence;
|
|
31259
|
+
}
|
|
31260
|
+
if (!isInsideCodeFence && line.trim() === '') {
|
|
31261
|
+
blockTexts.push(blockLines.join('\n'));
|
|
31262
|
+
blockLines = [];
|
|
31263
|
+
continue;
|
|
31264
|
+
}
|
|
31265
|
+
blockLines.push(line);
|
|
31266
|
+
}
|
|
31267
|
+
blockTexts.push(blockLines.join('\n'));
|
|
31268
|
+
return blockTexts
|
|
31269
|
+
.filter((blockText) => blockText.trim() !== '')
|
|
31270
|
+
.map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
|
|
31271
|
+
}
|
|
31272
|
+
/**
|
|
31273
|
+
* Appends one region to the already merged regions, merging it into an earlier region with the same heading
|
|
31274
|
+
*
|
|
31275
|
+
* @param mergedRegions Regions merged so far, used as the reducer accumulator
|
|
31276
|
+
* @param region The next region in original order
|
|
31277
|
+
* @returns The accumulator with the region either appended or merged into its earlier twin
|
|
31278
|
+
*
|
|
31279
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31280
|
+
*/
|
|
31281
|
+
function mergeRegionSharingHeading(mergedRegions, region) {
|
|
31282
|
+
const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
|
|
31283
|
+
if (existingRegionIndex === -1) {
|
|
31284
|
+
return [...mergedRegions, region];
|
|
31285
|
+
}
|
|
31286
|
+
return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
|
|
31287
|
+
? mergedRegion
|
|
31288
|
+
: {
|
|
31289
|
+
...mergedRegion,
|
|
31290
|
+
blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
|
|
31291
|
+
});
|
|
31292
|
+
}
|
|
31293
|
+
/**
|
|
31294
|
+
* Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
|
|
31295
|
+
*
|
|
31296
|
+
* @param blocks The blocks of the section occurrence being merged into an earlier section
|
|
31297
|
+
* @returns The same blocks with the first one marked as opening a merged section
|
|
31298
|
+
*
|
|
31299
|
+
* @private internal utility of `mergeRegionSharingHeading`
|
|
31300
|
+
*/
|
|
31301
|
+
function markFirstBlockAsOpeningMergedSection(blocks) {
|
|
31302
|
+
return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
|
|
31303
|
+
}
|
|
31304
|
+
/**
|
|
31305
|
+
* Keeps only the first occurrence of every identical block inside one region
|
|
31306
|
+
*
|
|
31307
|
+
* @param region The region whose blocks may repeat
|
|
31308
|
+
* @returns The region without repeated blocks
|
|
31309
|
+
*
|
|
31310
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31311
|
+
*/
|
|
31312
|
+
function removeDuplicateBlocksFromRegion(region) {
|
|
31313
|
+
const alreadyRenderedTexts = new Set();
|
|
31314
|
+
const uniqueBlocks = [];
|
|
31315
|
+
let isMergeSeamPending = false;
|
|
31316
|
+
for (const block of region.blocks) {
|
|
31317
|
+
if (alreadyRenderedTexts.has(block.text)) {
|
|
31318
|
+
// Note: A removed block must still hand its merge seam over to the next block which survives
|
|
31319
|
+
isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
|
|
31320
|
+
continue;
|
|
31321
|
+
}
|
|
31322
|
+
alreadyRenderedTexts.add(block.text);
|
|
31323
|
+
uniqueBlocks.push({
|
|
31324
|
+
text: block.text,
|
|
31325
|
+
isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
|
|
31326
|
+
});
|
|
31327
|
+
isMergeSeamPending = false;
|
|
31328
|
+
}
|
|
31329
|
+
return { ...region, blocks: uniqueBlocks };
|
|
31330
|
+
}
|
|
31331
|
+
/**
|
|
31332
|
+
* Renders one region back into its markdown representation
|
|
31333
|
+
*
|
|
31334
|
+
* @param region The region to render
|
|
31335
|
+
* @returns The heading line together with its joined blocks
|
|
31336
|
+
*
|
|
31337
|
+
* @private internal utility of `deduplicateSystemMessage`
|
|
31338
|
+
*/
|
|
31339
|
+
function renderRegion(region) {
|
|
31340
|
+
const body = joinBlocks(region.blocks);
|
|
31341
|
+
if (region.headingLine === null) {
|
|
31342
|
+
return body;
|
|
31343
|
+
}
|
|
31344
|
+
if (body === '') {
|
|
31345
|
+
return region.headingLine;
|
|
31346
|
+
}
|
|
31347
|
+
return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
|
|
31348
|
+
}
|
|
31349
|
+
/**
|
|
31350
|
+
* Joins blocks of one region back together
|
|
31351
|
+
*
|
|
31352
|
+
* @param blocks The blocks to join in their original order
|
|
31353
|
+
* @returns The joined body of one region
|
|
31354
|
+
*
|
|
31355
|
+
* @private internal utility of `renderRegion`
|
|
31356
|
+
*/
|
|
31357
|
+
function joinBlocks(blocks) {
|
|
31358
|
+
return blocks
|
|
31359
|
+
.map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
|
|
31360
|
+
.join('');
|
|
31361
|
+
}
|
|
31362
|
+
/**
|
|
31363
|
+
* Chooses the separator between two neighboring blocks
|
|
31364
|
+
*
|
|
31365
|
+
* Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
|
|
31366
|
+
* merged together their lists are joined into one compact list instead of two separate ones.
|
|
31367
|
+
*
|
|
31368
|
+
* @param previousBlock The block rendered before the separator
|
|
31369
|
+
* @param nextBlock The block rendered after the separator
|
|
31370
|
+
* @returns Either a single or a double newline
|
|
31371
|
+
*
|
|
31372
|
+
* @private internal utility of `joinBlocks`
|
|
31373
|
+
*/
|
|
31374
|
+
function createBlockSeparator(previousBlock, nextBlock) {
|
|
31375
|
+
if (!nextBlock.isOpeningMergedSection) {
|
|
31376
|
+
return '\n\n';
|
|
31377
|
+
}
|
|
31378
|
+
const previousBlockLines = previousBlock.text.split('\n');
|
|
31379
|
+
const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
|
|
31380
|
+
LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
|
|
31381
|
+
return isListContinuing ? '\n' : '\n\n';
|
|
31382
|
+
}
|
|
31383
|
+
|
|
30927
31384
|
/**
|
|
30928
31385
|
* Removes single-hash comment lines (`# Comment`) from a system message
|
|
30929
31386
|
* This is used to clean up the final system message before sending it to the AI model
|
|
@@ -30962,6 +31419,12 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
30962
31419
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
30963
31420
|
const filteredCommitments = filterCommitmentsForAgentModelRequirements(parseResult.commitments);
|
|
30964
31421
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
31422
|
+
if (options === null || options === void 0 ? void 0 : options.isTeamToolRegistrationDisabled) {
|
|
31423
|
+
requirements = {
|
|
31424
|
+
...requirements,
|
|
31425
|
+
_metadata: { ...requirements._metadata, isTeamToolRegistrationDisabled: true },
|
|
31426
|
+
};
|
|
31427
|
+
}
|
|
30965
31428
|
requirements = await applyCommitmentsToAgentModelRequirements(requirements, filteredCommitments, options);
|
|
30966
31429
|
requirements = await augmentAgentModelRequirementsFromSource(requirements, parseResult, agentSource);
|
|
30967
31430
|
requirements = await materializeInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
@@ -30997,14 +31460,14 @@ function createInitialAgentModelRequirements(agentName, modelName) {
|
|
|
30997
31460
|
* Performs the final system-message cleanup pass after all other augmentation steps are complete.
|
|
30998
31461
|
*
|
|
30999
31462
|
* @param requirements - Fully built requirements before final cleanup.
|
|
31000
|
-
* @returns Requirements with comment lines removed
|
|
31463
|
+
* @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
|
|
31001
31464
|
*
|
|
31002
31465
|
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
31003
31466
|
*/
|
|
31004
31467
|
function finalizeRequirements(requirements) {
|
|
31005
31468
|
return {
|
|
31006
31469
|
...requirements,
|
|
31007
|
-
systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
|
|
31470
|
+
systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
|
|
31008
31471
|
};
|
|
31009
31472
|
}
|
|
31010
31473
|
|
|
@@ -31667,28 +32130,28 @@ function parseToolExecutionEnvelope(rawValue) {
|
|
|
31667
32130
|
*/
|
|
31668
32131
|
function buildToolInvocationScript(options) {
|
|
31669
32132
|
const { functionName, functionArgsExpression } = options;
|
|
31670
|
-
return `
|
|
31671
|
-
|
|
31672
|
-
|
|
31673
|
-
|
|
31674
|
-
|
|
31675
|
-
|
|
31676
|
-
|
|
31677
|
-
|
|
31678
|
-
|
|
31679
|
-
|
|
32133
|
+
return spaceTrim$1((block) => `
|
|
32134
|
+
const args = ${block(functionArgsExpression)};
|
|
32135
|
+
const runtimeContextRaw =
|
|
32136
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
32137
|
+
? undefined
|
|
32138
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
32139
|
+
|
|
32140
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
32141
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
32142
|
+
}
|
|
31680
32143
|
|
|
31681
|
-
|
|
31682
|
-
|
|
31683
|
-
|
|
31684
|
-
|
|
32144
|
+
const toolProgressTokenRaw =
|
|
32145
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
32146
|
+
? undefined
|
|
32147
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
31685
32148
|
|
|
31686
|
-
|
|
31687
|
-
|
|
31688
|
-
|
|
32149
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
32150
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
32151
|
+
}
|
|
31689
32152
|
|
|
31690
|
-
|
|
31691
|
-
|
|
32153
|
+
return await ${functionName}(args);
|
|
32154
|
+
`);
|
|
31692
32155
|
}
|
|
31693
32156
|
|
|
31694
32157
|
/**
|