@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,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-shot migration of legacy flat models[] into providers[] + models[].
|
|
3
|
-
*
|
|
4
|
-
* Pure function — takes a snapshot, returns the new snapshot plus a flag.
|
|
5
|
-
* The caller (settings load path) is responsible for writing settings.json
|
|
6
|
-
* and the .bak backup.
|
|
7
|
-
*/
|
|
8
|
-
import type { ProviderConfig } from "../llm/provider-catalog.js";
|
|
9
|
-
interface LegacyModel {
|
|
10
|
-
key: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
provider?: string;
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
apiKey?: string;
|
|
15
|
-
model: string;
|
|
16
|
-
maxOutputTokens?: number;
|
|
17
|
-
maxContextTokens?: number;
|
|
18
|
-
providerKey?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface MigrationInput {
|
|
21
|
-
providers: ProviderConfig[];
|
|
22
|
-
models: LegacyModel[];
|
|
23
|
-
}
|
|
24
|
-
export interface MigrationOutput {
|
|
25
|
-
providers: ProviderConfig[];
|
|
26
|
-
models: Array<{
|
|
27
|
-
key: string;
|
|
28
|
-
label?: string;
|
|
29
|
-
providerKey: string;
|
|
30
|
-
model: string;
|
|
31
|
-
/**
|
|
32
|
-
* Self-describing legacy fields. Kept (rather than stripped) so model
|
|
33
|
-
* entries stay valid standalone — the engine can read credentials
|
|
34
|
-
* straight off the entry without a ProviderCatalog round-trip.
|
|
35
|
-
*/
|
|
36
|
-
provider?: string;
|
|
37
|
-
baseUrl?: string;
|
|
38
|
-
apiKey?: string;
|
|
39
|
-
maxOutputTokens?: number;
|
|
40
|
-
maxContextTokens?: number;
|
|
41
|
-
}>;
|
|
42
|
-
changed: boolean;
|
|
43
|
-
}
|
|
44
|
-
export declare function migrateModels(input: MigrationInput): MigrationOutput;
|
|
45
|
-
export {};
|
package/dist/cli/onboarding.d.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Onboarding data layer — provider catalog, env detection, key validation,
|
|
3
|
-
* settings persistence. The interactive flow itself is rendered by Ink
|
|
4
|
-
* (see src/ui/components/OnboardingPrompt.tsx); this module only exposes
|
|
5
|
-
* pure(-ish) helpers it consumes, so there's a single input stack.
|
|
6
|
-
*/
|
|
7
|
-
export interface OnboardingResult {
|
|
8
|
-
/**
|
|
9
|
-
* Pool alias key (e.g. "deepseek-v4-pro"). The engine uses this to switch
|
|
10
|
-
* the active model — callers should NOT re-derive an alias from `model`
|
|
11
|
-
* (the old modelKey() helper folded multiple model ids to one key, which
|
|
12
|
-
* silently shadowed entries in the pool).
|
|
13
|
-
*/
|
|
14
|
-
key: string;
|
|
15
|
-
provider: string;
|
|
16
|
-
model: string;
|
|
17
|
-
apiKey: string;
|
|
18
|
-
baseUrl: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ProviderDef {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
envKey: string;
|
|
24
|
-
provider: string;
|
|
25
|
-
baseUrl: string;
|
|
26
|
-
keyUrl: string;
|
|
27
|
-
keyPrefix: string;
|
|
28
|
-
/**
|
|
29
|
-
* The catalog of model IDs to register for this provider. The first
|
|
30
|
-
* entry doubles as the zero-config default — auto-activated when the
|
|
31
|
-
* user boots with just an env key (no onboarding). Users override by
|
|
32
|
-
* picking in the wizard or running `/model`.
|
|
33
|
-
*/
|
|
34
|
-
models: string[];
|
|
35
|
-
/** When true, skip API key prompt (e.g. local providers like Ollama). */
|
|
36
|
-
noKey?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export declare const PROVIDERS: ProviderDef[];
|
|
39
|
-
/**
|
|
40
|
-
* Resolve the model list a provider should expose right now. For
|
|
41
|
-
* OpenRouter this comes from the snapshot; for direct providers it
|
|
42
|
-
* stays hardcoded (snapshot doesn't carry their native IDs).
|
|
43
|
-
*/
|
|
44
|
-
export declare function resolveProviderModels(provider: ProviderDef): string[];
|
|
45
|
-
export interface DetectedEnvKey {
|
|
46
|
-
provider: ProviderDef;
|
|
47
|
-
envKey: string;
|
|
48
|
-
apiKey: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Scan environment for known provider API keys.
|
|
52
|
-
* Returns one entry per provider that has its envKey set.
|
|
53
|
-
*/
|
|
54
|
-
export declare function detectEnvKeys(): DetectedEnvKey[];
|
|
55
|
-
/** Mask a key for display: "sk-517f...b594" */
|
|
56
|
-
export declare function maskKey(key: string): string;
|
|
57
|
-
/**
|
|
58
|
-
* Find a provider definition that matches a given API key.
|
|
59
|
-
* Checks key prefix first, then env var match, then baseUrl.
|
|
60
|
-
*/
|
|
61
|
-
export declare function detectProviderFromApiKey(apiKey: string, baseUrl?: string): ProviderDef | undefined;
|
|
62
|
-
export declare function validateApiKey(baseUrl: string, apiKey: string): Promise<boolean>;
|
|
63
|
-
/**
|
|
64
|
-
* Resolve an API key from the canonical fallback chain.
|
|
65
|
-
* Priority: 1) command-line option 2) settings.json 3) all provider env vars
|
|
66
|
-
*/
|
|
67
|
-
export declare function resolveApiKey(optionsApiKey?: string, settingsApiKey?: string): string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Look up a previously-persisted API key for a given provider in
|
|
70
|
-
* ~/.code-shell/settings.json. Matches by baseUrl (each ProviderDef.baseUrl
|
|
71
|
-
* is unique, while `provider` is a generic kind like "openai" shared across
|
|
72
|
-
* multiple endpoints).
|
|
73
|
-
*
|
|
74
|
-
* Returns the first match found in: settings.models[] (preferred — newer),
|
|
75
|
-
* then settings.model (legacy top-level). undefined when nothing matches.
|
|
76
|
-
*/
|
|
77
|
-
export declare function findSavedKeyForProvider(provider: ProviderDef): {
|
|
78
|
-
apiKey: string;
|
|
79
|
-
baseUrl: string;
|
|
80
|
-
} | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Return the list of model IDs previously saved under this provider
|
|
83
|
-
* (matched by baseUrl). Used by the onboarding wizard to pre-populate the
|
|
84
|
-
* "model pool" step with the user's prior choices instead of resetting to
|
|
85
|
-
* just the provider's first model.
|
|
86
|
-
*/
|
|
87
|
-
export declare function loadSavedModelsForProvider(provider: ProviderDef): string[];
|
|
88
|
-
export declare function hasApiKey(): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Resolve a model's max-output-token budget. Lookup order:
|
|
91
|
-
* 1. KNOWN_MAX_OUTPUT (covers direct providers like Anthropic/DeepSeek
|
|
92
|
-
* whose IDs aren't in the OpenRouter snapshot)
|
|
93
|
-
* 2. OpenRouter snapshot (covers `vendor/model` style IDs)
|
|
94
|
-
* 3. undefined — caller falls back to its own default
|
|
95
|
-
*
|
|
96
|
-
* Returns undefined (not 0) when nothing is known, so callers can use
|
|
97
|
-
* `?? defaultValue` semantics.
|
|
98
|
-
*/
|
|
99
|
-
export declare function resolveMaxOutput(model: string): number | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* Resolve a model's context window size. Lookup order:
|
|
102
|
-
* 1. KNOWN_CONTEXT_WINDOWS (covers direct providers like DeepSeek)
|
|
103
|
-
* 2. OpenRouter snapshot (covers `vendor/model` style IDs)
|
|
104
|
-
* 3. undefined — unknown
|
|
105
|
-
*/
|
|
106
|
-
export declare function resolveContextWindow(model: string): number | undefined;
|
|
107
|
-
/**
|
|
108
|
-
* Derive a pool key in `provider-model` form. Single source of truth for
|
|
109
|
-
* model alias generation — replaces the old modelKey() function which
|
|
110
|
-
* folded same-family models to one key (e.g. v4-flash and v4-pro both
|
|
111
|
-
* collapsed to "deepseek"), causing the pool to silently shadow entries.
|
|
112
|
-
*
|
|
113
|
-
* ("deepseek", "deepseek-v4-pro") → "deepseek-v4-pro"
|
|
114
|
-
* ("openai", "openai/gpt-5") → "openai-gpt-5"
|
|
115
|
-
* ("anthropic","claude-opus-4-7") → "anthropic-claude-opus-4-7"
|
|
116
|
-
*
|
|
117
|
-
* If the model id already starts with `<provider>-` (e.g. "deepseek-v4-pro"
|
|
118
|
-
* under provider "deepseek"), the prefix isn't duplicated.
|
|
119
|
-
*
|
|
120
|
-
* `used` is a set of already-taken keys; collisions are resolved with a
|
|
121
|
-
* `-2`, `-3`, ... suffix.
|
|
122
|
-
*/
|
|
123
|
-
export declare function deriveModelPoolKey(providerKind: string, modelId: string, used?: string[]): string;
|
|
124
|
-
/**
|
|
125
|
-
* Build model pool entries from a provider's model list.
|
|
126
|
-
*/
|
|
127
|
-
export declare function buildModelPool(provider: ProviderDef, apiKey: string): Array<{
|
|
128
|
-
key: string;
|
|
129
|
-
label: string;
|
|
130
|
-
provider: string;
|
|
131
|
-
model: string;
|
|
132
|
-
baseUrl: string;
|
|
133
|
-
apiKey: string;
|
|
134
|
-
maxOutputTokens?: number;
|
|
135
|
-
maxContextTokens?: number;
|
|
136
|
-
}>;
|
|
137
|
-
export declare function modelDisplayName(model: string): string;
|
|
138
|
-
export declare function saveSettings(result: OnboardingResult, providerDef?: ProviderDef, poolModels?: string[]): void;
|
|
139
|
-
/**
|
|
140
|
-
* Append-only persistence for the new ProviderModelFlow-based onboarding.
|
|
141
|
-
*
|
|
142
|
-
* Writes the new shape:
|
|
143
|
-
* - settings.activeKey — primary source of truth for active model
|
|
144
|
-
* - settings.models[] — self-describing entries (key, provider,
|
|
145
|
-
* model, baseUrl, apiKey, maxOutput, maxContext)
|
|
146
|
-
* - settings.providers[] — credential source for the wizard
|
|
147
|
-
* - settings.model.* — legacy mirror of the active entry, kept in
|
|
148
|
-
* sync so legacy boot paths (cli/main.ts,
|
|
149
|
-
* repl.ts, run.ts) keep working without
|
|
150
|
-
* each having to learn about activeKey
|
|
151
|
-
*
|
|
152
|
-
* Append-only: never removes existing entries. To start over use /logout.
|
|
153
|
-
* Writes atomically via tmp+rename.
|
|
154
|
-
*/
|
|
155
|
-
export declare function appendOnboardingResult(opts: {
|
|
156
|
-
/** Alias key the engine should switch to after writing. Matches one of addedModels[].key. */
|
|
157
|
-
activeKey: string;
|
|
158
|
-
/** Active entry's fields, used to mirror into the legacy settings.model.* block. */
|
|
159
|
-
activeMirror: {
|
|
160
|
-
provider: string;
|
|
161
|
-
model: string;
|
|
162
|
-
apiKey: string;
|
|
163
|
-
baseUrl: string;
|
|
164
|
-
};
|
|
165
|
-
addedProvider?: {
|
|
166
|
-
key: string;
|
|
167
|
-
label?: string;
|
|
168
|
-
kind: string;
|
|
169
|
-
baseUrl: string;
|
|
170
|
-
apiKey?: string;
|
|
171
|
-
protocol?: string;
|
|
172
|
-
modelsPath?: string;
|
|
173
|
-
};
|
|
174
|
-
addedModels: Array<{
|
|
175
|
-
key: string;
|
|
176
|
-
label?: string;
|
|
177
|
-
providerKey?: string;
|
|
178
|
-
/** LLM client/protocol ("openai"/"anthropic"). New canonical name. */
|
|
179
|
-
protocol?: string;
|
|
180
|
-
/** Legacy mirror of `protocol`. Both are written so legacy readers keep working. */
|
|
181
|
-
provider?: string;
|
|
182
|
-
model: string;
|
|
183
|
-
baseUrl: string;
|
|
184
|
-
apiKey?: string;
|
|
185
|
-
maxContextTokens?: number;
|
|
186
|
-
maxOutputTokens?: number;
|
|
187
|
-
}>;
|
|
188
|
-
}): void;
|
|
189
|
-
export declare function saveArenaSettingsByKeys(keys: string[]): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Output renderers for different formats.
|
|
3
|
-
*/
|
|
4
|
-
import type { StreamEvent, TerminalReason } from "../../types.js";
|
|
5
|
-
export type OutputFormat = "text" | "json" | "jsonl" | "stream-json";
|
|
6
|
-
export interface OutputRenderer {
|
|
7
|
-
onEvent(event: StreamEvent): void;
|
|
8
|
-
onComplete(text: string, reason: TerminalReason, meta: Record<string, unknown>): void;
|
|
9
|
-
}
|
|
10
|
-
export declare class TextRenderer implements OutputRenderer {
|
|
11
|
-
private activeAgents;
|
|
12
|
-
onEvent(event: StreamEvent): void;
|
|
13
|
-
onComplete(_text: string, reason: TerminalReason): void;
|
|
14
|
-
}
|
|
15
|
-
export declare class JsonRenderer implements OutputRenderer {
|
|
16
|
-
private text;
|
|
17
|
-
onEvent(event: StreamEvent): void;
|
|
18
|
-
onComplete(text: string, reason: TerminalReason, meta: Record<string, unknown>): void;
|
|
19
|
-
}
|
|
20
|
-
export declare class JsonlRenderer implements OutputRenderer {
|
|
21
|
-
onEvent(event: StreamEvent): void;
|
|
22
|
-
onComplete(text: string, reason: TerminalReason, meta: Record<string, unknown>): void;
|
|
23
|
-
}
|
|
24
|
-
export declare class StreamJsonRenderer implements OutputRenderer {
|
|
25
|
-
onEvent(event: StreamEvent): void;
|
|
26
|
-
onComplete(text: string, reason: TerminalReason, meta: Record<string, unknown>): void;
|
|
27
|
-
}
|
|
28
|
-
export declare function createRenderer(format: OutputFormat): OutputRenderer;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal UI utilities — spinners, markdown rendering, styled output.
|
|
3
|
-
*/
|
|
4
|
-
import { type Ora } from "ora";
|
|
5
|
-
/**
|
|
6
|
-
* Render markdown text to styled terminal output.
|
|
7
|
-
* Falls back to raw text if rendering fails.
|
|
8
|
-
*/
|
|
9
|
-
export declare function renderMarkdown(text: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Highlight a code block with syntax coloring.
|
|
12
|
-
*/
|
|
13
|
-
export declare function highlightCode(code: string, lang?: string): string;
|
|
14
|
-
export interface SpinnerHandle {
|
|
15
|
-
update(text: string): void;
|
|
16
|
-
succeed(text: string): void;
|
|
17
|
-
fail(text: string): void;
|
|
18
|
-
stop(): void;
|
|
19
|
-
instance: Ora;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Create a spinner for long-running operations.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createSpinner(text: string): SpinnerHandle;
|
|
25
|
-
/**
|
|
26
|
-
* Print a styled banner box.
|
|
27
|
-
*/
|
|
28
|
-
export declare function printBanner(lines: {
|
|
29
|
-
label: string;
|
|
30
|
-
value: string;
|
|
31
|
-
}[]): void;
|
|
32
|
-
/**
|
|
33
|
-
* Format a tool call start line.
|
|
34
|
-
*/
|
|
35
|
-
export declare function formatToolStart(toolName: string, args: Record<string, unknown>): string;
|
|
36
|
-
/**
|
|
37
|
-
* Format a tool result line.
|
|
38
|
-
*/
|
|
39
|
-
export declare function formatToolResult(toolName: string, result?: string, error?: string): string;
|
|
40
|
-
export interface TaskDisplayInfo {
|
|
41
|
-
id: string;
|
|
42
|
-
subject: string;
|
|
43
|
-
activeForm?: string;
|
|
44
|
-
status: "pending" | "in_progress" | "completed" | "stopped";
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Render the task list as a compact terminal block.
|
|
48
|
-
* Returns the formatted string (caller handles printing).
|
|
49
|
-
*/
|
|
50
|
-
export declare function renderTaskList(tasks: TaskDisplayInfo[]): string;
|
package/dist/cli/updater.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auto-update — checks npm registry for newer versions; can optionally install
|
|
3
|
-
* the new version in the background after the current process exits.
|
|
4
|
-
*
|
|
5
|
-
* Flow:
|
|
6
|
-
* 1. `checkForUpdate()` runs at startup (non-blocking). Stores result in
|
|
7
|
-
* module state for the UI to read via `getUpdateAvailable()`.
|
|
8
|
-
* 2. UI re-polls every 30 min via `pollForUpdate()`.
|
|
9
|
-
* 3. If the user has write permission on the npm global prefix, we register
|
|
10
|
-
* `scheduleAutoInstallOnExit()` so that on process exit a detached
|
|
11
|
-
* `npm i -g` spawns and survives the parent. Next startup picks up
|
|
12
|
-
* the new version.
|
|
13
|
-
* 4. If the user has NO permission, UI shows the manual command instead.
|
|
14
|
-
*
|
|
15
|
-
* Concurrency: multiple `code-shell` processes can run at once. A file lock
|
|
16
|
-
* at `~/.code-shell/.update.lock` prevents both from launching `npm i -g`
|
|
17
|
-
* simultaneously (which corrupts the install).
|
|
18
|
-
*
|
|
19
|
-
* Headless safety: `checkForUpdate()` and `scheduleAutoInstallOnExit()` are
|
|
20
|
-
* only invoked from the Ink-based UpdateBanner component, never from the
|
|
21
|
-
* `run` / `arena` headless code paths. Keep it that way — wiring the updater
|
|
22
|
-
* into bare CLI commands would surprise CI users with background `npm i -g`
|
|
23
|
-
* on every short-lived `code-shell run …` invocation. If you need updater
|
|
24
|
-
* behavior in a new headless entry point, gate it on something explicit
|
|
25
|
-
* (e.g. `--auto-update` flag) rather than calling it unconditionally.
|
|
26
|
-
*/
|
|
27
|
-
export interface UpdateInfo {
|
|
28
|
-
latestVersion: string;
|
|
29
|
-
/** True if `<npm prefix>` is writable by current user — can self-install. */
|
|
30
|
-
canAutoInstall: boolean;
|
|
31
|
-
/** Cached npm global prefix path (for diagnostics / manual command hint). */
|
|
32
|
-
npmPrefix: string | null;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Kick off an update check. Non-blocking: returns immediately, fills module
|
|
36
|
-
* state when network/npm respond. Safe to call multiple times (e.g. on a 30min
|
|
37
|
-
* timer).
|
|
38
|
-
*/
|
|
39
|
-
export declare function checkForUpdate(packageName?: string): void;
|
|
40
|
-
/** Returns update info if a newer version was found, else undefined. */
|
|
41
|
-
export declare function getUpdateAvailable(): UpdateInfo | undefined;
|
|
42
|
-
/** Returns "why is auto-update off" — for /doctor-style diagnostics. */
|
|
43
|
-
export declare function getAutoUpdateDisabledReason(): string | null;
|
|
44
|
-
/**
|
|
45
|
-
* Install the on-exit hook so that the new version is installed AFTER the
|
|
46
|
-
* current process exits (avoids overwriting files the running process still
|
|
47
|
-
* has open). Idempotent — calling twice is a no-op.
|
|
48
|
-
*/
|
|
49
|
-
export declare function scheduleAutoInstallOnExit(): void;
|
|
50
|
-
export declare function getCurrentVersion(): string;
|
|
51
|
-
declare function getLockFilePath(): string;
|
|
52
|
-
/**
|
|
53
|
-
* Try to acquire the update lock. Returns true on success.
|
|
54
|
-
* Uses `O_EXCL` (writeFile flag 'wx') for atomic create. Stale locks (mtime
|
|
55
|
-
* older than LOCK_TIMEOUT_MS) are taken over, re-verifying staleness right
|
|
56
|
-
* before unlink to close the TOCTOU race.
|
|
57
|
-
*/
|
|
58
|
-
declare function acquireLock(): Promise<boolean>;
|
|
59
|
-
declare function releaseLock(): Promise<void>;
|
|
60
|
-
export declare const __internal: {
|
|
61
|
-
acquireLock: typeof acquireLock;
|
|
62
|
-
releaseLock: typeof releaseLock;
|
|
63
|
-
getLockFilePath: typeof getLockFilePath;
|
|
64
|
-
};
|
|
65
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as LLMClientBase}from'./chunk-OWBYLMDD.js';import'./chunk-FU7AHZNN.js';import'./chunk-DI26OUIU.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {p}from'./chunk-M7VU4YVY.js';export{e as COMPACTABLE_TOOL_NAMES,b as adjustIndexToPreserveAPIInvariants,k as applySummaryCompaction,g as applyToolResultBudget,i as buildSummarizationPrompt,m as dropOldestRounds,a as estimateTokens,j as extractAnchoredSummary,n as extractReferencedFilePaths,l as groupMessagesByApiRound,f as microcompact,c as snipCompact,h as truncateToolResult,d as windowCompact}from'./chunk-M7VU4YVY.js';import'./chunk-3QP5BQ3L.js';p();
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context compaction strategies.
|
|
3
|
-
*
|
|
4
|
-
* Tier 0: truncateToolResult — truncate oversized individual results
|
|
5
|
-
* Tier 1: microcompact — zero-cost, clears old tool_result content
|
|
6
|
-
* Tier 2: LLM summary — generates summary via model call (async)
|
|
7
|
-
* Tier 3: window compact — keeps first + last N messages (sync fallback)
|
|
8
|
-
* Emergency: dropOldestRounds — progressive API-round-based truncation
|
|
9
|
-
*
|
|
10
|
-
* All slicing functions use adjustIndexToPreserveAPIInvariants()
|
|
11
|
-
* to prevent splitting tool_use / tool_result pairs.
|
|
12
|
-
*/
|
|
13
|
-
import type { Message } from "../types.js";
|
|
14
|
-
/**
|
|
15
|
-
* Estimate token count from messages.
|
|
16
|
-
* Uses per-block-type estimation with 33% overhead padding.
|
|
17
|
-
*/
|
|
18
|
-
export declare function estimateTokens(messages: Message[]): number;
|
|
19
|
-
/**
|
|
20
|
-
* Expand a slice start-index backwards so that every tool_result in the
|
|
21
|
-
* kept range has its corresponding tool_use in the kept range too.
|
|
22
|
-
*
|
|
23
|
-
* Without this, windowCompact / applySummaryCompaction can produce
|
|
24
|
-
* messages where tool_result references a tool_use_id that was
|
|
25
|
-
* compacted away, causing an API validation error.
|
|
26
|
-
*/
|
|
27
|
-
export declare function adjustIndexToPreserveAPIInvariants(messages: Message[], startIndex: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* Snip strategy: keep first N + last M messages, replace middle with a marker.
|
|
30
|
-
* Less aggressive than windowCompact — preserves initial context AND recent history.
|
|
31
|
-
* Uses adjustIndexToPreserveAPIInvariants on both boundaries.
|
|
32
|
-
*/
|
|
33
|
-
export declare function snipCompact(messages: Message[], keepFirstN?: number, keepLastM?: number): Message[];
|
|
34
|
-
/**
|
|
35
|
-
* Window strategy: keep first message + last N messages.
|
|
36
|
-
* Uses adjustIndexToPreserveAPIInvariants to avoid splitting tool pairs.
|
|
37
|
-
*/
|
|
38
|
-
export declare function windowCompact(messages: Message[], keepLastN: number): Message[];
|
|
39
|
-
/**
|
|
40
|
-
* Tools whose results are safe to clear during microcompact.
|
|
41
|
-
*
|
|
42
|
-
* Tracks the CC `COMPACTABLE_TOOLS` set: only "data-fetching" tools where the
|
|
43
|
-
* result is reconstructible (re-Read, re-Glob, re-Bash). Orchestration tools
|
|
44
|
-
* (TaskCreate / TaskUpdate / Agent / Skill / etc.) are excluded — their
|
|
45
|
-
* results carry conversation state the model needs to keep referencing.
|
|
46
|
-
*/
|
|
47
|
-
export declare const COMPACTABLE_TOOL_NAMES: ReadonlySet<string>;
|
|
48
|
-
export interface MicrocompactOptions {
|
|
49
|
-
/** Keep this many most-recent compactable tool-result rounds untouched. */
|
|
50
|
-
keepRecentN?: number;
|
|
51
|
-
/** Tool names whose results may be cleared. Defaults to COMPACTABLE_TOOL_NAMES. */
|
|
52
|
-
compactableTools?: ReadonlySet<string>;
|
|
53
|
-
/** Optional callback invoked once when any clearing actually happened. */
|
|
54
|
-
onClear?: (info: {
|
|
55
|
-
clearedRounds: number;
|
|
56
|
-
toolNames: string[];
|
|
57
|
-
}) => void;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Remove old tool_result content (microcompact).
|
|
61
|
-
*
|
|
62
|
-
* For each tool_result block older than the most-recent N compactable rounds,
|
|
63
|
-
* replaces its content with a short fingerprint of the originating call
|
|
64
|
-
* (e.g. `[Old tool result cleared — Read file_path=/.../foo.ts]`) so the
|
|
65
|
-
* model can decide whether it's worth re-running the tool instead of
|
|
66
|
-
* guessing what it had seen.
|
|
67
|
-
*
|
|
68
|
-
* Behavior changes vs. earlier versions:
|
|
69
|
-
* - Only clears whitelisted tool names (Read/Glob/Bash/...). Orchestration
|
|
70
|
-
* tool results (TaskCreate/TaskUpdate/Agent/etc.) are left intact.
|
|
71
|
-
* - "Round" count is per *compactable* result, not per message with any
|
|
72
|
-
* tool_result. A round containing only TaskUpdate doesn't count toward N.
|
|
73
|
-
* - Replacement string includes tool name + key args so the model isn't
|
|
74
|
-
* forced into blind re-Reads (which then trip the Investigation guard).
|
|
75
|
-
*/
|
|
76
|
-
export declare function microcompact(messages: Message[], options?: MicrocompactOptions): Message[];
|
|
77
|
-
/**
|
|
78
|
-
* Apply aggregate per-message tool result budget.
|
|
79
|
-
* When total tool_result content in a single message exceeds maxTotalChars,
|
|
80
|
-
* truncates the largest results first with a notice.
|
|
81
|
-
*/
|
|
82
|
-
export declare function applyToolResultBudget(messages: Message[], maxTotalChars?: number): Message[];
|
|
83
|
-
/**
|
|
84
|
-
* Truncate a single tool result if it exceeds the character limit.
|
|
85
|
-
* Returns the truncated string with a notice.
|
|
86
|
-
*/
|
|
87
|
-
export declare function truncateToolResult(result: string, maxChars?: number): string;
|
|
88
|
-
/**
|
|
89
|
-
* Build a structured summarization prompt from messages to be compacted.
|
|
90
|
-
* Produces a 9-section summary preserving key details.
|
|
91
|
-
*/
|
|
92
|
-
export declare function buildSummarizationPrompt(messagesToSummarize: Message[], priorSummary?: string): string;
|
|
93
|
-
export declare function extractAnchoredSummary(messages: Message[]): string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Apply LLM-generated summary compaction (hybrid mode).
|
|
96
|
-
*
|
|
97
|
-
* Instead of eagerly restoring file contents (wastes tokens), gives the
|
|
98
|
-
* model a summary + the transcript path so it can Read on demand.
|
|
99
|
-
* Also lists recently-referenced files so the model knows what to re-read.
|
|
100
|
-
*/
|
|
101
|
-
export declare function applySummaryCompaction(messages: Message[], summary: string, keepRecentN: number, transcriptPath?: string): Message[];
|
|
102
|
-
/**
|
|
103
|
-
* Group messages by API round-trip boundaries.
|
|
104
|
-
* Each group represents one complete assistant response + its tool results.
|
|
105
|
-
*/
|
|
106
|
-
export declare function groupMessagesByApiRound(messages: Message[]): Message[][];
|
|
107
|
-
/**
|
|
108
|
-
* Drop the oldest API rounds from messages, preserving tool pairs.
|
|
109
|
-
* Used for progressive prompt-too-long recovery.
|
|
110
|
-
*/
|
|
111
|
-
export declare function dropOldestRounds(messages: Message[], roundsToDrop: number): Message[];
|
|
112
|
-
/**
|
|
113
|
-
* Extract file paths that were referenced (Read/Edit/Write) in compacted
|
|
114
|
-
* messages. Returns paths only — the model uses Read tool on demand.
|
|
115
|
-
*/
|
|
116
|
-
export declare function extractReferencedFilePaths(messages: Message[]): string[];
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context manager — three-tier context management.
|
|
3
|
-
*
|
|
4
|
-
* Tier 1: microcompact (sync, zero-cost) — clear old tool_result content
|
|
5
|
-
* Tier 2: LLM summary (async) — generate summary of older messages via model call
|
|
6
|
-
* Tier 3: window compact (sync, emergency) — aggressive truncation fallback
|
|
7
|
-
*/
|
|
8
|
-
import type { Message } from "../types.js";
|
|
9
|
-
export interface ContextManagerConfig {
|
|
10
|
-
maxTokens: number;
|
|
11
|
-
compactAtRatio: number;
|
|
12
|
-
summarizeAtRatio: number;
|
|
13
|
-
maxToolResultChars: number;
|
|
14
|
-
/**
|
|
15
|
-
* Lower bound, as a ratio of maxTokens, below which microcompact will not
|
|
16
|
-
* run. CC's external (non-cache-edit) path is "autocompact handles context
|
|
17
|
-
* pressure"; mirror that by leaving early-turn context alone so a model
|
|
18
|
-
* with a 1M window doesn't see its first-3-rounds Read results wiped at
|
|
19
|
-
* 23k tokens. Raising the floor also keeps prompt-cache prefixes warm in
|
|
20
|
-
* short sessions.
|
|
21
|
-
*/
|
|
22
|
-
microcompactFloorRatio: number;
|
|
23
|
-
/**
|
|
24
|
-
* Most-recent compactable rounds microcompact keeps untouched. Auto-derived
|
|
25
|
-
* from maxTokens when not set explicitly: bigger window → keep more.
|
|
26
|
-
*/
|
|
27
|
-
microcompactKeepRecent?: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Async function type for LLM summarization calls.
|
|
31
|
-
* Injected by the Engine so the ContextManager doesn't depend on LLM directly.
|
|
32
|
-
*/
|
|
33
|
-
export type SummarizeFn = (prompt: string) => Promise<string>;
|
|
34
|
-
export type CompactStrategy = "micro" | "summary" | "window" | "snip" | "emergency";
|
|
35
|
-
export type OnCompactFn = (info: {
|
|
36
|
-
strategy: CompactStrategy;
|
|
37
|
-
before: number;
|
|
38
|
-
after: number;
|
|
39
|
-
}) => void;
|
|
40
|
-
export declare class ContextManager {
|
|
41
|
-
private config;
|
|
42
|
-
private toolCallHashes;
|
|
43
|
-
private summarizeFn;
|
|
44
|
-
private consecutiveSummaryFailures;
|
|
45
|
-
private lastSummary;
|
|
46
|
-
/** Last known actual token count from API usage data. */
|
|
47
|
-
private lastActualTokens;
|
|
48
|
-
/** Message count at the time lastActualTokens was recorded. */
|
|
49
|
-
private lastActualAtMessageCount;
|
|
50
|
-
/** Path to session transcript — passed to summary compaction for on-demand access. */
|
|
51
|
-
private transcriptPath;
|
|
52
|
-
/** Notified whenever any compaction tier fires, including microcompact. */
|
|
53
|
-
private onCompact;
|
|
54
|
-
/**
|
|
55
|
-
* Tool-result persistence state. Created lazily once we know where to
|
|
56
|
-
* write files (i.e. once setTranscriptPath has been called).
|
|
57
|
-
* `null` = persistence has been explicitly disabled.
|
|
58
|
-
*/
|
|
59
|
-
private replacementState;
|
|
60
|
-
private toolResultsDir;
|
|
61
|
-
constructor(config?: Partial<ContextManagerConfig>);
|
|
62
|
-
setOnCompact(fn: OnCompactFn): void;
|
|
63
|
-
/**
|
|
64
|
-
* Record actual token usage from API response.
|
|
65
|
-
* Used for hybrid estimation: actual + estimate for new messages.
|
|
66
|
-
*/
|
|
67
|
-
recordActualUsage(inputTokens: number, messageCount: number): void;
|
|
68
|
-
/**
|
|
69
|
-
* Best-effort token estimate: uses actual API usage as base if available,
|
|
70
|
-
* plus estimation for messages added since the last API call.
|
|
71
|
-
*/
|
|
72
|
-
private estimateTokensHybrid;
|
|
73
|
-
/**
|
|
74
|
-
* Set the summarize function (injected by Engine).
|
|
75
|
-
*/
|
|
76
|
-
setSummarizeFn(fn: SummarizeFn): void;
|
|
77
|
-
/**
|
|
78
|
-
* Set the transcript path so compaction can reference it. The
|
|
79
|
-
* tool-results directory lives alongside the transcript file:
|
|
80
|
-
* <transcriptDir>/tool-results/<toolUseId>.txt
|
|
81
|
-
*/
|
|
82
|
-
setTranscriptPath(path: string): void;
|
|
83
|
-
/**
|
|
84
|
-
* Initialize tool-result-persistence state from already-loaded messages.
|
|
85
|
-
* Call this once per session, after setTranscriptPath, when resuming so
|
|
86
|
-
* the manager re-enters the same "frozen decision" state it had on the
|
|
87
|
-
* previous run. Without this, a resumed session would re-evaluate
|
|
88
|
-
* every result against the current threshold and might flip choices.
|
|
89
|
-
*/
|
|
90
|
-
initReplacementStateFromMessages(messages: Message[]): void;
|
|
91
|
-
/**
|
|
92
|
-
* Apply progressive context management (sync path).
|
|
93
|
-
* For Tier 2 (LLM summary), call manageAsync instead.
|
|
94
|
-
*/
|
|
95
|
-
manage(messages: Message[]): Message[];
|
|
96
|
-
/**
|
|
97
|
-
* Async context management — attempts LLM summarization before falling back.
|
|
98
|
-
* Call this when you have access to the LLM (between turns).
|
|
99
|
-
*/
|
|
100
|
-
manageAsync(messages: Message[]): Promise<Message[]>;
|
|
101
|
-
/**
|
|
102
|
-
* Persist large tool_result blocks to disk and replace them with a
|
|
103
|
-
* preview + filepath. No-op when transcript path hasn't been set
|
|
104
|
-
* (e.g. unit tests that exercise compaction directly without a session).
|
|
105
|
-
*/
|
|
106
|
-
private persistLargeToolResults;
|
|
107
|
-
/**
|
|
108
|
-
* Truncate oversized tool results in messages.
|
|
109
|
-
*/
|
|
110
|
-
private truncateToolResults;
|
|
111
|
-
/**
|
|
112
|
-
* Reactive compaction check — call during streaming to detect if
|
|
113
|
-
* token usage is approaching the limit mid-turn.
|
|
114
|
-
* Returns true if emergency compaction should be triggered.
|
|
115
|
-
*/
|
|
116
|
-
shouldReactiveCompact(messages: Message[], currentResponseTokens: number): boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Check if context is approaching limits.
|
|
119
|
-
*/
|
|
120
|
-
checkLimits(messages: Message[]): {
|
|
121
|
-
tokens: number;
|
|
122
|
-
ratio: number;
|
|
123
|
-
needsCompact: boolean;
|
|
124
|
-
needsEmergency: boolean;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Deduplicate tool calls by hashing arguments.
|
|
128
|
-
*/
|
|
129
|
-
deduplicateToolCalls(calls: Array<{
|
|
130
|
-
toolName: string;
|
|
131
|
-
args: Record<string, unknown>;
|
|
132
|
-
}>): {
|
|
133
|
-
toExecute: typeof calls;
|
|
134
|
-
cached: Array<{
|
|
135
|
-
toolName: string;
|
|
136
|
-
args: Record<string, unknown>;
|
|
137
|
-
result: string;
|
|
138
|
-
}>;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Record a tool call result for dedup tracking.
|
|
142
|
-
*/
|
|
143
|
-
recordToolResult(toolName: string, args: Record<string, unknown>, result: string): void;
|
|
144
|
-
private hashCall;
|
|
145
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token counter — more accurate token estimation.
|
|
3
|
-
*
|
|
4
|
-
* Uses a character-based heuristic tuned per language/content type,
|
|
5
|
-
* with cache-aware accounting for prompt caching.
|
|
6
|
-
*/
|
|
7
|
-
import type { Message } from "../types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Estimate token count for a string, detecting content type.
|
|
10
|
-
*/
|
|
11
|
-
export declare function estimateStringTokens(text: string): number;
|
|
12
|
-
/**
|
|
13
|
-
* Estimate token count for a message array.
|
|
14
|
-
*/
|
|
15
|
-
export declare function estimateMessagesTokens(messages: Message[]): number;
|
|
16
|
-
/**
|
|
17
|
-
* Context window usage report.
|
|
18
|
-
*/
|
|
19
|
-
export interface ContextUsage {
|
|
20
|
-
usedTokens: number;
|
|
21
|
-
maxTokens: number;
|
|
22
|
-
usagePercent: number;
|
|
23
|
-
systemPromptTokens: number;
|
|
24
|
-
messagesTokens: number;
|
|
25
|
-
headroom: number;
|
|
26
|
-
}
|
|
27
|
-
export declare function calculateContextUsage(messages: Message[], systemPrompt: string, maxTokens: number): ContextUsage;
|