@cjhyy/code-shell 0.3.0 → 0.5.0-rc.2
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 +75 -0
- package/dist/cli.js +2 -0
- package/dist/index.d.ts +1 -68
- package/dist/index.js +1 -1
- package/package.json +25 -73
- package/dist/agent/coordinator.d.ts +0 -49
- package/dist/anthropic-DJXVKFMJ.js +0 -1
- package/dist/arena/arena.d.ts +0 -43
- package/dist/arena/context/context-tools.d.ts +0 -16
- package/dist/arena/detect-mode.d.ts +0 -20
- package/dist/arena/digest-builder.d.ts +0 -25
- package/dist/arena/index.d.ts +0 -29
- package/dist/arena/index.js +0 -1
- package/dist/arena/iterate/convergence.d.ts +0 -25
- package/dist/arena/iterate/formats/index.d.ts +0 -22
- package/dist/arena/iterate/index.d.ts +0 -11
- package/dist/arena/iterate/iterative-arena.d.ts +0 -23
- package/dist/arena/iterate/parse.d.ts +0 -42
- package/dist/arena/iterate/phases/argue.d.ts +0 -22
- package/dist/arena/iterate/phases/revise.d.ts +0 -16
- package/dist/arena/iterate/phases/tournament.d.ts +0 -34
- package/dist/arena/iterate/tools/web-tools.d.ts +0 -13
- package/dist/arena/iterate/types.d.ts +0 -152
- package/dist/arena/ledger.d.ts +0 -47
- package/dist/arena/lenses/architecture.d.ts +0 -5
- package/dist/arena/lenses/engineering.d.ts +0 -5
- package/dist/arena/lenses/general.d.ts +0 -5
- package/dist/arena/lenses/index.d.ts +0 -16
- package/dist/arena/lenses/product.d.ts +0 -5
- package/dist/arena/model-presets.d.ts +0 -23
- package/dist/arena/phases/adjudication.d.ts +0 -24
- package/dist/arena/phases/build-consensus.d.ts +0 -29
- package/dist/arena/phases/claim-registry.d.ts +0 -26
- package/dist/arena/phases/cross-review.d.ts +0 -45
- package/dist/arena/phases/debate-rounds.d.ts +0 -27
- package/dist/arena/phases/participant-research.d.ts +0 -38
- package/dist/arena/phases/planning-detail-expansion.d.ts +0 -38
- package/dist/arena/planner.d.ts +0 -27
- package/dist/arena/providers/docs.d.ts +0 -6
- package/dist/arena/providers/git.d.ts +0 -8
- package/dist/arena/providers/index.d.ts +0 -32
- package/dist/arena/providers/none.d.ts +0 -7
- package/dist/arena/providers/repo.d.ts +0 -6
- package/dist/arena/render/session.d.ts +0 -17
- package/dist/arena/render/terminal.d.ts +0 -33
- package/dist/arena/strategies/discussion.d.ts +0 -25
- package/dist/arena/strategies/index.d.ts +0 -15
- package/dist/arena/strategies/language-wrapper.d.ts +0 -17
- package/dist/arena/strategies/lens-wrapper.d.ts +0 -16
- package/dist/arena/strategies/planning.d.ts +0 -30
- package/dist/arena/strategies/review.d.ts +0 -26
- package/dist/arena/strategies/utils.d.ts +0 -39
- package/dist/arena/tools/selector.d.ts +0 -17
- package/dist/arena/transitions.d.ts +0 -48
- package/dist/arena/types.d.ts +0 -508
- package/dist/arena-MRBATZFD.js +0 -3
- package/dist/bootstrap/setup.d.ts +0 -14
- package/dist/bootstrap/state.d.ts +0 -160
- package/dist/bwrap-PVZMLHZR.js +0 -2
- package/dist/chunk-2OD6VR4N.js +0 -2
- package/dist/chunk-3QP5BQ3L.js +0 -1
- package/dist/chunk-5QIVXFCT.js +0 -1
- package/dist/chunk-AFMP73YP.js +0 -2
- package/dist/chunk-D3TVASD2.js +0 -4
- package/dist/chunk-DI26OUIU.js +0 -2
- package/dist/chunk-FU7AHZNN.js +0 -1
- package/dist/chunk-FZXY554D.js +0 -2
- package/dist/chunk-GGVAOPI7.js +0 -1
- package/dist/chunk-GKAQH2DG.js +0 -2
- package/dist/chunk-GYNO4R7R.js +0 -2
- package/dist/chunk-K4HILJ6G.js +0 -251
- package/dist/chunk-M7VU4YVY.js +0 -49
- package/dist/chunk-MLCTC53I.js +0 -1
- package/dist/chunk-O5HFCH2U.js +0 -1
- package/dist/chunk-OWBYLMDD.js +0 -1
- package/dist/chunk-P6JSTIFM.js +0 -1
- package/dist/chunk-QTWU7UNA.js +0 -5
- package/dist/chunk-SKIX2M5Z.js +0 -4
- package/dist/chunk-SNFAPSLA.js +0 -1
- package/dist/chunk-SV7H4FKT.js +0 -3
- package/dist/chunk-T222K6IV.js +0 -18
- package/dist/chunk-TKJA6W36.js +0 -3
- package/dist/chunk-WI6FSWGU.js +0 -1
- package/dist/chunk-WONQHE4P.js +0 -641
- package/dist/chunk-X2S7ASQ2.js +0 -1
- package/dist/chunk-Z5HKHAO7.js +0 -336
- package/dist/cli/commands/arena.d.ts +0 -29
- package/dist/cli/commands/builtin/advanced-commands.d.ts +0 -5
- package/dist/cli/commands/builtin/core-commands.d.ts +0 -5
- package/dist/cli/commands/builtin/export-md.d.ts +0 -19
- package/dist/cli/commands/builtin/extra-commands.d.ts +0 -6
- package/dist/cli/commands/builtin/git-commands.d.ts +0 -5
- package/dist/cli/commands/builtin/init/detect.d.ts +0 -25
- package/dist/cli/commands/builtin/init/index.d.ts +0 -19
- package/dist/cli/commands/builtin/more-commands.d.ts +0 -5
- package/dist/cli/commands/builtin/permissions-command.d.ts +0 -5
- package/dist/cli/commands/builtin/plugin-commands-registration.d.ts +0 -12
- package/dist/cli/commands/builtin/plugin-handler.d.ts +0 -6
- package/dist/cli/commands/builtin/utility-commands.d.ts +0 -5
- package/dist/cli/commands/registry.d.ts +0 -79
- package/dist/cli/commands/repl.d.ts +0 -21
- package/dist/cli/commands/run.d.ts +0 -21
- package/dist/cli/commands/runs.d.ts +0 -14
- package/dist/cli/cost-tracker.d.ts +0 -63
- package/dist/cli/exit.d.ts +0 -12
- package/dist/cli/input/ndjson-reader.d.ts +0 -31
- package/dist/cli/input-compiler.d.ts +0 -5
- package/dist/cli/main.d.ts +0 -5
- package/dist/cli/main.js +0 -415
- package/dist/cli/migrate-models.d.ts +0 -45
- package/dist/cli/onboarding.d.ts +0 -189
- package/dist/cli/output/renderer.d.ts +0 -28
- package/dist/cli/output/terminal-ui.d.ts +0 -50
- package/dist/cli/updater.d.ts +0 -65
- package/dist/client-base-GSFXPP2Y.js +0 -1
- package/dist/compaction-L3Y6NG4N.js +0 -1
- package/dist/context/compaction.d.ts +0 -116
- package/dist/context/manager.d.ts +0 -145
- package/dist/context/token-counter.d.ts +0 -27
- package/dist/context/tool-result-storage.d.ts +0 -96
- package/dist/cron/scheduler.d.ts +0 -34
- package/dist/data/openrouter-models.d.ts +0 -35
- package/dist/data/openrouter-sync.d.ts +0 -16
- package/dist/data/static-catalogs.d.ts +0 -25
- package/dist/devtools-FBX4HVVY.js +0 -1
- package/dist/engine/cost-store.d.ts +0 -22
- package/dist/engine/engine.d.ts +0 -236
- package/dist/engine/model-facade.d.ts +0 -24
- package/dist/engine/query.d.ts +0 -50
- package/dist/engine/streaming-tool-queue.d.ts +0 -34
- package/dist/engine/token-budget.d.ts +0 -22
- package/dist/engine/tool-summary.d.ts +0 -13
- package/dist/engine/turn-loop.d.ts +0 -122
- package/dist/engine/turn-state.d.ts +0 -20
- package/dist/exceptions.d.ts +0 -44
- package/dist/export-md-U72T7NW7.js +0 -22
- package/dist/file-history-7FQFEQOL.js +0 -1
- package/dist/git/utils.d.ts +0 -35
- package/dist/git/worktree.d.ts +0 -36
- package/dist/hooks/events.d.ts +0 -114
- package/dist/hooks/inject.d.ts +0 -19
- package/dist/hooks/registry.d.ts +0 -15
- package/dist/hooks/shell-runner.d.ts +0 -45
- package/dist/llm/api-key-sanitize.d.ts +0 -22
- package/dist/llm/capabilities/index.d.ts +0 -20
- package/dist/llm/capabilities/rules.d.ts +0 -26
- package/dist/llm/capabilities/types.d.ts +0 -108
- package/dist/llm/client-base.d.ts +0 -29
- package/dist/llm/client-factory.d.ts +0 -10
- package/dist/llm/model-cache.d.ts +0 -21
- package/dist/llm/model-fetcher.d.ts +0 -29
- package/dist/llm/model-pool.d.ts +0 -84
- package/dist/llm/provider-catalog.d.ts +0 -32
- package/dist/llm/provider-kinds.d.ts +0 -21
- package/dist/llm/providers/anthropic.d.ts +0 -19
- package/dist/llm/providers/openai.d.ts +0 -64
- package/dist/llm/retry.d.ts +0 -12
- package/dist/llm/stream-watchdog.d.ts +0 -42
- package/dist/llm/token-counter.d.ts +0 -17
- package/dist/llm/types.d.ts +0 -37
- package/dist/logging/logger.d.ts +0 -102
- package/dist/logging/session-recorder.d.ts +0 -90
- package/dist/lsp/client.d.ts +0 -41
- package/dist/lsp/manager.d.ts +0 -40
- package/dist/lsp/servers.d.ts +0 -16
- package/dist/manager-4XKLZHKE.js +0 -1
- package/dist/mcp-manager-3JGHEJO3.js +0 -1
- package/dist/memory-BNI4WEWL.js +0 -1
- package/dist/model-cache-HEDXI7UJ.js +0 -1
- package/dist/model-fetcher-X5W5EASG.js +0 -1
- package/dist/native-ts/yoga-layout/enums.d.ts +0 -117
- package/dist/native-ts/yoga-layout/index.d.ts +0 -270
- package/dist/off-7SDVMMXW.js +0 -1
- package/dist/openai-OQ6LLN5J.js +0 -1
- package/dist/openrouter-models-ZT4R2AE3.js +0 -1
- package/dist/openrouter-sync-ARMVWY7S.js +0 -1
- package/dist/plugin-handler-GJISMH5Q.js +0 -11
- package/dist/plugins/gitOps.d.ts +0 -23
- package/dist/plugins/installedPlugins.d.ts +0 -15
- package/dist/plugins/knownMarketplaces.d.ts +0 -10
- package/dist/plugins/loadPluginHooks.d.ts +0 -52
- package/dist/plugins/marketplaceManager.d.ts +0 -49
- package/dist/plugins/parseMarketplaceInput.d.ts +0 -16
- package/dist/plugins/pluginCommandHook.d.ts +0 -54
- package/dist/plugins/pluginCommandsLoader.d.ts +0 -25
- package/dist/plugins/pluginInstaller.d.ts +0 -36
- package/dist/plugins/schemas.d.ts +0 -9
- package/dist/plugins/types.d.ts +0 -75
- package/dist/plugins/varRewrite.d.ts +0 -42
- package/dist/preset/index.d.ts +0 -60
- package/dist/product/define.d.ts +0 -60
- package/dist/product/index.d.ts +0 -5
- package/dist/product/index.js +0 -1
- package/dist/product/types.d.ts +0 -111
- package/dist/prompt/composer.d.ts +0 -42
- package/dist/prompt/instruction-scanner.d.ts +0 -54
- package/dist/prompt/section-cache.d.ts +0 -15
- package/dist/prompt/section-loader.d.ts +0 -26
- package/dist/protocol/client.d.ts +0 -64
- package/dist/protocol/helpers.d.ts +0 -42
- package/dist/protocol/index.d.ts +0 -4
- package/dist/protocol/server.d.ts +0 -51
- package/dist/protocol/transport.d.ts +0 -36
- package/dist/protocol/types.d.ts +0 -192
- package/dist/react-compiler-runtime-shim.d.ts +0 -1
- package/dist/remote/bridge.d.ts +0 -37
- package/dist/render/Ansi.d.ts +0 -10
- package/dist/render/bidi.d.ts +0 -15
- package/dist/render/clearTerminal.d.ts +0 -19
- package/dist/render/colorize.d.ts +0 -16
- package/dist/render/components/AlternateScreen.d.ts +0 -21
- package/dist/render/components/App.d.ts +0 -71
- package/dist/render/components/AppContext.d.ts +0 -11
- package/dist/render/components/Box.d.ts +0 -49
- package/dist/render/components/Button.d.ts +0 -36
- package/dist/render/components/ClockContext.d.ts +0 -9
- package/dist/render/components/CursorDeclarationContext.d.ts +0 -22
- package/dist/render/components/ErrorOverview.d.ts +0 -5
- package/dist/render/components/Link.d.ts +0 -7
- package/dist/render/components/Newline.d.ts +0 -12
- package/dist/render/components/NoSelect.d.ts +0 -19
- package/dist/render/components/RawAnsi.d.ts +0 -16
- package/dist/render/components/ScrollBox.d.ts +0 -78
- package/dist/render/components/Spacer.d.ts +0 -5
- package/dist/render/components/Static.d.ts +0 -23
- package/dist/render/components/StdinContext.d.ts +0 -27
- package/dist/render/components/TerminalFocusContext.d.ts +0 -10
- package/dist/render/components/TerminalSizeContext.d.ts +0 -5
- package/dist/render/components/Text.d.ts +0 -55
- package/dist/render/constants.d.ts +0 -1
- package/dist/render/cursor.d.ts +0 -8
- package/dist/render/devtools.d.ts +0 -9
- package/dist/render/dom.d.ts +0 -77
- package/dist/render/events/click-event.d.ts +0 -31
- package/dist/render/events/dispatcher.d.ts +0 -40
- package/dist/render/events/emitter.d.ts +0 -5
- package/dist/render/events/event-handlers.d.ts +0 -46
- package/dist/render/events/event.d.ts +0 -5
- package/dist/render/events/focus-event.d.ts +0 -13
- package/dist/render/events/input-event.d.ts +0 -30
- package/dist/render/events/keyboard-event.d.ts +0 -19
- package/dist/render/events/paste-event.d.ts +0 -8
- package/dist/render/events/resize-event.d.ts +0 -9
- package/dist/render/events/terminal-event.d.ts +0 -54
- package/dist/render/events/terminal-focus-event.d.ts +0 -13
- package/dist/render/focus.d.ts +0 -43
- package/dist/render/frame.d.ts +0 -95
- package/dist/render/get-max-width.d.ts +0 -17
- package/dist/render/hit-test.d.ts +0 -33
- package/dist/render/hooks/use-animation-frame.d.ts +0 -26
- package/dist/render/hooks/use-app.d.ts +0 -5
- package/dist/render/hooks/use-declared-cursor.d.ts +0 -26
- package/dist/render/hooks/use-input.d.ts +0 -37
- package/dist/render/hooks/use-interval.d.ts +0 -18
- package/dist/render/hooks/use-search-highlight.d.ts +0 -30
- package/dist/render/hooks/use-selection.d.ts +0 -39
- package/dist/render/hooks/use-stdin.d.ts +0 -5
- package/dist/render/hooks/use-tab-status.d.ts +0 -13
- package/dist/render/hooks/use-terminal-focus.d.ts +0 -10
- package/dist/render/hooks/use-terminal-title.d.ts +0 -12
- package/dist/render/hooks/use-terminal-viewport.d.ts +0 -29
- package/dist/render/index.d.ts +0 -30
- package/dist/render/ink.d.ts +0 -391
- package/dist/render/instances.d.ts +0 -3
- package/dist/render/layout/engine.d.ts +0 -2
- package/dist/render/layout/geometry.d.ts +0 -30
- package/dist/render/layout/node.d.ts +0 -125
- package/dist/render/layout/yoga.d.ts +0 -56
- package/dist/render/line-width-cache.d.ts +0 -1
- package/dist/render/log-update.d.ts +0 -28
- package/dist/render/measure-element.d.ts +0 -16
- package/dist/render/measure-text.d.ts +0 -6
- package/dist/render/node-cache.d.ts +0 -20
- package/dist/render/optimizer.d.ts +0 -15
- package/dist/render/output.d.ts +0 -119
- package/dist/render/parse-keypress.d.ts +0 -111
- package/dist/render/reconciler.d.ts +0 -11
- package/dist/render/render-border.d.ts +0 -24
- package/dist/render/render-node-to-output.d.ts +0 -45
- package/dist/render/render-to-screen.d.ts +0 -46
- package/dist/render/renderer.d.ts +0 -14
- package/dist/render/root.d.ts +0 -74
- package/dist/render/screen.d.ts +0 -269
- package/dist/render/searchHighlight.d.ts +0 -20
- package/dist/render/selection.d.ts +0 -229
- package/dist/render/squash-text-nodes.d.ts +0 -22
- package/dist/render/stringWidth.d.ts +0 -1
- package/dist/render/styles.d.ts +0 -306
- package/dist/render/supports-hyperlinks.d.ts +0 -13
- package/dist/render/tabstops.d.ts +0 -1
- package/dist/render/terminal-focus-state.d.ts +0 -6
- package/dist/render/terminal-querier.d.ts +0 -129
- package/dist/render/terminal.d.ts +0 -46
- package/dist/render/termio/ansi.d.ts +0 -65
- package/dist/render/termio/csi.d.ts +0 -165
- package/dist/render/termio/dec.d.ts +0 -37
- package/dist/render/termio/esc.d.ts +0 -12
- package/dist/render/termio/osc.d.ts +0 -173
- package/dist/render/termio/parser.d.ts +0 -35
- package/dist/render/termio/sgr.d.ts +0 -8
- package/dist/render/termio/tokenize.d.ts +0 -45
- package/dist/render/termio/types.d.ts +0 -190
- package/dist/render/termio.d.ts +0 -24
- package/dist/render/useTerminalNotification.d.ts +0 -28
- package/dist/render/warn.d.ts +0 -1
- package/dist/render/widest-line.d.ts +0 -1
- package/dist/render/wrap-text.d.ts +0 -2
- package/dist/render/wrapAnsi.d.ts +0 -7
- package/dist/run/ArtifactTracker.d.ts +0 -38
- package/dist/run/CheckpointWriter.d.ts +0 -53
- package/dist/run/EngineRunner.d.ts +0 -72
- package/dist/run/Evaluator.d.ts +0 -56
- package/dist/run/FileRunStore.d.ts +0 -39
- package/dist/run/Heartbeat.d.ts +0 -54
- package/dist/run/RunApprovalBackend.d.ts +0 -53
- package/dist/run/RunLock.d.ts +0 -40
- package/dist/run/RunManager.d.ts +0 -82
- package/dist/run/RunQueue.d.ts +0 -27
- package/dist/run/RunStore.d.ts +0 -25
- package/dist/run/factory.d.ts +0 -63
- package/dist/run/index.d.ts +0 -17
- package/dist/run/index.js +0 -1
- package/dist/run/types.d.ts +0 -136
- package/dist/seatbelt-L54CNI2Y.js +0 -37
- package/dist/services/analytics.d.ts +0 -29
- package/dist/services/auto-dream.d.ts +0 -35
- package/dist/services/diagnostics.d.ts +0 -41
- package/dist/services/extract-memories.d.ts +0 -27
- package/dist/services/index.d.ts +0 -11
- package/dist/services/memory-orchestrator.d.ts +0 -39
- package/dist/services/notifier.d.ts +0 -25
- package/dist/services/oauth.d.ts +0 -27
- package/dist/services/session-memory.d.ts +0 -37
- package/dist/session/file-history.d.ts +0 -41
- package/dist/session/memory.d.ts +0 -65
- package/dist/session/session-manager.d.ts +0 -28
- package/dist/session/transcript.d.ts +0 -39
- package/dist/session-manager-AGWS5SMJ.js +0 -1
- package/dist/settings/manager.d.ts +0 -36
- package/dist/settings/schema.d.ts +0 -1123
- package/dist/skills/frontmatter.d.ts +0 -13
- package/dist/skills/index.d.ts +0 -7
- package/dist/skills/scanner.d.ts +0 -20
- package/dist/tool-summary-HJX6RHG4.js +0 -2
- package/dist/tool-system/builtin/agent-notifications.d.ts +0 -55
- package/dist/tool-system/builtin/agent-registry.d.ts +0 -67
- package/dist/tool-system/builtin/agent-transcript-translator.d.ts +0 -22
- package/dist/tool-system/builtin/agent.d.ts +0 -16
- package/dist/tool-system/builtin/apply-patch/applier.d.ts +0 -26
- package/dist/tool-system/builtin/apply-patch/index.d.ts +0 -19
- package/dist/tool-system/builtin/apply-patch/parser.d.ts +0 -17
- package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +0 -18
- package/dist/tool-system/builtin/apply-patch/types.d.ts +0 -49
- package/dist/tool-system/builtin/arena.d.ts +0 -31
- package/dist/tool-system/builtin/ask-user.d.ts +0 -20
- package/dist/tool-system/builtin/bash.d.ts +0 -12
- package/dist/tool-system/builtin/brief.d.ts +0 -6
- package/dist/tool-system/builtin/config.d.ts +0 -6
- package/dist/tool-system/builtin/cron.d.ts +0 -10
- package/dist/tool-system/builtin/edit.d.ts +0 -6
- package/dist/tool-system/builtin/file-cache.d.ts +0 -11
- package/dist/tool-system/builtin/glob.d.ts +0 -6
- package/dist/tool-system/builtin/grep.d.ts +0 -6
- package/dist/tool-system/builtin/index.d.ts +0 -20
- package/dist/tool-system/builtin/lsp.d.ts +0 -6
- package/dist/tool-system/builtin/mcp-tools.d.ts +0 -10
- package/dist/tool-system/builtin/notebook-edit.d.ts +0 -6
- package/dist/tool-system/builtin/plan.d.ts +0 -18
- package/dist/tool-system/builtin/powershell.d.ts +0 -6
- package/dist/tool-system/builtin/read.d.ts +0 -6
- package/dist/tool-system/builtin/remote-trigger.d.ts +0 -6
- package/dist/tool-system/builtin/repl.d.ts +0 -6
- package/dist/tool-system/builtin/send-message.d.ts +0 -6
- package/dist/tool-system/builtin/skill-prompt.d.ts +0 -7
- package/dist/tool-system/builtin/skill.d.ts +0 -8
- package/dist/tool-system/builtin/sleep.d.ts +0 -6
- package/dist/tool-system/builtin/task.d.ts +0 -51
- package/dist/tool-system/builtin/tool-search.d.ts +0 -11
- package/dist/tool-system/builtin/web-fetch.d.ts +0 -6
- package/dist/tool-system/builtin/web-search.d.ts +0 -6
- package/dist/tool-system/builtin/worktree.d.ts +0 -10
- package/dist/tool-system/builtin/write.d.ts +0 -6
- package/dist/tool-system/context.d.ts +0 -133
- package/dist/tool-system/executor.d.ts +0 -49
- package/dist/tool-system/investigation-guard.d.ts +0 -46
- package/dist/tool-system/mcp-manager.d.ts +0 -50
- package/dist/tool-system/permission.d.ts +0 -104
- package/dist/tool-system/registry.d.ts +0 -32
- package/dist/tool-system/sandbox/bwrap.d.ts +0 -13
- package/dist/tool-system/sandbox/index.d.ts +0 -78
- package/dist/tool-system/sandbox/off.d.ts +0 -2
- package/dist/tool-system/sandbox/seatbelt.d.ts +0 -18
- package/dist/tool-system/task-guard.d.ts +0 -30
- package/dist/tool-system/validation.d.ts +0 -5
- package/dist/types.d.ts +0 -356
- package/dist/ui/App.d.ts +0 -14
- package/dist/ui/components/AgentBlock.d.ts +0 -35
- package/dist/ui/components/AgentDock.d.ts +0 -36
- package/dist/ui/components/AskUserPrompt.d.ts +0 -14
- package/dist/ui/components/BabyHand.d.ts +0 -1
- package/dist/ui/components/Banner.d.ts +0 -8
- package/dist/ui/components/CodeBlock.d.ts +0 -7
- package/dist/ui/components/CommandInput.d.ts +0 -24
- package/dist/ui/components/ContextUsageBar.d.ts +0 -7
- package/dist/ui/components/DiffLine.d.ts +0 -33
- package/dist/ui/components/DiffView.d.ts +0 -6
- package/dist/ui/components/DogLogo.d.ts +0 -1
- package/dist/ui/components/FullscreenLayout.d.ts +0 -51
- package/dist/ui/components/KunHead.d.ts +0 -1
- package/dist/ui/components/KunLogo.d.ts +0 -1
- package/dist/ui/components/MessageContent.d.ts +0 -26
- package/dist/ui/components/MessageRow.d.ts +0 -54
- package/dist/ui/components/ModelManager.d.ts +0 -68
- package/dist/ui/components/ModelSelector.d.ts +0 -10
- package/dist/ui/components/OnboardingPrompt.d.ts +0 -16
- package/dist/ui/components/PermissionDialog.d.ts +0 -8
- package/dist/ui/components/PermissionPrompt.d.ts +0 -11
- package/dist/ui/components/ProviderModelFlow.d.ts +0 -58
- package/dist/ui/components/ScrollView.d.ts +0 -34
- package/dist/ui/components/SessionPicker.d.ts +0 -16
- package/dist/ui/components/Spinner.d.ts +0 -8
- package/dist/ui/components/SpinnerWithVerb.d.ts +0 -19
- package/dist/ui/components/StatusLine.d.ts +0 -28
- package/dist/ui/components/StructuredDiff.d.ts +0 -8
- package/dist/ui/components/TaskList.d.ts +0 -6
- package/dist/ui/components/TextInput.d.ts +0 -17
- package/dist/ui/components/ThemedBox.d.ts +0 -19
- package/dist/ui/components/ThemedText.d.ts +0 -26
- package/dist/ui/components/ToolCall.d.ts +0 -28
- package/dist/ui/components/UpdateBanner.d.ts +0 -1
- package/dist/ui/components/VirtualMessageList.d.ts +0 -43
- package/dist/ui/components/WelcomeTips.d.ts +0 -5
- package/dist/ui/dev-seed.d.ts +0 -1
- package/dist/ui/fullscreen-mode.d.ts +0 -9
- package/dist/ui/hooks/useCostSummary.d.ts +0 -1
- package/dist/ui/hooks/useVirtualScroll.d.ts +0 -101
- package/dist/ui/index.d.ts +0 -12
- package/dist/ui/input-history.d.ts +0 -61
- package/dist/ui/onboarding-runner.d.ts +0 -2
- package/dist/ui/perf-probes.d.ts +0 -22
- package/dist/ui/query-guard.d.ts +0 -35
- package/dist/ui/slice-anchor.d.ts +0 -44
- package/dist/ui/store.d.ts +0 -108
- package/dist/ui/terminal-renderer.d.ts +0 -45
- package/dist/ui/theme.d.ts +0 -36
- package/dist/ui/vim-mode.d.ts +0 -25
- package/dist/updater-OCNU2K2Z.js +0 -1
- package/dist/utils/debug.d.ts +0 -41
- package/dist/utils/earlyInput.d.ts +0 -43
- package/dist/utils/env.d.ts +0 -24
- package/dist/utils/envUtils.d.ts +0 -51
- package/dist/utils/execFileNoThrow.d.ts +0 -39
- package/dist/utils/format.d.ts +0 -44
- package/dist/utils/fullscreen.d.ts +0 -47
- package/dist/utils/intl.d.ts +0 -22
- package/dist/utils/lockfile.d.ts +0 -15
- package/dist/utils/semver.d.ts +0 -6
- package/dist/utils/sliceAnsi.d.ts +0 -12
- package/dist/utils/systemTheme.d.ts +0 -40
- package/dist/utils/task-sanitizer.d.ts +0 -6
- package/dist/utils/theme.d.ts +0 -91
- package/dist/utils/toolDisplay.d.ts +0 -31
- package/dist/utils/truncate.d.ts +0 -40
- package/dist/voice/index.d.ts +0 -35
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Progress } from './terminal.js';
|
|
2
|
-
type WriteRaw = (data: string) => void;
|
|
3
|
-
export declare const TerminalWriteContext: import("react").Context<WriteRaw | null>;
|
|
4
|
-
export declare const TerminalWriteProvider: import("react").Provider<WriteRaw | null>;
|
|
5
|
-
export type TerminalNotification = {
|
|
6
|
-
notifyITerm2: (opts: {
|
|
7
|
-
message: string;
|
|
8
|
-
title?: string;
|
|
9
|
-
}) => void;
|
|
10
|
-
notifyKitty: (opts: {
|
|
11
|
-
message: string;
|
|
12
|
-
title: string;
|
|
13
|
-
id: number;
|
|
14
|
-
}) => void;
|
|
15
|
-
notifyGhostty: (opts: {
|
|
16
|
-
message: string;
|
|
17
|
-
title: string;
|
|
18
|
-
}) => void;
|
|
19
|
-
notifyBell: () => void;
|
|
20
|
-
/**
|
|
21
|
-
* Report progress to the terminal via OSC 9;4 sequences.
|
|
22
|
-
* Supported terminals: ConEmu, Ghostty 1.2.0+, iTerm2 3.6.6+
|
|
23
|
-
* Pass state=null to clear progress.
|
|
24
|
-
*/
|
|
25
|
-
progress: (state: Progress['state'] | null, percentage?: number) => void;
|
|
26
|
-
};
|
|
27
|
-
export declare function useTerminalNotification(): TerminalNotification;
|
|
28
|
-
export {};
|
package/dist/render/warn.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function ifNotInteger(value: number | undefined, name: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function widestLine(string: string): number;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ArtifactTracker — records meaningful artifact refs during run execution.
|
|
3
|
-
*
|
|
4
|
-
* Listens to StreamEvents and identifies:
|
|
5
|
-
* - Files written or edited (Write / Edit tool results)
|
|
6
|
-
* - Files created by Bash commands (mkdir, touch, cp, git commit, etc.)
|
|
7
|
-
* - Structured outputs (e.g., generated configs, test results)
|
|
8
|
-
*
|
|
9
|
-
* Design constraint (§14):
|
|
10
|
-
* - Only record artifacts valuable for recovery, display, evaluation, or audit
|
|
11
|
-
* - Do NOT record every Read or every tool output
|
|
12
|
-
* - Judgment: file writes are artifacts, reads are not
|
|
13
|
-
*/
|
|
14
|
-
import type { StreamEvent } from "../types.js";
|
|
15
|
-
import type { RunStore } from "./RunStore.js";
|
|
16
|
-
export interface ArtifactTrackerConfig {
|
|
17
|
-
runId: string;
|
|
18
|
-
store: RunStore;
|
|
19
|
-
}
|
|
20
|
-
export declare class ArtifactTracker {
|
|
21
|
-
private readonly config;
|
|
22
|
-
private readonly pendingCalls;
|
|
23
|
-
private readonly recordedPaths;
|
|
24
|
-
constructor(config: ArtifactTrackerConfig);
|
|
25
|
-
/**
|
|
26
|
-
* Feed a StreamEvent to the tracker.
|
|
27
|
-
*/
|
|
28
|
-
onStreamEvent(event: StreamEvent): Promise<void>;
|
|
29
|
-
/** Get all recorded artifact paths. */
|
|
30
|
-
getRecordedPaths(): string[];
|
|
31
|
-
private processToolResult;
|
|
32
|
-
private recordFileArtifact;
|
|
33
|
-
/**
|
|
34
|
-
* Extract artifact refs from Bash commands.
|
|
35
|
-
* Only track commands that clearly produce files.
|
|
36
|
-
*/
|
|
37
|
-
private extractBashArtifacts;
|
|
38
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CheckpointWriter — extracts structured checkpoints from Engine execution.
|
|
3
|
-
*
|
|
4
|
-
* Checkpoint sources (per design doc §12):
|
|
5
|
-
* 1. Lifecycle — run started, resumed, completed (handled by RunManager)
|
|
6
|
-
* 2. Phase boundary — detected from assistant messages via keyword heuristics
|
|
7
|
-
* 3. Waiting — entering waiting_input / waiting_approval (handled by RunManager)
|
|
8
|
-
* 4. Final — terminal state (handled by RunManager)
|
|
9
|
-
*
|
|
10
|
-
* This writer handles #2 (phase boundary) and periodic turn-based checkpoints.
|
|
11
|
-
* It listens to StreamEvents and writes checkpoints to RunStore when triggered.
|
|
12
|
-
*
|
|
13
|
-
* Design constraints (§12.1):
|
|
14
|
-
* - Do NOT checkpoint every tool call
|
|
15
|
-
* - Do NOT depend on model real-time summarization
|
|
16
|
-
* - Checkpoint = "state summary + pointers", not "full text copy"
|
|
17
|
-
*/
|
|
18
|
-
import type { StreamEvent } from "../types.js";
|
|
19
|
-
import type { RunStore } from "./RunStore.js";
|
|
20
|
-
export interface CheckpointWriterConfig {
|
|
21
|
-
runId: string;
|
|
22
|
-
objective: string;
|
|
23
|
-
store: RunStore;
|
|
24
|
-
/** Write a periodic checkpoint every N turns. 0 = disabled. Default: 10 */
|
|
25
|
-
turnInterval?: number;
|
|
26
|
-
}
|
|
27
|
-
export declare class CheckpointWriter {
|
|
28
|
-
private readonly config;
|
|
29
|
-
private readonly turnInterval;
|
|
30
|
-
private currentTurn;
|
|
31
|
-
private lastCheckpointTurn;
|
|
32
|
-
private touchedTools;
|
|
33
|
-
private lastAssistantText;
|
|
34
|
-
private sessionId;
|
|
35
|
-
private detectedPhases;
|
|
36
|
-
constructor(config: CheckpointWriterConfig);
|
|
37
|
-
/**
|
|
38
|
-
* Feed a StreamEvent to the writer. Called for every event during execution.
|
|
39
|
-
*/
|
|
40
|
-
onStreamEvent(event: StreamEvent): Promise<void>;
|
|
41
|
-
/** Set the linked session ID (called once known after Engine.run starts). */
|
|
42
|
-
setSessionId(id: string): void;
|
|
43
|
-
/** Get accumulated touched tools for use in final checkpoint. */
|
|
44
|
-
getTouchedTools(): string[];
|
|
45
|
-
private checkPhaseBoundary;
|
|
46
|
-
private writePeriodicCheckpoint;
|
|
47
|
-
private writeCheckpoint;
|
|
48
|
-
/**
|
|
49
|
-
* Extract a short summary from assistant text.
|
|
50
|
-
* Takes the first ~300 chars, truncated at sentence boundary.
|
|
51
|
-
*/
|
|
52
|
-
private extractSummary;
|
|
53
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EngineRunner — bridges a RunSnapshot into an Engine.run() call.
|
|
3
|
-
*
|
|
4
|
-
* Responsibilities:
|
|
5
|
-
* - Prepare EngineConfig from run snapshot
|
|
6
|
-
* - Start or resume a session
|
|
7
|
-
* - Inject run-aware approval backend and askUser adapter
|
|
8
|
-
* - Forward stream events to RunManager
|
|
9
|
-
* - Return execution result (does NOT manage run state transitions)
|
|
10
|
-
*/
|
|
11
|
-
import { type EngineConfig, type EngineHookConfig } from "../engine/engine.js";
|
|
12
|
-
import type { LLMConfig, RegisteredTool } from "../types.js";
|
|
13
|
-
import type { RunSnapshot, RunExecutionContext, RunExecutionResult } from "./types.js";
|
|
14
|
-
import { type RunLifecycleHooks } from "./RunApprovalBackend.js";
|
|
15
|
-
/**
|
|
16
|
-
* Handles returned from execute() to allow RunManager to resolve
|
|
17
|
-
* pending approvals and user input while Engine is suspended.
|
|
18
|
-
*/
|
|
19
|
-
export interface RunExecutionHandle {
|
|
20
|
-
/** Resolve a pending tool approval. Returns false if nothing was pending. */
|
|
21
|
-
resolveApproval: (approved: boolean, reason?: string) => boolean;
|
|
22
|
-
/** Resolve a pending user input request. Returns false if nothing was pending. */
|
|
23
|
-
resolveInput: (answer: string) => boolean;
|
|
24
|
-
/** Check if there's a pending approval. */
|
|
25
|
-
hasPendingApproval: () => boolean;
|
|
26
|
-
/** Check if there's a pending input request. */
|
|
27
|
-
hasPendingInput: () => boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The contract for executing a Run. RunManager delegates to this interface.
|
|
31
|
-
*
|
|
32
|
-
* EngineRunner is the built-in implementation (calls CodeShell's LLM Engine).
|
|
33
|
-
* External services can implement this to plug in any execution backend:
|
|
34
|
-
* - CI/CD pipeline runners
|
|
35
|
-
* - ETL orchestrators
|
|
36
|
-
* - Multi-agent coordinators
|
|
37
|
-
* - Custom API call chains
|
|
38
|
-
*/
|
|
39
|
-
export interface RunExecutor {
|
|
40
|
-
execute(run: RunSnapshot, context: RunExecutionContext, lifecycleHooks?: RunLifecycleHooks, onHandleReady?: (handle: RunExecutionHandle) => void): Promise<{
|
|
41
|
-
result: RunExecutionResult;
|
|
42
|
-
handle: RunExecutionHandle;
|
|
43
|
-
}>;
|
|
44
|
-
}
|
|
45
|
-
export interface CustomToolEntry {
|
|
46
|
-
definition: RegisteredTool;
|
|
47
|
-
execute: (args: Record<string, unknown>) => Promise<string>;
|
|
48
|
-
}
|
|
49
|
-
export interface EngineRunnerConfig {
|
|
50
|
-
llm: LLMConfig;
|
|
51
|
-
maxTurns?: number;
|
|
52
|
-
maxContextTokens?: number;
|
|
53
|
-
sessionStorageDir?: string;
|
|
54
|
-
permissionMode?: EngineConfig["permissionMode"];
|
|
55
|
-
enabledBuiltinTools?: string[];
|
|
56
|
-
disabledBuiltinTools?: string[];
|
|
57
|
-
customSystemPrompt?: string;
|
|
58
|
-
appendSystemPrompt?: string;
|
|
59
|
-
mcpServers?: EngineConfig["mcpServers"];
|
|
60
|
-
/** Custom tools registered by the product adapter. */
|
|
61
|
-
customTools?: CustomToolEntry[];
|
|
62
|
-
/** Hooks registered into each Engine instance before run execution. */
|
|
63
|
-
hooks?: EngineHookConfig[];
|
|
64
|
-
}
|
|
65
|
-
export declare class EngineRunner implements RunExecutor {
|
|
66
|
-
private readonly config;
|
|
67
|
-
constructor(config: EngineRunnerConfig);
|
|
68
|
-
execute(run: RunSnapshot, context: RunExecutionContext, lifecycleHooks?: RunLifecycleHooks, onHandleReady?: (handle: RunExecutionHandle) => void): Promise<{
|
|
69
|
-
result: RunExecutionResult;
|
|
70
|
-
handle: RunExecutionHandle;
|
|
71
|
-
}>;
|
|
72
|
-
}
|
package/dist/run/Evaluator.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evaluator — contract for run completion evaluation.
|
|
3
|
-
*
|
|
4
|
-
* An evaluator inspects a completed (or about-to-complete) run and produces
|
|
5
|
-
* a structured verdict. This enables:
|
|
6
|
-
* - Automated quality gates before marking a run as "completed"
|
|
7
|
-
* - Product-specific acceptance criteria
|
|
8
|
-
* - CI/CD integration for agent-driven workflows
|
|
9
|
-
*
|
|
10
|
-
* The evaluator is intentionally decoupled from the Engine:
|
|
11
|
-
* - It runs AFTER the Engine finishes, not during the turn loop
|
|
12
|
-
* - It receives the run snapshot + final checkpoint, not raw messages
|
|
13
|
-
* - Its result is written into the checkpoint's `evaluator` field
|
|
14
|
-
*
|
|
15
|
-
* Phase 5 provides the contract; concrete implementations are domain-specific.
|
|
16
|
-
*/
|
|
17
|
-
import type { RunSnapshot, RunCheckpoint, RunArtifactRef } from "./types.js";
|
|
18
|
-
export type EvaluatorVerdict = "passed" | "failed" | "warning";
|
|
19
|
-
export interface EvaluatorResult {
|
|
20
|
-
verdict: EvaluatorVerdict;
|
|
21
|
-
findings: string[];
|
|
22
|
-
/** Optional structured data for programmatic consumption. */
|
|
23
|
-
details?: Record<string, unknown>;
|
|
24
|
-
}
|
|
25
|
-
export interface EvaluatorContext {
|
|
26
|
-
run: RunSnapshot;
|
|
27
|
-
checkpoint: RunCheckpoint;
|
|
28
|
-
artifacts: RunArtifactRef[];
|
|
29
|
-
}
|
|
30
|
-
export interface Evaluator {
|
|
31
|
-
/** Human-readable name for logging and display. */
|
|
32
|
-
readonly name: string;
|
|
33
|
-
/**
|
|
34
|
-
* Evaluate a run's final state.
|
|
35
|
-
* Should NOT have side effects beyond reading files/state.
|
|
36
|
-
* Must be safe to call multiple times on the same run.
|
|
37
|
-
*/
|
|
38
|
-
evaluate(context: EvaluatorContext): Promise<EvaluatorResult>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Default evaluator that always passes. Used when no evaluator is configured.
|
|
42
|
-
*/
|
|
43
|
-
export declare class NoopEvaluator implements Evaluator {
|
|
44
|
-
readonly name = "noop";
|
|
45
|
-
evaluate(): Promise<EvaluatorResult>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Runs multiple evaluators and merges their results.
|
|
49
|
-
* The overall verdict is the worst across all evaluators.
|
|
50
|
-
*/
|
|
51
|
-
export declare class CompositeEvaluator implements Evaluator {
|
|
52
|
-
readonly name: string;
|
|
53
|
-
private readonly evaluators;
|
|
54
|
-
constructor(evaluators: Evaluator[]);
|
|
55
|
-
evaluate(context: EvaluatorContext): Promise<EvaluatorResult>;
|
|
56
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FileRunStore — local filesystem implementation of RunStore.
|
|
3
|
-
*
|
|
4
|
-
* Layout:
|
|
5
|
-
* ~/.code-shell/runs/<runId>/
|
|
6
|
-
* run.json — current snapshot
|
|
7
|
-
* events.jsonl — append-only event log
|
|
8
|
-
* checkpoints/<id>.json — structured checkpoints
|
|
9
|
-
* approvals/<id>.json — approval records
|
|
10
|
-
* artifacts/refs.jsonl — artifact reference log
|
|
11
|
-
*/
|
|
12
|
-
import type { RunStore } from "./RunStore.js";
|
|
13
|
-
import type { RunSnapshot, RunEvent, RunCheckpoint, RunApproval, RunArtifactRef, ListRunsQuery } from "./types.js";
|
|
14
|
-
export declare class FileRunStore implements RunStore {
|
|
15
|
-
private readonly runsDir;
|
|
16
|
-
constructor(storageDir?: string);
|
|
17
|
-
private runDir;
|
|
18
|
-
private ensureRunDir;
|
|
19
|
-
private writeJson;
|
|
20
|
-
private readJson;
|
|
21
|
-
/** Serializes concurrent JSONL appends per file path. */
|
|
22
|
-
private readonly appendLocks;
|
|
23
|
-
private appendJsonl;
|
|
24
|
-
private readJsonl;
|
|
25
|
-
create(snapshot: RunSnapshot): Promise<void>;
|
|
26
|
-
update(snapshot: RunSnapshot): Promise<void>;
|
|
27
|
-
get(runId: string): Promise<RunSnapshot | null>;
|
|
28
|
-
list(query?: ListRunsQuery): Promise<RunSnapshot[]>;
|
|
29
|
-
delete(runId: string): Promise<void>;
|
|
30
|
-
appendEvent(event: RunEvent): Promise<void>;
|
|
31
|
-
listEvents(runId: string): Promise<RunEvent[]>;
|
|
32
|
-
saveCheckpoint(cp: RunCheckpoint): Promise<void>;
|
|
33
|
-
getLatestCheckpoint(runId: string): Promise<RunCheckpoint | null>;
|
|
34
|
-
saveApproval(approval: RunApproval): Promise<void>;
|
|
35
|
-
getApproval(runId: string, approvalId: string): Promise<RunApproval | null>;
|
|
36
|
-
getPendingApproval(runId: string): Promise<RunApproval | null>;
|
|
37
|
-
appendArtifactRef(ref: RunArtifactRef): Promise<void>;
|
|
38
|
-
listArtifactRefs(runId: string): Promise<RunArtifactRef[]>;
|
|
39
|
-
}
|
package/dist/run/Heartbeat.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Heartbeat — periodic timestamp writer for run liveness detection.
|
|
3
|
-
*
|
|
4
|
-
* While a run is executing, the heartbeat writes a timestamp file at regular
|
|
5
|
-
* intervals. Crash recovery uses this to determine if a "running" run is
|
|
6
|
-
* actually alive or if its process died without cleanup.
|
|
7
|
-
*
|
|
8
|
-
* File: ~/.code-shell/runs/<runId>/heartbeat
|
|
9
|
-
* Content: JSON { pid, timestamp, runId }
|
|
10
|
-
*/
|
|
11
|
-
export interface HeartbeatConfig {
|
|
12
|
-
runsDir?: string;
|
|
13
|
-
/** Heartbeat interval in ms. Default: 5_000 (5 seconds) */
|
|
14
|
-
intervalMs?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface HeartbeatData {
|
|
17
|
-
pid: number;
|
|
18
|
-
timestamp: number;
|
|
19
|
-
runId: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class Heartbeat {
|
|
22
|
-
private readonly runsDir;
|
|
23
|
-
private readonly intervalMs;
|
|
24
|
-
private timers;
|
|
25
|
-
constructor(config?: HeartbeatConfig);
|
|
26
|
-
/**
|
|
27
|
-
* Start heartbeat for a run. Writes immediately, then repeats on interval.
|
|
28
|
-
*/
|
|
29
|
-
start(runId: string): void;
|
|
30
|
-
/**
|
|
31
|
-
* Stop heartbeat for a run and remove the heartbeat file.
|
|
32
|
-
*/
|
|
33
|
-
stop(runId: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Stop all heartbeats.
|
|
36
|
-
*/
|
|
37
|
-
stopAll(): void;
|
|
38
|
-
/**
|
|
39
|
-
* Read the last heartbeat for a run. Returns null if no heartbeat exists.
|
|
40
|
-
*/
|
|
41
|
-
read(runId: string): HeartbeatData | null;
|
|
42
|
-
/**
|
|
43
|
-
* Check if a run's heartbeat is stale (older than threshold).
|
|
44
|
-
* Returns true if stale or missing, false if recent.
|
|
45
|
-
*/
|
|
46
|
-
isStale(runId: string, thresholdMs?: number): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Check if the process that wrote the heartbeat is still alive.
|
|
49
|
-
*/
|
|
50
|
-
isProcessAlive(runId: string): boolean;
|
|
51
|
-
private write;
|
|
52
|
-
private remove;
|
|
53
|
-
private filePath;
|
|
54
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RunApprovalBackend — bridges Engine's approval system into Run lifecycle.
|
|
3
|
-
*
|
|
4
|
-
* When Engine requests tool approval:
|
|
5
|
-
* 1. Creates a RunApproval record
|
|
6
|
-
* 2. Notifies RunManager to transition the run to waiting_approval
|
|
7
|
-
* 3. Suspends the Engine's promise until the user resumes the run
|
|
8
|
-
*
|
|
9
|
-
* Similarly for AskUser:
|
|
10
|
-
* 1. Notifies RunManager to transition the run to waiting_input
|
|
11
|
-
* 2. Suspends until the user provides input via resume
|
|
12
|
-
*/
|
|
13
|
-
import type { ApprovalRequest, ApprovalResult } from "../types.js";
|
|
14
|
-
import type { ApprovalBackend } from "../tool-system/permission.js";
|
|
15
|
-
import type { AskUserFn } from "../tool-system/builtin/ask-user.js";
|
|
16
|
-
export interface PendingApproval {
|
|
17
|
-
resolve: (result: ApprovalResult) => void;
|
|
18
|
-
request: ApprovalRequest;
|
|
19
|
-
}
|
|
20
|
-
export interface PendingInput {
|
|
21
|
-
resolve: (answer: string) => void;
|
|
22
|
-
question: string;
|
|
23
|
-
}
|
|
24
|
-
export interface RunLifecycleHooks {
|
|
25
|
-
onApprovalNeeded: (request: ApprovalRequest) => Promise<{
|
|
26
|
-
approvalId: string;
|
|
27
|
-
}>;
|
|
28
|
-
onInputNeeded: (question: string) => Promise<void>;
|
|
29
|
-
onApprovalResolved?: (approvalId: string, result: ApprovalResult) => void;
|
|
30
|
-
onInputResolved?: (answer: string) => void;
|
|
31
|
-
}
|
|
32
|
-
export declare class RunApprovalBackend implements ApprovalBackend {
|
|
33
|
-
private pendingApproval;
|
|
34
|
-
private hooks;
|
|
35
|
-
setHooks(hooks: RunLifecycleHooks): void;
|
|
36
|
-
/** Max time (ms) to wait for approval before auto-rejecting. Default: 24h */
|
|
37
|
-
private timeoutMs;
|
|
38
|
-
setTimeout(ms: number): void;
|
|
39
|
-
requestApproval(request: ApprovalRequest): Promise<ApprovalResult>;
|
|
40
|
-
/**
|
|
41
|
-
* Called by RunManager when the user resumes with an approval decision.
|
|
42
|
-
*/
|
|
43
|
-
resolveApproval(result: ApprovalResult): boolean;
|
|
44
|
-
hasPendingApproval(): boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Creates an AskUserFn that suspends the run when user input is needed.
|
|
48
|
-
*/
|
|
49
|
-
export declare function createRunAskUserFn(hooks: RunLifecycleHooks): {
|
|
50
|
-
askUserFn: AskUserFn;
|
|
51
|
-
resolveInput: (answer: string) => boolean;
|
|
52
|
-
hasPendingInput: () => boolean;
|
|
53
|
-
};
|
package/dist/run/RunLock.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RunLock — file-based locking to prevent multiple workers from executing
|
|
3
|
-
* the same run concurrently.
|
|
4
|
-
*
|
|
5
|
-
* Uses proper-lockfile (via lazy wrapper) for cross-process safe locking.
|
|
6
|
-
* Each run gets a lock on its run.json file.
|
|
7
|
-
*/
|
|
8
|
-
export interface RunLockConfig {
|
|
9
|
-
/** Base directory for runs. Default: ~/.code-shell/runs */
|
|
10
|
-
runsDir?: string;
|
|
11
|
-
/** Stale lock timeout in ms. Default: 60_000 (1 minute) */
|
|
12
|
-
staleMs?: number;
|
|
13
|
-
}
|
|
14
|
-
export declare class RunLock {
|
|
15
|
-
private readonly runsDir;
|
|
16
|
-
private readonly staleMs;
|
|
17
|
-
private readonly releaseFns;
|
|
18
|
-
constructor(config?: RunLockConfig);
|
|
19
|
-
/**
|
|
20
|
-
* Acquire a lock for a run. Returns true if acquired, false if already held.
|
|
21
|
-
*/
|
|
22
|
-
acquire(runId: string): Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* Release the lock for a run.
|
|
25
|
-
*/
|
|
26
|
-
release(runId: string): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Check if a run is currently locked by any process.
|
|
29
|
-
*/
|
|
30
|
-
isLocked(runId: string): Promise<boolean>;
|
|
31
|
-
/**
|
|
32
|
-
* Force-unlock a stale lock (e.g., after crash recovery).
|
|
33
|
-
*/
|
|
34
|
-
forceUnlock(runId: string): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Release all locks held by this instance.
|
|
37
|
-
*/
|
|
38
|
-
releaseAll(): Promise<void>;
|
|
39
|
-
private lockTarget;
|
|
40
|
-
}
|
package/dist/run/RunManager.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RunManager — the top-level coordinator for managed agent runs.
|
|
3
|
-
*
|
|
4
|
-
* It does NOT replace Engine. It wraps Engine.run() to provide:
|
|
5
|
-
* - Submit / queue / start / resume / cancel lifecycle
|
|
6
|
-
* - State machine validation
|
|
7
|
-
* - Event sourcing (append-only run events)
|
|
8
|
-
* - Checkpoint and approval coordination
|
|
9
|
-
* - Waiting states: waiting_input / waiting_approval with suspend/resume
|
|
10
|
-
* - Attach (live stream subscription)
|
|
11
|
-
* - Run locking, heartbeat, and crash recovery (Phase 4)
|
|
12
|
-
*/
|
|
13
|
-
import type { RunStore } from "./RunStore.js";
|
|
14
|
-
import { type EngineRunnerConfig, type RunExecutor } from "./EngineRunner.js";
|
|
15
|
-
import { type Evaluator } from "./Evaluator.js";
|
|
16
|
-
import type { RunSnapshot, RunEvent, SubmitRunInput, ResumeRunInput, ListRunsQuery, RunStreamCallback, DetachFn } from "./types.js";
|
|
17
|
-
export interface RunManagerConfig {
|
|
18
|
-
store: RunStore;
|
|
19
|
-
/**
|
|
20
|
-
* Execution backend. Two ways to provide:
|
|
21
|
-
* - `EngineRunnerConfig` object → creates built-in EngineRunner (calls LLM Engine)
|
|
22
|
-
* - `RunExecutor` instance → custom executor (any backend: CI/CD, ETL, etc.)
|
|
23
|
-
*/
|
|
24
|
-
executor: RunExecutor | EngineRunnerConfig;
|
|
25
|
-
concurrency?: number;
|
|
26
|
-
/** Base directory for runs (used by lock and heartbeat). */
|
|
27
|
-
runsDir?: string;
|
|
28
|
-
/** Heartbeat interval in ms. Default: 5000 */
|
|
29
|
-
heartbeatIntervalMs?: number;
|
|
30
|
-
/** Stale lock timeout in ms. Default: 60000 */
|
|
31
|
-
staleLockMs?: number;
|
|
32
|
-
/** Optional evaluator to run on completion. Default: NoopEvaluator */
|
|
33
|
-
evaluator?: Evaluator;
|
|
34
|
-
/** Tags applied to every submitted run unless already present. */
|
|
35
|
-
defaultTags?: string[];
|
|
36
|
-
/** Metadata merged into every submitted run. Submit input wins on conflicts. */
|
|
37
|
-
defaultMetadata?: Record<string, unknown>;
|
|
38
|
-
}
|
|
39
|
-
export declare class RunManager {
|
|
40
|
-
private readonly store;
|
|
41
|
-
private readonly queue;
|
|
42
|
-
private readonly runner;
|
|
43
|
-
private readonly lock;
|
|
44
|
-
private readonly heartbeat;
|
|
45
|
-
private readonly evaluator;
|
|
46
|
-
private readonly defaultTags;
|
|
47
|
-
private readonly defaultMetadata;
|
|
48
|
-
private readonly subscribers;
|
|
49
|
-
private readonly abortControllers;
|
|
50
|
-
/** Active execution handles — used to resolve pending approvals/input while Engine is suspended */
|
|
51
|
-
private readonly executionHandles;
|
|
52
|
-
constructor(config: RunManagerConfig);
|
|
53
|
-
submit(input: SubmitRunInput): Promise<RunSnapshot>;
|
|
54
|
-
start(runId: string): Promise<void>;
|
|
55
|
-
resume(runId: string, input?: ResumeRunInput): Promise<void>;
|
|
56
|
-
cancel(runId: string, reason?: string): Promise<void>;
|
|
57
|
-
get(runId: string): Promise<RunSnapshot | null>;
|
|
58
|
-
list(query?: ListRunsQuery): Promise<RunSnapshot[]>;
|
|
59
|
-
getEvents(runId: string): Promise<RunEvent[]>;
|
|
60
|
-
attach(runId: string, cb: RunStreamCallback): DetachFn;
|
|
61
|
-
/**
|
|
62
|
-
* Scan for runs stuck in "running" state and recover them.
|
|
63
|
-
*
|
|
64
|
-
* Call this on process startup. For each "running" run:
|
|
65
|
-
* - If heartbeat is stale AND process is dead → reset to "queued" or "blocked"
|
|
66
|
-
* - If heartbeat is recent OR process is alive → skip (still executing)
|
|
67
|
-
*
|
|
68
|
-
* Returns the IDs of recovered runs.
|
|
69
|
-
*/
|
|
70
|
-
recover(): Promise<string[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Graceful shutdown — stop all heartbeats and release all locks.
|
|
73
|
-
*/
|
|
74
|
-
shutdown(): Promise<void>;
|
|
75
|
-
private executeRun;
|
|
76
|
-
private handleApprovalNeeded;
|
|
77
|
-
private handleInputNeeded;
|
|
78
|
-
private transition;
|
|
79
|
-
private emitRunEvent;
|
|
80
|
-
private notifySubscribers;
|
|
81
|
-
private getOrThrow;
|
|
82
|
-
}
|
package/dist/run/RunQueue.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RunQueue — simple in-process FIFO queue with configurable concurrency.
|
|
3
|
-
*
|
|
4
|
-
* Phase 1: single-process, no persistence.
|
|
5
|
-
* The queue holds run IDs; the actual execution is delegated to a callback.
|
|
6
|
-
*/
|
|
7
|
-
export interface RunQueueConfig {
|
|
8
|
-
concurrency?: number;
|
|
9
|
-
}
|
|
10
|
-
export type RunQueueExecutor = (runId: string) => Promise<void>;
|
|
11
|
-
export declare class RunQueue {
|
|
12
|
-
private readonly concurrency;
|
|
13
|
-
private readonly pending;
|
|
14
|
-
private readonly active;
|
|
15
|
-
private executor;
|
|
16
|
-
private draining;
|
|
17
|
-
constructor(config?: RunQueueConfig);
|
|
18
|
-
setExecutor(fn: RunQueueExecutor): void;
|
|
19
|
-
enqueue(runId: string): void;
|
|
20
|
-
cancel(runId: string): boolean;
|
|
21
|
-
isActive(runId: string): boolean;
|
|
22
|
-
isPending(runId: string): boolean;
|
|
23
|
-
get activeCount(): number;
|
|
24
|
-
get pendingCount(): number;
|
|
25
|
-
private drain;
|
|
26
|
-
private processNext;
|
|
27
|
-
}
|
package/dist/run/RunStore.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RunStore — persistence interface for Run lifecycle data.
|
|
3
|
-
*
|
|
4
|
-
* Implementations must guarantee:
|
|
5
|
-
* - Snapshot writes are atomic (no partial state on crash)
|
|
6
|
-
* - Event appends are append-only and ordered
|
|
7
|
-
* - Checkpoint / approval reads return the latest version
|
|
8
|
-
*/
|
|
9
|
-
import type { RunSnapshot, RunEvent, RunCheckpoint, RunApproval, RunArtifactRef, ListRunsQuery } from "./types.js";
|
|
10
|
-
export interface RunStore {
|
|
11
|
-
create(snapshot: RunSnapshot): Promise<void>;
|
|
12
|
-
update(snapshot: RunSnapshot): Promise<void>;
|
|
13
|
-
get(runId: string): Promise<RunSnapshot | null>;
|
|
14
|
-
list(query?: ListRunsQuery): Promise<RunSnapshot[]>;
|
|
15
|
-
delete(runId: string): Promise<void>;
|
|
16
|
-
appendEvent(event: RunEvent): Promise<void>;
|
|
17
|
-
listEvents(runId: string): Promise<RunEvent[]>;
|
|
18
|
-
saveCheckpoint(cp: RunCheckpoint): Promise<void>;
|
|
19
|
-
getLatestCheckpoint(runId: string): Promise<RunCheckpoint | null>;
|
|
20
|
-
saveApproval(approval: RunApproval): Promise<void>;
|
|
21
|
-
getApproval(runId: string, approvalId: string): Promise<RunApproval | null>;
|
|
22
|
-
getPendingApproval(runId: string): Promise<RunApproval | null>;
|
|
23
|
-
appendArtifactRef(ref: RunArtifactRef): Promise<void>;
|
|
24
|
-
listArtifactRefs(runId: string): Promise<RunArtifactRef[]>;
|
|
25
|
-
}
|
package/dist/run/factory.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK convenience factory — create a RunManager with sensible defaults.
|
|
3
|
-
*
|
|
4
|
-
* Usage from an external repo:
|
|
5
|
-
* ```ts
|
|
6
|
-
* import { createRunManager } from "code-shell";
|
|
7
|
-
*
|
|
8
|
-
* const manager = createRunManager({
|
|
9
|
-
* llm: {
|
|
10
|
-
* provider: "openai",
|
|
11
|
-
* model: "anthropic/claude-sonnet-4",
|
|
12
|
-
* apiKey: process.env.OPENROUTER_API_KEY,
|
|
13
|
-
* baseUrl: "https://openrouter.ai/api/v1",
|
|
14
|
-
* },
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* const run = await manager.submit({ objective: "Refactor the auth module" });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
import type { LLMConfig, PermissionMode } from "../types.js";
|
|
21
|
-
import type { EngineConfig, EngineHookConfig } from "../engine/engine.js";
|
|
22
|
-
import type { Evaluator } from "./Evaluator.js";
|
|
23
|
-
import { RunManager } from "./RunManager.js";
|
|
24
|
-
export interface CreateRunManagerOptions {
|
|
25
|
-
/** LLM configuration (required). */
|
|
26
|
-
llm: LLMConfig;
|
|
27
|
-
/** Working directory. Default: process.cwd() */
|
|
28
|
-
cwd?: string;
|
|
29
|
-
/** Max turns per engine execution. Default: 30 */
|
|
30
|
-
maxTurns?: number;
|
|
31
|
-
/** Max context tokens. Default: 200_000 */
|
|
32
|
-
maxContextTokens?: number;
|
|
33
|
-
/** Permission mode. Default: "acceptEdits" */
|
|
34
|
-
permissionMode?: PermissionMode;
|
|
35
|
-
/** Queue concurrency. Default: 1 */
|
|
36
|
-
concurrency?: number;
|
|
37
|
-
/** Custom storage directory for runs. Default: ~/.code-shell/runs */
|
|
38
|
-
runsDir?: string;
|
|
39
|
-
/** Custom storage directory for sessions. Default: ~/.code-shell/sessions */
|
|
40
|
-
sessionStorageDir?: string;
|
|
41
|
-
/** MCP servers to connect. */
|
|
42
|
-
mcpServers?: EngineConfig["mcpServers"];
|
|
43
|
-
/** Enabled builtin tools (add to preset defaults). */
|
|
44
|
-
enabledBuiltinTools?: string[];
|
|
45
|
-
/** Disabled builtin tools (remove from preset defaults). */
|
|
46
|
-
disabledBuiltinTools?: string[];
|
|
47
|
-
/** Custom system prompt (replaces preset prompt). */
|
|
48
|
-
customSystemPrompt?: string;
|
|
49
|
-
/** Append to system prompt (added after preset prompt). */
|
|
50
|
-
appendSystemPrompt?: string;
|
|
51
|
-
/** Optional evaluator for run completion. */
|
|
52
|
-
evaluator?: Evaluator;
|
|
53
|
-
/** Hooks registered into each Engine instance before run execution. */
|
|
54
|
-
hooks?: EngineHookConfig[];
|
|
55
|
-
/** Tags applied to every submitted run unless already present. */
|
|
56
|
-
defaultTags?: string[];
|
|
57
|
-
/** Metadata merged into every submitted run. Submit input wins on conflicts. */
|
|
58
|
-
defaultMetadata?: Record<string, unknown>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Create a fully configured RunManager with one call.
|
|
62
|
-
*/
|
|
63
|
-
export declare function createRunManager(options: CreateRunManagerOptions): RunManager;
|