@emiliosp/pi-maestro 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +91 -2
- package/agents/builder.md +40 -0
- package/agents/verifier.md +31 -0
- package/docs/configuration.md +109 -0
- package/docs/maestro.png +0 -0
- package/docs/subagent-integration.md +53 -0
- package/docs/workflow.md +260 -0
- package/extensions/maestro-subagent.ts +88 -0
- package/extensions/maestro.ts +123 -0
- package/node_modules/@js-temporal/polyfill/CHANGELOG.md +453 -0
- package/node_modules/@js-temporal/polyfill/LICENSE +13 -0
- package/node_modules/@js-temporal/polyfill/README.md +90 -0
- package/node_modules/@js-temporal/polyfill/dist/index.cjs +2 -0
- package/node_modules/@js-temporal/polyfill/dist/index.cjs.map +1 -0
- package/node_modules/@js-temporal/polyfill/dist/index.esm.js +2 -0
- package/node_modules/@js-temporal/polyfill/dist/index.esm.js.map +1 -0
- package/node_modules/@js-temporal/polyfill/dist/index.umd.js +2 -0
- package/node_modules/@js-temporal/polyfill/dist/index.umd.js.map +1 -0
- package/node_modules/@js-temporal/polyfill/index.d.cts +1215 -0
- package/node_modules/@js-temporal/polyfill/index.d.ts +1215 -0
- package/node_modules/@js-temporal/polyfill/lib/assert.ts +8 -0
- package/node_modules/@js-temporal/polyfill/lib/bigintmath.ts +39 -0
- package/node_modules/@js-temporal/polyfill/lib/calendar.ts +2424 -0
- package/node_modules/@js-temporal/polyfill/lib/debug.ts +7 -0
- package/node_modules/@js-temporal/polyfill/lib/duration.ts +438 -0
- package/node_modules/@js-temporal/polyfill/lib/durationformat.d.ts +93 -0
- package/node_modules/@js-temporal/polyfill/lib/ecmascript.ts +4973 -0
- package/node_modules/@js-temporal/polyfill/lib/index.ts +34 -0
- package/node_modules/@js-temporal/polyfill/lib/init.ts +43 -0
- package/node_modules/@js-temporal/polyfill/lib/instant.ts +138 -0
- package/node_modules/@js-temporal/polyfill/lib/internaltypes.d.ts +242 -0
- package/node_modules/@js-temporal/polyfill/lib/intl.ts +758 -0
- package/node_modules/@js-temporal/polyfill/lib/intrinsicclass.ts +162 -0
- package/node_modules/@js-temporal/polyfill/lib/legacydate.ts +17 -0
- package/node_modules/@js-temporal/polyfill/lib/math.ts +96 -0
- package/node_modules/@js-temporal/polyfill/lib/now.ts +48 -0
- package/node_modules/@js-temporal/polyfill/lib/plaindate.ts +212 -0
- package/node_modules/@js-temporal/polyfill/lib/plaindatetime.ts +274 -0
- package/node_modules/@js-temporal/polyfill/lib/plainmonthday.ts +110 -0
- package/node_modules/@js-temporal/polyfill/lib/plaintime.ts +154 -0
- package/node_modules/@js-temporal/polyfill/lib/plainyearmonth.ts +157 -0
- package/node_modules/@js-temporal/polyfill/lib/regex.ts +59 -0
- package/node_modules/@js-temporal/polyfill/lib/slots.ts +341 -0
- package/node_modules/@js-temporal/polyfill/lib/temporal.ts +10 -0
- package/node_modules/@js-temporal/polyfill/lib/timeduration.ts +149 -0
- package/node_modules/@js-temporal/polyfill/lib/zoneddatetime.ts +492 -0
- package/node_modules/@js-temporal/polyfill/package.json +143 -0
- package/node_modules/acorn/CHANGELOG.md +998 -0
- package/node_modules/acorn/LICENSE +21 -0
- package/node_modules/acorn/README.md +309 -0
- package/node_modules/acorn/bin/acorn +4 -0
- package/node_modules/acorn/dist/acorn.d.mts +897 -0
- package/node_modules/acorn/dist/acorn.d.ts +897 -0
- package/node_modules/acorn/dist/acorn.js +6342 -0
- package/node_modules/acorn/dist/acorn.mjs +6313 -0
- package/node_modules/acorn/dist/bin.js +90 -0
- package/node_modules/acorn/package.json +50 -0
- package/node_modules/jiti/LICENSE +21 -0
- package/node_modules/jiti/README.md +258 -0
- package/node_modules/jiti/dist/babel.cjs +257 -0
- package/node_modules/jiti/dist/jiti.cjs +1 -0
- package/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/node_modules/jiti/lib/jiti.cjs +30 -0
- package/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/node_modules/jiti/lib/jiti.mjs +29 -0
- package/node_modules/jiti/lib/types.d.ts +420 -0
- package/node_modules/jiti/package.json +146 -0
- package/node_modules/jsbi/LICENSE +176 -0
- package/node_modules/jsbi/README.md +173 -0
- package/node_modules/jsbi/dist/jsbi-cjs.js +2 -0
- package/node_modules/jsbi/dist/jsbi-cjs.js.map +1 -0
- package/node_modules/jsbi/dist/jsbi-umd.js +2 -0
- package/node_modules/jsbi/dist/jsbi-umd.js.map +1 -0
- package/node_modules/jsbi/dist/jsbi.mjs +2 -0
- package/node_modules/jsbi/dist/jsbi.mjs.map +1 -0
- package/node_modules/jsbi/jsbi.d.ts +43 -0
- package/node_modules/jsbi/package.json +35 -0
- package/node_modules/pi-subagents/CHANGELOG.md +2941 -0
- package/node_modules/pi-subagents/LICENSE +21 -0
- package/node_modules/pi-subagents/README.md +129 -0
- package/node_modules/pi-subagents/agents/claude-code-writer.md +16 -0
- package/node_modules/pi-subagents/agents/claude-code.md +15 -0
- package/node_modules/pi-subagents/agents/codex-exec-writer.md +16 -0
- package/node_modules/pi-subagents/agents/codex-exec.md +15 -0
- package/node_modules/pi-subagents/agents/cursor-agent-writer.md +15 -0
- package/node_modules/pi-subagents/agents/cursor-agent.md +14 -0
- package/node_modules/pi-subagents/agents/delegate.md +14 -0
- package/node_modules/pi-subagents/agents/evidence-auditor.md +34 -0
- package/node_modules/pi-subagents/agents/oracle.md +78 -0
- package/node_modules/pi-subagents/agents/researcher.md +62 -0
- package/node_modules/pi-subagents/agents/reviewer.md +91 -0
- package/node_modules/pi-subagents/agents/scout.md +50 -0
- package/node_modules/pi-subagents/agents/worker.md +60 -0
- package/node_modules/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/node_modules/pi-subagents/docs/agents.md +560 -0
- package/node_modules/pi-subagents/docs/configuration.md +691 -0
- package/node_modules/pi-subagents/docs/extension-api.md +632 -0
- package/node_modules/pi-subagents/docs/missions.md +155 -0
- package/node_modules/pi-subagents/docs/models.md +253 -0
- package/node_modules/pi-subagents/docs/observability.md +328 -0
- package/node_modules/pi-subagents/docs/standalone-background.md +59 -0
- package/node_modules/pi-subagents/docs/tool-reference.md +540 -0
- package/node_modules/pi-subagents/docs/watchdog.md +185 -0
- package/node_modules/pi-subagents/docs/workflows.md +568 -0
- package/node_modules/pi-subagents/index.d.ts +3 -0
- package/node_modules/pi-subagents/index.d.ts.map +1 -0
- package/node_modules/pi-subagents/index.js +10 -0
- package/node_modules/pi-subagents/index.js.map +1 -0
- package/node_modules/pi-subagents/inspector-runner.mjs +11 -0
- package/node_modules/pi-subagents/install.mjs +93 -0
- package/node_modules/pi-subagents/node_modules/yaml/LICENSE +13 -0
- package/node_modules/pi-subagents/node_modules/yaml/README.md +172 -0
- package/node_modules/pi-subagents/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/composer.js +217 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/Alias.js +114 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/lexer.js +717 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/parse/parser.js +967 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +64 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/pi-subagents/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/composer.js +222 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Alias.js +116 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Scalar.d.ts +43 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/lexer.js +719 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/parse/parser.js +972 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/merge.js +68 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/pi-subagents/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/pi-subagents/node_modules/yaml/package.json +97 -0
- package/node_modules/pi-subagents/node_modules/yaml/util.js +2 -0
- package/node_modules/pi-subagents/package.json +137 -0
- package/node_modules/pi-subagents/prompts/council.md +63 -0
- package/node_modules/pi-subagents/prompts/gather-context-and-clarify.md +13 -0
- package/node_modules/pi-subagents/prompts/parallel-cleanup.md +59 -0
- package/node_modules/pi-subagents/prompts/parallel-research.md +50 -0
- package/node_modules/pi-subagents/prompts/parallel-review.md +58 -0
- package/node_modules/pi-subagents/prompts/review-loop.md +47 -0
- package/node_modules/pi-subagents/runner-peer-loader.mjs +21 -0
- package/node_modules/pi-subagents/runner-peer-preload.mjs +30 -0
- package/node_modules/pi-subagents/skills/council-mode/SKILL.md +59 -0
- package/node_modules/pi-subagents/skills/council-mode/references/pass-contracts.md +150 -0
- package/node_modules/pi-subagents/skills/pi-subagents/SKILL.md +123 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +74 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/execution-controls.md +561 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +161 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +61 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +297 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/review-and-validation.md +73 -0
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.d.ts +10 -0
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.js +63 -0
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-management.d.ts +28 -0
- package/node_modules/pi-subagents/src/agents/agent-management.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-management.js +1517 -0
- package/node_modules/pi-subagents/src/agents/agent-management.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-memory.d.ts +49 -0
- package/node_modules/pi-subagents/src/agents/agent-memory.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-memory.js +349 -0
- package/node_modules/pi-subagents/src/agents/agent-memory.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-refinements.d.ts +100 -0
- package/node_modules/pi-subagents/src/agents/agent-refinements.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-refinements.js +569 -0
- package/node_modules/pi-subagents/src/agents/agent-refinements.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.d.ts +3 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.js +6 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-selection.d.ts +3 -0
- package/node_modules/pi-subagents/src/agents/agent-selection.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-selection.js +23 -0
- package/node_modules/pi-subagents/src/agents/agent-selection.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-serializer.d.ts +8 -0
- package/node_modules/pi-subagents/src/agents/agent-serializer.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agent-serializer.js +203 -0
- package/node_modules/pi-subagents/src/agents/agent-serializer.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/agents.d.ts +332 -0
- package/node_modules/pi-subagents/src/agents/agents.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/agents.js +2690 -0
- package/node_modules/pi-subagents/src/agents/agents.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/builtin-names.d.ts +2 -0
- package/node_modules/pi-subagents/src/agents/builtin-names.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/builtin-names.js +17 -0
- package/node_modules/pi-subagents/src/agents/builtin-names.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/chain-serializer.d.ts +7 -0
- package/node_modules/pi-subagents/src/agents/chain-serializer.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/chain-serializer.js +319 -0
- package/node_modules/pi-subagents/src/agents/chain-serializer.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/frontmatter.d.ts +16 -0
- package/node_modules/pi-subagents/src/agents/frontmatter.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/frontmatter.js +142 -0
- package/node_modules/pi-subagents/src/agents/frontmatter.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/global-npm-root.d.ts +7 -0
- package/node_modules/pi-subagents/src/agents/global-npm-root.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/global-npm-root.js +58 -0
- package/node_modules/pi-subagents/src/agents/global-npm-root.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/identity.d.ts +8 -0
- package/node_modules/pi-subagents/src/agents/identity.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/identity.js +30 -0
- package/node_modules/pi-subagents/src/agents/identity.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/proactive-skills.d.ts +36 -0
- package/node_modules/pi-subagents/src/agents/proactive-skills.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/proactive-skills.js +156 -0
- package/node_modules/pi-subagents/src/agents/proactive-skills.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-events.d.ts +27 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-events.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-events.js +53 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-events.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-registry.d.ts +64 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-registry.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-registry.js +395 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-registry.js.map +1 -0
- package/node_modules/pi-subagents/src/agents/skills.d.ts +35 -0
- package/node_modules/pi-subagents/src/agents/skills.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/agents/skills.js +718 -0
- package/node_modules/pi-subagents/src/agents/skills.js.map +1 -0
- package/node_modules/pi-subagents/src/api/agents.d.ts +5 -0
- package/node_modules/pi-subagents/src/api/agents.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/agents.js +3 -0
- package/node_modules/pi-subagents/src/api/agents.js.map +1 -0
- package/node_modules/pi-subagents/src/api/background-work.d.ts +39 -0
- package/node_modules/pi-subagents/src/api/background-work.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/background-work.js +165 -0
- package/node_modules/pi-subagents/src/api/background-work.js.map +1 -0
- package/node_modules/pi-subagents/src/api/capability-ceiling.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/capability-ceiling.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/capability-ceiling.js +2 -0
- package/node_modules/pi-subagents/src/api/capability-ceiling.js.map +1 -0
- package/node_modules/pi-subagents/src/api/child-tool-plan.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/child-tool-plan.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/child-tool-plan.js +2 -0
- package/node_modules/pi-subagents/src/api/child-tool-plan.js.map +1 -0
- package/node_modules/pi-subagents/src/api/control-channel.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/control-channel.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/control-channel.js +2 -0
- package/node_modules/pi-subagents/src/api/control-channel.js.map +1 -0
- package/node_modules/pi-subagents/src/api/delegation.d.ts +113 -0
- package/node_modules/pi-subagents/src/api/delegation.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/delegation.js +9 -0
- package/node_modules/pi-subagents/src/api/delegation.js.map +1 -0
- package/node_modules/pi-subagents/src/api/external-job-provider.d.ts +58 -0
- package/node_modules/pi-subagents/src/api/external-job-provider.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/external-job-provider.js +140 -0
- package/node_modules/pi-subagents/src/api/external-job-provider.js.map +1 -0
- package/node_modules/pi-subagents/src/api/external-runs.d.ts +48 -0
- package/node_modules/pi-subagents/src/api/external-runs.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/external-runs.js +245 -0
- package/node_modules/pi-subagents/src/api/external-runs.js.map +1 -0
- package/node_modules/pi-subagents/src/api/inspectors.d.ts +21 -0
- package/node_modules/pi-subagents/src/api/inspectors.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/inspectors.js +12 -0
- package/node_modules/pi-subagents/src/api/inspectors.js.map +1 -0
- package/node_modules/pi-subagents/src/api/intercom-bridge.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/intercom-bridge.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/intercom-bridge.js +2 -0
- package/node_modules/pi-subagents/src/api/intercom-bridge.js.map +1 -0
- package/node_modules/pi-subagents/src/api/preflight.d.ts +177 -0
- package/node_modules/pi-subagents/src/api/preflight.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/preflight.js +406 -0
- package/node_modules/pi-subagents/src/api/preflight.js.map +1 -0
- package/node_modules/pi-subagents/src/api/project-panes.d.ts +8 -0
- package/node_modules/pi-subagents/src/api/project-panes.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/project-panes.js +8 -0
- package/node_modules/pi-subagents/src/api/project-panes.js.map +1 -0
- package/node_modules/pi-subagents/src/api/required-child-extensions.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/required-child-extensions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/required-child-extensions.js +2 -0
- package/node_modules/pi-subagents/src/api/required-child-extensions.js.map +1 -0
- package/node_modules/pi-subagents/src/api/shared-types.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/shared-types.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/shared-types.js +2 -0
- package/node_modules/pi-subagents/src/api/shared-types.js.map +1 -0
- package/node_modules/pi-subagents/src/api/workflow-resources.d.ts +3 -0
- package/node_modules/pi-subagents/src/api/workflow-resources.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/api/workflow-resources.js +2 -0
- package/node_modules/pi-subagents/src/api/workflow-resources.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/config.d.ts +8 -0
- package/node_modules/pi-subagents/src/extension/config.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/config.js +256 -0
- package/node_modules/pi-subagents/src/extension/config.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/control-notices.d.ts +21 -0
- package/node_modules/pi-subagents/src/extension/control-notices.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/control-notices.js +36 -0
- package/node_modules/pi-subagents/src/extension/control-notices.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/doctor.d.ts +33 -0
- package/node_modules/pi-subagents/src/extension/doctor.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/doctor.js +232 -0
- package/node_modules/pi-subagents/src/extension/doctor.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/fanout-child.d.ts +7 -0
- package/node_modules/pi-subagents/src/extension/fanout-child.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/fanout-child.js +280 -0
- package/node_modules/pi-subagents/src/extension/fanout-child.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/herdr-pi-bridge.d.ts +17 -0
- package/node_modules/pi-subagents/src/extension/herdr-pi-bridge.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/herdr-pi-bridge.js +245 -0
- package/node_modules/pi-subagents/src/extension/herdr-pi-bridge.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/index.d.ts +20 -0
- package/node_modules/pi-subagents/src/extension/index.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/index.js +1099 -0
- package/node_modules/pi-subagents/src/extension/index.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/public-execution.d.ts +71 -0
- package/node_modules/pi-subagents/src/extension/public-execution.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/public-execution.js +212 -0
- package/node_modules/pi-subagents/src/extension/public-execution.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/reply-workflow-script.d.ts +12 -0
- package/node_modules/pi-subagents/src/extension/reply-workflow-script.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/reply-workflow-script.js +70 -0
- package/node_modules/pi-subagents/src/extension/reply-workflow-script.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/rpc.d.ts +85 -0
- package/node_modules/pi-subagents/src/extension/rpc.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/rpc.js +720 -0
- package/node_modules/pi-subagents/src/extension/rpc.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/schemas.d.ts +139 -0
- package/node_modules/pi-subagents/src/extension/schemas.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/schemas.js +311 -0
- package/node_modules/pi-subagents/src/extension/schemas.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/steering-notices.d.ts +15 -0
- package/node_modules/pi-subagents/src/extension/steering-notices.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/steering-notices.js +23 -0
- package/node_modules/pi-subagents/src/extension/steering-notices.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/subagent-guide.d.ts +4 -0
- package/node_modules/pi-subagents/src/extension/subagent-guide.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/subagent-guide.js +42 -0
- package/node_modules/pi-subagents/src/extension/subagent-guide.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-activation.d.ts +7 -0
- package/node_modules/pi-subagents/src/extension/tool-activation.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-activation.js +132 -0
- package/node_modules/pi-subagents/src/extension/tool-activation.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-description.d.ts +23 -0
- package/node_modules/pi-subagents/src/extension/tool-description.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-description.js +184 -0
- package/node_modules/pi-subagents/src/extension/tool-description.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-result.d.ts +10 -0
- package/node_modules/pi-subagents/src/extension/tool-result.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-result.js +17 -0
- package/node_modules/pi-subagents/src/extension/tool-result.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/upgrade-notice.d.ts +7 -0
- package/node_modules/pi-subagents/src/extension/upgrade-notice.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/upgrade-notice.js +37 -0
- package/node_modules/pi-subagents/src/extension/upgrade-notice.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/actions.d.ts +23 -0
- package/node_modules/pi-subagents/src/inspectors/actions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/actions.js +155 -0
- package/node_modules/pi-subagents/src/inspectors/actions.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/actions.d.ts +12 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/actions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/actions.js +63 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/actions.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/plugin.d.ts +8 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/plugin.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/plugin.js +24 -0
- package/node_modules/pi-subagents/src/inspectors/ghostty/plugin.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/actions.d.ts +26 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/actions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/actions.js +134 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/actions.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/client.d.ts +42 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/client.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/client.js +130 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/client.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/focus.d.ts +25 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/focus.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/focus.js +50 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/focus.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/plugin.d.ts +7 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/plugin.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/plugin.js +15 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/plugin.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/project-panes.d.ts +137 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/project-panes.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/project-panes.js +608 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/project-panes.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/inspector-runner.d.ts +24 -0
- package/node_modules/pi-subagents/src/inspectors/inspector-runner.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/inspector-runner.js +162 -0
- package/node_modules/pi-subagents/src/inspectors/inspector-runner.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/plugins.d.ts +9 -0
- package/node_modules/pi-subagents/src/inspectors/plugins.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/plugins.js +82 -0
- package/node_modules/pi-subagents/src/inspectors/plugins.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/session-roots-codec.d.ts +16 -0
- package/node_modules/pi-subagents/src/inspectors/session-roots-codec.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/session-roots-codec.js +33 -0
- package/node_modules/pi-subagents/src/inspectors/session-roots-codec.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/shell-command.d.ts +2 -0
- package/node_modules/pi-subagents/src/inspectors/shell-command.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/shell-command.js +17 -0
- package/node_modules/pi-subagents/src/inspectors/shell-command.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/types.d.ts +49 -0
- package/node_modules/pi-subagents/src/inspectors/types.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/types.js +2 -0
- package/node_modules/pi-subagents/src/inspectors/types.js.map +1 -0
- package/node_modules/pi-subagents/src/integrations/herdr-status.d.ts +49 -0
- package/node_modules/pi-subagents/src/integrations/herdr-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/integrations/herdr-status.js +385 -0
- package/node_modules/pi-subagents/src/integrations/herdr-status.js.map +1 -0
- package/node_modules/pi-subagents/src/integrations/pi-web-session-liveness.d.ts +20 -0
- package/node_modules/pi-subagents/src/integrations/pi-web-session-liveness.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/integrations/pi-web-session-liveness.js +54 -0
- package/node_modules/pi-subagents/src/integrations/pi-web-session-liveness.js.map +1 -0
- package/node_modules/pi-subagents/src/intercom/intercom-bridge.d.ts +59 -0
- package/node_modules/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/intercom/intercom-bridge.js +194 -0
- package/node_modules/pi-subagents/src/intercom/intercom-bridge.js.map +1 -0
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.d.ts +64 -0
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.js +899 -0
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -0
- package/node_modules/pi-subagents/src/intercom/result-intercom.d.ts +36 -0
- package/node_modules/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/intercom/result-intercom.js +373 -0
- package/node_modules/pi-subagents/src/intercom/result-intercom.js.map +1 -0
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.d.ts +40 -0
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.js +202 -0
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.js.map +1 -0
- package/node_modules/pi-subagents/src/missions/actions.d.ts +55 -0
- package/node_modules/pi-subagents/src/missions/actions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/missions/actions.js +396 -0
- package/node_modules/pi-subagents/src/missions/actions.js.map +1 -0
- package/node_modules/pi-subagents/src/missions/goal-driver.d.ts +17 -0
- package/node_modules/pi-subagents/src/missions/goal-driver.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/missions/goal-driver.js +172 -0
- package/node_modules/pi-subagents/src/missions/goal-driver.js.map +1 -0
- package/node_modules/pi-subagents/src/missions/lifecycle.d.ts +40 -0
- package/node_modules/pi-subagents/src/missions/lifecycle.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/missions/lifecycle.js +352 -0
- package/node_modules/pi-subagents/src/missions/lifecycle.js.map +1 -0
- package/node_modules/pi-subagents/src/missions/store.d.ts +22 -0
- package/node_modules/pi-subagents/src/missions/store.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/missions/store.js +583 -0
- package/node_modules/pi-subagents/src/missions/store.js.map +1 -0
- package/node_modules/pi-subagents/src/missions/types.d.ts +168 -0
- package/node_modules/pi-subagents/src/missions/types.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/missions/types.js +10 -0
- package/node_modules/pi-subagents/src/missions/types.js.map +1 -0
- package/node_modules/pi-subagents/src/missions/workflow-state.d.ts +15 -0
- package/node_modules/pi-subagents/src/missions/workflow-state.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/missions/workflow-state.js +274 -0
- package/node_modules/pi-subagents/src/missions/workflow-state.js.map +1 -0
- package/node_modules/pi-subagents/src/policy/authority.d.ts +10 -0
- package/node_modules/pi-subagents/src/policy/authority.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/policy/authority.js +42 -0
- package/node_modules/pi-subagents/src/policy/authority.js.map +1 -0
- package/node_modules/pi-subagents/src/profiles/profiles.d.ts +135 -0
- package/node_modules/pi-subagents/src/profiles/profiles.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/profiles/profiles.js +527 -0
- package/node_modules/pi-subagents/src/profiles/profiles.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.d.ts +114 -0
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.js +508 -0
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/active-run-index.d.ts +13 -0
- package/node_modules/pi-subagents/src/runs/background/active-run-index.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/active-run-index.js +158 -0
- package/node_modules/pi-subagents/src/runs/background/active-run-index.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-execution.d.ts +290 -0
- package/node_modules/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-execution.js +2016 -0
- package/node_modules/pi-subagents/src/runs/background/async-execution.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.d.ts +30 -0
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.js +907 -0
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-resume.d.ts +59 -0
- package/node_modules/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-resume.js +672 -0
- package/node_modules/pi-subagents/src/runs/background/async-resume.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-retention.d.ts +45 -0
- package/node_modules/pi-subagents/src/runs/background/async-retention.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-retention.js +916 -0
- package/node_modules/pi-subagents/src/runs/background/async-retention.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-status-snapshot.d.ts +10 -0
- package/node_modules/pi-subagents/src/runs/background/async-status-snapshot.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-status-snapshot.js +25 -0
- package/node_modules/pi-subagents/src/runs/background/async-status-snapshot.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-status.d.ts +170 -0
- package/node_modules/pi-subagents/src/runs/background/async-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/async-status.js +674 -0
- package/node_modules/pi-subagents/src/runs/background/async-status.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/auto-drain.d.ts +17 -0
- package/node_modules/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/auto-drain.js +73 -0
- package/node_modules/pi-subagents/src/runs/background/auto-drain.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/await-async-run.d.ts +23 -0
- package/node_modules/pi-subagents/src/runs/background/await-async-run.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/await-async-run.js +82 -0
- package/node_modules/pi-subagents/src/runs/background/await-async-run.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.d.ts +9 -0
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.js +69 -0
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/calendar-schedule.d.ts +27 -0
- package/node_modules/pi-subagents/src/runs/background/calendar-schedule.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/calendar-schedule.js +94 -0
- package/node_modules/pi-subagents/src/runs/background/calendar-schedule.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/chain-append.d.ts +35 -0
- package/node_modules/pi-subagents/src/runs/background/chain-append.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/chain-append.js +300 -0
- package/node_modules/pi-subagents/src/runs/background/chain-append.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.d.ts +50 -0
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.js +184 -0
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/completion-batcher.d.ts +52 -0
- package/node_modules/pi-subagents/src/runs/background/completion-batcher.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/completion-batcher.js +120 -0
- package/node_modules/pi-subagents/src/runs/background/completion-batcher.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/completion-dedupe.d.ts +14 -0
- package/node_modules/pi-subagents/src/runs/background/completion-dedupe.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/completion-dedupe.js +49 -0
- package/node_modules/pi-subagents/src/runs/background/completion-dedupe.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/completion-replay.d.ts +48 -0
- package/node_modules/pi-subagents/src/runs/background/completion-replay.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/completion-replay.js +267 -0
- package/node_modules/pi-subagents/src/runs/background/completion-replay.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/control-channel.d.ts +170 -0
- package/node_modules/pi-subagents/src/runs/background/control-channel.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/control-channel.js +587 -0
- package/node_modules/pi-subagents/src/runs/background/control-channel.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/fleet-view.d.ts +64 -0
- package/node_modules/pi-subagents/src/runs/background/fleet-view.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/fleet-view.js +667 -0
- package/node_modules/pi-subagents/src/runs/background/fleet-view.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/index-segment.d.ts +16 -0
- package/node_modules/pi-subagents/src/runs/background/index-segment.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/index-segment.js +59 -0
- package/node_modules/pi-subagents/src/runs/background/index-segment.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/inspect-rpc.d.ts +60 -0
- package/node_modules/pi-subagents/src/runs/background/inspect-rpc.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/inspect-rpc.js +406 -0
- package/node_modules/pi-subagents/src/runs/background/inspect-rpc.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/notify.d.ts +182 -0
- package/node_modules/pi-subagents/src/runs/background/notify.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/notify.js +758 -0
- package/node_modules/pi-subagents/src/runs/background/notify.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/owned-process-tree.d.ts +11 -0
- package/node_modules/pi-subagents/src/runs/background/owned-process-tree.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/owned-process-tree.js +117 -0
- package/node_modules/pi-subagents/src/runs/background/owned-process-tree.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/parallel-groups.d.ts +4 -0
- package/node_modules/pi-subagents/src/runs/background/parallel-groups.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/parallel-groups.js +47 -0
- package/node_modules/pi-subagents/src/runs/background/parallel-groups.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/pid-namespace.d.ts +3 -0
- package/node_modules/pi-subagents/src/runs/background/pid-namespace.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/pid-namespace.js +20 -0
- package/node_modules/pi-subagents/src/runs/background/pid-namespace.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal-candidate.d.ts +18 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal-candidate.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal-candidate.js +97 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal-candidate.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal.d.ts +22 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal.js +228 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/result-delivery-ownership.d.ts +11 -0
- package/node_modules/pi-subagents/src/runs/background/result-delivery-ownership.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/result-delivery-ownership.js +37 -0
- package/node_modules/pi-subagents/src/runs/background/result-delivery-ownership.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/result-files.d.ts +33 -0
- package/node_modules/pi-subagents/src/runs/background/result-files.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/result-files.js +528 -0
- package/node_modules/pi-subagents/src/runs/background/result-files.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/result-watcher.d.ts +91 -0
- package/node_modules/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/result-watcher.js +801 -0
- package/node_modules/pi-subagents/src/runs/background/result-watcher.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.d.ts +5 -0
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.js +57 -0
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/retained-children.d.ts +25 -0
- package/node_modules/pi-subagents/src/runs/background/retained-children.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/retained-children.js +129 -0
- package/node_modules/pi-subagents/src/runs/background/retained-children.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/retained-nested-route-tracker.d.ts +13 -0
- package/node_modules/pi-subagents/src/runs/background/retained-nested-route-tracker.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/retained-nested-route-tracker.js +91 -0
- package/node_modules/pi-subagents/src/runs/background/retained-nested-route-tracker.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-child-session.d.ts +127 -0
- package/node_modules/pi-subagents/src/runs/background/run-child-session.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-child-session.js +632 -0
- package/node_modules/pi-subagents/src/runs/background/run-child-session.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-query.d.ts +4 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-query.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-query.js +7 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-query.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.d.ts +23 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.js +170 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-status.d.ts +26 -0
- package/node_modules/pi-subagents/src/runs/background/run-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/run-status.js +839 -0
- package/node_modules/pi-subagents/src/runs/background/run-status.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.d.ts +18 -0
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.js +157 -0
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.d.ts +25 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.js +70 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-sessions.d.ts +7 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-sessions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-sessions.js +35 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-sessions.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.d.ts +43 -0
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.js +114 -0
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-startup-failure.d.ts +14 -0
- package/node_modules/pi-subagents/src/runs/background/runner-startup-failure.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-startup-failure.js +47 -0
- package/node_modules/pi-subagents/src/runs/background/runner-startup-failure.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.d.ts +119 -0
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.js +1178 -0
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/stale-run-reconciler.d.ts +38 -0
- package/node_modules/pi-subagents/src/runs/background/stale-run-reconciler.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/stale-run-reconciler.js +421 -0
- package/node_modules/pi-subagents/src/runs/background/stale-run-reconciler.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/steering.d.ts +52 -0
- package/node_modules/pi-subagents/src/runs/background/steering.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/steering.js +247 -0
- package/node_modules/pi-subagents/src/runs/background/steering.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.d.ts +14 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.js +277 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.d.ts +203 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.js +4991 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.d.ts +122 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.js +735 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.d.ts +8 -0
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.js +123 -0
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/top-level-async.d.ts +8 -0
- package/node_modules/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/top-level-async.js +6 -0
- package/node_modules/pi-subagents/src/runs/background/top-level-async.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-completions.d.ts +29 -0
- package/node_modules/pi-subagents/src/runs/background/wait-completions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-completions.js +265 -0
- package/node_modules/pi-subagents/src/runs/background/wait-completions.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-config.d.ts +9 -0
- package/node_modules/pi-subagents/src/runs/background/wait-config.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-config.js +47 -0
- package/node_modules/pi-subagents/src/runs/background/wait-config.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-subscriptions.d.ts +27 -0
- package/node_modules/pi-subagents/src/runs/background/wait-subscriptions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-subscriptions.js +337 -0
- package/node_modules/pi-subagents/src/runs/background/wait-subscriptions.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-tool.d.ts +7 -0
- package/node_modules/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/wait-tool.js +36 -0
- package/node_modules/pi-subagents/src/runs/background/wait-tool.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.d.ts +31 -0
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.js +81 -0
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-dismiss-action.d.ts +7 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-dismiss-action.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-dismiss-action.js +82 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-dismiss-action.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-steering-action.d.ts +32 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-steering-action.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-steering-action.js +270 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-steering-action.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.d.ts +7 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.js +187 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/command-action.d.ts +13 -0
- package/node_modules/pi-subagents/src/runs/foreground/command-action.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/command-action.js +38 -0
- package/node_modules/pi-subagents/src/runs/foreground/command-action.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/execution.d.ts +11 -0
- package/node_modules/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/execution.js +2159 -0
- package/node_modules/pi-subagents/src/runs/foreground/execution.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-control.d.ts +25 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-control.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-control.js +139 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-control.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-history.d.ts +12 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-history.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-history.js +166 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-history.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/prompt-audit.d.ts +33 -0
- package/node_modules/pi-subagents/src/runs/foreground/prompt-audit.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/prompt-audit.js +139 -0
- package/node_modules/pi-subagents/src/runs/foreground/prompt-audit.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.d.ts +299 -0
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.js +7529 -0
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-detach-reconcile.d.ts +16 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-detach-reconcile.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-detach-reconcile.js +284 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-detach-reconcile.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-foreground-steering.d.ts +44 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-foreground-steering.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-foreground-steering.js +149 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-foreground-steering.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/abort-recovery.d.ts +27 -0
- package/node_modules/pi-subagents/src/runs/shared/abort-recovery.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/abort-recovery.js +109 -0
- package/node_modules/pi-subagents/src/runs/shared/abort-recovery.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/acceptance.d.ts +145 -0
- package/node_modules/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/acceptance.js +1617 -0
- package/node_modules/pi-subagents/src/runs/shared/acceptance.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/agent-contract.d.ts +6 -0
- package/node_modules/pi-subagents/src/runs/shared/agent-contract.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/agent-contract.js +36 -0
- package/node_modules/pi-subagents/src/runs/shared/agent-contract.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/async-status-projection.d.ts +97 -0
- package/node_modules/pi-subagents/src/runs/shared/async-status-projection.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/async-status-projection.js +545 -0
- package/node_modules/pi-subagents/src/runs/shared/async-status-projection.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/background-process-options.d.ts +5 -0
- package/node_modules/pi-subagents/src/runs/shared/background-process-options.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/background-process-options.js +7 -0
- package/node_modules/pi-subagents/src/runs/shared/background-process-options.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/capability-ceiling.d.ts +58 -0
- package/node_modules/pi-subagents/src/runs/shared/capability-ceiling.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/capability-ceiling.js +179 -0
- package/node_modules/pi-subagents/src/runs/shared/capability-ceiling.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/chain-outputs.d.ts +19 -0
- package/node_modules/pi-subagents/src/runs/shared/chain-outputs.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/chain-outputs.js +105 -0
- package/node_modules/pi-subagents/src/runs/shared/chain-outputs.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-commands.d.ts +28 -0
- package/node_modules/pi-subagents/src/runs/shared/child-commands.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-commands.js +250 -0
- package/node_modules/pi-subagents/src/runs/shared/child-commands.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-hooks.d.ts +32 -0
- package/node_modules/pi-subagents/src/runs/shared/child-hooks.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-hooks.js +173 -0
- package/node_modules/pi-subagents/src/runs/shared/child-hooks.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-identity.d.ts +24 -0
- package/node_modules/pi-subagents/src/runs/shared/child-identity.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-identity.js +41 -0
- package/node_modules/pi-subagents/src/runs/shared/child-identity.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch-plan.d.ts +71 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch-plan.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch-plan.js +89 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch-plan.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch.d.ts +116 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch.js +247 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-lifecycle.d.ts +14 -0
- package/node_modules/pi-subagents/src/runs/shared/child-lifecycle.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-lifecycle.js +23 -0
- package/node_modules/pi-subagents/src/runs/shared/child-lifecycle.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-runtime-config.d.ts +106 -0
- package/node_modules/pi-subagents/src/runs/shared/child-runtime-config.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-runtime-config.js +39 -0
- package/node_modules/pi-subagents/src/runs/shared/child-runtime-config.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-session.d.ts +168 -0
- package/node_modules/pi-subagents/src/runs/shared/child-session.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-session.js +584 -0
- package/node_modules/pi-subagents/src/runs/shared/child-session.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.d.ts +77 -0
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.js +385 -0
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/claude-code-adapter.d.ts +81 -0
- package/node_modules/pi-subagents/src/runs/shared/claude-code-adapter.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/claude-code-adapter.js +256 -0
- package/node_modules/pi-subagents/src/runs/shared/claude-code-adapter.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/codex-exec-adapter.d.ts +26 -0
- package/node_modules/pi-subagents/src/runs/shared/codex-exec-adapter.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/codex-exec-adapter.js +128 -0
- package/node_modules/pi-subagents/src/runs/shared/codex-exec-adapter.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/context-mode.d.ts +13 -0
- package/node_modules/pi-subagents/src/runs/shared/context-mode.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/context-mode.js +39 -0
- package/node_modules/pi-subagents/src/runs/shared/context-mode.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/cursor-agent-adapter.d.ts +27 -0
- package/node_modules/pi-subagents/src/runs/shared/cursor-agent-adapter.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/cursor-agent-adapter.js +100 -0
- package/node_modules/pi-subagents/src/runs/shared/cursor-agent-adapter.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.d.ts +50 -0
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.js +274 -0
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.d.ts +18 -0
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.js +23 -0
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/extension-bindings.d.ts +17 -0
- package/node_modules/pi-subagents/src/runs/shared/extension-bindings.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/extension-bindings.js +83 -0
- package/node_modules/pi-subagents/src/runs/shared/extension-bindings.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-contract.d.ts +30 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-contract.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-contract.js +146 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-contract.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-preflight.d.ts +42 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-preflight.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-preflight.js +160 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-preflight.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.d.ts +66 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.js +425 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-bridge.d.ts +25 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-bridge.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-bridge.js +487 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-bridge.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-runner.d.ts +45 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-runner.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-runner.js +353 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-runner.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/fast-mode-extension.d.ts +4 -0
- package/node_modules/pi-subagents/src/runs/shared/fast-mode-extension.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/fast-mode-extension.js +9 -0
- package/node_modules/pi-subagents/src/runs/shared/fast-mode-extension.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/git-environment.d.ts +3 -0
- package/node_modules/pi-subagents/src/runs/shared/git-environment.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/git-environment.js +28 -0
- package/node_modules/pi-subagents/src/runs/shared/git-environment.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-connection.d.ts +71 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-connection.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-connection.js +258 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-connection.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-external-adapters.d.ts +148 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-external-adapters.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-external-adapters.js +405 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-external-adapters.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-machine.d.ts +48 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-machine.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-machine.js +247 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-machine.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-pi-protocol.d.ts +22 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-pi-protocol.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-pi-protocol.js +58 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-pi-protocol.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.d.ts +267 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.js +716 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/host-step-status.d.ts +34 -0
- package/node_modules/pi-subagents/src/runs/shared/host-step-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/host-step-status.js +245 -0
- package/node_modules/pi-subagents/src/runs/shared/host-step-status.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/lane-metadata.d.ts +24 -0
- package/node_modules/pi-subagents/src/runs/shared/lane-metadata.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/lane-metadata.js +127 -0
- package/node_modules/pi-subagents/src/runs/shared/lane-metadata.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/launch-cwd.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/shared/launch-cwd.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/launch-cwd.js +17 -0
- package/node_modules/pi-subagents/src/runs/shared/launch-cwd.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/long-running-guard.d.ts +33 -0
- package/node_modules/pi-subagents/src/runs/shared/long-running-guard.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/long-running-guard.js +199 -0
- package/node_modules/pi-subagents/src/runs/shared/long-running-guard.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-config-sources.d.ts +34 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-config-sources.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-config-sources.js +419 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-config-sources.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.d.ts +87 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.js +478 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-grant.d.ts +43 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-grant.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-grant.js +160 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-grant.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.d.ts +22 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.js +65 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.d.ts +106 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.js +377 -0
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/model-scope.d.ts +69 -0
- package/node_modules/pi-subagents/src/runs/shared/model-scope.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/model-scope.js +172 -0
- package/node_modules/pi-subagents/src/runs/shared/model-scope.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mutation-evidence.d.ts +19 -0
- package/node_modules/pi-subagents/src/runs/shared/mutation-evidence.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/mutation-evidence.js +199 -0
- package/node_modules/pi-subagents/src/runs/shared/mutation-evidence.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.d.ts +134 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.js +1056 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-path.d.ts +9 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-path.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-path.js +35 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-path.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-render.d.ts +21 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-render.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-render.js +116 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-render.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.d.ts +33 -0
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.js +527 -0
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.d.ts +79 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.js +780 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.d.ts +168 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.js +126 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/partial-output.d.ts +18 -0
- package/node_modules/pi-subagents/src/runs/shared/partial-output.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/partial-output.js +29 -0
- package/node_modules/pi-subagents/src/runs/shared/partial-output.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/permissions.d.ts +13 -0
- package/node_modules/pi-subagents/src/runs/shared/permissions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/permissions.js +93 -0
- package/node_modules/pi-subagents/src/runs/shared/permissions.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/pi-spawn.d.ts +28 -0
- package/node_modules/pi-subagents/src/runs/shared/pi-spawn.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/pi-spawn.js +156 -0
- package/node_modules/pi-subagents/src/runs/shared/pi-spawn.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/process-signal.d.ts +16 -0
- package/node_modules/pi-subagents/src/runs/shared/process-signal.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/process-signal.js +22 -0
- package/node_modules/pi-subagents/src/runs/shared/process-signal.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/readonly-drain-observation.d.ts +26 -0
- package/node_modules/pi-subagents/src/runs/shared/readonly-drain-observation.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/readonly-drain-observation.js +51 -0
- package/node_modules/pi-subagents/src/runs/shared/readonly-drain-observation.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/run-fanout-budget.d.ts +15 -0
- package/node_modules/pi-subagents/src/runs/shared/run-fanout-budget.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/run-fanout-budget.js +259 -0
- package/node_modules/pi-subagents/src/runs/shared/run-fanout-budget.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/run-history.d.ts +67 -0
- package/node_modules/pi-subagents/src/runs/shared/run-history.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/run-history.js +270 -0
- package/node_modules/pi-subagents/src/runs/shared/run-history.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.d.ts +8 -0
- package/node_modules/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.js +45 -0
- package/node_modules/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/session-lease.d.ts +70 -0
- package/node_modules/pi-subagents/src/runs/shared/session-lease.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/session-lease.js +251 -0
- package/node_modules/pi-subagents/src/runs/shared/session-lease.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/single-output.d.ts +61 -0
- package/node_modules/pi-subagents/src/runs/shared/single-output.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/single-output.js +271 -0
- package/node_modules/pi-subagents/src/runs/shared/single-output.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/spawn-budget.d.ts +21 -0
- package/node_modules/pi-subagents/src/runs/shared/spawn-budget.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/spawn-budget.js +94 -0
- package/node_modules/pi-subagents/src/runs/shared/spawn-budget.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/structured-output.d.ts +64 -0
- package/node_modules/pi-subagents/src/runs/shared/structured-output.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/structured-output.js +465 -0
- package/node_modules/pi-subagents/src/runs/shared/structured-output.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.d.ts +50 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.js +247 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts +29 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +573 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-availability.d.ts +17 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-availability.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-availability.js +30 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-availability.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.d.ts +22 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.js +79 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-timeout.d.ts +32 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-timeout.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-timeout.js +74 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-timeout.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-budget.d.ts +8 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-budget.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-budget.js +75 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-budget.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-reconciliation.d.ts +9 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-reconciliation.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-reconciliation.js +72 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-reconciliation.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-async-child-guidance.d.ts +4 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-async-child-guidance.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-async-child-guidance.js +18 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-async-child-guidance.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-graph.d.ts +32 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-graph.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-graph.js +222 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-graph.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-apply.d.ts +37 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-apply.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-apply.js +179 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-apply.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.d.ts +85 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.js +804 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-lock.d.ts +6 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-lock.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-lock.js +41 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-lock.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-setup-command.d.ts +39 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-setup-command.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-setup-command.js +201 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-setup-command.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree.d.ts +182 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree.js +1347 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/accessible-dir.d.ts +12 -0
- package/node_modules/pi-subagents/src/shared/accessible-dir.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/accessible-dir.js +37 -0
- package/node_modules/pi-subagents/src/shared/accessible-dir.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/agent-stream-options.d.ts +6 -0
- package/node_modules/pi-subagents/src/shared/agent-stream-options.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/agent-stream-options.js +4 -0
- package/node_modules/pi-subagents/src/shared/agent-stream-options.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/artifacts.d.ts +23 -0
- package/node_modules/pi-subagents/src/shared/artifacts.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/artifacts.js +273 -0
- package/node_modules/pi-subagents/src/shared/artifacts.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/atomic-json.d.ts +19 -0
- package/node_modules/pi-subagents/src/shared/atomic-json.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/atomic-json.js +60 -0
- package/node_modules/pi-subagents/src/shared/atomic-json.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/capacity-resilient-json.d.ts +27 -0
- package/node_modules/pi-subagents/src/shared/capacity-resilient-json.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/capacity-resilient-json.js +87 -0
- package/node_modules/pi-subagents/src/shared/capacity-resilient-json.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/child-cache-retention.d.ts +30 -0
- package/node_modules/pi-subagents/src/shared/child-cache-retention.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/child-cache-retention.js +41 -0
- package/node_modules/pi-subagents/src/shared/child-cache-retention.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/child-session-name.d.ts +9 -0
- package/node_modules/pi-subagents/src/shared/child-session-name.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/child-session-name.js +41 -0
- package/node_modules/pi-subagents/src/shared/child-session-name.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/child-transcript.d.ts +38 -0
- package/node_modules/pi-subagents/src/shared/child-transcript.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/child-transcript.js +226 -0
- package/node_modules/pi-subagents/src/shared/child-transcript.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/completion-owner.d.ts +3 -0
- package/node_modules/pi-subagents/src/shared/completion-owner.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/completion-owner.js +9 -0
- package/node_modules/pi-subagents/src/shared/completion-owner.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/disabled-features.d.ts +92 -0
- package/node_modules/pi-subagents/src/shared/disabled-features.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/disabled-features.js +113 -0
- package/node_modules/pi-subagents/src/shared/disabled-features.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/display-text.d.ts +6 -0
- package/node_modules/pi-subagents/src/shared/display-text.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/display-text.js +155 -0
- package/node_modules/pi-subagents/src/shared/display-text.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/extension-context.d.ts +17 -0
- package/node_modules/pi-subagents/src/shared/extension-context.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/extension-context.js +33 -0
- package/node_modules/pi-subagents/src/shared/extension-context.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/file-coalescer.d.ts +12 -0
- package/node_modules/pi-subagents/src/shared/file-coalescer.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/file-coalescer.js +35 -0
- package/node_modules/pi-subagents/src/shared/file-coalescer.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/file-lease.d.ts +5 -0
- package/node_modules/pi-subagents/src/shared/file-lease.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/file-lease.js +101 -0
- package/node_modules/pi-subagents/src/shared/file-lease.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/file-system-retry.d.ts +32 -0
- package/node_modules/pi-subagents/src/shared/file-system-retry.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/file-system-retry.js +85 -0
- package/node_modules/pi-subagents/src/shared/file-system-retry.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/fork-context.d.ts +63 -0
- package/node_modules/pi-subagents/src/shared/fork-context.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/fork-context.js +176 -0
- package/node_modules/pi-subagents/src/shared/fork-context.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/fork-session-cwd.d.ts +3 -0
- package/node_modules/pi-subagents/src/shared/fork-session-cwd.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/fork-session-cwd.js +24 -0
- package/node_modules/pi-subagents/src/shared/fork-session-cwd.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/formatters.d.ts +36 -0
- package/node_modules/pi-subagents/src/shared/formatters.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/formatters.js +143 -0
- package/node_modules/pi-subagents/src/shared/formatters.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/jsonl-writer.d.ts +21 -0
- package/node_modules/pi-subagents/src/shared/jsonl-writer.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/jsonl-writer.js +68 -0
- package/node_modules/pi-subagents/src/shared/jsonl-writer.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/launch-contract.d.ts +64 -0
- package/node_modules/pi-subagents/src/shared/launch-contract.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/launch-contract.js +140 -0
- package/node_modules/pi-subagents/src/shared/launch-contract.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/model-info.d.ts +48 -0
- package/node_modules/pi-subagents/src/shared/model-info.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/model-info.js +82 -0
- package/node_modules/pi-subagents/src/shared/model-info.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/model-response-aliases.d.ts +2 -0
- package/node_modules/pi-subagents/src/shared/model-response-aliases.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/model-response-aliases.js +16 -0
- package/node_modules/pi-subagents/src/shared/model-response-aliases.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/node-executable.d.ts +2 -0
- package/node_modules/pi-subagents/src/shared/node-executable.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/node-executable.js +21 -0
- package/node_modules/pi-subagents/src/shared/node-executable.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/opencode-session-headers.d.ts +13 -0
- package/node_modules/pi-subagents/src/shared/opencode-session-headers.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/opencode-session-headers.js +27 -0
- package/node_modules/pi-subagents/src/shared/opencode-session-headers.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/prompt-resources.d.ts +6 -0
- package/node_modules/pi-subagents/src/shared/prompt-resources.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/prompt-resources.js +11 -0
- package/node_modules/pi-subagents/src/shared/prompt-resources.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/pruned-fork.d.ts +35 -0
- package/node_modules/pi-subagents/src/shared/pruned-fork.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/pruned-fork.js +429 -0
- package/node_modules/pi-subagents/src/shared/pruned-fork.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/required-child-extensions.d.ts +35 -0
- package/node_modules/pi-subagents/src/shared/required-child-extensions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/required-child-extensions.js +106 -0
- package/node_modules/pi-subagents/src/shared/required-child-extensions.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/session-file-trust.d.ts +2 -0
- package/node_modules/pi-subagents/src/shared/session-file-trust.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/session-file-trust.js +21 -0
- package/node_modules/pi-subagents/src/shared/session-file-trust.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/session-identity.d.ts +7 -0
- package/node_modules/pi-subagents/src/shared/session-identity.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/session-identity.js +7 -0
- package/node_modules/pi-subagents/src/shared/session-identity.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/session-tokens.d.ts +3 -0
- package/node_modules/pi-subagents/src/shared/session-tokens.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/session-tokens.js +59 -0
- package/node_modules/pi-subagents/src/shared/session-tokens.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/settings-file-lease.d.ts +5 -0
- package/node_modules/pi-subagents/src/shared/settings-file-lease.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/settings-file-lease.js +39 -0
- package/node_modules/pi-subagents/src/shared/settings-file-lease.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/settings.d.ts +147 -0
- package/node_modules/pi-subagents/src/shared/settings.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/settings.js +248 -0
- package/node_modules/pi-subagents/src/shared/settings.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/shortcuts.d.ts +2 -0
- package/node_modules/pi-subagents/src/shared/shortcuts.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/shortcuts.js +18 -0
- package/node_modules/pi-subagents/src/shared/shortcuts.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/status-format.d.ts +10 -0
- package/node_modules/pi-subagents/src/shared/status-format.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/status-format.js +61 -0
- package/node_modules/pi-subagents/src/shared/status-format.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/thinking-ceiling.d.ts +14 -0
- package/node_modules/pi-subagents/src/shared/thinking-ceiling.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/thinking-ceiling.js +38 -0
- package/node_modules/pi-subagents/src/shared/thinking-ceiling.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/types.d.ts +2725 -0
- package/node_modules/pi-subagents/src/shared/types.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/types.js +267 -0
- package/node_modules/pi-subagents/src/shared/types.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/utf8.d.ts +6 -0
- package/node_modules/pi-subagents/src/shared/utf8.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/utf8.js +13 -0
- package/node_modules/pi-subagents/src/shared/utf8.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/utils.d.ts +71 -0
- package/node_modules/pi-subagents/src/shared/utils.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/utils.js +593 -0
- package/node_modules/pi-subagents/src/shared/utils.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/watch-strategy.d.ts +3 -0
- package/node_modules/pi-subagents/src/shared/watch-strategy.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/watch-strategy.js +6 -0
- package/node_modules/pi-subagents/src/shared/watch-strategy.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/workflow-child-permit.d.ts +59 -0
- package/node_modules/pi-subagents/src/shared/workflow-child-permit.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/workflow-child-permit.js +160 -0
- package/node_modules/pi-subagents/src/shared/workflow-child-permit.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/delegation-adapters.d.ts +153 -0
- package/node_modules/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/delegation-adapters.js +310 -0
- package/node_modules/pi-subagents/src/slash/delegation-adapters.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/delegation-json.d.ts +11 -0
- package/node_modules/pi-subagents/src/slash/delegation-json.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/delegation-json.js +118 -0
- package/node_modules/pi-subagents/src/slash/delegation-json.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/delegation-request.d.ts +13 -0
- package/node_modules/pi-subagents/src/slash/delegation-request.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/delegation-request.js +175 -0
- package/node_modules/pi-subagents/src/slash/delegation-request.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/prompt-template-bridge.d.ts +27 -0
- package/node_modules/pi-subagents/src/slash/prompt-template-bridge.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/prompt-template-bridge.js +393 -0
- package/node_modules/pi-subagents/src/slash/prompt-template-bridge.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/prompt-workflows.d.ts +22 -0
- package/node_modules/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/prompt-workflows.js +275 -0
- package/node_modules/pi-subagents/src/slash/prompt-workflows.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/selector.d.ts +48 -0
- package/node_modules/pi-subagents/src/slash/selector.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/selector.js +118 -0
- package/node_modules/pi-subagents/src/slash/selector.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/slash-bridge.d.ts +31 -0
- package/node_modules/pi-subagents/src/slash/slash-bridge.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/slash-bridge.js +133 -0
- package/node_modules/pi-subagents/src/slash/slash-bridge.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/slash-commands.d.ts +11 -0
- package/node_modules/pi-subagents/src/slash/slash-commands.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/slash-commands.js +1049 -0
- package/node_modules/pi-subagents/src/slash/slash-commands.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/slash-live-state.d.ts +22 -0
- package/node_modules/pi-subagents/src/slash/slash-live-state.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/slash-live-state.js +264 -0
- package/node_modules/pi-subagents/src/slash/slash-live-state.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/subagent-cost.d.ts +30 -0
- package/node_modules/pi-subagents/src/slash/subagent-cost.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/subagent-cost.js +311 -0
- package/node_modules/pi-subagents/src/slash/subagent-cost.js.map +1 -0
- package/node_modules/pi-subagents/src/slash/subagents-admin.d.ts +3 -0
- package/node_modules/pi-subagents/src/slash/subagents-admin.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/slash/subagents-admin.js +453 -0
- package/node_modules/pi-subagents/src/slash/subagents-admin.js.map +1 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.d.ts +88 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.js +1112 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.js.map +1 -0
- package/node_modules/pi-subagents/src/tui/fleet-transcript.d.ts +50 -0
- package/node_modules/pi-subagents/src/tui/fleet-transcript.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/fleet-transcript.js +497 -0
- package/node_modules/pi-subagents/src/tui/fleet-transcript.js.map +1 -0
- package/node_modules/pi-subagents/src/tui/fleet.d.ts +169 -0
- package/node_modules/pi-subagents/src/tui/fleet.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/fleet.js +1427 -0
- package/node_modules/pi-subagents/src/tui/fleet.js.map +1 -0
- package/node_modules/pi-subagents/src/tui/render-helpers.d.ts +24 -0
- package/node_modules/pi-subagents/src/tui/render-helpers.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/render-helpers.js +101 -0
- package/node_modules/pi-subagents/src/tui/render-helpers.js.map +1 -0
- package/node_modules/pi-subagents/src/tui/render.d.ts +61 -0
- package/node_modules/pi-subagents/src/tui/render.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/render.js +3675 -0
- package/node_modules/pi-subagents/src/tui/render.js.map +1 -0
- package/node_modules/pi-subagents/src/tui/running-tone.d.ts +11 -0
- package/node_modules/pi-subagents/src/tui/running-tone.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/running-tone.js +23 -0
- package/node_modules/pi-subagents/src/tui/running-tone.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/change-signature.d.ts +8 -0
- package/node_modules/pi-subagents/src/watchdog/change-signature.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/change-signature.js +246 -0
- package/node_modules/pi-subagents/src/watchdog/change-signature.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/child-status.d.ts +54 -0
- package/node_modules/pi-subagents/src/watchdog/child-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/child-status.js +188 -0
- package/node_modules/pi-subagents/src/watchdog/child-status.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/diff-tool.d.ts +26 -0
- package/node_modules/pi-subagents/src/watchdog/diff-tool.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/diff-tool.js +99 -0
- package/node_modules/pi-subagents/src/watchdog/diff-tool.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/emission-guard.d.ts +37 -0
- package/node_modules/pi-subagents/src/watchdog/emission-guard.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/emission-guard.js +98 -0
- package/node_modules/pi-subagents/src/watchdog/emission-guard.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/guidance.d.ts +4 -0
- package/node_modules/pi-subagents/src/watchdog/guidance.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/guidance.js +20 -0
- package/node_modules/pi-subagents/src/watchdog/guidance.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/lsp-diagnostics.d.ts +18 -0
- package/node_modules/pi-subagents/src/watchdog/lsp-diagnostics.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/lsp-diagnostics.js +490 -0
- package/node_modules/pi-subagents/src/watchdog/lsp-diagnostics.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/model-selection.d.ts +25 -0
- package/node_modules/pi-subagents/src/watchdog/model-selection.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/model-selection.js +168 -0
- package/node_modules/pi-subagents/src/watchdog/model-selection.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/permission-arbiter.d.ts +21 -0
- package/node_modules/pi-subagents/src/watchdog/permission-arbiter.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/permission-arbiter.js +136 -0
- package/node_modules/pi-subagents/src/watchdog/permission-arbiter.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/register-child.d.ts +14 -0
- package/node_modules/pi-subagents/src/watchdog/register-child.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/register-child.js +129 -0
- package/node_modules/pi-subagents/src/watchdog/register-child.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/register-main.d.ts +10 -0
- package/node_modules/pi-subagents/src/watchdog/register-main.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/register-main.js +418 -0
- package/node_modules/pi-subagents/src/watchdog/register-main.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/render.d.ts +12 -0
- package/node_modules/pi-subagents/src/watchdog/render.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/render.js +52 -0
- package/node_modules/pi-subagents/src/watchdog/render.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/review.d.ts +37 -0
- package/node_modules/pi-subagents/src/watchdog/review.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/review.js +320 -0
- package/node_modules/pi-subagents/src/watchdog/review.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/rules.d.ts +22 -0
- package/node_modules/pi-subagents/src/watchdog/rules.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/rules.js +59 -0
- package/node_modules/pi-subagents/src/watchdog/rules.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/runtime.d.ts +196 -0
- package/node_modules/pi-subagents/src/watchdog/runtime.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/runtime.js +867 -0
- package/node_modules/pi-subagents/src/watchdog/runtime.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/scope.d.ts +15 -0
- package/node_modules/pi-subagents/src/watchdog/scope.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/scope.js +45 -0
- package/node_modules/pi-subagents/src/watchdog/scope.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/settings.d.ts +30 -0
- package/node_modules/pi-subagents/src/watchdog/settings.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/settings.js +481 -0
- package/node_modules/pi-subagents/src/watchdog/settings.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/tool-actions.d.ts +18 -0
- package/node_modules/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/tool-actions.js +151 -0
- package/node_modules/pi-subagents/src/watchdog/tool-actions.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/turn-delta.d.ts +16 -0
- package/node_modules/pi-subagents/src/watchdog/turn-delta.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/turn-delta.js +189 -0
- package/node_modules/pi-subagents/src/watchdog/turn-delta.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/types.d.ts +142 -0
- package/node_modules/pi-subagents/src/watchdog/types.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/types.js +28 -0
- package/node_modules/pi-subagents/src/watchdog/types.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/warning-format.d.ts +8 -0
- package/node_modules/pi-subagents/src/watchdog/warning-format.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/warning-format.js +60 -0
- package/node_modules/pi-subagents/src/watchdog/warning-format.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/chat-progress.d.ts +38 -0
- package/node_modules/pi-subagents/src/workflows/chat-progress.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/chat-progress.js +130 -0
- package/node_modules/pi-subagents/src/workflows/chat-progress.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/host-command.d.ts +31 -0
- package/node_modules/pi-subagents/src/workflows/host-command.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/host-command.js +228 -0
- package/node_modules/pi-subagents/src/workflows/host-command.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.d.ts +205 -0
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.js +2707 -0
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/structured-workflow-scripts.d.ts +10 -0
- package/node_modules/pi-subagents/src/workflows/structured-workflow-scripts.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/structured-workflow-scripts.js +166 -0
- package/node_modules/pi-subagents/src/workflows/structured-workflow-scripts.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-checklist.d.ts +128 -0
- package/node_modules/pi-subagents/src/workflows/workflow-checklist.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-checklist.js +315 -0
- package/node_modules/pi-subagents/src/workflows/workflow-checklist.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-child-summary.d.ts +20 -0
- package/node_modules/pi-subagents/src/workflows/workflow-child-summary.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-child-summary.js +179 -0
- package/node_modules/pi-subagents/src/workflows/workflow-child-summary.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-preflight.d.ts +59 -0
- package/node_modules/pi-subagents/src/workflows/workflow-preflight.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-preflight.js +289 -0
- package/node_modules/pi-subagents/src/workflows/workflow-preflight.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-receipt.d.ts +35 -0
- package/node_modules/pi-subagents/src/workflows/workflow-receipt.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-receipt.js +455 -0
- package/node_modules/pi-subagents/src/workflows/workflow-receipt.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-resources.d.ts +56 -0
- package/node_modules/pi-subagents/src/workflows/workflow-resources.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-resources.js +260 -0
- package/node_modules/pi-subagents/src/workflows/workflow-resources.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-reuse.d.ts +51 -0
- package/node_modules/pi-subagents/src/workflows/workflow-reuse.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-reuse.js +103 -0
- package/node_modules/pi-subagents/src/workflows/workflow-reuse.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-revival.d.ts +32 -0
- package/node_modules/pi-subagents/src/workflows/workflow-revival.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-revival.js +111 -0
- package/node_modules/pi-subagents/src/workflows/workflow-revival.js.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-settlement.d.ts +85 -0
- package/node_modules/pi-subagents/src/workflows/workflow-settlement.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/workflows/workflow-settlement.js +204 -0
- package/node_modules/pi-subagents/src/workflows/workflow-settlement.js.map +1 -0
- package/node_modules/undici/LICENSE +21 -0
- package/node_modules/undici/README.md +797 -0
- package/node_modules/undici/docs/docs/api/Agent.md +291 -0
- package/node_modules/undici/docs/docs/api/BalancedPool.md +297 -0
- package/node_modules/undici/docs/docs/api/CacheStorage.md +188 -0
- package/node_modules/undici/docs/docs/api/CacheStore.md +360 -0
- package/node_modules/undici/docs/docs/api/Client.md +533 -0
- package/node_modules/undici/docs/docs/api/ClientStats.md +93 -0
- package/node_modules/undici/docs/docs/api/Connector.md +198 -0
- package/node_modules/undici/docs/docs/api/ContentType.md +97 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +179 -0
- package/node_modules/undici/docs/docs/api/Debug.md +78 -0
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +515 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +827 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +171 -0
- package/node_modules/undici/docs/docs/api/Errors.md +524 -0
- package/node_modules/undici/docs/docs/api/EventSource.md +358 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +711 -0
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +121 -0
- package/node_modules/undici/docs/docs/api/H2CClient.md +385 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +418 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +622 -0
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +371 -0
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +206 -0
- package/node_modules/undici/docs/docs/api/MockClient.md +199 -0
- package/node_modules/undici/docs/docs/api/MockErrors.md +63 -0
- package/node_modules/undici/docs/docs/api/MockPool.md +618 -0
- package/node_modules/undici/docs/docs/api/Pool.md +279 -0
- package/node_modules/undici/docs/docs/api/PoolStats.md +141 -0
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +248 -0
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +276 -0
- package/node_modules/undici/docs/docs/api/RetryAgent.md +136 -0
- package/node_modules/undici/docs/docs/api/RetryHandler.md +200 -0
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +239 -0
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +361 -0
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +256 -0
- package/node_modules/undici/docs/docs/api/Util.md +82 -0
- package/node_modules/undici/docs/docs/api/WebSocket.md +536 -0
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +159 -0
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +66 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +60 -0
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +233 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +192 -0
- package/node_modules/undici/docs/docs/best-practices/proxy.md +129 -0
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +226 -0
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +65 -0
- package/node_modules/undici/docs/docs/getting-started.md +281 -0
- package/node_modules/undici/docs/docs/index.md +784 -0
- package/node_modules/undici/docs/docs/site.json +125 -0
- package/node_modules/undici/docs/docs/type-map.json +79 -0
- package/node_modules/undici/index-fetch.js +65 -0
- package/node_modules/undici/index.d.ts +3 -0
- package/node_modules/undici/index.js +236 -0
- package/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/node_modules/undici/lib/api/api-connect.js +112 -0
- package/node_modules/undici/lib/api/api-pipeline.js +265 -0
- package/node_modules/undici/lib/api/api-request.js +244 -0
- package/node_modules/undici/lib/api/api-stream.js +270 -0
- package/node_modules/undici/lib/api/api-upgrade.js +121 -0
- package/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/undici/lib/api/readable.js +616 -0
- package/node_modules/undici/lib/cache/memory-cache-store.js +279 -0
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +469 -0
- package/node_modules/undici/lib/core/connect.js +192 -0
- package/node_modules/undici/lib/core/constants.js +120 -0
- package/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/node_modules/undici/lib/core/errors.js +497 -0
- package/node_modules/undici/lib/core/request.js +546 -0
- package/node_modules/undici/lib/core/socks5-client.js +422 -0
- package/node_modules/undici/lib/core/socks5-utils.js +212 -0
- package/node_modules/undici/lib/core/symbols.js +79 -0
- package/node_modules/undici/lib/core/tree.js +160 -0
- package/node_modules/undici/lib/core/util.js +1049 -0
- package/node_modules/undici/lib/dispatcher/agent.js +177 -0
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +217 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +1801 -0
- package/node_modules/undici/lib/dispatcher/client-h2.js +1781 -0
- package/node_modules/undici/lib/dispatcher/client.js +741 -0
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +197 -0
- package/node_modules/undici/lib/dispatcher/dispatcher.js +58 -0
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +110 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +175 -0
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +232 -0
- package/node_modules/undici/lib/dispatcher/pool.js +143 -0
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +395 -0
- package/node_modules/undici/lib/dispatcher/retry-agent.js +38 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +159 -0
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +350 -0
- package/node_modules/undici/lib/encoding/index.js +33 -0
- package/node_modules/undici/lib/global.js +82 -0
- package/node_modules/undici/lib/handler/cache-handler.js +818 -0
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +134 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +72 -0
- package/node_modules/undici/lib/handler/deduplication-handler.js +466 -0
- package/node_modules/undici/lib/handler/redirect-handler.js +238 -0
- package/node_modules/undici/lib/handler/retry-handler.js +594 -0
- package/node_modules/undici/lib/interceptor/cache.js +671 -0
- package/node_modules/undici/lib/interceptor/decompress.js +394 -0
- package/node_modules/undici/lib/interceptor/deduplicate.js +118 -0
- package/node_modules/undici/lib/interceptor/dns.js +582 -0
- package/node_modules/undici/lib/interceptor/dump.js +99 -0
- package/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
- package/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/node_modules/undici/lib/mock/mock-agent.js +244 -0
- package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/node_modules/undici/lib/mock/mock-interceptor.js +227 -0
- package/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/node_modules/undici/lib/mock/mock-utils.js +720 -0
- package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/undici/lib/mock/snapshot-agent.js +371 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +623 -0
- package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
- package/node_modules/undici/lib/util/cache.js +758 -0
- package/node_modules/undici/lib/util/date.js +670 -0
- package/node_modules/undici/lib/util/runtime-features.js +93 -0
- package/node_modules/undici/lib/util/stats.js +32 -0
- package/node_modules/undici/lib/util/timers.js +425 -0
- package/node_modules/undici/lib/web/cache/cache.js +862 -0
- package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/node_modules/undici/lib/web/cookies/parse.js +318 -0
- package/node_modules/undici/lib/web/cookies/util.js +352 -0
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +521 -0
- package/node_modules/undici/lib/web/eventsource/eventsource.js +500 -0
- package/node_modules/undici/lib/web/eventsource/util.js +60 -0
- package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/undici/lib/web/fetch/body.js +547 -0
- package/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/node_modules/undici/lib/web/fetch/formdata.js +278 -0
- package/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/node_modules/undici/lib/web/fetch/index.js +2432 -0
- package/node_modules/undici/lib/web/fetch/request.js +1144 -0
- package/node_modules/undici/lib/web/fetch/response.js +639 -0
- package/node_modules/undici/lib/web/fetch/util.js +1530 -0
- package/node_modules/undici/lib/web/infra/index.js +229 -0
- package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/node_modules/undici/lib/web/webidl/index.js +1004 -0
- package/node_modules/undici/lib/web/websocket/connection.js +329 -0
- package/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/node_modules/undici/lib/web/websocket/frame.js +127 -0
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
- package/node_modules/undici/lib/web/websocket/receiver.js +507 -0
- package/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +496 -0
- package/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/node_modules/undici/lib/web/websocket/websocket.js +780 -0
- package/node_modules/undici/package.json +152 -0
- package/node_modules/undici/scripts/strip-comments.js +10 -0
- package/node_modules/undici/types/README.md +6 -0
- package/node_modules/undici/types/agent.d.ts +30 -0
- package/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/undici/types/client-stats.d.ts +15 -0
- package/node_modules/undici/types/client.d.ts +184 -0
- package/node_modules/undici/types/connector.d.ts +37 -0
- package/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/undici/types/cookies.d.ts +30 -0
- package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici/types/dispatcher.d.ts +253 -0
- package/node_modules/undici/types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici/types/errors.d.ts +187 -0
- package/node_modules/undici/types/eventsource.d.ts +66 -0
- package/node_modules/undici/types/fetch.d.ts +235 -0
- package/node_modules/undici/types/formdata.d.ts +108 -0
- package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/undici/types/h2c-client.d.ts +73 -0
- package/node_modules/undici/types/handlers.d.ts +16 -0
- package/node_modules/undici/types/header.d.ts +165 -0
- package/node_modules/undici/types/index.d.ts +93 -0
- package/node_modules/undici/types/interceptors.d.ts +82 -0
- package/node_modules/undici/types/mock-agent.d.ts +69 -0
- package/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/node_modules/undici/types/mock-client.d.ts +27 -0
- package/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/undici/types/mock-interceptor.d.ts +98 -0
- package/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/node_modules/undici/types/patch.d.ts +29 -0
- package/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/undici/types/pool.d.ts +39 -0
- package/node_modules/undici/types/proxy-agent.d.ts +36 -0
- package/node_modules/undici/types/readable.d.ts +68 -0
- package/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/node_modules/undici/types/round-robin-pool.d.ts +39 -0
- package/node_modules/undici/types/snapshot-agent.d.ts +113 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +27 -0
- package/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/undici/types/utility.d.ts +7 -0
- package/node_modules/undici/types/webidl.d.ts +346 -0
- package/node_modules/undici/types/websocket.d.ts +188 -0
- package/package.json +99 -4
- package/src/MaestroPaths.ts +206 -0
- package/src/artifacts/builder-handoff/assertBuilderHandoff.ts +111 -0
- package/src/artifacts/builder-handoff/readBuilderHandoff.ts +30 -0
- package/src/artifacts/builder-handoff/schema.ts +137 -0
- package/src/artifacts/builder-handoff/writeBuilderHandoff.ts +24 -0
- package/src/artifacts/escalation/assertEscalation.ts +66 -0
- package/src/artifacts/escalation/createEscalation.ts +52 -0
- package/src/artifacts/escalation/getNextEscalationId.ts +26 -0
- package/src/artifacts/escalation/readEscalation.ts +50 -0
- package/src/artifacts/escalation/readEscalationHistory.ts +47 -0
- package/src/artifacts/escalation/resolveEscalation.ts +53 -0
- package/src/artifacts/escalation/schema.ts +74 -0
- package/src/artifacts/verifier-handoff/assertVerifierHandoff.ts +109 -0
- package/src/artifacts/verifier-handoff/readVerifierHandoff.ts +30 -0
- package/src/artifacts/verifier-handoff/rejectVerifierFinding.ts +54 -0
- package/src/artifacts/verifier-handoff/schema.ts +71 -0
- package/src/artifacts/verifier-handoff/writeVerifierHandoff.ts +31 -0
- package/src/config/assertConfiguration.ts +101 -0
- package/src/config/defaults.ts +45 -0
- package/src/config/loadConfiguration.ts +198 -0
- package/src/config/schema.ts +92 -0
- package/src/git/command.ts +172 -0
- package/src/git/commits/createCommit.ts +76 -0
- package/src/git/commits/createWorkflowCheckpointCommit.ts +24 -0
- package/src/git/commits/findCommitByMessage.ts +39 -0
- package/src/git/commits/getStagedPaths.ts +23 -0
- package/src/git/history/getParentCommit.ts +25 -0
- package/src/git/repository/assertRepositoryTrusted.ts +16 -0
- package/src/git/repository/findRepositoryRoot.ts +19 -0
- package/src/git/repository/getCurrentBranch.ts +18 -0
- package/src/git/repository/getHeadCommit.ts +18 -0
- package/src/git/repository/getRepositoryStatus.ts +74 -0
- package/src/git/utils/hasGitExitCode.ts +19 -0
- package/src/ids/createSpecId.ts +45 -0
- package/src/ids/isValidSpecId.ts +41 -0
- package/src/maestro/checks/assertEnvironment.ts +99 -0
- package/src/maestro/instructions/getMaestroInstructions.ts +28 -0
- package/src/maestro/session/MaestroSessionState.ts +54 -0
- package/src/maestro/status/formatMaestroStatus.ts +44 -0
- package/src/maestro/status/refreshMaestroStatus.ts +50 -0
- package/src/specs/create.ts +109 -0
- package/src/specs/template.ts +26 -0
- package/src/tools/child/open-escalation.ts +72 -0
- package/src/tools/child/record-builder-handoff.ts +85 -0
- package/src/tools/child/record-verifier-handoff.ts +139 -0
- package/src/tools/child/utils/isProtectedSpecPath.ts +61 -0
- package/src/tools/child/utils/resolveWorkflowContext.ts +25 -0
- package/src/tools/main/create-spec.ts +54 -0
- package/src/tools/main/launch-builder.ts +266 -0
- package/src/tools/main/launch-verifier.ts +270 -0
- package/src/tools/main/mark-spec-ready.ts +53 -0
- package/src/tools/main/resolve-escalation.ts +67 -0
- package/src/tools/main/resolve-findings.ts +123 -0
- package/src/tools/utils/pi-subagent-delegation.ts +127 -0
- package/src/tools/utils/resolveToolLaunchContext.ts +28 -0
- package/src/utils/getFileSha256.ts +13 -0
- package/src/utils/is-errno-exception.ts +9 -0
- package/src/utils/path-exists.ts +21 -0
- package/src/utils/path-strictly-within.ts +19 -0
- package/src/utils/path-within-or-equal.ts +25 -0
- package/src/utils/read-json.ts +26 -0
- package/src/utils/write-atomically.ts +41 -0
- package/src/utils/write-json-atomically.ts +28 -0
- package/src/workflow/builder/assertBuilderProtocolUnchanged.ts +31 -0
- package/src/workflow/builder/completeBuilderPass.ts +137 -0
- package/src/workflow/builder/prepareBuilderLauncher.ts +114 -0
- package/src/workflow/escalation/openBuilderEscalation.ts +93 -0
- package/src/workflow/escalation/resolveBuilderEscalation.ts +123 -0
- package/src/workflow/findings/resolveFindings.ts +267 -0
- package/src/workflow/roles.ts +11 -0
- package/src/workflow/spec/markSpecReady.ts +61 -0
- package/src/workflow/state/readWorkflowState.ts +19 -0
- package/src/workflow/state/schema.ts +91 -0
- package/src/workflow/state/writeWorkflowState.ts +82 -0
- package/src/workflow/transitions.ts +103 -0
- package/src/workflow/utils/getAgentRole.ts +33 -0
- package/src/workflow/verifier/completeVerifierPass.ts +128 -0
- package/src/workflow/verifier/hasProductChanges.ts +68 -0
- package/src/workflow/verifier/prepareVerifierLaunch.ts +108 -0
- package/templates/spec.md +103 -0
|
@@ -0,0 +1,2690 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent discovery and configuration
|
|
3
|
+
*/
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import { parse as parseYaml } from "yaml";
|
|
7
|
+
import * as os from "node:os";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { createAtomicJsonWriter } from "../shared/atomic-json.js";
|
|
11
|
+
import { resolveSettingsWriteTarget, withSettingsFileLease } from "../shared/settings-file-lease.js";
|
|
12
|
+
import { CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL, isCodeOwnedExternalCliAdapterId, parseExternalCliCapabilityNarrowing, validateCodeOwnedProfileRunner } from "../runs/shared/external-cli-contract.js";
|
|
13
|
+
import { isClaudeCodeAdapterId } from "../runs/shared/claude-code-adapter.js";
|
|
14
|
+
import { getAgentDir, getProjectConfigDir } from "../shared/utils.js";
|
|
15
|
+
import { expandHomePath } from "../shared/settings.js";
|
|
16
|
+
import { KNOWN_FIELDS } from "./agent-serializer.js";
|
|
17
|
+
import { parseChain, parseJsonChain } from "./chain-serializer.js";
|
|
18
|
+
import { mergeAgentsForScope } from "./agent-selection.js";
|
|
19
|
+
import { parseFrontmatter, parseFrontmatterList } from "./frontmatter.js";
|
|
20
|
+
import { buildRuntimeName, parsePackageName } from "./identity.js";
|
|
21
|
+
import { parseModelScopeConfig } from "../runs/shared/model-scope.js";
|
|
22
|
+
export { BUILTIN_AGENT_NAMES } from "./builtin-names.js";
|
|
23
|
+
export { buildRuntimeName, frontmatterNameForConfig, parsePackageName } from "./identity.js";
|
|
24
|
+
import { parseMemoryFrontmatter } from "./agent-memory.js";
|
|
25
|
+
import { validateAcceptanceInput } from "../runs/shared/acceptance.js";
|
|
26
|
+
import { validatePermissionRules } from "../runs/shared/permissions.js";
|
|
27
|
+
import { parseThinkingLevel } from "../shared/thinking-ceiling.js";
|
|
28
|
+
import { assertJsonSchemaObject } from "../runs/shared/structured-output.js";
|
|
29
|
+
import { normalizeCapabilityCeilingAllowedAgents } from "../runs/shared/capability-ceiling.js";
|
|
30
|
+
export function defaultSystemPromptMode(name) {
|
|
31
|
+
return name === "delegate" ? "append" : "replace";
|
|
32
|
+
}
|
|
33
|
+
export function defaultInheritProjectContext(name) {
|
|
34
|
+
return name === "delegate";
|
|
35
|
+
}
|
|
36
|
+
export function defaultInheritSkills() {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const EMPTY_SUBAGENT_SETTINGS = { overrides: {}, providerOverrides: {} };
|
|
40
|
+
const agentFrontmatterFields = new WeakMap();
|
|
41
|
+
const AGENT_SOURCE_PRIORITY = {
|
|
42
|
+
builtin: 0,
|
|
43
|
+
package: 1,
|
|
44
|
+
user: 2,
|
|
45
|
+
project: 3,
|
|
46
|
+
runtime: 4,
|
|
47
|
+
};
|
|
48
|
+
function agentDefinitionPriority(definition) {
|
|
49
|
+
return AGENT_SOURCE_PRIORITY[definition.source] * 1_000_000
|
|
50
|
+
+ (definition.discoveryPriority ?? 0);
|
|
51
|
+
}
|
|
52
|
+
export function findBlockingAgentDiagnostic(name, agent, diagnostics) {
|
|
53
|
+
const normalizedName = name.trim();
|
|
54
|
+
const agents = Array.isArray(agent) ? agent : agent ? [agent] : [];
|
|
55
|
+
let match;
|
|
56
|
+
for (const diagnostic of diagnostics ?? []) {
|
|
57
|
+
if ((diagnostic.runtimeName === normalizedName
|
|
58
|
+
|| (diagnostic.name === normalizedName && (!diagnostic.packageSpecified
|
|
59
|
+
|| diagnostic.runtimeName === undefined
|
|
60
|
+
|| agents.some((agent) => agent.name === diagnostic.runtimeName && agent.localName === diagnostic.name))))
|
|
61
|
+
&& (!match || agentDefinitionPriority(diagnostic) > agentDefinitionPriority(match))) {
|
|
62
|
+
match = diagnostic;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const highestPriority = Math.max(...agents.map(agentDefinitionPriority), -Infinity);
|
|
66
|
+
return !agents.length || (match && agentDefinitionPriority(match) > highestPriority) ? match : undefined;
|
|
67
|
+
}
|
|
68
|
+
/** Create formatter input from the exact discovery operation used for resolution. */
|
|
69
|
+
export function unknownAgentDiagnosticContext(discovered) {
|
|
70
|
+
return {
|
|
71
|
+
cwd: discovered.cwd,
|
|
72
|
+
scope: discovered.scope,
|
|
73
|
+
directories: discovered.directories,
|
|
74
|
+
agents: discovered.agents,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Render local discovery evidence without exposing filesystem error details. */
|
|
78
|
+
export function formatUnknownAgentError(name, context, prefix = "Unknown agent") {
|
|
79
|
+
const directories = context.directories.map((directory) => {
|
|
80
|
+
const state = directory.state === "candidates"
|
|
81
|
+
? `${directory.candidateCount ?? 0} candidate${directory.candidateCount === 1 ? "" : "s"}`
|
|
82
|
+
: directory.state === "empty" ? "present but empty"
|
|
83
|
+
: directory.state === "not-directory" ? "not a directory"
|
|
84
|
+
: directory.state;
|
|
85
|
+
return `- ${directory.source}: ${directory.path} (${state})`;
|
|
86
|
+
});
|
|
87
|
+
const agents = [...context.agents]
|
|
88
|
+
.sort((left, right) => left.name.localeCompare(right.name) || left.source.localeCompare(right.source))
|
|
89
|
+
.map((agent) => `- ${agent.name} (${agent.source})`);
|
|
90
|
+
return [
|
|
91
|
+
`${prefix}: ${name}`,
|
|
92
|
+
`Effective cwd: ${path.resolve(context.cwd)}`,
|
|
93
|
+
"Consulted agent-definition directories:",
|
|
94
|
+
...(directories.length ? directories : ["- (none)"]),
|
|
95
|
+
"Discovered agents:",
|
|
96
|
+
...(agents.length ? agents : ["- (none)"]),
|
|
97
|
+
].join("\n");
|
|
98
|
+
}
|
|
99
|
+
function getUserChainDir() {
|
|
100
|
+
return path.join(getAgentDir(), "chains");
|
|
101
|
+
}
|
|
102
|
+
let cachedGlobalNpmRoot = null;
|
|
103
|
+
function readJsonFileBestEffort(filePath) {
|
|
104
|
+
try {
|
|
105
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Installed package scans are opportunistic; bad third-party manifests
|
|
109
|
+
// should not break local agent discovery.
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function isSafePackagePath(value) {
|
|
114
|
+
return value.length > 0
|
|
115
|
+
&& !path.isAbsolute(value)
|
|
116
|
+
&& value.split(/[\\/]/).every((part) => part.length > 0 && part !== "." && part !== "..");
|
|
117
|
+
}
|
|
118
|
+
function parseNpmPackageName(source) {
|
|
119
|
+
const spec = source.slice(4).trim();
|
|
120
|
+
if (!spec)
|
|
121
|
+
return undefined;
|
|
122
|
+
const match = spec.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);
|
|
123
|
+
const packageName = match?.[1] ?? spec;
|
|
124
|
+
return isSafePackagePath(packageName) ? packageName : undefined;
|
|
125
|
+
}
|
|
126
|
+
function stripGitRef(repoPath) {
|
|
127
|
+
const atIndex = repoPath.indexOf("@");
|
|
128
|
+
const hashIndex = repoPath.indexOf("#");
|
|
129
|
+
const refIndex = [atIndex, hashIndex].filter((index) => index >= 0).sort((a, b) => a - b)[0];
|
|
130
|
+
return refIndex === undefined ? repoPath : repoPath.slice(0, refIndex);
|
|
131
|
+
}
|
|
132
|
+
function parseGitPackagePath(source) {
|
|
133
|
+
const spec = source.slice(4).trim();
|
|
134
|
+
if (!spec)
|
|
135
|
+
return undefined;
|
|
136
|
+
let host = "";
|
|
137
|
+
let repoPath = "";
|
|
138
|
+
const scpLike = spec.match(/^git@([^:]+):(.+)$/);
|
|
139
|
+
if (scpLike) {
|
|
140
|
+
host = scpLike[1] ?? "";
|
|
141
|
+
repoPath = scpLike[2] ?? "";
|
|
142
|
+
}
|
|
143
|
+
else if (/^[a-z][a-z0-9+.-]*:\/\//i.test(spec)) {
|
|
144
|
+
try {
|
|
145
|
+
const url = new URL(spec);
|
|
146
|
+
host = url.hostname;
|
|
147
|
+
repoPath = url.pathname.replace(/^\/+/, "");
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const slashIndex = spec.indexOf("/");
|
|
155
|
+
if (slashIndex < 0)
|
|
156
|
+
return undefined;
|
|
157
|
+
host = spec.slice(0, slashIndex);
|
|
158
|
+
repoPath = spec.slice(slashIndex + 1);
|
|
159
|
+
}
|
|
160
|
+
const normalizedPath = stripGitRef(repoPath).replace(/\.git$/, "").replace(/^\/+/, "");
|
|
161
|
+
if (!host || !isSafePackagePath(host) || !isSafePackagePath(normalizedPath) || normalizedPath.split(/[\\/]/).length < 2) {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
return { host, repoPath: normalizedPath };
|
|
165
|
+
}
|
|
166
|
+
function resolveSettingsPackageRoot(source, baseDir) {
|
|
167
|
+
const trimmed = source.trim();
|
|
168
|
+
if (!trimmed)
|
|
169
|
+
return undefined;
|
|
170
|
+
if (trimmed.startsWith("git:")) {
|
|
171
|
+
const parsed = parseGitPackagePath(trimmed);
|
|
172
|
+
return parsed ? path.join(baseDir, "git", parsed.host, parsed.repoPath) : undefined;
|
|
173
|
+
}
|
|
174
|
+
if (trimmed.startsWith("npm:")) {
|
|
175
|
+
const packageName = parseNpmPackageName(trimmed);
|
|
176
|
+
return packageName ? path.join(baseDir, "npm", "node_modules", packageName) : undefined;
|
|
177
|
+
}
|
|
178
|
+
const normalized = trimmed.startsWith("file:") ? trimmed.slice(5) : trimmed;
|
|
179
|
+
if (normalized === "~")
|
|
180
|
+
return os.homedir();
|
|
181
|
+
if (normalized.startsWith("~/"))
|
|
182
|
+
return path.join(os.homedir(), normalized.slice(2));
|
|
183
|
+
if (path.isAbsolute(normalized))
|
|
184
|
+
return normalized;
|
|
185
|
+
if (normalized === "." || normalized === ".." || normalized.startsWith("./") || normalized.startsWith("../")) {
|
|
186
|
+
return path.resolve(baseDir, normalized);
|
|
187
|
+
}
|
|
188
|
+
if (/^https?:\/\//i.test(trimmed)) {
|
|
189
|
+
const parsed = parseGitPackagePath(`git:${trimmed}`);
|
|
190
|
+
return parsed ? path.join(baseDir, "git", parsed.host, parsed.repoPath) : undefined;
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
function getGlobalNpmRoot() {
|
|
195
|
+
const offline = process.env.PI_OFFLINE?.toLowerCase();
|
|
196
|
+
if (offline === "1" || offline === "true" || offline === "yes")
|
|
197
|
+
return null;
|
|
198
|
+
if (cachedGlobalNpmRoot !== null)
|
|
199
|
+
return cachedGlobalNpmRoot;
|
|
200
|
+
const windowsGlobalRoot = process.platform === "win32" && process.env.APPDATA
|
|
201
|
+
? path.join(process.env.APPDATA, "npm", "node_modules")
|
|
202
|
+
: undefined;
|
|
203
|
+
if (windowsGlobalRoot) {
|
|
204
|
+
try {
|
|
205
|
+
if (fs.statSync(windowsGlobalRoot).isDirectory()) {
|
|
206
|
+
cachedGlobalNpmRoot = fs.realpathSync(windowsGlobalRoot);
|
|
207
|
+
return cachedGlobalNpmRoot;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
// Fall through if the directory disappears while resolving it.
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
cachedGlobalNpmRoot = fs.realpathSync(execSync("npm root -g", { encoding: "utf-8", timeout: 5000, windowsHide: true, stdio: ["ignore", "pipe", "ignore"] }).trim());
|
|
216
|
+
return cachedGlobalNpmRoot;
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
cachedGlobalNpmRoot = "";
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function stringArray(value) {
|
|
224
|
+
if (!Array.isArray(value))
|
|
225
|
+
return [];
|
|
226
|
+
return value.filter((entry) => typeof entry === "string" && entry.trim().length > 0);
|
|
227
|
+
}
|
|
228
|
+
function packageMetadata(pkg, packageRoot) {
|
|
229
|
+
const name = typeof pkg.name === "string" && pkg.name.trim() ? pkg.name.trim() : undefined;
|
|
230
|
+
const version = typeof pkg.version === "string" && pkg.version.trim() ? pkg.version.trim() : undefined;
|
|
231
|
+
return {
|
|
232
|
+
packageRoot,
|
|
233
|
+
...(name ? { packageName: name } : {}),
|
|
234
|
+
...(version ? { packageVersion: version } : {}),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function extractSubagentPathsFromPackageRoot(packageRoot, scope) {
|
|
238
|
+
const packageJsonPath = path.join(packageRoot, "package.json");
|
|
239
|
+
const pkg = readJsonFileBestEffort(packageJsonPath);
|
|
240
|
+
if (!pkg || typeof pkg !== "object" || Array.isArray(pkg))
|
|
241
|
+
return { agents: [], chains: [], watchPaths: [packageJsonPath], settingsErrors: {} };
|
|
242
|
+
const pkgRecord = pkg;
|
|
243
|
+
const metadata = packageMetadata(pkgRecord, packageRoot);
|
|
244
|
+
const roots = [];
|
|
245
|
+
const piSubagents = pkgRecord["pi-subagents"];
|
|
246
|
+
if (piSubagents && typeof piSubagents === "object" && !Array.isArray(piSubagents)) {
|
|
247
|
+
roots.push(piSubagents);
|
|
248
|
+
}
|
|
249
|
+
const pi = pkgRecord.pi;
|
|
250
|
+
if (pi && typeof pi === "object" && !Array.isArray(pi)) {
|
|
251
|
+
const subagents = pi.subagents;
|
|
252
|
+
if (subagents && typeof subagents === "object" && !Array.isArray(subagents)) {
|
|
253
|
+
roots.push(subagents);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const agents = [];
|
|
257
|
+
const chains = [];
|
|
258
|
+
for (const root of roots) {
|
|
259
|
+
for (const entry of stringArray(root.agents))
|
|
260
|
+
agents.push({ dir: path.resolve(packageRoot, entry), scope, ...metadata });
|
|
261
|
+
for (const entry of stringArray(root.chains))
|
|
262
|
+
chains.push({ dir: path.resolve(packageRoot, entry), scope, packageRoot });
|
|
263
|
+
}
|
|
264
|
+
return { agents, chains, watchPaths: [packageJsonPath], settingsErrors: {} };
|
|
265
|
+
}
|
|
266
|
+
function collectPackageRootsFromNodeModules(nodeModulesDir, watchPaths) {
|
|
267
|
+
const roots = [];
|
|
268
|
+
watchPaths?.push(nodeModulesDir);
|
|
269
|
+
if (!fs.existsSync(nodeModulesDir))
|
|
270
|
+
return roots;
|
|
271
|
+
let entries;
|
|
272
|
+
try {
|
|
273
|
+
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return roots;
|
|
277
|
+
}
|
|
278
|
+
for (const entry of entries) {
|
|
279
|
+
if (entry.name.startsWith("."))
|
|
280
|
+
continue;
|
|
281
|
+
if (!entry.isDirectory() && !entry.isSymbolicLink())
|
|
282
|
+
continue;
|
|
283
|
+
if (entry.name.startsWith("@")) {
|
|
284
|
+
const scopeDir = path.join(nodeModulesDir, entry.name);
|
|
285
|
+
watchPaths?.push(scopeDir);
|
|
286
|
+
let scopeEntries;
|
|
287
|
+
try {
|
|
288
|
+
scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
for (const scopeEntry of scopeEntries) {
|
|
294
|
+
if (scopeEntry.name.startsWith("."))
|
|
295
|
+
continue;
|
|
296
|
+
if (!scopeEntry.isDirectory() && !scopeEntry.isSymbolicLink())
|
|
297
|
+
continue;
|
|
298
|
+
roots.push(path.join(scopeDir, scopeEntry.name));
|
|
299
|
+
}
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
roots.push(path.join(nodeModulesDir, entry.name));
|
|
303
|
+
}
|
|
304
|
+
return roots;
|
|
305
|
+
}
|
|
306
|
+
function collectSettingsPackageRoots(settingsFile, baseDir) {
|
|
307
|
+
const settings = readSettingsFileStrict(settingsFile);
|
|
308
|
+
const packages = settings.packages;
|
|
309
|
+
if (!Array.isArray(packages))
|
|
310
|
+
return [];
|
|
311
|
+
const roots = [];
|
|
312
|
+
for (const entry of packages) {
|
|
313
|
+
const packageSource = typeof entry === "string"
|
|
314
|
+
? entry
|
|
315
|
+
: typeof entry === "object" && entry !== null && "source" in entry && typeof entry.source === "string"
|
|
316
|
+
? entry.source
|
|
317
|
+
: undefined;
|
|
318
|
+
if (!packageSource)
|
|
319
|
+
continue;
|
|
320
|
+
const packageRoot = resolveSettingsPackageRoot(packageSource, baseDir);
|
|
321
|
+
if (packageRoot)
|
|
322
|
+
roots.push(packageRoot);
|
|
323
|
+
}
|
|
324
|
+
return roots;
|
|
325
|
+
}
|
|
326
|
+
function collectPackageSubagentPaths(cwd, options = { includeUser: true, includeProject: true }) {
|
|
327
|
+
const agentDir = getAgentDir();
|
|
328
|
+
const projectRoot = findConfiguredProjectRoot(cwd) ?? cwd;
|
|
329
|
+
const packageRoots = [
|
|
330
|
+
{ root: projectRoot, scope: "root" },
|
|
331
|
+
];
|
|
332
|
+
const watchPaths = [path.join(projectRoot, "package.json")];
|
|
333
|
+
const settingsErrors = {};
|
|
334
|
+
const collectScopedSettingsRoots = (scope, settingsFile, baseDir) => {
|
|
335
|
+
try {
|
|
336
|
+
return collectSettingsPackageRoots(settingsFile, baseDir);
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
// The raw source snapshot includes both settings scopes. Defer a
|
|
340
|
+
// strict failure until a projection actually selects this scope so an
|
|
341
|
+
// unrelated malformed settings file stays out of scoped discovery.
|
|
342
|
+
settingsErrors[scope] = error instanceof Error
|
|
343
|
+
? error
|
|
344
|
+
: new Error(`Failed to read settings file '${settingsFile}': ${String(error)}`, { cause: error });
|
|
345
|
+
return [];
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
if (options.includeProject) {
|
|
349
|
+
const projectConfigDir = getProjectConfigDir(projectRoot);
|
|
350
|
+
const nodeModulesDir = path.join(projectConfigDir, "npm", "node_modules");
|
|
351
|
+
packageRoots.push(...collectPackageRootsFromNodeModules(nodeModulesDir, watchPaths).map((root) => ({ root, scope: "project" })));
|
|
352
|
+
packageRoots.push(...collectScopedSettingsRoots("project", path.join(projectConfigDir, "settings.json"), projectConfigDir).map((root) => ({ root, scope: "project" })));
|
|
353
|
+
}
|
|
354
|
+
if (options.includeUser) {
|
|
355
|
+
const nodeModulesDir = path.join(agentDir, "npm", "node_modules");
|
|
356
|
+
packageRoots.push(...collectPackageRootsFromNodeModules(nodeModulesDir, watchPaths).map((root) => ({ root, scope: "user" })));
|
|
357
|
+
packageRoots.push(...collectScopedSettingsRoots("user", path.join(agentDir, "settings.json"), agentDir).map((root) => ({ root, scope: "user" })));
|
|
358
|
+
}
|
|
359
|
+
if (options.includeUser) {
|
|
360
|
+
const globalRoot = options.globalNpmRoot === undefined ? getGlobalNpmRoot() : options.globalNpmRoot;
|
|
361
|
+
if (globalRoot) {
|
|
362
|
+
packageRoots.push(...collectPackageRootsFromNodeModules(globalRoot, watchPaths).map((root) => ({ root, scope: "user" })));
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const seenRoots = new Map();
|
|
366
|
+
const seenAgents = new Map();
|
|
367
|
+
const seenChains = new Map();
|
|
368
|
+
const agents = [];
|
|
369
|
+
const chains = [];
|
|
370
|
+
for (const { root: packageRoot, scope } of packageRoots) {
|
|
371
|
+
const resolvedRoot = path.resolve(packageRoot);
|
|
372
|
+
const scopes = seenRoots.get(resolvedRoot);
|
|
373
|
+
if (scopes !== undefined) {
|
|
374
|
+
scopes.add(scope);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const packageScopes = new Set([scope]);
|
|
378
|
+
seenRoots.set(resolvedRoot, packageScopes);
|
|
379
|
+
const paths = extractSubagentPathsFromPackageRoot(resolvedRoot, packageScopes);
|
|
380
|
+
watchPaths.push(...paths.watchPaths);
|
|
381
|
+
for (const agentPath of paths.agents) {
|
|
382
|
+
const agentKey = `${agentPath.dir}\u0000${agentPath.packageRoot}`;
|
|
383
|
+
const existing = seenAgents.get(agentKey);
|
|
384
|
+
if (existing) {
|
|
385
|
+
for (const packageScope of agentPath.scope)
|
|
386
|
+
existing.scope.add(packageScope);
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
seenAgents.set(agentKey, agentPath);
|
|
390
|
+
agents.push(agentPath);
|
|
391
|
+
}
|
|
392
|
+
for (const chainDir of paths.chains) {
|
|
393
|
+
const chainKey = `${chainDir.dir}\u0000${chainDir.packageRoot}`;
|
|
394
|
+
const existing = seenChains.get(chainKey);
|
|
395
|
+
if (existing) {
|
|
396
|
+
for (const packageScope of chainDir.scope)
|
|
397
|
+
existing.scope.add(packageScope);
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
seenChains.set(chainKey, chainDir);
|
|
401
|
+
chains.push(chainDir);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return { agents, chains, watchPaths, settingsErrors };
|
|
405
|
+
}
|
|
406
|
+
function normalizeAgentAliases(rawAliases, agentName) {
|
|
407
|
+
const aliases = [...new Set((rawAliases ?? []).map((alias) => alias.trim()).filter(Boolean))]
|
|
408
|
+
.filter((alias) => alias !== agentName);
|
|
409
|
+
return aliases.length > 0 ? aliases : undefined;
|
|
410
|
+
}
|
|
411
|
+
function effectiveAgentMatch(matches) {
|
|
412
|
+
const distinctNames = [...new Set(matches.map((agent) => agent.name))];
|
|
413
|
+
if (distinctNames.length === 1) {
|
|
414
|
+
const sourceRank = new Map([["builtin", 0], ["package", 1], ["user", 2], ["project", 3], ["runtime", 4]]);
|
|
415
|
+
const agent = [...matches].sort((a, b) => (sourceRank.get(b.source) ?? 0) - (sourceRank.get(a.source) ?? 0))[0];
|
|
416
|
+
return agent ? { agent } : {};
|
|
417
|
+
}
|
|
418
|
+
return {};
|
|
419
|
+
}
|
|
420
|
+
export function resolveAgentName(name, agents) {
|
|
421
|
+
const raw = name.trim();
|
|
422
|
+
const canonical = agents.filter((agent) => agent.name === raw);
|
|
423
|
+
if (canonical.length === 1)
|
|
424
|
+
return canonical[0] ? { agent: canonical[0] } : {};
|
|
425
|
+
if (canonical.length > 1) {
|
|
426
|
+
const effective = effectiveAgentMatch(canonical);
|
|
427
|
+
if (effective.agent)
|
|
428
|
+
return effective;
|
|
429
|
+
return { error: `Ambiguous agent name '${name}': ${canonical.map((agent) => agent.name).join(", ")}` };
|
|
430
|
+
}
|
|
431
|
+
const local = agents.filter((agent) => agent.localName === raw);
|
|
432
|
+
if (local.length === 1)
|
|
433
|
+
return local[0] ? { agent: local[0] } : {};
|
|
434
|
+
if (local.length > 1) {
|
|
435
|
+
const effective = effectiveAgentMatch(local);
|
|
436
|
+
if (effective.agent)
|
|
437
|
+
return effective;
|
|
438
|
+
return { error: `Ambiguous local agent name '${name}': ${local.map((agent) => agent.name).join(", ")}` };
|
|
439
|
+
}
|
|
440
|
+
const aliases = agents.filter((agent) => agent.aliases?.includes(raw));
|
|
441
|
+
if (aliases.length === 1)
|
|
442
|
+
return aliases[0] ? { agent: aliases[0] } : {};
|
|
443
|
+
if (aliases.length > 1) {
|
|
444
|
+
const effective = effectiveAgentMatch(aliases);
|
|
445
|
+
if (effective.agent)
|
|
446
|
+
return effective;
|
|
447
|
+
return { error: `Ambiguous agent alias '${name}': ${aliases.map((agent) => agent.name).join(", ")}` };
|
|
448
|
+
}
|
|
449
|
+
return {};
|
|
450
|
+
}
|
|
451
|
+
function splitToolList(rawTools) {
|
|
452
|
+
const mcpDirectTools = [];
|
|
453
|
+
const tools = [];
|
|
454
|
+
for (const tool of rawTools ?? []) {
|
|
455
|
+
if (tool.startsWith("mcp:")) {
|
|
456
|
+
mcpDirectTools.push(tool.slice(4));
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
tools.push(tool);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
...(rawTools !== undefined ? { tools } : {}),
|
|
464
|
+
...(mcpDirectTools.length > 0 ? { mcpDirectTools } : {}),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
function joinToolList(config) {
|
|
468
|
+
const joined = [
|
|
469
|
+
...(config.tools ?? []),
|
|
470
|
+
...(config.mcpDirectTools ?? []).map((tool) => `mcp:${tool}`),
|
|
471
|
+
];
|
|
472
|
+
return joined.length > 0 ? joined : undefined;
|
|
473
|
+
}
|
|
474
|
+
function arraysEqual(a, b) {
|
|
475
|
+
if (!a && !b)
|
|
476
|
+
return true;
|
|
477
|
+
if (!a || !b)
|
|
478
|
+
return false;
|
|
479
|
+
if (a.length !== b.length)
|
|
480
|
+
return false;
|
|
481
|
+
for (let i = 0; i < a.length; i++) {
|
|
482
|
+
if (a[i] !== b[i])
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
function cloneOverrideBase(agent) {
|
|
488
|
+
return {
|
|
489
|
+
description: agent.description,
|
|
490
|
+
...(agent.machine !== undefined ? { machine: agent.machine } : {}),
|
|
491
|
+
...(agent.output !== undefined ? { output: agent.output } : {}),
|
|
492
|
+
...(agent.outputMode !== undefined ? { outputMode: agent.outputMode } : {}),
|
|
493
|
+
...(agent.defaultReads !== undefined ? { defaultReads: [...agent.defaultReads] } : {}),
|
|
494
|
+
...(agent.model !== undefined ? { model: agent.model } : {}),
|
|
495
|
+
...(agent.modelProvider !== undefined ? { modelProvider: agent.modelProvider } : {}),
|
|
496
|
+
...(agent.fast !== undefined ? { fast: agent.fast } : {}),
|
|
497
|
+
...(agent.thinking !== undefined ? { thinking: agent.thinking } : {}),
|
|
498
|
+
systemPromptMode: agent.systemPromptMode,
|
|
499
|
+
inheritProjectContext: agent.inheritProjectContext,
|
|
500
|
+
inheritGlobalContext: agent.inheritGlobalContext,
|
|
501
|
+
inheritSkills: agent.inheritSkills,
|
|
502
|
+
...(agent.defaultContext !== undefined ? { defaultContext: agent.defaultContext } : {}),
|
|
503
|
+
...(agent.acceptanceRole !== undefined ? { acceptanceRole: agent.acceptanceRole } : {}),
|
|
504
|
+
...(agent.disabled !== undefined ? { disabled: agent.disabled } : {}),
|
|
505
|
+
systemPrompt: agent.systemPrompt,
|
|
506
|
+
...(agent.skills ? { skills: [...agent.skills] } : {}),
|
|
507
|
+
...(agent.skillPath ? { skillPath: [...agent.skillPath] } : {}),
|
|
508
|
+
...(agent.tools ? { tools: [...agent.tools] } : {}),
|
|
509
|
+
...(agent.excludeTools ? { excludeTools: [...agent.excludeTools] } : {}),
|
|
510
|
+
...(agent.allowNestedSubagents !== undefined ? { allowNestedSubagents: agent.allowNestedSubagents } : {}),
|
|
511
|
+
...(agent.allowedAgents !== undefined ? { allowedAgents: [...agent.allowedAgents] } : {}),
|
|
512
|
+
...(agent.mcpDirectTools ? { mcpDirectTools: [...agent.mcpDirectTools] } : {}),
|
|
513
|
+
...(!agent.extensionsFromDefault && agent.extensions ? { extensions: [...agent.extensions] } : {}),
|
|
514
|
+
...(agent.subagentOnlyExtensions ? { subagentOnlyExtensions: [...agent.subagentOnlyExtensions] } : {}),
|
|
515
|
+
...(agent.mutationTools ? { mutationTools: [...agent.mutationTools] } : {}),
|
|
516
|
+
...(agent.toolBudget !== undefined ? { toolBudget: agent.toolBudget } : {}),
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function cloneOverrideValue(override) {
|
|
520
|
+
return {
|
|
521
|
+
...(override.description !== undefined ? { description: override.description } : {}),
|
|
522
|
+
...(override.machine !== undefined ? { machine: override.machine } : {}),
|
|
523
|
+
...(override.output !== undefined ? { output: override.output } : {}),
|
|
524
|
+
...(override.outputMode !== undefined ? { outputMode: override.outputMode } : {}),
|
|
525
|
+
...(override.defaultReads !== undefined ? { defaultReads: override.defaultReads === false ? false : [...override.defaultReads] } : {}),
|
|
526
|
+
...(override.model !== undefined ? { model: override.model } : {}),
|
|
527
|
+
...(override.defaultProvider !== undefined ? { defaultProvider: override.defaultProvider } : {}),
|
|
528
|
+
...(override.fast !== undefined ? { fast: override.fast } : {}),
|
|
529
|
+
...(override.thinking !== undefined ? { thinking: override.thinking } : {}),
|
|
530
|
+
...(override.systemPromptMode !== undefined ? { systemPromptMode: override.systemPromptMode } : {}),
|
|
531
|
+
...(override.inheritProjectContext !== undefined ? { inheritProjectContext: override.inheritProjectContext } : {}),
|
|
532
|
+
...(override.inheritGlobalContext !== undefined ? { inheritGlobalContext: override.inheritGlobalContext } : {}),
|
|
533
|
+
...(override.inheritSkills !== undefined ? { inheritSkills: override.inheritSkills } : {}),
|
|
534
|
+
...(override.defaultContext !== undefined ? { defaultContext: override.defaultContext } : {}),
|
|
535
|
+
...(override.acceptanceRole !== undefined ? { acceptanceRole: override.acceptanceRole } : {}),
|
|
536
|
+
...(override.disabled !== undefined ? { disabled: override.disabled } : {}),
|
|
537
|
+
...(override.systemPrompt !== undefined ? { systemPrompt: override.systemPrompt } : {}),
|
|
538
|
+
...(override.skills !== undefined ? { skills: override.skills === false ? false : [...override.skills] } : {}),
|
|
539
|
+
...(override.tools !== undefined ? { tools: Array.isArray(override.tools) ? [...override.tools] : override.tools } : {}),
|
|
540
|
+
...(override.excludeTools !== undefined ? { excludeTools: override.excludeTools === false ? false : [...override.excludeTools] } : {}),
|
|
541
|
+
...(override.allowNestedSubagents !== undefined ? { allowNestedSubagents: override.allowNestedSubagents } : {}),
|
|
542
|
+
...(override.allowedAgents !== undefined ? { allowedAgents: override.allowedAgents === false ? false : [...override.allowedAgents] } : {}),
|
|
543
|
+
...(override.extensions !== undefined ? { extensions: override.extensions === false ? false : [...override.extensions] } : {}),
|
|
544
|
+
...(override.subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions: override.subagentOnlyExtensions === false ? false : [...override.subagentOnlyExtensions] } : {}),
|
|
545
|
+
...(override.mutationTools !== undefined ? { mutationTools: override.mutationTools === false ? false : [...override.mutationTools] } : {}),
|
|
546
|
+
...(override.toolBudget !== undefined ? { toolBudget: override.toolBudget === false ? false : { ...override.toolBudget, ...(Array.isArray(override.toolBudget.block) ? { block: [...override.toolBudget.block] } : {}) } } : {}),
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function isProjectRootCandidate(dir) {
|
|
550
|
+
return isDirectory(getProjectConfigDir(dir)) || isDirectory(path.join(dir, ".agents"));
|
|
551
|
+
}
|
|
552
|
+
function findProjectRootCandidates(cwd) {
|
|
553
|
+
const roots = [];
|
|
554
|
+
const windowsProfile = process.env.HOMEDRIVE && process.env.HOMEPATH
|
|
555
|
+
? `${process.env.HOMEDRIVE}${process.env.HOMEPATH}`
|
|
556
|
+
: undefined;
|
|
557
|
+
const homeDirs = new Set([os.homedir(), process.env.HOME, process.env.USERPROFILE, windowsProfile]
|
|
558
|
+
.filter((value) => Boolean(value?.trim()))
|
|
559
|
+
.filter(isDirectory)
|
|
560
|
+
.map((value) => fs.realpathSync.native(value)));
|
|
561
|
+
let currentDir = cwd;
|
|
562
|
+
while (true) {
|
|
563
|
+
// ~/.pi and ~/.agents are user configuration, never an implicit project.
|
|
564
|
+
if (isDirectory(currentDir) && homeDirs.has(fs.realpathSync.native(currentDir)))
|
|
565
|
+
return roots;
|
|
566
|
+
if (isProjectRootCandidate(currentDir))
|
|
567
|
+
roots.push(currentDir);
|
|
568
|
+
const parentDir = path.dirname(currentDir);
|
|
569
|
+
if (parentDir === currentDir)
|
|
570
|
+
return roots;
|
|
571
|
+
currentDir = parentDir;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
export function findNearestGitRoot(cwd) {
|
|
575
|
+
let currentDir = cwd;
|
|
576
|
+
while (true) {
|
|
577
|
+
if (fs.existsSync(path.join(currentDir, ".git")))
|
|
578
|
+
return currentDir;
|
|
579
|
+
const parentDir = path.dirname(currentDir);
|
|
580
|
+
if (parentDir === currentDir)
|
|
581
|
+
return null;
|
|
582
|
+
currentDir = parentDir;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function readProjectRootResolution(projectRoot) {
|
|
586
|
+
const settingsPath = path.join(getProjectConfigDir(projectRoot), "settings.json");
|
|
587
|
+
if (!fs.existsSync(settingsPath))
|
|
588
|
+
return undefined;
|
|
589
|
+
const settings = readSettingsFileStrict(settingsPath);
|
|
590
|
+
const subagents = settings.subagents;
|
|
591
|
+
if (!subagents || typeof subagents !== "object" || Array.isArray(subagents))
|
|
592
|
+
return undefined;
|
|
593
|
+
const value = subagents.projectRootResolution;
|
|
594
|
+
if (value === undefined)
|
|
595
|
+
return undefined;
|
|
596
|
+
if (value === "nearest" || value === "git-root")
|
|
597
|
+
return value;
|
|
598
|
+
throw new Error(`Subagent settings in '${settingsPath}' have invalid 'projectRootResolution'; expected 'nearest' or 'git-root'.`);
|
|
599
|
+
}
|
|
600
|
+
export function findNearestProjectRoot(cwd) {
|
|
601
|
+
return findProjectRootCandidates(cwd)[0] ?? null;
|
|
602
|
+
}
|
|
603
|
+
export function findConfiguredProjectRoot(cwd) {
|
|
604
|
+
const candidates = findProjectRootCandidates(cwd);
|
|
605
|
+
const nearestRoot = candidates[0];
|
|
606
|
+
if (!nearestRoot)
|
|
607
|
+
return null;
|
|
608
|
+
let policyRoot;
|
|
609
|
+
let policyRootIndex = -1;
|
|
610
|
+
for (const [index, candidate] of candidates.entries()) {
|
|
611
|
+
const mode = readProjectRootResolution(candidate);
|
|
612
|
+
if (mode === "nearest")
|
|
613
|
+
return nearestRoot;
|
|
614
|
+
if (mode === "git-root") {
|
|
615
|
+
policyRoot = candidate;
|
|
616
|
+
policyRootIndex = index;
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (!policyRoot)
|
|
621
|
+
return nearestRoot;
|
|
622
|
+
const gitRoot = findNearestGitRoot(cwd);
|
|
623
|
+
const gitProjectRoot = gitRoot
|
|
624
|
+
? candidates.slice(policyRootIndex).find((candidate) => path.resolve(candidate) === path.resolve(gitRoot))
|
|
625
|
+
: undefined;
|
|
626
|
+
const configuredGitRoot = fs.existsSync(path.join(policyRoot, ".git")) ? policyRoot : undefined;
|
|
627
|
+
return gitProjectRoot ?? configuredGitRoot ?? nearestRoot;
|
|
628
|
+
}
|
|
629
|
+
function getUserAgentSettingsPath() {
|
|
630
|
+
return path.join(getAgentDir(), "settings.json");
|
|
631
|
+
}
|
|
632
|
+
function getProjectAgentSettingsPath(cwd) {
|
|
633
|
+
const projectRoot = findConfiguredProjectRoot(cwd);
|
|
634
|
+
return projectRoot ? path.join(getProjectConfigDir(projectRoot), "settings.json") : null;
|
|
635
|
+
}
|
|
636
|
+
function readSettingsFileStrict(filePath) {
|
|
637
|
+
if (!fs.existsSync(filePath))
|
|
638
|
+
return {};
|
|
639
|
+
let raw;
|
|
640
|
+
try {
|
|
641
|
+
raw = fs.readFileSync(filePath, "utf-8");
|
|
642
|
+
}
|
|
643
|
+
catch (error) {
|
|
644
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
645
|
+
throw new Error(`Failed to read settings file '${filePath}': ${message}`, { cause: error });
|
|
646
|
+
}
|
|
647
|
+
let parsed;
|
|
648
|
+
try {
|
|
649
|
+
parsed = JSON.parse(raw);
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
653
|
+
throw new Error(`Failed to parse settings file '${filePath}': ${message}`, { cause: error });
|
|
654
|
+
}
|
|
655
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
656
|
+
throw new Error(`Settings file '${filePath}' must contain a JSON object.`);
|
|
657
|
+
}
|
|
658
|
+
return parsed;
|
|
659
|
+
}
|
|
660
|
+
function writeSettingsFile(filePath, settings) {
|
|
661
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
662
|
+
const targetPath = resolveSettingsWriteTarget(filePath);
|
|
663
|
+
let existingMode;
|
|
664
|
+
try {
|
|
665
|
+
existingMode = fs.statSync(targetPath).mode & 0o7777;
|
|
666
|
+
}
|
|
667
|
+
catch (error) {
|
|
668
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
669
|
+
throw error;
|
|
670
|
+
}
|
|
671
|
+
if (existingMode !== undefined)
|
|
672
|
+
fs.accessSync(targetPath, fs.constants.W_OK);
|
|
673
|
+
const tempMode = existingMode === undefined ? undefined : existingMode | 0o200;
|
|
674
|
+
// Reuse the atomic temp/rename path while retaining settings' newline and existing mode.
|
|
675
|
+
const writeAtomicSettings = createAtomicJsonWriter({
|
|
676
|
+
mode: tempMode,
|
|
677
|
+
fs: {
|
|
678
|
+
mkdirSync: fs.mkdirSync,
|
|
679
|
+
writeFileSync: (tempPath, data, options) => {
|
|
680
|
+
return fs.writeFileSync(tempPath, `${data}\n`, options);
|
|
681
|
+
},
|
|
682
|
+
renameSync: (sourcePath, destinationPath) => {
|
|
683
|
+
if (existingMode !== undefined)
|
|
684
|
+
fs.chmodSync(sourcePath, existingMode);
|
|
685
|
+
fs.renameSync(sourcePath, destinationPath);
|
|
686
|
+
},
|
|
687
|
+
rmSync: fs.rmSync,
|
|
688
|
+
},
|
|
689
|
+
});
|
|
690
|
+
writeAtomicSettings(targetPath, settings);
|
|
691
|
+
}
|
|
692
|
+
function parseOverrideStringArrayOrFalse(value, meta) {
|
|
693
|
+
if (value === undefined)
|
|
694
|
+
return undefined;
|
|
695
|
+
if (value === false)
|
|
696
|
+
return false;
|
|
697
|
+
if (!Array.isArray(value)) {
|
|
698
|
+
throw new Error(`Builtin override '${meta.name}' in '${meta.filePath}' has invalid '${meta.field}'; expected an array of strings or false.`);
|
|
699
|
+
}
|
|
700
|
+
const items = [];
|
|
701
|
+
for (const item of value) {
|
|
702
|
+
if (typeof item !== "string") {
|
|
703
|
+
throw new Error(`Builtin override '${meta.name}' in '${meta.filePath}' has invalid '${meta.field}'; expected an array of strings or false.`);
|
|
704
|
+
}
|
|
705
|
+
const trimmed = item.trim();
|
|
706
|
+
if (trimmed)
|
|
707
|
+
items.push(trimmed);
|
|
708
|
+
}
|
|
709
|
+
return items;
|
|
710
|
+
}
|
|
711
|
+
function parseToolsOverride(value, meta) {
|
|
712
|
+
if (typeof value === "string" && value.trim() === "inherit")
|
|
713
|
+
return "inherit";
|
|
714
|
+
if (value === undefined || value === false || Array.isArray(value)) {
|
|
715
|
+
return parseOverrideStringArrayOrFalse(value, { ...meta, field: "tools" });
|
|
716
|
+
}
|
|
717
|
+
throw new Error(`Builtin override '${meta.name}' in '${meta.filePath}' has invalid 'tools'; expected an array of strings, "inherit", or false.`);
|
|
718
|
+
}
|
|
719
|
+
export function validateOptionalMachine(value, label) {
|
|
720
|
+
if (value === undefined || value === false)
|
|
721
|
+
return undefined;
|
|
722
|
+
if (typeof value !== "string" || !value.trim())
|
|
723
|
+
throw new Error(label + " must be a non-empty string or false.");
|
|
724
|
+
const machine = value.trim();
|
|
725
|
+
if (machine.length > 128)
|
|
726
|
+
throw new Error(label + " must be 128 characters or fewer.");
|
|
727
|
+
if (/[\u0000-\u001f\u007f]/u.test(machine))
|
|
728
|
+
throw new Error(label + " contains control characters.");
|
|
729
|
+
return machine;
|
|
730
|
+
}
|
|
731
|
+
function parseBuiltinOverrideEntry(name, value, filePath) {
|
|
732
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
733
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' must be an object.`);
|
|
734
|
+
}
|
|
735
|
+
const input = value;
|
|
736
|
+
if (Object.hasOwn(input, "fallbackModels")) {
|
|
737
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' uses removed field 'fallbackModels'; configure one model instead.`);
|
|
738
|
+
}
|
|
739
|
+
const override = {};
|
|
740
|
+
if ("description" in input) {
|
|
741
|
+
if (typeof input.description === "string" && input.description.trim()) {
|
|
742
|
+
override.description = input.description.trim();
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'description'; expected a non-empty string.`);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if ("advertise" in input) {
|
|
749
|
+
if (typeof input.advertise === "boolean")
|
|
750
|
+
override.advertise = input.advertise;
|
|
751
|
+
else
|
|
752
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'advertise'; expected a boolean.`);
|
|
753
|
+
}
|
|
754
|
+
if ("output" in input) {
|
|
755
|
+
if ((typeof input.output === "string" && input.output.trim()) || input.output === false)
|
|
756
|
+
override.output = input.output;
|
|
757
|
+
else
|
|
758
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'output'; expected a non-empty string or false.`);
|
|
759
|
+
}
|
|
760
|
+
if ("outputMode" in input) {
|
|
761
|
+
if (input.outputMode === "inline" || input.outputMode === "file-only") {
|
|
762
|
+
override.outputMode = input.outputMode;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'outputMode'; expected 'inline' or 'file-only'.`);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
if ("model" in input) {
|
|
769
|
+
if (typeof input.model === "string" || input.model === false)
|
|
770
|
+
override.model = input.model;
|
|
771
|
+
else
|
|
772
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'model'; expected a string or false.`);
|
|
773
|
+
}
|
|
774
|
+
if ("fast" in input) {
|
|
775
|
+
if (typeof input.fast === "boolean")
|
|
776
|
+
override.fast = input.fast;
|
|
777
|
+
else
|
|
778
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'fast'; expected a boolean.`);
|
|
779
|
+
}
|
|
780
|
+
if ("thinking" in input) {
|
|
781
|
+
if (typeof input.thinking === "string" || input.thinking === false)
|
|
782
|
+
override.thinking = input.thinking;
|
|
783
|
+
else
|
|
784
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'thinking'; expected a string or false.`);
|
|
785
|
+
}
|
|
786
|
+
if ("systemPromptMode" in input) {
|
|
787
|
+
if (input.systemPromptMode === "append" || input.systemPromptMode === "replace") {
|
|
788
|
+
override.systemPromptMode = input.systemPromptMode;
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'systemPromptMode'; expected 'append' or 'replace'.`);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
if ("inheritProjectContext" in input) {
|
|
795
|
+
if (typeof input.inheritProjectContext === "boolean") {
|
|
796
|
+
override.inheritProjectContext = input.inheritProjectContext;
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'inheritProjectContext'; expected a boolean.`);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if ("inheritGlobalContext" in input) {
|
|
803
|
+
if (typeof input.inheritGlobalContext === "boolean") {
|
|
804
|
+
override.inheritGlobalContext = input.inheritGlobalContext;
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'inheritGlobalContext'; expected a boolean.`);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if ("inheritSkills" in input) {
|
|
811
|
+
if (typeof input.inheritSkills === "boolean") {
|
|
812
|
+
override.inheritSkills = input.inheritSkills;
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'inheritSkills'; expected a boolean.`);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if ("defaultContext" in input) {
|
|
819
|
+
if (input.defaultContext === "fresh" || input.defaultContext === "fork" || input.defaultContext === false) {
|
|
820
|
+
override.defaultContext = input.defaultContext;
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'defaultContext'; expected 'fresh', 'fork', or false.`);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if ("acceptanceRole" in input) {
|
|
827
|
+
if (input.acceptanceRole === "read-only" || input.acceptanceRole === "writer" || input.acceptanceRole === false) {
|
|
828
|
+
override.acceptanceRole = input.acceptanceRole;
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'acceptanceRole'; expected 'read-only', 'writer', or false.`);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
if ("disabled" in input) {
|
|
835
|
+
if (typeof input.disabled === "boolean") {
|
|
836
|
+
override.disabled = input.disabled;
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'disabled'; expected a boolean.`);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
if ("toolBudget" in input) {
|
|
843
|
+
if (input.toolBudget === false) {
|
|
844
|
+
override.toolBudget = false;
|
|
845
|
+
}
|
|
846
|
+
else if (input.toolBudget && typeof input.toolBudget === "object" && !Array.isArray(input.toolBudget)) {
|
|
847
|
+
override.toolBudget = input.toolBudget;
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'toolBudget'; expected an object or false.`);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
if ("systemPrompt" in input) {
|
|
854
|
+
if (typeof input.systemPrompt === "string")
|
|
855
|
+
override.systemPrompt = input.systemPrompt;
|
|
856
|
+
else
|
|
857
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'systemPrompt'; expected a string.`);
|
|
858
|
+
}
|
|
859
|
+
if (input.machine === false)
|
|
860
|
+
override.machine = false;
|
|
861
|
+
else {
|
|
862
|
+
const machine = validateOptionalMachine(input.machine, `Builtin override '${name}' in '${filePath}' field 'machine'`);
|
|
863
|
+
if (machine !== undefined)
|
|
864
|
+
override.machine = machine;
|
|
865
|
+
}
|
|
866
|
+
const defaultReads = parseOverrideStringArrayOrFalse(input.defaultReads, { filePath, name, field: "defaultReads" });
|
|
867
|
+
if (defaultReads !== undefined)
|
|
868
|
+
override.defaultReads = defaultReads;
|
|
869
|
+
if ("defaultProvider" in input) {
|
|
870
|
+
if (input.defaultProvider === false)
|
|
871
|
+
override.defaultProvider = false;
|
|
872
|
+
else if (typeof input.defaultProvider === "string" && input.defaultProvider.trim())
|
|
873
|
+
override.defaultProvider = input.defaultProvider.trim();
|
|
874
|
+
else
|
|
875
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'defaultProvider'; expected a non-empty string or false.`);
|
|
876
|
+
}
|
|
877
|
+
const skills = parseOverrideStringArrayOrFalse(input.skills, { filePath, name, field: "skills" });
|
|
878
|
+
if (skills !== undefined)
|
|
879
|
+
override.skills = skills;
|
|
880
|
+
const tools = parseToolsOverride(input.tools, { filePath, name });
|
|
881
|
+
if (tools !== undefined)
|
|
882
|
+
override.tools = tools;
|
|
883
|
+
const excludeTools = parseOverrideStringArrayOrFalse(input.excludeTools, { filePath, name, field: "excludeTools" });
|
|
884
|
+
if (excludeTools !== undefined)
|
|
885
|
+
override.excludeTools = excludeTools;
|
|
886
|
+
if ("allowNestedSubagents" in input) {
|
|
887
|
+
if (typeof input.allowNestedSubagents === "boolean")
|
|
888
|
+
override.allowNestedSubagents = input.allowNestedSubagents;
|
|
889
|
+
else
|
|
890
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'allowNestedSubagents'; expected a boolean.`);
|
|
891
|
+
}
|
|
892
|
+
const allowedAgents = parseOverrideStringArrayOrFalse(input.allowedAgents, { filePath, name, field: "allowedAgents" });
|
|
893
|
+
if (allowedAgents !== undefined)
|
|
894
|
+
override.allowedAgents = allowedAgents === false ? false : normalizeCapabilityCeilingAllowedAgents(allowedAgents);
|
|
895
|
+
const extensions = parseOverrideStringArrayOrFalse(input.extensions, { filePath, name, field: "extensions" });
|
|
896
|
+
if (extensions !== undefined)
|
|
897
|
+
override.extensions = extensions;
|
|
898
|
+
const subagentOnlyExtensions = parseOverrideStringArrayOrFalse(input.subagentOnlyExtensions, { filePath, name, field: "subagentOnlyExtensions" });
|
|
899
|
+
if (subagentOnlyExtensions !== undefined)
|
|
900
|
+
override.subagentOnlyExtensions = subagentOnlyExtensions;
|
|
901
|
+
const mutationTools = parseOverrideStringArrayOrFalse(input.mutationTools, { filePath, name, field: "mutationTools" });
|
|
902
|
+
if (mutationTools !== undefined)
|
|
903
|
+
override.mutationTools = mutationTools;
|
|
904
|
+
return Object.keys(override).length > 0 ? override : undefined;
|
|
905
|
+
}
|
|
906
|
+
function readSubagentSettings(filePath) {
|
|
907
|
+
if (!filePath)
|
|
908
|
+
return EMPTY_SUBAGENT_SETTINGS;
|
|
909
|
+
const settings = readSettingsFileStrict(filePath);
|
|
910
|
+
const subagents = settings.subagents;
|
|
911
|
+
if (!subagents || typeof subagents !== "object" || Array.isArray(subagents))
|
|
912
|
+
return EMPTY_SUBAGENT_SETTINGS;
|
|
913
|
+
const subagentsObject = subagents;
|
|
914
|
+
let disableBuiltins;
|
|
915
|
+
if ("disableBuiltins" in subagentsObject) {
|
|
916
|
+
if (typeof subagentsObject.disableBuiltins === "boolean") {
|
|
917
|
+
disableBuiltins = subagentsObject.disableBuiltins;
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'disableBuiltins'; expected a boolean.`);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
let disableThinking;
|
|
924
|
+
if ("disableThinking" in subagentsObject) {
|
|
925
|
+
if (typeof subagentsObject.disableThinking === "boolean") {
|
|
926
|
+
disableThinking = subagentsObject.disableThinking;
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'disableThinking'; expected a boolean.`);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
let defaultModel;
|
|
933
|
+
if ("defaultModel" in subagentsObject) {
|
|
934
|
+
if (typeof subagentsObject.defaultModel === "string" && subagentsObject.defaultModel.trim()) {
|
|
935
|
+
defaultModel = subagentsObject.defaultModel.trim();
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultModel'; expected a non-empty string.`);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
let defaultProvider;
|
|
942
|
+
if ("defaultProvider" in subagentsObject) {
|
|
943
|
+
if (typeof subagentsObject.defaultProvider === "string" && subagentsObject.defaultProvider.trim()) {
|
|
944
|
+
defaultProvider = subagentsObject.defaultProvider.trim();
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultProvider'; expected a non-empty string.`);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
let defaultThinking;
|
|
951
|
+
if ("defaultThinking" in subagentsObject) {
|
|
952
|
+
if (typeof subagentsObject.defaultThinking === "string" && subagentsObject.defaultThinking.trim()) {
|
|
953
|
+
defaultThinking = subagentsObject.defaultThinking.trim();
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultThinking'; expected a non-empty string.`);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
let maxThinking;
|
|
960
|
+
if ("maxThinking" in subagentsObject) {
|
|
961
|
+
try {
|
|
962
|
+
maxThinking = parseThinkingLevel(subagentsObject.maxThinking, `'${filePath}' subagents.maxThinking`);
|
|
963
|
+
}
|
|
964
|
+
catch (error) {
|
|
965
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'maxThinking'; expected one of off, minimal, low, medium, high, xhigh, or max.`, { cause: error instanceof Error ? error : undefined });
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
let defaultExtensions;
|
|
969
|
+
if ("defaultExtensions" in subagentsObject) {
|
|
970
|
+
if (!Array.isArray(subagentsObject.defaultExtensions)
|
|
971
|
+
|| subagentsObject.defaultExtensions.some((item) => typeof item !== "string" || !item.trim())) {
|
|
972
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultExtensions'; expected an array of non-empty strings.`);
|
|
973
|
+
}
|
|
974
|
+
defaultExtensions = subagentsObject.defaultExtensions.map((item) => item.trim());
|
|
975
|
+
}
|
|
976
|
+
let defaultSubagentOnlyExtensions;
|
|
977
|
+
if ("defaultSubagentOnlyExtensions" in subagentsObject) {
|
|
978
|
+
if (!Array.isArray(subagentsObject.defaultSubagentOnlyExtensions)
|
|
979
|
+
|| subagentsObject.defaultSubagentOnlyExtensions.some((item) => typeof item !== "string" || !item.trim())) {
|
|
980
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultSubagentOnlyExtensions'; expected an array of non-empty strings.`);
|
|
981
|
+
}
|
|
982
|
+
defaultSubagentOnlyExtensions = subagentsObject.defaultSubagentOnlyExtensions.map((item) => item.trim());
|
|
983
|
+
}
|
|
984
|
+
let agentScanDirs;
|
|
985
|
+
if ("agentScanDirs" in subagentsObject) {
|
|
986
|
+
if (!Array.isArray(subagentsObject.agentScanDirs)
|
|
987
|
+
|| subagentsObject.agentScanDirs.some((item) => typeof item !== "string" || !item.trim())) {
|
|
988
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'agentScanDirs'; expected an array of non-empty strings.`);
|
|
989
|
+
}
|
|
990
|
+
agentScanDirs = subagentsObject.agentScanDirs.map((item) => item.trim());
|
|
991
|
+
}
|
|
992
|
+
let agentExcludeDirs;
|
|
993
|
+
if ("agentExcludeDirs" in subagentsObject) {
|
|
994
|
+
if (!Array.isArray(subagentsObject.agentExcludeDirs)
|
|
995
|
+
|| subagentsObject.agentExcludeDirs.some((item) => typeof item !== "string" || !item.trim())) {
|
|
996
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'agentExcludeDirs'; expected an array of non-empty strings.`);
|
|
997
|
+
}
|
|
998
|
+
agentExcludeDirs = subagentsObject.agentExcludeDirs.map((item) => item.trim());
|
|
999
|
+
}
|
|
1000
|
+
const modelScope = parseModelScopeConfig(subagentsObject.modelScope, { filePath });
|
|
1001
|
+
const parsed = {};
|
|
1002
|
+
const providerOverrides = {};
|
|
1003
|
+
const agentOverrides = subagentsObject.agentOverrides;
|
|
1004
|
+
const agentOverridesByProvider = subagentsObject.agentOverridesByProvider;
|
|
1005
|
+
const parsedSettings = {
|
|
1006
|
+
overrides: parsed,
|
|
1007
|
+
providerOverrides,
|
|
1008
|
+
...(defaultModel !== undefined ? { defaultModel } : {}),
|
|
1009
|
+
...(defaultProvider !== undefined ? { defaultProvider } : {}),
|
|
1010
|
+
...(defaultThinking !== undefined ? { defaultThinking } : {}),
|
|
1011
|
+
...(maxThinking !== undefined ? { maxThinking } : {}),
|
|
1012
|
+
...(defaultExtensions !== undefined ? { defaultExtensions } : {}),
|
|
1013
|
+
...(defaultSubagentOnlyExtensions !== undefined ? { defaultSubagentOnlyExtensions } : {}),
|
|
1014
|
+
...(agentScanDirs !== undefined ? { agentScanDirs } : {}),
|
|
1015
|
+
...(agentExcludeDirs !== undefined ? { agentExcludeDirs } : {}),
|
|
1016
|
+
...(disableBuiltins !== undefined ? { disableBuiltins } : {}),
|
|
1017
|
+
...(disableThinking !== undefined ? { disableThinking } : {}),
|
|
1018
|
+
...(modelScope !== undefined ? { modelScope } : {}),
|
|
1019
|
+
};
|
|
1020
|
+
if (agentOverrides && typeof agentOverrides === "object" && !Array.isArray(agentOverrides)) {
|
|
1021
|
+
for (const [name, value] of Object.entries(agentOverrides)) {
|
|
1022
|
+
const override = parseBuiltinOverrideEntry(name, value, filePath);
|
|
1023
|
+
if (override)
|
|
1024
|
+
parsed[name] = override;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (agentOverridesByProvider !== undefined) {
|
|
1028
|
+
if (!agentOverridesByProvider || typeof agentOverridesByProvider !== "object" || Array.isArray(agentOverridesByProvider)) {
|
|
1029
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'agentOverridesByProvider'; expected an object keyed by provider.`);
|
|
1030
|
+
}
|
|
1031
|
+
for (const [provider, value] of Object.entries(agentOverridesByProvider)) {
|
|
1032
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1033
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'agentOverridesByProvider.${provider}'; expected an object keyed by agent.`);
|
|
1034
|
+
}
|
|
1035
|
+
const entries = {};
|
|
1036
|
+
for (const [agentName, agentValue] of Object.entries(value)) {
|
|
1037
|
+
const override = parseBuiltinOverrideEntry(`agentOverridesByProvider.${provider}.${agentName}`, agentValue, filePath);
|
|
1038
|
+
if (override)
|
|
1039
|
+
entries[agentName] = override;
|
|
1040
|
+
}
|
|
1041
|
+
providerOverrides[provider] = entries;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return parsedSettings;
|
|
1045
|
+
}
|
|
1046
|
+
function selectProviderOverrides(settings, provider) {
|
|
1047
|
+
if (!provider)
|
|
1048
|
+
return settings;
|
|
1049
|
+
const selected = settings.providerOverrides[provider];
|
|
1050
|
+
if (!selected)
|
|
1051
|
+
return settings;
|
|
1052
|
+
const overrides = { ...settings.overrides };
|
|
1053
|
+
for (const [name, override] of Object.entries(selected)) {
|
|
1054
|
+
overrides[name] = { ...overrides[name], ...override };
|
|
1055
|
+
}
|
|
1056
|
+
return { ...settings, overrides };
|
|
1057
|
+
}
|
|
1058
|
+
function resolveSubagentDefaultProvider(userSettings, projectSettings, projectSettingsPath) {
|
|
1059
|
+
if (projectSettingsPath && projectSettings.defaultProvider !== undefined)
|
|
1060
|
+
return projectSettings.defaultProvider;
|
|
1061
|
+
return userSettings.defaultProvider;
|
|
1062
|
+
}
|
|
1063
|
+
function resolveSubagentDefaultModel(userSettings, projectSettings, userSettingsPath, projectSettingsPath, defaultProvider) {
|
|
1064
|
+
if (projectSettingsPath && projectSettings.defaultModel !== undefined) {
|
|
1065
|
+
return { type: "subagents.defaultModel", scope: "project", path: projectSettingsPath, model: projectSettings.defaultModel, ...(defaultProvider ? { defaultProvider } : {}) };
|
|
1066
|
+
}
|
|
1067
|
+
return userSettings.defaultModel !== undefined
|
|
1068
|
+
? { type: "subagents.defaultModel", scope: "user", path: userSettingsPath, model: userSettings.defaultModel, ...(defaultProvider ? { defaultProvider } : {}) }
|
|
1069
|
+
: undefined;
|
|
1070
|
+
}
|
|
1071
|
+
function applySubagentDefaultModel(agents, defaultModel, defaultProvider) {
|
|
1072
|
+
if (!defaultModel && !defaultProvider)
|
|
1073
|
+
return agents;
|
|
1074
|
+
return agents.map((agent) => {
|
|
1075
|
+
if (agent.model !== undefined && (agent.modelProvider !== undefined || !defaultProvider))
|
|
1076
|
+
return agent;
|
|
1077
|
+
const next = {
|
|
1078
|
+
...agent,
|
|
1079
|
+
...(agent.model === undefined && defaultModel ? { model: defaultModel.model, modelSource: defaultModel } : {}),
|
|
1080
|
+
...(defaultProvider ? { modelProvider: defaultProvider } : {}),
|
|
1081
|
+
};
|
|
1082
|
+
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
1083
|
+
if (frontmatterFields)
|
|
1084
|
+
agentFrontmatterFields.set(next, frontmatterFields);
|
|
1085
|
+
return next;
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
function resolveSubagentDefaultThinking(userSettings, projectSettings, projectSettingsPath) {
|
|
1089
|
+
if (projectSettingsPath && projectSettings.defaultThinking !== undefined)
|
|
1090
|
+
return projectSettings.defaultThinking;
|
|
1091
|
+
return userSettings.defaultThinking;
|
|
1092
|
+
}
|
|
1093
|
+
function applySubagentDefaultThinking(agents, defaultThinking) {
|
|
1094
|
+
if (defaultThinking === undefined)
|
|
1095
|
+
return agents;
|
|
1096
|
+
return agents.map((agent) => {
|
|
1097
|
+
if (agent.thinking !== undefined)
|
|
1098
|
+
return agent;
|
|
1099
|
+
const next = { ...agent, thinking: defaultThinking };
|
|
1100
|
+
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
1101
|
+
if (frontmatterFields)
|
|
1102
|
+
agentFrontmatterFields.set(next, frontmatterFields);
|
|
1103
|
+
return next;
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
function resolveSubagentMaxThinking(userSettings, projectSettings, projectSettingsPath) {
|
|
1107
|
+
if (projectSettingsPath && projectSettings.maxThinking !== undefined)
|
|
1108
|
+
return projectSettings.maxThinking;
|
|
1109
|
+
return userSettings.maxThinking;
|
|
1110
|
+
}
|
|
1111
|
+
function applySubagentMaxThinking(agents, maxThinking) {
|
|
1112
|
+
if (maxThinking === undefined)
|
|
1113
|
+
return agents;
|
|
1114
|
+
return agents.map((agent) => agent.maxThinking === maxThinking ? agent : { ...agent, maxThinking });
|
|
1115
|
+
}
|
|
1116
|
+
function resolveSubagentDefaultExtensions(userSettings, projectSettings, projectSettingsPath) {
|
|
1117
|
+
if (projectSettingsPath && projectSettings.defaultExtensions !== undefined)
|
|
1118
|
+
return projectSettings.defaultExtensions;
|
|
1119
|
+
return userSettings.defaultExtensions;
|
|
1120
|
+
}
|
|
1121
|
+
function applySubagentDefaultExtensions(agents, defaultExtensions) {
|
|
1122
|
+
if (defaultExtensions === undefined)
|
|
1123
|
+
return agents;
|
|
1124
|
+
return agents.map((agent) => {
|
|
1125
|
+
if (agent.extensions !== undefined)
|
|
1126
|
+
return agent;
|
|
1127
|
+
const next = { ...agent, extensions: [...defaultExtensions], extensionsFromDefault: true };
|
|
1128
|
+
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
1129
|
+
if (frontmatterFields)
|
|
1130
|
+
agentFrontmatterFields.set(next, frontmatterFields);
|
|
1131
|
+
return next;
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
function resolveSubagentDefaultSubagentOnlyExtensions(userSettings, projectSettings, projectSettingsPath) {
|
|
1135
|
+
if (projectSettingsPath && projectSettings.defaultSubagentOnlyExtensions !== undefined)
|
|
1136
|
+
return projectSettings.defaultSubagentOnlyExtensions;
|
|
1137
|
+
return userSettings.defaultSubagentOnlyExtensions;
|
|
1138
|
+
}
|
|
1139
|
+
function applySubagentDefaultSubagentOnlyExtensions(agents, defaultSubagentOnlyExtensions) {
|
|
1140
|
+
if (defaultSubagentOnlyExtensions === undefined)
|
|
1141
|
+
return agents;
|
|
1142
|
+
return agents.map((agent) => {
|
|
1143
|
+
if (agent.subagentOnlyExtensions !== undefined)
|
|
1144
|
+
return agent;
|
|
1145
|
+
const next = { ...agent, subagentOnlyExtensions: [...defaultSubagentOnlyExtensions] };
|
|
1146
|
+
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
1147
|
+
if (frontmatterFields)
|
|
1148
|
+
agentFrontmatterFields.set(next, frontmatterFields);
|
|
1149
|
+
return next;
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function applySubagentDefaults(agents, defaultModel, defaultProvider, defaultThinking, defaultExtensions, defaultSubagentOnlyExtensions) {
|
|
1153
|
+
return applySubagentDefaultSubagentOnlyExtensions(applySubagentDefaultExtensions(applySubagentDefaultThinking(applySubagentDefaultModel(agents, defaultModel, defaultProvider), defaultThinking), defaultExtensions), defaultSubagentOnlyExtensions);
|
|
1154
|
+
}
|
|
1155
|
+
function applyToolsOverride(target, toolsOverride) {
|
|
1156
|
+
if (toolsOverride === "inherit") {
|
|
1157
|
+
delete target.tools;
|
|
1158
|
+
delete target.mcpDirectTools;
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const { tools, mcpDirectTools } = splitToolList(toolsOverride === false ? [] : toolsOverride);
|
|
1162
|
+
if (tools === undefined)
|
|
1163
|
+
delete target.tools;
|
|
1164
|
+
else
|
|
1165
|
+
target.tools = tools;
|
|
1166
|
+
if (mcpDirectTools === undefined)
|
|
1167
|
+
delete target.mcpDirectTools;
|
|
1168
|
+
else
|
|
1169
|
+
target.mcpDirectTools = mcpDirectTools;
|
|
1170
|
+
}
|
|
1171
|
+
function applyBuiltinOverride(agent, override, meta) {
|
|
1172
|
+
const overrideInfo = {
|
|
1173
|
+
...meta,
|
|
1174
|
+
base: agent.override?.base ?? cloneOverrideBase(agent),
|
|
1175
|
+
fields: [...new Set([...(agent.override?.fields ?? []), ...Object.keys(override)])].sort(),
|
|
1176
|
+
fieldScopes: Object.fromEntries(Object.entries({ ...(agent.override?.fieldScopes ?? {}) }).map(([field, scopes]) => [field, [...scopes]])),
|
|
1177
|
+
};
|
|
1178
|
+
for (const field of Object.keys(override)) {
|
|
1179
|
+
const scopes = overrideInfo.fieldScopes[field] ?? [];
|
|
1180
|
+
overrideInfo.fieldScopes[field] = [...new Set([...scopes, meta.scope])].sort();
|
|
1181
|
+
}
|
|
1182
|
+
const next = {
|
|
1183
|
+
...agent,
|
|
1184
|
+
override: overrideInfo,
|
|
1185
|
+
};
|
|
1186
|
+
if (override.description !== undefined)
|
|
1187
|
+
next.description = override.description;
|
|
1188
|
+
if (override.advertise !== undefined)
|
|
1189
|
+
next.advertise = override.advertise;
|
|
1190
|
+
if (override.machine !== undefined) {
|
|
1191
|
+
if (override.machine === false)
|
|
1192
|
+
delete next.machine;
|
|
1193
|
+
else
|
|
1194
|
+
next.machine = override.machine;
|
|
1195
|
+
}
|
|
1196
|
+
if (override.output !== undefined) {
|
|
1197
|
+
if (override.output === false)
|
|
1198
|
+
delete next.output;
|
|
1199
|
+
else
|
|
1200
|
+
next.output = override.output;
|
|
1201
|
+
}
|
|
1202
|
+
if (override.outputMode !== undefined)
|
|
1203
|
+
next.outputMode = override.outputMode;
|
|
1204
|
+
if (override.defaultReads !== undefined) {
|
|
1205
|
+
if (override.defaultReads === false)
|
|
1206
|
+
delete next.defaultReads;
|
|
1207
|
+
else
|
|
1208
|
+
next.defaultReads = [...override.defaultReads];
|
|
1209
|
+
}
|
|
1210
|
+
if (override.model !== undefined) {
|
|
1211
|
+
if (override.model === false)
|
|
1212
|
+
delete next.model;
|
|
1213
|
+
else
|
|
1214
|
+
next.model = override.model;
|
|
1215
|
+
delete next.modelSource;
|
|
1216
|
+
}
|
|
1217
|
+
if (override.defaultProvider !== undefined) {
|
|
1218
|
+
if (override.defaultProvider === false)
|
|
1219
|
+
delete next.modelProvider;
|
|
1220
|
+
else
|
|
1221
|
+
next.modelProvider = override.defaultProvider;
|
|
1222
|
+
}
|
|
1223
|
+
if (override.fast !== undefined)
|
|
1224
|
+
next.fast = override.fast;
|
|
1225
|
+
if (override.thinking !== undefined) {
|
|
1226
|
+
if (override.thinking === false)
|
|
1227
|
+
delete next.thinking;
|
|
1228
|
+
else
|
|
1229
|
+
next.thinking = override.thinking;
|
|
1230
|
+
}
|
|
1231
|
+
if (override.systemPromptMode !== undefined)
|
|
1232
|
+
next.systemPromptMode = override.systemPromptMode;
|
|
1233
|
+
if (override.inheritProjectContext !== undefined)
|
|
1234
|
+
next.inheritProjectContext = override.inheritProjectContext;
|
|
1235
|
+
if (override.inheritGlobalContext !== undefined)
|
|
1236
|
+
next.inheritGlobalContext = override.inheritGlobalContext;
|
|
1237
|
+
if (override.inheritSkills !== undefined)
|
|
1238
|
+
next.inheritSkills = override.inheritSkills;
|
|
1239
|
+
if (override.defaultContext !== undefined) {
|
|
1240
|
+
if (override.defaultContext === false)
|
|
1241
|
+
delete next.defaultContext;
|
|
1242
|
+
else
|
|
1243
|
+
next.defaultContext = override.defaultContext;
|
|
1244
|
+
}
|
|
1245
|
+
if (override.acceptanceRole !== undefined) {
|
|
1246
|
+
if (override.acceptanceRole === false)
|
|
1247
|
+
delete next.acceptanceRole;
|
|
1248
|
+
else
|
|
1249
|
+
next.acceptanceRole = override.acceptanceRole;
|
|
1250
|
+
}
|
|
1251
|
+
if (override.disabled !== undefined)
|
|
1252
|
+
next.disabled = override.disabled;
|
|
1253
|
+
if (override.systemPrompt !== undefined)
|
|
1254
|
+
next.systemPrompt = override.systemPrompt;
|
|
1255
|
+
if (override.skills !== undefined) {
|
|
1256
|
+
if (override.skills === false)
|
|
1257
|
+
delete next.skills;
|
|
1258
|
+
else
|
|
1259
|
+
next.skills = [...override.skills];
|
|
1260
|
+
}
|
|
1261
|
+
if (override.tools !== undefined)
|
|
1262
|
+
applyToolsOverride(next, override.tools);
|
|
1263
|
+
if (override.excludeTools !== undefined) {
|
|
1264
|
+
if (override.excludeTools === false)
|
|
1265
|
+
delete next.excludeTools;
|
|
1266
|
+
else
|
|
1267
|
+
next.excludeTools = [...override.excludeTools];
|
|
1268
|
+
}
|
|
1269
|
+
if (override.allowNestedSubagents !== undefined)
|
|
1270
|
+
next.allowNestedSubagents = override.allowNestedSubagents;
|
|
1271
|
+
if (override.allowedAgents !== undefined) {
|
|
1272
|
+
if (override.allowedAgents === false)
|
|
1273
|
+
delete next.allowedAgents;
|
|
1274
|
+
else
|
|
1275
|
+
next.allowedAgents = [...override.allowedAgents];
|
|
1276
|
+
}
|
|
1277
|
+
if (override.extensions !== undefined) {
|
|
1278
|
+
if (override.extensions === false)
|
|
1279
|
+
delete next.extensions;
|
|
1280
|
+
else
|
|
1281
|
+
next.extensions = [...override.extensions];
|
|
1282
|
+
}
|
|
1283
|
+
if (override.subagentOnlyExtensions !== undefined) {
|
|
1284
|
+
if (override.subagentOnlyExtensions === false)
|
|
1285
|
+
delete next.subagentOnlyExtensions;
|
|
1286
|
+
else
|
|
1287
|
+
next.subagentOnlyExtensions = [...override.subagentOnlyExtensions];
|
|
1288
|
+
}
|
|
1289
|
+
if (override.mutationTools !== undefined) {
|
|
1290
|
+
if (override.mutationTools === false)
|
|
1291
|
+
delete next.mutationTools;
|
|
1292
|
+
else
|
|
1293
|
+
next.mutationTools = [...override.mutationTools];
|
|
1294
|
+
}
|
|
1295
|
+
if (override.toolBudget !== undefined) {
|
|
1296
|
+
if (override.toolBudget === false)
|
|
1297
|
+
delete next.toolBudget;
|
|
1298
|
+
else
|
|
1299
|
+
next.toolBudget = override.toolBudget;
|
|
1300
|
+
}
|
|
1301
|
+
return next;
|
|
1302
|
+
}
|
|
1303
|
+
function clearBuiltinThinking(agent, meta) {
|
|
1304
|
+
if (agent.thinking === undefined)
|
|
1305
|
+
return agent;
|
|
1306
|
+
const { thinking: _thinking, ...next } = agent;
|
|
1307
|
+
return { ...next, override: agent.override ?? { ...meta, base: cloneOverrideBase(agent) } };
|
|
1308
|
+
}
|
|
1309
|
+
function applyBuiltinOverrides(builtinAgents, userSettings, projectSettings, userSettingsPath, projectSettingsPath) {
|
|
1310
|
+
const projectBulkDisabled = projectSettings.disableBuiltins === true && projectSettingsPath !== null;
|
|
1311
|
+
const userBulkDisabled = projectSettings.disableBuiltins === undefined && userSettings.disableBuiltins === true;
|
|
1312
|
+
const projectThinkingConfigured = projectSettings.disableThinking !== undefined && projectSettingsPath !== null;
|
|
1313
|
+
const disableThinking = projectThinkingConfigured ? projectSettings.disableThinking === true : userSettings.disableThinking === true;
|
|
1314
|
+
const disableThinkingMeta = projectThinkingConfigured
|
|
1315
|
+
? { scope: "project", path: projectSettingsPath }
|
|
1316
|
+
: { scope: "user", path: userSettingsPath };
|
|
1317
|
+
const applyGlobalThinking = (agent, hasExplicitThinkingOverride) => {
|
|
1318
|
+
if (!disableThinking || hasExplicitThinkingOverride)
|
|
1319
|
+
return agent;
|
|
1320
|
+
return clearBuiltinThinking(agent, disableThinkingMeta);
|
|
1321
|
+
};
|
|
1322
|
+
return builtinAgents.map((agent) => {
|
|
1323
|
+
const projectOverride = projectSettings.overrides[agent.name];
|
|
1324
|
+
if (projectOverride && projectSettingsPath) {
|
|
1325
|
+
return applyGlobalThinking(applyBuiltinOverride(agent, projectOverride, { scope: "project", path: projectSettingsPath }), projectOverride.thinking !== undefined);
|
|
1326
|
+
}
|
|
1327
|
+
if (projectBulkDisabled && projectSettingsPath) {
|
|
1328
|
+
return applyGlobalThinking(applyBuiltinOverride(agent, { disabled: true }, { scope: "project", path: projectSettingsPath }), false);
|
|
1329
|
+
}
|
|
1330
|
+
const userOverride = userSettings.overrides[agent.name];
|
|
1331
|
+
if (userOverride) {
|
|
1332
|
+
return applyGlobalThinking(applyBuiltinOverride(agent, userOverride, { scope: "user", path: userSettingsPath }), !projectThinkingConfigured && userOverride.thinking !== undefined);
|
|
1333
|
+
}
|
|
1334
|
+
if (userBulkDisabled) {
|
|
1335
|
+
return applyGlobalThinking(applyBuiltinOverride(agent, { disabled: true }, { scope: "user", path: userSettingsPath }), false);
|
|
1336
|
+
}
|
|
1337
|
+
return applyGlobalThinking(agent, false);
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
function applyCustomAgentOverride(agent, override, meta) {
|
|
1341
|
+
const next = applyBuiltinOverride(agent, override, meta);
|
|
1342
|
+
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
1343
|
+
if (frontmatterFields)
|
|
1344
|
+
agentFrontmatterFields.set(next, frontmatterFields);
|
|
1345
|
+
return next;
|
|
1346
|
+
}
|
|
1347
|
+
function applyCustomAgentOverrides(agents, userSettings, projectSettings, userSettingsPath, projectSettingsPath) {
|
|
1348
|
+
// Apply user then project so project fields win without dropping user-only fields.
|
|
1349
|
+
return agents.map((agent) => {
|
|
1350
|
+
const userOverride = userSettings.overrides[agent.name];
|
|
1351
|
+
const withUserOverride = userOverride
|
|
1352
|
+
? applyCustomAgentOverride(agent, userOverride, { scope: "user", path: userSettingsPath })
|
|
1353
|
+
: agent;
|
|
1354
|
+
const projectOverride = projectSettings.overrides[agent.name];
|
|
1355
|
+
if (projectOverride && projectSettingsPath) {
|
|
1356
|
+
return applyCustomAgentOverride(withUserOverride, projectOverride, { scope: "project", path: projectSettingsPath });
|
|
1357
|
+
}
|
|
1358
|
+
return withUserOverride;
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
function runtimeAgentOverrides(settings) {
|
|
1362
|
+
const overrides = {};
|
|
1363
|
+
for (const [name, override] of Object.entries(settings.overrides)) {
|
|
1364
|
+
const narrowed = {};
|
|
1365
|
+
if (override.model !== undefined)
|
|
1366
|
+
narrowed.model = override.model;
|
|
1367
|
+
if (override.defaultProvider !== undefined)
|
|
1368
|
+
narrowed.defaultProvider = override.defaultProvider;
|
|
1369
|
+
if (override.fast !== undefined)
|
|
1370
|
+
narrowed.fast = override.fast;
|
|
1371
|
+
if (override.thinking !== undefined)
|
|
1372
|
+
narrowed.thinking = override.thinking;
|
|
1373
|
+
if (Object.keys(narrowed).length > 0)
|
|
1374
|
+
overrides[name] = narrowed;
|
|
1375
|
+
}
|
|
1376
|
+
return { ...settings, overrides };
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Runtime-registered agents keep their extension-owned definition (prompt,
|
|
1380
|
+
* tools, context, budgets, and every other launch field) but follow the same
|
|
1381
|
+
* model-tier settings as every other agent: `subagents.defaultModel`,
|
|
1382
|
+
* `defaultProvider`, `defaultThinking`, and the `model`, `defaultProvider`,
|
|
1383
|
+
* `fast`, and `thinking` fields of `agentOverrides.<name>`, user then project,
|
|
1384
|
+
* provider-scoped overrides included. Other override fields are ignored for
|
|
1385
|
+
* runtime agents. A definition `model` still wins over `defaultModel`.
|
|
1386
|
+
*/
|
|
1387
|
+
export function applyRuntimeAgentSettings(agents, context) {
|
|
1388
|
+
if (agents.length === 0)
|
|
1389
|
+
return agents;
|
|
1390
|
+
const sources = getAgentDiscoverySources(context.cwd, context.preferredModelProvider);
|
|
1391
|
+
const { user, project } = settingsForScope(sources, context.scope);
|
|
1392
|
+
const defaultProvider = resolveSubagentDefaultProvider(user, project, sources.projectSettingsPath);
|
|
1393
|
+
const defaultModel = resolveSubagentDefaultModel(user, project, sources.userSettingsPath, sources.projectSettingsPath, defaultProvider);
|
|
1394
|
+
const defaultThinking = resolveSubagentDefaultThinking(user, project, sources.projectSettingsPath);
|
|
1395
|
+
const withDefaults = applySubagentDefaultThinking(applySubagentDefaultModel(agents, defaultModel, defaultProvider), defaultThinking);
|
|
1396
|
+
return applyCustomAgentOverrides(withDefaults, runtimeAgentOverrides(user), runtimeAgentOverrides(project), sources.userSettingsPath, sources.projectSettingsPath);
|
|
1397
|
+
}
|
|
1398
|
+
export function buildBuiltinOverrideConfig(base, draft) {
|
|
1399
|
+
const override = {};
|
|
1400
|
+
if (draft.machine !== base.machine)
|
|
1401
|
+
override.machine = draft.machine ?? false;
|
|
1402
|
+
if (draft.description !== undefined) {
|
|
1403
|
+
const description = draft.description.trim();
|
|
1404
|
+
if (description && description !== base.description)
|
|
1405
|
+
override.description = description;
|
|
1406
|
+
}
|
|
1407
|
+
if (draft.output !== base.output)
|
|
1408
|
+
override.output = draft.output ?? false;
|
|
1409
|
+
if (draft.outputMode !== undefined && draft.outputMode !== base.outputMode)
|
|
1410
|
+
override.outputMode = draft.outputMode;
|
|
1411
|
+
if (!arraysEqual(draft.defaultReads, base.defaultReads))
|
|
1412
|
+
override.defaultReads = draft.defaultReads ? [...draft.defaultReads] : false;
|
|
1413
|
+
if (draft.model !== base.model)
|
|
1414
|
+
override.model = draft.model ?? false;
|
|
1415
|
+
if (draft.modelProvider !== base.modelProvider)
|
|
1416
|
+
override.defaultProvider = draft.modelProvider ?? false;
|
|
1417
|
+
if (draft.fast !== base.fast)
|
|
1418
|
+
override.fast = draft.fast === true;
|
|
1419
|
+
if (draft.thinking !== base.thinking)
|
|
1420
|
+
override.thinking = draft.thinking ?? false;
|
|
1421
|
+
if (draft.systemPromptMode !== base.systemPromptMode)
|
|
1422
|
+
override.systemPromptMode = draft.systemPromptMode;
|
|
1423
|
+
if (draft.inheritProjectContext !== base.inheritProjectContext)
|
|
1424
|
+
override.inheritProjectContext = draft.inheritProjectContext;
|
|
1425
|
+
if (draft.inheritGlobalContext !== base.inheritGlobalContext)
|
|
1426
|
+
override.inheritGlobalContext = draft.inheritGlobalContext;
|
|
1427
|
+
if (draft.inheritSkills !== base.inheritSkills)
|
|
1428
|
+
override.inheritSkills = draft.inheritSkills;
|
|
1429
|
+
if (draft.defaultContext !== base.defaultContext)
|
|
1430
|
+
override.defaultContext = draft.defaultContext ?? false;
|
|
1431
|
+
if (draft.acceptanceRole !== base.acceptanceRole)
|
|
1432
|
+
override.acceptanceRole = draft.acceptanceRole ?? false;
|
|
1433
|
+
if (draft.disabled !== base.disabled)
|
|
1434
|
+
override.disabled = draft.disabled ?? false;
|
|
1435
|
+
if (draft.systemPrompt !== base.systemPrompt)
|
|
1436
|
+
override.systemPrompt = draft.systemPrompt;
|
|
1437
|
+
if (!arraysEqual(draft.skills, base.skills))
|
|
1438
|
+
override.skills = draft.skills ? [...draft.skills] : false;
|
|
1439
|
+
const baseTools = joinToolList(base);
|
|
1440
|
+
const draftTools = joinToolList(draft);
|
|
1441
|
+
if (!arraysEqual(draftTools, baseTools))
|
|
1442
|
+
override.tools = draftTools ? [...draftTools] : false;
|
|
1443
|
+
if (!arraysEqual(draft.excludeTools, base.excludeTools))
|
|
1444
|
+
override.excludeTools = draft.excludeTools ? [...draft.excludeTools] : false;
|
|
1445
|
+
if (draft.allowNestedSubagents !== base.allowNestedSubagents)
|
|
1446
|
+
override.allowNestedSubagents = draft.allowNestedSubagents === true;
|
|
1447
|
+
if (!arraysEqual(draft.extensions, base.extensions))
|
|
1448
|
+
override.extensions = draft.extensions ? [...draft.extensions] : false;
|
|
1449
|
+
if (!arraysEqual(draft.subagentOnlyExtensions, base.subagentOnlyExtensions)) {
|
|
1450
|
+
override.subagentOnlyExtensions = draft.subagentOnlyExtensions ? [...draft.subagentOnlyExtensions] : false;
|
|
1451
|
+
}
|
|
1452
|
+
if (!arraysEqual(draft.mutationTools, base.mutationTools))
|
|
1453
|
+
override.mutationTools = draft.mutationTools ? [...draft.mutationTools] : false;
|
|
1454
|
+
if (JSON.stringify(draft.toolBudget) !== JSON.stringify(base.toolBudget))
|
|
1455
|
+
override.toolBudget = draft.toolBudget ?? false;
|
|
1456
|
+
return Object.keys(override).length > 0 ? override : undefined;
|
|
1457
|
+
}
|
|
1458
|
+
export function saveBuiltinAgentOverride(cwd, name, scope, override) {
|
|
1459
|
+
const filePath = scope === "project" ? getProjectAgentSettingsPath(cwd) : getUserAgentSettingsPath();
|
|
1460
|
+
if (!filePath)
|
|
1461
|
+
throw new Error("Project override is not available here. No project config root was found.");
|
|
1462
|
+
return withSettingsFileLease(filePath, () => {
|
|
1463
|
+
const settings = readSettingsFileStrict(filePath);
|
|
1464
|
+
const subagents = settings.subagents && typeof settings.subagents === "object" && !Array.isArray(settings.subagents)
|
|
1465
|
+
? { ...settings.subagents }
|
|
1466
|
+
: {};
|
|
1467
|
+
const agentOverrides = subagents.agentOverrides && typeof subagents.agentOverrides === "object" && !Array.isArray(subagents.agentOverrides)
|
|
1468
|
+
? { ...subagents.agentOverrides }
|
|
1469
|
+
: {};
|
|
1470
|
+
agentOverrides[name] = cloneOverrideValue(override);
|
|
1471
|
+
subagents.agentOverrides = agentOverrides;
|
|
1472
|
+
settings.subagents = subagents;
|
|
1473
|
+
writeSettingsFile(filePath, settings);
|
|
1474
|
+
return filePath;
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
export function removeBuiltinAgentOverride(cwd, name, scope, options) {
|
|
1478
|
+
const filePath = scope === "project" ? getProjectAgentSettingsPath(cwd) : getUserAgentSettingsPath();
|
|
1479
|
+
if (!filePath)
|
|
1480
|
+
throw new Error("Project override is not available here. No project config root was found.");
|
|
1481
|
+
if (!fs.existsSync(filePath))
|
|
1482
|
+
return { path: filePath, removed: false, machinePreserved: false };
|
|
1483
|
+
return withSettingsFileLease(filePath, () => {
|
|
1484
|
+
const settings = readSettingsFileStrict(filePath);
|
|
1485
|
+
const subagents = settings.subagents;
|
|
1486
|
+
if (!subagents || typeof subagents !== "object" || Array.isArray(subagents))
|
|
1487
|
+
return { path: filePath, removed: false, machinePreserved: false };
|
|
1488
|
+
const nextSubagents = { ...subagents };
|
|
1489
|
+
const agentOverrides = nextSubagents.agentOverrides;
|
|
1490
|
+
if (!agentOverrides || typeof agentOverrides !== "object" || Array.isArray(agentOverrides))
|
|
1491
|
+
return { path: filePath, removed: false, machinePreserved: false };
|
|
1492
|
+
const nextOverrides = { ...agentOverrides };
|
|
1493
|
+
const current = nextOverrides[name];
|
|
1494
|
+
if (!Object.prototype.hasOwnProperty.call(nextOverrides, name))
|
|
1495
|
+
return { path: filePath, removed: false, machinePreserved: false };
|
|
1496
|
+
const configuredMachine = current && typeof current === "object" && !Array.isArray(current) ? current.machine : undefined;
|
|
1497
|
+
const machine = configuredMachine === false || (typeof configuredMachine === "string" && configuredMachine.trim()) ? configuredMachine : undefined;
|
|
1498
|
+
if (options?.preserveMachine && machine !== undefined)
|
|
1499
|
+
nextOverrides[name] = { machine };
|
|
1500
|
+
else
|
|
1501
|
+
delete nextOverrides[name];
|
|
1502
|
+
if (Object.keys(nextOverrides).length > 0)
|
|
1503
|
+
nextSubagents.agentOverrides = nextOverrides;
|
|
1504
|
+
else
|
|
1505
|
+
delete nextSubagents.agentOverrides;
|
|
1506
|
+
if (Object.keys(nextSubagents).length > 0)
|
|
1507
|
+
settings.subagents = nextSubagents;
|
|
1508
|
+
else
|
|
1509
|
+
delete settings.subagents;
|
|
1510
|
+
writeSettingsFile(filePath, settings);
|
|
1511
|
+
return { path: filePath, removed: true, machinePreserved: options?.preserveMachine === true && machine !== undefined };
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
export function mergeBuiltinAgentOverride(cwd, name, scope, fields) {
|
|
1515
|
+
const filePath = scope === "project" ? getProjectAgentSettingsPath(cwd) : getUserAgentSettingsPath();
|
|
1516
|
+
if (!filePath)
|
|
1517
|
+
throw new Error("Project override is not available here. No project config root was found.");
|
|
1518
|
+
return withSettingsFileLease(filePath, () => {
|
|
1519
|
+
const settings = readSettingsFileStrict(filePath);
|
|
1520
|
+
const subagents = settings.subagents && typeof settings.subagents === "object" && !Array.isArray(settings.subagents)
|
|
1521
|
+
? { ...settings.subagents }
|
|
1522
|
+
: {};
|
|
1523
|
+
const agentOverrides = subagents.agentOverrides && typeof subagents.agentOverrides === "object" && !Array.isArray(subagents.agentOverrides)
|
|
1524
|
+
? { ...subagents.agentOverrides }
|
|
1525
|
+
: {};
|
|
1526
|
+
const existing = agentOverrides[name];
|
|
1527
|
+
const base = existing && typeof existing === "object" && !Array.isArray(existing)
|
|
1528
|
+
? existing
|
|
1529
|
+
: {};
|
|
1530
|
+
agentOverrides[name] = { ...base, ...cloneOverrideValue(fields) };
|
|
1531
|
+
subagents.agentOverrides = agentOverrides;
|
|
1532
|
+
settings.subagents = subagents;
|
|
1533
|
+
writeSettingsFile(filePath, settings);
|
|
1534
|
+
return filePath;
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
export function removeBuiltinAgentOverrideFields(cwd, name, scope, fields) {
|
|
1538
|
+
const filePath = scope === "project" ? getProjectAgentSettingsPath(cwd) : getUserAgentSettingsPath();
|
|
1539
|
+
if (!filePath)
|
|
1540
|
+
throw new Error("Project override is not available here. No project config root was found.");
|
|
1541
|
+
if (!fs.existsSync(filePath))
|
|
1542
|
+
return { path: filePath, removed: false };
|
|
1543
|
+
return withSettingsFileLease(filePath, () => {
|
|
1544
|
+
const settings = readSettingsFileStrict(filePath);
|
|
1545
|
+
const subagents = settings.subagents;
|
|
1546
|
+
if (!subagents || typeof subagents !== "object" || Array.isArray(subagents))
|
|
1547
|
+
return { path: filePath, removed: false };
|
|
1548
|
+
const agentOverrides = subagents.agentOverrides;
|
|
1549
|
+
if (!agentOverrides || typeof agentOverrides !== "object" || Array.isArray(agentOverrides))
|
|
1550
|
+
return { path: filePath, removed: false };
|
|
1551
|
+
const entry = agentOverrides[name];
|
|
1552
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
1553
|
+
return { path: filePath, removed: false };
|
|
1554
|
+
const nextEntry = { ...entry };
|
|
1555
|
+
let removed = false;
|
|
1556
|
+
for (const field of fields) {
|
|
1557
|
+
if (Object.prototype.hasOwnProperty.call(nextEntry, field)) {
|
|
1558
|
+
delete nextEntry[field];
|
|
1559
|
+
removed = true;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
if (!removed)
|
|
1563
|
+
return { path: filePath, removed: false };
|
|
1564
|
+
const nextSubagents = { ...subagents };
|
|
1565
|
+
if (Object.keys(nextEntry).length > 0) {
|
|
1566
|
+
nextSubagents.agentOverrides[name] = nextEntry;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
const nextOverrides = { ...agentOverrides };
|
|
1570
|
+
delete nextOverrides[name];
|
|
1571
|
+
if (Object.keys(nextOverrides).length > 0)
|
|
1572
|
+
nextSubagents.agentOverrides = nextOverrides;
|
|
1573
|
+
else
|
|
1574
|
+
delete nextSubagents.agentOverrides;
|
|
1575
|
+
}
|
|
1576
|
+
if (Object.keys(nextSubagents).length > 0)
|
|
1577
|
+
settings.subagents = nextSubagents;
|
|
1578
|
+
else
|
|
1579
|
+
delete settings.subagents;
|
|
1580
|
+
writeSettingsFile(filePath, settings);
|
|
1581
|
+
return { path: filePath, removed: true };
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
const DISCOVERY_PRUNED_DIR_NAMES = new Set([".git", "node_modules", ".pi", "sync-backups"]);
|
|
1585
|
+
function isDiscoveryNestedProjectRoot(dir) {
|
|
1586
|
+
return isDirectory(getProjectConfigDir(dir)) || isDirectory(path.join(dir, ".agents"));
|
|
1587
|
+
}
|
|
1588
|
+
function shouldPruneDiscoveryDir(rootDir, dir, dirName) {
|
|
1589
|
+
if (DISCOVERY_PRUNED_DIR_NAMES.has(dirName))
|
|
1590
|
+
return true;
|
|
1591
|
+
if (fs.existsSync(path.join(dir, ".git")))
|
|
1592
|
+
return true;
|
|
1593
|
+
return path.resolve(dir) !== path.resolve(rootDir) && isDiscoveryNestedProjectRoot(dir);
|
|
1594
|
+
}
|
|
1595
|
+
function listFilesRecursive(dir, predicate, rootDir = dir, visitedDirectories = new Set(), inspectedDirectories = new Set()) {
|
|
1596
|
+
const files = [];
|
|
1597
|
+
if (!fs.existsSync(dir))
|
|
1598
|
+
return files;
|
|
1599
|
+
inspectedDirectories.add(path.resolve(dir));
|
|
1600
|
+
let realDir;
|
|
1601
|
+
try {
|
|
1602
|
+
realDir = fs.realpathSync(dir);
|
|
1603
|
+
}
|
|
1604
|
+
catch {
|
|
1605
|
+
return files;
|
|
1606
|
+
}
|
|
1607
|
+
if (visitedDirectories.has(realDir))
|
|
1608
|
+
return files;
|
|
1609
|
+
visitedDirectories.add(realDir);
|
|
1610
|
+
let entries;
|
|
1611
|
+
try {
|
|
1612
|
+
entries = fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
1613
|
+
}
|
|
1614
|
+
catch {
|
|
1615
|
+
return files;
|
|
1616
|
+
}
|
|
1617
|
+
for (const entry of entries) {
|
|
1618
|
+
const filePath = path.join(dir, entry.name);
|
|
1619
|
+
let isDirectory = entry.isDirectory();
|
|
1620
|
+
if (entry.isSymbolicLink()) {
|
|
1621
|
+
try {
|
|
1622
|
+
isDirectory = fs.statSync(filePath).isDirectory();
|
|
1623
|
+
}
|
|
1624
|
+
catch {
|
|
1625
|
+
isDirectory = false;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
if (isDirectory) {
|
|
1629
|
+
if (!shouldPruneDiscoveryDir(rootDir, filePath, entry.name)) {
|
|
1630
|
+
files.push(...listFilesRecursive(filePath, predicate, rootDir, visitedDirectories, inspectedDirectories));
|
|
1631
|
+
}
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1634
|
+
if (!entry.isFile() && !entry.isSymbolicLink())
|
|
1635
|
+
continue;
|
|
1636
|
+
if (!predicate(entry.name))
|
|
1637
|
+
continue;
|
|
1638
|
+
files.push(filePath);
|
|
1639
|
+
}
|
|
1640
|
+
return files;
|
|
1641
|
+
}
|
|
1642
|
+
const agentDefinitionInspectionDirectories = new WeakMap();
|
|
1643
|
+
function rememberAgentDefinitionInspection(inspection, directories) {
|
|
1644
|
+
agentDefinitionInspectionDirectories.set(inspection, [...new Set([...directories].map((directory) => path.resolve(directory)))]);
|
|
1645
|
+
return inspection;
|
|
1646
|
+
}
|
|
1647
|
+
function inspectedAgentDefinitionDirectories(inspection, root) {
|
|
1648
|
+
return agentDefinitionInspectionDirectories.get(inspection) ?? [path.resolve(root)];
|
|
1649
|
+
}
|
|
1650
|
+
const DEFAULT_AGENT_DEFINITION_INSPECTION_FS = {
|
|
1651
|
+
existsSync: fs.existsSync,
|
|
1652
|
+
realpathSync: fs.realpathSync,
|
|
1653
|
+
statSync: fs.statSync,
|
|
1654
|
+
readdirSync: (dir) => fs.readdirSync(dir, { withFileTypes: true }),
|
|
1655
|
+
};
|
|
1656
|
+
/**
|
|
1657
|
+
* Inspect one agent-definition directory while retaining traversal failure
|
|
1658
|
+
* state. A nested unreadable directory makes the whole inspection unavailable,
|
|
1659
|
+
* preventing a partial traversal from being reported as empty or complete.
|
|
1660
|
+
*/
|
|
1661
|
+
export function inspectAgentDefinitionDirectory(dir, operations = DEFAULT_AGENT_DEFINITION_INSPECTION_FS, isExcluded = () => false) {
|
|
1662
|
+
const root = path.resolve(dir);
|
|
1663
|
+
if (isExcluded(root))
|
|
1664
|
+
return rememberAgentDefinitionInspection({ files: [], state: "empty" }, []);
|
|
1665
|
+
try {
|
|
1666
|
+
if (!operations.existsSync(root))
|
|
1667
|
+
return rememberAgentDefinitionInspection({ files: [], state: "absent" }, [root]);
|
|
1668
|
+
if (!operations.statSync(root).isDirectory())
|
|
1669
|
+
return rememberAgentDefinitionInspection({ files: [], state: "not-directory" }, [root]);
|
|
1670
|
+
}
|
|
1671
|
+
catch {
|
|
1672
|
+
return rememberAgentDefinitionInspection({ files: [], state: "unreadable" }, [root]);
|
|
1673
|
+
}
|
|
1674
|
+
const files = [];
|
|
1675
|
+
let unreadable = false;
|
|
1676
|
+
const visitedDirectories = new Set();
|
|
1677
|
+
const inspectedDirectories = new Set();
|
|
1678
|
+
const visit = (current) => {
|
|
1679
|
+
inspectedDirectories.add(path.resolve(current));
|
|
1680
|
+
let realDir;
|
|
1681
|
+
try {
|
|
1682
|
+
realDir = operations.realpathSync?.(current) ?? path.resolve(current);
|
|
1683
|
+
}
|
|
1684
|
+
catch {
|
|
1685
|
+
unreadable = true;
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
if (visitedDirectories.has(realDir))
|
|
1689
|
+
return;
|
|
1690
|
+
visitedDirectories.add(realDir);
|
|
1691
|
+
let entries;
|
|
1692
|
+
try {
|
|
1693
|
+
entries = operations.readdirSync(current).sort((a, b) => a.name.localeCompare(b.name));
|
|
1694
|
+
}
|
|
1695
|
+
catch {
|
|
1696
|
+
unreadable = true;
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
for (const entry of entries) {
|
|
1700
|
+
const filePath = path.join(current, entry.name);
|
|
1701
|
+
if (isExcluded(filePath))
|
|
1702
|
+
continue;
|
|
1703
|
+
let isDirectory = entry.isDirectory();
|
|
1704
|
+
if (entry.isSymbolicLink()) {
|
|
1705
|
+
try {
|
|
1706
|
+
isDirectory = operations.statSync(filePath).isDirectory();
|
|
1707
|
+
}
|
|
1708
|
+
catch {
|
|
1709
|
+
isDirectory = false;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
if (isDirectory) {
|
|
1713
|
+
if (!shouldPruneDiscoveryDir(root, filePath, entry.name))
|
|
1714
|
+
visit(filePath);
|
|
1715
|
+
continue;
|
|
1716
|
+
}
|
|
1717
|
+
if ((entry.isFile() || entry.isSymbolicLink()) && entry.name.endsWith(".md") && !entry.name.endsWith(".chain.md") && !isLegacyAgentSkillPath(root, filePath))
|
|
1718
|
+
files.push(filePath);
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
visit(root);
|
|
1722
|
+
return rememberAgentDefinitionInspection({ files, state: unreadable ? "unreadable" : files.length ? "candidates" : "empty" }, inspectedDirectories);
|
|
1723
|
+
}
|
|
1724
|
+
function isLegacyAgentSkillPath(rootDir, filePath) {
|
|
1725
|
+
const relative = path.relative(rootDir, filePath);
|
|
1726
|
+
const parts = relative.split(path.sep).map((part) => part.toLowerCase());
|
|
1727
|
+
if (path.basename(rootDir).toLowerCase() === ".agents") {
|
|
1728
|
+
parts.unshift(".agents");
|
|
1729
|
+
}
|
|
1730
|
+
return parts.some((part, index) => part === ".agents" && parts[index + 1] === "skills");
|
|
1731
|
+
}
|
|
1732
|
+
function isJsonSerializable(value) {
|
|
1733
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
1734
|
+
return true;
|
|
1735
|
+
if (typeof value === "number")
|
|
1736
|
+
return Number.isFinite(value);
|
|
1737
|
+
if (Array.isArray(value))
|
|
1738
|
+
return value.every(isJsonSerializable);
|
|
1739
|
+
if (value && typeof value === "object")
|
|
1740
|
+
return Object.values(value).every(isJsonSerializable);
|
|
1741
|
+
return false;
|
|
1742
|
+
}
|
|
1743
|
+
function parseAgentRunnerFrontmatter(raw, agentName) {
|
|
1744
|
+
if (raw === undefined || !raw.trim())
|
|
1745
|
+
return undefined;
|
|
1746
|
+
let parsed;
|
|
1747
|
+
try {
|
|
1748
|
+
parsed = parseYaml(raw);
|
|
1749
|
+
}
|
|
1750
|
+
catch (error) {
|
|
1751
|
+
throw new Error(`Agent '${agentName}' has invalid runner frontmatter: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1752
|
+
}
|
|
1753
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1754
|
+
throw new Error(`Agent '${agentName}' has invalid runner frontmatter; expected an object.`);
|
|
1755
|
+
}
|
|
1756
|
+
const runner = parsed;
|
|
1757
|
+
if (runner.type === "pi") {
|
|
1758
|
+
if (Object.keys(runner).some((key) => key !== "type"))
|
|
1759
|
+
throw new Error(`Agent '${agentName}' has invalid Pi runner frontmatter; only 'type' is supported.`);
|
|
1760
|
+
return { type: "pi" };
|
|
1761
|
+
}
|
|
1762
|
+
if (runner.type === "external-job") {
|
|
1763
|
+
if (typeof runner.provider !== "string" || !runner.provider.trim() || runner.provider.trim() !== runner.provider) {
|
|
1764
|
+
throw new Error(`Agent '${agentName}' external-job runner requires a non-empty trimmed provider string.`);
|
|
1765
|
+
}
|
|
1766
|
+
if (runner.options !== undefined && (!runner.options || typeof runner.options !== "object" || Array.isArray(runner.options) || !isJsonSerializable(runner.options))) {
|
|
1767
|
+
throw new Error(`Agent '${agentName}' external-job runner options must be a JSON-serializable object.`);
|
|
1768
|
+
}
|
|
1769
|
+
const supported = new Set(["type", "provider", "options"]);
|
|
1770
|
+
const unknown = Object.keys(runner).filter((key) => !supported.has(key));
|
|
1771
|
+
if (unknown.length > 0)
|
|
1772
|
+
throw new Error(`Agent '${agentName}' external-job runner has unsupported fields: ${unknown.join(", ")}.`);
|
|
1773
|
+
return {
|
|
1774
|
+
type: "external-job",
|
|
1775
|
+
provider: runner.provider,
|
|
1776
|
+
...(runner.options ? { options: runner.options } : {}),
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
if (runner.type !== "external-cli") {
|
|
1780
|
+
throw new Error(`Agent '${agentName}' has invalid runner.type; expected 'pi', 'external-cli', or 'external-job'.`);
|
|
1781
|
+
}
|
|
1782
|
+
if (typeof runner.command !== "string" || !runner.command.trim()) {
|
|
1783
|
+
throw new Error(`Agent '${agentName}' external-cli runner requires a non-empty command string.`);
|
|
1784
|
+
}
|
|
1785
|
+
if (runner.args !== undefined && (!Array.isArray(runner.args) || runner.args.some((arg) => typeof arg !== "string"))) {
|
|
1786
|
+
throw new Error(`Agent '${agentName}' external-cli runner args must be an array of strings.`);
|
|
1787
|
+
}
|
|
1788
|
+
if (runner.adapter !== undefined && !isCodeOwnedExternalCliAdapterId(runner.adapter))
|
|
1789
|
+
throw new Error(`Agent '${agentName}' external-cli runner adapter must be ${CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL}.`);
|
|
1790
|
+
if (runner.adapter !== undefined && Array.isArray(runner.args) && runner.args.length > 0)
|
|
1791
|
+
throw new Error(`Agent '${agentName}' ${runner.adapter} adapter owns its argv; runner args are not supported.`);
|
|
1792
|
+
if (runner.promptDelivery !== undefined && runner.promptDelivery !== "stdin") {
|
|
1793
|
+
throw new Error(`Agent '${agentName}' external-cli runner promptDelivery must be 'stdin'.`);
|
|
1794
|
+
}
|
|
1795
|
+
const capabilities = parseExternalCliCapabilityNarrowing(runner.capabilities, `Agent '${agentName}' external-cli runner capabilities`);
|
|
1796
|
+
const supported = new Set(["type", "adapter", "command", "args", "promptDelivery", "capabilities"]);
|
|
1797
|
+
const unknown = Object.keys(runner).filter((key) => !supported.has(key));
|
|
1798
|
+
if (unknown.length > 0)
|
|
1799
|
+
throw new Error(`Agent '${agentName}' external-cli runner has unsupported fields: ${unknown.join(", ")}.`);
|
|
1800
|
+
const runnerArgs = Array.isArray(runner.args) ? runner.args.filter((arg) => typeof arg === "string") : undefined;
|
|
1801
|
+
return {
|
|
1802
|
+
type: "external-cli",
|
|
1803
|
+
...(isCodeOwnedExternalCliAdapterId(runner.adapter) ? { adapter: runner.adapter } : {}),
|
|
1804
|
+
command: runner.command.trim(),
|
|
1805
|
+
...(runnerArgs?.length ? { args: runnerArgs } : {}),
|
|
1806
|
+
...(runner.promptDelivery ? { promptDelivery: "stdin" } : {}),
|
|
1807
|
+
...(capabilities ? { capabilities } : {}),
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
function validateExternalRunnerProfile(frontmatter, agentName, runner) {
|
|
1811
|
+
if (runner?.type !== "external-cli" && runner?.type !== "external-job")
|
|
1812
|
+
return;
|
|
1813
|
+
// The code-owned Claude Code adapters accept an explicit model and thinking level:
|
|
1814
|
+
// both are translated into their own argv rather than into a Pi child model.
|
|
1815
|
+
const adapterAcceptsOverrides = runner.type === "external-cli" && isClaudeCodeAdapterId(runner.adapter);
|
|
1816
|
+
const unsupported = ["tools", "excludeTools", "allowNestedSubagents", "allowedAgents", "model", "thinking", "extensions", "subagentOnlyExtensions", "mutationTools", "maxSubagentDepth", "skills", "skill", "skillPath", "toolBudget", "permission", "permissions"]
|
|
1817
|
+
.filter((field) => frontmatter[field] !== undefined && !(adapterAcceptsOverrides && (field === "model" || field === "thinking")));
|
|
1818
|
+
if (unsupported.length > 0) {
|
|
1819
|
+
throw new Error(`Agent '${agentName}' uses runner.type='${runner.type}' and declares unsupported Pi-only fields: ${unsupported.join(", ")}.`);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
function parseAgentAcceptanceFrontmatter(raw, agentName) {
|
|
1823
|
+
if (raw === undefined || !raw.trim())
|
|
1824
|
+
return undefined;
|
|
1825
|
+
let parsed;
|
|
1826
|
+
try {
|
|
1827
|
+
parsed = parseYaml(raw);
|
|
1828
|
+
}
|
|
1829
|
+
catch (error) {
|
|
1830
|
+
throw new Error(`Agent '${agentName}' has invalid acceptance frontmatter: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1831
|
+
}
|
|
1832
|
+
const errors = validateAcceptanceInput(parsed, `Agent '${agentName}' acceptance frontmatter`);
|
|
1833
|
+
if (errors.length > 0)
|
|
1834
|
+
throw new Error(errors.join(" "));
|
|
1835
|
+
return parsed;
|
|
1836
|
+
}
|
|
1837
|
+
function readAgentDefinitionFiles(dir, inspection = inspectAgentDefinitionDirectory(dir)) {
|
|
1838
|
+
const files = [];
|
|
1839
|
+
for (const filePath of inspection.files) {
|
|
1840
|
+
if (isLegacyAgentSkillPath(dir, filePath)) {
|
|
1841
|
+
continue;
|
|
1842
|
+
}
|
|
1843
|
+
try {
|
|
1844
|
+
files.push({ filePath, content: fs.readFileSync(filePath, "utf-8") });
|
|
1845
|
+
}
|
|
1846
|
+
catch {
|
|
1847
|
+
continue;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
return files;
|
|
1851
|
+
}
|
|
1852
|
+
function resolveAgentRelativeExtensionPaths(paths, agentFilePath) {
|
|
1853
|
+
if (paths === undefined)
|
|
1854
|
+
return undefined;
|
|
1855
|
+
const baseDir = path.dirname(agentFilePath);
|
|
1856
|
+
return paths.map((entry) => {
|
|
1857
|
+
const trimmed = entry.trim();
|
|
1858
|
+
if (trimmed === "." || trimmed === ".." || trimmed.startsWith("./") || trimmed.startsWith("../")) {
|
|
1859
|
+
return path.resolve(baseDir, trimmed);
|
|
1860
|
+
}
|
|
1861
|
+
return entry;
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
function loadAgentsFromDefinitionFiles(files, source, discoveryPriority, packageSource) {
|
|
1865
|
+
const agents = [];
|
|
1866
|
+
const diagnostics = [];
|
|
1867
|
+
for (const { filePath, content } of files) {
|
|
1868
|
+
let name;
|
|
1869
|
+
let runtimeName;
|
|
1870
|
+
let packageSpecified = false;
|
|
1871
|
+
try {
|
|
1872
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
1873
|
+
if (!frontmatter.name || !frontmatter.description) {
|
|
1874
|
+
continue;
|
|
1875
|
+
}
|
|
1876
|
+
const localName = frontmatter.name;
|
|
1877
|
+
name = localName;
|
|
1878
|
+
const parsedPackage = parsePackageName(frontmatter.package, `Agent '${localName}' package`);
|
|
1879
|
+
packageSpecified = parsedPackage.packageName !== undefined || parsedPackage.error !== undefined;
|
|
1880
|
+
if (parsedPackage.error)
|
|
1881
|
+
throw new Error(parsedPackage.error);
|
|
1882
|
+
const packageName = parsedPackage.packageName;
|
|
1883
|
+
runtimeName = buildRuntimeName(localName, packageName);
|
|
1884
|
+
const runner = parseAgentRunnerFrontmatter(frontmatter.runner, localName);
|
|
1885
|
+
validateExternalRunnerProfile(frontmatter, localName, runner);
|
|
1886
|
+
let advertise;
|
|
1887
|
+
if (frontmatter.advertise !== undefined) {
|
|
1888
|
+
if (frontmatter.advertise === "true")
|
|
1889
|
+
advertise = true;
|
|
1890
|
+
else if (frontmatter.advertise === "false")
|
|
1891
|
+
advertise = false;
|
|
1892
|
+
else
|
|
1893
|
+
throw new Error(`Agent '${localName}' has invalid advertise frontmatter; expected true or false.`);
|
|
1894
|
+
}
|
|
1895
|
+
const rawTools = parseFrontmatterList(frontmatter.tools);
|
|
1896
|
+
const parsedTools = splitToolList(rawTools);
|
|
1897
|
+
const tools = parsedTools.tools ?? [];
|
|
1898
|
+
const mcpDirectTools = parsedTools.mcpDirectTools ?? [];
|
|
1899
|
+
const excludeTools = parseFrontmatterList(frontmatter.excludeTools);
|
|
1900
|
+
const parsedAllowedAgents = parseFrontmatterList(frontmatter.allowedAgents);
|
|
1901
|
+
const allowedAgents = parsedAllowedAgents === undefined ? undefined : normalizeCapabilityCeilingAllowedAgents(parsedAllowedAgents);
|
|
1902
|
+
const defaultReads = parseFrontmatterList(frontmatter.defaultReads);
|
|
1903
|
+
const aliases = normalizeAgentAliases(parseFrontmatterList(frontmatter.aliases ?? frontmatter.alias), runtimeName);
|
|
1904
|
+
const profileError = validateCodeOwnedProfileRunner({ name: runtimeName, localName, aliases, runner });
|
|
1905
|
+
if (profileError)
|
|
1906
|
+
throw new Error(profileError);
|
|
1907
|
+
const skillStr = frontmatter.skill || frontmatter.skills;
|
|
1908
|
+
const skills = parseFrontmatterList(skillStr);
|
|
1909
|
+
const skillPath = parseFrontmatterList(frontmatter.skillPath);
|
|
1910
|
+
if (frontmatter.fallbackModels !== undefined)
|
|
1911
|
+
throw new Error(`Agent '${filePath}' uses removed frontmatter field 'fallbackModels'. Configure one model instead.`);
|
|
1912
|
+
const systemPromptMode = frontmatter.systemPromptMode === "replace"
|
|
1913
|
+
? "replace"
|
|
1914
|
+
: frontmatter.systemPromptMode === "append"
|
|
1915
|
+
? "append"
|
|
1916
|
+
: defaultSystemPromptMode(localName);
|
|
1917
|
+
const inheritProjectContext = frontmatter.inheritProjectContext === "true"
|
|
1918
|
+
? true
|
|
1919
|
+
: frontmatter.inheritProjectContext === "false"
|
|
1920
|
+
? false
|
|
1921
|
+
: defaultInheritProjectContext(localName);
|
|
1922
|
+
const inheritGlobalContext = frontmatter.inheritGlobalContext === "true";
|
|
1923
|
+
const inheritSkills = frontmatter.inheritSkills === "true"
|
|
1924
|
+
? true
|
|
1925
|
+
: frontmatter.inheritSkills === "false"
|
|
1926
|
+
? false
|
|
1927
|
+
: defaultInheritSkills();
|
|
1928
|
+
const defaultContext = frontmatter.defaultContext === "fork"
|
|
1929
|
+
? "fork"
|
|
1930
|
+
: frontmatter.defaultContext === "fresh"
|
|
1931
|
+
? "fresh"
|
|
1932
|
+
: undefined;
|
|
1933
|
+
let defaultAsync;
|
|
1934
|
+
if (frontmatter.async !== undefined) {
|
|
1935
|
+
if (frontmatter.async === "true")
|
|
1936
|
+
defaultAsync = true;
|
|
1937
|
+
else if (frontmatter.async === "false")
|
|
1938
|
+
defaultAsync = false;
|
|
1939
|
+
else
|
|
1940
|
+
throw new Error(`Agent '${localName}' has invalid async frontmatter; expected true or false.`);
|
|
1941
|
+
}
|
|
1942
|
+
let defaultTimeoutMs;
|
|
1943
|
+
if (frontmatter.timeoutMs !== undefined) {
|
|
1944
|
+
const parsed = Number(frontmatter.timeoutMs);
|
|
1945
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1946
|
+
throw new Error(`Agent '${localName}' has invalid timeoutMs frontmatter; expected a positive integer.`);
|
|
1947
|
+
}
|
|
1948
|
+
defaultTimeoutMs = parsed;
|
|
1949
|
+
}
|
|
1950
|
+
let defaultToolTimeoutMs;
|
|
1951
|
+
if (frontmatter.toolTimeoutMs !== undefined) {
|
|
1952
|
+
const parsed = Number(frontmatter.toolTimeoutMs);
|
|
1953
|
+
if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 2_147_483_647) {
|
|
1954
|
+
throw new Error(`Agent '${localName}' has invalid toolTimeoutMs frontmatter; expected a positive integer no larger than 2147483647.`);
|
|
1955
|
+
}
|
|
1956
|
+
defaultToolTimeoutMs = parsed;
|
|
1957
|
+
}
|
|
1958
|
+
const defaultAcceptance = parseAgentAcceptanceFrontmatter(frontmatter.acceptance, localName);
|
|
1959
|
+
let outputMode;
|
|
1960
|
+
if (frontmatter.outputMode !== undefined) {
|
|
1961
|
+
if (frontmatter.outputMode === "inline" || frontmatter.outputMode === "file-only")
|
|
1962
|
+
outputMode = frontmatter.outputMode;
|
|
1963
|
+
else
|
|
1964
|
+
throw new Error(`Agent '${localName}' has invalid outputMode frontmatter; expected 'inline' or 'file-only'.`);
|
|
1965
|
+
}
|
|
1966
|
+
let acceptanceRole;
|
|
1967
|
+
if (frontmatter.acceptanceRole !== undefined && frontmatter.acceptanceRole.trim()) {
|
|
1968
|
+
if (frontmatter.acceptanceRole === "read-only" || frontmatter.acceptanceRole === "writer")
|
|
1969
|
+
acceptanceRole = frontmatter.acceptanceRole;
|
|
1970
|
+
else
|
|
1971
|
+
throw new Error(`Agent '${localName}' has invalid acceptanceRole frontmatter; expected 'read-only' or 'writer'.`);
|
|
1972
|
+
}
|
|
1973
|
+
const extensions = resolveAgentRelativeExtensionPaths(parseFrontmatterList(frontmatter.extensions), filePath);
|
|
1974
|
+
const subagentOnlyExtensions = resolveAgentRelativeExtensionPaths(parseFrontmatterList(frontmatter.subagentOnlyExtensions), filePath);
|
|
1975
|
+
const mutationTools = parseFrontmatterList(frontmatter.mutationTools);
|
|
1976
|
+
let fast;
|
|
1977
|
+
if (frontmatter.fast !== undefined) {
|
|
1978
|
+
if (frontmatter.fast === "true")
|
|
1979
|
+
fast = true;
|
|
1980
|
+
else if (frontmatter.fast === "false")
|
|
1981
|
+
fast = false;
|
|
1982
|
+
else
|
|
1983
|
+
throw new Error(`Agent '${localName}' has invalid fast frontmatter; expected true or false.`);
|
|
1984
|
+
}
|
|
1985
|
+
let allowNestedSubagents;
|
|
1986
|
+
if (frontmatter.allowNestedSubagents !== undefined) {
|
|
1987
|
+
if (frontmatter.allowNestedSubagents === "true")
|
|
1988
|
+
allowNestedSubagents = true;
|
|
1989
|
+
else if (frontmatter.allowNestedSubagents === "false")
|
|
1990
|
+
allowNestedSubagents = false;
|
|
1991
|
+
else
|
|
1992
|
+
throw new Error(`Agent '${localName}' has invalid allowNestedSubagents frontmatter; expected true or false.`);
|
|
1993
|
+
}
|
|
1994
|
+
const extraFields = {};
|
|
1995
|
+
for (const [key, value] of Object.entries(frontmatter)) {
|
|
1996
|
+
if (!KNOWN_FIELDS.has(key))
|
|
1997
|
+
extraFields[key] = value;
|
|
1998
|
+
}
|
|
1999
|
+
const parsedMaxSubagentDepth = Number(frontmatter.maxSubagentDepth);
|
|
2000
|
+
if (frontmatter.permission !== undefined && frontmatter.permissions !== undefined) {
|
|
2001
|
+
throw new Error(`Agent '${localName}' cannot declare both permission and permissions frontmatter.`);
|
|
2002
|
+
}
|
|
2003
|
+
const permissionSource = frontmatter.permissions ?? frontmatter.permission;
|
|
2004
|
+
const permissions = permissionSource?.trim()
|
|
2005
|
+
? validatePermissionRules(parseYaml(permissionSource), `Agent '${localName}' permissions`)
|
|
2006
|
+
: undefined;
|
|
2007
|
+
let toolBudget;
|
|
2008
|
+
if (frontmatter.toolBudget !== undefined && frontmatter.toolBudget.trim()) {
|
|
2009
|
+
const parsed = JSON.parse(frontmatter.toolBudget);
|
|
2010
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
2011
|
+
throw new Error(`Agent '${localName}' has invalid toolBudget frontmatter; expected a JSON object.`);
|
|
2012
|
+
}
|
|
2013
|
+
toolBudget = parsed;
|
|
2014
|
+
}
|
|
2015
|
+
let outputSchema;
|
|
2016
|
+
if (frontmatter.outputSchema !== undefined && frontmatter.outputSchema.trim()) {
|
|
2017
|
+
const parsed = JSON.parse(frontmatter.outputSchema);
|
|
2018
|
+
assertJsonSchemaObject(parsed, `Agent '${localName}' outputSchema`);
|
|
2019
|
+
outputSchema = parsed;
|
|
2020
|
+
}
|
|
2021
|
+
const maxSubagentDepth = Number.isInteger(parsedMaxSubagentDepth) && parsedMaxSubagentDepth >= 0
|
|
2022
|
+
? parsedMaxSubagentDepth
|
|
2023
|
+
: undefined;
|
|
2024
|
+
const memory = parseMemoryFrontmatter(frontmatter.memory);
|
|
2025
|
+
const machine = validateOptionalMachine(frontmatter.machine, `Agent '${runtimeName}' frontmatter 'machine'`);
|
|
2026
|
+
const agent = {
|
|
2027
|
+
name: runtimeName,
|
|
2028
|
+
...(runner !== undefined ? { runner } : {}),
|
|
2029
|
+
localName,
|
|
2030
|
+
...(packageName !== undefined ? { packageName } : {}),
|
|
2031
|
+
...(packageSource?.packageName ? { packageSourceName: packageSource.packageName } : {}),
|
|
2032
|
+
...(packageSource?.packageVersion ? { packageSourceVersion: packageSource.packageVersion } : {}),
|
|
2033
|
+
...(packageSource?.packageRoot ? { packageSourceRoot: packageSource.packageRoot } : {}),
|
|
2034
|
+
description: frontmatter.description,
|
|
2035
|
+
...(advertise !== undefined ? { advertise } : {}),
|
|
2036
|
+
...(aliases !== undefined ? { aliases } : {}),
|
|
2037
|
+
...(rawTools !== undefined ? { tools } : {}),
|
|
2038
|
+
...(excludeTools !== undefined ? { excludeTools } : {}),
|
|
2039
|
+
...(allowNestedSubagents !== undefined ? { allowNestedSubagents } : {}),
|
|
2040
|
+
...(allowedAgents !== undefined ? { allowedAgents } : {}),
|
|
2041
|
+
...(mcpDirectTools.length > 0 ? { mcpDirectTools } : {}),
|
|
2042
|
+
...(frontmatter.model !== undefined ? { model: frontmatter.model } : {}),
|
|
2043
|
+
...(fast !== undefined ? { fast } : {}),
|
|
2044
|
+
...(frontmatter.thinking !== undefined ? { thinking: frontmatter.thinking === "false" ? false : frontmatter.thinking } : {}),
|
|
2045
|
+
systemPromptMode,
|
|
2046
|
+
inheritProjectContext,
|
|
2047
|
+
inheritGlobalContext,
|
|
2048
|
+
inheritSkills,
|
|
2049
|
+
...(defaultContext !== undefined ? { defaultContext } : {}),
|
|
2050
|
+
...(defaultAsync !== undefined ? { defaultAsync } : {}),
|
|
2051
|
+
...(defaultTimeoutMs !== undefined ? { defaultTimeoutMs } : {}),
|
|
2052
|
+
...(defaultToolTimeoutMs !== undefined ? { defaultToolTimeoutMs } : {}),
|
|
2053
|
+
...(defaultAcceptance !== undefined ? { defaultAcceptance } : {}),
|
|
2054
|
+
...(acceptanceRole !== undefined ? { acceptanceRole } : {}),
|
|
2055
|
+
systemPrompt: body,
|
|
2056
|
+
source,
|
|
2057
|
+
filePath,
|
|
2058
|
+
...(discoveryPriority !== undefined ? { discoveryPriority } : {}),
|
|
2059
|
+
...(skills?.length ? { skills } : {}),
|
|
2060
|
+
...(skillPath?.length ? { skillPath } : {}),
|
|
2061
|
+
...(extensions !== undefined ? { extensions } : {}),
|
|
2062
|
+
...(subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions } : {}),
|
|
2063
|
+
...(mutationTools?.length ? { mutationTools } : {}),
|
|
2064
|
+
...(machine !== undefined ? { machine } : {}),
|
|
2065
|
+
...(frontmatter.output !== undefined ? { output: frontmatter.output } : {}),
|
|
2066
|
+
...(outputMode !== undefined ? { outputMode } : {}),
|
|
2067
|
+
...(outputSchema !== undefined ? { outputSchema } : {}),
|
|
2068
|
+
...(defaultReads?.length ? { defaultReads } : {}),
|
|
2069
|
+
defaultProgress: frontmatter.defaultProgress === "true",
|
|
2070
|
+
interactive: frontmatter.interactive === "true",
|
|
2071
|
+
...(maxSubagentDepth !== undefined ? { maxSubagentDepth } : {}),
|
|
2072
|
+
...(toolBudget !== undefined ? { toolBudget } : {}),
|
|
2073
|
+
...(permissions !== undefined ? { permissions } : {}),
|
|
2074
|
+
...(memory !== undefined ? { memory } : {}),
|
|
2075
|
+
...(Object.keys(extraFields).length > 0 ? { extraFields } : {}),
|
|
2076
|
+
};
|
|
2077
|
+
agentFrontmatterFields.set(agent, new Set(Object.keys(frontmatter)));
|
|
2078
|
+
agents.push(agent);
|
|
2079
|
+
}
|
|
2080
|
+
catch (error) {
|
|
2081
|
+
diagnostics.push({ source, filePath, ...(name ? { name } : {}), ...(runtimeName && runtimeName !== name ? { runtimeName } : {}), ...(packageSpecified ? { packageSpecified: true } : {}), ...(discoveryPriority !== undefined ? { discoveryPriority } : {}), error: error instanceof Error ? error.message : String(error) });
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
return { agents, diagnostics };
|
|
2085
|
+
}
|
|
2086
|
+
function loadAgentsFromDir(dir, source, discoveryPriority, packageSource, inspection = inspectAgentDefinitionDirectory(dir)) {
|
|
2087
|
+
return loadAgentsFromDefinitionFiles(readAgentDefinitionFiles(dir, inspection), source, discoveryPriority, packageSource);
|
|
2088
|
+
}
|
|
2089
|
+
function reportAgentDefinitionDirectory(source, dir, inspection) {
|
|
2090
|
+
return {
|
|
2091
|
+
source,
|
|
2092
|
+
path: path.resolve(dir),
|
|
2093
|
+
state: inspection.state,
|
|
2094
|
+
...(inspection.state === "candidates" ? { candidateCount: inspection.files.length } : {}),
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
function loadChainsFromDir(dir, source) {
|
|
2098
|
+
const chains = new Map();
|
|
2099
|
+
const diagnostics = [];
|
|
2100
|
+
const directories = new Set();
|
|
2101
|
+
const files = listFilesRecursive(dir, (fileName) => fileName.endsWith(".chain.md") || fileName.endsWith(".chain.json"), dir, new Set(), directories);
|
|
2102
|
+
for (const filePath of files) {
|
|
2103
|
+
let content;
|
|
2104
|
+
try {
|
|
2105
|
+
content = fs.readFileSync(filePath, "utf-8");
|
|
2106
|
+
}
|
|
2107
|
+
catch {
|
|
2108
|
+
continue;
|
|
2109
|
+
}
|
|
2110
|
+
try {
|
|
2111
|
+
const chain = filePath.endsWith(".chain.json") ? parseJsonChain(content, source, filePath) : parseChain(content, source, filePath);
|
|
2112
|
+
const existing = chains.get(chain.name);
|
|
2113
|
+
if (existing && existing.filePath.endsWith(".chain.json") && filePath.endsWith(".chain.md"))
|
|
2114
|
+
continue;
|
|
2115
|
+
chains.set(chain.name, chain);
|
|
2116
|
+
}
|
|
2117
|
+
catch (error) {
|
|
2118
|
+
diagnostics.push({ source, filePath, error: error instanceof Error ? error.message : String(error) });
|
|
2119
|
+
continue;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
return { chains: Array.from(chains.values()), diagnostics, files, directories: [...directories] };
|
|
2123
|
+
}
|
|
2124
|
+
function isDirectory(p) {
|
|
2125
|
+
try {
|
|
2126
|
+
return fs.statSync(p).isDirectory();
|
|
2127
|
+
}
|
|
2128
|
+
catch {
|
|
2129
|
+
return false;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
function resolveNearestProjectAgentDirs(cwd) {
|
|
2133
|
+
const projectRoot = findConfiguredProjectRoot(cwd);
|
|
2134
|
+
if (!projectRoot)
|
|
2135
|
+
return { readDirs: [], candidateDirs: [], preferredDir: null };
|
|
2136
|
+
const legacyDir = path.join(projectRoot, ".agents");
|
|
2137
|
+
const preferredDir = path.join(getProjectConfigDir(projectRoot), "agents");
|
|
2138
|
+
const candidateDirs = [legacyDir, preferredDir];
|
|
2139
|
+
const readDirs = [];
|
|
2140
|
+
if (isDirectory(legacyDir))
|
|
2141
|
+
readDirs.push(legacyDir);
|
|
2142
|
+
if (isDirectory(preferredDir))
|
|
2143
|
+
readDirs.push(preferredDir);
|
|
2144
|
+
return { readDirs, candidateDirs, preferredDir };
|
|
2145
|
+
}
|
|
2146
|
+
function resolveNearestProjectChainDirs(cwd) {
|
|
2147
|
+
const projectRoot = findConfiguredProjectRoot(cwd);
|
|
2148
|
+
if (!projectRoot)
|
|
2149
|
+
return { readDirs: [], preferredDir: null };
|
|
2150
|
+
const preferredDir = path.join(getProjectConfigDir(projectRoot), "chains");
|
|
2151
|
+
return {
|
|
2152
|
+
readDirs: isDirectory(preferredDir) ? [preferredDir] : [],
|
|
2153
|
+
preferredDir,
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
const BUILTIN_AGENTS_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "agents");
|
|
2157
|
+
// Candidate files and inspection state must describe the same cached builtin scan.
|
|
2158
|
+
const BUILTIN_AGENT_DEFINITION_INSPECTION = inspectAgentDefinitionDirectory(BUILTIN_AGENTS_DIR);
|
|
2159
|
+
const BUILTIN_AGENT_DEFINITION_FILES = readAgentDefinitionFiles(BUILTIN_AGENTS_DIR, BUILTIN_AGENT_DEFINITION_INSPECTION);
|
|
2160
|
+
export const EXTRA_AGENT_DIRS_ENV = "PI_SUBAGENT_EXTRA_AGENT_DIRS";
|
|
2161
|
+
// Additional read-only directories to scan for agent definitions, supplied by the
|
|
2162
|
+
// launcher via PI_SUBAGENT_EXTRA_AGENT_DIRS (PATH-style, split on os/path delimiter).
|
|
2163
|
+
// Lets a hermetic wrapper (e.g. a Nix-store install) expose bundled agents without
|
|
2164
|
+
// copying or symlinking them into the writable agent dir. Loaded as "user" source,
|
|
2165
|
+
// at lower precedence than agents the user placed in their own agent dir.
|
|
2166
|
+
function extraUserAgentDirs() {
|
|
2167
|
+
const raw = process.env[EXTRA_AGENT_DIRS_ENV];
|
|
2168
|
+
if (!raw)
|
|
2169
|
+
return [];
|
|
2170
|
+
return raw
|
|
2171
|
+
.split(path.delimiter)
|
|
2172
|
+
.map((dir) => dir.trim())
|
|
2173
|
+
.filter((dir) => dir.length > 0);
|
|
2174
|
+
}
|
|
2175
|
+
function readConfiguredAgentScanDirs(filePath, key = "agentScanDirs") {
|
|
2176
|
+
if (!filePath)
|
|
2177
|
+
return [];
|
|
2178
|
+
try {
|
|
2179
|
+
const settings = readSettingsFileStrict(filePath);
|
|
2180
|
+
const subagents = settings.subagents;
|
|
2181
|
+
if (!subagents || typeof subagents !== "object" || Array.isArray(subagents))
|
|
2182
|
+
return [];
|
|
2183
|
+
const dirs = subagents[key];
|
|
2184
|
+
return Array.isArray(dirs) ? dirs.filter((dir) => typeof dir === "string" && dir.trim().length > 0) : [];
|
|
2185
|
+
}
|
|
2186
|
+
catch {
|
|
2187
|
+
return [];
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
// Resolve existing ancestors to canonicalize missing descendants of symlinks.
|
|
2191
|
+
function canonicalAgentPath(filePath) {
|
|
2192
|
+
const resolved = path.resolve(filePath);
|
|
2193
|
+
try {
|
|
2194
|
+
return fs.realpathSync(resolved);
|
|
2195
|
+
}
|
|
2196
|
+
catch {
|
|
2197
|
+
const parent = path.dirname(resolved);
|
|
2198
|
+
return parent === resolved ? resolved : path.join(canonicalAgentPath(parent), path.basename(resolved));
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
function agentExclusionRoots(userSettingsPath, projectSettingsPath) {
|
|
2202
|
+
return [userSettingsPath, projectSettingsPath].flatMap((settingsPath) => settingsPath
|
|
2203
|
+
? readConfiguredAgentScanDirs(settingsPath, "agentExcludeDirs").map((entry) => {
|
|
2204
|
+
const resolved = path.resolve(path.dirname(settingsPath), expandHomePath(entry.trim()).replace(/[\\/]+/g, path.sep));
|
|
2205
|
+
return { resolved, real: canonicalAgentPath(resolved) };
|
|
2206
|
+
}) : []);
|
|
2207
|
+
}
|
|
2208
|
+
function agentExclusions(roots) {
|
|
2209
|
+
return (filePath) => {
|
|
2210
|
+
if (!roots.length)
|
|
2211
|
+
return false;
|
|
2212
|
+
if (roots.some((root) => isPathWithin(root.resolved, filePath)))
|
|
2213
|
+
return true;
|
|
2214
|
+
const real = canonicalAgentPath(filePath);
|
|
2215
|
+
return roots.some((root) => isPathWithin(root.real, real));
|
|
2216
|
+
};
|
|
2217
|
+
}
|
|
2218
|
+
function expandAgentScanDirPattern(pattern, isExcluded) {
|
|
2219
|
+
const expanded = expandHomePath(pattern.trim()).replace(/[\\/]+/g, path.sep);
|
|
2220
|
+
if (!expanded)
|
|
2221
|
+
return { dirs: [], watchPaths: [] };
|
|
2222
|
+
const wildcardMatches = [...expanded.matchAll(/\*/g)];
|
|
2223
|
+
if (wildcardMatches.length === 0) {
|
|
2224
|
+
const dir = path.resolve(expanded);
|
|
2225
|
+
return { dirs: !isExcluded(dir) && fs.existsSync(dir) ? [dir] : [], watchPaths: [dir] };
|
|
2226
|
+
}
|
|
2227
|
+
const parts = expanded.split(path.sep);
|
|
2228
|
+
const wildcardIndex = parts.findIndex((part) => part.includes("*"));
|
|
2229
|
+
if (wildcardMatches.length !== 1 || wildcardIndex === -1 || parts[wildcardIndex] !== "*")
|
|
2230
|
+
return { dirs: [], watchPaths: [] };
|
|
2231
|
+
const base = path.resolve(parts.slice(0, wildcardIndex).join(path.sep) || path.sep);
|
|
2232
|
+
if (isExcluded(base))
|
|
2233
|
+
return { dirs: [], watchPaths: [base] };
|
|
2234
|
+
const rest = parts.slice(wildcardIndex + 1);
|
|
2235
|
+
let entries;
|
|
2236
|
+
try {
|
|
2237
|
+
entries = fs.readdirSync(base, { withFileTypes: true });
|
|
2238
|
+
}
|
|
2239
|
+
catch {
|
|
2240
|
+
return { dirs: [], watchPaths: [base] };
|
|
2241
|
+
}
|
|
2242
|
+
const candidateDirs = entries.filter((entry) => entry.isDirectory()).map((entry) => path.join(base, entry.name, ...rest));
|
|
2243
|
+
return {
|
|
2244
|
+
dirs: candidateDirs.filter((dir) => !isExcluded(dir) && fs.existsSync(dir)),
|
|
2245
|
+
watchPaths: [base, ...candidateDirs],
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
function settingsAgentScanDirs(entries, isExcluded) {
|
|
2249
|
+
const dirs = new Set();
|
|
2250
|
+
const watchPaths = new Set();
|
|
2251
|
+
for (const entry of entries) {
|
|
2252
|
+
const expanded = expandAgentScanDirPattern(entry, isExcluded);
|
|
2253
|
+
for (const dir of expanded.dirs)
|
|
2254
|
+
dirs.add(dir);
|
|
2255
|
+
for (const watchPath of expanded.watchPaths)
|
|
2256
|
+
watchPaths.add(watchPath);
|
|
2257
|
+
}
|
|
2258
|
+
return { dirs: [...dirs], watchPaths: [...watchPaths] };
|
|
2259
|
+
}
|
|
2260
|
+
const agentDiscoveryCache = new Map();
|
|
2261
|
+
function isPathWithin(root, candidate) {
|
|
2262
|
+
const relative = path.relative(path.resolve(root), path.resolve(candidate));
|
|
2263
|
+
return relative === "" || (relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative));
|
|
2264
|
+
}
|
|
2265
|
+
function addDirectoryWatchPaths(paths, root, files, directories = []) {
|
|
2266
|
+
const resolvedRoot = path.resolve(root);
|
|
2267
|
+
paths.add(resolvedRoot);
|
|
2268
|
+
// The initial recursive inspection is already bounded to this discovery
|
|
2269
|
+
// root. Keep every visited directory in the fingerprint so a file added to
|
|
2270
|
+
// an existing empty nested directory invalidates the snapshot too.
|
|
2271
|
+
for (const directory of directories) {
|
|
2272
|
+
if (isPathWithin(resolvedRoot, directory))
|
|
2273
|
+
paths.add(path.resolve(directory));
|
|
2274
|
+
}
|
|
2275
|
+
for (const file of files) {
|
|
2276
|
+
paths.add(path.resolve(file));
|
|
2277
|
+
let current = path.resolve(path.dirname(file));
|
|
2278
|
+
while (isPathWithin(resolvedRoot, current)) {
|
|
2279
|
+
paths.add(current);
|
|
2280
|
+
if (current === resolvedRoot)
|
|
2281
|
+
break;
|
|
2282
|
+
current = path.dirname(current);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
function watchPathSignature(filePath, isExcluded) {
|
|
2287
|
+
try {
|
|
2288
|
+
const stat = fs.statSync(filePath);
|
|
2289
|
+
if (stat.isDirectory()) {
|
|
2290
|
+
const entries = fs.readdirSync(filePath, { withFileTypes: true })
|
|
2291
|
+
.filter((entry) => !isExcluded || !isExcluded(path.join(filePath, entry.name)))
|
|
2292
|
+
.sort((left, right) => left.name.localeCompare(right.name))
|
|
2293
|
+
.map((entry) => `${entry.name}:${entry.isDirectory() ? "d" : entry.isSymbolicLink() ? (isExcluded ? `l:${canonicalAgentPath(path.join(filePath, entry.name))}` : "l") : "f"}`)
|
|
2294
|
+
.join("|");
|
|
2295
|
+
return `directory:${entries}`;
|
|
2296
|
+
}
|
|
2297
|
+
return `file:${stat.size}:${stat.mtimeMs}`;
|
|
2298
|
+
}
|
|
2299
|
+
catch {
|
|
2300
|
+
return "missing";
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
function discoveryFingerprint(sources) {
|
|
2304
|
+
const exclusionIdentity = JSON.stringify(sources.exclusionRoots.map((root) => ({ resolved: root.resolved, real: canonicalAgentPath(root.resolved) })));
|
|
2305
|
+
// A retargeted exclusion needs a fresh scan before fingerprinting old roots.
|
|
2306
|
+
if (exclusionIdentity !== JSON.stringify(sources.exclusionRoots))
|
|
2307
|
+
return exclusionIdentity;
|
|
2308
|
+
const rootIdentities = JSON.stringify(sources.identityWatchPaths.map((root) => [root, canonicalAgentPath(root)]));
|
|
2309
|
+
// Package metadata can redirect agents outside an excluded tree without chains.
|
|
2310
|
+
const unfilteredPaths = new Set([...sources.packageSubagentPaths.watchPaths, ...(sources.chainWatchPaths ?? [])]);
|
|
2311
|
+
return exclusionIdentity + "\n" + rootIdentities + "\n" + [...new Set([...sources.watchPaths, ...unfilteredPaths])]
|
|
2312
|
+
.filter((filePath) => unfilteredPaths.has(filePath) || filePath === sources.userSettingsPath || filePath === sources.projectSettingsPath || !sources.isExcluded(filePath))
|
|
2313
|
+
.sort((left, right) => left.localeCompare(right))
|
|
2314
|
+
.map((filePath) => `${filePath}:${watchPathSignature(filePath, sources.exclusionRoots.length && !unfilteredPaths.has(filePath) ? sources.isExcluded : undefined)}`)
|
|
2315
|
+
.join("\n");
|
|
2316
|
+
}
|
|
2317
|
+
function discoveryCacheKey(cwd, preferredModelProvider, globalNpmRoot) {
|
|
2318
|
+
return JSON.stringify([
|
|
2319
|
+
path.resolve(cwd),
|
|
2320
|
+
preferredModelProvider ?? null,
|
|
2321
|
+
globalNpmRoot === undefined ? ["default"] : ["override", globalNpmRoot],
|
|
2322
|
+
getProjectConfigDir(path.resolve(cwd)),
|
|
2323
|
+
getAgentDir(),
|
|
2324
|
+
os.homedir(),
|
|
2325
|
+
process.env.HOME ?? "",
|
|
2326
|
+
process.env.USERPROFILE ?? "",
|
|
2327
|
+
process.env[EXTRA_AGENT_DIRS_ENV] ?? "",
|
|
2328
|
+
process.env.PI_OFFLINE ?? "",
|
|
2329
|
+
process.env.APPDATA ?? "",
|
|
2330
|
+
]);
|
|
2331
|
+
}
|
|
2332
|
+
function projectDiscoveryWatchPaths(cwd) {
|
|
2333
|
+
const paths = [];
|
|
2334
|
+
let current = path.resolve(cwd);
|
|
2335
|
+
while (true) {
|
|
2336
|
+
paths.push(getProjectConfigDir(current), path.join(current, ".agents"), path.join(current, ".git"));
|
|
2337
|
+
const parent = path.dirname(current);
|
|
2338
|
+
if (parent === current)
|
|
2339
|
+
break;
|
|
2340
|
+
current = parent;
|
|
2341
|
+
}
|
|
2342
|
+
return paths;
|
|
2343
|
+
}
|
|
2344
|
+
function packageEntryIncluded(scope, packageScopes) {
|
|
2345
|
+
if (scope === "both" || packageScopes.has("root"))
|
|
2346
|
+
return true;
|
|
2347
|
+
return packageScopes.has(scope);
|
|
2348
|
+
}
|
|
2349
|
+
function buildAgentDiscoverySources(cwd, preferredModelProvider, globalNpmRoot) {
|
|
2350
|
+
const effectiveCwd = path.resolve(cwd);
|
|
2351
|
+
const userDirOld = path.join(getAgentDir(), "agents");
|
|
2352
|
+
const userDirNew = path.join(os.homedir(), ".agents");
|
|
2353
|
+
const userChainDir = getUserChainDir();
|
|
2354
|
+
const { readDirs: projectAgentDirs, candidateDirs: projectCandidateDirs, preferredDir: projectAgentsDir } = resolveNearestProjectAgentDirs(effectiveCwd);
|
|
2355
|
+
const { readDirs: projectChainDirs, preferredDir: projectChainDir } = resolveNearestProjectChainDirs(effectiveCwd);
|
|
2356
|
+
const userSettingsPath = getUserAgentSettingsPath();
|
|
2357
|
+
const projectSettingsPath = getProjectAgentSettingsPath(effectiveCwd);
|
|
2358
|
+
const packageSubagentPaths = collectPackageSubagentPaths(effectiveCwd, { includeUser: true, includeProject: true, globalNpmRoot });
|
|
2359
|
+
const exclusionRoots = agentExclusionRoots(userSettingsPath, projectSettingsPath);
|
|
2360
|
+
const isExcluded = agentExclusions(exclusionRoots);
|
|
2361
|
+
const userScanDirs = settingsAgentScanDirs(readConfiguredAgentScanDirs(userSettingsPath), isExcluded);
|
|
2362
|
+
const projectScanDirs = settingsAgentScanDirs(readConfiguredAgentScanDirs(projectSettingsPath), isExcluded);
|
|
2363
|
+
const builtinLoaded = loadAgentsFromDefinitionFiles(BUILTIN_AGENT_DEFINITION_FILES, "builtin");
|
|
2364
|
+
const userLoaded = [...extraUserAgentDirs(), ...userScanDirs.dirs, userDirOld, userDirNew].filter((dir) => !isExcluded(dir)).map((dir, discoveryPriority) => {
|
|
2365
|
+
const inspection = inspectAgentDefinitionDirectory(dir, undefined, isExcluded);
|
|
2366
|
+
return { dir, inspection, loaded: loadAgentsFromDir(dir, "user", discoveryPriority, undefined, inspection) };
|
|
2367
|
+
});
|
|
2368
|
+
const projectInspections = new Map(projectCandidateDirs.filter((dir) => !isExcluded(dir)).map((dir) => [dir, inspectAgentDefinitionDirectory(dir, undefined, isExcluded)]));
|
|
2369
|
+
const projectLoaded = [...projectScanDirs.dirs, ...projectAgentDirs].filter((dir) => !isExcluded(dir)).map((dir, discoveryPriority) => {
|
|
2370
|
+
const inspection = projectInspections.get(dir) ?? inspectAgentDefinitionDirectory(dir, undefined, isExcluded);
|
|
2371
|
+
return { dir, inspection, loaded: loadAgentsFromDir(dir, "project", dir === projectAgentsDir ? 1 : discoveryPriority, undefined, inspection) };
|
|
2372
|
+
});
|
|
2373
|
+
const packageLoaded = packageSubagentPaths.agents.filter((entry) => !isExcluded(entry.dir)).map((entry, index) => {
|
|
2374
|
+
const inspection = inspectAgentDefinitionDirectory(entry.dir, undefined, isExcluded);
|
|
2375
|
+
return { dir: entry.dir, inspection, packageEntry: entry, loaded: loadAgentsFromDir(entry.dir, "package", packageSubagentPaths.agents.length - index, entry, inspection) };
|
|
2376
|
+
});
|
|
2377
|
+
const watchPaths = new Set([
|
|
2378
|
+
userSettingsPath,
|
|
2379
|
+
...(projectSettingsPath ? [projectSettingsPath] : []),
|
|
2380
|
+
...projectDiscoveryWatchPaths(effectiveCwd),
|
|
2381
|
+
...findProjectRootCandidates(effectiveCwd).map((root) => path.join(getProjectConfigDir(root), "settings.json")),
|
|
2382
|
+
...userScanDirs.watchPaths,
|
|
2383
|
+
...projectScanDirs.watchPaths,
|
|
2384
|
+
...packageSubagentPaths.watchPaths,
|
|
2385
|
+
]);
|
|
2386
|
+
for (const directory of userLoaded)
|
|
2387
|
+
addDirectoryWatchPaths(watchPaths, directory.dir, directory.inspection.files, inspectedAgentDefinitionDirectories(directory.inspection, directory.dir));
|
|
2388
|
+
for (const dir of projectCandidateDirs) {
|
|
2389
|
+
const inspection = projectInspections.get(dir);
|
|
2390
|
+
addDirectoryWatchPaths(watchPaths, dir, inspection?.files ?? [], inspection ? inspectedAgentDefinitionDirectories(inspection, dir) : []);
|
|
2391
|
+
}
|
|
2392
|
+
for (const directory of projectLoaded)
|
|
2393
|
+
addDirectoryWatchPaths(watchPaths, directory.dir, directory.inspection.files, inspectedAgentDefinitionDirectories(directory.inspection, directory.dir));
|
|
2394
|
+
for (const directory of packageLoaded)
|
|
2395
|
+
addDirectoryWatchPaths(watchPaths, directory.dir, directory.inspection.files, inspectedAgentDefinitionDirectories(directory.inspection, directory.dir));
|
|
2396
|
+
const userDir = process.env.PI_CODING_AGENT_DIR ? userDirOld : fs.existsSync(userDirNew) ? userDirNew : userDirOld;
|
|
2397
|
+
return {
|
|
2398
|
+
cwd: effectiveCwd,
|
|
2399
|
+
...(preferredModelProvider !== undefined ? { preferredModelProvider } : {}),
|
|
2400
|
+
userDir,
|
|
2401
|
+
userDirOld,
|
|
2402
|
+
userDirNew,
|
|
2403
|
+
userChainDir,
|
|
2404
|
+
projectAgentDirs,
|
|
2405
|
+
projectCandidateDirs: projectCandidateDirs.filter((dir) => !isExcluded(dir)),
|
|
2406
|
+
projectAgentsDir,
|
|
2407
|
+
projectChainDirs,
|
|
2408
|
+
projectChainDir,
|
|
2409
|
+
userSettingsPath,
|
|
2410
|
+
projectSettingsPath,
|
|
2411
|
+
packageSubagentPaths,
|
|
2412
|
+
builtinLoaded,
|
|
2413
|
+
userLoaded,
|
|
2414
|
+
projectLoaded,
|
|
2415
|
+
projectInspections,
|
|
2416
|
+
packageLoaded,
|
|
2417
|
+
isExcluded,
|
|
2418
|
+
exclusionRoots,
|
|
2419
|
+
// Aliases outside excluded lexical subtrees can be retargeted into allowed
|
|
2420
|
+
// storage. Watch only their identity, never the excluded target's contents.
|
|
2421
|
+
identityWatchPaths: [...new Set([
|
|
2422
|
+
...userScanDirs.watchPaths, ...projectScanDirs.watchPaths,
|
|
2423
|
+
...extraUserAgentDirs(), userDirOld, userDirNew, ...projectCandidateDirs,
|
|
2424
|
+
...packageSubagentPaths.agents.map((entry) => entry.dir),
|
|
2425
|
+
])]
|
|
2426
|
+
.filter((dir) => !exclusionRoots.some((root) => isPathWithin(root.resolved, dir)) && isExcluded(dir)),
|
|
2427
|
+
watchPaths: [...watchPaths].filter((filePath) => !isExcluded(filePath) || filePath === userSettingsPath || filePath === projectSettingsPath),
|
|
2428
|
+
};
|
|
2429
|
+
}
|
|
2430
|
+
function ensureDiscoveryChains(sources) {
|
|
2431
|
+
if (sources.userChains)
|
|
2432
|
+
return;
|
|
2433
|
+
sources.packageChainLoaded = sources.packageSubagentPaths.chains.map((entry) => ({ entry, loaded: loadChainsFromDir(entry.dir, "package") }));
|
|
2434
|
+
sources.userChains = loadChainsFromDir(sources.userChainDir, "user");
|
|
2435
|
+
sources.projectChainLoaded = sources.projectChainDirs.map((dir) => ({ dir, loaded: loadChainsFromDir(dir, "project") }));
|
|
2436
|
+
const watchPaths = new Set(sources.packageSubagentPaths.watchPaths);
|
|
2437
|
+
addDirectoryWatchPaths(watchPaths, sources.userChainDir, sources.userChains.files, sources.userChains.directories);
|
|
2438
|
+
for (const chain of sources.projectChainLoaded)
|
|
2439
|
+
addDirectoryWatchPaths(watchPaths, chain.dir, chain.loaded.files, chain.loaded.directories);
|
|
2440
|
+
for (const chain of sources.packageChainLoaded)
|
|
2441
|
+
addDirectoryWatchPaths(watchPaths, chain.entry.dir, chain.loaded.files, chain.loaded.directories);
|
|
2442
|
+
sources.chainWatchPaths = watchPaths;
|
|
2443
|
+
sources.watchPaths = [...new Set([...sources.watchPaths, ...watchPaths])];
|
|
2444
|
+
}
|
|
2445
|
+
function getAgentDiscoverySources(cwd, preferredModelProvider, includeChains = false, globalNpmRoot) {
|
|
2446
|
+
const key = discoveryCacheKey(cwd, preferredModelProvider, globalNpmRoot);
|
|
2447
|
+
const cached = agentDiscoveryCache.get(key);
|
|
2448
|
+
if (cached && cached.fingerprint === discoveryFingerprint(cached.sources)) {
|
|
2449
|
+
if (includeChains) {
|
|
2450
|
+
ensureDiscoveryChains(cached.sources);
|
|
2451
|
+
cached.fingerprint = discoveryFingerprint(cached.sources);
|
|
2452
|
+
}
|
|
2453
|
+
return cached.sources;
|
|
2454
|
+
}
|
|
2455
|
+
const sources = buildAgentDiscoverySources(cwd, preferredModelProvider, globalNpmRoot);
|
|
2456
|
+
const entry = { sources, fingerprint: discoveryFingerprint(sources) };
|
|
2457
|
+
agentDiscoveryCache.set(key, entry);
|
|
2458
|
+
if (includeChains) {
|
|
2459
|
+
ensureDiscoveryChains(sources);
|
|
2460
|
+
entry.fingerprint = discoveryFingerprint(sources);
|
|
2461
|
+
}
|
|
2462
|
+
return sources;
|
|
2463
|
+
}
|
|
2464
|
+
/** Clear process-local discovery snapshots, primarily for hosts that reload settings in place. */
|
|
2465
|
+
export function clearAgentDiscoveryCache() {
|
|
2466
|
+
agentDiscoveryCache.clear();
|
|
2467
|
+
}
|
|
2468
|
+
function ensureSettingsForScope(sources, scope, preferredModelProvider) {
|
|
2469
|
+
if (scope !== "project" && sources.userSettings === undefined) {
|
|
2470
|
+
if (sources.packageSubagentPaths.settingsErrors.user)
|
|
2471
|
+
throw sources.packageSubagentPaths.settingsErrors.user;
|
|
2472
|
+
sources.userSettings = selectProviderOverrides(readSubagentSettings(sources.userSettingsPath), preferredModelProvider);
|
|
2473
|
+
}
|
|
2474
|
+
if (scope !== "user" && sources.projectSettings === undefined) {
|
|
2475
|
+
if (sources.packageSubagentPaths.settingsErrors.project)
|
|
2476
|
+
throw sources.packageSubagentPaths.settingsErrors.project;
|
|
2477
|
+
sources.projectSettings = selectProviderOverrides(readSubagentSettings(sources.projectSettingsPath), preferredModelProvider);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
function settingsForScope(sources, scope) {
|
|
2481
|
+
// Parse only settings that participate in this projection. The source cache
|
|
2482
|
+
// still retains both source trees, while malformed out-of-scope settings do
|
|
2483
|
+
// not make an otherwise valid scoped projection fail.
|
|
2484
|
+
ensureSettingsForScope(sources, scope, sources.preferredModelProvider);
|
|
2485
|
+
return {
|
|
2486
|
+
user: scope === "project" ? EMPTY_SUBAGENT_SETTINGS : sources.userSettings ?? EMPTY_SUBAGENT_SETTINGS,
|
|
2487
|
+
project: scope === "user" ? EMPTY_SUBAGENT_SETTINGS : sources.projectSettings ?? EMPTY_SUBAGENT_SETTINGS,
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
function configuredAgentsForScope(sources, scope, settingsScope = scope) {
|
|
2491
|
+
const { user: userSettings, project: projectSettings } = settingsForScope(sources, settingsScope);
|
|
2492
|
+
const defaultProvider = resolveSubagentDefaultProvider(userSettings, projectSettings, sources.projectSettingsPath);
|
|
2493
|
+
const defaultModel = resolveSubagentDefaultModel(userSettings, projectSettings, sources.userSettingsPath, sources.projectSettingsPath, defaultProvider);
|
|
2494
|
+
const defaultThinking = resolveSubagentDefaultThinking(userSettings, projectSettings, sources.projectSettingsPath);
|
|
2495
|
+
const maxThinking = resolveSubagentMaxThinking(userSettings, projectSettings, sources.projectSettingsPath);
|
|
2496
|
+
const defaultExtensions = resolveSubagentDefaultExtensions(userSettings, projectSettings, sources.projectSettingsPath);
|
|
2497
|
+
const defaultSubagentOnlyExtensions = resolveSubagentDefaultSubagentOnlyExtensions(userSettings, projectSettings, sources.projectSettingsPath);
|
|
2498
|
+
const applyDefaults = (agents) => applySubagentDefaults(agents, defaultModel, defaultProvider, defaultThinking, defaultExtensions, defaultSubagentOnlyExtensions);
|
|
2499
|
+
const builtin = applyBuiltinOverrides(applyDefaults(sources.builtinLoaded.agents), userSettings, projectSettings, sources.userSettingsPath, sources.projectSettingsPath);
|
|
2500
|
+
const user = applyCustomAgentOverrides(applyDefaults(scope === "project" ? [] : sources.userLoaded.flatMap((loaded) => loaded.loaded.agents)), userSettings, projectSettings, sources.userSettingsPath, sources.projectSettingsPath);
|
|
2501
|
+
const projectMap = new Map();
|
|
2502
|
+
if (scope !== "user")
|
|
2503
|
+
for (const loaded of sources.projectLoaded)
|
|
2504
|
+
for (const agent of loaded.loaded.agents)
|
|
2505
|
+
projectMap.set(agent.name, agent);
|
|
2506
|
+
const project = applyCustomAgentOverrides(applyDefaults(Array.from(projectMap.values())), userSettings, projectSettings, sources.userSettingsPath, sources.projectSettingsPath);
|
|
2507
|
+
const packageMap = new Map();
|
|
2508
|
+
for (const loaded of sources.packageLoaded) {
|
|
2509
|
+
if (!loaded.packageEntry || !packageEntryIncluded(scope, loaded.packageEntry.scope))
|
|
2510
|
+
continue;
|
|
2511
|
+
for (const agent of loaded.loaded.agents)
|
|
2512
|
+
if (!packageMap.has(agent.name))
|
|
2513
|
+
packageMap.set(agent.name, agent);
|
|
2514
|
+
}
|
|
2515
|
+
const packageAgents = applyCustomAgentOverrides(applyDefaults(Array.from(packageMap.values())), userSettings, projectSettings, sources.userSettingsPath, sources.projectSettingsPath);
|
|
2516
|
+
return {
|
|
2517
|
+
builtin,
|
|
2518
|
+
package: packageAgents,
|
|
2519
|
+
user,
|
|
2520
|
+
project,
|
|
2521
|
+
userSettings,
|
|
2522
|
+
projectSettings,
|
|
2523
|
+
maxThinking,
|
|
2524
|
+
modelScope: projectSettings.modelScope ?? userSettings.modelScope,
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
function discoveryDirectories(sources, scope) {
|
|
2528
|
+
const directories = [reportAgentDefinitionDirectory("builtin", BUILTIN_AGENTS_DIR, BUILTIN_AGENT_DEFINITION_INSPECTION)];
|
|
2529
|
+
if (scope !== "project")
|
|
2530
|
+
for (const directory of sources.userLoaded)
|
|
2531
|
+
directories.push(reportAgentDefinitionDirectory("user", directory.dir, directory.inspection));
|
|
2532
|
+
if (scope !== "user") {
|
|
2533
|
+
const reported = new Set();
|
|
2534
|
+
for (const dir of sources.projectCandidateDirs) {
|
|
2535
|
+
reported.add(path.resolve(dir));
|
|
2536
|
+
directories.push(reportAgentDefinitionDirectory("project", dir, sources.projectInspections.get(dir)));
|
|
2537
|
+
}
|
|
2538
|
+
for (const directory of sources.projectLoaded) {
|
|
2539
|
+
if (!reported.has(path.resolve(directory.dir)))
|
|
2540
|
+
directories.push(reportAgentDefinitionDirectory("project", directory.dir, directory.inspection));
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
for (const directory of sources.packageLoaded) {
|
|
2544
|
+
if (directory.packageEntry && packageEntryIncluded(scope, directory.packageEntry.scope))
|
|
2545
|
+
directories.push(reportAgentDefinitionDirectory("package", directory.dir, directory.inspection));
|
|
2546
|
+
}
|
|
2547
|
+
return directories;
|
|
2548
|
+
}
|
|
2549
|
+
function discoveryDiagnostics(sources, scope) {
|
|
2550
|
+
return [
|
|
2551
|
+
...sources.builtinLoaded.diagnostics,
|
|
2552
|
+
...(scope === "project" ? [] : sources.userLoaded.flatMap((loaded) => loaded.loaded.diagnostics)),
|
|
2553
|
+
...(scope === "user" ? [] : sources.projectLoaded.flatMap((loaded) => loaded.loaded.diagnostics)),
|
|
2554
|
+
...sources.packageLoaded
|
|
2555
|
+
.filter((loaded) => loaded.packageEntry && packageEntryIncluded(scope, loaded.packageEntry.scope))
|
|
2556
|
+
.flatMap((loaded) => loaded.loaded.diagnostics),
|
|
2557
|
+
];
|
|
2558
|
+
}
|
|
2559
|
+
function buildEffectiveDiscovery(sources, scope) {
|
|
2560
|
+
const configured = configuredAgentsForScope(sources, scope);
|
|
2561
|
+
const agents = applySubagentMaxThinking(mergeAgentsForScope(scope, configured.user, configured.project, configured.builtin, configured.package).filter((agent) => agent.disabled !== true), configured.maxThinking);
|
|
2562
|
+
return {
|
|
2563
|
+
agents,
|
|
2564
|
+
agentDiagnostics: discoveryDiagnostics(sources, scope),
|
|
2565
|
+
projectAgentsDir: sources.projectAgentsDir,
|
|
2566
|
+
cwd: sources.cwd,
|
|
2567
|
+
scope,
|
|
2568
|
+
directories: discoveryDirectories(sources, scope),
|
|
2569
|
+
...(configured.modelScope !== undefined ? { modelScope: configured.modelScope } : {}),
|
|
2570
|
+
...(configured.maxThinking !== undefined ? { maxThinking: configured.maxThinking } : {}),
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
function buildAllDiscovery(sources, includeChains, settingsScope) {
|
|
2574
|
+
if (includeChains)
|
|
2575
|
+
ensureDiscoveryChains(sources);
|
|
2576
|
+
const configured = configuredAgentsForScope(sources, "both", settingsScope);
|
|
2577
|
+
const packageChainMap = new Map();
|
|
2578
|
+
const packageChainDiagnostics = [];
|
|
2579
|
+
for (const chain of sources.packageChainLoaded ?? []) {
|
|
2580
|
+
packageChainDiagnostics.push(...chain.loaded.diagnostics);
|
|
2581
|
+
for (const definition of chain.loaded.chains)
|
|
2582
|
+
if (!packageChainMap.has(definition.name))
|
|
2583
|
+
packageChainMap.set(definition.name, definition);
|
|
2584
|
+
}
|
|
2585
|
+
const projectChainMap = new Map();
|
|
2586
|
+
const projectChainDiagnostics = [];
|
|
2587
|
+
for (const chain of sources.projectChainLoaded ?? []) {
|
|
2588
|
+
projectChainDiagnostics.push(...chain.loaded.diagnostics);
|
|
2589
|
+
for (const definition of chain.loaded.chains)
|
|
2590
|
+
projectChainMap.set(definition.name, definition);
|
|
2591
|
+
}
|
|
2592
|
+
const chains = [
|
|
2593
|
+
...Array.from(packageChainMap.values()),
|
|
2594
|
+
...(sources.userChains?.chains ?? []),
|
|
2595
|
+
...Array.from(projectChainMap.values()),
|
|
2596
|
+
];
|
|
2597
|
+
return {
|
|
2598
|
+
builtin: applySubagentMaxThinking(configured.builtin, configured.maxThinking),
|
|
2599
|
+
package: applySubagentMaxThinking(configured.package, configured.maxThinking),
|
|
2600
|
+
user: applySubagentMaxThinking(configured.user, configured.maxThinking),
|
|
2601
|
+
project: applySubagentMaxThinking(configured.project, configured.maxThinking),
|
|
2602
|
+
agentDiagnostics: [
|
|
2603
|
+
...sources.builtinLoaded.diagnostics,
|
|
2604
|
+
...sources.userLoaded.flatMap((loaded) => loaded.loaded.diagnostics),
|
|
2605
|
+
...sources.packageLoaded.flatMap((loaded) => loaded.loaded.diagnostics),
|
|
2606
|
+
...sources.projectLoaded.flatMap((loaded) => loaded.loaded.diagnostics),
|
|
2607
|
+
],
|
|
2608
|
+
chains,
|
|
2609
|
+
chainDiagnostics: [...packageChainDiagnostics, ...(sources.userChains?.diagnostics ?? []), ...projectChainDiagnostics],
|
|
2610
|
+
cwd: sources.cwd,
|
|
2611
|
+
userDir: sources.userDir,
|
|
2612
|
+
projectDir: sources.projectAgentsDir,
|
|
2613
|
+
userChainDir: sources.userChainDir,
|
|
2614
|
+
projectChainDir: sources.projectChainDir,
|
|
2615
|
+
userSettingsPath: sources.userSettingsPath,
|
|
2616
|
+
projectSettingsPath: sources.projectSettingsPath,
|
|
2617
|
+
...(configured.maxThinking !== undefined ? { maxThinking: configured.maxThinking } : {}),
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
export function discoverAgentSnapshot(cwd, scope, preferredModelProvider, options = {}) {
|
|
2621
|
+
const includeChains = options.includeChains !== false;
|
|
2622
|
+
const sources = getAgentDiscoverySources(cwd, preferredModelProvider, includeChains, options.globalNpmRoot);
|
|
2623
|
+
return { effective: buildEffectiveDiscovery(sources, scope), all: buildAllDiscovery(sources, includeChains, scope) };
|
|
2624
|
+
}
|
|
2625
|
+
function discoverAgentsUncached(cwd, scope, preferredModelProvider, options = {}) {
|
|
2626
|
+
const effectiveCwd = path.resolve(cwd);
|
|
2627
|
+
const userDirOld = path.join(getAgentDir(), "agents");
|
|
2628
|
+
const userDirNew = path.join(os.homedir(), ".agents");
|
|
2629
|
+
const { readDirs: projectAgentDirs, candidateDirs: projectCandidateDirs, preferredDir: projectAgentsDir } = resolveNearestProjectAgentDirs(effectiveCwd);
|
|
2630
|
+
const userSettingsPath = getUserAgentSettingsPath();
|
|
2631
|
+
const projectSettingsPath = getProjectAgentSettingsPath(effectiveCwd);
|
|
2632
|
+
const userSettings = selectProviderOverrides(scope === "project" ? EMPTY_SUBAGENT_SETTINGS : readSubagentSettings(userSettingsPath), preferredModelProvider);
|
|
2633
|
+
const projectSettings = selectProviderOverrides(scope === "user" ? EMPTY_SUBAGENT_SETTINGS : readSubagentSettings(projectSettingsPath), preferredModelProvider);
|
|
2634
|
+
const defaultProvider = resolveSubagentDefaultProvider(userSettings, projectSettings, projectSettingsPath);
|
|
2635
|
+
const defaultModel = resolveSubagentDefaultModel(userSettings, projectSettings, userSettingsPath, projectSettingsPath, defaultProvider);
|
|
2636
|
+
const defaultThinking = resolveSubagentDefaultThinking(userSettings, projectSettings, projectSettingsPath);
|
|
2637
|
+
const maxThinking = resolveSubagentMaxThinking(userSettings, projectSettings, projectSettingsPath);
|
|
2638
|
+
const defaultExtensions = resolveSubagentDefaultExtensions(userSettings, projectSettings, projectSettingsPath);
|
|
2639
|
+
const defaultSubagentOnlyExtensions = resolveSubagentDefaultSubagentOnlyExtensions(userSettings, projectSettings, projectSettingsPath);
|
|
2640
|
+
const modelScope = projectSettings.modelScope ?? userSettings.modelScope;
|
|
2641
|
+
const packageSubagentPaths = collectPackageSubagentPaths(effectiveCwd, { includeUser: scope !== "project", includeProject: scope !== "user", globalNpmRoot: options.globalNpmRoot });
|
|
2642
|
+
const isExcluded = agentExclusions(agentExclusionRoots(userSettingsPath, projectSettingsPath));
|
|
2643
|
+
const directories = [reportAgentDefinitionDirectory("builtin", BUILTIN_AGENTS_DIR, BUILTIN_AGENT_DEFINITION_INSPECTION)];
|
|
2644
|
+
const builtinLoaded = loadAgentsFromDefinitionFiles(BUILTIN_AGENT_DEFINITION_FILES, "builtin");
|
|
2645
|
+
const applyDefaults = (agents) => applySubagentDefaults(agents, defaultModel, defaultProvider, defaultThinking, defaultExtensions, defaultSubagentOnlyExtensions);
|
|
2646
|
+
const builtinAgents = applyBuiltinOverrides(applyDefaults(builtinLoaded.agents), userSettings, projectSettings, userSettingsPath, projectSettingsPath);
|
|
2647
|
+
const userScanDirs = settingsAgentScanDirs(userSettings.agentScanDirs ?? [], isExcluded);
|
|
2648
|
+
const projectScanDirs = settingsAgentScanDirs(projectSettings.agentScanDirs ?? [], isExcluded);
|
|
2649
|
+
const userLoaded = scope === "project" ? [] : [...extraUserAgentDirs(), ...userScanDirs.dirs, userDirOld, userDirNew].filter((dir) => !isExcluded(dir)).map((dir, discoveryPriority) => {
|
|
2650
|
+
const inspection = inspectAgentDefinitionDirectory(dir, undefined, isExcluded);
|
|
2651
|
+
directories.push(reportAgentDefinitionDirectory("user", dir, inspection));
|
|
2652
|
+
return loadAgentsFromDir(dir, "user", discoveryPriority, undefined, inspection);
|
|
2653
|
+
});
|
|
2654
|
+
const userAgents = applyCustomAgentOverrides(applyDefaults(userLoaded.flatMap((loaded) => loaded.agents)), userSettings, projectSettings, userSettingsPath, projectSettingsPath);
|
|
2655
|
+
const projectInspections = scope === "user" ? new Map() : new Map(projectCandidateDirs.filter((dir) => !isExcluded(dir)).map((dir) => [dir, inspectAgentDefinitionDirectory(dir, undefined, isExcluded)]));
|
|
2656
|
+
if (scope !== "user")
|
|
2657
|
+
for (const [dir, inspection] of projectInspections)
|
|
2658
|
+
directories.push(reportAgentDefinitionDirectory("project", dir, inspection));
|
|
2659
|
+
const projectLoaded = scope === "user" ? [] : [...projectScanDirs.dirs, ...projectAgentDirs].filter((dir) => !isExcluded(dir)).map((dir, discoveryPriority) => {
|
|
2660
|
+
const inspection = projectInspections.get(dir) ?? inspectAgentDefinitionDirectory(dir, undefined, isExcluded);
|
|
2661
|
+
if (!projectInspections.has(dir))
|
|
2662
|
+
directories.push(reportAgentDefinitionDirectory("project", dir, inspection));
|
|
2663
|
+
return loadAgentsFromDir(dir, "project", dir === projectAgentsDir ? 1 : discoveryPriority, undefined, inspection);
|
|
2664
|
+
});
|
|
2665
|
+
const projectAgents = applyCustomAgentOverrides(applyDefaults(projectLoaded.flatMap((loaded) => loaded.agents)), userSettings, projectSettings, userSettingsPath, projectSettingsPath);
|
|
2666
|
+
const packageLoaded = packageSubagentPaths.agents.filter((entry) => !isExcluded(entry.dir)).map((entry, index) => {
|
|
2667
|
+
const inspection = inspectAgentDefinitionDirectory(entry.dir, undefined, isExcluded);
|
|
2668
|
+
directories.push(reportAgentDefinitionDirectory("package", entry.dir, inspection));
|
|
2669
|
+
return loadAgentsFromDir(entry.dir, "package", packageSubagentPaths.agents.length - index, entry, inspection);
|
|
2670
|
+
});
|
|
2671
|
+
const packageMap = new Map();
|
|
2672
|
+
for (const loaded of packageLoaded)
|
|
2673
|
+
for (const agent of loaded.agents)
|
|
2674
|
+
if (!packageMap.has(agent.name))
|
|
2675
|
+
packageMap.set(agent.name, agent);
|
|
2676
|
+
const packageAgents = applyCustomAgentOverrides(applyDefaults(Array.from(packageMap.values())), userSettings, projectSettings, userSettingsPath, projectSettingsPath);
|
|
2677
|
+
const agents = applySubagentMaxThinking(mergeAgentsForScope(scope, userAgents, projectAgents, builtinAgents, packageAgents).filter((agent) => agent.disabled !== true), maxThinking);
|
|
2678
|
+
const agentDiagnostics = [...builtinLoaded.diagnostics, ...userLoaded.flatMap((loaded) => loaded.diagnostics), ...projectLoaded.flatMap((loaded) => loaded.diagnostics), ...packageLoaded.flatMap((loaded) => loaded.diagnostics)];
|
|
2679
|
+
return { agents, agentDiagnostics, projectAgentsDir, cwd: effectiveCwd, scope, directories, ...(modelScope !== undefined ? { modelScope } : {}), ...(maxThinking !== undefined ? { maxThinking } : {}) };
|
|
2680
|
+
}
|
|
2681
|
+
export function discoverAgents(cwd, scope, preferredModelProvider, options = {}) {
|
|
2682
|
+
if (scope !== "both")
|
|
2683
|
+
return discoverAgentsUncached(cwd, scope, preferredModelProvider, options);
|
|
2684
|
+
const sources = getAgentDiscoverySources(cwd, preferredModelProvider, false, options.globalNpmRoot);
|
|
2685
|
+
return buildEffectiveDiscovery(sources, scope);
|
|
2686
|
+
}
|
|
2687
|
+
export function discoverAgentsAll(cwd, preferredModelProvider, options = {}) {
|
|
2688
|
+
return discoverAgentSnapshot(cwd, "both", preferredModelProvider, options).all;
|
|
2689
|
+
}
|
|
2690
|
+
//# sourceMappingURL=agents.js.map
|