@promptbook/cli 0.114.0-13 → 0.114.0-18
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/apps/agents-server/next.config.ts +6 -0
- package/apps/agents-server/src/app/admin/_components/AdminFilterFields.tsx +84 -0
- package/apps/agents-server/src/app/admin/_components/AdminMetricCard.tsx +36 -0
- package/apps/agents-server/src/app/admin/_components/AdminTaskManagerTabs.tsx +97 -0
- package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerClient.tsx +103 -0
- package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerEditDialog.tsx +232 -0
- package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerFiltersCard.tsx +195 -0
- package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerRow.tsx +189 -0
- package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerSummaryMetrics.tsx +60 -0
- package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerTableCard.tsx +147 -0
- package/apps/agents-server/src/app/admin/planned-messages/page.tsx +17 -0
- package/apps/agents-server/src/app/admin/planned-messages/plannedMessageEditForm.ts +186 -0
- package/apps/agents-server/src/app/admin/planned-messages/plannedMessageManagerDialogs.ts +46 -0
- package/apps/agents-server/src/app/admin/planned-messages/plannedMessageManagerPresentation.tsx +188 -0
- package/apps/agents-server/src/app/admin/planned-messages/resolvePlannedMessageSortValue.ts +115 -0
- package/apps/agents-server/src/app/admin/planned-messages/usePlannedMessageManagerData.ts +116 -0
- package/apps/agents-server/src/app/admin/planned-messages/usePlannedMessageManagerState.ts +289 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +7 -2
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerFiltersCard.tsx +7 -73
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerSummaryMetrics.tsx +5 -30
- package/apps/agents-server/src/app/admin/task-manager/[taskId]/TaskManagerTaskDetailClient.tsx +1 -1
- package/apps/agents-server/src/app/agents/[agentName]/api/book/reference-diagnostics/route.ts +30 -7
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +1 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/book/test.http +3 -3
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorMissingReferences.tsx +106 -12
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +3 -0
- package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorDiagnostics.ts +12 -0
- package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorWrapper.tsx +2 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentGoalChatPlannedMessages.tsx +46 -3
- package/apps/agents-server/src/app/api/admin/default-agents/reinstate/route.ts +5 -1
- package/apps/agents-server/src/app/api/admin/planned-messages/[timeoutId]/route.ts +80 -0
- package/apps/agents-server/src/app/api/admin/planned-messages/route.ts +19 -0
- package/apps/agents-server/src/app/api/internal/agent-goal-chat-planned-messages/route.ts +30 -2
- package/apps/agents-server/src/components/DefaultAgents/ReinstateBundledAgentsButton.tsx +7 -0
- package/apps/agents-server/src/components/DefaultAgents/coreAgentsAdminRoute.ts +6 -0
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +7 -0
- package/apps/agents-server/src/components/Homepage/DefaultAgentsStatusNotice.tsx +1 -7
- package/apps/agents-server/src/database/migrations/2026-08-1800-user-chat-timeout-schedule.sql +11 -0
- package/apps/agents-server/src/instrumentation-node.ts +18 -0
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +4 -0
- package/apps/agents-server/src/languages/translations/czech.yaml +4 -0
- package/apps/agents-server/src/languages/translations/english.yaml +4 -0
- package/apps/agents-server/src/tools/agentGoalChatTimeoutToolFunctions.ts +62 -15
- package/apps/agents-server/src/tools/agentGoalChatTimeoutTools.ts +63 -9
- package/apps/agents-server/src/utils/adminEntityLookups/loadAgentNamesByPermanentId.ts +45 -0
- package/apps/agents-server/src/utils/adminEntityLookups/loadUsernamesByUserId.ts +36 -0
- package/apps/agents-server/src/utils/adminEntityLookups.ts +2 -0
- package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatPlannedMessageActions.ts +299 -52
- package/apps/agents-server/src/utils/agentGoalChat/createAgentGoalChatNoteContent.ts +45 -17
- package/apps/agents-server/src/utils/agentGoalChat.ts +1 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectIdentity.ts +46 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeAutostartScheduler.ts +162 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDesiredState.ts +252 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDisplay.ts +6 -3
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDomains.ts +2 -44
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimePaths.ts +25 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimePm2.ts +4 -3
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeRegistry.ts +77 -24
- package/apps/agents-server/src/utils/agentProjects/agentProjectStateMutationQueue.ts +58 -0
- package/apps/agents-server/src/utils/agentProjects/listAllLocalAgentProjectIdentities.ts +48 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectRuntimeEnvironmentFlag.ts +23 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectRuntimeStatus.ts +73 -0
- package/apps/agents-server/src/utils/agentProjects/startDefaultAgentProjectRuntimes.ts +110 -0
- package/apps/agents-server/src/utils/agentReferenceResolver/MissingCoreAgentRecovery.ts +19 -0
- package/apps/agents-server/src/utils/agentReferenceResolver/bookScopedAgentReferences.ts +7 -0
- package/apps/agents-server/src/utils/agentReferenceResolver/createAgentInheritanceDiagnostics.ts +457 -0
- package/apps/agents-server/src/utils/agentReferenceResolver/createUnresolvedAgentReferenceDiagnostics.ts +27 -0
- package/apps/agents-server/src/utils/agentReferenceResolver/resolveCoreAgentAwareMissingReferences.ts +156 -0
- package/apps/agents-server/src/utils/chatMessageChips/createAnsweredMessageChipToolCalls.ts +15 -3
- package/apps/agents-server/src/utils/chatMessageChips/createPlannedMessageChipToolCalls.ts +8 -3
- package/apps/agents-server/src/utils/chatMessageChips/createTouchedExternalSourceChipToolCalls.ts +39 -0
- package/apps/agents-server/src/utils/chatMessageChips/createTouchedProjectChipResult.ts +45 -0
- package/apps/agents-server/src/utils/chatMessageChips/createTouchedProjectChipToolCalls.ts +58 -24
- package/apps/agents-server/src/utils/cronExpression/CronExpression.ts +63 -0
- package/apps/agents-server/src/utils/cronExpression/normalizeCronExpression.ts +34 -0
- package/apps/agents-server/src/utils/cronExpression/normalizeCronExpressionWhitespace.ts +11 -0
- package/apps/agents-server/src/utils/cronExpression/parseCronExpression.ts +41 -0
- package/apps/agents-server/src/utils/cronExpression/parseCronExpressionField.ts +140 -0
- package/apps/agents-server/src/utils/cronExpression/resolveNextCronRun.ts +100 -0
- package/apps/agents-server/src/utils/cronExpression/throwInvalidCronExpressionField.ts +20 -0
- package/apps/agents-server/src/utils/cronExpression.ts +10 -0
- package/apps/agents-server/src/utils/explicitFromCommitment.ts +130 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/loadAdminChatTaskFallbackData.ts +3 -77
- package/apps/agents-server/src/utils/localChatRunner/applyLocalAgentPlannedMessageCommands.ts +53 -4
- package/apps/agents-server/src/utils/localChatRunner/prepareLocalAgentPlannedMessagesSidecar.ts +15 -7
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +8 -0
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentBooks.ts +5 -11
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentRuntime.ts +2 -2
- package/apps/agents-server/src/utils/managementApi/managementApiSchemas.ts +2 -2
- package/apps/agents-server/src/utils/plannedMessageManager/cancelManagedPlannedMessage.ts +35 -0
- package/apps/agents-server/src/utils/plannedMessageManager/collectPlannedMessageAgentOptions.ts +56 -0
- package/apps/agents-server/src/utils/plannedMessageManager/createPlannedMessageManagerCounters.ts +104 -0
- package/apps/agents-server/src/utils/plannedMessageManager/filterPlannedMessages.ts +191 -0
- package/apps/agents-server/src/utils/plannedMessageManager/getPlannedMessageManagerResponse.ts +55 -0
- package/apps/agents-server/src/utils/plannedMessageManager/isPlannedMessageStillPlanned.ts +18 -0
- package/apps/agents-server/src/utils/plannedMessageManager/loadPlannedMessageManagerRecord.ts +32 -0
- package/apps/agents-server/src/utils/plannedMessageManager/mapPlannedMessageManagerRecord.ts +73 -0
- package/apps/agents-server/src/utils/plannedMessageManager/parsePlannedMessageManagerUpdateRequest.ts +76 -0
- package/apps/agents-server/src/utils/plannedMessageManager/resolvePlannedMessageEndReason.ts +59 -0
- package/apps/agents-server/src/utils/plannedMessageManager/resolvePlannedMessageLifecycle.ts +99 -0
- package/apps/agents-server/src/utils/plannedMessageManager/resolvePlannedMessageRecurrenceKind.ts +40 -0
- package/apps/agents-server/src/utils/plannedMessageManager/updateManagedPlannedMessage.ts +121 -0
- package/apps/agents-server/src/utils/plannedMessagesAdmin.ts +200 -0
- package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +114 -95
- package/apps/agents-server/src/utils/userChatClient.ts +4 -0
- package/apps/agents-server/src/utils/userChatTimeout/UserChatTimeoutRecord.ts +37 -1
- package/apps/agents-server/src/utils/userChatTimeout/agentScopedTimeoutBulkActions.ts +11 -17
- package/apps/agents-server/src/utils/userChatTimeout/createTimeoutWakeUpMessage.ts +37 -13
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/PlannedMessageSchedule.ts +52 -0
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/hasPlannedMessageRecurrence.ts +13 -0
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/isPlannedMessageScheduleFinished.ts +30 -0
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/normalizePlannedMessageScheduleValues.ts +62 -0
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/parsePlannedMessageSchedule.ts +202 -0
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/resolvePlannedMessageDueAt.ts +121 -0
- package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule.ts +12 -0
- package/apps/agents-server/src/utils/userChatTimeout/setAgentScopedUserChatTimeoutPausedState.ts +66 -0
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/createUserChatTimeout.ts +76 -5
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/listAllUserChatTimeouts.ts +37 -0
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/mapUserChatTimeoutRow.ts +9 -0
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/repeatFiredUserChatTimeout.ts +19 -9
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/updateAgentScopedUserChatTimeout.ts +39 -6
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore.ts +1 -0
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutWorker.ts +110 -11
- package/apps/agents-server/src/utils/userChatTimeout.ts +16 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateCron.ts +23 -316
- package/apps/agents-server/tests/e2e/support/AgentManagementApi.ts +3 -3
- package/esm/index.es.js +951 -102
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/git/commitAgentProjectChanges.d.ts +15 -0
- package/esm/scripts/run-agent-messages/git/commitAnsweredMessageProjectChanges.d.ts +24 -0
- package/esm/scripts/run-agent-messages/git/ensureAgentProjectGitRepository.d.ts +20 -0
- package/esm/scripts/run-agent-messages/git/readAgentProjectCommitChange.d.ts +11 -0
- package/esm/scripts/run-agent-messages/git/runAgentProjectGitCommand.d.ts +29 -0
- package/esm/scripts/run-agent-messages/messages/buildAgentGoalChatPromptSection.d.ts +3 -3
- package/esm/scripts/run-agent-messages/messages/listAgentProjectDirectoryNames.d.ts +7 -0
- package/esm/scripts/run-agent-messages/messages/resolveAnsweredMessageTouches.d.ts +29 -0
- package/esm/scripts/run-codex-prompts/ping/pingCoderHarnessPeriodically.d.ts +22 -0
- package/esm/src/book-3.0/AgentMessageRunReport.d.ts +18 -0
- package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +38 -5
- 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/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/utils/agentProjectToolCall.d.ts +39 -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/timeoutToolCallPresentation.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
- 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 +3 -0
- 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/random/$generateBookBoilerplate.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/book-2.0/agent-source/string_book.ts +1 -1
- package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +6 -1
- package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +6 -1
- package/src/book-3.0/AgentMessageRunReport.ts +59 -0
- package/src/book-3.0/AgentPlannedMessagesSidecar.ts +64 -9
- package/src/book-3.0/describeAgentPlannedMessageSchedule.ts +94 -0
- package/src/book-components/BookEditor/BookEditorMonaco.tsx +2 -0
- package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +3 -11
- package/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.ts +71 -0
- package/src/book-components/Chat/Chat/Chat.module.css +165 -18
- package/src/book-components/Chat/Chat/ChatMessageMap.tsx +0 -1
- package/src/book-components/Chat/Chat/renderAgentProjectDiff.tsx +85 -0
- package/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.tsx +206 -0
- package/src/book-components/Chat/Chat/renderToolCallDetails.tsx +8 -0
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +2 -3
- package/src/book-components/Chat/utils/agentProjectToolCall.ts +82 -5
- package/src/book-components/Chat/utils/externalSourceToolCall.ts +65 -0
- package/src/book-components/Chat/utils/getToolCallChipletInfo.ts +36 -0
- package/src/book-components/Chat/utils/renderMarkdown.ts +3 -10
- package/src/book-components/Chat/utils/timeoutToolCallPresentation.ts +12 -1
- package/src/cli/cli-commands/coder/ping.ts +35 -9
- package/src/cli/cli-commands/coder/waitOptions.ts +33 -0
- package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +3 -1
- package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +3 -1
- package/src/cli/cli-commands/common/harnessUpdateCliOptions.ts +1 -4
- package/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.ts +47 -3
- package/src/commands/FORMAT/formatCommandParser.ts +4 -2
- package/src/commitments/FROM/FROM.ts +13 -0
- package/src/other/templates/getTemplatesPipelineCollection.ts +819 -751
- package/src/utils/agent-message-runtime/AgentMessageProjectChange.ts +183 -0
- package/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.ts +80 -0
- package/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.ts +3 -0
- package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +2 -4
- package/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.ts +341 -0
- package/src/utils/random/$generateBookBoilerplate.ts +1 -1
- package/src/version.ts +2 -2
- package/src/versions.txt +5 -0
- package/umd/index.umd.js +950 -101
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/git/commitAgentProjectChanges.d.ts +15 -0
- package/umd/scripts/run-agent-messages/git/commitAnsweredMessageProjectChanges.d.ts +24 -0
- package/umd/scripts/run-agent-messages/git/ensureAgentProjectGitRepository.d.ts +20 -0
- package/umd/scripts/run-agent-messages/git/readAgentProjectCommitChange.d.ts +11 -0
- package/umd/scripts/run-agent-messages/git/runAgentProjectGitCommand.d.ts +29 -0
- package/umd/scripts/run-agent-messages/messages/buildAgentGoalChatPromptSection.d.ts +3 -3
- package/umd/scripts/run-agent-messages/messages/listAgentProjectDirectoryNames.d.ts +7 -0
- package/umd/scripts/run-agent-messages/messages/resolveAnsweredMessageTouches.d.ts +29 -0
- package/umd/scripts/run-codex-prompts/ping/pingCoderHarnessPeriodically.d.ts +22 -0
- package/umd/src/book-3.0/AgentMessageRunReport.d.ts +18 -0
- package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +38 -5
- 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/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/utils/agentProjectToolCall.d.ts +39 -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/timeoutToolCallPresentation.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
- 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 +3 -0
- 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/random/$generateBookBoilerplate.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerScopeTabs.tsx +0 -74
- package/esm/scripts/run-agent-messages/messages/resolveTouchedAgentProjects.d.ts +0 -15
- package/umd/scripts/run-agent-messages/messages/resolveTouchedAgentProjects.d.ts +0 -15
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Category of one external source an answered agent message touched.
|
|
3
|
+
*
|
|
4
|
+
* - `integration` is a third-party service reached through an integration, for example Gmail.
|
|
5
|
+
* - `website` is a concrete web address the agent fetched or browsed.
|
|
6
|
+
* - `search` is a lookup the agent ran against a web search engine.
|
|
7
|
+
*
|
|
8
|
+
* @private internal type of the agent-message runtime
|
|
9
|
+
*/
|
|
10
|
+
export type AgentMessageTouchedExternalSourceKind = 'integration' | 'website' | 'search';
|
|
11
|
+
/**
|
|
12
|
+
* One source outside the agent itself which answering a single message viewed or edited.
|
|
13
|
+
*
|
|
14
|
+
* Everything the agent does inside its own folder stays internal and is never described here;
|
|
15
|
+
* this records only the reach beyond it, so a chat can tell which outside services and websites
|
|
16
|
+
* one answer really involved.
|
|
17
|
+
*
|
|
18
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
19
|
+
*
|
|
20
|
+
* @private internal type of the agent-message runtime
|
|
21
|
+
*/
|
|
22
|
+
export type AgentMessageTouchedExternalSource = {
|
|
23
|
+
/**
|
|
24
|
+
* Category of the touched source.
|
|
25
|
+
*/
|
|
26
|
+
readonly kind: AgentMessageTouchedExternalSourceKind;
|
|
27
|
+
/**
|
|
28
|
+
* User-facing name of the source, for example `Gmail`, `example.com` or the search query.
|
|
29
|
+
*/
|
|
30
|
+
readonly name: string;
|
|
31
|
+
/**
|
|
32
|
+
* Address of the source, when the touch names a concrete one.
|
|
33
|
+
*/
|
|
34
|
+
readonly url?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Validates one already-parsed JSON value as a touched external source.
|
|
38
|
+
*
|
|
39
|
+
* @param value - Raw serialized source.
|
|
40
|
+
* @returns The typed source, or `null` when the value does not match the expected shape, so
|
|
41
|
+
* consumers can silently skip foreign or malformed entries.
|
|
42
|
+
*
|
|
43
|
+
* @private internal utility of the agent-message runtime
|
|
44
|
+
*/
|
|
45
|
+
export declare function normalizeAgentMessageTouchedExternalSource(value: unknown): AgentMessageTouchedExternalSource | null;
|
|
@@ -42,6 +42,9 @@ export type AgentMessageRuntimeLogEvent = {
|
|
|
42
42
|
readonly command?: string;
|
|
43
43
|
readonly exit_code?: number | null;
|
|
44
44
|
readonly changes?: ReadonlyArray<AgentMessageRuntimeLogFileChange>;
|
|
45
|
+
readonly server?: string;
|
|
46
|
+
readonly tool?: string;
|
|
47
|
+
readonly query?: string;
|
|
45
48
|
};
|
|
46
49
|
};
|
|
47
50
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentMessageTouchedExternalSource } from './AgentMessageTouchedExternalSource';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves which sources outside the agent one coding harness touched while answering a single message.
|
|
4
|
+
*
|
|
5
|
+
* The runtime log streams what the harness really did, so a source counts as touched when the
|
|
6
|
+
* harness reached it in a tool invocation — calling an integration, fetching a web address,
|
|
7
|
+
* searching the web, or running a network client in the shell. Only tool payloads are inspected:
|
|
8
|
+
* tool results and assistant narration are ignored so a service merely mentioned in the
|
|
9
|
+
* conversation is never reported, and addresses of the machine the agent runs on are dropped
|
|
10
|
+
* because they are internal.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Raw runtime log content of one answered message.
|
|
13
|
+
* @returns Touched external sources without duplicates, ordered by first appearance.
|
|
14
|
+
* @private internal utility of the agent-message runtime
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveAgentMessageTouchedExternalSources(options: {
|
|
17
|
+
readonly logText: string | null | undefined;
|
|
18
|
+
}): ReadonlyArray<AgentMessageTouchedExternalSource>;
|
package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.114.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.114.0-17`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -140,7 +140,12 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
140
140
|
\`FROM\` odkazuje na zdroj rodičovského agenta. Při vyhodnocení dědičnosti platí:
|
|
141
141
|
|
|
142
142
|
- Obsah rodiče se sloučí do výsledného zdroje.
|
|
143
|
-
- \`FROM
|
|
143
|
+
- Když \`FROM\` není uvedeno vůbec, platí to samé jako \`FROM @Adam\`, tedy jádrový agent, ze kterého dědí každý agent.
|
|
144
|
+
- \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
|
|
145
|
+
- Výslovně zvolený rodič nahradí implicitního Adama; vlastní řetězec \`FROM\` tohoto rodiče se pak zdědí běžným způsobem.
|
|
146
|
+
- \`@Jmeno\` je pro jednoslovné jméno agenta zkratka zápisu \`{Jmeno}\`.
|
|
147
|
+
- Když je \`FROM\` uvedeno vícekrát, platí poslední a přepíše všechna předchozí.
|
|
148
|
+
- Adam je kořenový agent a musí výslovně použít \`FROM @Null\` (\`@Void\` je ekvivalentní). Editor knihy upozorní na jiného Adamova rodiče i na lokální cykly dědičnosti.
|
|
144
149
|
- Chybějící odkazy se do výsledného zdroje propíší jako poznámky.
|
|
145
150
|
`),
|
|
146
151
|
},
|
|
@@ -140,7 +140,12 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
140
140
|
\`FROM\` points to a parent agent source. During inheritance resolution:
|
|
141
141
|
|
|
142
142
|
- Parent corpus is merged into effective source.
|
|
143
|
-
- \`FROM
|
|
143
|
+
- Writing no \`FROM\` at all is the same as writing \`FROM @Adam\`, the core agent every agent inherits from.
|
|
144
|
+
- \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
|
|
145
|
+
- An explicit parent replaces the implicit Adam parent; the selected parent's own \`FROM\` chain is then inherited normally.
|
|
146
|
+
- \`@Name\` is shorthand for \`{Name}\` when the agent name is one word.
|
|
147
|
+
- When \`FROM\` is written more than once, the last one wins and overrides every earlier one.
|
|
148
|
+
- Adam is the root agent and must explicitly use \`FROM @Null\` (\`@Void\` is equivalent). The Book editor warns about a different Adam parent and local inheritance cycles.
|
|
144
149
|
- Missing references are surfaced as notes in resolved source.
|
|
145
150
|
`),
|
|
146
151
|
},
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2
2
|
|
|
3
3
|
import type { Usage } from '../execution/Usage';
|
|
4
|
+
import type { AgentMessageProjectChange } from '../utils/agent-message-runtime/AgentMessageProjectChange';
|
|
5
|
+
import { normalizeAgentMessageProjectChange } from '../utils/agent-message-runtime/AgentMessageProjectChange';
|
|
6
|
+
import type { AgentMessageTouchedExternalSource } from '../utils/agent-message-runtime/AgentMessageTouchedExternalSource';
|
|
7
|
+
import { normalizeAgentMessageTouchedExternalSource } from '../utils/agent-message-runtime/AgentMessageTouchedExternalSource';
|
|
4
8
|
import type { CodexLoginMethod } from './codexLoginMethod';
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -84,6 +88,24 @@ export type AgentMessageRunReport = {
|
|
|
84
88
|
* answered, so this is the only trace of the projects one answer viewed or edited.
|
|
85
89
|
*/
|
|
86
90
|
readonly touchedProjectNames?: ReadonlyArray<string>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Sources outside the agent — integrations, websites and web searches — the harness reached
|
|
94
|
+
* while answering the message.
|
|
95
|
+
*
|
|
96
|
+
* Reported from the same live runtime log as `touchedProjectNames`, so this is the only trace
|
|
97
|
+
* of what one answer touched beyond the agent itself.
|
|
98
|
+
*/
|
|
99
|
+
readonly touchedExternalSources?: ReadonlyArray<AgentMessageTouchedExternalSource>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Changes the harness made to the agent projects while answering the message.
|
|
103
|
+
*
|
|
104
|
+
* Every agent project is a git repository and the runner commits each answer into it, so one
|
|
105
|
+
* entry describes exactly what one message did to one project — including the diff of the
|
|
106
|
+
* commit it created.
|
|
107
|
+
*/
|
|
108
|
+
readonly projectChanges?: ReadonlyArray<AgentMessageProjectChange>;
|
|
87
109
|
};
|
|
88
110
|
|
|
89
111
|
/**
|
|
@@ -150,9 +172,46 @@ export function normalizeAgentMessageRunReport(value: unknown): AgentMessageRunR
|
|
|
150
172
|
return null;
|
|
151
173
|
}
|
|
152
174
|
|
|
175
|
+
if (
|
|
176
|
+
report.touchedExternalSources !== undefined &&
|
|
177
|
+
!isSerializedTouchedExternalSourceList(report.touchedExternalSources)
|
|
178
|
+
) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (report.projectChanges !== undefined && !isSerializedProjectChangeList(report.projectChanges)) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
|
|
153
186
|
return report as AgentMessageRunReport;
|
|
154
187
|
}
|
|
155
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Checks that one value structurally matches a list of project changes.
|
|
191
|
+
*
|
|
192
|
+
* @private internal helper of `normalizeAgentMessageRunReport`
|
|
193
|
+
*/
|
|
194
|
+
function isSerializedProjectChangeList(value: unknown): value is ReadonlyArray<AgentMessageProjectChange> {
|
|
195
|
+
return (
|
|
196
|
+
Array.isArray(value) &&
|
|
197
|
+
value.every((projectChange) => normalizeAgentMessageProjectChange(projectChange) !== null)
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Checks that one value structurally matches a list of touched external sources.
|
|
203
|
+
*
|
|
204
|
+
* @private internal helper of `normalizeAgentMessageRunReport`
|
|
205
|
+
*/
|
|
206
|
+
function isSerializedTouchedExternalSourceList(
|
|
207
|
+
value: unknown,
|
|
208
|
+
): value is ReadonlyArray<AgentMessageTouchedExternalSource> {
|
|
209
|
+
return (
|
|
210
|
+
Array.isArray(value) &&
|
|
211
|
+
value.every((externalSource) => normalizeAgentMessageTouchedExternalSource(externalSource) !== null)
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
156
215
|
/**
|
|
157
216
|
* Checks that one value structurally matches a list of project directory names.
|
|
158
217
|
*
|
|
@@ -16,7 +16,7 @@ export const AGENT_PLANNED_MESSAGES_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTO
|
|
|
16
16
|
*
|
|
17
17
|
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
18
18
|
*/
|
|
19
|
-
export const AGENT_PLANNED_MESSAGE_COMMAND_ACTIONS = ['set', 'cancel'] as const;
|
|
19
|
+
export const AGENT_PLANNED_MESSAGE_COMMAND_ACTIONS = ['set', 'update', 'cancel'] as const;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* One planned-message command action.
|
|
@@ -28,8 +28,9 @@ export type AgentPlannedMessageCommandAction = (typeof AGENT_PLANNED_MESSAGE_COM
|
|
|
28
28
|
/**
|
|
29
29
|
* One planned message that is already waiting to wake the agent.
|
|
30
30
|
*
|
|
31
|
-
* A planned message
|
|
32
|
-
* goal, while `dueAt` only says
|
|
31
|
+
* A planned message can repeat like `setInterval`, run a bounded number of times, or wake the agent
|
|
32
|
+
* only once, so the whole schedule is what the agent compares with its goal, while `dueAt` only says
|
|
33
|
+
* when the nearest wake-up happens.
|
|
33
34
|
*
|
|
34
35
|
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
35
36
|
*/
|
|
@@ -39,9 +40,39 @@ export type AgentPlannedMessageSnapshot = {
|
|
|
39
40
|
readonly message: string | null;
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
|
-
* Repeat interval in milliseconds, or `null` for a planned message that
|
|
43
|
+
* Repeat interval in milliseconds, or `null` for a planned message that does not repeat at a fixed
|
|
44
|
+
* interval.
|
|
43
45
|
*/
|
|
44
46
|
readonly intervalMs: number | null;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Five-field cron expression driving the repetitions, or `null` when the planned message does not
|
|
50
|
+
* follow a cron.
|
|
51
|
+
*/
|
|
52
|
+
readonly cronExpression: string | null;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Moment before which the planned message never wakes the agent, or `null` when it has no starting
|
|
56
|
+
* date.
|
|
57
|
+
*/
|
|
58
|
+
readonly startsAt: string | null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Moment after which the planned message never wakes the agent again, or `null` when it has no
|
|
62
|
+
* ending date.
|
|
63
|
+
*/
|
|
64
|
+
readonly endsAt: string | null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Total number of wake-ups the planned message performs, or `null` when it repeats until it is
|
|
68
|
+
* cancelled.
|
|
69
|
+
*/
|
|
70
|
+
readonly maxRunCount: number | null;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Number of times the planned message already woke the agent.
|
|
74
|
+
*/
|
|
75
|
+
readonly runCount: number;
|
|
45
76
|
};
|
|
46
77
|
|
|
47
78
|
/**
|
|
@@ -50,13 +81,20 @@ export type AgentPlannedMessageSnapshot = {
|
|
|
50
81
|
* The payload stays untyped on purpose: it is untrusted harness output and is validated by the very
|
|
51
82
|
* same shared planned-message actions that back the model tools and the internal runtime API.
|
|
52
83
|
*
|
|
53
|
-
* For a `set` command, `milliseconds` is the repeat interval of the planned message, not a one-shot
|
|
84
|
+
* For a `set` command, `milliseconds` is the repeat interval of the planned message, not a one-shot
|
|
85
|
+
* delay, and `cronExpression`, `startsAt`, `endsAt`, and `maxRunCount` bound how it repeats. An
|
|
86
|
+
* `update` command changes the very same fields of the planned message named by `timeoutId`, where a
|
|
87
|
+
* field that is left out stays as it is and an explicit `null` removes the bound.
|
|
54
88
|
*
|
|
55
89
|
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
56
90
|
*/
|
|
57
91
|
export type AgentPlannedMessageCommand = {
|
|
58
92
|
readonly action: AgentPlannedMessageCommandAction;
|
|
59
93
|
readonly milliseconds?: unknown;
|
|
94
|
+
readonly cronExpression?: unknown;
|
|
95
|
+
readonly startsAt?: unknown;
|
|
96
|
+
readonly endsAt?: unknown;
|
|
97
|
+
readonly maxRunCount?: unknown;
|
|
60
98
|
readonly message?: unknown;
|
|
61
99
|
readonly timeoutId?: unknown;
|
|
62
100
|
};
|
|
@@ -194,23 +232,40 @@ function normalizeAgentPlannedMessageSnapshots(rawSnapshots: unknown): Array<Age
|
|
|
194
232
|
* Normalizes the optional fields of one already planned message.
|
|
195
233
|
*
|
|
196
234
|
* @param snapshot - Planned-message entry with the required identity fields.
|
|
197
|
-
* @returns Snapshot with a usable
|
|
235
|
+
* @returns Snapshot with a usable schedule and message.
|
|
198
236
|
*
|
|
199
237
|
* @private internal utility of `parseAgentPlannedMessagesSidecar`
|
|
200
238
|
*/
|
|
201
239
|
function createNormalizedAgentPlannedMessageSnapshot(
|
|
202
240
|
snapshot: AgentPlannedMessageSnapshot,
|
|
203
241
|
): AgentPlannedMessageSnapshot {
|
|
204
|
-
const intervalMs = Number(snapshot.intervalMs);
|
|
205
|
-
|
|
206
242
|
return {
|
|
207
243
|
timeoutId: snapshot.timeoutId,
|
|
208
244
|
dueAt: snapshot.dueAt,
|
|
209
245
|
message: typeof snapshot.message === 'string' ? snapshot.message : null,
|
|
210
|
-
intervalMs:
|
|
246
|
+
intervalMs: normalizeAgentPlannedMessagePositiveCount(snapshot.intervalMs),
|
|
247
|
+
cronExpression: typeof snapshot.cronExpression === 'string' ? snapshot.cronExpression : null,
|
|
248
|
+
startsAt: typeof snapshot.startsAt === 'string' ? snapshot.startsAt : null,
|
|
249
|
+
endsAt: typeof snapshot.endsAt === 'string' ? snapshot.endsAt : null,
|
|
250
|
+
maxRunCount: normalizeAgentPlannedMessagePositiveCount(snapshot.maxRunCount),
|
|
251
|
+
runCount: normalizeAgentPlannedMessagePositiveCount(snapshot.runCount) || 0,
|
|
211
252
|
};
|
|
212
253
|
}
|
|
213
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Normalizes one optional positive whole number of a planned-message snapshot.
|
|
257
|
+
*
|
|
258
|
+
* @param value - Untrusted interval, run count, or run-count limit.
|
|
259
|
+
* @returns Whole positive number, or `null` when the value cannot be used.
|
|
260
|
+
*
|
|
261
|
+
* @private internal utility of `parseAgentPlannedMessagesSidecar`
|
|
262
|
+
*/
|
|
263
|
+
function normalizeAgentPlannedMessagePositiveCount(value: unknown): number | null {
|
|
264
|
+
const numericValue = Number(value);
|
|
265
|
+
|
|
266
|
+
return Number.isFinite(numericValue) && numericValue > 0 ? Math.floor(numericValue) : null;
|
|
267
|
+
}
|
|
268
|
+
|
|
214
269
|
/**
|
|
215
270
|
* Checks whether one untrusted sidecar entry describes an already planned message.
|
|
216
271
|
*
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { formatTimeoutDurationHuman } from '../book-components/Chat/utils/timeoutToolCallPresentation';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Schedule of one planned message as it is described to an agent.
|
|
5
|
+
*
|
|
6
|
+
* The fields match `AgentPlannedMessageSnapshot`, so one snapshot, one scheduling result, and one
|
|
7
|
+
* stored planned message are all described by the very same sentence.
|
|
8
|
+
*
|
|
9
|
+
* @private internal convention shared by the Agents Server and agent-folder runner
|
|
10
|
+
*/
|
|
11
|
+
export type AgentPlannedMessageScheduleDescription = {
|
|
12
|
+
readonly intervalMs?: number | null;
|
|
13
|
+
readonly cronExpression?: string | null;
|
|
14
|
+
readonly startsAt?: string | null;
|
|
15
|
+
readonly endsAt?: string | null;
|
|
16
|
+
readonly maxRunCount?: number | null;
|
|
17
|
+
readonly runCount?: number | null;
|
|
18
|
+
readonly dueAt?: string | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Describes one planned-message schedule in a single sentence fragment.
|
|
23
|
+
*
|
|
24
|
+
* A planned message can repeat forever, repeat a bounded number of times, run inside a date window, or
|
|
25
|
+
* wake the agent only once. Every surface showing a planned message — the wake-up itself, the goal-chat
|
|
26
|
+
* notes, the planned-message prompt section, and the model tools — describes it with this one helper,
|
|
27
|
+
* so an agent never has to reconcile two different wordings of the same plan.
|
|
28
|
+
*
|
|
29
|
+
* @param schedule - Schedule of the planned message.
|
|
30
|
+
* @returns Fragment such as `repeats every 5 minutes (2 of 10 runs done)`.
|
|
31
|
+
*
|
|
32
|
+
* @private internal utility of the Agents Server planned messages
|
|
33
|
+
*/
|
|
34
|
+
export function describeAgentPlannedMessageSchedule(schedule: AgentPlannedMessageScheduleDescription): string {
|
|
35
|
+
const scheduleParts = [
|
|
36
|
+
describeAgentPlannedMessageRecurrence(schedule),
|
|
37
|
+
...describeAgentPlannedMessageBounds(schedule),
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
return scheduleParts.join(', ');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Describes how often one planned message wakes the agent.
|
|
45
|
+
*
|
|
46
|
+
* @param schedule - Schedule of the planned message.
|
|
47
|
+
* @returns Recurrence fragment.
|
|
48
|
+
*
|
|
49
|
+
* @private internal utility of `describeAgentPlannedMessageSchedule`
|
|
50
|
+
*/
|
|
51
|
+
function describeAgentPlannedMessageRecurrence(schedule: AgentPlannedMessageScheduleDescription): string {
|
|
52
|
+
if (schedule.cronExpression) {
|
|
53
|
+
return `repeats on cron \`${schedule.cronExpression}\``;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (schedule.intervalMs) {
|
|
57
|
+
return `repeats every ${formatTimeoutDurationHuman(schedule.intervalMs)}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return schedule.dueAt ? `wakes you once at ${schedule.dueAt}` : 'wakes you once';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Describes the bounds limiting how long one planned message keeps repeating.
|
|
65
|
+
*
|
|
66
|
+
* @param schedule - Schedule of the planned message.
|
|
67
|
+
* @returns Fragments for the starting date, ending date, and run count that are really set.
|
|
68
|
+
*
|
|
69
|
+
* @private internal utility of `describeAgentPlannedMessageSchedule`
|
|
70
|
+
*/
|
|
71
|
+
function describeAgentPlannedMessageBounds(schedule: AgentPlannedMessageScheduleDescription): Array<string> {
|
|
72
|
+
const bounds: Array<string> = [];
|
|
73
|
+
const runCount = schedule.runCount || 0;
|
|
74
|
+
|
|
75
|
+
if (schedule.startsAt) {
|
|
76
|
+
bounds.push(`starting ${schedule.startsAt}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (schedule.endsAt) {
|
|
80
|
+
bounds.push(`until ${schedule.endsAt}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (schedule.maxRunCount) {
|
|
84
|
+
bounds.push(`${runCount} of ${schedule.maxRunCount} runs done`);
|
|
85
|
+
} else if (runCount > 0) {
|
|
86
|
+
bounds.push(`${runCount} run${runCount === 1 ? '' : 's'} done`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((schedule.cronExpression || schedule.intervalMs) && schedule.dueAt) {
|
|
90
|
+
bounds.push(`next at ${schedule.dueAt}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return bounds;
|
|
94
|
+
}
|
|
@@ -15,6 +15,7 @@ import { BookEditorMonacoConstants } from './BookEditorMonacoConstants';
|
|
|
15
15
|
import { BookEditorMonacoUploadPanel } from './BookEditorMonacoUploadPanel';
|
|
16
16
|
import { BOOK_EDITOR_RENDER_THEME, resolveBookEditorRenderTheme } from './BookEditorTheme';
|
|
17
17
|
import { createDeprecatedCommitmentDiagnostics } from './createDeprecatedCommitmentDiagnostics.browser';
|
|
18
|
+
import { createDuplicateFromCommitmentDiagnostics } from './createDuplicateFromCommitmentDiagnostics';
|
|
18
19
|
import { createUnknownCommitmentDiagnostics } from './createUnknownCommitmentDiagnostics';
|
|
19
20
|
import { useBookEditorMonacoDecorations } from './useBookEditorMonacoDecorations';
|
|
20
21
|
import { useBookEditorMonacoDiagnostics } from './useBookEditorMonacoDiagnostics';
|
|
@@ -262,6 +263,7 @@ export function BookEditorMonaco(props: BookEditorProps) {
|
|
|
262
263
|
...(diagnostics || []),
|
|
263
264
|
...createDeprecatedCommitmentDiagnostics(value),
|
|
264
265
|
...createUnknownCommitmentDiagnostics(value),
|
|
266
|
+
...createDuplicateFromCommitmentDiagnostics(value),
|
|
265
267
|
];
|
|
266
268
|
const isActionBarVisible = isBookEditorMonacoActionbarVisible({
|
|
267
269
|
hoistedMenuItems,
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* In the browser build the full Node.js implementation is not available,
|
|
5
|
-
* so this stub always returns an empty array to keep the editor functional.
|
|
6
|
-
*
|
|
7
|
-
* @private internal utility of `BookEditorMonaco`
|
|
8
|
-
*/
|
|
9
|
-
export function createDeprecatedCommitmentDiagnostics(_agentSource?: string): [] {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
1
|
+
// The Book editor already uses the commitment parser in the browser for other
|
|
2
|
+
// diagnostics, so reuse the same catalog-driven implementation here as well.
|
|
3
|
+
export { createDeprecatedCommitmentDiagnostics } from './createDeprecatedCommitmentDiagnostics';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { parseAgentSourceWithCommitments } from '../../book-2.0/agent-source/parseAgentSourceWithCommitments';
|
|
2
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Monaco diagnostic shown when a Book source declares its parent agent more than once.
|
|
6
|
+
*
|
|
7
|
+
* @private internal type of `BookEditorMonaco`
|
|
8
|
+
*/
|
|
9
|
+
type DuplicateFromCommitmentDiagnostic = {
|
|
10
|
+
readonly startLineNumber: number;
|
|
11
|
+
readonly startColumn: number;
|
|
12
|
+
readonly endLineNumber: number;
|
|
13
|
+
readonly endColumn: number;
|
|
14
|
+
readonly message: string;
|
|
15
|
+
readonly source: string;
|
|
16
|
+
readonly severity: 'warning';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Commitment declaring the parent agent one book inherits from.
|
|
21
|
+
*
|
|
22
|
+
* @private internal constant of `createDuplicateFromCommitmentDiagnostics`
|
|
23
|
+
*/
|
|
24
|
+
const FROM_COMMITMENT_TYPE = 'FROM';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates Book editor diagnostics for a parent agent declared by more than one `FROM` commitment.
|
|
28
|
+
*
|
|
29
|
+
* Repeating `FROM` stays valid — the last one wins and overrides every earlier one — but an author who writes it
|
|
30
|
+
* twice usually means only one of them, so every `FROM` keyword is marked to show which one actually applies.
|
|
31
|
+
*
|
|
32
|
+
* @param agentSource - Current editor content.
|
|
33
|
+
* @returns Warning markers for every `FROM` keyword, empty when the book declares at most one parent.
|
|
34
|
+
*
|
|
35
|
+
* @private internal utility of `BookEditorMonaco`
|
|
36
|
+
*/
|
|
37
|
+
export function createDuplicateFromCommitmentDiagnostics(
|
|
38
|
+
agentSource?: string_book,
|
|
39
|
+
): ReadonlyArray<DuplicateFromCommitmentDiagnostic> {
|
|
40
|
+
if (!agentSource?.trim()) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const fromCommitments = parseAgentSourceWithCommitments(agentSource).commitments.filter(
|
|
45
|
+
(commitment) => commitment.type === FROM_COMMITMENT_TYPE,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (fromCommitments.length < 2) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const lastFromCommitment = fromCommitments[fromCommitments.length - 1]!;
|
|
53
|
+
|
|
54
|
+
return fromCommitments.map((fromCommitment) => {
|
|
55
|
+
const startColumn = fromCommitment.originalLine.indexOf(FROM_COMMITMENT_TYPE) + 1;
|
|
56
|
+
const isEffectiveFromCommitment = fromCommitment === lastFromCommitment;
|
|
57
|
+
const message = isEffectiveFromCommitment
|
|
58
|
+
? `\`${FROM_COMMITMENT_TYPE}\` is written ${fromCommitments.length} times in this book. Only this last one is used, the earlier ones are ignored.`
|
|
59
|
+
: `\`${FROM_COMMITMENT_TYPE}\` is written ${fromCommitments.length} times in this book. Only the last one on line ${lastFromCommitment.lineNumber} is used, so this one is ignored.`;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
startLineNumber: fromCommitment.lineNumber,
|
|
63
|
+
startColumn,
|
|
64
|
+
endLineNumber: fromCommitment.lineNumber,
|
|
65
|
+
endColumn: startColumn + FROM_COMMITMENT_TYPE.length,
|
|
66
|
+
message,
|
|
67
|
+
source: 'Promptbook',
|
|
68
|
+
severity: 'warning',
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|