@a5c-ai/babysitter-sdk 0.0.187-staging.cbc8da4a → 0.0.187-staging.cbd8dccc
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/dist/api/effects.d.ts +87 -0
- package/dist/api/effects.d.ts.map +1 -0
- package/dist/api/effects.js +329 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +14 -0
- package/dist/api/runs.d.ts +86 -0
- package/dist/api/runs.d.ts.map +1 -0
- package/dist/api/runs.js +253 -0
- package/dist/cli/commandRegistry.d.ts +27 -0
- package/dist/cli/commandRegistry.d.ts.map +1 -0
- package/dist/cli/commandRegistry.js +126 -0
- package/dist/cli/commands/harnessCreateRun.d.ts.map +1 -1
- package/dist/cli/commands/harnessCreateRun.js +13 -9
- package/dist/cli/commands/harnessPhase1.d.ts +1 -0
- package/dist/cli/commands/harnessPhase1.d.ts.map +1 -1
- package/dist/cli/commands/harnessPhase1.js +12 -12
- package/dist/cli/commands/harnessPhase2.d.ts +8 -0
- package/dist/cli/commands/harnessPhase2.d.ts.map +1 -1
- package/dist/cli/commands/harnessPhase2.js +159 -29
- package/dist/cli/commands/harnessPrompts.d.ts +1 -0
- package/dist/cli/commands/harnessPrompts.d.ts.map +1 -1
- package/dist/cli/commands/harnessPrompts.js +13 -0
- package/dist/cli/commands/harnessResumeRun.d.ts +1 -0
- package/dist/cli/commands/harnessResumeRun.d.ts.map +1 -1
- package/dist/cli/commands/harnessResumeRun.js +13 -11
- package/dist/cli/commands/harnessUtils.d.ts +18 -5
- package/dist/cli/commands/harnessUtils.d.ts.map +1 -1
- package/dist/cli/commands/harnessUtils.js +23 -7
- package/dist/cli/commands/instructions.d.ts +1 -0
- package/dist/cli/commands/instructions.d.ts.map +1 -1
- package/dist/cli/commands/instructions.js +33 -2
- package/dist/cli/commands/runIterate.d.ts +13 -0
- package/dist/cli/commands/runIterate.d.ts.map +1 -1
- package/dist/cli/commands/runIterate.js +21 -0
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +2 -0
- package/dist/cli/commands/sessionHistory.d.ts +14 -0
- package/dist/cli/commands/sessionHistory.d.ts.map +1 -0
- package/dist/cli/commands/sessionHistory.js +82 -0
- package/dist/cli/commands/tui.d.ts +25 -0
- package/dist/cli/commands/tui.d.ts.map +1 -0
- package/dist/cli/commands/tui.js +195 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +166 -11
- package/dist/cost/effectCost.d.ts +21 -0
- package/dist/cost/effectCost.d.ts.map +1 -0
- package/dist/cost/effectCost.js +26 -0
- package/dist/cost/index.d.ts +1 -0
- package/dist/cost/index.d.ts.map +1 -1
- package/dist/cost/index.js +3 -1
- package/dist/dashboard/colors.d.ts +26 -0
- package/dist/dashboard/colors.d.ts.map +1 -0
- package/dist/dashboard/colors.js +38 -0
- package/dist/dashboard/components/BreakpointApproval.d.ts +25 -0
- package/dist/dashboard/components/BreakpointApproval.d.ts.map +1 -0
- package/dist/dashboard/components/BreakpointApproval.js +77 -0
- package/dist/dashboard/components/EffectTree.d.ts +17 -0
- package/dist/dashboard/components/EffectTree.d.ts.map +1 -0
- package/dist/dashboard/components/EffectTree.js +53 -0
- package/dist/dashboard/components/KeyValue.d.ts +7 -0
- package/dist/dashboard/components/KeyValue.d.ts.map +1 -0
- package/dist/dashboard/components/KeyValue.js +19 -0
- package/dist/dashboard/components/ProgressBar.d.ts +7 -0
- package/dist/dashboard/components/ProgressBar.d.ts.map +1 -0
- package/dist/dashboard/components/ProgressBar.js +34 -0
- package/dist/dashboard/components/StatusBadge.d.ts +4 -0
- package/dist/dashboard/components/StatusBadge.d.ts.map +1 -0
- package/dist/dashboard/components/StatusBadge.js +28 -0
- package/dist/dashboard/components/StatusLine.d.ts +13 -0
- package/dist/dashboard/components/StatusLine.d.ts.map +1 -0
- package/dist/dashboard/components/StatusLine.js +70 -0
- package/dist/dashboard/components/StructuredDiff.d.ts +6 -0
- package/dist/dashboard/components/StructuredDiff.d.ts.map +1 -0
- package/dist/dashboard/components/StructuredDiff.js +47 -0
- package/dist/dashboard/components/Table.d.ts +5 -0
- package/dist/dashboard/components/Table.d.ts.map +1 -0
- package/dist/dashboard/components/Table.js +25 -0
- package/dist/dashboard/components/index.d.ts +11 -0
- package/dist/dashboard/components/index.d.ts.map +1 -0
- package/dist/dashboard/components/index.js +25 -0
- package/dist/dashboard/components/messages/EffectRequestedMessage.d.ts +3 -0
- package/dist/dashboard/components/messages/EffectRequestedMessage.d.ts.map +1 -0
- package/dist/dashboard/components/messages/EffectRequestedMessage.js +21 -0
- package/dist/dashboard/components/messages/EffectResolvedMessage.d.ts +3 -0
- package/dist/dashboard/components/messages/EffectResolvedMessage.d.ts.map +1 -0
- package/dist/dashboard/components/messages/EffectResolvedMessage.js +20 -0
- package/dist/dashboard/components/messages/EventMessage.d.ts +3 -0
- package/dist/dashboard/components/messages/EventMessage.d.ts.map +1 -0
- package/dist/dashboard/components/messages/EventMessage.js +27 -0
- package/dist/dashboard/components/messages/RunCompletedMessage.d.ts +3 -0
- package/dist/dashboard/components/messages/RunCompletedMessage.d.ts.map +1 -0
- package/dist/dashboard/components/messages/RunCompletedMessage.js +17 -0
- package/dist/dashboard/components/messages/RunCreatedMessage.d.ts +3 -0
- package/dist/dashboard/components/messages/RunCreatedMessage.d.ts.map +1 -0
- package/dist/dashboard/components/messages/RunCreatedMessage.js +18 -0
- package/dist/dashboard/components/messages/RunFailedMessage.d.ts +3 -0
- package/dist/dashboard/components/messages/RunFailedMessage.d.ts.map +1 -0
- package/dist/dashboard/components/messages/RunFailedMessage.js +23 -0
- package/dist/dashboard/components/messages/index.d.ts +8 -0
- package/dist/dashboard/components/messages/index.d.ts.map +1 -0
- package/dist/dashboard/components/messages/index.js +15 -0
- package/dist/dashboard/components/messages/types.d.ts +9 -0
- package/dist/dashboard/components/messages/types.d.ts.map +1 -0
- package/dist/dashboard/components/messages/types.js +5 -0
- package/dist/dashboard/diffParser.d.ts +20 -0
- package/dist/dashboard/diffParser.d.ts.map +1 -0
- package/dist/dashboard/diffParser.js +58 -0
- package/dist/dashboard/index.d.ts +13 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +34 -0
- package/dist/dashboard/ink/App.d.ts +27 -0
- package/dist/dashboard/ink/App.d.ts.map +1 -0
- package/dist/dashboard/ink/App.js +90 -0
- package/dist/dashboard/ink/components/ActionMenu.d.ts +14 -0
- package/dist/dashboard/ink/components/ActionMenu.d.ts.map +1 -0
- package/dist/dashboard/ink/components/ActionMenu.js +39 -0
- package/dist/dashboard/ink/components/Message.d.ts +17 -0
- package/dist/dashboard/ink/components/Message.d.ts.map +1 -0
- package/dist/dashboard/ink/components/Message.js +142 -0
- package/dist/dashboard/ink/components/MessagePane.d.ts +25 -0
- package/dist/dashboard/ink/components/MessagePane.d.ts.map +1 -0
- package/dist/dashboard/ink/components/MessagePane.js +156 -0
- package/dist/dashboard/ink/components/PromptBar.d.ts +32 -0
- package/dist/dashboard/ink/components/PromptBar.d.ts.map +1 -0
- package/dist/dashboard/ink/components/PromptBar.js +162 -0
- package/dist/dashboard/ink/components/RunListTable.d.ts +28 -0
- package/dist/dashboard/ink/components/RunListTable.d.ts.map +1 -0
- package/dist/dashboard/ink/components/RunListTable.js +115 -0
- package/dist/dashboard/ink/components/RunningIndicator.d.ts +25 -0
- package/dist/dashboard/ink/components/RunningIndicator.d.ts.map +1 -0
- package/dist/dashboard/ink/components/RunningIndicator.js +38 -0
- package/dist/dashboard/ink/components/StatusBar.d.ts +37 -0
- package/dist/dashboard/ink/components/StatusBar.d.ts.map +1 -0
- package/dist/dashboard/ink/components/StatusBar.js +109 -0
- package/dist/dashboard/ink/components/StatusLine.d.ts +30 -0
- package/dist/dashboard/ink/components/StatusLine.d.ts.map +1 -0
- package/dist/dashboard/ink/components/StatusLine.js +122 -0
- package/dist/dashboard/ink/components/index.d.ts +24 -0
- package/dist/dashboard/ink/components/index.d.ts.map +1 -0
- package/dist/dashboard/ink/components/index.js +41 -0
- package/dist/dashboard/ink/components/primitives/BorderBox.d.ts +47 -0
- package/dist/dashboard/ink/components/primitives/BorderBox.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/BorderBox.js +107 -0
- package/dist/dashboard/ink/components/primitives/ProgressBar.d.ts +25 -0
- package/dist/dashboard/ink/components/primitives/ProgressBar.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/ProgressBar.js +55 -0
- package/dist/dashboard/ink/components/primitives/Tree.d.ts +27 -0
- package/dist/dashboard/ink/components/primitives/Tree.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/Tree.js +73 -0
- package/dist/dashboard/ink/components/primitives/index.d.ts +10 -0
- package/dist/dashboard/ink/components/primitives/index.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/index.js +16 -0
- package/dist/dashboard/ink/contexts/ChatContext.d.ts +33 -0
- package/dist/dashboard/ink/contexts/ChatContext.d.ts.map +1 -0
- package/dist/dashboard/ink/contexts/ChatContext.js +105 -0
- package/dist/dashboard/ink/contexts/ClockContext.d.ts +26 -0
- package/dist/dashboard/ink/contexts/ClockContext.d.ts.map +1 -0
- package/dist/dashboard/ink/contexts/ClockContext.js +43 -0
- package/dist/dashboard/ink/contexts/InkContext.d.ts +58 -0
- package/dist/dashboard/ink/contexts/InkContext.d.ts.map +1 -0
- package/dist/dashboard/ink/contexts/InkContext.js +77 -0
- package/dist/dashboard/ink/contexts/NavigationContext.d.ts +44 -0
- package/dist/dashboard/ink/contexts/NavigationContext.d.ts.map +1 -0
- package/dist/dashboard/ink/contexts/NavigationContext.js +91 -0
- package/dist/dashboard/ink/contexts/SessionContext.d.ts +54 -0
- package/dist/dashboard/ink/contexts/SessionContext.d.ts.map +1 -0
- package/dist/dashboard/ink/contexts/SessionContext.js +87 -0
- package/dist/dashboard/ink/contexts/ThemeContext.d.ts +17 -0
- package/dist/dashboard/ink/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/dashboard/ink/contexts/ThemeContext.js +46 -0
- package/dist/dashboard/ink/data/runScanner.d.ts +42 -0
- package/dist/dashboard/ink/data/runScanner.d.ts.map +1 -0
- package/dist/dashboard/ink/data/runScanner.js +145 -0
- package/dist/dashboard/ink/helpers.d.ts +238 -0
- package/dist/dashboard/ink/helpers.d.ts.map +1 -0
- package/dist/dashboard/ink/helpers.js +710 -0
- package/dist/dashboard/ink/hooks/useChat.d.ts +6 -0
- package/dist/dashboard/ink/hooks/useChat.d.ts.map +1 -0
- package/dist/dashboard/ink/hooks/useChat.js +8 -0
- package/dist/dashboard/ink/hooks/useClock.d.ts +14 -0
- package/dist/dashboard/ink/hooks/useClock.d.ts.map +1 -0
- package/dist/dashboard/ink/hooks/useClock.js +13 -0
- package/dist/dashboard/ink/hooks/useNavigation.d.ts +7 -0
- package/dist/dashboard/ink/hooks/useNavigation.d.ts.map +1 -0
- package/dist/dashboard/ink/hooks/useNavigation.js +10 -0
- package/dist/dashboard/ink/hooks/useRunScanner.d.ts +15 -0
- package/dist/dashboard/ink/hooks/useRunScanner.d.ts.map +1 -0
- package/dist/dashboard/ink/hooks/useRunScanner.js +57 -0
- package/dist/dashboard/ink/hooks/useSession.d.ts +14 -0
- package/dist/dashboard/ink/hooks/useSession.d.ts.map +1 -0
- package/dist/dashboard/ink/hooks/useSession.js +13 -0
- package/dist/dashboard/ink/hooks/useTheme.d.ts +8 -0
- package/dist/dashboard/ink/hooks/useTheme.d.ts.map +1 -0
- package/dist/dashboard/ink/hooks/useTheme.js +12 -0
- package/dist/dashboard/ink/index.d.ts +32 -0
- package/dist/dashboard/ink/index.d.ts.map +1 -0
- package/dist/dashboard/ink/index.js +85 -0
- package/dist/dashboard/ink/render.d.ts +31 -0
- package/dist/dashboard/ink/render.d.ts.map +1 -0
- package/dist/dashboard/ink/render.js +97 -0
- package/dist/dashboard/ink/types.d.ts +167 -0
- package/dist/dashboard/ink/types.d.ts.map +1 -0
- package/dist/dashboard/ink/types.js +8 -0
- package/dist/dashboard/ink/views/DashboardView.d.ts +23 -0
- package/dist/dashboard/ink/views/DashboardView.d.ts.map +1 -0
- package/dist/dashboard/ink/views/DashboardView.js +156 -0
- package/dist/dashboard/ink/views/SessionView.d.ts +16 -0
- package/dist/dashboard/ink/views/SessionView.d.ts.map +1 -0
- package/dist/dashboard/ink/views/SessionView.js +222 -0
- package/dist/dashboard/ink/views/index.d.ts +6 -0
- package/dist/dashboard/ink/views/index.d.ts.map +1 -0
- package/dist/dashboard/ink/views/index.js +10 -0
- package/dist/dashboard/render.d.ts +20 -0
- package/dist/dashboard/render.d.ts.map +1 -0
- package/dist/dashboard/render.js +30 -0
- package/dist/governance/bridge.d.ts +17 -0
- package/dist/governance/bridge.d.ts.map +1 -0
- package/dist/governance/bridge.js +46 -0
- package/dist/governance/builtins.d.ts +25 -0
- package/dist/governance/builtins.d.ts.map +1 -0
- package/dist/governance/builtins.js +67 -0
- package/dist/governance/engine.d.ts +20 -0
- package/dist/governance/engine.d.ts.map +1 -0
- package/dist/governance/engine.js +124 -0
- package/dist/governance/index.d.ts +11 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +25 -0
- package/dist/governance/logging.d.ts +18 -0
- package/dist/governance/logging.d.ts.map +1 -0
- package/dist/governance/logging.js +83 -0
- package/dist/governance/types.d.ts +106 -0
- package/dist/governance/types.d.ts.map +1 -0
- package/dist/governance/types.js +13 -0
- package/dist/harness/agenticTools.d.ts +4 -0
- package/dist/harness/agenticTools.d.ts.map +1 -1
- package/dist/harness/agenticTools.js +106 -5
- package/dist/harness/backgroundProcessRegistry.d.ts +63 -0
- package/dist/harness/backgroundProcessRegistry.d.ts.map +1 -0
- package/dist/harness/backgroundProcessRegistry.js +199 -0
- package/dist/harness/backgroundTracker.d.ts +64 -0
- package/dist/harness/backgroundTracker.d.ts.map +1 -0
- package/dist/harness/backgroundTracker.js +107 -0
- package/dist/harness/claudeCode.d.ts +1 -1
- package/dist/harness/claudeCode.d.ts.map +1 -1
- package/dist/harness/claudeCode.js +133 -34
- package/dist/harness/codex.d.ts.map +1 -1
- package/dist/harness/codex.js +1 -0
- package/dist/harness/cursor.d.ts.map +1 -1
- package/dist/harness/cursor.js +2 -0
- package/dist/harness/geminiCli.d.ts.map +1 -1
- package/dist/harness/geminiCli.js +2 -0
- package/dist/harness/githubCopilot.d.ts.map +1 -1
- package/dist/harness/githubCopilot.js +2 -0
- package/dist/harness/index.d.ts +4 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +7 -1
- package/dist/harness/internal.d.ts.map +1 -1
- package/dist/harness/internal.js +10 -2
- package/dist/harness/invoker.d.ts +16 -0
- package/dist/harness/invoker.d.ts.map +1 -1
- package/dist/harness/invoker.js +70 -0
- package/dist/harness/ohMyPi.d.ts.map +1 -1
- package/dist/harness/ohMyPi.js +1 -0
- package/dist/harness/openclaw.d.ts.map +1 -1
- package/dist/harness/openclaw.js +2 -0
- package/dist/harness/opencode.d.ts.map +1 -1
- package/dist/harness/opencode.js +2 -0
- package/dist/harness/pi.d.ts.map +1 -1
- package/dist/harness/pi.js +1 -0
- package/dist/harness/streamingCapture.d.ts +44 -0
- package/dist/harness/streamingCapture.d.ts.map +1 -0
- package/dist/harness/streamingCapture.js +249 -0
- package/dist/harness/types.d.ts +22 -1
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/mcp/tools/runs.d.ts.map +1 -1
- package/dist/mcp/tools/runs.js +59 -94
- package/dist/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/mcp/tools/sessions.js +2 -0
- package/dist/processLibrary/active.js +1 -1
- package/dist/prompts/compose.d.ts.map +1 -1
- package/dist/prompts/compose.js +2 -0
- package/dist/prompts/context.d.ts +8 -0
- package/dist/prompts/context.d.ts.map +1 -1
- package/dist/prompts/context.js +50 -9
- package/dist/prompts/index.d.ts +3 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +10 -1
- package/dist/prompts/parts/index.d.ts +1 -0
- package/dist/prompts/parts/index.d.ts.map +1 -1
- package/dist/prompts/parts/index.js +3 -1
- package/dist/prompts/parts/parallelDispatch.d.ts +15 -0
- package/dist/prompts/parts/parallelDispatch.d.ts.map +1 -0
- package/dist/prompts/parts/parallelDispatch.js +46 -0
- package/dist/prompts/strata.d.ts +39 -0
- package/dist/prompts/strata.d.ts.map +1 -0
- package/dist/prompts/strata.js +140 -0
- package/dist/prompts/templates/process-guidelines.md +1 -1
- package/dist/prompts/types.d.ts +28 -0
- package/dist/prompts/types.d.ts.map +1 -1
- package/dist/runtime/asyncEffects.d.ts +22 -0
- package/dist/runtime/asyncEffects.d.ts.map +1 -0
- package/dist/runtime/asyncEffects.js +86 -0
- package/dist/runtime/commitEffectResult.d.ts +9 -0
- package/dist/runtime/commitEffectResult.d.ts.map +1 -1
- package/dist/runtime/commitEffectResult.js +46 -0
- package/dist/runtime/createRun.js +1 -1
- package/dist/runtime/effectGroupRegistry.d.ts +57 -0
- package/dist/runtime/effectGroupRegistry.d.ts.map +1 -0
- package/dist/runtime/effectGroupRegistry.js +107 -0
- package/dist/runtime/exceptions.d.ts +5 -0
- package/dist/runtime/exceptions.d.ts.map +1 -1
- package/dist/runtime/exceptions.js +13 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -1
- package/dist/runtime/intrinsics/parallel.d.ts +5 -1
- package/dist/runtime/intrinsics/parallel.d.ts.map +1 -1
- package/dist/runtime/intrinsics/parallel.js +124 -18
- package/dist/runtime/intrinsics/parallelGroup.d.ts +16 -0
- package/dist/runtime/intrinsics/parallelGroup.d.ts.map +1 -0
- package/dist/runtime/intrinsics/parallelGroup.js +105 -0
- package/dist/runtime/intrinsics/task.d.ts +2 -0
- package/dist/runtime/intrinsics/task.d.ts.map +1 -1
- package/dist/runtime/intrinsics/task.js +35 -0
- package/dist/runtime/orchestrateIteration.d.ts +6 -0
- package/dist/runtime/orchestrateIteration.d.ts.map +1 -1
- package/dist/runtime/orchestrateIteration.js +45 -0
- package/dist/runtime/replay/effectIndex.d.ts +3 -0
- package/dist/runtime/replay/effectIndex.d.ts.map +1 -1
- package/dist/runtime/replay/effectIndex.js +74 -0
- package/dist/runtime/replay/stateCache.js +1 -1
- package/dist/runtime/types.d.ts +26 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/session/context.d.ts +22 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +108 -0
- package/dist/session/history.d.ts +30 -0
- package/dist/session/history.d.ts.map +1 -0
- package/dist/session/history.js +143 -0
- package/dist/session/index.d.ts +4 -2
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +15 -1
- package/dist/session/parse.d.ts.map +1 -1
- package/dist/session/parse.js +7 -0
- package/dist/session/types.d.ts +62 -1
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/write.d.ts +20 -0
- package/dist/session/write.d.ts.map +1 -1
- package/dist/session/write.js +44 -0
- package/dist/storage/createRunDir.js +1 -1
- package/dist/storage/types.d.ts +3 -2
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/tasks/batching.d.ts +6 -1
- package/dist/tasks/batching.d.ts.map +1 -1
- package/dist/tasks/batching.js +33 -8
- package/dist/tasks/effectGroup.d.ts +19 -0
- package/dist/tasks/effectGroup.d.ts.map +1 -0
- package/dist/tasks/effectGroup.js +58 -0
- package/dist/tasks/grouping.d.ts +19 -0
- package/dist/tasks/grouping.d.ts.map +1 -0
- package/dist/tasks/grouping.js +54 -0
- package/dist/tasks/index.d.ts +1 -0
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +1 -0
- package/dist/tasks/partitioning.d.ts +11 -0
- package/dist/tasks/partitioning.d.ts.map +1 -0
- package/dist/tasks/partitioning.js +20 -0
- package/dist/tasks/registry.d.ts +1 -1
- package/dist/tasks/registry.d.ts.map +1 -1
- package/dist/tasks/serializer.d.ts +2 -1
- package/dist/tasks/serializer.d.ts.map +1 -1
- package/dist/tasks/serializer.js +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GAP-JSON-002: Effect Dispatch and Response Protocol.
|
|
3
|
+
*
|
|
4
|
+
* Typed API wrappers for listing, showing, cancelling, and batch-committing
|
|
5
|
+
* effects. All functions return ApiResult envelopes and never throw.
|
|
6
|
+
*/
|
|
7
|
+
import type { ApiResult } from "./runs";
|
|
8
|
+
import type { JsonRecord } from "../storage/types";
|
|
9
|
+
type EffectStatusFilter = "requested" | "resolved" | "cancelled";
|
|
10
|
+
type EffectStatusOutput = "requested" | "resolved_ok" | "resolved_error" | "cancelled";
|
|
11
|
+
export interface ListEffectsInput {
|
|
12
|
+
runDir: string;
|
|
13
|
+
filter?: {
|
|
14
|
+
kind?: string | string[];
|
|
15
|
+
status?: EffectStatusFilter;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface EffectSummary {
|
|
19
|
+
effectId: string;
|
|
20
|
+
kind?: string;
|
|
21
|
+
status: EffectStatusOutput;
|
|
22
|
+
taskId?: string;
|
|
23
|
+
labels?: string[];
|
|
24
|
+
requestedAt?: string;
|
|
25
|
+
resolvedAt?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ListEffectsOutput {
|
|
28
|
+
effects: EffectSummary[];
|
|
29
|
+
}
|
|
30
|
+
export interface ShowEffectInput {
|
|
31
|
+
runDir: string;
|
|
32
|
+
effectId: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ShowEffectOutput {
|
|
35
|
+
effectId: string;
|
|
36
|
+
kind?: string;
|
|
37
|
+
status: EffectStatusOutput;
|
|
38
|
+
taskId?: string;
|
|
39
|
+
labels?: string[];
|
|
40
|
+
requestedAt?: string;
|
|
41
|
+
resolvedAt?: string;
|
|
42
|
+
taskDefinition?: JsonRecord;
|
|
43
|
+
result?: unknown;
|
|
44
|
+
autoApproval?: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface CancelEffectInput {
|
|
47
|
+
runDir: string;
|
|
48
|
+
effectId: string;
|
|
49
|
+
reason?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface CancelEffectOutput {
|
|
52
|
+
resultRef: string;
|
|
53
|
+
}
|
|
54
|
+
export interface BatchCommitEffectEntry {
|
|
55
|
+
effectId: string;
|
|
56
|
+
result: {
|
|
57
|
+
status: "ok" | "error";
|
|
58
|
+
value?: unknown;
|
|
59
|
+
error?: string;
|
|
60
|
+
stdout?: string;
|
|
61
|
+
stderr?: string;
|
|
62
|
+
stdoutRef?: string;
|
|
63
|
+
stderrRef?: string;
|
|
64
|
+
startedAt?: string;
|
|
65
|
+
finishedAt?: string;
|
|
66
|
+
metadata?: JsonRecord;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface BatchCommitEffectsInput {
|
|
70
|
+
runDir: string;
|
|
71
|
+
effects: BatchCommitEffectEntry[];
|
|
72
|
+
}
|
|
73
|
+
export interface BatchCommitEffectResult {
|
|
74
|
+
effectId: string;
|
|
75
|
+
ok: boolean;
|
|
76
|
+
resultRef?: string;
|
|
77
|
+
error?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface BatchCommitEffectsOutput {
|
|
80
|
+
results: BatchCommitEffectResult[];
|
|
81
|
+
}
|
|
82
|
+
export declare function apiListEffects(input: ListEffectsInput): Promise<ApiResult<ListEffectsOutput>>;
|
|
83
|
+
export declare function apiShowEffect(input: ShowEffectInput): Promise<ApiResult<ShowEffectOutput>>;
|
|
84
|
+
export declare function apiCancelEffect(input: CancelEffectInput): Promise<ApiResult<CancelEffectOutput>>;
|
|
85
|
+
export declare function apiBatchCommitEffects(input: BatchCommitEffectsInput): Promise<ApiResult<BatchCommitEffectsOutput>>;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AAa,CACjC,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CA0DtC;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CA8DxC;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC,CA8G9C"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GAP-JSON-002: Effect Dispatch and Response Protocol.
|
|
4
|
+
*
|
|
5
|
+
* Typed API wrappers for listing, showing, cancelling, and batch-committing
|
|
6
|
+
* effects. All functions return ApiResult envelopes and never throw.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.apiListEffects = apiListEffects;
|
|
10
|
+
exports.apiShowEffect = apiShowEffect;
|
|
11
|
+
exports.apiCancelEffect = apiCancelEffect;
|
|
12
|
+
exports.apiBatchCommitEffects = apiBatchCommitEffects;
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const journal_1 = require("../storage/journal");
|
|
15
|
+
const tasks_1 = require("../storage/tasks");
|
|
16
|
+
const lock_1 = require("../storage/lock");
|
|
17
|
+
const serializer_1 = require("../tasks/serializer");
|
|
18
|
+
// ── Result envelope helpers (mirror runs.ts) ───────────────────────────────
|
|
19
|
+
function ok(data) {
|
|
20
|
+
return { ok: true, data };
|
|
21
|
+
}
|
|
22
|
+
function fail(code, message) {
|
|
23
|
+
return { ok: false, error: { code, message } };
|
|
24
|
+
}
|
|
25
|
+
async function pathExists(p) {
|
|
26
|
+
try {
|
|
27
|
+
await fs_1.promises.access(p);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function buildEffectInfoMap(events) {
|
|
35
|
+
const effects = new Map();
|
|
36
|
+
for (const event of events) {
|
|
37
|
+
if (event.type === "EFFECT_REQUESTED") {
|
|
38
|
+
const data = event.data;
|
|
39
|
+
const effectId = data.effectId;
|
|
40
|
+
if (!effectId)
|
|
41
|
+
continue;
|
|
42
|
+
effects.set(effectId, {
|
|
43
|
+
effectId,
|
|
44
|
+
kind: typeof data.kind === "string" ? data.kind : undefined,
|
|
45
|
+
taskId: typeof data.taskId === "string" ? data.taskId : undefined,
|
|
46
|
+
labels: Array.isArray(data.labels) ? data.labels : undefined,
|
|
47
|
+
status: "requested",
|
|
48
|
+
requestedAt: event.recordedAt,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else if (event.type === "EFFECT_RESOLVED") {
|
|
52
|
+
const data = event.data;
|
|
53
|
+
const effectId = data.effectId;
|
|
54
|
+
if (!effectId)
|
|
55
|
+
continue;
|
|
56
|
+
const existing = effects.get(effectId);
|
|
57
|
+
if (existing) {
|
|
58
|
+
const resultStatus = data.status;
|
|
59
|
+
existing.status = resultStatus === "error" ? "resolved_error" : "resolved_ok";
|
|
60
|
+
existing.resolvedAt = event.recordedAt;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (event.type === "EFFECT_CANCELLED") {
|
|
64
|
+
const data = event.data;
|
|
65
|
+
const effectId = data.effectId;
|
|
66
|
+
if (!effectId)
|
|
67
|
+
continue;
|
|
68
|
+
const existing = effects.get(effectId);
|
|
69
|
+
if (existing) {
|
|
70
|
+
existing.status = "cancelled";
|
|
71
|
+
existing.resolvedAt = event.recordedAt;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return effects;
|
|
76
|
+
}
|
|
77
|
+
// ── API functions ──────────────────────────────────────────────────────────
|
|
78
|
+
async function apiListEffects(input) {
|
|
79
|
+
try {
|
|
80
|
+
if (!input.runDir) {
|
|
81
|
+
return fail("INVALID_INPUT", "runDir must be a non-empty string");
|
|
82
|
+
}
|
|
83
|
+
if (!(await pathExists(input.runDir))) {
|
|
84
|
+
return fail("RUN_NOT_FOUND", `Run directory not found: ${input.runDir}`);
|
|
85
|
+
}
|
|
86
|
+
const events = await (0, journal_1.loadJournal)(input.runDir);
|
|
87
|
+
const effectMap = buildEffectInfoMap(events);
|
|
88
|
+
let effects = Array.from(effectMap.values());
|
|
89
|
+
// Apply filters
|
|
90
|
+
if (input.filter) {
|
|
91
|
+
if (input.filter.kind !== undefined) {
|
|
92
|
+
const kinds = Array.isArray(input.filter.kind) ? input.filter.kind : [input.filter.kind];
|
|
93
|
+
effects = effects.filter((e) => e.kind !== undefined && kinds.includes(e.kind));
|
|
94
|
+
}
|
|
95
|
+
if (input.filter.status !== undefined) {
|
|
96
|
+
const statusFilter = input.filter.status;
|
|
97
|
+
effects = effects.filter((e) => {
|
|
98
|
+
if (statusFilter === "requested")
|
|
99
|
+
return e.status === "requested";
|
|
100
|
+
if (statusFilter === "resolved")
|
|
101
|
+
return e.status === "resolved_ok" || e.status === "resolved_error";
|
|
102
|
+
if (statusFilter === "cancelled")
|
|
103
|
+
return e.status === "cancelled";
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Sort by effectId ascending
|
|
109
|
+
effects.sort((a, b) => a.effectId.localeCompare(b.effectId));
|
|
110
|
+
return ok({
|
|
111
|
+
effects: effects.map((e) => ({
|
|
112
|
+
effectId: e.effectId,
|
|
113
|
+
kind: e.kind,
|
|
114
|
+
status: e.status,
|
|
115
|
+
taskId: e.taskId,
|
|
116
|
+
labels: e.labels,
|
|
117
|
+
requestedAt: e.requestedAt,
|
|
118
|
+
resolvedAt: e.resolvedAt,
|
|
119
|
+
})),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
124
|
+
return fail("INTERNAL_ERROR", msg);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async function apiShowEffect(input) {
|
|
128
|
+
try {
|
|
129
|
+
if (!input.runDir) {
|
|
130
|
+
return fail("INVALID_INPUT", "runDir must be a non-empty string");
|
|
131
|
+
}
|
|
132
|
+
if (!input.effectId) {
|
|
133
|
+
return fail("INVALID_INPUT", "effectId must be a non-empty string");
|
|
134
|
+
}
|
|
135
|
+
if (!(await pathExists(input.runDir))) {
|
|
136
|
+
return fail("RUN_NOT_FOUND", `Run directory not found: ${input.runDir}`);
|
|
137
|
+
}
|
|
138
|
+
const events = await (0, journal_1.loadJournal)(input.runDir);
|
|
139
|
+
const effectMap = buildEffectInfoMap(events);
|
|
140
|
+
const info = effectMap.get(input.effectId);
|
|
141
|
+
if (!info) {
|
|
142
|
+
return fail("EFFECT_NOT_FOUND", `Effect not found: ${input.effectId}`);
|
|
143
|
+
}
|
|
144
|
+
// Read task definition
|
|
145
|
+
const taskDef = await (0, tasks_1.readTaskDefinition)(input.runDir, input.effectId);
|
|
146
|
+
// Read result if resolved
|
|
147
|
+
let resultData = null;
|
|
148
|
+
if (info.status === "resolved_ok" || info.status === "resolved_error") {
|
|
149
|
+
const storedResult = await (0, tasks_1.readTaskResult)(input.runDir, input.effectId);
|
|
150
|
+
resultData = storedResult ?? null;
|
|
151
|
+
}
|
|
152
|
+
const output = {
|
|
153
|
+
effectId: info.effectId,
|
|
154
|
+
kind: info.kind,
|
|
155
|
+
status: info.status,
|
|
156
|
+
taskId: info.taskId,
|
|
157
|
+
labels: info.labels,
|
|
158
|
+
requestedAt: info.requestedAt,
|
|
159
|
+
resolvedAt: info.resolvedAt,
|
|
160
|
+
taskDefinition: taskDef ?? undefined,
|
|
161
|
+
result: resultData === null ? undefined : resultData,
|
|
162
|
+
};
|
|
163
|
+
// Include autoApproval for breakpoint effects
|
|
164
|
+
if (info.kind === "breakpoint" || info.taskId === "__sdk.breakpoint") {
|
|
165
|
+
if (taskDef && typeof taskDef === "object") {
|
|
166
|
+
const autoApproval = taskDef.autoApproval;
|
|
167
|
+
if (autoApproval !== undefined) {
|
|
168
|
+
output.autoApproval = autoApproval;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return ok(output);
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
176
|
+
return fail("INTERNAL_ERROR", msg);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async function apiCancelEffect(input) {
|
|
180
|
+
try {
|
|
181
|
+
if (!input.runDir) {
|
|
182
|
+
return fail("INVALID_INPUT", "runDir must be a non-empty string");
|
|
183
|
+
}
|
|
184
|
+
if (!input.effectId) {
|
|
185
|
+
return fail("INVALID_INPUT", "effectId must be a non-empty string");
|
|
186
|
+
}
|
|
187
|
+
if (!(await pathExists(input.runDir))) {
|
|
188
|
+
return fail("RUN_NOT_FOUND", `Run directory not found: ${input.runDir}`);
|
|
189
|
+
}
|
|
190
|
+
return await (0, lock_1.withRunLock)(input.runDir, "api:cancelEffect", async () => {
|
|
191
|
+
const events = await (0, journal_1.loadJournal)(input.runDir);
|
|
192
|
+
const effectMap = buildEffectInfoMap(events);
|
|
193
|
+
const info = effectMap.get(input.effectId);
|
|
194
|
+
if (!info) {
|
|
195
|
+
return fail("EFFECT_NOT_FOUND", `Effect not found: ${input.effectId}`);
|
|
196
|
+
}
|
|
197
|
+
if (info.status !== "requested") {
|
|
198
|
+
return fail("EFFECT_NOT_PENDING", `Effect ${input.effectId} is not pending (status=${info.status})`);
|
|
199
|
+
}
|
|
200
|
+
// Extract taskId and invocationKey from the EFFECT_REQUESTED event
|
|
201
|
+
const requestedEvent = events.find((e) => e.type === "EFFECT_REQUESTED" && e.data.effectId === input.effectId);
|
|
202
|
+
const eventData = requestedEvent?.data;
|
|
203
|
+
const taskId = eventData?.taskId ?? `task-${input.effectId}`;
|
|
204
|
+
const invocationKey = eventData?.invocationKey ?? `key-${input.effectId}`;
|
|
205
|
+
const { resultRef } = await (0, serializer_1.serializeAndWriteTaskResult)({
|
|
206
|
+
runDir: input.runDir,
|
|
207
|
+
effectId: input.effectId,
|
|
208
|
+
taskId,
|
|
209
|
+
invocationKey,
|
|
210
|
+
payload: {
|
|
211
|
+
status: "cancelled",
|
|
212
|
+
reason: input.reason,
|
|
213
|
+
error: { name: "EffectCancelledError", message: input.reason ?? "Effect cancelled" },
|
|
214
|
+
metadata: { cancelled: true, reason: input.reason },
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
await (0, journal_1.appendEvent)({
|
|
218
|
+
runDir: input.runDir,
|
|
219
|
+
eventType: "EFFECT_CANCELLED",
|
|
220
|
+
event: {
|
|
221
|
+
effectId: input.effectId,
|
|
222
|
+
reason: input.reason,
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
return ok({ resultRef });
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
230
|
+
return fail("INTERNAL_ERROR", msg);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async function apiBatchCommitEffects(input) {
|
|
234
|
+
try {
|
|
235
|
+
if (!input.runDir) {
|
|
236
|
+
return fail("INVALID_INPUT", "runDir must be a non-empty string");
|
|
237
|
+
}
|
|
238
|
+
if (!Array.isArray(input.effects)) {
|
|
239
|
+
return fail("INVALID_INPUT", "effects must be an array");
|
|
240
|
+
}
|
|
241
|
+
if (input.effects.length === 0) {
|
|
242
|
+
return fail("INVALID_INPUT", "effects array must not be empty");
|
|
243
|
+
}
|
|
244
|
+
const results = [];
|
|
245
|
+
for (const entry of input.effects) {
|
|
246
|
+
try {
|
|
247
|
+
const commitResult = await (0, lock_1.withRunLock)(input.runDir, "api:batchCommitEffect", async () => {
|
|
248
|
+
// Load journal to find the effect metadata
|
|
249
|
+
const events = await (0, journal_1.loadJournal)(input.runDir);
|
|
250
|
+
const requestedEvent = events.find((e) => e.type === "EFFECT_REQUESTED" && e.data.effectId === entry.effectId);
|
|
251
|
+
if (!requestedEvent) {
|
|
252
|
+
throw new Error(`Unknown effectId ${entry.effectId}`);
|
|
253
|
+
}
|
|
254
|
+
const eventData = requestedEvent.data;
|
|
255
|
+
const taskId = eventData.taskId ?? `task-${entry.effectId}`;
|
|
256
|
+
const invocationKey = eventData.invocationKey ?? `key-${entry.effectId}`;
|
|
257
|
+
// Check if already resolved
|
|
258
|
+
const alreadyResolved = events.some((e) => (e.type === "EFFECT_RESOLVED" || e.type === "EFFECT_CANCELLED") &&
|
|
259
|
+
e.data.effectId === entry.effectId);
|
|
260
|
+
if (alreadyResolved) {
|
|
261
|
+
throw new Error(`Effect ${entry.effectId} is already resolved`);
|
|
262
|
+
}
|
|
263
|
+
const resultPayload = entry.result.status === "ok"
|
|
264
|
+
? {
|
|
265
|
+
status: "ok",
|
|
266
|
+
result: entry.result.value,
|
|
267
|
+
stdout: entry.result.stdout,
|
|
268
|
+
stderr: entry.result.stderr,
|
|
269
|
+
stdoutRef: entry.result.stdoutRef,
|
|
270
|
+
stderrRef: entry.result.stderrRef,
|
|
271
|
+
startedAt: entry.result.startedAt,
|
|
272
|
+
finishedAt: entry.result.finishedAt,
|
|
273
|
+
metadata: entry.result.metadata,
|
|
274
|
+
}
|
|
275
|
+
: {
|
|
276
|
+
status: "error",
|
|
277
|
+
error: { name: "Error", message: entry.result.error ?? "Unknown error" },
|
|
278
|
+
stdout: entry.result.stdout,
|
|
279
|
+
stderr: entry.result.stderr,
|
|
280
|
+
stdoutRef: entry.result.stdoutRef,
|
|
281
|
+
stderrRef: entry.result.stderrRef,
|
|
282
|
+
startedAt: entry.result.startedAt,
|
|
283
|
+
finishedAt: entry.result.finishedAt,
|
|
284
|
+
metadata: entry.result.metadata,
|
|
285
|
+
};
|
|
286
|
+
const { resultRef, stdoutRef, stderrRef } = await (0, serializer_1.serializeAndWriteTaskResult)({
|
|
287
|
+
runDir: input.runDir,
|
|
288
|
+
effectId: entry.effectId,
|
|
289
|
+
taskId,
|
|
290
|
+
invocationKey,
|
|
291
|
+
payload: resultPayload,
|
|
292
|
+
});
|
|
293
|
+
await (0, journal_1.appendEvent)({
|
|
294
|
+
runDir: input.runDir,
|
|
295
|
+
eventType: "EFFECT_RESOLVED",
|
|
296
|
+
event: {
|
|
297
|
+
effectId: entry.effectId,
|
|
298
|
+
status: entry.result.status,
|
|
299
|
+
resultRef,
|
|
300
|
+
stdoutRef: stdoutRef ?? undefined,
|
|
301
|
+
stderrRef: stderrRef ?? undefined,
|
|
302
|
+
startedAt: resultPayload.startedAt,
|
|
303
|
+
finishedAt: resultPayload.finishedAt,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
return { resultRef };
|
|
307
|
+
});
|
|
308
|
+
results.push({
|
|
309
|
+
effectId: entry.effectId,
|
|
310
|
+
ok: true,
|
|
311
|
+
resultRef: commitResult.resultRef,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
316
|
+
results.push({
|
|
317
|
+
effectId: entry.effectId,
|
|
318
|
+
ok: false,
|
|
319
|
+
error: msg,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return ok({ results });
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
327
|
+
return fail("INTERNAL_ERROR", msg);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { apiCreateRun, apiIterate, apiCommitEffect, apiRunStatus, apiRunEvents, } from "./runs";
|
|
2
|
+
export type { ApiResult, ApiCreateRunInput, ApiIterateOutput, RunStatusOutput, RunEventsOutput, } from "./runs";
|
|
3
|
+
export { apiListEffects, apiShowEffect, apiCancelEffect, apiBatchCommitEffects, } from "./effects";
|
|
4
|
+
export type { ListEffectsInput, ListEffectsOutput, EffectSummary, ShowEffectInput, ShowEffectOutput, CancelEffectInput, CancelEffectOutput, BatchCommitEffectEntry, BatchCommitEffectsInput, BatchCommitEffectResult, BatchCommitEffectsOutput, } from "./effects";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiBatchCommitEffects = exports.apiCancelEffect = exports.apiShowEffect = exports.apiListEffects = exports.apiRunEvents = exports.apiRunStatus = exports.apiCommitEffect = exports.apiIterate = exports.apiCreateRun = void 0;
|
|
4
|
+
var runs_1 = require("./runs");
|
|
5
|
+
Object.defineProperty(exports, "apiCreateRun", { enumerable: true, get: function () { return runs_1.apiCreateRun; } });
|
|
6
|
+
Object.defineProperty(exports, "apiIterate", { enumerable: true, get: function () { return runs_1.apiIterate; } });
|
|
7
|
+
Object.defineProperty(exports, "apiCommitEffect", { enumerable: true, get: function () { return runs_1.apiCommitEffect; } });
|
|
8
|
+
Object.defineProperty(exports, "apiRunStatus", { enumerable: true, get: function () { return runs_1.apiRunStatus; } });
|
|
9
|
+
Object.defineProperty(exports, "apiRunEvents", { enumerable: true, get: function () { return runs_1.apiRunEvents; } });
|
|
10
|
+
var effects_1 = require("./effects");
|
|
11
|
+
Object.defineProperty(exports, "apiListEffects", { enumerable: true, get: function () { return effects_1.apiListEffects; } });
|
|
12
|
+
Object.defineProperty(exports, "apiShowEffect", { enumerable: true, get: function () { return effects_1.apiShowEffect; } });
|
|
13
|
+
Object.defineProperty(exports, "apiCancelEffect", { enumerable: true, get: function () { return effects_1.apiCancelEffect; } });
|
|
14
|
+
Object.defineProperty(exports, "apiBatchCommitEffects", { enumerable: true, get: function () { return effects_1.apiBatchCommitEffects; } });
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GAP-JSON-001: Programmatic API for run lifecycle.
|
|
3
|
+
*
|
|
4
|
+
* Thin typed wrappers over existing runtime functions with validation,
|
|
5
|
+
* error handling, and ApiResult envelopes. These functions never throw.
|
|
6
|
+
*/
|
|
7
|
+
import type { EffectAction, IterationResult } from "../runtime/types";
|
|
8
|
+
import type { JsonRecord } from "../storage/types";
|
|
9
|
+
export type ApiResult<T> = {
|
|
10
|
+
ok: true;
|
|
11
|
+
data: T;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
error: {
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export interface ApiCreateRunInput {
|
|
20
|
+
processId: string;
|
|
21
|
+
entrypoint: string;
|
|
22
|
+
runsDir: string;
|
|
23
|
+
inputs?: unknown;
|
|
24
|
+
prompt?: string;
|
|
25
|
+
harness?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ApiIterateOutput {
|
|
28
|
+
status: IterationResult["status"];
|
|
29
|
+
output?: unknown;
|
|
30
|
+
error?: unknown;
|
|
31
|
+
nextActions?: EffectAction[];
|
|
32
|
+
metadata?: unknown;
|
|
33
|
+
}
|
|
34
|
+
export interface RunStatusOutput {
|
|
35
|
+
state: "created" | "running" | "waiting" | "completed" | "failed";
|
|
36
|
+
processId: string;
|
|
37
|
+
runId: string;
|
|
38
|
+
pendingEffects: Array<{
|
|
39
|
+
effectId: string;
|
|
40
|
+
kind?: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
export interface RunEventsOutput {
|
|
44
|
+
events: Array<{
|
|
45
|
+
seq: number;
|
|
46
|
+
type: string;
|
|
47
|
+
recordedAt: string;
|
|
48
|
+
data: JsonRecord;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
export declare function apiCreateRun(input: ApiCreateRunInput): Promise<ApiResult<{
|
|
52
|
+
runId: string;
|
|
53
|
+
runDir: string;
|
|
54
|
+
}>>;
|
|
55
|
+
export declare function apiIterate(input: {
|
|
56
|
+
runDir: string;
|
|
57
|
+
}): Promise<ApiResult<ApiIterateOutput>>;
|
|
58
|
+
export declare function apiCommitEffect(input: {
|
|
59
|
+
runDir: string;
|
|
60
|
+
effectId: string;
|
|
61
|
+
result: {
|
|
62
|
+
status: "ok" | "error";
|
|
63
|
+
value?: unknown;
|
|
64
|
+
error?: string;
|
|
65
|
+
stdout?: string;
|
|
66
|
+
stderr?: string;
|
|
67
|
+
stdoutRef?: string;
|
|
68
|
+
stderrRef?: string;
|
|
69
|
+
startedAt?: string;
|
|
70
|
+
finishedAt?: string;
|
|
71
|
+
metadata?: JsonRecord;
|
|
72
|
+
};
|
|
73
|
+
}): Promise<ApiResult<{
|
|
74
|
+
resultRef: string;
|
|
75
|
+
}>>;
|
|
76
|
+
export declare function apiRunStatus(input: {
|
|
77
|
+
runId: string;
|
|
78
|
+
runsDir: string;
|
|
79
|
+
}): Promise<ApiResult<RunStatusOutput>>;
|
|
80
|
+
export declare function apiRunEvents(input: {
|
|
81
|
+
runId: string;
|
|
82
|
+
runsDir: string;
|
|
83
|
+
limit?: number;
|
|
84
|
+
filterType?: string;
|
|
85
|
+
}): Promise<ApiResult<RunEventsOutput>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