actoviq-agent-sdk 0.4.11 → 0.4.13
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/CHANGELOG.md +42 -0
- package/dist/src/computer/hadamardComputerUse.d.ts +15 -0
- package/dist/src/computer/hadamardComputerUse.d.ts.map +1 -1
- package/dist/src/computer/hadamardComputerUse.js +120 -4
- package/dist/src/computer/hadamardComputerUse.js.map +1 -1
- package/dist/src/config/agentDefinitionMigration.d.ts +125 -0
- package/dist/src/config/agentDefinitionMigration.d.ts.map +1 -0
- package/dist/src/config/agentDefinitionMigration.js +540 -0
- package/dist/src/config/agentDefinitionMigration.js.map +1 -0
- package/dist/src/config/agentProfiles.d.ts +23 -0
- package/dist/src/config/agentProfiles.d.ts.map +1 -1
- package/dist/src/config/agentProfiles.js +69 -13
- package/dist/src/config/agentProfiles.js.map +1 -1
- package/dist/src/config/hadamardHome.js +0 -1
- package/dist/src/config/hadamardHome.js.map +1 -1
- package/dist/src/config/modelConfigurationCatalog.d.ts +25 -0
- package/dist/src/config/modelConfigurationCatalog.d.ts.map +1 -0
- package/dist/src/config/modelConfigurationCatalog.js +50 -0
- package/dist/src/config/modelConfigurationCatalog.js.map +1 -0
- package/dist/src/config/projectSettings.d.ts +62 -0
- package/dist/src/config/projectSettings.d.ts.map +1 -0
- package/dist/src/config/projectSettings.js +242 -0
- package/dist/src/config/projectSettings.js.map +1 -0
- package/dist/src/config/resolveRuntimeConfig.d.ts.map +1 -1
- package/dist/src/config/resolveRuntimeConfig.js +97 -4
- package/dist/src/config/resolveRuntimeConfig.js.map +1 -1
- package/dist/src/goal/goalCommandService.d.ts +11 -0
- package/dist/src/goal/goalCommandService.d.ts.map +1 -0
- package/dist/src/goal/goalCommandService.js +138 -0
- package/dist/src/goal/goalCommandService.js.map +1 -0
- package/dist/src/goal/goalContinuation.d.ts +50 -0
- package/dist/src/goal/goalContinuation.d.ts.map +1 -0
- package/dist/src/goal/goalContinuation.js +131 -0
- package/dist/src/goal/goalContinuation.js.map +1 -0
- package/dist/src/goal/goalController.d.ts +42 -0
- package/dist/src/goal/goalController.d.ts.map +1 -0
- package/dist/src/goal/goalController.js +281 -0
- package/dist/src/goal/goalController.js.map +1 -0
- package/dist/src/goal/goalPrompt.d.ts +3 -0
- package/dist/src/goal/goalPrompt.d.ts.map +1 -1
- package/dist/src/goal/goalPrompt.js +28 -2
- package/dist/src/goal/goalPrompt.js.map +1 -1
- package/dist/src/goal/goalService.d.ts +68 -2
- package/dist/src/goal/goalService.d.ts.map +1 -1
- package/dist/src/goal/goalService.js +500 -8
- package/dist/src/goal/goalService.js.map +1 -1
- package/dist/src/goal/goalStore.d.ts.map +1 -1
- package/dist/src/goal/goalStore.js +172 -5
- package/dist/src/goal/goalStore.js.map +1 -1
- package/dist/src/goal/goalTools.d.ts +2 -1
- package/dist/src/goal/goalTools.d.ts.map +1 -1
- package/dist/src/goal/goalTools.js +70 -5
- package/dist/src/goal/goalTools.js.map +1 -1
- package/dist/src/goal/goalWorkCoordinator.d.ts +43 -0
- package/dist/src/goal/goalWorkCoordinator.d.ts.map +1 -0
- package/dist/src/goal/goalWorkCoordinator.js +72 -0
- package/dist/src/goal/goalWorkCoordinator.js.map +1 -0
- package/dist/src/goal/index.d.ts +10 -4
- package/dist/src/goal/index.d.ts.map +1 -1
- package/dist/src/goal/index.js +7 -1
- package/dist/src/goal/index.js.map +1 -1
- package/dist/src/goal/projectGoalApi.d.ts +82 -0
- package/dist/src/goal/projectGoalApi.d.ts.map +1 -0
- package/dist/src/goal/projectGoalApi.js +287 -0
- package/dist/src/goal/projectGoalApi.js.map +1 -0
- package/dist/src/goal/projectGoalStore.d.ts +131 -0
- package/dist/src/goal/projectGoalStore.d.ts.map +1 -0
- package/dist/src/goal/projectGoalStore.js +808 -0
- package/dist/src/goal/projectGoalStore.js.map +1 -0
- package/dist/src/goal/types.d.ts +127 -3
- package/dist/src/goal/types.d.ts.map +1 -1
- package/dist/src/goal/types.js +2 -2
- package/dist/src/goal/types.js.map +1 -1
- package/dist/src/gui/agentTargetPicker.d.ts +32 -0
- package/dist/src/gui/agentTargetPicker.d.ts.map +1 -0
- package/dist/src/gui/agentTargetPicker.js +99 -0
- package/dist/src/gui/agentTargetPicker.js.map +1 -0
- package/dist/src/gui/electronMain.js +10 -3
- package/dist/src/gui/electronMain.js.map +1 -1
- package/dist/src/gui/hadamardGui.d.ts +24 -0
- package/dist/src/gui/hadamardGui.d.ts.map +1 -1
- package/dist/src/gui/hadamardGui.js +6321 -1327
- package/dist/src/gui/hadamardGui.js.map +1 -1
- package/dist/src/gui/projectWorkbench.d.ts +13 -2
- package/dist/src/gui/projectWorkbench.d.ts.map +1 -1
- package/dist/src/gui/projectWorkbench.js +109 -67
- package/dist/src/gui/projectWorkbench.js.map +1 -1
- package/dist/src/gui/promptTemplates.d.ts +18 -0
- package/dist/src/gui/promptTemplates.d.ts.map +1 -0
- package/dist/src/gui/promptTemplates.js +178 -0
- package/dist/src/gui/promptTemplates.js.map +1 -0
- package/dist/src/gui/terminalManager.d.ts +14 -0
- package/dist/src/gui/terminalManager.d.ts.map +1 -1
- package/dist/src/gui/terminalManager.js +25 -5
- package/dist/src/gui/terminalManager.js.map +1 -1
- package/dist/src/gui/transcript/clientBundle.d.ts +6 -1
- package/dist/src/gui/transcript/clientBundle.d.ts.map +1 -1
- package/dist/src/gui/transcript/clientBundle.js +6 -1
- package/dist/src/gui/transcript/clientBundle.js.map +1 -1
- package/dist/src/help/productCapabilities.d.ts +17 -0
- package/dist/src/help/productCapabilities.d.ts.map +1 -0
- package/dist/src/help/productCapabilities.js +146 -0
- package/dist/src/help/productCapabilities.js.map +1 -0
- package/dist/src/index.d.ts +21 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/issues/issueExecution.d.ts.map +1 -1
- package/dist/src/issues/issueExecution.js +29 -9
- package/dist/src/issues/issueExecution.js.map +1 -1
- package/dist/src/manager/assistantGlobalTools.d.ts +44 -0
- package/dist/src/manager/assistantGlobalTools.d.ts.map +1 -1
- package/dist/src/manager/assistantGlobalTools.js +565 -34
- package/dist/src/manager/assistantGlobalTools.js.map +1 -1
- package/dist/src/manager/assistantProposals.d.ts +87 -0
- package/dist/src/manager/assistantProposals.d.ts.map +1 -0
- package/dist/src/manager/assistantProposals.js +207 -0
- package/dist/src/manager/assistantProposals.js.map +1 -0
- package/dist/src/manager/referenceIndex.d.ts +82 -0
- package/dist/src/manager/referenceIndex.d.ts.map +1 -0
- package/dist/src/manager/referenceIndex.js +167 -0
- package/dist/src/manager/referenceIndex.js.map +1 -0
- package/dist/src/manager/referenceOperations.d.ts +108 -0
- package/dist/src/manager/referenceOperations.d.ts.map +1 -0
- package/dist/src/manager/referenceOperations.js +821 -0
- package/dist/src/manager/referenceOperations.js.map +1 -0
- package/dist/src/manager/resolveTargetRef.d.ts +67 -0
- package/dist/src/manager/resolveTargetRef.d.ts.map +1 -0
- package/dist/src/manager/resolveTargetRef.js +81 -0
- package/dist/src/manager/resolveTargetRef.js.map +1 -0
- package/dist/src/memory/durableMemoryPipeline.d.ts +51 -0
- package/dist/src/memory/durableMemoryPipeline.d.ts.map +1 -0
- package/dist/src/memory/durableMemoryPipeline.js +266 -0
- package/dist/src/memory/durableMemoryPipeline.js.map +1 -0
- package/dist/src/memory/durableMemoryStore.d.ts +59 -0
- package/dist/src/memory/durableMemoryStore.d.ts.map +1 -0
- package/dist/src/memory/durableMemoryStore.js +194 -0
- package/dist/src/memory/durableMemoryStore.js.map +1 -0
- package/dist/src/memory/hadamardDream.d.ts +18 -0
- package/dist/src/memory/hadamardDream.d.ts.map +1 -1
- package/dist/src/memory/hadamardDream.js +119 -39
- package/dist/src/memory/hadamardDream.js.map +1 -1
- package/dist/src/memory/hadamardMemory.d.ts +20 -39
- package/dist/src/memory/hadamardMemory.d.ts.map +1 -1
- package/dist/src/memory/hadamardMemory.js +112 -450
- package/dist/src/memory/hadamardMemory.js.map +1 -1
- package/dist/src/memory/hadamardSessionMemoryState.d.ts +2 -5
- package/dist/src/memory/hadamardSessionMemoryState.d.ts.map +1 -1
- package/dist/src/memory/hadamardSessionMemoryState.js +5 -61
- package/dist/src/memory/hadamardSessionMemoryState.js.map +1 -1
- package/dist/src/memory/memoryCommandService.d.ts +25 -0
- package/dist/src/memory/memoryCommandService.d.ts.map +1 -0
- package/dist/src/memory/memoryCommandService.js +93 -0
- package/dist/src/memory/memoryCommandService.js.map +1 -0
- package/dist/src/memory/memoryProposalCommandService.d.ts.map +1 -1
- package/dist/src/memory/memoryProposalCommandService.js +2 -1
- package/dist/src/memory/memoryProposalCommandService.js.map +1 -1
- package/dist/src/memory/memoryProposalTools.d.ts +1 -0
- package/dist/src/memory/memoryProposalTools.d.ts.map +1 -1
- package/dist/src/memory/memoryProposalTools.js +16 -11
- package/dist/src/memory/memoryProposalTools.js.map +1 -1
- package/dist/src/parity/bridgeConfigs.d.ts +4 -0
- package/dist/src/parity/bridgeConfigs.d.ts.map +1 -1
- package/dist/src/parity/bridgeConfigs.js +30 -1
- package/dist/src/parity/bridgeConfigs.js.map +1 -1
- package/dist/src/router/modelRouter.d.ts +22 -2
- package/dist/src/router/modelRouter.d.ts.map +1 -1
- package/dist/src/router/modelRouter.js +76 -9
- package/dist/src/router/modelRouter.js.map +1 -1
- package/dist/src/runtime/agentClient.d.ts +24 -4
- package/dist/src/runtime/agentClient.d.ts.map +1 -1
- package/dist/src/runtime/agentClient.js +581 -262
- package/dist/src/runtime/agentClient.js.map +1 -1
- package/dist/src/runtime/agentSession.d.ts +8 -3
- package/dist/src/runtime/agentSession.d.ts.map +1 -1
- package/dist/src/runtime/agentSession.js +10 -3
- package/dist/src/runtime/agentSession.js.map +1 -1
- package/dist/src/runtime/agentTemplates.d.ts +28 -0
- package/dist/src/runtime/agentTemplates.d.ts.map +1 -0
- package/dist/src/runtime/agentTemplates.js +73 -0
- package/dist/src/runtime/agentTemplates.js.map +1 -0
- package/dist/src/runtime/conversationEngine.d.ts +4 -0
- package/dist/src/runtime/conversationEngine.d.ts.map +1 -1
- package/dist/src/runtime/conversationEngine.js +52 -3
- package/dist/src/runtime/conversationEngine.js.map +1 -1
- package/dist/src/runtime/defaultHadamardAgents.d.ts.map +1 -1
- package/dist/src/runtime/defaultHadamardAgents.js +9 -47
- package/dist/src/runtime/defaultHadamardAgents.js.map +1 -1
- package/dist/src/runtime/effectiveAgentRunOptions.d.ts +49 -0
- package/dist/src/runtime/effectiveAgentRunOptions.d.ts.map +1 -0
- package/dist/src/runtime/effectiveAgentRunOptions.js +50 -0
- package/dist/src/runtime/effectiveAgentRunOptions.js.map +1 -0
- package/dist/src/runtime/externalAgentRunner.d.ts +25 -0
- package/dist/src/runtime/externalAgentRunner.d.ts.map +1 -0
- package/dist/src/runtime/externalAgentRunner.js +57 -0
- package/dist/src/runtime/externalAgentRunner.js.map +1 -0
- package/dist/src/runtime/hadamardAgentDefinitions.d.ts +15 -0
- package/dist/src/runtime/hadamardAgentDefinitions.d.ts.map +1 -1
- package/dist/src/runtime/hadamardAgentDefinitions.js +42 -2
- package/dist/src/runtime/hadamardAgentDefinitions.js.map +1 -1
- package/dist/src/runtime/hadamardAgents.d.ts +6 -0
- package/dist/src/runtime/hadamardAgents.d.ts.map +1 -1
- package/dist/src/runtime/hadamardAgents.js +52 -1
- package/dist/src/runtime/hadamardAgents.js.map +1 -1
- package/dist/src/runtime/hadamardCompact.d.ts +12 -1
- package/dist/src/runtime/hadamardCompact.d.ts.map +1 -1
- package/dist/src/runtime/hadamardCompact.js +91 -35
- package/dist/src/runtime/hadamardCompact.js.map +1 -1
- package/dist/src/runtime/hadamardPermissions.d.ts +1 -0
- package/dist/src/runtime/hadamardPermissions.d.ts.map +1 -1
- package/dist/src/runtime/hadamardPermissions.js +6 -0
- package/dist/src/runtime/hadamardPermissions.js.map +1 -1
- package/dist/src/runtime/hadamardSlashCommands.d.ts +7 -1
- package/dist/src/runtime/hadamardSlashCommands.d.ts.map +1 -1
- package/dist/src/runtime/hadamardSlashCommands.js +47 -5
- package/dist/src/runtime/hadamardSlashCommands.js.map +1 -1
- package/dist/src/runtime/tools.d.ts.map +1 -1
- package/dist/src/runtime/tools.js +2 -0
- package/dist/src/runtime/tools.js.map +1 -1
- package/dist/src/team/executorTarget.d.ts +26 -0
- package/dist/src/team/executorTarget.d.ts.map +1 -0
- package/dist/src/team/executorTarget.js +15 -0
- package/dist/src/team/executorTarget.js.map +1 -0
- package/dist/src/team/modelTeam.d.ts +5 -1
- package/dist/src/team/modelTeam.d.ts.map +1 -1
- package/dist/src/team/modelTeam.js +157 -41
- package/dist/src/team/modelTeam.js.map +1 -1
- package/dist/src/team/teamComposition.d.ts +20 -0
- package/dist/src/team/teamComposition.d.ts.map +1 -0
- package/dist/src/team/teamComposition.js +78 -0
- package/dist/src/team/teamComposition.js.map +1 -0
- package/dist/src/team/teamDefinitions.d.ts +10 -1
- package/dist/src/team/teamDefinitions.d.ts.map +1 -1
- package/dist/src/team/teamDefinitions.js +123 -16
- package/dist/src/team/teamDefinitions.js.map +1 -1
- package/dist/src/team/teamGraph.d.ts +1 -1
- package/dist/src/team/teamGraph.d.ts.map +1 -1
- package/dist/src/team/teamGraph.js +1 -1
- package/dist/src/team/teamGraph.js.map +1 -1
- package/dist/src/team/teamPrompts.d.ts.map +1 -1
- package/dist/src/team/teamPrompts.js +0 -4
- package/dist/src/team/teamPrompts.js.map +1 -1
- package/dist/src/team/teamProposalService.d.ts +9 -1
- package/dist/src/team/teamProposalService.d.ts.map +1 -1
- package/dist/src/team/teamProposalService.js +66 -6
- package/dist/src/team/teamProposalService.js.map +1 -1
- package/dist/src/team/teamPropose.d.ts +3 -1
- package/dist/src/team/teamPropose.d.ts.map +1 -1
- package/dist/src/team/teamPropose.js +16 -10
- package/dist/src/team/teamPropose.js.map +1 -1
- package/dist/src/team/teamRuntime.d.ts +5 -0
- package/dist/src/team/teamRuntime.d.ts.map +1 -1
- package/dist/src/team/teamRuntime.js +23 -5
- package/dist/src/team/teamRuntime.js.map +1 -1
- package/dist/src/team/workflowSquad.d.ts +10 -2
- package/dist/src/team/workflowSquad.d.ts.map +1 -1
- package/dist/src/team/workflowSquad.js +250 -12
- package/dist/src/team/workflowSquad.js.map +1 -1
- package/dist/src/tools/enterWorktree.d.ts.map +1 -1
- package/dist/src/tools/enterWorktree.js +3 -0
- package/dist/src/tools/enterWorktree.js.map +1 -1
- package/dist/src/tools/exaSearch.d.ts +2 -2
- package/dist/src/tools/exitWorktree.d.ts.map +1 -1
- package/dist/src/tools/exitWorktree.js +3 -1
- package/dist/src/tools/exitWorktree.js.map +1 -1
- package/dist/src/tools/hadamardCoreTools.d.ts +5 -14
- package/dist/src/tools/hadamardCoreTools.d.ts.map +1 -1
- package/dist/src/tools/hadamardCoreTools.js +31 -0
- package/dist/src/tools/hadamardCoreTools.js.map +1 -1
- package/dist/src/tools/hadamardFileTools.d.ts.map +1 -1
- package/dist/src/tools/hadamardFileTools.js +116 -38
- package/dist/src/tools/hadamardFileTools.js.map +1 -1
- package/dist/src/tools/planMode/PlanModeTools.d.ts +22 -0
- package/dist/src/tools/planMode/PlanModeTools.d.ts.map +1 -1
- package/dist/src/tools/planMode/PlanModeTools.js +102 -5
- package/dist/src/tools/planMode/PlanModeTools.js.map +1 -1
- package/dist/src/tools/todo/TodoWriteTool.d.ts +1 -1
- package/dist/src/tui/hadamardTui.d.ts.map +1 -1
- package/dist/src/tui/hadamardTui.js +387 -168
- package/dist/src/tui/hadamardTui.js.map +1 -1
- package/dist/src/tui/pendingInput.d.ts +17 -0
- package/dist/src/tui/pendingInput.d.ts.map +1 -0
- package/dist/src/tui/pendingInput.js +23 -0
- package/dist/src/tui/pendingInput.js.map +1 -0
- package/dist/src/tui/reasoningDisplay.d.ts +13 -0
- package/dist/src/tui/reasoningDisplay.d.ts.map +1 -0
- package/dist/src/tui/reasoningDisplay.js +45 -0
- package/dist/src/tui/reasoningDisplay.js.map +1 -0
- package/dist/src/tui/screen.d.ts +11 -1
- package/dist/src/tui/screen.d.ts.map +1 -1
- package/dist/src/tui/screen.js +64 -34
- package/dist/src/tui/screen.js.map +1 -1
- package/dist/src/types.d.ts +210 -77
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/ui/commandSurface.d.ts +8 -0
- package/dist/src/ui/commandSurface.d.ts.map +1 -1
- package/dist/src/ui/commandSurface.js +78 -13
- package/dist/src/ui/commandSurface.js.map +1 -1
- package/dist/src/update/appUpdateService.d.ts +34 -1
- package/dist/src/update/appUpdateService.d.ts.map +1 -1
- package/dist/src/update/appUpdateService.js +114 -9
- package/dist/src/update/appUpdateService.js.map +1 -1
- package/package.json +3 -2
- package/dist/src/prompts/outputStyles.d.ts +0 -20
- package/dist/src/prompts/outputStyles.d.ts.map +0 -1
- package/dist/src/prompts/outputStyles.js +0 -35
- package/dist/src/prompts/outputStyles.js.map +0 -1
package/dist/src/goal/index.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Goal runtime contract - public exports.
|
|
3
3
|
*
|
|
4
|
-
* A Goal is a
|
|
4
|
+
* A Goal is a project-scoped execution contract: objective, status, budget,
|
|
5
5
|
* progress evidence, and a blocked audit. `GoalService` is the single
|
|
6
6
|
* authority over lifecycle; the runtime injects `buildGoalPrompt` each turn;
|
|
7
7
|
* `createGoalTools` exposes GetGoal/CreateGoal/UpdateGoal to the agent.
|
|
8
8
|
*/
|
|
9
|
-
export type { Goal, GoalBlockAudit, GoalBudget, GoalEvidence, GoalMutationResult, GoalStatus, } from './types.js';
|
|
9
|
+
export type { Goal, GoalBlockAudit, GoalBudget, GoalBudgetConsumption, GoalDeliveryConsumption, GoalCompletionRequest, GoalEvidence, GoalMutationResult, GoalStatus, GoalTurnOutcome, GoalTurnReceipt, GoalWorkItem, GoalWorkItemClass, GoalWorkItemPriority, GoalWorkItemRole, GoalWorkItemStatus, GoalWorkItemUpdateRequest, GoalReplanAudit, GoalWorkClaim, GoalHandoffReceipt, } from './types.js';
|
|
10
10
|
export { GOAL_SCHEMA_VERSION } from './types.js';
|
|
11
11
|
export { AgentSessionGoalPort, GOAL_METADATA_KEY, StoredSessionGoalPort, type GoalSessionPort, type GoalStorePort, normalizeGoal, readGoal, writeGoal, } from './goalStore.js';
|
|
12
|
-
export { GoalService, type BlockGoalInput, type CreateGoalInput, type GoalClock, type GoalServiceOptions, type GoalTransitionResult, type ProgressGoalInput, goalStatusMark, } from './goalService.js';
|
|
12
|
+
export { GoalService, type BlockGoalInput, type CreateGoalInput, type GoalClock, type GoalServiceOptions, type GoalTransitionResult, type ProgressGoalInput, type PlanGoalInput, type PlanGoalItemInput, type RequestGoalWorkItemUpdateInput, type SettleGoalTurnInput, goalStatusMark, } from './goalService.js';
|
|
13
13
|
export { buildGoalPrompt, type GoalPromptOptions } from './goalPrompt.js';
|
|
14
|
-
export { CREATE_GOAL_TOOL_NAME, GET_GOAL_TOOL_NAME, GOAL_TOOLS_PROMPT, UPDATE_GOAL_TOOL_NAME, createGoalTools, type GoalToolContext, } from './goalTools.js';
|
|
14
|
+
export { CREATE_GOAL_TOOL_NAME, GET_GOAL_TOOL_NAME, GOAL_TOOLS_PROMPT, UPDATE_GOAL_TOOL_NAME, PLAN_GOAL_TOOL_NAME, createGoalTools, type GoalToolContext, } from './goalTools.js';
|
|
15
|
+
export { GoalExecutionBlockedError, decideGoalExecution, settleGoalRun, settleGoalRunFailure, isExploratoryTool, type GoalExecutionDecision, type DecideGoalExecutionOptions, } from './goalController.js';
|
|
16
|
+
export { executeGoalCommand, type GoalCommandResult, } from './goalCommandService.js';
|
|
17
|
+
export { ProjectGoalStore, PROJECT_GOAL_DATABASE, type ProjectGoalEvent, type ProjectGoalSummary, type GoalContinuationMode, type GoalContinuationProfileRef, type GoalContinuationState, } from './projectGoalStore.js';
|
|
18
|
+
export { ProjectGoalApi, type GoalSessionIdentity, type ProjectGoalStatus, } from './projectGoalApi.js';
|
|
19
|
+
export { GoalContinuationService, type GoalContinuationExecutor, type GoalContinuationExecutorInput, type GoalContinuationRunResult, type GoalWakeDecision, } from './goalContinuation.js';
|
|
20
|
+
export { GoalWorkCoordinator, type GoalWorkerIdentity, type GoalWorkerOutcome, type GoalWorkerRunResult, } from './goalWorkCoordinator.js';
|
|
15
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/goal/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,YAAY,EACV,IAAI,EACJ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/goal/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,YAAY,EACV,IAAI,EACJ,cAAc,EACd,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,aAAa,EACb,QAAQ,EACR,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAC"}
|
package/dist/src/goal/index.js
CHANGED
|
@@ -2,5 +2,11 @@ export { GOAL_SCHEMA_VERSION } from './types.js';
|
|
|
2
2
|
export { AgentSessionGoalPort, GOAL_METADATA_KEY, StoredSessionGoalPort, normalizeGoal, readGoal, writeGoal, } from './goalStore.js';
|
|
3
3
|
export { GoalService, goalStatusMark, } from './goalService.js';
|
|
4
4
|
export { buildGoalPrompt } from './goalPrompt.js';
|
|
5
|
-
export { CREATE_GOAL_TOOL_NAME, GET_GOAL_TOOL_NAME, GOAL_TOOLS_PROMPT, UPDATE_GOAL_TOOL_NAME, createGoalTools, } from './goalTools.js';
|
|
5
|
+
export { CREATE_GOAL_TOOL_NAME, GET_GOAL_TOOL_NAME, GOAL_TOOLS_PROMPT, UPDATE_GOAL_TOOL_NAME, PLAN_GOAL_TOOL_NAME, createGoalTools, } from './goalTools.js';
|
|
6
|
+
export { GoalExecutionBlockedError, decideGoalExecution, settleGoalRun, settleGoalRunFailure, isExploratoryTool, } from './goalController.js';
|
|
7
|
+
export { executeGoalCommand, } from './goalCommandService.js';
|
|
8
|
+
export { ProjectGoalStore, PROJECT_GOAL_DATABASE, } from './projectGoalStore.js';
|
|
9
|
+
export { ProjectGoalApi, } from './projectGoalApi.js';
|
|
10
|
+
export { GoalContinuationService, } from './goalContinuation.js';
|
|
11
|
+
export { GoalWorkCoordinator, } from './goalWorkCoordinator.js';
|
|
6
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/goal/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/goal/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EAGrB,aAAa,EACb,QAAQ,EACR,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EAWX,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAA0B,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,GAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GAMtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,GAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uBAAuB,GAKxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,GAIpB,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type GoalCommandResult } from './goalCommandService.js';
|
|
2
|
+
import { AgentPool } from '../team/agentPool.js';
|
|
3
|
+
import { type GoalContinuationExecutor, type GoalContinuationRunResult } from './goalContinuation.js';
|
|
4
|
+
import { GoalService } from './goalService.js';
|
|
5
|
+
import { type ProjectGoalEvent, type ProjectGoalSummary, type GoalContinuationMode, type GoalContinuationProfileRef, type GoalContinuationState } from './projectGoalStore.js';
|
|
6
|
+
import type { Goal, GoalBudget, GoalEvidence } from './types.js';
|
|
7
|
+
import type { GoalHandoffReceipt, GoalWorkClaim } from './types.js';
|
|
8
|
+
import { type GoalWorkerIdentity, type GoalWorkerOutcome, type GoalWorkerRunResult } from './goalWorkCoordinator.js';
|
|
9
|
+
export interface GoalSessionIdentity {
|
|
10
|
+
id: string;
|
|
11
|
+
metadata: Record<string, unknown>;
|
|
12
|
+
mergeMetadata?(metadata: Record<string, unknown>): Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface ProjectGoalStatus {
|
|
15
|
+
goalId?: string;
|
|
16
|
+
goal: Goal | null;
|
|
17
|
+
evidence: GoalEvidence[];
|
|
18
|
+
budget?: GoalBudget;
|
|
19
|
+
}
|
|
20
|
+
/** Shared SDK/UI facade over the canonical project Goal database. */
|
|
21
|
+
export declare class ProjectGoalApi {
|
|
22
|
+
private readonly storePromise;
|
|
23
|
+
private resolvedStore?;
|
|
24
|
+
private closed;
|
|
25
|
+
private readonly continuationExecutor?;
|
|
26
|
+
private readonly timers;
|
|
27
|
+
private readonly agentPool;
|
|
28
|
+
constructor(projectStateDirectory: string, options?: {
|
|
29
|
+
continuationExecutor?: GoalContinuationExecutor;
|
|
30
|
+
agentPool?: AgentPool;
|
|
31
|
+
});
|
|
32
|
+
/** Synchronous UI cache read after the project database has been opened. */
|
|
33
|
+
peek(sessionId?: string): Goal | null;
|
|
34
|
+
serviceForSession(session: GoalSessionIdentity, options?: {
|
|
35
|
+
forceNew?: boolean;
|
|
36
|
+
}): Promise<GoalService>;
|
|
37
|
+
command(session: GoalSessionIdentity, rawArgs: string): Promise<GoalCommandResult>;
|
|
38
|
+
status(sessionId?: string): Promise<ProjectGoalStatus>;
|
|
39
|
+
list(options?: {
|
|
40
|
+
includeArchived?: boolean;
|
|
41
|
+
limit?: number;
|
|
42
|
+
}): Promise<ProjectGoalSummary[]>;
|
|
43
|
+
history(goalId: string, limit?: number): Promise<ProjectGoalEvent[]>;
|
|
44
|
+
attach(sessionId: string, goalId: string): Promise<void>;
|
|
45
|
+
continuationStatus(sessionId?: string): Promise<GoalContinuationState | undefined>;
|
|
46
|
+
claimWork(sessionId: string, worker: GoalWorkerIdentity, leaseMs?: number): Promise<GoalWorkClaim | undefined>;
|
|
47
|
+
/** Claim a specific frontier item for the main session agent (prevents double-run). */
|
|
48
|
+
claimWorkItem(sessionId: string, workItemId: string, options?: {
|
|
49
|
+
agentId?: string;
|
|
50
|
+
leaseMs?: number;
|
|
51
|
+
}): Promise<GoalWorkClaim | undefined>;
|
|
52
|
+
releaseWorkClaim(claimToken: string, reason?: string): Promise<boolean>;
|
|
53
|
+
completeWorkClaim(claimToken: string, evidenceRefs: string[]): Promise<boolean>;
|
|
54
|
+
workClaims(sessionId?: string): Promise<GoalWorkClaim[]>;
|
|
55
|
+
handoffs(sessionId?: string): Promise<GoalHandoffReceipt[]>;
|
|
56
|
+
runWorkers(input: {
|
|
57
|
+
sessionId: string;
|
|
58
|
+
workers: GoalWorkerIdentity[];
|
|
59
|
+
leaseMs?: number;
|
|
60
|
+
acquireTimeoutMs?: number;
|
|
61
|
+
run: (claim: GoalWorkClaim, worker: GoalWorkerIdentity) => Promise<GoalWorkerOutcome>;
|
|
62
|
+
}): Promise<GoalWorkerRunResult[]>;
|
|
63
|
+
configureContinuation(input: {
|
|
64
|
+
sessionId: string;
|
|
65
|
+
mode: GoalContinuationMode;
|
|
66
|
+
executionProfile?: GoalContinuationProfileRef;
|
|
67
|
+
minIntervalSeconds?: number;
|
|
68
|
+
maxIntervalSeconds?: number;
|
|
69
|
+
}): Promise<GoalContinuationState>;
|
|
70
|
+
runContinuation(sessionId: string, options?: {
|
|
71
|
+
force?: boolean;
|
|
72
|
+
mode?: GoalContinuationMode;
|
|
73
|
+
signal?: AbortSignal;
|
|
74
|
+
}): Promise<GoalContinuationRunResult>;
|
|
75
|
+
detach(sessionId: string): Promise<void>;
|
|
76
|
+
close(): Promise<void>;
|
|
77
|
+
private store;
|
|
78
|
+
private configureContinuationCommand;
|
|
79
|
+
private schedule;
|
|
80
|
+
private clearTimer;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=projectGoalApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectGoalApi.d.ts","sourceRoot":"","sources":["../../../src/goal/projectGoalApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC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.js';
|
|
2
|
+
import { AgentPool } from '../team/agentPool.js';
|
|
3
|
+
import { decideGoalExecution } from './goalController.js';
|
|
4
|
+
import { GoalContinuationService, } from './goalContinuation.js';
|
|
5
|
+
import { GoalService } from './goalService.js';
|
|
6
|
+
import { GOAL_METADATA_KEY } from './goalStore.js';
|
|
7
|
+
import { ProjectGoalStore, } from './projectGoalStore.js';
|
|
8
|
+
import { GoalWorkCoordinator, } from './goalWorkCoordinator.js';
|
|
9
|
+
/** Shared SDK/UI facade over the canonical project Goal database. */
|
|
10
|
+
export class ProjectGoalApi {
|
|
11
|
+
storePromise;
|
|
12
|
+
resolvedStore;
|
|
13
|
+
closed = false;
|
|
14
|
+
continuationExecutor;
|
|
15
|
+
timers = new Map();
|
|
16
|
+
agentPool;
|
|
17
|
+
constructor(projectStateDirectory, options = {}) {
|
|
18
|
+
this.continuationExecutor = options.continuationExecutor;
|
|
19
|
+
this.agentPool = options.agentPool ?? new AgentPool();
|
|
20
|
+
this.storePromise = ProjectGoalStore.open(projectStateDirectory).then(store => {
|
|
21
|
+
this.resolvedStore = store;
|
|
22
|
+
if (this.continuationExecutor) {
|
|
23
|
+
for (const state of store.listScheduledContinuations())
|
|
24
|
+
this.schedule(state);
|
|
25
|
+
}
|
|
26
|
+
return store;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Synchronous UI cache read after the project database has been opened. */
|
|
30
|
+
peek(sessionId) {
|
|
31
|
+
if (!this.resolvedStore)
|
|
32
|
+
return null;
|
|
33
|
+
if (sessionId)
|
|
34
|
+
return this.resolvedStore.readForSession(sessionId)?.goal ?? null;
|
|
35
|
+
const goalId = this.resolvedStore.currentGoalId();
|
|
36
|
+
return goalId ? this.resolvedStore.readSnapshot(goalId) : null;
|
|
37
|
+
}
|
|
38
|
+
async serviceForSession(session, options = {}) {
|
|
39
|
+
const store = await this.store();
|
|
40
|
+
if (!options.forceNew && session.metadata[GOAL_METADATA_KEY] !== undefined) {
|
|
41
|
+
const imported = store.importLegacyGoal(session.id, session.metadata[GOAL_METADATA_KEY]);
|
|
42
|
+
if (imported && session.mergeMetadata) {
|
|
43
|
+
await session.mergeMetadata({ [GOAL_METADATA_KEY]: undefined });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return new GoalService({ port: store.portForSession(session.id, options) });
|
|
47
|
+
}
|
|
48
|
+
async command(session, rawArgs) {
|
|
49
|
+
const command = rawArgs.trim().split(/\s+/u)[0]?.toLowerCase() ?? '';
|
|
50
|
+
if (command === 'schedule')
|
|
51
|
+
return this.configureContinuationCommand(session, rawArgs);
|
|
52
|
+
if (command === 'run' && this.continuationExecutor) {
|
|
53
|
+
const status = await this.status(session.id);
|
|
54
|
+
if (!status.goalId || !status.goal) {
|
|
55
|
+
return { ok: false, changed: false, message: 'no goal set — use /goal start <objective>', goal: null };
|
|
56
|
+
}
|
|
57
|
+
const run = await this.runContinuation(session.id, { force: true });
|
|
58
|
+
return {
|
|
59
|
+
ok: run.started,
|
|
60
|
+
changed: run.started,
|
|
61
|
+
message: `goal continuation: ${run.turns} turn(s) · ${run.reason}`,
|
|
62
|
+
goal: run.goal,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// A bare objective updates the session's current goal in place so the
|
|
66
|
+
// objective can be edited mid-run; `start` remains the explicit new-goal path.
|
|
67
|
+
const forceNew = command === 'start';
|
|
68
|
+
const result = await executeGoalCommand(await this.serviceForSession(session, { forceNew }), rawArgs);
|
|
69
|
+
if (command === 'answer' && result.ok) {
|
|
70
|
+
const continuation = await this.continuationStatus(session.id);
|
|
71
|
+
if (continuation?.mode === 'scheduled')
|
|
72
|
+
this.schedule(continuation);
|
|
73
|
+
}
|
|
74
|
+
if (command === 'status' || command === '') {
|
|
75
|
+
const [continuation, claims, handoffs] = await Promise.all([
|
|
76
|
+
this.continuationStatus(session.id),
|
|
77
|
+
this.workClaims(session.id),
|
|
78
|
+
this.handoffs(session.id),
|
|
79
|
+
]);
|
|
80
|
+
return {
|
|
81
|
+
...result,
|
|
82
|
+
message: [
|
|
83
|
+
result.message,
|
|
84
|
+
continuation
|
|
85
|
+
? `continuation ${continuation.mode} · interval ${continuation.currentIntervalSeconds}s${continuation.nextWakeAt ? ` · next ${continuation.nextWakeAt}` : ''}${continuation.leaseOwner ? ` · leased by ${continuation.leaseOwner}` : ''}`
|
|
86
|
+
: 'continuation manual · not configured',
|
|
87
|
+
claims.length > 0
|
|
88
|
+
? `claims ${claims.map(claim => `${claim.workItemId}→${claim.agentId}`).join(', ')}`
|
|
89
|
+
: 'claims none',
|
|
90
|
+
handoffs.length > 0 ? `handoffs ${handoffs.length}` : 'handoffs none',
|
|
91
|
+
].join('\n'),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
async status(sessionId) {
|
|
97
|
+
const store = await this.store();
|
|
98
|
+
const record = sessionId
|
|
99
|
+
? store.readForSession(sessionId)
|
|
100
|
+
: (() => {
|
|
101
|
+
const goalId = store.currentGoalId();
|
|
102
|
+
const goal = goalId ? store.readSnapshot(goalId) : null;
|
|
103
|
+
return goalId && goal ? { id: goalId, goal } : undefined;
|
|
104
|
+
})();
|
|
105
|
+
return {
|
|
106
|
+
...(record ? { goalId: record.id } : {}),
|
|
107
|
+
goal: record?.goal ?? null,
|
|
108
|
+
evidence: record?.goal.evidence ?? [],
|
|
109
|
+
...(record?.goal.budget ? { budget: record.goal.budget } : {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async list(options = {}) {
|
|
113
|
+
return (await this.store()).listGoals(options);
|
|
114
|
+
}
|
|
115
|
+
async history(goalId, limit = 100) {
|
|
116
|
+
return (await this.store()).history(goalId, limit);
|
|
117
|
+
}
|
|
118
|
+
async attach(sessionId, goalId) {
|
|
119
|
+
const store = await this.store();
|
|
120
|
+
if (!store.readSnapshot(goalId))
|
|
121
|
+
throw new Error(`Unknown or archived Goal: ${goalId}`);
|
|
122
|
+
store.attachSession(sessionId, goalId);
|
|
123
|
+
}
|
|
124
|
+
async continuationStatus(sessionId) {
|
|
125
|
+
const status = await this.status(sessionId);
|
|
126
|
+
return status.goalId ? (await this.store()).continuationState(status.goalId) : undefined;
|
|
127
|
+
}
|
|
128
|
+
async claimWork(sessionId, worker, leaseMs) {
|
|
129
|
+
const store = await this.store();
|
|
130
|
+
const record = store.readForSession(sessionId);
|
|
131
|
+
if (!record)
|
|
132
|
+
return undefined;
|
|
133
|
+
return new GoalWorkCoordinator(store, this.agentPool).claim(record.id, worker, leaseMs);
|
|
134
|
+
}
|
|
135
|
+
/** Claim a specific frontier item for the main session agent (prevents double-run). */
|
|
136
|
+
async claimWorkItem(sessionId, workItemId, options = {}) {
|
|
137
|
+
const store = await this.store();
|
|
138
|
+
const record = store.readForSession(sessionId);
|
|
139
|
+
if (!record)
|
|
140
|
+
return undefined;
|
|
141
|
+
const claim = store.claimWorkItem({
|
|
142
|
+
goalId: record.id,
|
|
143
|
+
workItemId,
|
|
144
|
+
agentId: options.agentId ?? sessionId,
|
|
145
|
+
...(options.leaseMs !== undefined ? { leaseMs: options.leaseMs } : {}),
|
|
146
|
+
});
|
|
147
|
+
if (claim)
|
|
148
|
+
store.markClaimRunning(claim.claimToken);
|
|
149
|
+
return claim;
|
|
150
|
+
}
|
|
151
|
+
async releaseWorkClaim(claimToken, reason = 'released') {
|
|
152
|
+
return (await this.store()).releaseWorkClaim(claimToken, reason);
|
|
153
|
+
}
|
|
154
|
+
async completeWorkClaim(claimToken, evidenceRefs) {
|
|
155
|
+
return (await this.store()).completeWorkClaim(claimToken, evidenceRefs);
|
|
156
|
+
}
|
|
157
|
+
async workClaims(sessionId) {
|
|
158
|
+
const status = await this.status(sessionId);
|
|
159
|
+
return status.goalId ? (await this.store()).listWorkClaims(status.goalId) : [];
|
|
160
|
+
}
|
|
161
|
+
async handoffs(sessionId) {
|
|
162
|
+
const status = await this.status(sessionId);
|
|
163
|
+
return status.goalId ? (await this.store()).listHandoffs(status.goalId) : [];
|
|
164
|
+
}
|
|
165
|
+
async runWorkers(input) {
|
|
166
|
+
const store = await this.store();
|
|
167
|
+
const record = store.readForSession(input.sessionId);
|
|
168
|
+
if (!record)
|
|
169
|
+
return input.workers.map(worker => ({ worker, skipped: true }));
|
|
170
|
+
return new GoalWorkCoordinator(store, this.agentPool).runWorkers({
|
|
171
|
+
goalId: record.id,
|
|
172
|
+
workers: input.workers,
|
|
173
|
+
...(input.leaseMs !== undefined ? { leaseMs: input.leaseMs } : {}),
|
|
174
|
+
...(input.acquireTimeoutMs !== undefined ? { acquireTimeoutMs: input.acquireTimeoutMs } : {}),
|
|
175
|
+
run: input.run,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async configureContinuation(input) {
|
|
179
|
+
const store = await this.store();
|
|
180
|
+
const record = store.readForSession(input.sessionId);
|
|
181
|
+
if (!record)
|
|
182
|
+
throw new Error('No project Goal is attached to this session.');
|
|
183
|
+
const state = store.configureContinuation({
|
|
184
|
+
goalId: record.id,
|
|
185
|
+
mode: input.mode,
|
|
186
|
+
...(input.executionProfile ? { executionProfile: input.executionProfile } : {}),
|
|
187
|
+
...(input.minIntervalSeconds !== undefined ? { minIntervalSeconds: input.minIntervalSeconds } : {}),
|
|
188
|
+
...(input.maxIntervalSeconds !== undefined ? { maxIntervalSeconds: input.maxIntervalSeconds } : {}),
|
|
189
|
+
});
|
|
190
|
+
this.clearTimer(record.id);
|
|
191
|
+
if (state.mode === 'scheduled' && this.continuationExecutor)
|
|
192
|
+
this.schedule(state);
|
|
193
|
+
return state;
|
|
194
|
+
}
|
|
195
|
+
async runContinuation(sessionId, options = {}) {
|
|
196
|
+
if (!this.continuationExecutor)
|
|
197
|
+
throw new Error('Goal continuation executor is unavailable.');
|
|
198
|
+
const store = await this.store();
|
|
199
|
+
const record = store.readForSession(sessionId);
|
|
200
|
+
if (!record) {
|
|
201
|
+
return { started: false, turns: 0, reason: 'No project Goal is attached.', goal: null };
|
|
202
|
+
}
|
|
203
|
+
let continuation = store.continuationState(record.id);
|
|
204
|
+
if (!continuation) {
|
|
205
|
+
continuation = store.configureContinuation({ goalId: record.id, mode: options.mode ?? 'manual' });
|
|
206
|
+
}
|
|
207
|
+
const result = await new GoalContinuationService(store, this.continuationExecutor).run({
|
|
208
|
+
goalId: record.id,
|
|
209
|
+
...(options.mode ? { mode: options.mode } : {}),
|
|
210
|
+
...(options.force !== undefined ? { force: options.force } : {}),
|
|
211
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
212
|
+
});
|
|
213
|
+
if (result.continuation?.mode === 'scheduled')
|
|
214
|
+
this.schedule(result.continuation);
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
async detach(sessionId) {
|
|
218
|
+
(await this.store()).detachSession(sessionId);
|
|
219
|
+
}
|
|
220
|
+
async close() {
|
|
221
|
+
if (this.closed)
|
|
222
|
+
return;
|
|
223
|
+
this.closed = true;
|
|
224
|
+
for (const timer of this.timers.values())
|
|
225
|
+
clearTimeout(timer);
|
|
226
|
+
this.timers.clear();
|
|
227
|
+
(await this.storePromise).close();
|
|
228
|
+
}
|
|
229
|
+
async store() {
|
|
230
|
+
if (this.closed)
|
|
231
|
+
throw new Error('Project Goal API is closed.');
|
|
232
|
+
return this.storePromise;
|
|
233
|
+
}
|
|
234
|
+
async configureContinuationCommand(session, rawArgs) {
|
|
235
|
+
const [, modeValue = '', minValue = '', maxValue = ''] = rawArgs.trim().split(/\s+/u);
|
|
236
|
+
if (!['manual', 'foreground', 'scheduled'].includes(modeValue)) {
|
|
237
|
+
return {
|
|
238
|
+
ok: false,
|
|
239
|
+
changed: false,
|
|
240
|
+
message: 'usage: /goal schedule <manual|foreground|scheduled> [min-seconds] [max-seconds]',
|
|
241
|
+
goal: (await this.status(session.id)).goal,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const state = await this.configureContinuation({
|
|
245
|
+
sessionId: session.id,
|
|
246
|
+
mode: modeValue,
|
|
247
|
+
...(Number(minValue) > 0 ? { minIntervalSeconds: Number(minValue) } : {}),
|
|
248
|
+
...(Number(maxValue) > 0 ? { maxIntervalSeconds: Number(maxValue) } : {}),
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
ok: true,
|
|
252
|
+
changed: true,
|
|
253
|
+
message: `goal continuation: ${state.mode} · ${state.currentIntervalSeconds}s${state.nextWakeAt ? ` · next ${state.nextWakeAt}` : ''}`,
|
|
254
|
+
goal: (await this.status(session.id)).goal,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
schedule(state) {
|
|
258
|
+
this.clearTimer(state.goalId);
|
|
259
|
+
if (this.closed || state.mode !== 'scheduled' || !state.sessionId || !state.nextWakeAt)
|
|
260
|
+
return;
|
|
261
|
+
const goal = this.resolvedStore?.readSnapshot(state.goalId);
|
|
262
|
+
if (!goal)
|
|
263
|
+
return;
|
|
264
|
+
const decision = decideGoalExecution(goal);
|
|
265
|
+
// Keep arming through waiting_user / waiting_external so an answer or
|
|
266
|
+
// deferred resume can wake without requiring a manual `/goal run`.
|
|
267
|
+
if (decision.kind === 'stop'
|
|
268
|
+
&& decision.reason !== 'waiting_user'
|
|
269
|
+
&& decision.reason !== 'waiting_external') {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const delay = Math.max(0, Math.min(Date.parse(state.nextWakeAt) - Date.now(), 2_147_000_000));
|
|
273
|
+
const timer = setTimeout(() => {
|
|
274
|
+
this.timers.delete(state.goalId);
|
|
275
|
+
void this.runContinuation(state.sessionId, { mode: 'scheduled' }).catch(() => undefined);
|
|
276
|
+
}, delay);
|
|
277
|
+
timer.unref?.();
|
|
278
|
+
this.timers.set(state.goalId, timer);
|
|
279
|
+
}
|
|
280
|
+
clearTimer(goalId) {
|
|
281
|
+
const timer = this.timers.get(goalId);
|
|
282
|
+
if (timer)
|
|
283
|
+
clearTimeout(timer);
|
|
284
|
+
this.timers.delete(goalId);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=projectGoalApi.js.map
|
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C,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;QAC9F,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjC,KAAK,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,SAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5F,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAEO,UAAU,CAAC,MAAc;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type GoalSessionPort } from './goalStore.js';
|
|
2
|
+
import type { Goal } from './types.js';
|
|
3
|
+
import type { GoalHandoffReceipt, GoalWorkClaim } from './types.js';
|
|
4
|
+
export declare const PROJECT_GOAL_DATABASE = "goal-state.sqlite";
|
|
5
|
+
export interface ProjectGoalSummary {
|
|
6
|
+
id: string;
|
|
7
|
+
objective: string;
|
|
8
|
+
status: Goal['status'];
|
|
9
|
+
revision: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
attachedSessionIds: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ProjectGoalEvent {
|
|
15
|
+
id: number;
|
|
16
|
+
goalId: string;
|
|
17
|
+
type: string;
|
|
18
|
+
at: string;
|
|
19
|
+
revision?: number;
|
|
20
|
+
payload?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export type GoalContinuationMode = 'manual' | 'foreground' | 'scheduled';
|
|
23
|
+
export interface GoalContinuationProfileRef {
|
|
24
|
+
kind: 'config' | 'agent';
|
|
25
|
+
name: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GoalContinuationState {
|
|
28
|
+
goalId: string;
|
|
29
|
+
mode: GoalContinuationMode;
|
|
30
|
+
executionProfile?: GoalContinuationProfileRef;
|
|
31
|
+
minIntervalSeconds: number;
|
|
32
|
+
maxIntervalSeconds: number;
|
|
33
|
+
currentIntervalSeconds: number;
|
|
34
|
+
nextWakeAt?: string;
|
|
35
|
+
lastWakeAt?: string;
|
|
36
|
+
lastOutcome?: string;
|
|
37
|
+
consecutiveNoChange: number;
|
|
38
|
+
leaseOwner?: string;
|
|
39
|
+
leaseExpiresAt?: string;
|
|
40
|
+
lastError?: string;
|
|
41
|
+
sessionId?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Project-scoped durable store for Goal snapshots, audit events, and session attachments. */
|
|
44
|
+
export declare class ProjectGoalStore {
|
|
45
|
+
private readonly driver;
|
|
46
|
+
private constructor();
|
|
47
|
+
static open(projectStateDirectory: string): Promise<ProjectGoalStore>;
|
|
48
|
+
close(): void;
|
|
49
|
+
createGoalId(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Goals are session-scoped: a session only sees the goal it is attached to, so
|
|
52
|
+
* a new chat starts without one instead of inheriting the project's last goal.
|
|
53
|
+
*/
|
|
54
|
+
portForSession(sessionId: string, options?: {
|
|
55
|
+
forceNew?: boolean;
|
|
56
|
+
}): GoalSessionPort;
|
|
57
|
+
importLegacyGoal(sessionId: string, raw: unknown, now?: string): string | undefined;
|
|
58
|
+
readForSession(sessionId: string): {
|
|
59
|
+
id: string;
|
|
60
|
+
goal: Goal;
|
|
61
|
+
} | undefined;
|
|
62
|
+
listGoals(options?: {
|
|
63
|
+
includeArchived?: boolean;
|
|
64
|
+
limit?: number;
|
|
65
|
+
}): ProjectGoalSummary[];
|
|
66
|
+
history(goalId: string, limit?: number): ProjectGoalEvent[];
|
|
67
|
+
continuationState(goalId: string): GoalContinuationState | undefined;
|
|
68
|
+
listScheduledContinuations(): GoalContinuationState[];
|
|
69
|
+
configureContinuation(input: {
|
|
70
|
+
goalId: string;
|
|
71
|
+
mode: GoalContinuationMode;
|
|
72
|
+
executionProfile?: GoalContinuationProfileRef;
|
|
73
|
+
minIntervalSeconds?: number;
|
|
74
|
+
maxIntervalSeconds?: number;
|
|
75
|
+
now?: Date;
|
|
76
|
+
}): GoalContinuationState;
|
|
77
|
+
acquireContinuationLease(goalId: string, owner: string, now?: Date, leaseMs?: number): boolean;
|
|
78
|
+
settleContinuation(input: {
|
|
79
|
+
goalId: string;
|
|
80
|
+
owner: string;
|
|
81
|
+
outcome: string;
|
|
82
|
+
error?: string;
|
|
83
|
+
now?: Date;
|
|
84
|
+
}): GoalContinuationState | undefined;
|
|
85
|
+
claimNextWork(input: {
|
|
86
|
+
goalId: string;
|
|
87
|
+
agentId: string;
|
|
88
|
+
roleScopes?: string[];
|
|
89
|
+
leaseMs?: number;
|
|
90
|
+
now?: Date;
|
|
91
|
+
}): GoalWorkClaim | undefined;
|
|
92
|
+
renewWorkClaim(claimToken: string, leaseMs?: number, now?: Date): GoalWorkClaim | undefined;
|
|
93
|
+
markClaimRunning(claimToken: string, now?: Date): boolean;
|
|
94
|
+
releaseWorkClaim(claimToken: string, reason?: string, now?: Date): boolean;
|
|
95
|
+
/** Atomically claim a specific work item if it is runnable and unclaimed. */
|
|
96
|
+
claimWorkItem(input: {
|
|
97
|
+
goalId: string;
|
|
98
|
+
workItemId: string;
|
|
99
|
+
agentId: string;
|
|
100
|
+
roleScopes?: string[];
|
|
101
|
+
leaseMs?: number;
|
|
102
|
+
now?: Date;
|
|
103
|
+
}): GoalWorkClaim | undefined;
|
|
104
|
+
completeWorkClaim(claimToken: string, evidenceRefs: string[], now?: Date): boolean;
|
|
105
|
+
handoffWork(input: {
|
|
106
|
+
claimToken: string;
|
|
107
|
+
reason: string;
|
|
108
|
+
toAgentId?: string;
|
|
109
|
+
toAgentRoleScopes?: string[];
|
|
110
|
+
evidenceRefs?: string[];
|
|
111
|
+
leaseMs?: number;
|
|
112
|
+
now?: Date;
|
|
113
|
+
}): {
|
|
114
|
+
receipt: GoalHandoffReceipt;
|
|
115
|
+
claim?: GoalWorkClaim;
|
|
116
|
+
} | undefined;
|
|
117
|
+
listWorkClaims(goalId: string, options?: {
|
|
118
|
+
includeExpired?: boolean;
|
|
119
|
+
now?: Date;
|
|
120
|
+
}): GoalWorkClaim[];
|
|
121
|
+
listHandoffs(goalId: string, limit?: number): GoalHandoffReceipt[];
|
|
122
|
+
goalIdForSession(sessionId: string): string | undefined;
|
|
123
|
+
currentGoalId(): string | undefined;
|
|
124
|
+
readSnapshot(goalId: string): Goal | null;
|
|
125
|
+
writeSnapshot(goalId: string, goal: Goal | undefined, eventType?: string): void;
|
|
126
|
+
updateSnapshot(goalId: string, mutation: (current: unknown) => Goal | undefined): Goal | undefined;
|
|
127
|
+
attachSession(sessionId: string, goalId: string, at?: string): void;
|
|
128
|
+
detachSession(sessionId: string, at?: string): void;
|
|
129
|
+
private insertEvent;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=projectGoalStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectGoalStore.d.ts","sourceRoot":"","sources":["../../../src/goal/projectGoalStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD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