@cjhyy/code-shell 0.1.0-alpha.0
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 +109 -0
- package/LICENSE +21 -0
- package/README.md +177 -0
- package/dist/agent/coordinator.d.ts +49 -0
- package/dist/anthropic-NENYS535.js +9 -0
- package/dist/anthropic-XMTTVNSH.cjs +9 -0
- package/dist/arena/arena.d.ts +43 -0
- package/dist/arena/context/context-tools.d.ts +16 -0
- package/dist/arena/detect-mode.d.ts +20 -0
- package/dist/arena/digest-builder.d.ts +25 -0
- package/dist/arena/index.cjs +103 -0
- package/dist/arena/index.d.ts +29 -0
- package/dist/arena/index.js +103 -0
- package/dist/arena/iterate/convergence.d.ts +25 -0
- package/dist/arena/iterate/formats/index.d.ts +22 -0
- package/dist/arena/iterate/index.d.ts +11 -0
- package/dist/arena/iterate/iterative-arena.d.ts +23 -0
- package/dist/arena/iterate/parse.d.ts +42 -0
- package/dist/arena/iterate/phases/argue.d.ts +22 -0
- package/dist/arena/iterate/phases/revise.d.ts +16 -0
- package/dist/arena/iterate/phases/tournament.d.ts +34 -0
- package/dist/arena/iterate/tools/web-tools.d.ts +13 -0
- package/dist/arena/iterate/types.d.ts +152 -0
- package/dist/arena/ledger.d.ts +47 -0
- package/dist/arena/lenses/architecture.d.ts +5 -0
- package/dist/arena/lenses/engineering.d.ts +5 -0
- package/dist/arena/lenses/general.d.ts +5 -0
- package/dist/arena/lenses/index.d.ts +16 -0
- package/dist/arena/lenses/product.d.ts +5 -0
- package/dist/arena/model-presets.d.ts +14 -0
- package/dist/arena/phases/adjudication.d.ts +24 -0
- package/dist/arena/phases/build-consensus.d.ts +29 -0
- package/dist/arena/phases/claim-registry.d.ts +26 -0
- package/dist/arena/phases/cross-review.d.ts +45 -0
- package/dist/arena/phases/debate-rounds.d.ts +27 -0
- package/dist/arena/phases/participant-research.d.ts +38 -0
- package/dist/arena/phases/planning-detail-expansion.d.ts +38 -0
- package/dist/arena/planner.d.ts +27 -0
- package/dist/arena/providers/docs.d.ts +6 -0
- package/dist/arena/providers/git.d.ts +8 -0
- package/dist/arena/providers/index.d.ts +16 -0
- package/dist/arena/providers/none.d.ts +7 -0
- package/dist/arena/providers/repo.d.ts +6 -0
- package/dist/arena/render/session.d.ts +17 -0
- package/dist/arena/render/terminal.d.ts +33 -0
- package/dist/arena/strategies/discussion.d.ts +25 -0
- package/dist/arena/strategies/index.d.ts +15 -0
- package/dist/arena/strategies/language-wrapper.d.ts +17 -0
- package/dist/arena/strategies/lens-wrapper.d.ts +16 -0
- package/dist/arena/strategies/planning.d.ts +30 -0
- package/dist/arena/strategies/review.d.ts +26 -0
- package/dist/arena/strategies/utils.d.ts +34 -0
- package/dist/arena/tools/selector.d.ts +17 -0
- package/dist/arena/transitions.d.ts +48 -0
- package/dist/arena/types.d.ts +499 -0
- package/dist/arena-46QQ6BZQ.js +261 -0
- package/dist/arena-HZZZ2GJH.cjs +261 -0
- package/dist/bootstrap/setup.d.ts +14 -0
- package/dist/bootstrap/state.d.ts +160 -0
- package/dist/bridge-4ZRXVWBN.js +98 -0
- package/dist/bridge-W476QDFH.cjs +98 -0
- package/dist/chunk-3EAEC566.cjs +136 -0
- package/dist/chunk-3EUDE77E.cjs +1252 -0
- package/dist/chunk-3QR52LL5.cjs +105 -0
- package/dist/chunk-4PKZPFCD.js +136 -0
- package/dist/chunk-4RRUP4MM.js +86 -0
- package/dist/chunk-4SFPFHMG.js +132 -0
- package/dist/chunk-5LHVI777.cjs +246 -0
- package/dist/chunk-6JOOLG6F.js +104 -0
- package/dist/chunk-6ZIROYXX.js +207 -0
- package/dist/chunk-7RMAR2Y3.js +6511 -0
- package/dist/chunk-BE6IPRDM.js +224 -0
- package/dist/chunk-BHGIJ2DJ.js +41 -0
- package/dist/chunk-BMH65OVB.cjs +224 -0
- package/dist/chunk-C7JBCO5V.js +80 -0
- package/dist/chunk-CSO5EOEP.cjs +132 -0
- package/dist/chunk-DI7RDLOS.js +47 -0
- package/dist/chunk-DICG4AB7.cjs +73 -0
- package/dist/chunk-EL2RL5DG.cjs +101 -0
- package/dist/chunk-FGZGCFJX.cjs +207 -0
- package/dist/chunk-FUOKLKR2.js +101 -0
- package/dist/chunk-FVP7XJGS.cjs +4577 -0
- package/dist/chunk-HD7MT5XU.cjs +86 -0
- package/dist/chunk-IJSHQGMP.cjs +45 -0
- package/dist/chunk-IMMTBZ33.cjs +63 -0
- package/dist/chunk-J5XW6UYL.js +291 -0
- package/dist/chunk-JT2WSQSR.cjs +335 -0
- package/dist/chunk-KO2FPF7G.js +93 -0
- package/dist/chunk-LRAY5IYC.cjs +291 -0
- package/dist/chunk-NG73UR3L.cjs +285 -0
- package/dist/chunk-NZ4DQ72D.cjs +664 -0
- package/dist/chunk-O6F2EF2Z.js +73 -0
- package/dist/chunk-OG4MIQJ6.js +335 -0
- package/dist/chunk-QHDYFC5U.cjs +6511 -0
- package/dist/chunk-R32DJSJE.cjs +41 -0
- package/dist/chunk-S74VVJBF.js +285 -0
- package/dist/chunk-SK62UVS6.js +105 -0
- package/dist/chunk-SQZHPD3S.js +4577 -0
- package/dist/chunk-UK2SU23S.cjs +93 -0
- package/dist/chunk-VKGNCYRL.js +258 -0
- package/dist/chunk-WFQF3RT4.cjs +104 -0
- package/dist/chunk-WHRTARDJ.cjs +258 -0
- package/dist/chunk-WRZJUQ5Z.js +664 -0
- package/dist/chunk-X4HAERTQ.js +63 -0
- package/dist/chunk-XHC2JMEC.cjs +80 -0
- package/dist/chunk-YZ25SSWJ.js +222 -0
- package/dist/chunk-ZJV3YSY3.cjs +222 -0
- package/dist/chunk-ZRSSGYA5.js +246 -0
- package/dist/chunk-ZXYDDJEJ.js +1252 -0
- package/dist/cli/commands/arena.d.ts +29 -0
- package/dist/cli/commands/builtin/advanced-commands.d.ts +5 -0
- package/dist/cli/commands/builtin/core-commands.d.ts +5 -0
- package/dist/cli/commands/builtin/extra-commands.d.ts +6 -0
- package/dist/cli/commands/builtin/git-commands.d.ts +5 -0
- package/dist/cli/commands/builtin/more-commands.d.ts +7 -0
- package/dist/cli/commands/builtin/permissions-command.d.ts +5 -0
- package/dist/cli/commands/builtin/utility-commands.d.ts +5 -0
- package/dist/cli/commands/registry.d.ts +64 -0
- package/dist/cli/commands/repl.d.ts +21 -0
- package/dist/cli/commands/run.d.ts +21 -0
- package/dist/cli/commands/runs.d.ts +14 -0
- package/dist/cli/cost-tracker.d.ts +57 -0
- package/dist/cli/exit.d.ts +12 -0
- package/dist/cli/input/ndjson-reader.d.ts +31 -0
- package/dist/cli/input-compiler.d.ts +5 -0
- package/dist/cli/main.cjs +19674 -0
- package/dist/cli/main.d.ts +5 -0
- package/dist/cli/main.js +19674 -0
- package/dist/cli/onboarding.d.ts +26 -0
- package/dist/cli/output/renderer.d.ts +28 -0
- package/dist/cli/output/terminal-ui.d.ts +50 -0
- package/dist/cli/updater.d.ts +10 -0
- package/dist/compaction-44I55TLI.cjs +32 -0
- package/dist/compaction-CCHWA4G6.js +32 -0
- package/dist/context/compaction.d.ts +83 -0
- package/dist/context/manager.d.ts +99 -0
- package/dist/context/token-counter.d.ts +27 -0
- package/dist/coordinator-5HY7ALO2.js +7 -0
- package/dist/coordinator-INDLPVMF.cjs +7 -0
- package/dist/cost-tracker-IWYAUPXH.js +9 -0
- package/dist/cost-tracker-JXTJQQWE.cjs +9 -0
- package/dist/cron/scheduler.d.ts +34 -0
- package/dist/devtools-KIY3LWQJ.js +6 -0
- package/dist/devtools-LRP47DDV.cjs +6 -0
- package/dist/engine/cost-store.d.ts +22 -0
- package/dist/engine/engine.d.ts +101 -0
- package/dist/engine/model-facade.d.ts +24 -0
- package/dist/engine/query.d.ts +50 -0
- package/dist/engine/streaming-tool-queue.d.ts +34 -0
- package/dist/engine/token-budget.d.ts +22 -0
- package/dist/engine/tool-summary.d.ts +13 -0
- package/dist/engine/turn-loop.d.ts +62 -0
- package/dist/engine/turn-state.d.ts +14 -0
- package/dist/exceptions.d.ts +44 -0
- package/dist/file-history-HZWO2WQ5.js +7 -0
- package/dist/file-history-UQQILIY7.cjs +7 -0
- package/dist/git/utils.d.ts +35 -0
- package/dist/git/worktree.d.ts +36 -0
- package/dist/hooks/events.d.ts +35 -0
- package/dist/hooks/registry.d.ts +15 -0
- package/dist/index.cjs +336 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +336 -0
- package/dist/ink/Ansi.d.ts +10 -0
- package/dist/ink/bidi.d.ts +15 -0
- package/dist/ink/clearTerminal.d.ts +13 -0
- package/dist/ink/colorize.d.ts +16 -0
- package/dist/ink/components/AlternateScreen.d.ts +21 -0
- package/dist/ink/components/App.d.ts +70 -0
- package/dist/ink/components/AppContext.d.ts +11 -0
- package/dist/ink/components/Box.d.ts +49 -0
- package/dist/ink/components/Button.d.ts +36 -0
- package/dist/ink/components/ClockContext.d.ts +9 -0
- package/dist/ink/components/CursorDeclarationContext.d.ts +22 -0
- package/dist/ink/components/ErrorOverview.d.ts +5 -0
- package/dist/ink/components/Link.d.ts +7 -0
- package/dist/ink/components/Newline.d.ts +12 -0
- package/dist/ink/components/NoSelect.d.ts +19 -0
- package/dist/ink/components/RawAnsi.d.ts +16 -0
- package/dist/ink/components/ScrollBox.d.ts +78 -0
- package/dist/ink/components/Spacer.d.ts +5 -0
- package/dist/ink/components/StdinContext.d.ts +27 -0
- package/dist/ink/components/TerminalFocusContext.d.ts +10 -0
- package/dist/ink/components/TerminalSizeContext.d.ts +5 -0
- package/dist/ink/components/Text.d.ts +55 -0
- package/dist/ink/constants.d.ts +1 -0
- package/dist/ink/cursor.d.ts +8 -0
- package/dist/ink/devtools.d.ts +5 -0
- package/dist/ink/dom.d.ts +76 -0
- package/dist/ink/events/click-event.d.ts +31 -0
- package/dist/ink/events/dispatcher.d.ts +40 -0
- package/dist/ink/events/emitter.d.ts +5 -0
- package/dist/ink/events/event-handlers.d.ts +46 -0
- package/dist/ink/events/event.d.ts +5 -0
- package/dist/ink/events/focus-event.d.ts +13 -0
- package/dist/ink/events/input-event.d.ts +30 -0
- package/dist/ink/events/keyboard-event.d.ts +19 -0
- package/dist/ink/events/paste-event.d.ts +8 -0
- package/dist/ink/events/resize-event.d.ts +9 -0
- package/dist/ink/events/terminal-event.d.ts +54 -0
- package/dist/ink/events/terminal-focus-event.d.ts +13 -0
- package/dist/ink/focus.d.ts +43 -0
- package/dist/ink/frame.d.ts +94 -0
- package/dist/ink/get-max-width.d.ts +17 -0
- package/dist/ink/hit-test.d.ts +33 -0
- package/dist/ink/hooks/use-animation-frame.d.ts +26 -0
- package/dist/ink/hooks/use-app.d.ts +5 -0
- package/dist/ink/hooks/use-declared-cursor.d.ts +26 -0
- package/dist/ink/hooks/use-input.d.ts +37 -0
- package/dist/ink/hooks/use-interval.d.ts +18 -0
- package/dist/ink/hooks/use-search-highlight.d.ts +30 -0
- package/dist/ink/hooks/use-selection.d.ts +39 -0
- package/dist/ink/hooks/use-stdin.d.ts +5 -0
- package/dist/ink/hooks/use-tab-status.d.ts +13 -0
- package/dist/ink/hooks/use-terminal-focus.d.ts +10 -0
- package/dist/ink/hooks/use-terminal-title.d.ts +12 -0
- package/dist/ink/hooks/use-terminal-viewport.d.ts +29 -0
- package/dist/ink/index.d.ts +20 -0
- package/dist/ink/ink.d.ts +369 -0
- package/dist/ink/instances.d.ts +3 -0
- package/dist/ink/layout/engine.d.ts +2 -0
- package/dist/ink/layout/geometry.d.ts +30 -0
- package/dist/ink/layout/node.d.ts +125 -0
- package/dist/ink/layout/yoga.d.ts +56 -0
- package/dist/ink/line-width-cache.d.ts +1 -0
- package/dist/ink/log-update.d.ts +17 -0
- package/dist/ink/measure-element.d.ts +16 -0
- package/dist/ink/measure-text.d.ts +6 -0
- package/dist/ink/node-cache.d.ts +20 -0
- package/dist/ink/optimizer.d.ts +15 -0
- package/dist/ink/output.d.ts +119 -0
- package/dist/ink/parse-keypress.d.ts +111 -0
- package/dist/ink/reconciler.d.ts +11 -0
- package/dist/ink/render-border.d.ts +24 -0
- package/dist/ink/render-node-to-output.d.ts +45 -0
- package/dist/ink/render-to-screen.d.ts +46 -0
- package/dist/ink/renderer.d.ts +14 -0
- package/dist/ink/root.d.ts +74 -0
- package/dist/ink/screen.d.ts +269 -0
- package/dist/ink/searchHighlight.d.ts +20 -0
- package/dist/ink/selection.d.ts +229 -0
- package/dist/ink/squash-text-nodes.d.ts +22 -0
- package/dist/ink/stringWidth.d.ts +1 -0
- package/dist/ink/styles.d.ts +306 -0
- package/dist/ink/supports-hyperlinks.d.ts +13 -0
- package/dist/ink/tabstops.d.ts +1 -0
- package/dist/ink/terminal-focus-state.d.ts +6 -0
- package/dist/ink/terminal-querier.d.ts +129 -0
- package/dist/ink/terminal.d.ts +46 -0
- package/dist/ink/termio/ansi.d.ts +65 -0
- package/dist/ink/termio/csi.d.ts +165 -0
- package/dist/ink/termio/dec.d.ts +37 -0
- package/dist/ink/termio/esc.d.ts +12 -0
- package/dist/ink/termio/osc.d.ts +173 -0
- package/dist/ink/termio/parser.d.ts +35 -0
- package/dist/ink/termio/sgr.d.ts +8 -0
- package/dist/ink/termio/tokenize.d.ts +45 -0
- package/dist/ink/termio/types.d.ts +190 -0
- package/dist/ink/termio.d.ts +24 -0
- package/dist/ink/useTerminalNotification.d.ts +28 -0
- package/dist/ink/warn.d.ts +1 -0
- package/dist/ink/widest-line.d.ts +1 -0
- package/dist/ink/wrap-text.d.ts +2 -0
- package/dist/ink/wrapAnsi.d.ts +7 -0
- package/dist/llm/client-base.d.ts +22 -0
- package/dist/llm/client-factory.d.ts +10 -0
- package/dist/llm/model-pool.d.ts +60 -0
- package/dist/llm/providers/anthropic.d.ts +19 -0
- package/dist/llm/providers/openai.d.ts +19 -0
- package/dist/llm/types.d.ts +21 -0
- package/dist/loader-DXFSUB4R.cjs +91 -0
- package/dist/loader-J5UID6CV.js +91 -0
- package/dist/logging/logger.d.ts +19 -0
- package/dist/lsp/client.d.ts +41 -0
- package/dist/lsp/manager.d.ts +40 -0
- package/dist/lsp/servers.d.ts +16 -0
- package/dist/manager-ETWDOCHN.cjs +9 -0
- package/dist/manager-HGMQNEJB.cjs +11 -0
- package/dist/manager-HUAQOORS.js +9 -0
- package/dist/manager-VJIZ2CQC.js +11 -0
- package/dist/mcp-manager-G4G2QASE.cjs +8 -0
- package/dist/mcp-manager-OKXHHWYR.js +8 -0
- package/dist/memory-AP747G5H.js +7 -0
- package/dist/memory-BH3BYUN5.cjs +7 -0
- package/dist/native-ts/yoga-layout/enums.d.ts +117 -0
- package/dist/native-ts/yoga-layout/index.d.ts +270 -0
- package/dist/onboarding-6WEPV7C2.js +11 -0
- package/dist/onboarding-QM5DY2TU.cjs +11 -0
- package/dist/openai-5HQGBL4L.js +9 -0
- package/dist/openai-656VWUQW.cjs +9 -0
- package/dist/plugins/loader.d.ts +72 -0
- package/dist/plugins/types.d.ts +4 -0
- package/dist/preset/index.d.ts +60 -0
- package/dist/product/define.d.ts +60 -0
- package/dist/product/index.cjs +23 -0
- package/dist/product/index.d.ts +5 -0
- package/dist/product/index.js +23 -0
- package/dist/product/types.d.ts +116 -0
- package/dist/prompt/composer.d.ts +42 -0
- package/dist/prompt/instruction-scanner.d.ts +54 -0
- package/dist/prompt/section-cache.d.ts +15 -0
- package/dist/prompt/section-loader.d.ts +26 -0
- package/dist/protocol/client.d.ts +64 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/server.d.ts +49 -0
- package/dist/protocol/transport.d.ts +36 -0
- package/dist/protocol/types.d.ts +150 -0
- package/dist/react-compiler-runtime-shim.d.ts +1 -0
- package/dist/remote/bridge.d.ts +37 -0
- package/dist/run/ArtifactTracker.d.ts +38 -0
- package/dist/run/CheckpointWriter.d.ts +53 -0
- package/dist/run/EngineRunner.d.ts +70 -0
- package/dist/run/Evaluator.d.ts +56 -0
- package/dist/run/FileRunStore.d.ts +39 -0
- package/dist/run/Heartbeat.d.ts +54 -0
- package/dist/run/RunApprovalBackend.d.ts +53 -0
- package/dist/run/RunLock.d.ts +40 -0
- package/dist/run/RunManager.d.ts +76 -0
- package/dist/run/RunQueue.d.ts +27 -0
- package/dist/run/RunStore.d.ts +25 -0
- package/dist/run/factory.d.ts +57 -0
- package/dist/run/index.cjs +50 -0
- package/dist/run/index.d.ts +17 -0
- package/dist/run/index.js +50 -0
- package/dist/run/types.d.ts +136 -0
- package/dist/services/analytics.d.ts +29 -0
- package/dist/services/auto-dream.d.ts +35 -0
- package/dist/services/compact.d.ts +56 -0
- package/dist/services/diagnostics.d.ts +41 -0
- package/dist/services/extract-memories.d.ts +27 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/notifier.d.ts +25 -0
- package/dist/services/oauth.d.ts +27 -0
- package/dist/services/session-memory.d.ts +37 -0
- package/dist/session/file-history.d.ts +41 -0
- package/dist/session/memory.d.ts +45 -0
- package/dist/session/session-manager.d.ts +23 -0
- package/dist/session/transcript.d.ts +39 -0
- package/dist/session-manager-JIIBCFTC.js +8 -0
- package/dist/session-manager-UQKB564H.cjs +8 -0
- package/dist/settings/manager.d.ts +27 -0
- package/dist/settings/schema.d.ts +676 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/matcher.d.ts +21 -0
- package/dist/skills/scanner.d.ts +30 -0
- package/dist/skills-63RBYQRX.js +13 -0
- package/dist/skills-V3BPLW3D.cjs +13 -0
- package/dist/token-counter-CHAXW5O7.cjs +13 -0
- package/dist/token-counter-DSOZGZ5Q.js +13 -0
- package/dist/tool-summary-5P2GKRA4.cjs +31 -0
- package/dist/tool-summary-J2ICNMWP.js +31 -0
- package/dist/tool-system/builtin/agent.d.ts +35 -0
- package/dist/tool-system/builtin/arena.d.ts +18 -0
- package/dist/tool-system/builtin/ask-user.d.ts +12 -0
- package/dist/tool-system/builtin/bash.d.ts +6 -0
- package/dist/tool-system/builtin/brief.d.ts +6 -0
- package/dist/tool-system/builtin/config.d.ts +6 -0
- package/dist/tool-system/builtin/cron.d.ts +10 -0
- package/dist/tool-system/builtin/edit.d.ts +6 -0
- package/dist/tool-system/builtin/file-cache.d.ts +11 -0
- package/dist/tool-system/builtin/glob.d.ts +6 -0
- package/dist/tool-system/builtin/grep.d.ts +6 -0
- package/dist/tool-system/builtin/index.d.ts +10 -0
- package/dist/tool-system/builtin/lsp.d.ts +6 -0
- package/dist/tool-system/builtin/mcp-tools.d.ts +10 -0
- package/dist/tool-system/builtin/notebook-edit.d.ts +6 -0
- package/dist/tool-system/builtin/plan.d.ts +18 -0
- package/dist/tool-system/builtin/powershell.d.ts +6 -0
- package/dist/tool-system/builtin/read.d.ts +6 -0
- package/dist/tool-system/builtin/remote-trigger.d.ts +6 -0
- package/dist/tool-system/builtin/repl.d.ts +6 -0
- package/dist/tool-system/builtin/send-message.d.ts +6 -0
- package/dist/tool-system/builtin/skill.d.ts +6 -0
- package/dist/tool-system/builtin/sleep.d.ts +6 -0
- package/dist/tool-system/builtin/task.d.ts +51 -0
- package/dist/tool-system/builtin/tool-search.d.ts +12 -0
- package/dist/tool-system/builtin/web-fetch.d.ts +6 -0
- package/dist/tool-system/builtin/web-search.d.ts +6 -0
- package/dist/tool-system/builtin/worktree.d.ts +10 -0
- package/dist/tool-system/builtin/write.d.ts +6 -0
- package/dist/tool-system/executor.d.ts +25 -0
- package/dist/tool-system/mcp-manager.d.ts +50 -0
- package/dist/tool-system/permission.d.ts +69 -0
- package/dist/tool-system/registry.d.ts +24 -0
- package/dist/tool-system/validation.d.ts +5 -0
- package/dist/types.d.ts +260 -0
- package/dist/ui/App.d.ts +14 -0
- package/dist/ui/components/AgentBlock.d.ts +32 -0
- package/dist/ui/components/BabyHand.d.ts +1 -0
- package/dist/ui/components/Banner.d.ts +8 -0
- package/dist/ui/components/CodeBlock.d.ts +7 -0
- package/dist/ui/components/CommandInput.d.ts +13 -0
- package/dist/ui/components/ContextUsageBar.d.ts +7 -0
- package/dist/ui/components/DiffView.d.ts +6 -0
- package/dist/ui/components/DogLogo.d.ts +1 -0
- package/dist/ui/components/FullscreenLayout.d.ts +51 -0
- package/dist/ui/components/KunHead.d.ts +1 -0
- package/dist/ui/components/KunLogo.d.ts +1 -0
- package/dist/ui/components/MessageContent.d.ts +22 -0
- package/dist/ui/components/PermissionDialog.d.ts +8 -0
- package/dist/ui/components/PermissionPrompt.d.ts +8 -0
- package/dist/ui/components/ScrollView.d.ts +34 -0
- package/dist/ui/components/Spinner.d.ts +8 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +13 -0
- package/dist/ui/components/StatusLine.d.ts +22 -0
- package/dist/ui/components/StructuredDiff.d.ts +8 -0
- package/dist/ui/components/TaskList.d.ts +6 -0
- package/dist/ui/components/TextInput.d.ts +9 -0
- package/dist/ui/components/ThemedBox.d.ts +19 -0
- package/dist/ui/components/ThemedText.d.ts +26 -0
- package/dist/ui/components/ToolCall.d.ts +21 -0
- package/dist/ui/components/VirtualMessageList.d.ts +24 -0
- package/dist/ui/hooks/useCostSummary.d.ts +1 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/input-history.d.ts +61 -0
- package/dist/ui/store.d.ts +82 -0
- package/dist/ui/terminal-renderer.d.ts +45 -0
- package/dist/ui/theme.d.ts +36 -0
- package/dist/ui/vim-mode.d.ts +25 -0
- package/dist/updater-AVD4LKTQ.js +183 -0
- package/dist/updater-URVNPDPW.cjs +183 -0
- package/dist/utils/debug.d.ts +57 -0
- package/dist/utils/earlyInput.d.ts +43 -0
- package/dist/utils/env.d.ts +24 -0
- package/dist/utils/envUtils.d.ts +51 -0
- package/dist/utils/execFileNoThrow.d.ts +39 -0
- package/dist/utils/format.d.ts +44 -0
- package/dist/utils/fullscreen.d.ts +47 -0
- package/dist/utils/intl.d.ts +22 -0
- package/dist/utils/lockfile.d.ts +15 -0
- package/dist/utils/log.d.ts +56 -0
- package/dist/utils/semver.d.ts +5 -0
- package/dist/utils/sliceAnsi.d.ts +12 -0
- package/dist/utils/systemTheme.d.ts +40 -0
- package/dist/utils/theme.d.ts +91 -0
- package/dist/utils/toolDisplay.d.ts +31 -0
- package/dist/utils/truncate.d.ts +40 -0
- package/dist/voice/index.d.ts +35 -0
- package/dist/voice-KTZ7PAGO.js +80 -0
- package/dist/voice-KZE25GKB.cjs +80 -0
- package/package.json +130 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
+
|
|
3
|
+
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
4
|
+
|
|
5
|
+
// src/session/file-history.ts
|
|
6
|
+
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
7
|
+
var _fs = require('fs');
|
|
8
|
+
var _path = require('path');
|
|
9
|
+
var _crypto = require('crypto');
|
|
10
|
+
var FileHistory = (_class = class _FileHistory {
|
|
11
|
+
|
|
12
|
+
__init() {this.snapshots = []}
|
|
13
|
+
constructor(sessionDir) {;_class.prototype.__init.call(this);
|
|
14
|
+
this.historyDir = _path.join.call(void 0, sessionDir, "file-history");
|
|
15
|
+
_fs.mkdirSync.call(void 0, this.historyDir, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Save a snapshot of a file before it is modified.
|
|
19
|
+
* Returns the snapshot record, or null if the file doesn't exist.
|
|
20
|
+
*/
|
|
21
|
+
saveSnapshot(filePath) {
|
|
22
|
+
const absPath = _path.resolve.call(void 0, filePath);
|
|
23
|
+
if (!_fs.existsSync.call(void 0, absPath)) return null;
|
|
24
|
+
try {
|
|
25
|
+
const content = _fs.readFileSync.call(void 0, absPath);
|
|
26
|
+
const hash = _crypto.createHash.call(void 0, "md5").update(content).digest("hex");
|
|
27
|
+
const existing = this.snapshots.find(
|
|
28
|
+
(s) => s.filePath === absPath && s.hash === hash
|
|
29
|
+
);
|
|
30
|
+
if (existing) return existing;
|
|
31
|
+
const timestamp = Date.now();
|
|
32
|
+
const safeName = absPath.replace(/[/\\:]/g, "_").slice(-100);
|
|
33
|
+
const backupPath = _path.join.call(void 0, this.historyDir, `${timestamp}_${safeName}`);
|
|
34
|
+
_fs.copyFileSync.call(void 0, absPath, backupPath);
|
|
35
|
+
const snapshot = {
|
|
36
|
+
filePath: absPath,
|
|
37
|
+
timestamp,
|
|
38
|
+
backupPath,
|
|
39
|
+
hash,
|
|
40
|
+
size: content.length
|
|
41
|
+
};
|
|
42
|
+
this.snapshots.push(snapshot);
|
|
43
|
+
this.saveIndex();
|
|
44
|
+
return snapshot;
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get all snapshots for a specific file.
|
|
51
|
+
*/
|
|
52
|
+
getSnapshots(filePath) {
|
|
53
|
+
const absPath = _path.resolve.call(void 0, filePath);
|
|
54
|
+
return this.snapshots.filter((s) => s.filePath === absPath).sort((a, b) => b.timestamp - a.timestamp);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Restore a file to a specific snapshot.
|
|
58
|
+
*/
|
|
59
|
+
restore(snapshot) {
|
|
60
|
+
try {
|
|
61
|
+
if (!_fs.existsSync.call(void 0, snapshot.backupPath)) return false;
|
|
62
|
+
this.saveSnapshot(snapshot.filePath);
|
|
63
|
+
_fs.copyFileSync.call(void 0, snapshot.backupPath, snapshot.filePath);
|
|
64
|
+
return true;
|
|
65
|
+
} catch (e2) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Restore a file to its most recent snapshot.
|
|
71
|
+
*/
|
|
72
|
+
restoreLatest(filePath) {
|
|
73
|
+
const snapshots = this.getSnapshots(filePath);
|
|
74
|
+
if (snapshots.length === 0) return false;
|
|
75
|
+
return this.restore(snapshots[0]);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get all tracked files.
|
|
79
|
+
*/
|
|
80
|
+
getTrackedFiles() {
|
|
81
|
+
return [...new Set(this.snapshots.map((s) => s.filePath))];
|
|
82
|
+
}
|
|
83
|
+
saveIndex() {
|
|
84
|
+
try {
|
|
85
|
+
const indexPath = _path.join.call(void 0, this.historyDir, "index.json");
|
|
86
|
+
_fs.writeFileSync.call(void 0, indexPath, JSON.stringify(this.snapshots, null, 2), "utf-8");
|
|
87
|
+
} catch (e3) {
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static loadFromDir(sessionDir) {
|
|
91
|
+
const history = new _FileHistory(sessionDir);
|
|
92
|
+
const indexPath = _path.join.call(void 0, history.historyDir, "index.json");
|
|
93
|
+
if (_fs.existsSync.call(void 0, indexPath)) {
|
|
94
|
+
try {
|
|
95
|
+
history.snapshots = JSON.parse(_fs.readFileSync.call(void 0, indexPath, "utf-8"));
|
|
96
|
+
} catch (e4) {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return history;
|
|
100
|
+
}
|
|
101
|
+
}, _class);
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
exports.FileHistory = FileHistory;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-DI7RDLOS.js";
|
|
4
|
+
|
|
5
|
+
// src/session/memory.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
import { mkdirSync, existsSync, readFileSync, writeFileSync, readdirSync, unlinkSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
var MemoryManager = class {
|
|
11
|
+
memoryDir;
|
|
12
|
+
indexPath;
|
|
13
|
+
constructor(projectDir) {
|
|
14
|
+
const baseDir = join(homedir(), ".code-shell");
|
|
15
|
+
if (projectDir) {
|
|
16
|
+
const projectHash = projectDir.replace(/[/\\:]/g, "-").replace(/^-/, "");
|
|
17
|
+
this.memoryDir = join(baseDir, "projects", projectHash, "memory");
|
|
18
|
+
} else {
|
|
19
|
+
this.memoryDir = join(baseDir, "memory");
|
|
20
|
+
}
|
|
21
|
+
this.indexPath = join(this.memoryDir, "MEMORY.md");
|
|
22
|
+
mkdirSync(this.memoryDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
getMemoryDir() {
|
|
25
|
+
return this.memoryDir;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Save a memory entry. Creates the file and updates the index.
|
|
29
|
+
*/
|
|
30
|
+
save(entry) {
|
|
31
|
+
const fileName = this.slugify(entry.name) + ".md";
|
|
32
|
+
const filePath = join(this.memoryDir, fileName);
|
|
33
|
+
const content = `---
|
|
34
|
+
name: ${entry.name}
|
|
35
|
+
description: ${entry.description}
|
|
36
|
+
type: ${entry.type}
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
${entry.content}
|
|
40
|
+
`;
|
|
41
|
+
writeFileSync(filePath, content, "utf-8");
|
|
42
|
+
this.updateIndex();
|
|
43
|
+
return fileName;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Load all memory entries.
|
|
47
|
+
*/
|
|
48
|
+
loadAll() {
|
|
49
|
+
if (!existsSync(this.memoryDir)) return [];
|
|
50
|
+
const files = readdirSync(this.memoryDir).filter(
|
|
51
|
+
(f) => f.endsWith(".md") && f !== "MEMORY.md"
|
|
52
|
+
);
|
|
53
|
+
const entries = [];
|
|
54
|
+
for (const file of files) {
|
|
55
|
+
const entry = this.loadFile(file);
|
|
56
|
+
if (entry) entries.push(entry);
|
|
57
|
+
}
|
|
58
|
+
return entries;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Load a single memory file.
|
|
62
|
+
*/
|
|
63
|
+
loadFile(fileName) {
|
|
64
|
+
const filePath = join(this.memoryDir, fileName);
|
|
65
|
+
if (!existsSync(filePath)) return null;
|
|
66
|
+
try {
|
|
67
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
68
|
+
const frontmatterMatch = raw.match(/^---\n([\s\S]*?)\n---\n\n?([\s\S]*)$/);
|
|
69
|
+
if (!frontmatterMatch) return null;
|
|
70
|
+
const frontmatter = frontmatterMatch[1];
|
|
71
|
+
const content = frontmatterMatch[2].trim();
|
|
72
|
+
const name = frontmatter.match(/name:\s*(.+)/)?.[1]?.trim() ?? fileName;
|
|
73
|
+
const description = frontmatter.match(/description:\s*(.+)/)?.[1]?.trim() ?? "";
|
|
74
|
+
const type = frontmatter.match(/type:\s*(.+)/)?.[1]?.trim() ?? "project";
|
|
75
|
+
return { name, description, type, content, fileName };
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Delete a memory by name or filename.
|
|
82
|
+
*/
|
|
83
|
+
delete(nameOrFile) {
|
|
84
|
+
const entries = this.loadAll();
|
|
85
|
+
const entry = entries.find(
|
|
86
|
+
(e) => e.name === nameOrFile || e.fileName === nameOrFile
|
|
87
|
+
);
|
|
88
|
+
if (!entry) return false;
|
|
89
|
+
try {
|
|
90
|
+
unlinkSync(join(this.memoryDir, entry.fileName));
|
|
91
|
+
this.updateIndex();
|
|
92
|
+
return true;
|
|
93
|
+
} catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the MEMORY.md index content for injection into prompts.
|
|
99
|
+
*/
|
|
100
|
+
getIndex() {
|
|
101
|
+
if (!existsSync(this.indexPath)) return "";
|
|
102
|
+
return readFileSync(this.indexPath, "utf-8");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Build a prompt-friendly summary of all memories.
|
|
106
|
+
*/
|
|
107
|
+
buildMemoryContext() {
|
|
108
|
+
const entries = this.loadAll();
|
|
109
|
+
if (entries.length === 0) return "";
|
|
110
|
+
const lines = entries.map(
|
|
111
|
+
(e) => `- [${e.type}] ${e.name}: ${e.description}`
|
|
112
|
+
);
|
|
113
|
+
return `# Persistent Memory
|
|
114
|
+
|
|
115
|
+
The following memories from previous sessions may be relevant:
|
|
116
|
+
|
|
117
|
+
` + lines.join("\n") + `
|
|
118
|
+
|
|
119
|
+
To read a specific memory, check ~/.code-shell/memory/`;
|
|
120
|
+
}
|
|
121
|
+
updateIndex() {
|
|
122
|
+
const entries = this.loadAll();
|
|
123
|
+
const lines = entries.map(
|
|
124
|
+
(e) => `- [${e.name}](${e.fileName}) \u2014 ${e.description}`
|
|
125
|
+
);
|
|
126
|
+
const content = lines.length > 0 ? lines.join("\n") + "\n" : "(no memories stored)\n";
|
|
127
|
+
writeFileSync(this.indexPath, content, "utf-8");
|
|
128
|
+
}
|
|
129
|
+
slugify(text) {
|
|
130
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export {
|
|
135
|
+
MemoryManager
|
|
136
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm,
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-DI7RDLOS.js";
|
|
5
|
+
|
|
6
|
+
// src/context/token-counter.ts
|
|
7
|
+
function estimateStringTokens(text) {
|
|
8
|
+
if (!text) return 0;
|
|
9
|
+
const cjkChars = (text.match(/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g) ?? []).length;
|
|
10
|
+
const cjkRatio = cjkChars / text.length;
|
|
11
|
+
if (cjkRatio > 0.3) {
|
|
12
|
+
const cjkTokens = cjkChars / RATIOS.cjk;
|
|
13
|
+
const otherChars = text.length - cjkChars;
|
|
14
|
+
const otherTokens = otherChars / RATIOS.english;
|
|
15
|
+
return Math.ceil(cjkTokens + otherTokens);
|
|
16
|
+
}
|
|
17
|
+
const codeIndicators = ["{", "}", "(", ")", ";", "=>", "import ", "function ", "class ", "const "];
|
|
18
|
+
const codeScore = codeIndicators.reduce((s, ind) => s + (text.includes(ind) ? 1 : 0), 0);
|
|
19
|
+
if (codeScore >= 3) return Math.ceil(text.length / RATIOS.code);
|
|
20
|
+
if (text.startsWith("{") || text.startsWith("[")) return Math.ceil(text.length / RATIOS.json);
|
|
21
|
+
return Math.ceil(text.length / RATIOS.english);
|
|
22
|
+
}
|
|
23
|
+
function estimateMessagesTokens(messages) {
|
|
24
|
+
let total = 0;
|
|
25
|
+
for (const msg of messages) {
|
|
26
|
+
total += 4;
|
|
27
|
+
if (typeof msg.content === "string") {
|
|
28
|
+
total += estimateStringTokens(msg.content);
|
|
29
|
+
} else if (Array.isArray(msg.content)) {
|
|
30
|
+
for (const block of msg.content) {
|
|
31
|
+
total += estimateBlockTokens(block);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return total;
|
|
36
|
+
}
|
|
37
|
+
function estimateBlockTokens(block) {
|
|
38
|
+
let tokens = 2;
|
|
39
|
+
if (block.text) tokens += estimateStringTokens(block.text);
|
|
40
|
+
if (block.content && typeof block.content === "string") {
|
|
41
|
+
tokens += estimateStringTokens(block.content);
|
|
42
|
+
}
|
|
43
|
+
if (block.input) {
|
|
44
|
+
tokens += estimateStringTokens(JSON.stringify(block.input));
|
|
45
|
+
}
|
|
46
|
+
if (block.name) tokens += estimateStringTokens(block.name);
|
|
47
|
+
return tokens;
|
|
48
|
+
}
|
|
49
|
+
function calculateContextUsage(messages, systemPrompt, maxTokens) {
|
|
50
|
+
const systemPromptTokens = estimateStringTokens(systemPrompt);
|
|
51
|
+
const messagesTokens = estimateMessagesTokens(messages);
|
|
52
|
+
const usedTokens = systemPromptTokens + messagesTokens;
|
|
53
|
+
return {
|
|
54
|
+
usedTokens,
|
|
55
|
+
maxTokens,
|
|
56
|
+
usagePercent: usedTokens / maxTokens * 100,
|
|
57
|
+
systemPromptTokens,
|
|
58
|
+
messagesTokens,
|
|
59
|
+
headroom: maxTokens - usedTokens
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
var RATIOS;
|
|
63
|
+
var init_token_counter = __esm({
|
|
64
|
+
"src/context/token-counter.ts"() {
|
|
65
|
+
init_esm_shims();
|
|
66
|
+
RATIOS = {
|
|
67
|
+
english: 4,
|
|
68
|
+
// ~4 chars per token for English prose
|
|
69
|
+
code: 3.2,
|
|
70
|
+
// ~3.2 chars per token for code (more tokens per char)
|
|
71
|
+
json: 3.5,
|
|
72
|
+
// JSON structures
|
|
73
|
+
mixed: 3.6,
|
|
74
|
+
// Mixed content (typical for tool results)
|
|
75
|
+
cjk: 1.5
|
|
76
|
+
// CJK characters: ~1.5 chars per token
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
estimateStringTokens,
|
|
83
|
+
estimateMessagesTokens,
|
|
84
|
+
calculateContextUsage,
|
|
85
|
+
init_token_counter
|
|
86
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-DI7RDLOS.js";
|
|
4
|
+
|
|
5
|
+
// src/skills/index.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
|
|
8
|
+
// src/skills/scanner.ts
|
|
9
|
+
init_esm_shims();
|
|
10
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
|
11
|
+
import { join, resolve } from "path";
|
|
12
|
+
import { homedir } from "os";
|
|
13
|
+
function scanSkills(cwd) {
|
|
14
|
+
const skills = [];
|
|
15
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16
|
+
const dirs = [
|
|
17
|
+
// Project-level
|
|
18
|
+
join(cwd, ".code-shell", "skills"),
|
|
19
|
+
join(cwd, ".claude", "skills"),
|
|
20
|
+
// User-level
|
|
21
|
+
join(homedir(), ".code-shell", "skills"),
|
|
22
|
+
join(homedir(), ".claude", "skills")
|
|
23
|
+
];
|
|
24
|
+
for (const dir of dirs) {
|
|
25
|
+
if (!existsSync(dir)) continue;
|
|
26
|
+
try {
|
|
27
|
+
const files = readdirSync(dir).filter(
|
|
28
|
+
(f) => f.endsWith(".md") && statSync(join(dir, f)).isFile()
|
|
29
|
+
);
|
|
30
|
+
for (const file of files) {
|
|
31
|
+
const filePath = resolve(join(dir, file));
|
|
32
|
+
if (seen.has(filePath)) continue;
|
|
33
|
+
seen.add(filePath);
|
|
34
|
+
const skill = parseSkillFile(filePath);
|
|
35
|
+
if (skill) skills.push(skill);
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return skills;
|
|
41
|
+
}
|
|
42
|
+
function parseSkillFile(filePath) {
|
|
43
|
+
try {
|
|
44
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
45
|
+
const match = raw.match(/^---\n([\s\S]*?)\n---\n\n?([\s\S]*)$/);
|
|
46
|
+
if (!match) return null;
|
|
47
|
+
const frontmatter = match[1];
|
|
48
|
+
const content = match[2].trim();
|
|
49
|
+
const name = extractField(frontmatter, "name");
|
|
50
|
+
if (!name) return null;
|
|
51
|
+
const description = extractField(frontmatter, "description") ?? "";
|
|
52
|
+
const whenToUse = extractField(frontmatter, "when_to_use") ?? "";
|
|
53
|
+
const keywords = extractList(frontmatter, "keywords");
|
|
54
|
+
const tools = extractList(frontmatter, "tools");
|
|
55
|
+
const intents = extractList(frontmatter, "intents");
|
|
56
|
+
return {
|
|
57
|
+
name,
|
|
58
|
+
description,
|
|
59
|
+
triggers: { keywords, tools, intents },
|
|
60
|
+
whenToUse,
|
|
61
|
+
content,
|
|
62
|
+
filePath
|
|
63
|
+
};
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function extractField(frontmatter, field) {
|
|
69
|
+
const match = frontmatter.match(new RegExp(`^${field}:\\s*(.+)$`, "m"));
|
|
70
|
+
return match?.[1]?.trim();
|
|
71
|
+
}
|
|
72
|
+
function extractList(frontmatter, field) {
|
|
73
|
+
const match = frontmatter.match(new RegExp(`${field}:\\s*\\[([^\\]]+)\\]`));
|
|
74
|
+
if (!match) return [];
|
|
75
|
+
return match[1].split(",").map((s) => s.trim().replace(/^['"]|['"]$/g, ""));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/skills/matcher.ts
|
|
79
|
+
init_esm_shims();
|
|
80
|
+
function matchSkillsByInput(skills, input) {
|
|
81
|
+
const inputLower = input.toLowerCase();
|
|
82
|
+
const results = [];
|
|
83
|
+
for (const skill of skills) {
|
|
84
|
+
let bestScore = 0;
|
|
85
|
+
let matchedBy = "";
|
|
86
|
+
if (skill.triggers.keywords) {
|
|
87
|
+
for (const kw of skill.triggers.keywords) {
|
|
88
|
+
if (inputLower.includes(kw.toLowerCase())) {
|
|
89
|
+
const score = kw.length / input.length * 10 + 5;
|
|
90
|
+
if (score > bestScore) {
|
|
91
|
+
bestScore = score;
|
|
92
|
+
matchedBy = "keyword";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (skill.triggers.intents) {
|
|
98
|
+
for (const intent of skill.triggers.intents) {
|
|
99
|
+
if (inputLower.includes(intent.toLowerCase())) {
|
|
100
|
+
const score = 8;
|
|
101
|
+
if (score > bestScore) {
|
|
102
|
+
bestScore = score;
|
|
103
|
+
matchedBy = "intent";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (bestScore > 0) {
|
|
109
|
+
results.push({ skill, score: bestScore, matchedBy });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return results.sort((a, b) => b.score - a.score);
|
|
113
|
+
}
|
|
114
|
+
function matchSkillsByTool(skills, toolName) {
|
|
115
|
+
return skills.filter((s) => s.triggers.tools?.includes(toolName)).map((skill) => ({ skill, score: 10, matchedBy: "tool" }));
|
|
116
|
+
}
|
|
117
|
+
function buildSkillListing(skills) {
|
|
118
|
+
if (skills.length === 0) return "";
|
|
119
|
+
const lines = skills.map(
|
|
120
|
+
(s) => `- **${s.name}**: ${s.description}${s.whenToUse ? ` \u2014 Use when: ${s.whenToUse}` : ""}`
|
|
121
|
+
);
|
|
122
|
+
return `# Available Skills
|
|
123
|
+
|
|
124
|
+
${lines.join("\n")}`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
scanSkills,
|
|
129
|
+
matchSkillsByInput,
|
|
130
|
+
matchSkillsByTool,
|
|
131
|
+
buildSkillListing
|
|
132
|
+
};
|