@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,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn loop — state machine implementation.
|
|
3
|
-
*
|
|
4
|
-
* Following Claude Code's po_() pattern:
|
|
5
|
-
* pre_check → model_call → post_check → tool_exec → context_mgmt → hook_notify → next turn
|
|
6
|
-
*/
|
|
7
|
-
import type { Message, StreamCallback, TerminalReason } from "../types.js";
|
|
8
|
-
import { ModelFacade } from "./model-facade.js";
|
|
9
|
-
import { ToolExecutor } from "../tool-system/executor.js";
|
|
10
|
-
import { ContextManager } from "../context/manager.js";
|
|
11
|
-
import { HookRegistry } from "../hooks/registry.js";
|
|
12
|
-
import { Transcript } from "../session/transcript.js";
|
|
13
|
-
export interface TurnLoopConfig {
|
|
14
|
-
maxTurns: number;
|
|
15
|
-
maxToolCallsPerTurn: number;
|
|
16
|
-
tokenBudget?: number;
|
|
17
|
-
onStream?: StreamCallback;
|
|
18
|
-
signal?: AbortSignal;
|
|
19
|
-
/**
|
|
20
|
-
* Fired after each turn boundary is recorded. Lets the engine flush an
|
|
21
|
-
* up-to-date snapshot to state.json mid-run, so a long run doesn't leave
|
|
22
|
-
* the on-disk turnCount/status frozen at the last completion.
|
|
23
|
-
*/
|
|
24
|
-
onTurnBoundary?: (turnCount: number) => void;
|
|
25
|
-
}
|
|
26
|
-
export interface CtxOverheadStore {
|
|
27
|
-
/** Tokens for system prompt + tool defs, derived from provider's promptTokens. */
|
|
28
|
-
get(sid: string): number;
|
|
29
|
-
set(sid: string, tokens: number): void;
|
|
30
|
-
}
|
|
31
|
-
export interface TurnLoopDeps {
|
|
32
|
-
model: ModelFacade;
|
|
33
|
-
toolExecutor: ToolExecutor;
|
|
34
|
-
contextManager: ContextManager;
|
|
35
|
-
hooks: HookRegistry;
|
|
36
|
-
transcript: Transcript;
|
|
37
|
-
systemPrompt: string;
|
|
38
|
-
tools: import("../types.js").ToolDefinition[];
|
|
39
|
-
/** Per-sid overhead cache so the ctx bar doesn't drop between turns. */
|
|
40
|
-
ctxOverheadStore: CtxOverheadStore;
|
|
41
|
-
/** Current session id, used to key the overhead store. */
|
|
42
|
-
sessionId: string;
|
|
43
|
-
/**
|
|
44
|
-
* Carried into every hook emit's `ctx.data.isSubAgent` so handlers can
|
|
45
|
-
* skip noisy injections for spawned children. Set by Engine from
|
|
46
|
-
* EngineConfig.isSubAgent (engine.ts:119).
|
|
47
|
-
*/
|
|
48
|
-
isSubAgent?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Reads/clears the most recent compaction event emitted by
|
|
51
|
-
* ContextManager since the last call. Returns `null` if no compaction
|
|
52
|
-
* fired since the previous check. The Engine wires this up so the
|
|
53
|
-
* turn loop can `post_compact` emit + inject hook messages without
|
|
54
|
-
* the ContextManager itself depending on HookRegistry.
|
|
55
|
-
*/
|
|
56
|
-
consumePendingCompactInfo?: () => {
|
|
57
|
-
strategy: string;
|
|
58
|
-
before: number;
|
|
59
|
-
after: number;
|
|
60
|
-
} | null;
|
|
61
|
-
}
|
|
62
|
-
export interface TurnLoopResult {
|
|
63
|
-
text: string;
|
|
64
|
-
reason: TerminalReason;
|
|
65
|
-
messages: Message[];
|
|
66
|
-
}
|
|
67
|
-
export declare class TurnLoop {
|
|
68
|
-
private readonly deps;
|
|
69
|
-
private readonly config;
|
|
70
|
-
private turnCount;
|
|
71
|
-
/** Tool IDs already emitted as tool_use_start during streaming (to avoid duplicates). */
|
|
72
|
-
private streamedToolIds;
|
|
73
|
-
/**
|
|
74
|
-
* Turn-scoped child logger set at the top of each loop iteration. Class
|
|
75
|
-
* methods invoked inside the iteration (callModelWithFallback,
|
|
76
|
-
* executeToolCall, ...) read it instead of using the root `logger`, so
|
|
77
|
-
* every line they write is tagged with the current turn/turnId.
|
|
78
|
-
*/
|
|
79
|
-
private currentTurnLog;
|
|
80
|
-
/** Last emitted ctx token estimate; used to skip no-op usage_update events. */
|
|
81
|
-
private lastCtxEmit;
|
|
82
|
-
constructor(deps: TurnLoopDeps, config: TurnLoopConfig);
|
|
83
|
-
/**
|
|
84
|
-
* Emit a lifecycle hook with isSubAgent + sessionId auto-merged into data.
|
|
85
|
-
* Returns the aggregated HookResult so callers can consume `messages` /
|
|
86
|
-
* `decision` / `stop`. Use this instead of `deps.hooks.emit` directly so
|
|
87
|
-
* every emit carries the same context envelope.
|
|
88
|
-
*/
|
|
89
|
-
private emitHook;
|
|
90
|
-
/**
|
|
91
|
-
* Emit a usage_update so the UI ctx bar reflects current message-array
|
|
92
|
-
* size. Called at every point where messages mutate: after a tool_result
|
|
93
|
-
* is appended, after context management (which may shrink), and after an
|
|
94
|
-
* LLM response (which we also feed through with the provider's authoritative
|
|
95
|
-
* promptTokens to override our estimate).
|
|
96
|
-
*/
|
|
97
|
-
private emitCtxFromMessages;
|
|
98
|
-
private emitCtxFromUsage;
|
|
99
|
-
/**
|
|
100
|
-
* Run the multi-turn agent loop until completion.
|
|
101
|
-
*/
|
|
102
|
-
run(initialMessages: Message[]): Promise<TurnLoopResult>;
|
|
103
|
-
/**
|
|
104
|
-
* Call model with streaming fallback.
|
|
105
|
-
* If streaming fails, emit tombstone and retry non-streaming.
|
|
106
|
-
*/
|
|
107
|
-
private callModelWithFallback;
|
|
108
|
-
/**
|
|
109
|
-
* Execute tools with overlap: start concurrent-safe (read-only) tools
|
|
110
|
-
* immediately in parallel while sequential (write) tools run one-by-one.
|
|
111
|
-
* Both groups run simultaneously — we don't wait for safe tools to finish
|
|
112
|
-
* before starting unsafe ones.
|
|
113
|
-
*/
|
|
114
|
-
private executeToolsOverlapped;
|
|
115
|
-
get currentTurn(): number;
|
|
116
|
-
/**
|
|
117
|
-
* Generate synthetic error tool_results for any dangling tool_use blocks
|
|
118
|
-
* that never received results (e.g. because the API call failed).
|
|
119
|
-
* Prevents model confusion on the next turn.
|
|
120
|
-
*/
|
|
121
|
-
private patchOrphanedToolUses;
|
|
122
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn loop state definitions.
|
|
3
|
-
*/
|
|
4
|
-
import type { TurnPhase, ToolCall, LLMResponse, TerminalReason } from "../types.js";
|
|
5
|
-
export interface TurnState {
|
|
6
|
-
phase: TurnPhase;
|
|
7
|
-
turnNumber: number;
|
|
8
|
-
modelResponse?: LLMResponse;
|
|
9
|
-
toolCalls?: ToolCall[];
|
|
10
|
-
finalText?: string;
|
|
11
|
-
error?: Error;
|
|
12
|
-
terminalReason?: TerminalReason;
|
|
13
|
-
}
|
|
14
|
-
export declare function initialTurnState(turnNumber: number): TurnState;
|
|
15
|
-
/**
|
|
16
|
-
* Short, human-readable turn correlation ID. Stamped on every log entry
|
|
17
|
-
* written for the duration of one turn so `jq 'select(.turnId == "abc123")'`
|
|
18
|
-
* pulls a single turn's whole timeline out of the daily log file.
|
|
19
|
-
*/
|
|
20
|
-
export declare function newTurnId(): string;
|
package/dist/exceptions.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom exception hierarchy for the code-shell framework.
|
|
3
|
-
*/
|
|
4
|
-
export declare class FrameworkError extends Error {
|
|
5
|
-
readonly details?: Record<string, unknown> | undefined;
|
|
6
|
-
constructor(message: string, details?: Record<string, unknown> | undefined);
|
|
7
|
-
}
|
|
8
|
-
export declare class LLMError extends FrameworkError {
|
|
9
|
-
readonly provider?: string | undefined;
|
|
10
|
-
constructor(message: string, provider?: string | undefined, details?: Record<string, unknown>);
|
|
11
|
-
}
|
|
12
|
-
export declare class LLMRateLimitError extends LLMError {
|
|
13
|
-
readonly retryAfter?: number | undefined;
|
|
14
|
-
constructor(provider: string, retryAfter?: number | undefined);
|
|
15
|
-
}
|
|
16
|
-
export declare class ContextLimitError extends LLMError {
|
|
17
|
-
constructor(provider?: string);
|
|
18
|
-
}
|
|
19
|
-
export declare class ToolError extends FrameworkError {
|
|
20
|
-
readonly toolName?: string | undefined;
|
|
21
|
-
constructor(message: string, toolName?: string | undefined, details?: Record<string, unknown>);
|
|
22
|
-
}
|
|
23
|
-
export declare class ToolNotFoundError extends ToolError {
|
|
24
|
-
constructor(toolName: string);
|
|
25
|
-
}
|
|
26
|
-
export declare class ToolExecutionError extends ToolError {
|
|
27
|
-
constructor(toolName: string, cause: string);
|
|
28
|
-
}
|
|
29
|
-
export declare class ToolTimeoutError extends ToolError {
|
|
30
|
-
readonly timeoutMs: number;
|
|
31
|
-
constructor(toolName: string, timeoutMs: number);
|
|
32
|
-
}
|
|
33
|
-
export declare class PermissionDeniedError extends FrameworkError {
|
|
34
|
-
constructor(toolName: string, reason?: string);
|
|
35
|
-
}
|
|
36
|
-
export declare class SessionError extends FrameworkError {
|
|
37
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
38
|
-
}
|
|
39
|
-
export declare class TranscriptError extends FrameworkError {
|
|
40
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
41
|
-
}
|
|
42
|
-
export declare class ConfigError extends FrameworkError {
|
|
43
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
44
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {h as h$1,a}from'./chunk-3QP5BQ3L.js';import {join,basename}from'path';h$1();var h=2e3,_=800,w=/^[A-Za-z0-9_-]+$/;function R(n,r,e){if(!w.test(n))throw new Error(`renderSessionMarkdown: invalid sessionId ${JSON.stringify(n)} \u2014 expected [A-Za-z0-9_-]+`);let t=[],s=[],u=`session-${n}-attachments`;t.push(`# Session ${n}`),t.push("");let i=0;for(let d of r){let o=d;if(o.type!=="message")continue;i+=1;let $=o.data?.role??"unknown",a=o.data?.content;if(t.push(`## turn ${i} \xB7 ${$}`),t.push(""),typeof a=="string"){t.push(a),t.push("");continue}if(!Array.isArray(a)){t.push("```json"),t.push(JSON.stringify(a,null,2)),t.push("```"),t.push("");continue}let l=0;for(let m of a){l+=1;let g=I(m,{turnNumber:i,itemIdx:l,sidecarDir:u,cwd:e,sidecars:s});g&&(t.push(g),t.push(""));}}return {md:t.join(`
|
|
2
|
-
`),sidecars:s}}a(R,"renderSessionMarkdown");function I(n,r){let e=n.type;if(e==="reasoning"){let t=n.reasoningContent??"";return y("reasoning",t)}if(e==="text")return n.text??"";if(e==="tool_use"){let t=n.name??"?",s=JSON.stringify(n.input??{},null,2)??"{}",u=`**\u{1F6E0} tool_use** \xB7 \`${t}\``;return s.length<=_?`${u}
|
|
3
|
-
|
|
4
|
-
\`\`\`json
|
|
5
|
-
${s}
|
|
6
|
-
\`\`\``:y(`${t} args (${s.length} bytes)`,s,"json")}if(e==="tool_result"){let t=n.tool_use_id??n.id??"?",s=N(n.content);if(s.length<=h)return `**\u25C0 tool_result** \xB7 ${t}
|
|
7
|
-
|
|
8
|
-
\`\`\`
|
|
9
|
-
${s}
|
|
10
|
-
\`\`\``;let u=`t${r.turnNumber}-i${r.itemIdx}-${t.slice(0,12)}.txt`,i=join(r.cwd,r.sidecarDir,u);r.sidecars.push({path:i,content:s});let d=s.slice(0,h),o=join(r.sidecarDir,basename(i));return `**\u25C0 tool_result** \xB7 ${t} \xB7 ${s.length.toLocaleString()} bytes \xB7 [full \u2192 ${o}](./${o})
|
|
11
|
-
|
|
12
|
-
\`\`\`
|
|
13
|
-
${d}
|
|
14
|
-
\u2026(truncated, see sidecar)
|
|
15
|
-
\`\`\``}return "```json\n"+JSON.stringify(n,null,2)+"\n```"}a(I,"renderBlock");function y(n,r,e=""){let t=e?"```"+e:"```";return `<details><summary>${n}</summary>
|
|
16
|
-
|
|
17
|
-
${t}
|
|
18
|
-
${r}
|
|
19
|
-
\`\`\`
|
|
20
|
-
|
|
21
|
-
</details>`}a(y,"collapsible");function N(n){if(n==null)return "";if(typeof n=="string")return n;if(Array.isArray(n)){let r=[];for(let e of n)e&&typeof e=="object"&&"text"in e&&typeof e.text=="string"?r.push(e.text):r.push(JSON.stringify(e));return r.join(`
|
|
22
|
-
`)}return JSON.stringify(n,null,2)}a(N,"stringifyResult");export{R as renderSessionMarkdown};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as FileHistory}from'./chunk-WI6FSWGU.js';import'./chunk-3QP5BQ3L.js';
|
package/dist/git/utils.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Git utility functions for the git workflow commands.
|
|
3
|
-
*/
|
|
4
|
-
export interface GitStatusEntry {
|
|
5
|
-
status: string;
|
|
6
|
-
path: string;
|
|
7
|
-
}
|
|
8
|
-
export interface GitLogEntry {
|
|
9
|
-
hash: string;
|
|
10
|
-
message: string;
|
|
11
|
-
author: string;
|
|
12
|
-
date: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function isGitRepo(cwd: string): boolean;
|
|
15
|
-
export declare function getCurrentBranch(cwd: string): string;
|
|
16
|
-
export declare function getGitStatus(cwd: string): GitStatusEntry[];
|
|
17
|
-
export declare function getGitDiff(cwd: string, opts?: {
|
|
18
|
-
staged?: boolean;
|
|
19
|
-
file?: string;
|
|
20
|
-
}): string;
|
|
21
|
-
export declare function getGitDiffStat(cwd: string, opts?: {
|
|
22
|
-
staged?: boolean;
|
|
23
|
-
file?: string;
|
|
24
|
-
}): string;
|
|
25
|
-
export declare function getGitLog(cwd: string, n?: number): GitLogEntry[];
|
|
26
|
-
export declare function getRemoteUrl(cwd: string): string | undefined;
|
|
27
|
-
export declare function gitAdd(cwd: string, files?: string[]): void;
|
|
28
|
-
export declare function gitCommit(cwd: string, message: string): string;
|
|
29
|
-
export declare function gitListBranches(cwd: string): {
|
|
30
|
-
name: string;
|
|
31
|
-
current: boolean;
|
|
32
|
-
}[];
|
|
33
|
-
export declare function gitCheckout(cwd: string, branch: string, create?: boolean): void;
|
|
34
|
-
export declare function ghAvailable(): boolean;
|
|
35
|
-
export declare function ghPrComments(cwd: string, prUrl: string): string;
|
package/dist/git/worktree.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Git worktree management — create/remove isolated worktrees for agents.
|
|
3
|
-
*/
|
|
4
|
-
export interface WorktreeSession {
|
|
5
|
-
originalCwd: string;
|
|
6
|
-
worktreePath: string;
|
|
7
|
-
worktreeName: string;
|
|
8
|
-
worktreeBranch: string;
|
|
9
|
-
originalBranch?: string;
|
|
10
|
-
sessionId: string;
|
|
11
|
-
createdAt: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Validate worktree slug to prevent path traversal attacks.
|
|
15
|
-
*/
|
|
16
|
-
export declare function validateWorktreeSlug(slug: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Find the canonical git root (resolves worktree → main repo).
|
|
19
|
-
*/
|
|
20
|
-
export declare function findGitRoot(cwd: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Create an isolated git worktree for an agent session.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createWorktree(cwd: string, slug: string, sessionId: string): WorktreeSession;
|
|
25
|
-
/**
|
|
26
|
-
* Remove a worktree and optionally its branch.
|
|
27
|
-
*/
|
|
28
|
-
export declare function removeWorktree(worktreePath: string, removeBranch?: boolean): void;
|
|
29
|
-
/**
|
|
30
|
-
* List active worktrees.
|
|
31
|
-
*/
|
|
32
|
-
export declare function listWorktrees(cwd: string): Array<{
|
|
33
|
-
path: string;
|
|
34
|
-
branch: string;
|
|
35
|
-
head: string;
|
|
36
|
-
}>;
|
package/dist/hooks/events.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook event type definitions.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Lifecycle hooks the engine emits.
|
|
6
|
-
*
|
|
7
|
-
* **Currently emitted** (handlers registered here will actually fire):
|
|
8
|
-
* - on_session_start / on_session_end (engine.ts) — fires once per Engine.run().
|
|
9
|
-
* on_session_start handlers may return
|
|
10
|
-
* `messages` to inject a <system-reminder>
|
|
11
|
-
* at the head of the conversation, before
|
|
12
|
-
* the current user prompt.
|
|
13
|
-
* - on_agent_start / on_agent_end (engine.ts) — notify-only; returned
|
|
14
|
-
* messages are NOT consumed (the loop
|
|
15
|
-
* is already armed by the time these
|
|
16
|
-
* fire). Use on_session_start instead.
|
|
17
|
-
* - user_prompt_submit (engine.ts) — fires once per run() for
|
|
18
|
-
* every new user prompt (cold-start and
|
|
19
|
-
* resume both qualify). Returned messages
|
|
20
|
-
* are merged into the same lifecycle
|
|
21
|
-
* <system-reminder> as on_session_start.
|
|
22
|
-
* - on_turn_start / on_turn_end (turn-loop.ts) — on_turn_start handlers
|
|
23
|
-
* may return `messages` to inject a
|
|
24
|
-
* per-turn reminder appended to the
|
|
25
|
-
* conversation right before the model call.
|
|
26
|
-
* - pre_tool_use / post_tool_use (executor.ts) — pre_tool_use honors
|
|
27
|
-
* `decision: "deny"` to short-circuit
|
|
28
|
-
* the call (executor.ts:131).
|
|
29
|
-
* - on_tool_start / on_tool_end (executor.ts)
|
|
30
|
-
* - file_changed (executor.ts, Write/Edit only)
|
|
31
|
-
* - on_permission_check (executor.ts) — fires after the
|
|
32
|
-
* classifier runs and before its
|
|
33
|
-
* decision is acted on. Handler can
|
|
34
|
-
* override via `decision`; the
|
|
35
|
-
* override is logged as
|
|
36
|
-
* `permission.hook_override`. ctx.data
|
|
37
|
-
* carries `classifierDecision` so
|
|
38
|
-
* handlers can branch on the rule
|
|
39
|
-
* set's verdict.
|
|
40
|
-
* - post_compact (turn-loop.ts) — fires after
|
|
41
|
-
* ContextManager.manageAsync() runs
|
|
42
|
-
* a non-micro compaction. Handlers
|
|
43
|
-
* may return `messages` to inject a
|
|
44
|
-
* <system-reminder> into the same
|
|
45
|
-
* turn before the model call. ctx.data
|
|
46
|
-
* carries `strategy` (summary/snip/
|
|
47
|
-
* window/emergency), `beforeTokens`,
|
|
48
|
-
* `afterTokens`. Microcompact is
|
|
49
|
-
* intentionally suppressed.
|
|
50
|
-
* - notification (agent.ts) — fired when a background
|
|
51
|
-
* sub-agent transitions to a terminal
|
|
52
|
-
* state. ctx.data carries `kind`
|
|
53
|
-
* ("agent_completed" / "agent_failed" /
|
|
54
|
-
* "agent_cancelled"), `agentId`,
|
|
55
|
-
* `name`, `description`, plus
|
|
56
|
-
* `finalText` (completed) or `error`
|
|
57
|
-
* (failed). Fired void — handler
|
|
58
|
-
* latency does not block the main
|
|
59
|
-
* loop. Not consumed by the engine
|
|
60
|
-
* (bg-agent feed renders the same
|
|
61
|
-
* info via notificationQueue);
|
|
62
|
-
* intended for shell hooks (osascript
|
|
63
|
-
* / desktop notifications).
|
|
64
|
-
*
|
|
65
|
-
* All Engine-side emits run through Engine.emitHook / TurnLoop.emitHook, which
|
|
66
|
-
* auto-merge `isSubAgent` (and sessionId, for turn-loop) into ctx.data so
|
|
67
|
-
* handlers can skip noisy injections for spawned children.
|
|
68
|
-
*
|
|
69
|
-
* **Reserved / not-yet-emitted** (defined so downstream can register handlers
|
|
70
|
-
* in anticipation; wire the emitter before relying on them):
|
|
71
|
-
* - pre_compact — would require pre-flight prediction inside
|
|
72
|
-
* ContextManager; current implementation only knows
|
|
73
|
-
* after-the-fact (use post_compact instead).
|
|
74
|
-
*/
|
|
75
|
-
export type HookEventName = "on_agent_start" | "on_agent_end" | "on_turn_start" | "on_turn_end" | "on_tool_start" | "on_tool_end" | "on_permission_check" | "on_session_start" | "on_session_end" | "pre_tool_use" | "post_tool_use" | "user_prompt_submit" | "pre_compact" | "post_compact" | "file_changed" | "notification";
|
|
76
|
-
export interface HookContext {
|
|
77
|
-
eventName: HookEventName;
|
|
78
|
-
data: Record<string, unknown>;
|
|
79
|
-
sessionId?: string;
|
|
80
|
-
turnNumber?: number;
|
|
81
|
-
}
|
|
82
|
-
export interface HookResult {
|
|
83
|
-
/** If true, stop the hook chain */
|
|
84
|
-
stop?: boolean;
|
|
85
|
-
/** Modified data to pass along */
|
|
86
|
-
data?: Record<string, unknown>;
|
|
87
|
-
/** Additional messages to inject */
|
|
88
|
-
messages?: string[];
|
|
89
|
-
/** Allow/deny/ask override for permission hooks */
|
|
90
|
-
decision?: "allow" | "deny" | "ask";
|
|
91
|
-
/**
|
|
92
|
-
* For pre_tool_use: replace the tool's args before execution. Used by
|
|
93
|
-
* "sanitizer" handlers (e.g. redact secrets in Bash commands, normalize
|
|
94
|
-
* file paths, inject a default flag). Last handler in the chain wins.
|
|
95
|
-
* Args are re-validated against the tool's input schema before the
|
|
96
|
-
* tool runs, so a malformed updatedInput still surfaces as an
|
|
97
|
-
* "Invalid input" error rather than silently passing through.
|
|
98
|
-
*/
|
|
99
|
-
updatedInput?: Record<string, unknown>;
|
|
100
|
-
/**
|
|
101
|
-
* For post_tool_use: text appended to the tool's content (visible to
|
|
102
|
-
* the model on the next LLM call). Used by linter/typecheck handlers
|
|
103
|
-
* to surface results without re-running the tool. Multiple handlers'
|
|
104
|
-
* additionalContext entries are joined with two newlines.
|
|
105
|
-
*/
|
|
106
|
-
additionalContext?: string;
|
|
107
|
-
/**
|
|
108
|
-
* For user_prompt_submit: replace the most recent user message text
|
|
109
|
-
* with this string. Last handler wins. Used to auto-prepend project
|
|
110
|
-
* context, mask secrets, or rewrite shorthand prompts. The original
|
|
111
|
-
* prompt is logged at info level for audit purposes.
|
|
112
|
-
*/
|
|
113
|
-
updatedPrompt?: string;
|
|
114
|
-
}
|
package/dist/hooks/inject.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook message injection helper.
|
|
3
|
-
*
|
|
4
|
-
* Handlers return raw markdown strings via HookResult.messages. The emit
|
|
5
|
-
* site uses wrapHookMessages() to package them into a single user-role
|
|
6
|
-
* <system-reminder> Message so the model sees them as one block instead
|
|
7
|
-
* of a noisy sequence of separate user turns.
|
|
8
|
-
*
|
|
9
|
-
* Contract:
|
|
10
|
-
* - Handlers do NOT wrap their own <system-reminder>; emit-site owns the
|
|
11
|
-
* wrapper. Keeps formatting consistent and lets us evolve it (e.g. add
|
|
12
|
-
* a trailing close-tag, tag attributes) without touching every handler.
|
|
13
|
-
* - Empty / whitespace-only messages are dropped before wrapping; if
|
|
14
|
-
* nothing remains, returns null (caller skips the injection).
|
|
15
|
-
* - Multiple handlers' messages are joined with a blank line between
|
|
16
|
-
* blocks so each is visually distinct inside the reminder.
|
|
17
|
-
*/
|
|
18
|
-
import type { Message } from "../types.js";
|
|
19
|
-
export declare function wrapHookMessages(messages: string[] | undefined): Message | null;
|
package/dist/hooks/registry.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook registry with priority-based chain-of-responsibility execution.
|
|
3
|
-
*/
|
|
4
|
-
import type { HookEventName, HookContext, HookResult } from "./events.js";
|
|
5
|
-
export type HookHandler = (ctx: HookContext) => HookResult | Promise<HookResult>;
|
|
6
|
-
export declare class HookRegistry {
|
|
7
|
-
private hooks;
|
|
8
|
-
register(eventName: HookEventName, handler: HookHandler, priority?: number, name?: string): void;
|
|
9
|
-
emit(eventName: HookEventName, data?: Record<string, unknown>): Promise<HookResult>;
|
|
10
|
-
hasHooks(eventName: HookEventName): boolean;
|
|
11
|
-
clear(eventName?: HookEventName): void;
|
|
12
|
-
listHooks(): Map<HookEventName, string[]>;
|
|
13
|
-
listEvents(): HookEventName[];
|
|
14
|
-
countHandlers(eventName: HookEventName): number;
|
|
15
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* shell-runner — execute a user-configured shell command as a hook handler.
|
|
3
|
-
*
|
|
4
|
-
* Protocol (matches Claude Code's shell-hook contract):
|
|
5
|
-
*
|
|
6
|
-
* stdin JSON.stringify({ eventName, data }) — the full HookContext
|
|
7
|
-
* envelope, including ctx.data fields like toolName / args /
|
|
8
|
-
* sessionId / isSubAgent.
|
|
9
|
-
*
|
|
10
|
-
* stdout Either ignored (when exit 0 with no/blank output) or parsed
|
|
11
|
-
* as a HookResult JSON document. Unparseable stdout on exit 0
|
|
12
|
-
* is logged at warn level and dropped — we do NOT crash the
|
|
13
|
-
* turn loop on malformed handler output.
|
|
14
|
-
*
|
|
15
|
-
* exit 0 Normal return. Stdout (if any) becomes the HookResult.
|
|
16
|
-
* exit 2 Deny / block. Stderr becomes the human-readable reason and
|
|
17
|
-
* is surfaced to the model via HookResult.messages so the LLM
|
|
18
|
-
* sees why the action was rejected.
|
|
19
|
-
* exit * Any other non-zero code = handler error. Logged at error
|
|
20
|
-
* level; we return {} (no effect) so a buggy hook never wedges
|
|
21
|
-
* the engine.
|
|
22
|
-
*
|
|
23
|
-
* ENV (passed to child):
|
|
24
|
-
* CODESHELL_HOOK_EVENT — event name, also in stdin
|
|
25
|
-
* CODESHELL_HOOK_CWD — repo root for context-aware hooks
|
|
26
|
-
* (callers may add more by reading process.env directly)
|
|
27
|
-
*
|
|
28
|
-
* timeout Defaults to 60_000 ms; settings.timeout_ms overrides.
|
|
29
|
-
* On timeout we SIGTERM then SIGKILL, log, and return {}.
|
|
30
|
-
*/
|
|
31
|
-
import type { HookContext, HookResult } from "./events.js";
|
|
32
|
-
import type { SettingsHookConfig } from "../types.js";
|
|
33
|
-
/**
|
|
34
|
-
* Run one shell-hook command and return the parsed HookResult. Catches
|
|
35
|
-
* every failure mode (spawn error, timeout, malformed JSON) and
|
|
36
|
-
* returns an empty result so the registry's chain keeps going.
|
|
37
|
-
*/
|
|
38
|
-
export declare function runShellHook(config: SettingsHookConfig, ctx: HookContext): Promise<HookResult>;
|
|
39
|
-
/**
|
|
40
|
-
* Check whether the hook should fire for the current ctx, respecting
|
|
41
|
-
* the optional `matcher` regex. Returns false for non-tool events
|
|
42
|
-
* when matcher is set (matcher only makes sense when ctx.data has a
|
|
43
|
-
* toolName field).
|
|
44
|
-
*/
|
|
45
|
-
export declare function shellHookMatches(config: SettingsHookConfig, ctx: HookContext): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sanitizeApiKey — defensive cleanup for API keys pasted via the wizard.
|
|
3
|
-
*
|
|
4
|
-
* Windows terminals (ConPTY, legacy cmd.exe, IME-active states) are the main
|
|
5
|
-
* source of breakage: bracketed-paste residue, CR endings, zero-width chars
|
|
6
|
-
* pulled in from rich-text sources (Notion / OneNote / web pages), full-width
|
|
7
|
-
* spaces from CJK IME, smart quotes from word processors. None of these are
|
|
8
|
-
* valid in any real provider's API key, so we strip them and warn.
|
|
9
|
-
*/
|
|
10
|
-
export type SanitizeResult = {
|
|
11
|
-
value: string;
|
|
12
|
-
changed: boolean;
|
|
13
|
-
warnings: string[];
|
|
14
|
-
};
|
|
15
|
-
export declare function sanitizeApiKey(raw: string): SanitizeResult;
|
|
16
|
-
/**
|
|
17
|
-
* Returns true when the sanitized key contains any non-ASCII-printable
|
|
18
|
-
* character. Real provider keys are uniformly ASCII (`[A-Za-z0-9_\-.]`-ish),
|
|
19
|
-
* so a stray non-ASCII char almost certainly means the user pasted the wrong
|
|
20
|
-
* thing (e.g. the surrounding sentence in Chinese).
|
|
21
|
-
*/
|
|
22
|
-
export declare function hasNonAsciiPrintable(s: string): boolean;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capability layer — single entry point.
|
|
3
|
-
*
|
|
4
|
-
* `capabilitiesFor(kind, model)` walks the rules in `rules.ts`, returns
|
|
5
|
-
* a `Capability` describing what params the (provider, model) pair will
|
|
6
|
-
* accept. Clients spread the result into their request-build code.
|
|
7
|
-
*
|
|
8
|
-
* Pure function. No I/O, no caching beyond the rules array.
|
|
9
|
-
*/
|
|
10
|
-
import type { ProviderKindName } from "../provider-kinds.js";
|
|
11
|
-
import { type Capability } from "./types.js";
|
|
12
|
-
export { DEFAULT_CAPABILITY } from "./types.js";
|
|
13
|
-
export type { Capability, ReasoningShape, ReasoningEffort, ThinkingSwitch, EchoReasoning, ParallelToolCallsShape, StreamUsageShape, } from "./types.js";
|
|
14
|
-
/**
|
|
15
|
-
* Resolve the capability for a given (provider kind, model id).
|
|
16
|
-
*
|
|
17
|
-
* First matching rule for the kind wins — rules.ts is ordered so that
|
|
18
|
-
* more specific patterns come before catch-alls.
|
|
19
|
-
*/
|
|
20
|
-
export declare function capabilitiesFor(kind: ProviderKindName, model: string): Capability;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-(provider kind, model family) capability overrides.
|
|
3
|
-
*
|
|
4
|
-
* Each rule patches the conservative DEFAULT_CAPABILITY. First match per
|
|
5
|
-
* kind wins — order matters for overlapping families.
|
|
6
|
-
*
|
|
7
|
-
* Authority for every entry is the vendor's own docs; the `why` field
|
|
8
|
-
* cites the specific page. When a model 400s on something not captured
|
|
9
|
-
* here, add a rule, don't patch the client.
|
|
10
|
-
*
|
|
11
|
-
* Sources audited 2026-05-15:
|
|
12
|
-
* OpenAI: https://platform.openai.com/docs/guides/reasoning
|
|
13
|
-
* https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning
|
|
14
|
-
* Anthropic: https://platform.claude.com/docs/en/build-with-claude/extended-thinking
|
|
15
|
-
* DeepSeek: https://api-docs.deepseek.com/guides/reasoning_model
|
|
16
|
-
* https://api-docs.deepseek.com/guides/thinking_mode
|
|
17
|
-
* Z.AI: https://docs.z.ai/guides/llm/glm-4.6
|
|
18
|
-
* Gemini: https://ai.google.dev/gemini-api/docs/openai
|
|
19
|
-
* https://ai.google.dev/gemini-api/docs/thinking
|
|
20
|
-
* OpenRouter: https://openrouter.ai/docs/guides/best-practices/reasoning-tokens
|
|
21
|
-
* xAI: https://docs.x.ai/docs/guides/reasoning
|
|
22
|
-
* Mistral: https://docs.mistral.ai/api/
|
|
23
|
-
* Groq: https://console.groq.com/docs/reasoning
|
|
24
|
-
*/
|
|
25
|
-
import type { CapabilityRule } from "./types.js";
|
|
26
|
-
export declare const RULES: ReadonlyArray<CapabilityRule>;
|