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