agent-whisker 0.0.0-stage → 0.2.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/.claude-plugin/marketplace.json +12 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/README.zh-CN.md +165 -0
- package/node_modules/jieba-wasm/LICENSE +25 -0
- package/node_modules/jieba-wasm/README.md +134 -0
- package/node_modules/jieba-wasm/package.json +129 -0
- package/node_modules/jieba-wasm/pkg/nodejs/jieba_rs_wasm.d.ts +24 -0
- package/node_modules/jieba-wasm/pkg/nodejs/jieba_rs_wasm.js +341 -0
- package/node_modules/jieba-wasm/pkg/nodejs/jieba_rs_wasm_bg.wasm +0 -0
- package/node_modules/jieba-wasm/pkg/nodejs/jieba_rs_wasm_bg.wasm.d.ts +25 -0
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +226 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +228 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +120 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +54 -4
- package/packages/antigravity-plugin/README.md +27 -0
- package/packages/antigravity-plugin/README.zh-CN.md +27 -0
- package/packages/antigravity-plugin/agents/review.md +36 -0
- package/packages/antigravity-plugin/hooks.json +24 -0
- package/packages/antigravity-plugin/package.json +7 -0
- package/packages/antigravity-plugin/plugin.json +5 -0
- package/packages/antigravity-plugin/review-perspectives.md +14 -0
- package/packages/antigravity-plugin/rules/agent-whisker.md +7 -0
- package/packages/antigravity-plugin/skills/task-state/SKILL.md +93 -0
- package/packages/claude-plugin/.claude-plugin/plugin.json +8 -0
- package/packages/claude-plugin/.codex-plugin/plugin.json +8 -0
- package/packages/claude-plugin/README.md +242 -0
- package/packages/claude-plugin/README.zh-CN.md +88 -0
- package/packages/claude-plugin/agents/recall.md +28 -0
- package/packages/claude-plugin/agents/review.md +33 -0
- package/packages/claude-plugin/bin/taskstate +1274 -0
- package/packages/claude-plugin/bin/windows-launch.mjs +71 -0
- package/packages/claude-plugin/hooks/codex.json +95 -0
- package/packages/claude-plugin/hooks/hooks.json +80 -0
- package/packages/claude-plugin/package.json +7 -0
- package/packages/claude-plugin/review-perspectives.md +14 -0
- package/packages/claude-plugin/skills/task-state/SKILL.md +93 -0
- package/packages/cli/README.md +294 -0
- package/packages/cli/README.zh-CN.md +294 -0
- package/packages/cli/package.json +16 -0
- package/packages/cli/src/command.js +325 -0
- package/packages/cli/src/commands/catalog.js +101 -0
- package/packages/cli/src/commands/doctor.js +1773 -0
- package/packages/cli/src/commands/document.js +38 -0
- package/packages/cli/src/commands/exclude.js +156 -0
- package/packages/cli/src/commands/extract.js +63 -0
- package/packages/cli/src/commands/grep.js +139 -0
- package/packages/cli/src/commands/hook.js +342 -0
- package/packages/cli/src/commands/index-command.js +199 -0
- package/packages/cli/src/commands/index.js +49 -0
- package/packages/cli/src/commands/ingest.js +332 -0
- package/packages/cli/src/commands/init.js +208 -0
- package/packages/cli/src/commands/install.js +225 -0
- package/packages/cli/src/commands/mcp.js +54 -0
- package/packages/cli/src/commands/nudge.js +83 -0
- package/packages/cli/src/commands/project.js +228 -0
- package/packages/cli/src/commands/read.js +158 -0
- package/packages/cli/src/commands/search.js +283 -0
- package/packages/cli/src/commands/service.js +241 -0
- package/packages/cli/src/commands/sessions.js +611 -0
- package/packages/cli/src/commands/status.js +194 -0
- package/packages/cli/src/commands/tui.js +62 -0
- package/packages/cli/src/commands/version.js +25 -0
- package/packages/cli/src/exclusion.js +88 -0
- package/packages/cli/src/grep-options.js +133 -0
- package/packages/cli/src/index.js +18 -0
- package/packages/cli/src/install/agents.js +99 -0
- package/packages/cli/src/install/antigravity-plugin.js +221 -0
- package/packages/cli/src/install/claude-plugin.js +167 -0
- package/packages/cli/src/install/clients.js +515 -0
- package/packages/cli/src/install/codex-plugin.js +207 -0
- package/packages/cli/src/install/dsh.js +599 -0
- package/packages/cli/src/install/external.js +659 -0
- package/packages/cli/src/install/handlers.js +76 -0
- package/packages/cli/src/install/herdr-mod.js +411 -0
- package/packages/cli/src/install/mcp.js +266 -0
- package/packages/cli/src/install/remove.js +913 -0
- package/packages/cli/src/install/rules.js +669 -0
- package/packages/cli/src/install/steps.js +1767 -0
- package/packages/cli/src/install/wrapper.js +558 -0
- package/packages/cli/src/keystore.js +530 -0
- package/packages/cli/src/launcher.js +184 -0
- package/packages/cli/src/main.js +11 -0
- package/packages/cli/src/node-version.js +25 -0
- package/packages/cli/src/paths.js +16 -0
- package/packages/cli/src/pointer.js +330 -0
- package/packages/cli/src/run.js +254 -0
- package/packages/cli/src/session-wait.js +365 -0
- package/packages/cli/src/store-access.js +51 -0
- package/packages/cli/src/tui/app.js +1430 -0
- package/packages/cli/src/tui/data/call.js +83 -0
- package/packages/cli/src/tui/data/poll.js +24 -0
- package/packages/cli/src/tui/glyphs.js +93 -0
- package/packages/cli/src/tui/i18n.js +342 -0
- package/packages/cli/src/tui/model.js +251 -0
- package/packages/cli/src/tui/pages/common.js +71 -0
- package/packages/cli/src/tui/pages/library.js +154 -0
- package/packages/cli/src/tui/pages/sessions.js +96 -0
- package/packages/cli/src/tui/pages/system.js +124 -0
- package/packages/cli/src/tui/pages/tasks.js +297 -0
- package/packages/cli/src/tui/run.js +216 -0
- package/packages/cli/src/tui/term/keys.js +152 -0
- package/packages/cli/src/tui/term/screen.js +88 -0
- package/packages/cli/src/tui/term/term.js +157 -0
- package/packages/cli/src/tui/term/width.js +290 -0
- package/packages/cli/src/tui/ui/widgets.js +247 -0
- package/packages/core/README.md +53 -0
- package/packages/core/README.zh-CN.md +53 -0
- package/packages/core/package.json +13 -0
- package/packages/core/src/antigravity.js +471 -0
- package/packages/core/src/append.js +309 -0
- package/packages/core/src/atomic-file.js +127 -0
- package/packages/core/src/barrier.js +359 -0
- package/packages/core/src/blobs.js +423 -0
- package/packages/core/src/catalog.js +513 -0
- package/packages/core/src/chunk.js +371 -0
- package/packages/core/src/clairic.js +518 -0
- package/packages/core/src/compact.js +194 -0
- package/packages/core/src/context.js +65 -0
- package/packages/core/src/convert.js +168 -0
- package/packages/core/src/crashpoints.js +59 -0
- package/packages/core/src/db.js +1318 -0
- package/packages/core/src/doc-kind.js +30 -0
- package/packages/core/src/dsh.js +494 -0
- package/packages/core/src/encoding.js +175 -0
- package/packages/core/src/errors.js +139 -0
- package/packages/core/src/excerpt.js +93 -0
- package/packages/core/src/exclude.js +102 -0
- package/packages/core/src/extract.js +708 -0
- package/packages/core/src/extractors.js +170 -0
- package/packages/core/src/format.js +18 -0
- package/packages/core/src/grep.js +623 -0
- package/packages/core/src/host.js +590 -0
- package/packages/core/src/ids.js +242 -0
- package/packages/core/src/index-db.js +1040 -0
- package/packages/core/src/index-view.js +201 -0
- package/packages/core/src/index.js +89 -0
- package/packages/core/src/ingest-file.js +854 -0
- package/packages/core/src/json.js +127 -0
- package/packages/core/src/library-filters.js +126 -0
- package/packages/core/src/library-read.js +751 -0
- package/packages/core/src/nudge.js +129 -0
- package/packages/core/src/observers.js +175 -0
- package/packages/core/src/pages.js +95 -0
- package/packages/core/src/pattern.js +433 -0
- package/packages/core/src/pdf-bookmarks.js +231 -0
- package/packages/core/src/project.js +1073 -0
- package/packages/core/src/protobuf.js +112 -0
- package/packages/core/src/ranking.js +13 -0
- package/packages/core/src/reclassify.js +78 -0
- package/packages/core/src/recovery.js +179 -0
- package/packages/core/src/reducers/library.js +559 -0
- package/packages/core/src/reducers/registry.js +180 -0
- package/packages/core/src/replay.js +525 -0
- package/packages/core/src/rerank.js +1263 -0
- package/packages/core/src/schema.js +479 -0
- package/packages/core/src/search.js +1241 -0
- package/packages/core/src/session-files.js +2320 -0
- package/packages/core/src/session-grep.js +270 -0
- package/packages/core/src/session-reader.js +201 -0
- package/packages/core/src/sessions-read.js +888 -0
- package/packages/core/src/sessions-search.js +1142 -0
- package/packages/core/src/sessions-sync.js +886 -0
- package/packages/core/src/sessions.js +958 -0
- package/packages/core/src/sources.js +558 -0
- package/packages/core/src/state.js +172 -0
- package/packages/core/src/store.js +1039 -0
- package/packages/core/src/tokenize.js +187 -0
- package/packages/core/src/validation.js +127 -0
- package/packages/dsh-plugin/README.md +64 -0
- package/packages/dsh-plugin/README.zh-CN.md +64 -0
- package/packages/dsh-plugin/checked.json +3 -0
- package/packages/dsh-plugin/index.js +520 -0
- package/packages/dsh-plugin/package.json +7 -0
- package/packages/dsh-plugin/skills/task-state/SKILL.md +93 -0
- package/packages/herdr-plugin/README.md +15 -0
- package/packages/herdr-plugin/README.zh-CN.md +15 -0
- package/packages/herdr-plugin/app-mod/main.js +189 -0
- package/packages/herdr-plugin/app-mod/mod.json +1 -0
- package/packages/herdr-plugin/app-mod/status.js +275 -0
- package/packages/herdr-plugin/herdr-plugin.toml +15 -0
- package/packages/herdr-plugin/package.json +7 -0
- package/packages/mcp/README.md +106 -0
- package/packages/mcp/README.zh-CN.md +106 -0
- package/packages/mcp/package.json +13 -0
- package/packages/mcp/src/framing.js +101 -0
- package/packages/mcp/src/index.js +13 -0
- package/packages/mcp/src/instructions.js +378 -0
- package/packages/mcp/src/reload.js +141 -0
- package/packages/mcp/src/roots.js +185 -0
- package/packages/mcp/src/server.js +779 -0
- package/packages/mcp/src/tools/arguments.js +482 -0
- package/packages/mcp/src/tools/context.js +21 -0
- package/packages/mcp/src/tools/definitions.js +343 -0
- package/packages/mcp/src/tools/document-sessions.js +262 -0
- package/packages/mcp/src/tools/extract.js +57 -0
- package/packages/mcp/src/tools/grep.js +39 -0
- package/packages/mcp/src/tools/library.js +716 -0
- package/packages/mcp/src/tools/other-store.js +159 -0
- package/packages/mcp/src/tools/results.js +32 -0
- package/packages/mcp/src/tools/session-entries.js +49 -0
- package/packages/mcp/src/tools/sessions.js +730 -0
- package/packages/mcp/src/tools/text.js +47 -0
- package/packages/mcp/src/tools.js +125 -0
- package/packages/mcp/src/whisker.js +132 -0
- package/packages/pi-extension/LICENSE +21 -0
- package/packages/pi-extension/README.md +29 -0
- package/packages/pi-extension/README.zh-CN.md +29 -0
- package/packages/pi-extension/agents/review.md +33 -0
- package/packages/pi-extension/package.json +20 -0
- package/packages/pi-extension/review-perspectives.md +14 -0
- package/packages/pi-extension/skills/task-state/SKILL.md +93 -0
- package/packages/pi-extension/src/extension.ts +857 -0
- package/packages/pi-extension/src/index.ts +6 -0
- package/packages/service/README.md +22 -0
- package/packages/service/README.zh-CN.md +22 -0
- package/packages/service/package.json +13 -0
- package/packages/service/src/errors.js +38 -0
- package/packages/service/src/files.js +289 -0
- package/packages/service/src/index.js +16 -0
- package/packages/service/src/launch-agent.js +387 -0
- package/packages/service/src/on-demand.js +93 -0
- package/packages/service/src/runtime.js +477 -0
- package/packages/service/src/types.js +119 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
// The tool definitions tools/list sends: TOOL_DEFINITIONS, one deep-frozen array whose order is that of tools/list,
|
|
2
|
+
// and ToolName, the names it holds. Every description and schema is text a model reads, and its bytes are pinned by
|
|
3
|
+
// the MCP tests: a change here is a change of what every client is sent.
|
|
4
|
+
// The argument checks read these same schemas, and the bounds and enums core also enforces are core's constants, so
|
|
5
|
+
// neither can drift from what core accepts.
|
|
6
|
+
import {
|
|
7
|
+
DOC_KINDS,
|
|
8
|
+
GREP_MAX_CONTEXT,
|
|
9
|
+
HARNESSES,
|
|
10
|
+
SEARCH_MAX_LIMIT,
|
|
11
|
+
SEARCH_MAX_QUERIES,
|
|
12
|
+
SESSION_MAX_QUERIES,
|
|
13
|
+
SESSION_READ_DEFAULT_BYTES,
|
|
14
|
+
} from "../../../core/src/index.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* MCP tool annotations of every tool: none changes the user's documents, sessions or registrations (a call may
|
|
18
|
+
* only catch up the store's indexes, or its copy of a changed session, as a sync would). Codex asks for approval before
|
|
19
|
+
* each call unless readOnlyHint is true, and refuses the call when its approval policy is never, so readOnlyHint alone
|
|
20
|
+
* is declared: destructiveHint and idempotentHint mean nothing beside it, and openWorldHint keeps its default (true),
|
|
21
|
+
* which is honest for library_search, since it may send document text to a configured reranking endpoint.
|
|
22
|
+
*/
|
|
23
|
+
const READ_ONLY = { readOnlyHint: true } ;
|
|
24
|
+
|
|
25
|
+
/** The fields of a pattern and how it matches, the same in both grep tools. */
|
|
26
|
+
const PATTERN_PROPERTIES = {
|
|
27
|
+
pattern: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Regex pattern (spaces match any whitespace; set fixed: true for literal text).",
|
|
30
|
+
},
|
|
31
|
+
fixed: { type: "boolean", description: "Match literal text." },
|
|
32
|
+
ignore_case: { type: "boolean", description: "Ignore case; default smart case." },
|
|
33
|
+
word: { type: "boolean", description: "Match whole words." },
|
|
34
|
+
} ;
|
|
35
|
+
|
|
36
|
+
const READ_FROM = "Pass returned 'next' cursor to continue reading.";
|
|
37
|
+
const LIST_AFTER = "Pass returned 'next' cursor to list further.";
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Definitions for the four library tools and three session tools; key order determines tools/list order.
|
|
41
|
+
* Deep freezing prevents mutation, and checkArguments reads these same schemas to avoid drift.
|
|
42
|
+
* Library tools carry a `library_` prefix because Codex shows a tool's own name inside its server namespace and
|
|
43
|
+
* clients' tool search matches on names, where a bare `search` or `read` says nothing about what is searched.
|
|
44
|
+
* Each description starts with when to use the tool and how it differs from its siblings: Claude Code defers schemas
|
|
45
|
+
* and its tool search matches only the first 4096 characters of a description; Codex's tool search indexes whole
|
|
46
|
+
* descriptions together with the server instructions; and the instructions only name each tool by what it is for. Keep
|
|
47
|
+
* every definition within the tools/list budget the MCP tests pin. Each declares READ_ONLY. Lazy
|
|
48
|
+
* clients may read only schemas, so describe each field. Each rule is said once, since a client that loads every
|
|
49
|
+
* definition pays for every copy on each request: a rule on filling a field in that field's description, none the
|
|
50
|
+
* instructions say for every tool (which tool opens a result), and only a description's opening, which tool search
|
|
51
|
+
* matches, says again what a field says. Search/read guidance covers one question per search,
|
|
52
|
+
* question for reranking only, group: document and rerank: false for collecting material, and PDF page reads. No
|
|
53
|
+
* description states a rule against combining arguments: a call that combines them runs, and its answer's note says
|
|
54
|
+
* what it ignored, so the rule costs context only when it matters. The two read tools' from fields say
|
|
55
|
+
* how to read on in the same words. The two grep tools come last, so the others keep their places. Both descriptions
|
|
56
|
+
* lead with exact matching and regular expressions; they share PATTERN_PROPERTIES. Return sizes (max_bytes, max_excerpt_bytes,
|
|
57
|
+
* catalog, session_search and grep limits, session_read windows) have no maximum: their descriptions state the default
|
|
58
|
+
* and that there is no maximum, and the agent decides how much its task needs; the defaults stay small, and the two
|
|
59
|
+
* read tools, which return the most text, ask for only what the task needs in the same words. library_grep's context
|
|
60
|
+
* alone has a maximum, core's (GREP_MAX_CONTEXT), since it multiplies every listed match. max_bytes declares no
|
|
61
|
+
* minimum because core raises a smaller budget to its own and the answer says so. The kind enums, the two query
|
|
62
|
+
* counts, library_search's limit maximum and session_read's default budget are core's constants (DOC_KINDS,
|
|
63
|
+
* SEARCH_MAX_QUERIES, SESSION_MAX_QUERIES, SEARCH_MAX_LIMIT, SESSION_READ_DEFAULT_BYTES), as harness's enum and
|
|
64
|
+
* context's maximum are, so those schemas cannot drift from what core accepts.
|
|
65
|
+
*/
|
|
66
|
+
export const TOOL_DEFINITIONS = deepFreeze([
|
|
67
|
+
{
|
|
68
|
+
name: "library_search",
|
|
69
|
+
description:
|
|
70
|
+
'Find library passages. Survey with group: "document" or rerank: false. Top 3 hits include context; context.in points to hits[in].text.',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
queries: {
|
|
75
|
+
type: "array",
|
|
76
|
+
items: { type: "string" },
|
|
77
|
+
minItems: 1,
|
|
78
|
+
maxItems: SEARCH_MAX_QUERIES,
|
|
79
|
+
description:
|
|
80
|
+
"1-8 keyword phrasings for one question (query both languages in bilingual libraries; <=1024B each).",
|
|
81
|
+
},
|
|
82
|
+
question: {
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "Natural-language question for reranking only; defaults to queries[0].",
|
|
85
|
+
},
|
|
86
|
+
group: { type: "string", enum: ["document"], description: "Return matching documents." },
|
|
87
|
+
rerank: {
|
|
88
|
+
type: "boolean",
|
|
89
|
+
description: "false skips reranking and its cutoff.",
|
|
90
|
+
},
|
|
91
|
+
scope: {
|
|
92
|
+
type: "string",
|
|
93
|
+
enum: ["project", "user", "all"],
|
|
94
|
+
description: "Default: project + user; never other registered projects (run from that project's directory).",
|
|
95
|
+
},
|
|
96
|
+
kind: {
|
|
97
|
+
type: "string",
|
|
98
|
+
enum: [...DOC_KINDS],
|
|
99
|
+
description: "Kind; books/standards without Abstract+References are notes.",
|
|
100
|
+
},
|
|
101
|
+
folder: { type: "string", description: "Folder key from by_folder or ~/path." },
|
|
102
|
+
max_excerpt_bytes: {
|
|
103
|
+
type: "integer",
|
|
104
|
+
minimum: 0,
|
|
105
|
+
description: "UTF-8 bytes per hit; 0 for locators only, no max.",
|
|
106
|
+
},
|
|
107
|
+
limit: {
|
|
108
|
+
type: "integer",
|
|
109
|
+
minimum: 1,
|
|
110
|
+
maximum: SEARCH_MAX_LIMIT,
|
|
111
|
+
description: "Max hits; default 8 passages or 20 documents.",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
required: ["queries"],
|
|
115
|
+
additionalProperties: false,
|
|
116
|
+
},
|
|
117
|
+
annotations: READ_ONLY,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "library_read",
|
|
121
|
+
description:
|
|
122
|
+
"Open a library hit by chunk, PDF page or section; default: start at top. Read only what you need. Chunk reads give [first, last] and chunk_count.",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
doc: { type: "string", description: "Document ID from search, grep or catalog." },
|
|
127
|
+
version: {
|
|
128
|
+
type: "string",
|
|
129
|
+
description: "Pin the version in docs[doc]; default current.",
|
|
130
|
+
},
|
|
131
|
+
chunk: { type: "integer", minimum: 0, description: "Zero-based chunk index." },
|
|
132
|
+
page: { type: "integer", minimum: 1, description: "One-based PDF page." },
|
|
133
|
+
section: { type: "integer", minimum: 0, description: "Zero-based outline index." },
|
|
134
|
+
from: { type: "string", description: READ_FROM },
|
|
135
|
+
before: {
|
|
136
|
+
type: "integer",
|
|
137
|
+
minimum: 0,
|
|
138
|
+
description: "Preceding units; default 0, no max.",
|
|
139
|
+
},
|
|
140
|
+
after: {
|
|
141
|
+
type: "integer",
|
|
142
|
+
minimum: 0,
|
|
143
|
+
description: "Following units; default 0, no max.",
|
|
144
|
+
},
|
|
145
|
+
max_bytes: { type: "integer", description: "UTF-8 budget; default 16384, no max." },
|
|
146
|
+
outline: {
|
|
147
|
+
type: "boolean",
|
|
148
|
+
description: "Add the outline; alone, return only the outline.",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
required: ["doc"],
|
|
152
|
+
additionalProperties: false,
|
|
153
|
+
},
|
|
154
|
+
annotations: READ_ONLY,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "library_catalog",
|
|
158
|
+
description: "Browse library titles or count documents without searching their text.",
|
|
159
|
+
inputSchema: {
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: {
|
|
162
|
+
kind: {
|
|
163
|
+
type: "string",
|
|
164
|
+
enum: [...DOC_KINDS],
|
|
165
|
+
description: "Filter by document kind.",
|
|
166
|
+
},
|
|
167
|
+
limit: {
|
|
168
|
+
type: "integer",
|
|
169
|
+
minimum: 1,
|
|
170
|
+
description: "Page size; default 50, no max.",
|
|
171
|
+
},
|
|
172
|
+
after: { type: "string", description: LIST_AFTER },
|
|
173
|
+
title: {
|
|
174
|
+
type: "string",
|
|
175
|
+
description: "Title substring, ignoring case.",
|
|
176
|
+
},
|
|
177
|
+
folder: {
|
|
178
|
+
type: "string",
|
|
179
|
+
description: "Folder key from by_folder or ~/path.",
|
|
180
|
+
},
|
|
181
|
+
count_by: {
|
|
182
|
+
type: "string",
|
|
183
|
+
enum: ["kind", "folder", "both"],
|
|
184
|
+
description: "Count groups instead of listing rows.",
|
|
185
|
+
},
|
|
186
|
+
fields: {
|
|
187
|
+
type: "array",
|
|
188
|
+
items: { type: "string", enum: ["doc", "title", "source", "kind", "bytes"] },
|
|
189
|
+
minItems: 1,
|
|
190
|
+
maxItems: 5,
|
|
191
|
+
uniqueItems: true,
|
|
192
|
+
description: "Column list; doc always included.",
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
additionalProperties: false,
|
|
196
|
+
},
|
|
197
|
+
annotations: READ_ONLY,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "session_search",
|
|
201
|
+
description:
|
|
202
|
+
"Find work and decisions in retained Claude Code, Codex, pi, Antigravity and DeepSeek Harness sessions. Omit queries to list recent sessions.",
|
|
203
|
+
inputSchema: {
|
|
204
|
+
type: "object",
|
|
205
|
+
properties: {
|
|
206
|
+
queries: {
|
|
207
|
+
type: "array",
|
|
208
|
+
items: { type: "string" },
|
|
209
|
+
minItems: 0,
|
|
210
|
+
maxItems: SESSION_MAX_QUERIES,
|
|
211
|
+
description: "Keyword phrasings, up to 1024 bytes each.",
|
|
212
|
+
},
|
|
213
|
+
harness: {
|
|
214
|
+
type: "string",
|
|
215
|
+
enum: [...HARNESSES],
|
|
216
|
+
description: "Filter by agent program.",
|
|
217
|
+
},
|
|
218
|
+
cwd: { type: "string", description: "Absolute directory and descendants." },
|
|
219
|
+
since: { type: "string", description: "Start: local YYYY-MM-DD or ISO timestamp." },
|
|
220
|
+
until: { type: "string", description: "End: local YYYY-MM-DD or ISO timestamp." },
|
|
221
|
+
after: { type: "string", description: LIST_AFTER },
|
|
222
|
+
parent: { type: "string", description: "Children of this session ID." },
|
|
223
|
+
session: {
|
|
224
|
+
type: "string",
|
|
225
|
+
description: "One session; no 3-hit cap.",
|
|
226
|
+
},
|
|
227
|
+
role: {
|
|
228
|
+
type: "string",
|
|
229
|
+
enum: ["dialogue", "user", "assistant", "tool", "all"],
|
|
230
|
+
description: "Default: user + assistant; all includes tools.",
|
|
231
|
+
},
|
|
232
|
+
subagents: { type: "boolean", description: "Include child sessions; off unless parent is set." },
|
|
233
|
+
group: { type: "string", enum: ["session"], description: "Collect hits under each session." },
|
|
234
|
+
project: {
|
|
235
|
+
type: "boolean",
|
|
236
|
+
description: "Registered project of the server root/cwd.",
|
|
237
|
+
},
|
|
238
|
+
limit: { type: "integer", minimum: 1, description: "Hits or sessions; default 8, no max." },
|
|
239
|
+
},
|
|
240
|
+
additionalProperties: false,
|
|
241
|
+
},
|
|
242
|
+
annotations: READ_ONLY,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: "session_read",
|
|
246
|
+
description:
|
|
247
|
+
"Read around a session hit or from the tail. Read only what you need. Check entries and bytes before a whole read.",
|
|
248
|
+
inputSchema: {
|
|
249
|
+
type: "object",
|
|
250
|
+
properties: {
|
|
251
|
+
session: { type: "string", description: "Session ID, unique native ID or child alias." },
|
|
252
|
+
at: { type: "integer", minimum: 0, description: "Center entry (0-based; default 0)." },
|
|
253
|
+
from: { type: "integer", minimum: 0, description: READ_FROM },
|
|
254
|
+
tail: { type: "integer", minimum: 1, description: "Last N entries matching role." },
|
|
255
|
+
before: { type: "integer", minimum: 0, description: "Entries preceding at; default 2, no max." },
|
|
256
|
+
after: {
|
|
257
|
+
type: "integer",
|
|
258
|
+
minimum: 0,
|
|
259
|
+
description: "Entries after at (default 8) or from (fill byte budget); no max.",
|
|
260
|
+
},
|
|
261
|
+
role: {
|
|
262
|
+
type: "string",
|
|
263
|
+
enum: ["dialogue", "user", "assistant", "tool", "all"],
|
|
264
|
+
description: "Default all; at is always included.",
|
|
265
|
+
},
|
|
266
|
+
whole: { type: "boolean", description: "Read all entries; set max_bytes to page through them." },
|
|
267
|
+
results: {
|
|
268
|
+
type: "boolean",
|
|
269
|
+
description: "Include tool output when the source file matches; default false.",
|
|
270
|
+
},
|
|
271
|
+
max_bytes: {
|
|
272
|
+
type: "integer",
|
|
273
|
+
description: `UTF-8 budget; default ${SESSION_READ_DEFAULT_BYTES}, no max.`,
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
required: ["session"],
|
|
277
|
+
additionalProperties: false,
|
|
278
|
+
},
|
|
279
|
+
annotations: READ_ONLY,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "library_grep",
|
|
283
|
+
description:
|
|
284
|
+
"Locate and count exact matches for a regular expression or literal text in library documents, including PDFs.",
|
|
285
|
+
inputSchema: {
|
|
286
|
+
type: "object",
|
|
287
|
+
properties: {
|
|
288
|
+
...PATTERN_PROPERTIES,
|
|
289
|
+
path: { type: "string", description: "Source/folder key, absolute or ~/ path." },
|
|
290
|
+
kind: { type: "string", enum: [...DOC_KINDS], description: "Filter by document kind." },
|
|
291
|
+
list: { type: "string", enum: ["lines", "documents"], description: "documents: counts only." },
|
|
292
|
+
limit: { type: "integer", minimum: 0, description: "Rows to list; default 100, no max." },
|
|
293
|
+
per_document: { type: "integer", minimum: 1, description: "Line limit per document." },
|
|
294
|
+
context: { type: "integer", minimum: 0, maximum: GREP_MAX_CONTEXT, description: "Lines around each match." },
|
|
295
|
+
},
|
|
296
|
+
required: ["pattern"],
|
|
297
|
+
additionalProperties: false,
|
|
298
|
+
},
|
|
299
|
+
annotations: READ_ONLY,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "session_grep",
|
|
303
|
+
description:
|
|
304
|
+
"Locate and count exact matches for a regular expression or literal text in session history, including tools and subagents.",
|
|
305
|
+
inputSchema: {
|
|
306
|
+
type: "object",
|
|
307
|
+
properties: {
|
|
308
|
+
...PATTERN_PROPERTIES,
|
|
309
|
+
session: { type: "string", description: "Search one session." },
|
|
310
|
+
parent: { type: "string", description: "Search this parent's children." },
|
|
311
|
+
harness: { type: "string", enum: [...HARNESSES], description: "Filter by agent program." },
|
|
312
|
+
cwd: { type: "string", description: "Absolute directory and descendants." },
|
|
313
|
+
project: { type: "boolean", description: "Use the server directory's registered project." },
|
|
314
|
+
since: { type: "string", description: "Start: local YYYY-MM-DD or ISO timestamp." },
|
|
315
|
+
until: { type: "string", description: "End: local YYYY-MM-DD or ISO timestamp." },
|
|
316
|
+
role: {
|
|
317
|
+
type: "string",
|
|
318
|
+
enum: ["dialogue", "user", "assistant", "tool", "all"],
|
|
319
|
+
description: "Default: all roles.",
|
|
320
|
+
},
|
|
321
|
+
subagents: { type: "boolean", description: "Include child sessions; default true." },
|
|
322
|
+
list: { type: "string", enum: ["entries", "sessions"], description: "sessions: counts only." },
|
|
323
|
+
limit: { type: "integer", minimum: 0, description: "Rows to list; default 100, no max." },
|
|
324
|
+
per_session: { type: "integer", minimum: 1, description: "Entry limit per session." },
|
|
325
|
+
},
|
|
326
|
+
required: ["pattern"],
|
|
327
|
+
additionalProperties: false,
|
|
328
|
+
},
|
|
329
|
+
annotations: READ_ONLY,
|
|
330
|
+
},
|
|
331
|
+
] );
|
|
332
|
+
|
|
333
|
+
/** Tool name. */
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
/** Deep-freeze an object and nested objects/arrays; return it. Used once at module load for TOOL_DEFINITIONS. */
|
|
337
|
+
function deepFreeze (value ) {
|
|
338
|
+
if (value !== null && typeof value === "object") {
|
|
339
|
+
for (const inner of Object.values(value)) deepFreeze(inner);
|
|
340
|
+
Object.freeze(value);
|
|
341
|
+
}
|
|
342
|
+
return value;
|
|
343
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// The lines that join a document to its sessions and a session to its documents: a library_read answer ends with the
|
|
2
|
+
// sessions that named the document's file (namedIn), a session_read answer with the library documents among the files
|
|
3
|
+
// its entries name (namedPaths, libraryDocuments, documentsLine). Both are looked up last on the call's handle, read
|
|
4
|
+
// the session index and the state as they stand, and never fail the read they end; the paths looked up and the
|
|
5
|
+
// documents listed are bounded.
|
|
6
|
+
import { isAbsolute, join, normalize, relative, sep } from "node:path";
|
|
7
|
+
import { StoreError } from "../../../core/src/index.js";
|
|
8
|
+
import { INVALID_ARGUMENTS } from "./arguments.js";
|
|
9
|
+
import { MCP_MAX_TIER } from "./context.js";
|
|
10
|
+
import { reasonOf } from "./other-store.js";
|
|
11
|
+
|
|
12
|
+
import { isoSecond, joinNotes } from "./text.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The named_in line of a library_read answer: `{ line }` with `{ sessions, last, session_search }`, how many sessions
|
|
16
|
+
* core's countSessions finds naming the document's source here, the latest such entry's time, and the session_search
|
|
17
|
+
* arguments that list them; `{ note }` when the session index could not be read; null when there is nothing to say (no
|
|
18
|
+
* path here to ask for, no usable session index, no session, or a source no query can hold). A project's document is
|
|
19
|
+
* counted in the project's sessions only (projectCwd cwd: its paths here and their git worktrees), and its call carries
|
|
20
|
+
* project: true. Reads the session index as it stands, as session_search does. Never throws.
|
|
21
|
+
*/
|
|
22
|
+
export function namedIn(
|
|
23
|
+
store ,
|
|
24
|
+
source ,
|
|
25
|
+
cwd ,
|
|
26
|
+
) {
|
|
27
|
+
const asked = sourceQuery(source);
|
|
28
|
+
if (asked === null) return null;
|
|
29
|
+
try {
|
|
30
|
+
const counted = store.countSessions({ queries: [asked.path], ...(asked.project ? { projectCwd: cwd } : {}) });
|
|
31
|
+
if (counted.syncedMs === null || counted.sessions === 0 || counted.lastMs === null) return null;
|
|
32
|
+
return {
|
|
33
|
+
line: {
|
|
34
|
+
sessions: counted.sessions,
|
|
35
|
+
last: isoSecond(counted.lastMs),
|
|
36
|
+
session_search: {
|
|
37
|
+
queries: [asked.path],
|
|
38
|
+
role: "all",
|
|
39
|
+
subagents: true,
|
|
40
|
+
group: "session",
|
|
41
|
+
...(asked.project ? { project: true } : {}),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// A source over a query's 1024 bytes is one session_search could not take either.
|
|
47
|
+
if (error instanceof StoreError && error.code === INVALID_ARGUMENTS) return null;
|
|
48
|
+
return { note: `Sessions were not checked for this file (${reasonOf(error)}).` };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The path a document's sessions are counted by: its source, when that is the path of one of its current locations
|
|
54
|
+
* here (a project location, or this device's under the home directory without `~/` or outside it as it stands), with
|
|
55
|
+
* project true for a project location: a project's document is read from inside the project, and another repository
|
|
56
|
+
* holds the same relative paths; null for a source that is a title or another device's path, and for a bare file name
|
|
57
|
+
* in the home directory, which no scope narrows. Pure.
|
|
58
|
+
*/
|
|
59
|
+
function sourceQuery(source ) {
|
|
60
|
+
if (source === undefined || source.ingestedMs === null || source.source === "") return null;
|
|
61
|
+
const label = source.source;
|
|
62
|
+
const here = source.locations.find((location) =>
|
|
63
|
+
location.device === ""
|
|
64
|
+
? location.path === label
|
|
65
|
+
: location.device === source.device && (location.path === label || location.path === `~/${label}`),
|
|
66
|
+
);
|
|
67
|
+
if (here === undefined) return null;
|
|
68
|
+
if (here.device !== "" && !label.includes("/")) return null;
|
|
69
|
+
return { path: label, project: here.device === "" };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Distinct file paths of a session_read answer looked up in the library, in the order they appear. */
|
|
73
|
+
const NAMED_PATHS = 64;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Spans of an entry's text that may hold a path: a JSON string (group 1), a '…' or `…` span on one line (2, 3), or a
|
|
77
|
+
* run without whitespace, quotes, brackets, `,`, `;`, `|` and `=` (4). Keep URLs whole, including `=`, so their
|
|
78
|
+
* query parameter values cannot be mistaken for files.
|
|
79
|
+
*/
|
|
80
|
+
const NAMED_SPANS =
|
|
81
|
+
/"((?:[^"\\\n]|\\.){1,4096})"|'([^'\n]{1,1024})'|`([^`\n]{1,1024})`|((?:[a-z][a-z\d+.-]*:\/\/|\/\/)[^\s"'`()<>[\]{},;|]+|[^\s"'`()<>[\]{},;|=]+)/giu;
|
|
82
|
+
|
|
83
|
+
/** A last part with an extension, which a path named as a file has. */
|
|
84
|
+
const NAMED_EXTENSION = /\.([\p{L}\p{N}]{1,8})$/u;
|
|
85
|
+
const BARE_EXTENSIONS = new Set(
|
|
86
|
+
(
|
|
87
|
+
"md markdown mdx txt pdf docx doc rtf odt html htm xml json jsonl yaml yml toml ini cfg conf csv tsv rst " +
|
|
88
|
+
"tex bib org adoc epub sql sh bash zsh ps1 py ts tsx js jsx mjs cjs rs go java kt swift c cc cpp h hpp " +
|
|
89
|
+
"cs rb php lua r css scss less vue svelte astro proto graphql"
|
|
90
|
+
).split(" "),
|
|
91
|
+
);
|
|
92
|
+
const MEMBER_CHAIN = /^[\p{ID_Start}_$][\p{ID_Continue}$]*(?:\.[\p{ID_Start}_$][\p{ID_Continue}$]*){2,}$/u;
|
|
93
|
+
const VERSION_OR_MEASURE = /^v?\d*(?:\.\d+)+(?:[a-z]+|[-+.][a-z\d.-]+)?$/iu;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The file paths text names, in order, as absolute paths here: a span of NAMED_SPANS whose last part has an
|
|
97
|
+
* extension (a known document or source extension for bare names), excluding URLs, numbers and bare member chains;
|
|
98
|
+
* trailing punctuation and a `:line` or `:line:column` are dropped;
|
|
99
|
+
* `~/…` under homeDir, an absolute path normalised, a relative one against cwd when cwd is absolute. A JSON string is
|
|
100
|
+
* taken whole when it holds no whitespace or is absolute or `~/…`, and when it holds whitespace it is read again as
|
|
101
|
+
* text, once: a command's arguments sit inside one. Paths over 4096 characters are dropped. Pure.
|
|
102
|
+
*/
|
|
103
|
+
export function namedPaths(text , cwd , homeDir ) {
|
|
104
|
+
const found = [];
|
|
105
|
+
const take = (raw ) => {
|
|
106
|
+
const span = raw
|
|
107
|
+
.replace(/[.,:;!?]+$/u, "")
|
|
108
|
+
.replace(/:\d+(?::\d+)?$/u, "")
|
|
109
|
+
.replaceAll("\\", "/");
|
|
110
|
+
if (/[\0?#]/u.test(span) || raw.startsWith("//") || span.includes("://") || /^www\.[^/]+\//iu.test(span)) return;
|
|
111
|
+
if (/^[a-z][a-z\d+.-]*:/iu.test(span) && !(/^[a-z]:\//iu.test(span) && isAbsolute(span))) return;
|
|
112
|
+
const filename = span.slice(span.lastIndexOf("/") + 1);
|
|
113
|
+
const extension = NAMED_EXTENSION.exec(filename)?.[1]?.toLowerCase();
|
|
114
|
+
if (extension === undefined) return;
|
|
115
|
+
if (
|
|
116
|
+
filename === span &&
|
|
117
|
+
(filename.startsWith(".") || !BARE_EXTENSIONS.has(extension) || MEMBER_CHAIN.test(filename))
|
|
118
|
+
)
|
|
119
|
+
return;
|
|
120
|
+
if (!BARE_EXTENSIONS.has(extension) && VERSION_OR_MEASURE.test(filename)) return;
|
|
121
|
+
const path = span.startsWith("~/")
|
|
122
|
+
? join(homeDir, span.slice(2))
|
|
123
|
+
: isAbsolute(span)
|
|
124
|
+
? normalize(span)
|
|
125
|
+
: isAbsolute(cwd)
|
|
126
|
+
? join(cwd, span)
|
|
127
|
+
: null;
|
|
128
|
+
if (path !== null && path.length <= 4096) found.push(path);
|
|
129
|
+
};
|
|
130
|
+
const scan = (within , again ) => {
|
|
131
|
+
for (const match of within.matchAll(NAMED_SPANS)) {
|
|
132
|
+
if (match[1] === undefined) {
|
|
133
|
+
take(match[2] ?? match[3] ?? match[4] ?? "");
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
let value ;
|
|
137
|
+
try {
|
|
138
|
+
value = JSON.parse(`"${match[1]}"`);
|
|
139
|
+
} catch {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (typeof value !== "string") continue;
|
|
143
|
+
const spaced = /\s/u.test(value);
|
|
144
|
+
if (!spaced || value.startsWith("/") || value.startsWith("~/")) take(value);
|
|
145
|
+
if (spaced && again) scan(value, false);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
scan(text, true);
|
|
149
|
+
return found;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* What the library holds of the files a session_read answer's items name: the documents found at each path looked up
|
|
154
|
+
* (none for a path that names none; a path absent was not looked up), or the sentence saying the library was not read.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* LibraryDocuments of the files a session_read answer's items name: the documents core's documentsAt finds at each of
|
|
160
|
+
* the first NAMED_PATHS distinct paths (paths, by item), in the view library_read reads from cwd (the registered project
|
|
161
|
+
* there and the user scope); `{ note }` when the library could not be read. When the session's own directory belongs
|
|
162
|
+
* to that project through a checkout here (a worktree, resolved as resolveProject resolves it), a path under that
|
|
163
|
+
* checkout that names nothing is looked up again as the project-relative path. A session directory that cannot be
|
|
164
|
+
* resolved (gone, or unreadable) gives no checkout. Reads state only after the read it shapes; never throws.
|
|
165
|
+
*/
|
|
166
|
+
export function libraryDocuments(
|
|
167
|
+
store ,
|
|
168
|
+
paths ,
|
|
169
|
+
sessionCwd ,
|
|
170
|
+
cwd ,
|
|
171
|
+
homeDir ,
|
|
172
|
+
) {
|
|
173
|
+
const asked = [...new Set(paths.flat())].slice(0, NAMED_PATHS);
|
|
174
|
+
const found = new Map ();
|
|
175
|
+
if (asked.length === 0) return { found };
|
|
176
|
+
try {
|
|
177
|
+
const project = store.resolveProject({ cwd, maxTier: MCP_MAX_TIER });
|
|
178
|
+
const scopes = project === null ? ["user"] : [project.scope, "user"];
|
|
179
|
+
let checkout = null;
|
|
180
|
+
if (project !== null && isAbsolute(sessionCwd)) {
|
|
181
|
+
try {
|
|
182
|
+
const own = store.resolveProject({ cwd: sessionCwd, maxTier: MCP_MAX_TIER });
|
|
183
|
+
if (own?.projectId === project.projectId) checkout = own.root;
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (error instanceof StoreError) throw error;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (const path of asked) {
|
|
189
|
+
let documents = store.documentsAt({ scopes, maxTier: MCP_MAX_TIER, path, homeDir });
|
|
190
|
+
const inside = checkout === null ? "" : relative(checkout, path);
|
|
191
|
+
if (
|
|
192
|
+
documents.length === 0 &&
|
|
193
|
+
project !== null &&
|
|
194
|
+
inside !== "" &&
|
|
195
|
+
!inside.startsWith("..") &&
|
|
196
|
+
!isAbsolute(inside)
|
|
197
|
+
)
|
|
198
|
+
documents = store.documentsAt({
|
|
199
|
+
scopes: [project.scope],
|
|
200
|
+
maxTier: MCP_MAX_TIER,
|
|
201
|
+
path: inside.split(sep).join("/"),
|
|
202
|
+
homeDir,
|
|
203
|
+
});
|
|
204
|
+
found.set(path, documents);
|
|
205
|
+
}
|
|
206
|
+
return { found };
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return { note: `The library was not checked for the files these entries name (${reasonOf(error)}).` };
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Library documents a session_read answer lists: as many as library_search lists by default with group: "document".
|
|
214
|
+
* The paths looked up are bounded (NAMED_PATHS), but not the documents at each: documentsAt gives every document whose
|
|
215
|
+
* current location is that path.
|
|
216
|
+
*/
|
|
217
|
+
export const NAMED_DOCUMENTS = 20;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The library_read line of a session_read answer holding items: `line`, one `{ doc, source, at }` per document found at
|
|
221
|
+
* a path the items name (pathsOf), the first listed (NAMED_DOCUMENTS, or fewer to keep max_bytes) in the order of their
|
|
222
|
+
* first mention, at listing the entries that named it (a tool output without at counts for its call's), and no line
|
|
223
|
+
* when listed is 0; `note`, the sentence saying how many of the items' distinct paths were looked up when not all were
|
|
224
|
+
* and the one saying how many documents they name when more than are listed, or the one saying the library was not
|
|
225
|
+
* checked when the items name any file. Pure.
|
|
226
|
+
*/
|
|
227
|
+
export function documentsLine(
|
|
228
|
+
items ,
|
|
229
|
+
pathsOf ,
|
|
230
|
+
documents ,
|
|
231
|
+
listed ,
|
|
232
|
+
) {
|
|
233
|
+
const named = new Set(items.flatMap((item) => pathsOf.get(item) ?? []));
|
|
234
|
+
if (named.size === 0) return {};
|
|
235
|
+
if ("note" in documents) return { note: documents.note };
|
|
236
|
+
const entries = new Map ();
|
|
237
|
+
let entry ;
|
|
238
|
+
for (const item of items) {
|
|
239
|
+
entry = item.at ?? entry;
|
|
240
|
+
if (entry === undefined) continue;
|
|
241
|
+
for (const path of pathsOf.get(item) ?? [])
|
|
242
|
+
for (const document of documents.found.get(path) ?? []) {
|
|
243
|
+
const key = `${document.scope}\u0000${document.docId}`;
|
|
244
|
+
const known = entries.get(key) ?? { doc: document.docId, source: document.source, at: [] };
|
|
245
|
+
if (!known.at.includes(entry)) known.at.push(entry);
|
|
246
|
+
entries.set(key, known);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const looked = [...named].filter((path) => documents.found.has(path)).length;
|
|
250
|
+
const note = joinNotes(
|
|
251
|
+
looked === named.size
|
|
252
|
+
? null
|
|
253
|
+
: `Only ${looked} of the ${named.size} files these entries name were looked up in the library.`,
|
|
254
|
+
entries.size <= listed
|
|
255
|
+
? null
|
|
256
|
+
: `Only ${listed} of the ${entries.size} library documents these entries name are listed.`,
|
|
257
|
+
);
|
|
258
|
+
return {
|
|
259
|
+
...(entries.size === 0 || listed === 0 ? {} : { line: [...entries.values()].slice(0, listed) }),
|
|
260
|
+
...(note === undefined ? {} : { note }),
|
|
261
|
+
};
|
|
262
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXTRACT_MAX_ITEM_BYTES,
|
|
3
|
+
EXTRACT_MAX_MEDIA,
|
|
4
|
+
EXTRACT_MAX_TOTAL_BYTES,
|
|
5
|
+
extractFromLibrary,
|
|
6
|
+
|
|
7
|
+
} from "../../../core/src/index.js";
|
|
8
|
+
import { MCP_MAX_TIER, } from "./context.js";
|
|
9
|
+
|
|
10
|
+
export const EXTRACTION_TOOL_DEFINITION = {
|
|
11
|
+
name: "library_extract",
|
|
12
|
+
description: `Extract typed fields from one library document with Clairic (${EXTRACT_MAX_ITEM_BYTES / 1_048_576} MiB per item, ${EXTRACT_MAX_TOTAL_BYTES / 1_048_576} MiB total). Only a loopback endpoint may receive non-open documents.`,
|
|
13
|
+
annotations: { readOnlyHint: true },
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
required: ["doc", "fields"],
|
|
18
|
+
properties: {
|
|
19
|
+
doc: { type: "string", description: "Document ID from library_search or library_catalog." },
|
|
20
|
+
pages: {
|
|
21
|
+
type: "array",
|
|
22
|
+
items: { type: "integer", minimum: 1 },
|
|
23
|
+
minItems: 1,
|
|
24
|
+
maxItems: EXTRACT_MAX_MEDIA,
|
|
25
|
+
description: "1-based PDF pages to render and extract (at most 4).",
|
|
26
|
+
},
|
|
27
|
+
section: { type: "integer", minimum: 0, description: "0-based outline section (for text/Markdown documents)." },
|
|
28
|
+
chunk: { type: "integer", minimum: 0, description: "0-based chunk ordinal (for text/Markdown documents)." },
|
|
29
|
+
fields: {
|
|
30
|
+
type: "object",
|
|
31
|
+
description: "Typed Clairic field schema, e.g. { revenue: { type: 'number', instructions: '...' } }.",
|
|
32
|
+
},
|
|
33
|
+
state: { type: "string", description: "Optional context or disambiguation note passed alongside the document." },
|
|
34
|
+
source_only: {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
description: "Require values literally printed on the page (returns null otherwise).",
|
|
37
|
+
},
|
|
38
|
+
reference_date: { type: "string", description: "Optional YYYY-MM-DD reference date for relative dates." },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
} ;
|
|
42
|
+
|
|
43
|
+
export function runExtract(store , args , context ) {
|
|
44
|
+
const project = store.resolveProject({ cwd: context.cwd, maxTier: MCP_MAX_TIER });
|
|
45
|
+
return extractFromLibrary(store, context.host, {
|
|
46
|
+
scopes: project ? [project.scope, "user"] : ["user"],
|
|
47
|
+
maxTier: MCP_MAX_TIER,
|
|
48
|
+
docId: args.doc ,
|
|
49
|
+
fields: args.fields ,
|
|
50
|
+
pages: args.pages ,
|
|
51
|
+
section: args.section ,
|
|
52
|
+
chunk: args.chunk ,
|
|
53
|
+
state: args.state ,
|
|
54
|
+
sourceOnly: args.source_only ,
|
|
55
|
+
referenceDate: args.reference_date ,
|
|
56
|
+
});
|
|
57
|
+
}
|