@north-light/crouter 0.3.154
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/README.md +48 -0
- package/bin/crouter +4 -0
- package/bin/crtr +4 -0
- package/bin/crtrd +4 -0
- package/bin/runtime-generation-manifest.mjs +263 -0
- package/bin/runtime-selector.mjs +378 -0
- package/dist/api/__tests__/client.test.d.ts +1 -0
- package/dist/api/__tests__/client.test.js +274 -0
- package/dist/api/client.d.ts +249 -0
- package/dist/api/client.js +616 -0
- package/dist/api/dto/attach.d.ts +16 -0
- package/dist/api/dto/attach.js +13 -0
- package/dist/api/dto/broker.d.ts +45 -0
- package/dist/api/dto/broker.js +20 -0
- package/dist/api/dto/canvas.d.ts +253 -0
- package/dist/api/dto/canvas.js +2 -0
- package/dist/api/dto/common.d.ts +27 -0
- package/dist/api/dto/common.js +15 -0
- package/dist/api/dto/config.d.ts +19 -0
- package/dist/api/dto/config.js +3 -0
- package/dist/api/dto/crons.d.ts +124 -0
- package/dist/api/dto/crons.js +10 -0
- package/dist/api/dto/files.d.ts +11 -0
- package/dist/api/dto/files.js +7 -0
- package/dist/api/dto/focus.d.ts +24 -0
- package/dist/api/dto/focus.js +10 -0
- package/dist/api/dto/health.d.ts +41 -0
- package/dist/api/dto/health.js +2 -0
- package/dist/api/dto/human.d.ts +57 -0
- package/dist/api/dto/human.js +4 -0
- package/dist/api/dto/inbox.d.ts +105 -0
- package/dist/api/dto/inbox.js +10 -0
- package/dist/api/dto/lifecycle.d.ts +79 -0
- package/dist/api/dto/lifecycle.js +3 -0
- package/dist/api/dto/messages.d.ts +55 -0
- package/dist/api/dto/messages.js +2 -0
- package/dist/api/dto/modelauth.d.ts +41 -0
- package/dist/api/dto/modelauth.js +3 -0
- package/dist/api/dto/nodes.d.ts +209 -0
- package/dist/api/dto/nodes.js +3 -0
- package/dist/api/dto/profiles.d.ts +14 -0
- package/dist/api/dto/profiles.js +3 -0
- package/dist/api/dto/reports.d.ts +41 -0
- package/dist/api/dto/reports.js +2 -0
- package/dist/api/dto/subscriptions.d.ts +14 -0
- package/dist/api/dto/subscriptions.js +2 -0
- package/dist/api/dto/worktree.d.ts +19 -0
- package/dist/api/dto/worktree.js +6 -0
- package/dist/api/errors.d.ts +19 -0
- package/dist/api/errors.js +30 -0
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.js +25 -0
- package/dist/api/routes.d.ts +64 -0
- package/dist/api/routes.js +92 -0
- package/dist/build-root.d.ts +43 -0
- package/dist/build-root.js +96 -0
- package/dist/builtin-memory/00-runtime-base.md +51 -0
- package/dist/builtin-memory/01-spine/00-has-manager.md +23 -0
- package/dist/builtin-memory/01-spine/01-no-manager.md +10 -0
- package/dist/builtin-memory/02-lifecycle/00-terminal.md +19 -0
- package/dist/builtin-memory/02-lifecycle/01-resident.md +10 -0
- package/dist/builtin-memory/04-base-worker.md +18 -0
- package/dist/builtin-memory/04-orchestration-kernel.md +109 -0
- package/dist/builtin-memory/05-kinds/advisor/00-base.md +19 -0
- package/dist/builtin-memory/05-kinds/advisor/01-orchestrator.md +26 -0
- package/dist/builtin-memory/05-kinds/design/00-base.md +20 -0
- package/dist/builtin-memory/05-kinds/design/01-orchestrator.md +13 -0
- package/dist/builtin-memory/05-kinds/developer/00-base.md +22 -0
- package/dist/builtin-memory/05-kinds/developer/01-orchestrator.md +21 -0
- package/dist/builtin-memory/05-kinds/explore/00-base.md +20 -0
- package/dist/builtin-memory/05-kinds/explore/01-orchestrator.md +16 -0
- package/dist/builtin-memory/05-kinds/general/00-base.md +15 -0
- package/dist/builtin-memory/05-kinds/general/01-orchestrator.md +11 -0
- package/dist/builtin-memory/05-kinds/plan/00-base.md +20 -0
- package/dist/builtin-memory/05-kinds/plan/01-orchestrator.md +17 -0
- package/dist/builtin-memory/05-kinds/plan/reviewers/architecture-fit.md +17 -0
- package/dist/builtin-memory/05-kinds/plan/reviewers/code-smells.md +17 -0
- package/dist/builtin-memory/05-kinds/plan/reviewers/pattern-consistency.md +19 -0
- package/dist/builtin-memory/05-kinds/plan/reviewers/requirements-coverage.md +17 -0
- package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +20 -0
- package/dist/builtin-memory/05-kinds/product/00-base.md +25 -0
- package/dist/builtin-memory/05-kinds/product/01-orchestrator.md +15 -0
- package/dist/builtin-memory/05-kinds/product/teardown.md +15 -0
- package/dist/builtin-memory/05-kinds/review/00-base.md +19 -0
- package/dist/builtin-memory/05-kinds/review/01-orchestrator.md +17 -0
- package/dist/builtin-memory/05-kinds/spec/00-base.md +20 -0
- package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +15 -0
- package/dist/builtin-memory/05-kinds/spec/requirements.md +13 -0
- package/dist/builtin-memory/design.md +62 -0
- package/dist/builtin-memory/development.md +120 -0
- package/dist/builtin-memory/internal/INDEX.md +26 -0
- package/dist/builtin-memory/internal/agent-shaping.md +77 -0
- package/dist/builtin-memory/internal/examples/INDEX.md +15 -0
- package/dist/builtin-memory/internal/examples/imessage-assistant.md +100 -0
- package/dist/builtin-memory/internal/marketplaces.md +164 -0
- package/dist/builtin-memory/internal/nodes-and-canvas.md +51 -0
- package/dist/builtin-memory/internal/plugins.md +249 -0
- package/dist/builtin-memory/internal/storage-tiers.md +41 -0
- package/dist/builtin-memory/planning.md +43 -0
- package/dist/builtin-memory/product.md +80 -0
- package/dist/builtin-memory/spec.md +98 -0
- package/dist/builtin-memory/wedged-child-on-runaway-bash.md +34 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/README.md +47 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/claude-plugin-commands.test.ts +49 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/crtr-commands.test.ts +93 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/memory-slash-commands.test.ts +194 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/provider-rotation.test.ts +2632 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/statusline.test.ts +68 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +492 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crouter-help.ts +95 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crtr-commands/filters.json +7 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crtr-commands/index.ts +191 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/frontmatter-rules/index.ts +448 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/frontmatter-rules/test.ts +119 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +195 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +1232 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/statusline.ts +255 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/strip-skills-docs.ts +47 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/sysprompt-window.ts +19 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/lib/package.json +3 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/lib/subscription-state.js +1 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/lib/subscription-state.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/LICENSE +13 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/README.md +172 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/bin.mjs +11 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/errors.js +57 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/index.js +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/log.js +11 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/util.js +11 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/dist/visit.js +233 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/index.js +5 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/browser/package.json +3 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/cli.d.ts +8 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/cli.mjs +201 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/composer.js +224 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/Document.js +337 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/doc/directives.js +178 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/errors.d.ts +21 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/errors.js +62 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/index.d.ts +25 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/index.js +50 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/log.d.ts +3 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/log.js +19 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/options.d.ts +350 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/cst.js +112 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/parse/parser.js +980 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/public-api.js +107 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/tags.js +99 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/test-events.js +134 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/util.d.ts +16 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/util.js +28 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/visit.d.ts +102 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/dist/visit.js +236 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/package.json +97 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/node_modules/yaml/util.js +2 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/package-lock.json +3385 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/package.json +25 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/tsconfig.json +10 -0
- package/dist/builtin-pi-packages/pi-mode-switch/README.md +36 -0
- package/dist/builtin-pi-packages/pi-mode-switch/bin/mode +36 -0
- package/dist/builtin-pi-packages/pi-mode-switch/extensions/index.ts +449 -0
- package/dist/builtin-pi-packages/pi-mode-switch/package.json +14 -0
- package/dist/builtin-pi-packages/pi-mode-switch/tsconfig.json +9 -0
- package/dist/builtin-views/_lib/states.mjs +161 -0
- package/dist/builtin-views/canvas/core.mjs +657 -0
- package/dist/builtin-views/canvas/text.mjs +58 -0
- package/dist/builtin-views/canvas/tui.mjs +168 -0
- package/dist/builtin-views/canvas/web.jsx +121 -0
- package/dist/builtin-views/chat/core.mjs +684 -0
- package/dist/builtin-views/chat/text.mjs +101 -0
- package/dist/builtin-views/chat/tui.mjs +360 -0
- package/dist/builtin-views/chat/web.jsx +362 -0
- package/dist/builtin-views/git-pr/core.mjs +673 -0
- package/dist/builtin-views/git-pr/text.mjs +84 -0
- package/dist/builtin-views/git-pr/tui.mjs +301 -0
- package/dist/builtin-views/git-pr/web.jsx +216 -0
- package/dist/builtin-views/inbox/_lib/render.mjs +175 -0
- package/dist/builtin-views/inbox/core.mjs +1273 -0
- package/dist/builtin-views/inbox/text.mjs +73 -0
- package/dist/builtin-views/inbox/tui.mjs +314 -0
- package/dist/builtin-views/inbox/web.jsx +188 -0
- package/dist/builtin-views/linkedin/core.mjs +906 -0
- package/dist/builtin-views/linkedin/text.mjs +69 -0
- package/dist/builtin-views/linkedin/tui.mjs +413 -0
- package/dist/builtin-views/linkedin/web.jsx +206 -0
- package/dist/builtin-views/prompt-review/core.mjs +735 -0
- package/dist/builtin-views/prompt-review/text.mjs +15 -0
- package/dist/builtin-views/prompt-review/tui.mjs +196 -0
- package/dist/builtin-views/prompt-review/web.jsx +484 -0
- package/dist/builtin-views/workspace-sidebar/__tests__/core.test.d.ts +1 -0
- package/dist/builtin-views/workspace-sidebar/__tests__/core.test.js +50 -0
- package/dist/builtin-views/workspace-sidebar/__tests__/core.test.ts +53 -0
- package/dist/builtin-views/workspace-sidebar/core.mjs +670 -0
- package/dist/builtin-views/workspace-sidebar/text.mjs +53 -0
- package/dist/builtin-views/workspace-sidebar/tui.mjs +141 -0
- package/dist/builtin-views/workspace-sidebar/web.jsx +109 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +86 -0
- package/dist/clients/attach/__tests__/attach-chrome-remote.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/attach-chrome-remote.test.js +467 -0
- package/dist/clients/attach/__tests__/attach-keybindings.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/attach-keybindings.test.js +141 -0
- package/dist/clients/attach/__tests__/attach-remote-readonly.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/attach-remote-readonly.test.js +191 -0
- package/dist/clients/attach/__tests__/chat-view-snapshot-ordering.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/chat-view-snapshot-ordering.test.js +236 -0
- package/dist/clients/attach/__tests__/context-message.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/context-message.test.js +46 -0
- package/dist/clients/attach/__tests__/crtr-output-coverage.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/crtr-output-coverage.test.js +55 -0
- package/dist/clients/attach/__tests__/crtr-output.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/crtr-output.test.js +2103 -0
- package/dist/clients/attach/__tests__/diagram.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/diagram.test.js +42 -0
- package/dist/clients/attach/__tests__/markdown-headings.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/markdown-headings.test.js +27 -0
- package/dist/clients/attach/__tests__/oauth-dialog-lifecycle.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/oauth-dialog-lifecycle.test.js +133 -0
- package/dist/clients/attach/__tests__/prompt-preview.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/prompt-preview.test.js +87 -0
- package/dist/clients/attach/__tests__/ref-autocomplete.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/ref-autocomplete.test.js +176 -0
- package/dist/clients/attach/__tests__/titled-editor-preview.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/titled-editor-preview.test.js +271 -0
- package/dist/clients/attach/__tests__/visible-paths.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/visible-paths.test.js +19 -0
- package/dist/clients/attach/chrome/bash-jobs.d.ts +9 -0
- package/dist/clients/attach/chrome/bash-jobs.js +43 -0
- package/dist/clients/attach/chrome/canvas-panels.d.ts +36 -0
- package/dist/clients/attach/chrome/canvas-panels.js +172 -0
- package/dist/clients/attach/chrome/completion-bell.d.ts +10 -0
- package/dist/clients/attach/chrome/completion-bell.js +89 -0
- package/dist/clients/attach/chrome/cron-wait.d.ts +3 -0
- package/dist/clients/attach/chrome/cron-wait.js +34 -0
- package/dist/clients/attach/chrome/git-info.d.ts +20 -0
- package/dist/clients/attach/chrome/git-info.js +44 -0
- package/dist/clients/attach/chrome/roster.d.ts +26 -0
- package/dist/clients/attach/chrome/roster.js +233 -0
- package/dist/clients/attach/chrome/status-line.d.ts +35 -0
- package/dist/clients/attach/chrome/status-line.js +133 -0
- package/dist/clients/attach/chrome/widgets.d.ts +9 -0
- package/dist/clients/attach/chrome/widgets.js +61 -0
- package/dist/clients/attach/command.d.ts +2 -0
- package/dist/clients/attach/command.js +96 -0
- package/dist/clients/attach/config.d.ts +91 -0
- package/dist/clients/attach/config.js +271 -0
- package/dist/clients/attach/input/clipboard-image.d.ts +55 -0
- package/dist/clients/attach/input/clipboard-image.js +237 -0
- package/dist/clients/attach/input/controller.d.ts +210 -0
- package/dist/clients/attach/input/controller.js +689 -0
- package/dist/clients/attach/input/ref-autocomplete.d.ts +75 -0
- package/dist/clients/attach/input/ref-autocomplete.js +135 -0
- package/dist/clients/attach/input/titled-editor.d.ts +209 -0
- package/dist/clients/attach/input/titled-editor.js +801 -0
- package/dist/clients/attach/overlays/auth.d.ts +13 -0
- package/dist/clients/attach/overlays/auth.js +245 -0
- package/dist/clients/attach/overlays/dialogs.d.ts +27 -0
- package/dist/clients/attach/overlays/dialogs.js +102 -0
- package/dist/clients/attach/overlays/file-review.d.ts +9 -0
- package/dist/clients/attach/overlays/file-review.js +181 -0
- package/dist/clients/attach/overlays/graph.d.ts +76 -0
- package/dist/clients/attach/overlays/graph.js +657 -0
- package/dist/clients/attach/overlays/mcp.d.ts +32 -0
- package/dist/clients/attach/overlays/mcp.js +310 -0
- package/dist/clients/attach/overlays/pickers.d.ts +59 -0
- package/dist/clients/attach/overlays/pickers.js +170 -0
- package/dist/clients/attach/render/chat-view.d.ts +185 -0
- package/dist/clients/attach/render/chat-view.js +946 -0
- package/dist/clients/attach/render/context-message.d.ts +14 -0
- package/dist/clients/attach/render/context-message.js +81 -0
- package/dist/clients/attach/render/crtr-output.d.ts +48 -0
- package/dist/clients/attach/render/crtr-output.js +694 -0
- package/dist/clients/attach/render/diagram.d.ts +14 -0
- package/dist/clients/attach/render/diagram.js +135 -0
- package/dist/clients/attach/render/edit-diff.d.ts +6 -0
- package/dist/clients/attach/render/edit-diff.js +263 -0
- package/dist/clients/attach/render/frozen-history.d.ts +38 -0
- package/dist/clients/attach/render/frozen-history.js +100 -0
- package/dist/clients/attach/render/markdown-headings.d.ts +11 -0
- package/dist/clients/attach/render/markdown-headings.js +82 -0
- package/dist/clients/attach/session/banner.d.ts +9 -0
- package/dist/clients/attach/session/banner.js +29 -0
- package/dist/clients/attach/session/bindings.d.ts +12 -0
- package/dist/clients/attach/session/bindings.js +52 -0
- package/dist/clients/attach/session/chrome-refresh.d.ts +34 -0
- package/dist/clients/attach/session/chrome-refresh.js +93 -0
- package/dist/clients/attach/session/connection.d.ts +44 -0
- package/dist/clients/attach/session/connection.js +178 -0
- package/dist/clients/attach/session/context.d.ts +54 -0
- package/dist/clients/attach/session/context.js +16 -0
- package/dist/clients/attach/session/editor-frame.d.ts +43 -0
- package/dist/clients/attach/session/editor-frame.js +136 -0
- package/dist/clients/attach/session/editor-inventory.d.ts +59 -0
- package/dist/clients/attach/session/editor-inventory.js +161 -0
- package/dist/clients/attach/session/focus-events.d.ts +4 -0
- package/dist/clients/attach/session/focus-events.js +12 -0
- package/dist/clients/attach/session/frames.d.ts +43 -0
- package/dist/clients/attach/session/frames.js +170 -0
- package/dist/clients/attach/session/identity.d.ts +16 -0
- package/dist/clients/attach/session/identity.js +25 -0
- package/dist/clients/attach/session/input-wiring.d.ts +31 -0
- package/dist/clients/attach/session/input-wiring.js +128 -0
- package/dist/clients/attach/session/keys.d.ts +22 -0
- package/dist/clients/attach/session/keys.js +60 -0
- package/dist/clients/attach/session/layout.d.ts +20 -0
- package/dist/clients/attach/session/layout.js +56 -0
- package/dist/clients/attach/session/mode.d.ts +25 -0
- package/dist/clients/attach/session/mode.js +97 -0
- package/dist/clients/attach/session/pane-tag.d.ts +15 -0
- package/dist/clients/attach/session/pane-tag.js +43 -0
- package/dist/clients/attach/session/pi-assets.d.ts +1 -0
- package/dist/clients/attach/session/pi-assets.js +24 -0
- package/dist/clients/attach/session/pi-oauth-flows.d.ts +1 -0
- package/dist/clients/attach/session/pi-oauth-flows.js +21 -0
- package/dist/clients/attach/session/reconnect.d.ts +37 -0
- package/dist/clients/attach/session/reconnect.js +127 -0
- package/dist/clients/attach/session/state-sync.d.ts +38 -0
- package/dist/clients/attach/session/state-sync.js +68 -0
- package/dist/clients/attach/session/teardown.d.ts +30 -0
- package/dist/clients/attach/session/teardown.js +96 -0
- package/dist/clients/attach/slash/dispatch.d.ts +124 -0
- package/dist/clients/attach/slash/dispatch.js +696 -0
- package/dist/clients/attach/slash/prompt-preview.d.ts +30 -0
- package/dist/clients/attach/slash/prompt-preview.js +121 -0
- package/dist/clients/attach/viewer.d.ts +8 -0
- package/dist/clients/attach/viewer.js +1559 -0
- package/dist/clients/attach/visible-paths.d.ts +9 -0
- package/dist/clients/attach/visible-paths.js +76 -0
- package/dist/clients/web/__tests__/push-engine.test.d.ts +1 -0
- package/dist/clients/web/__tests__/push-engine.test.js +302 -0
- package/dist/clients/web/__tests__/push-registry.test.d.ts +1 -0
- package/dist/clients/web/__tests__/push-registry.test.js +177 -0
- package/dist/clients/web/dev-server.d.ts +7 -0
- package/dist/clients/web/dev-server.js +60 -0
- package/dist/clients/web/events.d.ts +19 -0
- package/dist/clients/web/events.js +165 -0
- package/dist/clients/web/push-engine.d.ts +108 -0
- package/dist/clients/web/push-engine.js +256 -0
- package/dist/clients/web/push-registry.d.ts +89 -0
- package/dist/clients/web/push-registry.js +378 -0
- package/dist/clients/web/server.d.ts +19 -0
- package/dist/clients/web/server.js +693 -0
- package/dist/clients/web/web-client/shared/protocol.d.ts +322 -0
- package/dist/clients/web/web-client/shared/protocol.js +8 -0
- package/dist/clients/web/web-cmd.d.ts +2 -0
- package/dist/clients/web/web-cmd.js +141 -0
- package/dist/commands/__tests__/api-client-cold-start-diagnostic.test.d.ts +1 -0
- package/dist/commands/__tests__/api-client-cold-start-diagnostic.test.js +96 -0
- package/dist/commands/__tests__/canvas-config.test.d.ts +1 -0
- package/dist/commands/__tests__/canvas-config.test.js +107 -0
- package/dist/commands/__tests__/human.test.d.ts +1 -0
- package/dist/commands/__tests__/human.test.js +344 -0
- package/dist/commands/__tests__/node-no-kickoff-flag.test.d.ts +1 -0
- package/dist/commands/__tests__/node-no-kickoff-flag.test.js +73 -0
- package/dist/commands/__tests__/node-worktree-flag.test.d.ts +1 -0
- package/dist/commands/__tests__/node-worktree-flag.test.js +49 -0
- package/dist/commands/__tests__/revive-now-gate.test.d.ts +1 -0
- package/dist/commands/__tests__/revive-now-gate.test.js +60 -0
- package/dist/commands/api-client.d.ts +100 -0
- package/dist/commands/api-client.js +377 -0
- package/dist/commands/attention.d.ts +2 -0
- package/dist/commands/attention.js +223 -0
- package/dist/commands/canvas-browse.d.ts +2 -0
- package/dist/commands/canvas-browse.js +95 -0
- package/dist/commands/canvas-config.d.ts +2 -0
- package/dist/commands/canvas-config.js +210 -0
- package/dist/commands/canvas-history/grep.d.ts +1 -0
- package/dist/commands/canvas-history/grep.js +104 -0
- package/dist/commands/canvas-history/read.d.ts +1 -0
- package/dist/commands/canvas-history/read.js +48 -0
- package/dist/commands/canvas-history/search.d.ts +1 -0
- package/dist/commands/canvas-history/search.js +118 -0
- package/dist/commands/canvas-history/shared.d.ts +27 -0
- package/dist/commands/canvas-history/shared.js +76 -0
- package/dist/commands/canvas-history.d.ts +2 -0
- package/dist/commands/canvas-history.js +30 -0
- package/dist/commands/canvas-issue.d.ts +2 -0
- package/dist/commands/canvas-issue.js +149 -0
- package/dist/commands/canvas-prune.d.ts +2 -0
- package/dist/commands/canvas-prune.js +108 -0
- package/dist/commands/canvas-rebuild-index.d.ts +2 -0
- package/dist/commands/canvas-rebuild-index.js +46 -0
- package/dist/commands/canvas-roster.d.ts +2 -0
- package/dist/commands/canvas-roster.js +62 -0
- package/dist/commands/canvas-snapshot.d.ts +2 -0
- package/dist/commands/canvas-snapshot.js +34 -0
- package/dist/commands/canvas-use.d.ts +1 -0
- package/dist/commands/canvas-use.js +63 -0
- package/dist/commands/canvas.d.ts +3 -0
- package/dist/commands/canvas.js +50 -0
- package/dist/commands/chord.d.ts +2 -0
- package/dist/commands/chord.js +242 -0
- package/dist/commands/cron.d.ts +2 -0
- package/dist/commands/cron.js +524 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +80 -0
- package/dist/commands/human/prompts.d.ts +8 -0
- package/dist/commands/human/prompts.js +427 -0
- package/dist/commands/human/queue.d.ts +12 -0
- package/dist/commands/human/queue.js +531 -0
- package/dist/commands/human/shared.d.ts +80 -0
- package/dist/commands/human/shared.js +194 -0
- package/dist/commands/human.d.ts +2 -0
- package/dist/commands/human.js +44 -0
- package/dist/commands/memory/delete.d.ts +1 -0
- package/dist/commands/memory/delete.js +77 -0
- package/dist/commands/memory/find.d.ts +1 -0
- package/dist/commands/memory/find.js +192 -0
- package/dist/commands/memory/lint.d.ts +9 -0
- package/dist/commands/memory/lint.js +217 -0
- package/dist/commands/memory/list.d.ts +1 -0
- package/dist/commands/memory/list.js +84 -0
- package/dist/commands/memory/origin.d.ts +1 -0
- package/dist/commands/memory/origin.js +100 -0
- package/dist/commands/memory/read.d.ts +1 -0
- package/dist/commands/memory/read.js +72 -0
- package/dist/commands/memory/shared.d.ts +54 -0
- package/dist/commands/memory/shared.js +225 -0
- package/dist/commands/memory/write.d.ts +1 -0
- package/dist/commands/memory/write.js +142 -0
- package/dist/commands/memory.d.ts +2 -0
- package/dist/commands/memory.js +26 -0
- package/dist/commands/node-context.d.ts +2 -0
- package/dist/commands/node-context.js +157 -0
- package/dist/commands/node-inspect-artifacts.d.ts +1 -0
- package/dist/commands/node-inspect-artifacts.js +109 -0
- package/dist/commands/node-lifecycle-revive.d.ts +12 -0
- package/dist/commands/node-lifecycle-revive.js +287 -0
- package/dist/commands/node-snapshot.d.ts +2 -0
- package/dist/commands/node-snapshot.js +37 -0
- package/dist/commands/node-transcript.d.ts +2 -0
- package/dist/commands/node-transcript.js +62 -0
- package/dist/commands/node-worktree.d.ts +2 -0
- package/dist/commands/node-worktree.js +102 -0
- package/dist/commands/node.d.ts +44 -0
- package/dist/commands/node.js +1943 -0
- package/dist/commands/pkg/cli-inspect.d.ts +17 -0
- package/dist/commands/pkg/cli-inspect.js +190 -0
- package/dist/commands/pkg/cli-manage.d.ts +3 -0
- package/dist/commands/pkg/cli-manage.js +206 -0
- package/dist/commands/pkg/cli.d.ts +1 -0
- package/dist/commands/pkg/cli.js +14 -0
- package/dist/commands/pkg/market-inspect.d.ts +2 -0
- package/dist/commands/pkg/market-inspect.js +141 -0
- package/dist/commands/pkg/market-manage.d.ts +3 -0
- package/dist/commands/pkg/market-manage.js +224 -0
- package/dist/commands/pkg/market.d.ts +1 -0
- package/dist/commands/pkg/market.js +14 -0
- package/dist/commands/pkg/plugin-inspect.d.ts +2 -0
- package/dist/commands/pkg/plugin-inspect.js +150 -0
- package/dist/commands/pkg/plugin-manage.d.ts +19 -0
- package/dist/commands/pkg/plugin-manage.js +398 -0
- package/dist/commands/pkg/plugin.d.ts +1 -0
- package/dist/commands/pkg/plugin.js +14 -0
- package/dist/commands/pkg/shared.d.ts +5 -0
- package/dist/commands/pkg/shared.js +61 -0
- package/dist/commands/pkg.d.ts +2 -0
- package/dist/commands/pkg.js +24 -0
- package/dist/commands/profile/default.d.ts +2 -0
- package/dist/commands/profile/default.js +143 -0
- package/dist/commands/profile/delete.d.ts +1 -0
- package/dist/commands/profile/delete.js +39 -0
- package/dist/commands/profile/env.d.ts +2 -0
- package/dist/commands/profile/env.js +194 -0
- package/dist/commands/profile/list.d.ts +1 -0
- package/dist/commands/profile/list.js +35 -0
- package/dist/commands/profile/new.d.ts +1 -0
- package/dist/commands/profile/new.js +75 -0
- package/dist/commands/profile/project.d.ts +2 -0
- package/dist/commands/profile/project.js +97 -0
- package/dist/commands/profile/rename.d.ts +1 -0
- package/dist/commands/profile/rename.js +42 -0
- package/dist/commands/profile/show.d.ts +1 -0
- package/dist/commands/profile/show.js +50 -0
- package/dist/commands/profile.d.ts +2 -0
- package/dist/commands/profile.js +37 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.js +166 -0
- package/dist/commands/revive.d.ts +2 -0
- package/dist/commands/revive.js +174 -0
- package/dist/commands/search/answer.d.ts +1 -0
- package/dist/commands/search/answer.js +50 -0
- package/dist/commands/search/contents.d.ts +1 -0
- package/dist/commands/search/contents.js +96 -0
- package/dist/commands/search/exa.d.ts +53 -0
- package/dist/commands/search/exa.js +157 -0
- package/dist/commands/search/puremd.d.ts +11 -0
- package/dist/commands/search/puremd.js +53 -0
- package/dist/commands/search/web.d.ts +1 -0
- package/dist/commands/search/web.js +65 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +24 -0
- package/dist/commands/surface-edit.d.ts +2 -0
- package/dist/commands/surface-edit.js +159 -0
- package/dist/commands/surface-inspect.d.ts +2 -0
- package/dist/commands/surface-inspect.js +38 -0
- package/dist/commands/surface-node.d.ts +2 -0
- package/dist/commands/surface-node.js +16 -0
- package/dist/commands/surface-reload.d.ts +2 -0
- package/dist/commands/surface-reload.js +127 -0
- package/dist/commands/surface-tmux-spread.d.ts +2 -0
- package/dist/commands/surface-tmux-spread.js +220 -0
- package/dist/commands/surface.d.ts +2 -0
- package/dist/commands/surface.js +48 -0
- package/dist/commands/sys/__tests__/config-broker-thresholds.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/config-broker-thresholds.test.js +95 -0
- package/dist/commands/sys/__tests__/config-keybindings.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/config-keybindings.test.js +55 -0
- package/dist/commands/sys/__tests__/config-model-ladders.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/config-model-ladders.test.js +121 -0
- package/dist/commands/sys/__tests__/helpers/setup-runtime.d.ts +5 -0
- package/dist/commands/sys/__tests__/helpers/setup-runtime.js +19 -0
- package/dist/commands/sys/__tests__/setup-core.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/setup-core.test.js +291 -0
- package/dist/commands/sys/__tests__/setup-front-door.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/setup-front-door.test.js +137 -0
- package/dist/commands/sys/__tests__/setup-models.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/setup-models.test.js +205 -0
- package/dist/commands/sys/__tests__/setup-providers-viewport.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/setup-providers-viewport.test.js +155 -0
- package/dist/commands/sys/__tests__/sync-deps.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/sync-deps.test.js +188 -0
- package/dist/commands/sys/__tests__/sync-import.test.d.ts +1 -0
- package/dist/commands/sys/__tests__/sync-import.test.js +314 -0
- package/dist/commands/sys/config.d.ts +1 -0
- package/dist/commands/sys/config.js +292 -0
- package/dist/commands/sys/daemon.d.ts +2 -0
- package/dist/commands/sys/daemon.js +188 -0
- package/dist/commands/sys/doctor.d.ts +1 -0
- package/dist/commands/sys/doctor.js +528 -0
- package/dist/commands/sys/feedback.d.ts +1 -0
- package/dist/commands/sys/feedback.js +174 -0
- package/dist/commands/sys/logs.d.ts +1 -0
- package/dist/commands/sys/logs.js +127 -0
- package/dist/commands/sys/prompt-review.d.ts +1 -0
- package/dist/commands/sys/prompt-review.js +291 -0
- package/dist/commands/sys/promptstudio.d.ts +2 -0
- package/dist/commands/sys/promptstudio.js +65 -0
- package/dist/commands/sys/setup-core.d.ts +138 -0
- package/dist/commands/sys/setup-core.js +582 -0
- package/dist/commands/sys/setup-wizard.d.ts +130 -0
- package/dist/commands/sys/setup-wizard.js +2310 -0
- package/dist/commands/sys/setup.d.ts +6 -0
- package/dist/commands/sys/setup.js +36 -0
- package/dist/commands/sys/shared.d.ts +51 -0
- package/dist/commands/sys/shared.js +81 -0
- package/dist/commands/sys/support/prepare.d.ts +13 -0
- package/dist/commands/sys/support/prepare.js +235 -0
- package/dist/commands/sys/support/submit.d.ts +19 -0
- package/dist/commands/sys/support/submit.js +525 -0
- package/dist/commands/sys/support.d.ts +2 -0
- package/dist/commands/sys/support.js +18 -0
- package/dist/commands/sys/sync-deps.d.ts +19 -0
- package/dist/commands/sys/sync-deps.js +508 -0
- package/dist/commands/sys/sync-project-guidance.d.ts +1 -0
- package/dist/commands/sys/sync-project-guidance.js +345 -0
- package/dist/commands/sys/sync-shared.d.ts +7 -0
- package/dist/commands/sys/sync-shared.js +49 -0
- package/dist/commands/sys/sync-skills.d.ts +1 -0
- package/dist/commands/sys/sync-skills.js +306 -0
- package/dist/commands/sys/sync.d.ts +2 -0
- package/dist/commands/sys/sync.js +18 -0
- package/dist/commands/sys/sysprompt.d.ts +1 -0
- package/dist/commands/sys/sysprompt.js +97 -0
- package/dist/commands/sys/update.d.ts +2 -0
- package/dist/commands/sys/update.js +139 -0
- package/dist/commands/sys.d.ts +2 -0
- package/dist/commands/sys.js +30 -0
- package/dist/commands/view-cycle.d.ts +2 -0
- package/dist/commands/view-cycle.js +130 -0
- package/dist/commands/view-list.d.ts +2 -0
- package/dist/commands/view-list.js +66 -0
- package/dist/commands/view-new.d.ts +2 -0
- package/dist/commands/view-new.js +74 -0
- package/dist/commands/view-pick.d.ts +6 -0
- package/dist/commands/view-pick.js +129 -0
- package/dist/commands/view-run.d.ts +2 -0
- package/dist/commands/view-run.js +214 -0
- package/dist/commands/view.d.ts +2 -0
- package/dist/commands/view.js +31 -0
- package/dist/commands/workspace.d.ts +2 -0
- package/dist/commands/workspace.js +165 -0
- package/dist/core/__tests__/base-worker-prompt.test.d.ts +1 -0
- package/dist/core/__tests__/base-worker-prompt.test.js +60 -0
- package/dist/core/__tests__/boot-fault-attempt.test.d.ts +1 -0
- package/dist/core/__tests__/boot-fault-attempt.test.js +83 -0
- package/dist/core/__tests__/boot.test.d.ts +1 -0
- package/dist/core/__tests__/boot.test.js +275 -0
- package/dist/core/__tests__/branded-host-concurrency.test.d.ts +1 -0
- package/dist/core/__tests__/branded-host-concurrency.test.js +72 -0
- package/dist/core/__tests__/broker-fork-seam.test.d.ts +1 -0
- package/dist/core/__tests__/broker-fork-seam.test.js +118 -0
- package/dist/core/__tests__/broker-launch-candidates.test.d.ts +1 -0
- package/dist/core/__tests__/broker-launch-candidates.test.js +241 -0
- package/dist/core/__tests__/broker-preflight.test.d.ts +1 -0
- package/dist/core/__tests__/broker-preflight.test.js +95 -0
- package/dist/core/__tests__/broker-sdk-wiring.test.d.ts +1 -0
- package/dist/core/__tests__/broker-sdk-wiring.test.js +732 -0
- package/dist/core/__tests__/broker-snapshot-history.test.d.ts +1 -0
- package/dist/core/__tests__/broker-snapshot-history.test.js +213 -0
- package/dist/core/__tests__/canvas-inbox-watcher-hold.test.d.ts +1 -0
- package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +502 -0
- package/dist/core/__tests__/canvas-inbox-watcher.test.d.ts +1 -0
- package/dist/core/__tests__/canvas-inbox-watcher.test.js +255 -0
- package/dist/core/__tests__/canvas.test.d.ts +1 -0
- package/dist/core/__tests__/canvas.test.js +201 -0
- package/dist/core/__tests__/chat-view-reconnect.test.d.ts +1 -0
- package/dist/core/__tests__/chat-view-reconnect.test.js +105 -0
- package/dist/core/__tests__/child-death-wake.test.d.ts +1 -0
- package/dist/core/__tests__/child-death-wake.test.js +161 -0
- package/dist/core/__tests__/close.test.d.ts +1 -0
- package/dist/core/__tests__/close.test.js +254 -0
- package/dist/core/__tests__/command-plugins-surfaces.test.d.ts +1 -0
- package/dist/core/__tests__/command-plugins-surfaces.test.js +325 -0
- package/dist/core/__tests__/command-plugins.test.d.ts +1 -0
- package/dist/core/__tests__/command-plugins.test.js +448 -0
- package/dist/core/__tests__/connection-reconnect-resume.test.d.ts +1 -0
- package/dist/core/__tests__/connection-reconnect-resume.test.js +36 -0
- package/dist/core/__tests__/context-intro.test.d.ts +1 -0
- package/dist/core/__tests__/context-intro.test.js +256 -0
- package/dist/core/__tests__/cron-broker-capacity.test.d.ts +1 -0
- package/dist/core/__tests__/cron-broker-capacity.test.js +100 -0
- package/dist/core/__tests__/daemon-boot.test.d.ts +1 -0
- package/dist/core/__tests__/daemon-boot.test.js +374 -0
- package/dist/core/__tests__/daemon-wedge.test.d.ts +1 -0
- package/dist/core/__tests__/daemon-wedge.test.js +104 -0
- package/dist/core/__tests__/dead-node-policy-table.test.d.ts +1 -0
- package/dist/core/__tests__/dead-node-policy-table.test.js +103 -0
- package/dist/core/__tests__/deferred-no-wake.test.d.ts +1 -0
- package/dist/core/__tests__/deferred-no-wake.test.js +514 -0
- package/dist/core/__tests__/events-contract.test.d.ts +1 -0
- package/dist/core/__tests__/events-contract.test.js +76 -0
- package/dist/core/__tests__/fault-classifier.test.d.ts +1 -0
- package/dist/core/__tests__/fault-classifier.test.js +71 -0
- package/dist/core/__tests__/finalization-migration.test.d.ts +1 -0
- package/dist/core/__tests__/finalization-migration.test.js +38 -0
- package/dist/core/__tests__/fixtures/api-server-host.d.ts +1 -0
- package/dist/core/__tests__/fixtures/api-server-host.js +47 -0
- package/dist/core/__tests__/fixtures/c3-custom-provider-ext.d.ts +2 -0
- package/dist/core/__tests__/fixtures/c3-custom-provider-ext.js +34 -0
- package/dist/core/__tests__/fixtures/c5-command-boundary-ext.d.ts +2 -0
- package/dist/core/__tests__/fixtures/c5-command-boundary-ext.js +8 -0
- package/dist/core/__tests__/fixtures/extra-extension.d.ts +1 -0
- package/dist/core/__tests__/fixtures/extra-extension.js +3 -0
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +310 -0
- package/dist/core/__tests__/fixtures/fake-engine.js +1210 -0
- package/dist/core/__tests__/fixtures/fake-pi-host.d.ts +2 -0
- package/dist/core/__tests__/fixtures/fake-pi-host.js +311 -0
- package/dist/core/__tests__/fixtures/metadata-migration-race.d.ts +1 -0
- package/dist/core/__tests__/fixtures/metadata-migration-race.js +49 -0
- package/dist/core/__tests__/fixtures/spawn-proof-target.test.d.ts +1 -0
- package/dist/core/__tests__/fixtures/spawn-proof-target.test.js +15 -0
- package/dist/core/__tests__/flagship-lifecycle.test.d.ts +1 -0
- package/dist/core/__tests__/flagship-lifecycle.test.js +303 -0
- package/dist/core/__tests__/focuses.test.d.ts +1 -0
- package/dist/core/__tests__/focuses.test.js +208 -0
- package/dist/core/__tests__/fork.test.d.ts +1 -0
- package/dist/core/__tests__/fork.test.js +108 -0
- package/dist/core/__tests__/full/broker-attach-limits.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-attach-limits.test.js +147 -0
- package/dist/core/__tests__/full/broker-attach-stream.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-attach-stream.test.js +133 -0
- package/dist/core/__tests__/full/broker-crash-teardown.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-crash-teardown.test.js +122 -0
- package/dist/core/__tests__/full/broker-deliver-ack.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-deliver-ack.test.js +73 -0
- package/dist/core/__tests__/full/broker-dialogs.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-dialogs.test.js +180 -0
- package/dist/core/__tests__/full/broker-display-snapshot.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-display-snapshot.test.js +75 -0
- package/dist/core/__tests__/full/broker-dormant-wake.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-dormant-wake.test.js +130 -0
- package/dist/core/__tests__/full/broker-model-changed-broadcast.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-model-changed-broadcast.test.js +57 -0
- package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.js +80 -0
- package/dist/core/__tests__/full/broker-pane-resolution.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-pane-resolution.test.js +155 -0
- package/dist/core/__tests__/full/broker-provider-retry.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-provider-retry.test.js +387 -0
- package/dist/core/__tests__/full/cascade-close.test.d.ts +1 -0
- package/dist/core/__tests__/full/cascade-close.test.js +240 -0
- package/dist/core/__tests__/full/consult-startup-failure.test.d.ts +1 -0
- package/dist/core/__tests__/full/consult-startup-failure.test.js +124 -0
- package/dist/core/__tests__/full/detach-focus.test.d.ts +1 -0
- package/dist/core/__tests__/full/detach-focus.test.js +126 -0
- package/dist/core/__tests__/full/idle-release-settlement.test.d.ts +1 -0
- package/dist/core/__tests__/full/idle-release-settlement.test.js +108 -0
- package/dist/core/__tests__/full/issue-146-yield-spawn-focus.test.d.ts +1 -0
- package/dist/core/__tests__/full/issue-146-yield-spawn-focus.test.js +107 -0
- package/dist/core/__tests__/full/park-clock-release.test.d.ts +1 -0
- package/dist/core/__tests__/full/park-clock-release.test.js +56 -0
- package/dist/core/__tests__/full/yield-message-transaction.test.d.ts +1 -0
- package/dist/core/__tests__/full/yield-message-transaction.test.js +70 -0
- package/dist/core/__tests__/helpers/broker-clients.d.ts +43 -0
- package/dist/core/__tests__/helpers/broker-clients.js +182 -0
- package/dist/core/__tests__/helpers/fleet.d.ts +12 -0
- package/dist/core/__tests__/helpers/fleet.js +45 -0
- package/dist/core/__tests__/helpers/harness.d.ts +128 -0
- package/dist/core/__tests__/helpers/harness.js +867 -0
- package/dist/core/__tests__/helpers/viewer-panes.d.ts +12 -0
- package/dist/core/__tests__/helpers/viewer-panes.js +133 -0
- package/dist/core/__tests__/history-inbox.test.d.ts +1 -0
- package/dist/core/__tests__/history-inbox.test.js +105 -0
- package/dist/core/__tests__/host-teardown-process-group.test.d.ts +1 -0
- package/dist/core/__tests__/host-teardown-process-group.test.js +476 -0
- package/dist/core/__tests__/human-cancel-guard.test.d.ts +1 -0
- package/dist/core/__tests__/human-cancel-guard.test.js +71 -0
- package/dist/core/__tests__/human-deliver-e2e.test.d.ts +1 -0
- package/dist/core/__tests__/human-deliver-e2e.test.js +123 -0
- package/dist/core/__tests__/human-deliver.test.d.ts +1 -0
- package/dist/core/__tests__/human-deliver.test.js +399 -0
- package/dist/core/__tests__/human-node-not-supervised.test.d.ts +1 -0
- package/dist/core/__tests__/human-node-not-supervised.test.js +94 -0
- package/dist/core/__tests__/inline-memory-refs.test.d.ts +1 -0
- package/dist/core/__tests__/inline-memory-refs.test.js +320 -0
- package/dist/core/__tests__/kickoff.test.d.ts +1 -0
- package/dist/core/__tests__/kickoff.test.js +148 -0
- package/dist/core/__tests__/lifecycle.test.d.ts +1 -0
- package/dist/core/__tests__/lifecycle.test.js +165 -0
- package/dist/core/__tests__/live-lifecycle-prompt.test.d.ts +1 -0
- package/dist/core/__tests__/live-lifecycle-prompt.test.js +51 -0
- package/dist/core/__tests__/live-mutation-verbs.test.d.ts +1 -0
- package/dist/core/__tests__/live-mutation-verbs.test.js +195 -0
- package/dist/core/__tests__/live-mutation.test.d.ts +1 -0
- package/dist/core/__tests__/live-mutation.test.js +197 -0
- package/dist/core/__tests__/memory-index-render.test.d.ts +1 -0
- package/dist/core/__tests__/memory-index-render.test.js +60 -0
- package/dist/core/__tests__/memory-resolver-precedence.test.d.ts +1 -0
- package/dist/core/__tests__/memory-resolver-precedence.test.js +169 -0
- package/dist/core/__tests__/migration.test.d.ts +1 -0
- package/dist/core/__tests__/migration.test.js +717 -0
- package/dist/core/__tests__/model-pin-durability.test.d.ts +1 -0
- package/dist/core/__tests__/model-pin-durability.test.js +124 -0
- package/dist/core/__tests__/on-read-crouter-home-fence.test.d.ts +1 -0
- package/dist/core/__tests__/on-read-crouter-home-fence.test.js +67 -0
- package/dist/core/__tests__/on-read-dedup-resume.test.d.ts +1 -0
- package/dist/core/__tests__/on-read-dedup-resume.test.js +121 -0
- package/dist/core/__tests__/on-read-identity.test.d.ts +1 -0
- package/dist/core/__tests__/on-read-identity.test.js +68 -0
- package/dist/core/__tests__/parse-argv-stdin-secret.test.d.ts +1 -0
- package/dist/core/__tests__/parse-argv-stdin-secret.test.js +26 -0
- package/dist/core/__tests__/passive-subscription.test.d.ts +1 -0
- package/dist/core/__tests__/passive-subscription.test.js +212 -0
- package/dist/core/__tests__/pid-identity-match.test.d.ts +1 -0
- package/dist/core/__tests__/pid-identity-match.test.js +145 -0
- package/dist/core/__tests__/pid-zombie.test.d.ts +1 -0
- package/dist/core/__tests__/pid-zombie.test.js +42 -0
- package/dist/core/__tests__/preview-registry-sync.test.d.ts +1 -0
- package/dist/core/__tests__/preview-registry-sync.test.js +65 -0
- package/dist/core/__tests__/prune-to-limit.test.d.ts +1 -0
- package/dist/core/__tests__/prune-to-limit.test.js +126 -0
- package/dist/core/__tests__/prune.test.d.ts +1 -0
- package/dist/core/__tests__/prune.test.js +135 -0
- package/dist/core/__tests__/push-final-guard.test.d.ts +1 -0
- package/dist/core/__tests__/push-final-guard.test.js +184 -0
- package/dist/core/__tests__/refresh-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/refresh-stall-recycle.test.js +101 -0
- package/dist/core/__tests__/relaunch-root.test.d.ts +1 -0
- package/dist/core/__tests__/relaunch-root.test.js +114 -0
- package/dist/core/__tests__/remote-canvas-target.test.d.ts +1 -0
- package/dist/core/__tests__/remote-canvas-target.test.js +87 -0
- package/dist/core/__tests__/reset.test.d.ts +1 -0
- package/dist/core/__tests__/reset.test.js +69 -0
- package/dist/core/__tests__/respawn-throttle.test.d.ts +1 -0
- package/dist/core/__tests__/respawn-throttle.test.js +154 -0
- package/dist/core/__tests__/review-model-floor.test.d.ts +1 -0
- package/dist/core/__tests__/review-model-floor.test.js +104 -0
- package/dist/core/__tests__/revive-all.test.d.ts +1 -0
- package/dist/core/__tests__/revive-all.test.js +147 -0
- package/dist/core/__tests__/revive.test.d.ts +1 -0
- package/dist/core/__tests__/revive.test.js +575 -0
- package/dist/core/__tests__/scope-crouter-home-fence.test.d.ts +1 -0
- package/dist/core/__tests__/scope-crouter-home-fence.test.js +55 -0
- package/dist/core/__tests__/secrets.test.d.ts +1 -0
- package/dist/core/__tests__/secrets.test.js +55 -0
- package/dist/core/__tests__/session-branch.test.d.ts +1 -0
- package/dist/core/__tests__/session-branch.test.js +61 -0
- package/dist/core/__tests__/session-cycles.test.d.ts +1 -0
- package/dist/core/__tests__/session-cycles.test.js +77 -0
- package/dist/core/__tests__/session-model.test.d.ts +1 -0
- package/dist/core/__tests__/session-model.test.js +129 -0
- package/dist/core/__tests__/spawn-no-kickoff.test.d.ts +1 -0
- package/dist/core/__tests__/spawn-no-kickoff.test.js +119 -0
- package/dist/core/__tests__/spawn-root.test.d.ts +1 -0
- package/dist/core/__tests__/spawn-root.test.js +320 -0
- package/dist/core/__tests__/spawn-worktree-id-conflict.test.d.ts +1 -0
- package/dist/core/__tests__/spawn-worktree-id-conflict.test.js +59 -0
- package/dist/core/__tests__/stdin-body-no-discard.test.d.ts +1 -0
- package/dist/core/__tests__/stdin-body-no-discard.test.js +33 -0
- package/dist/core/__tests__/stdout-errors.test.d.ts +1 -0
- package/dist/core/__tests__/stdout-errors.test.js +16 -0
- package/dist/core/__tests__/steer-note.test.d.ts +1 -0
- package/dist/core/__tests__/steer-note.test.js +41 -0
- package/dist/core/__tests__/stop-guard.test.d.ts +1 -0
- package/dist/core/__tests__/stop-guard.test.js +157 -0
- package/dist/core/__tests__/stream-watchdog.test.d.ts +1 -0
- package/dist/core/__tests__/stream-watchdog.test.js +154 -0
- package/dist/core/__tests__/subcommand-tier.test.d.ts +1 -0
- package/dist/core/__tests__/subcommand-tier.test.js +99 -0
- package/dist/core/__tests__/subscription-delivery.test.d.ts +1 -0
- package/dist/core/__tests__/subscription-delivery.test.js +211 -0
- package/dist/core/__tests__/subscription-pool-credential-guard.test.d.ts +1 -0
- package/dist/core/__tests__/subscription-pool-credential-guard.test.js +94 -0
- package/dist/core/__tests__/test-runner-cheap-sharding.test.d.ts +1 -0
- package/dist/core/__tests__/test-runner-cheap-sharding.test.js +97 -0
- package/dist/core/__tests__/tmux-surface.test.d.ts +1 -0
- package/dist/core/__tests__/tmux-surface.test.js +470 -0
- package/dist/core/__tests__/wake-bearings.test.d.ts +1 -0
- package/dist/core/__tests__/wake-bearings.test.js +102 -0
- package/dist/core/__tests__/worktree.test.d.ts +1 -0
- package/dist/core/__tests__/worktree.test.js +876 -0
- package/dist/core/__tests__/yield-ensures-daemon.test.d.ts +1 -0
- package/dist/core/__tests__/yield-ensures-daemon.test.js +54 -0
- package/dist/core/auth-file.d.ts +40 -0
- package/dist/core/auth-file.js +177 -0
- package/dist/core/auth-interaction.d.ts +19 -0
- package/dist/core/auth-interaction.js +94 -0
- package/dist/core/auto-update.d.ts +1 -0
- package/dist/core/auto-update.js +93 -0
- package/dist/core/bash-jobs.d.ts +55 -0
- package/dist/core/bash-jobs.js +150 -0
- package/dist/core/bootstrap.d.ts +5 -0
- package/dist/core/bootstrap.js +98 -0
- package/dist/core/broker-client/__tests__/transport-relay.test.d.ts +1 -0
- package/dist/core/broker-client/__tests__/transport-relay.test.js +213 -0
- package/dist/core/broker-client/client.d.ts +97 -0
- package/dist/core/broker-client/client.js +189 -0
- package/dist/core/broker-client/index.d.ts +1 -0
- package/dist/core/broker-client/index.js +13 -0
- package/dist/core/broker-client/transport-relay.d.ts +51 -0
- package/dist/core/broker-client/transport-relay.js +169 -0
- package/dist/core/broker-client/transport-socket.d.ts +29 -0
- package/dist/core/broker-client/transport-socket.js +164 -0
- package/dist/core/broker-client/transport.d.ts +32 -0
- package/dist/core/broker-client/transport.js +26 -0
- package/dist/core/canvas/__tests__/attention.test.d.ts +1 -0
- package/dist/core/canvas/__tests__/attention.test.js +97 -0
- package/dist/core/canvas/__tests__/human-work-outbox.test.d.ts +1 -0
- package/dist/core/canvas/__tests__/human-work-outbox.test.js +123 -0
- package/dist/core/canvas/__tests__/remote-canvas-source.test.d.ts +1 -0
- package/dist/core/canvas/__tests__/remote-canvas-source.test.js +372 -0
- package/dist/core/canvas/__tests__/remote-event-stream.test.d.ts +1 -0
- package/dist/core/canvas/__tests__/remote-event-stream.test.js +146 -0
- package/dist/core/canvas/__tests__/render-remote.test.d.ts +1 -0
- package/dist/core/canvas/__tests__/render-remote.test.js +241 -0
- package/dist/core/canvas/__tests__/source-resolve.test.d.ts +1 -0
- package/dist/core/canvas/__tests__/source-resolve.test.js +77 -0
- package/dist/core/canvas/attention.d.ts +19 -0
- package/dist/core/canvas/attention.js +87 -0
- package/dist/core/canvas/boot-id.d.ts +6 -0
- package/dist/core/canvas/boot-id.js +26 -0
- package/dist/core/canvas/boot.d.ts +93 -0
- package/dist/core/canvas/boot.js +190 -0
- package/dist/core/canvas/browse/__tests__/model.test.d.ts +1 -0
- package/dist/core/canvas/browse/__tests__/model.test.js +290 -0
- package/dist/core/canvas/browse/__tests__/rebuild-coalescer.test.d.ts +1 -0
- package/dist/core/canvas/browse/__tests__/rebuild-coalescer.test.js +134 -0
- package/dist/core/canvas/browse/__tests__/render.test.d.ts +1 -0
- package/dist/core/canvas/browse/__tests__/render.test.js +111 -0
- package/dist/core/canvas/browse/app.d.ts +41 -0
- package/dist/core/canvas/browse/app.js +916 -0
- package/dist/core/canvas/browse/model.d.ts +169 -0
- package/dist/core/canvas/browse/model.js +485 -0
- package/dist/core/canvas/browse/pins.d.ts +4 -0
- package/dist/core/canvas/browse/pins.js +29 -0
- package/dist/core/canvas/browse/rebuild-coalescer.d.ts +7 -0
- package/dist/core/canvas/browse/rebuild-coalescer.js +61 -0
- package/dist/core/canvas/browse/render.d.ts +59 -0
- package/dist/core/canvas/browse/render.js +550 -0
- package/dist/core/canvas/canvas.d.ts +358 -0
- package/dist/core/canvas/canvas.js +897 -0
- package/dist/core/canvas/crons.d.ts +222 -0
- package/dist/core/canvas/crons.js +367 -0
- package/dist/core/canvas/daemon-owner.d.ts +67 -0
- package/dist/core/canvas/daemon-owner.js +141 -0
- package/dist/core/canvas/db.d.ts +30 -0
- package/dist/core/canvas/db.js +1167 -0
- package/dist/core/canvas/extensions.d.ts +5 -0
- package/dist/core/canvas/extensions.js +39 -0
- package/dist/core/canvas/focuses.d.ts +22 -0
- package/dist/core/canvas/focuses.js +81 -0
- package/dist/core/canvas/history.d.ts +91 -0
- package/dist/core/canvas/history.js +490 -0
- package/dist/core/canvas/human-work-outbox.d.ts +73 -0
- package/dist/core/canvas/human-work-outbox.js +261 -0
- package/dist/core/canvas/index.d.ts +11 -0
- package/dist/core/canvas/index.js +13 -0
- package/dist/core/canvas/install-id.d.ts +9 -0
- package/dist/core/canvas/install-id.js +84 -0
- package/dist/core/canvas/labels.d.ts +28 -0
- package/dist/core/canvas/labels.js +38 -0
- package/dist/core/canvas/meta-file.d.ts +20 -0
- package/dist/core/canvas/meta-file.js +98 -0
- package/dist/core/canvas/nav-model.d.ts +55 -0
- package/dist/core/canvas/nav-model.js +284 -0
- package/dist/core/canvas/nav-render.d.ts +124 -0
- package/dist/core/canvas/nav-render.js +266 -0
- package/dist/core/canvas/paths.d.ts +81 -0
- package/dist/core/canvas/paths.js +164 -0
- package/dist/core/canvas/pid.d.ts +335 -0
- package/dist/core/canvas/pid.js +636 -0
- package/dist/core/canvas/remote-canvas-source.d.ts +62 -0
- package/dist/core/canvas/remote-canvas-source.js +231 -0
- package/dist/core/canvas/remote-event-stream.d.ts +24 -0
- package/dist/core/canvas/remote-event-stream.js +94 -0
- package/dist/core/canvas/render-source.d.ts +132 -0
- package/dist/core/canvas/render-source.js +457 -0
- package/dist/core/canvas/render.d.ts +47 -0
- package/dist/core/canvas/render.js +237 -0
- package/dist/core/canvas/source.d.ts +35 -0
- package/dist/core/canvas/source.js +44 -0
- package/dist/core/canvas/status-glyph.d.ts +42 -0
- package/dist/core/canvas/status-glyph.js +116 -0
- package/dist/core/canvas/telemetry.d.ts +14 -0
- package/dist/core/canvas/telemetry.js +35 -0
- package/dist/core/canvas/types.d.ts +302 -0
- package/dist/core/canvas/types.js +8 -0
- package/dist/core/clipboard-text.d.ts +3 -0
- package/dist/core/clipboard-text.js +39 -0
- package/dist/core/command-manifests/registry.d.ts +43 -0
- package/dist/core/command-manifests/registry.js +103 -0
- package/dist/core/command-manifests/schema.d.ts +87 -0
- package/dist/core/command-manifests/schema.js +849 -0
- package/dist/core/command-plugins/adapter.d.ts +22 -0
- package/dist/core/command-plugins/adapter.js +160 -0
- package/dist/core/command-plugins/compose.d.ts +11 -0
- package/dist/core/command-plugins/compose.js +88 -0
- package/dist/core/command-plugins/discovery.d.ts +74 -0
- package/dist/core/command-plugins/discovery.js +291 -0
- package/dist/core/command.d.ts +175 -0
- package/dist/core/command.js +636 -0
- package/dist/core/config.d.ts +125 -0
- package/dist/core/config.js +620 -0
- package/dist/core/configured-clis/cache.d.ts +16 -0
- package/dist/core/configured-clis/cache.js +57 -0
- package/dist/core/configured-clis/compose.d.ts +14 -0
- package/dist/core/configured-clis/compose.js +60 -0
- package/dist/core/configured-clis/discovery.d.ts +47 -0
- package/dist/core/configured-clis/discovery.js +173 -0
- package/dist/core/configured-clis/fetch.d.ts +51 -0
- package/dist/core/configured-clis/fetch.js +156 -0
- package/dist/core/configured-clis/invoker.d.ts +36 -0
- package/dist/core/configured-clis/invoker.js +547 -0
- package/dist/core/configured-clis/manifest.d.ts +24 -0
- package/dist/core/configured-clis/manifest.js +284 -0
- package/dist/core/configured-clis/registration.d.ts +40 -0
- package/dist/core/configured-clis/registration.js +201 -0
- package/dist/core/errors.d.ts +27 -0
- package/dist/core/errors.js +48 -0
- package/dist/core/events/emit.d.ts +4 -0
- package/dist/core/events/emit.js +17 -0
- package/dist/core/events/envelope.d.ts +2 -0
- package/dist/core/events/envelope.js +84 -0
- package/dist/core/events/errors.d.ts +4 -0
- package/dist/core/events/errors.js +69 -0
- package/dist/core/events/index.d.ts +5 -0
- package/dist/core/events/index.js +4 -0
- package/dist/core/events/operation-id.d.ts +4 -0
- package/dist/core/events/operation-id.js +24 -0
- package/dist/core/events/read.d.ts +40 -0
- package/dist/core/events/read.js +639 -0
- package/dist/core/events/serialize.d.ts +4 -0
- package/dist/core/events/serialize.js +199 -0
- package/dist/core/events/source.d.ts +18 -0
- package/dist/core/events/source.js +47 -0
- package/dist/core/events/types.d.ts +68 -0
- package/dist/core/events/types.js +11 -0
- package/dist/core/fault-classifier.d.ts +43 -0
- package/dist/core/fault-classifier.js +143 -0
- package/dist/core/feed/__tests__/coalesce-human.test.d.ts +1 -0
- package/dist/core/feed/__tests__/coalesce-human.test.js +36 -0
- package/dist/core/feed/__tests__/empty-node-guard.test.d.ts +1 -0
- package/dist/core/feed/__tests__/empty-node-guard.test.js +45 -0
- package/dist/core/feed/__tests__/inbox-migrate.test.d.ts +1 -0
- package/dist/core/feed/__tests__/inbox-migrate.test.js +53 -0
- package/dist/core/feed/feed.d.ts +31 -0
- package/dist/core/feed/feed.js +159 -0
- package/dist/core/feed/inbox-migrate.d.ts +11 -0
- package/dist/core/feed/inbox-migrate.js +135 -0
- package/dist/core/feed/inbox.d.ts +84 -0
- package/dist/core/feed/inbox.js +407 -0
- package/dist/core/feed/passive.d.ts +14 -0
- package/dist/core/feed/passive.js +114 -0
- package/dist/core/frontmatter.d.ts +8 -0
- package/dist/core/frontmatter.js +35 -0
- package/dist/core/fs-utils.d.ts +21 -0
- package/dist/core/fs-utils.js +149 -0
- package/dist/core/git.d.ts +22 -0
- package/dist/core/git.js +72 -0
- package/dist/core/help.d.ts +223 -0
- package/dist/core/help.js +275 -0
- package/dist/core/host-exports/__tests__/export-prunes-boot-skill.test.d.ts +1 -0
- package/dist/core/host-exports/__tests__/export-prunes-boot-skill.test.js +84 -0
- package/dist/core/host-exports/builtins.d.ts +50 -0
- package/dist/core/host-exports/builtins.js +68 -0
- package/dist/core/host-exports/export.d.ts +32 -0
- package/dist/core/host-exports/export.js +128 -0
- package/dist/core/inspector/core.d.ts +23 -0
- package/dist/core/inspector/core.js +148 -0
- package/dist/core/inspector/model.d.ts +54 -0
- package/dist/core/inspector/model.js +182 -0
- package/dist/core/inspector/text.d.ts +5 -0
- package/dist/core/inspector/text.js +32 -0
- package/dist/core/inspector/tui.d.ts +3 -0
- package/dist/core/inspector/tui.js +220 -0
- package/dist/core/io.d.ts +73 -0
- package/dist/core/io.js +254 -0
- package/dist/core/keybindings/__tests__/bespoke-consumers.test.d.ts +1 -0
- package/dist/core/keybindings/__tests__/bespoke-consumers.test.js +40 -0
- package/dist/core/keybindings/__tests__/inbox-affordance.test.d.ts +1 -0
- package/dist/core/keybindings/__tests__/inbox-affordance.test.js +38 -0
- package/dist/core/keybindings/__tests__/resolve.test.d.ts +1 -0
- package/dist/core/keybindings/__tests__/resolve.test.js +233 -0
- package/dist/core/keybindings/background-bash.d.ts +13 -0
- package/dist/core/keybindings/background-bash.js +34 -0
- package/dist/core/keybindings/catalog.d.ts +15 -0
- package/dist/core/keybindings/catalog.js +285 -0
- package/dist/core/keybindings/inbox.d.ts +21 -0
- package/dist/core/keybindings/inbox.js +35 -0
- package/dist/core/keybindings/index.d.ts +7 -0
- package/dist/core/keybindings/index.js +6 -0
- package/dist/core/keybindings/match.d.ts +29 -0
- package/dist/core/keybindings/match.js +105 -0
- package/dist/core/keybindings/persistence.d.ts +14 -0
- package/dist/core/keybindings/persistence.js +31 -0
- package/dist/core/keybindings/resolve.d.ts +22 -0
- package/dist/core/keybindings/resolve.js +333 -0
- package/dist/core/keybindings/types.d.ts +37 -0
- package/dist/core/keybindings/types.js +1 -0
- package/dist/core/locked-file.d.ts +24 -0
- package/dist/core/locked-file.js +91 -0
- package/dist/core/log.d.ts +3 -0
- package/dist/core/log.js +27 -0
- package/dist/core/manifest.d.ts +5 -0
- package/dist/core/manifest.js +15 -0
- package/dist/core/memory/inline-ref-grammar.d.ts +53 -0
- package/dist/core/memory/inline-ref-grammar.js +99 -0
- package/dist/core/memory/inline-ref-guidance.d.ts +8 -0
- package/dist/core/memory/inline-ref-guidance.js +35 -0
- package/dist/core/memory/inline-ref-inventory.d.ts +13 -0
- package/dist/core/memory/inline-ref-inventory.js +79 -0
- package/dist/core/memory-resolver.d.ts +106 -0
- package/dist/core/memory-resolver.js +422 -0
- package/dist/core/output.d.ts +35 -0
- package/dist/core/output.js +99 -0
- package/dist/core/pagination.d.ts +33 -0
- package/dist/core/pagination.js +89 -0
- package/dist/core/pool-credential-store.d.ts +34 -0
- package/dist/core/pool-credential-store.js +116 -0
- package/dist/core/predicate.d.ts +65 -0
- package/dist/core/predicate.js +191 -0
- package/dist/core/preview-registry.d.ts +25 -0
- package/dist/core/preview-registry.js +2841 -0
- package/dist/core/profiles/__tests__/env-store.test.d.ts +1 -0
- package/dist/core/profiles/__tests__/env-store.test.js +97 -0
- package/dist/core/profiles/__tests__/root-profile.test.d.ts +1 -0
- package/dist/core/profiles/__tests__/root-profile.test.js +69 -0
- package/dist/core/profiles/default-binding.d.ts +6 -0
- package/dist/core/profiles/default-binding.js +46 -0
- package/dist/core/profiles/env-store.d.ts +22 -0
- package/dist/core/profiles/env-store.js +157 -0
- package/dist/core/profiles/manifest.d.ts +35 -0
- package/dist/core/profiles/manifest.js +371 -0
- package/dist/core/profiles/select.d.ts +42 -0
- package/dist/core/profiles/select.js +673 -0
- package/dist/core/profiles/state-block.d.ts +4 -0
- package/dist/core/profiles/state-block.js +16 -0
- package/dist/core/provider-management.d.ts +12 -0
- package/dist/core/provider-management.js +22 -0
- package/dist/core/render.d.ts +12 -0
- package/dist/core/render.js +127 -0
- package/dist/core/resolver.d.ts +14 -0
- package/dist/core/resolver.js +136 -0
- package/dist/core/runtime/__tests__/command-expansion.test.d.ts +1 -0
- package/dist/core/runtime/__tests__/command-expansion.test.js +25 -0
- package/dist/core/runtime/__tests__/engine-route.test.d.ts +1 -0
- package/dist/core/runtime/__tests__/engine-route.test.js +36 -0
- package/dist/core/runtime/__tests__/install-id-cache-scoping.test.d.ts +1 -0
- package/dist/core/runtime/__tests__/install-id-cache-scoping.test.js +41 -0
- package/dist/core/runtime/__tests__/node-env.test.d.ts +1 -0
- package/dist/core/runtime/__tests__/node-env.test.js +73 -0
- package/dist/core/runtime/__tests__/spawn-at-given-id.test.d.ts +1 -0
- package/dist/core/runtime/__tests__/spawn-at-given-id.test.js +34 -0
- package/dist/core/runtime/__tests__/spawn-env.test.d.ts +1 -0
- package/dist/core/runtime/__tests__/spawn-env.test.js +268 -0
- package/dist/core/runtime/auth-reload.d.ts +7 -0
- package/dist/core/runtime/auth-reload.js +67 -0
- package/dist/core/runtime/banner.d.ts +13 -0
- package/dist/core/runtime/banner.js +51 -0
- package/dist/core/runtime/bearings.d.ts +99 -0
- package/dist/core/runtime/bearings.js +429 -0
- package/dist/core/runtime/boot-root.d.ts +24 -0
- package/dist/core/runtime/boot-root.js +102 -0
- package/dist/core/runtime/branded-host.d.ts +25 -0
- package/dist/core/runtime/branded-host.js +342 -0
- package/dist/core/runtime/broker-cli.d.ts +1 -0
- package/dist/core/runtime/broker-cli.js +81 -0
- package/dist/core/runtime/broker-protocol.d.ts +642 -0
- package/dist/core/runtime/broker-protocol.js +146 -0
- package/dist/core/runtime/broker-request.d.ts +37 -0
- package/dist/core/runtime/broker-request.js +85 -0
- package/dist/core/runtime/broker-sdk.d.ts +36 -0
- package/dist/core/runtime/broker-sdk.js +128 -0
- package/dist/core/runtime/broker.d.ts +245 -0
- package/dist/core/runtime/broker.js +3711 -0
- package/dist/core/runtime/busy.d.ts +32 -0
- package/dist/core/runtime/busy.js +107 -0
- package/dist/core/runtime/canvas-extensions.d.ts +20 -0
- package/dist/core/runtime/canvas-extensions.js +70 -0
- package/dist/core/runtime/close.d.ts +34 -0
- package/dist/core/runtime/close.js +223 -0
- package/dist/core/runtime/command-expansion.d.ts +19 -0
- package/dist/core/runtime/command-expansion.js +104 -0
- package/dist/core/runtime/connectivity.d.ts +12 -0
- package/dist/core/runtime/connectivity.js +73 -0
- package/dist/core/runtime/deliver-live.d.ts +26 -0
- package/dist/core/runtime/deliver-live.js +63 -0
- package/dist/core/runtime/fault-recovery-nudge.d.ts +3 -0
- package/dist/core/runtime/fault-recovery-nudge.js +3 -0
- package/dist/core/runtime/fault-recovery.d.ts +23 -0
- package/dist/core/runtime/fault-recovery.js +83 -0
- package/dist/core/runtime/fault.d.ts +64 -0
- package/dist/core/runtime/fault.js +260 -0
- package/dist/core/runtime/fleet.d.ts +57 -0
- package/dist/core/runtime/fleet.js +35 -0
- package/dist/core/runtime/front-door.d.ts +16 -0
- package/dist/core/runtime/front-door.js +186 -0
- package/dist/core/runtime/host.d.ts +43 -0
- package/dist/core/runtime/host.js +432 -0
- package/dist/core/runtime/interactive-deliver.d.ts +15 -0
- package/dist/core/runtime/interactive-deliver.js +41 -0
- package/dist/core/runtime/kickoff.d.ts +53 -0
- package/dist/core/runtime/kickoff.js +289 -0
- package/dist/core/runtime/launch-prompt.d.ts +8 -0
- package/dist/core/runtime/launch-prompt.js +13 -0
- package/dist/core/runtime/launch.d.ts +191 -0
- package/dist/core/runtime/launch.js +442 -0
- package/dist/core/runtime/lifecycle.d.ts +12 -0
- package/dist/core/runtime/lifecycle.js +121 -0
- package/dist/core/runtime/managed-provider-cooling.d.ts +38 -0
- package/dist/core/runtime/managed-provider-cooling.js +81 -0
- package/dist/core/runtime/memory.d.ts +3 -0
- package/dist/core/runtime/memory.js +18 -0
- package/dist/core/runtime/model-selection.d.ts +41 -0
- package/dist/core/runtime/model-selection.js +118 -0
- package/dist/core/runtime/model-swap.d.ts +27 -0
- package/dist/core/runtime/model-swap.js +70 -0
- package/dist/core/runtime/naming-persist.d.ts +11 -0
- package/dist/core/runtime/naming-persist.js +41 -0
- package/dist/core/runtime/naming.d.ts +26 -0
- package/dist/core/runtime/naming.js +174 -0
- package/dist/core/runtime/node-read.d.ts +36 -0
- package/dist/core/runtime/node-read.js +255 -0
- package/dist/core/runtime/nodes.d.ts +113 -0
- package/dist/core/runtime/nodes.js +330 -0
- package/dist/core/runtime/package-health.d.ts +49 -0
- package/dist/core/runtime/package-health.js +217 -0
- package/dist/core/runtime/persona.d.ts +25 -0
- package/dist/core/runtime/persona.js +132 -0
- package/dist/core/runtime/pi-cli.d.ts +8 -0
- package/dist/core/runtime/pi-cli.js +65 -0
- package/dist/core/runtime/pi-vendored.d.ts +26 -0
- package/dist/core/runtime/pi-vendored.js +77 -0
- package/dist/core/runtime/placement-tmux.d.ts +42 -0
- package/dist/core/runtime/placement-tmux.js +151 -0
- package/dist/core/runtime/placement.d.ts +97 -0
- package/dist/core/runtime/placement.js +394 -0
- package/dist/core/runtime/promote.d.ts +44 -0
- package/dist/core/runtime/promote.js +176 -0
- package/dist/core/runtime/recap.d.ts +8 -0
- package/dist/core/runtime/recap.js +136 -0
- package/dist/core/runtime/recycle.d.ts +14 -0
- package/dist/core/runtime/recycle.js +158 -0
- package/dist/core/runtime/reopen.d.ts +32 -0
- package/dist/core/runtime/reopen.js +119 -0
- package/dist/core/runtime/reset.d.ts +68 -0
- package/dist/core/runtime/reset.js +198 -0
- package/dist/core/runtime/resume-root.d.ts +6 -0
- package/dist/core/runtime/resume-root.js +292 -0
- package/dist/core/runtime/revive-all.d.ts +61 -0
- package/dist/core/runtime/revive-all.js +106 -0
- package/dist/core/runtime/revive.d.ts +58 -0
- package/dist/core/runtime/revive.js +357 -0
- package/dist/core/runtime/roadmap.d.ts +13 -0
- package/dist/core/runtime/roadmap.js +45 -0
- package/dist/core/runtime/session-branch.d.ts +13 -0
- package/dist/core/runtime/session-branch.js +46 -0
- package/dist/core/runtime/session-cycles.d.ts +30 -0
- package/dist/core/runtime/session-cycles.js +77 -0
- package/dist/core/runtime/session-list-cache.d.ts +53 -0
- package/dist/core/runtime/session-list-cache.js +406 -0
- package/dist/core/runtime/situational-context.d.ts +12 -0
- package/dist/core/runtime/situational-context.js +48 -0
- package/dist/core/runtime/situational-live.d.ts +9 -0
- package/dist/core/runtime/situational-live.js +40 -0
- package/dist/core/runtime/spawn-env.d.ts +31 -0
- package/dist/core/runtime/spawn-env.js +179 -0
- package/dist/core/runtime/spawn.d.ts +118 -0
- package/dist/core/runtime/spawn.js +473 -0
- package/dist/core/runtime/stop-guard.d.ts +18 -0
- package/dist/core/runtime/stop-guard.js +77 -0
- package/dist/core/runtime/stop-signals.d.ts +14 -0
- package/dist/core/runtime/stop-signals.js +46 -0
- package/dist/core/runtime/stream-watchdog.d.ts +55 -0
- package/dist/core/runtime/stream-watchdog.js +140 -0
- package/dist/core/runtime/structured-output.d.ts +12 -0
- package/dist/core/runtime/structured-output.js +90 -0
- package/dist/core/runtime/surface-bg.d.ts +11 -0
- package/dist/core/runtime/surface-bg.js +68 -0
- package/dist/core/runtime/tmux-chrome.d.ts +1 -0
- package/dist/core/runtime/tmux-chrome.js +4 -0
- package/dist/core/runtime/tmux.d.ts +247 -0
- package/dist/core/runtime/tmux.js +858 -0
- package/dist/core/runtime/warm-pool.d.ts +51 -0
- package/dist/core/runtime/warm-pool.js +373 -0
- package/dist/core/scope.d.ts +47 -0
- package/dist/core/scope.js +255 -0
- package/dist/core/secrets.d.ts +25 -0
- package/dist/core/secrets.js +55 -0
- package/dist/core/self-update.d.ts +21 -0
- package/dist/core/self-update.js +105 -0
- package/dist/core/session-model/session-state.d.ts +51 -0
- package/dist/core/session-model/session-state.js +170 -0
- package/dist/core/spawn.d.ts +16 -0
- package/dist/core/spawn.js +30 -0
- package/dist/core/stdout-errors.d.ts +3 -0
- package/dist/core/stdout-errors.js +14 -0
- package/dist/core/subscription-state.d.ts +138 -0
- package/dist/core/subscription-state.js +918 -0
- package/dist/core/substrate/ceiling.d.ts +20 -0
- package/dist/core/substrate/ceiling.js +69 -0
- package/dist/core/substrate/gate.d.ts +13 -0
- package/dist/core/substrate/gate.js +21 -0
- package/dist/core/substrate/index.d.ts +11 -0
- package/dist/core/substrate/index.js +25 -0
- package/dist/core/substrate/injected-store.d.ts +10 -0
- package/dist/core/substrate/injected-store.js +55 -0
- package/dist/core/substrate/on-read.d.ts +14 -0
- package/dist/core/substrate/on-read.js +404 -0
- package/dist/core/substrate/render-node.d.ts +11 -0
- package/dist/core/substrate/render-node.js +29 -0
- package/dist/core/substrate/render.d.ts +21 -0
- package/dist/core/substrate/render.js +547 -0
- package/dist/core/substrate/schema.d.ts +125 -0
- package/dist/core/substrate/schema.js +191 -0
- package/dist/core/substrate/session-cache.d.ts +25 -0
- package/dist/core/substrate/session-cache.js +101 -0
- package/dist/core/substrate/subject-fields.d.ts +45 -0
- package/dist/core/substrate/subject-fields.js +38 -0
- package/dist/core/substrate/subject.d.ts +12 -0
- package/dist/core/substrate/subject.js +47 -0
- package/dist/core/timing.d.ts +11 -0
- package/dist/core/timing.js +94 -0
- package/dist/core/tui/__tests__/host-keybindings.test.d.ts +1 -0
- package/dist/core/tui/__tests__/host-keybindings.test.js +113 -0
- package/dist/core/tui/draw.d.ts +100 -0
- package/dist/core/tui/draw.js +359 -0
- package/dist/core/tui/host.d.ts +66 -0
- package/dist/core/tui/host.js +689 -0
- package/dist/core/tui/terminal.d.ts +23 -0
- package/dist/core/tui/terminal.js +101 -0
- package/dist/core/view/__tests__/transport-cache.test.d.ts +1 -0
- package/dist/core/view/__tests__/transport-cache.test.js +62 -0
- package/dist/core/view/__tests__/transport-remote.test.d.ts +1 -0
- package/dist/core/view/__tests__/transport-remote.test.js +98 -0
- package/dist/core/view/bridge.d.ts +10 -0
- package/dist/core/view/bridge.js +31 -0
- package/dist/core/view/chrome.d.ts +9 -0
- package/dist/core/view/chrome.js +22 -0
- package/dist/core/view/contract.d.ts +205 -0
- package/dist/core/view/contract.js +23 -0
- package/dist/core/view/loader.d.ts +31 -0
- package/dist/core/view/loader.js +188 -0
- package/dist/core/view/remote-canvas-target.d.ts +4 -0
- package/dist/core/view/remote-canvas-target.js +30 -0
- package/dist/core/view/stream-local.d.ts +3 -0
- package/dist/core/view/stream-local.js +231 -0
- package/dist/core/view/transport-cache.d.ts +8 -0
- package/dist/core/view/transport-cache.js +38 -0
- package/dist/core/view/transport-local.d.ts +7 -0
- package/dist/core/view/transport-local.js +83 -0
- package/dist/core/view/transport-remote.d.ts +2 -0
- package/dist/core/view/transport-remote.js +58 -0
- package/dist/core/view/transport.d.ts +10 -0
- package/dist/core/view/transport.js +15 -0
- package/dist/core/wake.d.ts +86 -0
- package/dist/core/wake.js +307 -0
- package/dist/core/worktree.d.ts +111 -0
- package/dist/core/worktree.js +732 -0
- package/dist/daemon/__tests__/broker-ownership.test.d.ts +1 -0
- package/dist/daemon/__tests__/broker-ownership.test.js +25 -0
- package/dist/daemon/__tests__/daemon-ownership.test.d.ts +1 -0
- package/dist/daemon/__tests__/daemon-ownership.test.js +27 -0
- package/dist/daemon/api/__tests__/error-seam.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/error-seam.test.js +56 -0
- package/dist/daemon/api/__tests__/full/api-server.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/full/api-server.test.js +369 -0
- package/dist/daemon/api/__tests__/full/b10-attach-modelauth.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/full/b10-attach-modelauth.test.js +220 -0
- package/dist/daemon/api/__tests__/full/push-parity.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/full/push-parity.test.js +199 -0
- package/dist/daemon/api/__tests__/full/worktree-parity.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/full/worktree-parity.test.js +160 -0
- package/dist/daemon/api/__tests__/inbox.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/inbox.test.js +578 -0
- package/dist/daemon/api/bridge.d.ts +21 -0
- package/dist/daemon/api/bridge.js +351 -0
- package/dist/daemon/api/handlers/attach.d.ts +2 -0
- package/dist/daemon/api/handlers/attach.js +56 -0
- package/dist/daemon/api/handlers/canvas.d.ts +2 -0
- package/dist/daemon/api/handlers/canvas.js +463 -0
- package/dist/daemon/api/handlers/crons.d.ts +2 -0
- package/dist/daemon/api/handlers/crons.js +354 -0
- package/dist/daemon/api/handlers/daemon.d.ts +2 -0
- package/dist/daemon/api/handlers/daemon.js +35 -0
- package/dist/daemon/api/handlers/files.d.ts +2 -0
- package/dist/daemon/api/handlers/files.js +64 -0
- package/dist/daemon/api/handlers/focus.d.ts +2 -0
- package/dist/daemon/api/handlers/focus.js +92 -0
- package/dist/daemon/api/handlers/health.d.ts +2 -0
- package/dist/daemon/api/handlers/health.js +65 -0
- package/dist/daemon/api/handlers/human.d.ts +12 -0
- package/dist/daemon/api/handlers/human.js +741 -0
- package/dist/daemon/api/handlers/inbox.d.ts +2 -0
- package/dist/daemon/api/handlers/inbox.js +423 -0
- package/dist/daemon/api/handlers/messages.d.ts +2 -0
- package/dist/daemon/api/handlers/messages.js +290 -0
- package/dist/daemon/api/handlers/modelauth.d.ts +2 -0
- package/dist/daemon/api/handlers/modelauth.js +116 -0
- package/dist/daemon/api/handlers/nodes.d.ts +2 -0
- package/dist/daemon/api/handlers/nodes.js +540 -0
- package/dist/daemon/api/handlers/profiles.d.ts +2 -0
- package/dist/daemon/api/handlers/profiles.js +69 -0
- package/dist/daemon/api/handlers/reports.d.ts +2 -0
- package/dist/daemon/api/handlers/reports.js +144 -0
- package/dist/daemon/api/handlers/subscriptions.d.ts +2 -0
- package/dist/daemon/api/handlers/subscriptions.js +53 -0
- package/dist/daemon/api/handlers/worktree.d.ts +2 -0
- package/dist/daemon/api/handlers/worktree.js +40 -0
- package/dist/daemon/api/map.d.ts +100 -0
- package/dist/daemon/api/map.js +360 -0
- package/dist/daemon/api/router.d.ts +56 -0
- package/dist/daemon/api/router.js +190 -0
- package/dist/daemon/api/server.d.ts +23 -0
- package/dist/daemon/api/server.js +258 -0
- package/dist/daemon/control.d.ts +21 -0
- package/dist/daemon/control.js +22 -0
- package/dist/daemon/cron-run.d.ts +64 -0
- package/dist/daemon/cron-run.js +944 -0
- package/dist/daemon/cron-sink.d.ts +26 -0
- package/dist/daemon/cron-sink.js +43 -0
- package/dist/daemon/crtrd-cli.d.ts +1 -0
- package/dist/daemon/crtrd-cli.js +18 -0
- package/dist/daemon/crtrd.d.ts +89 -0
- package/dist/daemon/crtrd.js +1953 -0
- package/dist/daemon/fleet.d.ts +81 -0
- package/dist/daemon/fleet.js +405 -0
- package/dist/daemon/manage.d.ts +103 -0
- package/dist/daemon/manage.js +389 -0
- package/dist/daemon/pidfile.d.ts +8 -0
- package/dist/daemon/pidfile.js +37 -0
- package/dist/daemon/supervise-cadence.d.ts +1 -0
- package/dist/daemon/supervise-cadence.js +6 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +44 -0
- package/dist/pi-extensions/__tests__/canvas-bash-valve.test.d.ts +1 -0
- package/dist/pi-extensions/__tests__/canvas-bash-valve.test.js +31 -0
- package/dist/pi-extensions/__tests__/canvas-context-intro.test.d.ts +1 -0
- package/dist/pi-extensions/__tests__/canvas-context-intro.test.js +182 -0
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.d.ts +1 -0
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +467 -0
- package/dist/pi-extensions/__tests__/canvas-stophook-context-nudge.test.d.ts +1 -0
- package/dist/pi-extensions/__tests__/canvas-stophook-context-nudge.test.js +121 -0
- package/dist/pi-extensions/canvas-bash-valve.d.ts +8 -0
- package/dist/pi-extensions/canvas-bash-valve.js +297 -0
- package/dist/pi-extensions/canvas-context-intro.d.ts +91 -0
- package/dist/pi-extensions/canvas-context-intro.js +230 -0
- package/dist/pi-extensions/canvas-doc-substrate.d.ts +44 -0
- package/dist/pi-extensions/canvas-doc-substrate.js +151 -0
- package/dist/pi-extensions/canvas-goal-capture.d.ts +21 -0
- package/dist/pi-extensions/canvas-goal-capture.js +83 -0
- package/dist/pi-extensions/canvas-inbox-watcher.d.ts +25 -0
- package/dist/pi-extensions/canvas-inbox-watcher.js +942 -0
- package/dist/pi-extensions/canvas-passive-context.d.ts +32 -0
- package/dist/pi-extensions/canvas-passive-context.js +134 -0
- package/dist/pi-extensions/canvas-recap.d.ts +41 -0
- package/dist/pi-extensions/canvas-recap.js +263 -0
- package/dist/pi-extensions/canvas-stophook.d.ts +53 -0
- package/dist/pi-extensions/canvas-stophook.js +985 -0
- package/dist/pi-extensions/canvas-structured-output.d.ts +9 -0
- package/dist/pi-extensions/canvas-structured-output.js +155 -0
- package/dist/prompts/review.d.ts +2 -0
- package/dist/prompts/review.js +130 -0
- package/dist/prompts/view.d.ts +7 -0
- package/dist/prompts/view.js +172 -0
- package/dist/suppress-experimental-warnings.d.ts +1 -0
- package/dist/suppress-experimental-warnings.js +15 -0
- package/dist/types.d.ts +297 -0
- package/dist/types.js +153 -0
- package/dist/web/ViewChrome.d.ts +7 -0
- package/dist/web/ViewChrome.js +28 -0
- package/dist/web/ViewPane.d.ts +39 -0
- package/dist/web/ViewPane.js +48 -0
- package/dist/web/index.d.ts +8 -0
- package/dist/web/index.js +22 -0
- package/dist/web/runtime.d.ts +39 -0
- package/dist/web/runtime.js +232 -0
- package/dist/web/states.d.ts +24 -0
- package/dist/web/states.js +24 -0
- package/dist/web/transport-http.d.ts +5 -0
- package/dist/web/transport-http.js +34 -0
- package/dist/web/transport-stream.d.ts +3 -0
- package/dist/web/transport-stream.js +204 -0
- package/dist/web-client/apple-touch-icon.png +0 -0
- package/dist/web-client/assets/fragment-mono-latin-400-normal-BYwT3kSJ.woff +0 -0
- package/dist/web-client/assets/fragment-mono-latin-400-normal-yxdJ5AmL.woff2 +0 -0
- package/dist/web-client/assets/fragment-mono-latin-ext-400-normal-BbKYyvR9.woff2 +0 -0
- package/dist/web-client/assets/fragment-mono-latin-ext-400-normal-CT4YFKeK.woff +0 -0
- package/dist/web-client/assets/index-BpyZGBhI.js +79 -0
- package/dist/web-client/assets/index-CpEl9LTS.css +2 -0
- package/dist/web-client/assets/martian-mono-cyrillic-wght-normal-B84CD5C_.woff2 +0 -0
- package/dist/web-client/assets/martian-mono-latin-ext-wght-normal-DlL6xMw5.woff2 +0 -0
- package/dist/web-client/assets/martian-mono-latin-wght-normal-5W32yIyr.woff2 +0 -0
- package/dist/web-client/assets/workbox-window.prod.es5-Bd17z0YL.js +2 -0
- package/dist/web-client/icon-192.png +0 -0
- package/dist/web-client/icon-512.png +0 -0
- package/dist/web-client/icon-maskable-512.png +0 -0
- package/dist/web-client/index.html +17 -0
- package/dist/web-client/manifest.webmanifest +1 -0
- package/dist/web-client/sw.js +1 -0
- package/docs/compat/hearth-crtr-v1.md +187 -0
- package/docs/compat/hearth-crtr-v2.md +185 -0
- package/docs/compat/hearth-crtr-v3.md +184 -0
- package/docs/compat/hearth-crtr-v4.md +188 -0
- package/docs/compat/hearth-crtr-v5.md +175 -0
- package/docs/public-api.md +77 -0
- package/package.json +156 -0
- package/runtime.lock.json +12919 -0
- package/scripts/install-runtime.mjs +308 -0
- package/scripts/patch-pi-tree-root-ordering.mjs +57 -0
- package/scripts/postinstall.mjs +33 -0
- package/scripts/runtime-lock.mjs +26 -0
|
@@ -0,0 +1,2310 @@
|
|
|
1
|
+
import { BROKER_LIMIT_OVERRIDE_PRECEDENCE } from './setup.js';
|
|
2
|
+
import { getMarkdownTheme, getSelectListTheme, getSettingsListTheme } from '@earendil-works/pi-coding-agent';
|
|
3
|
+
import { TUI, ProcessTerminal, Input, matchesKey, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
|
|
4
|
+
import { LoginDialogComponent, ModelRegistry, ModelRuntime, ModelSelectorComponent, ThinkingSelectorComponent, SettingsManager } from '@earendil-works/pi-coding-agent';
|
|
5
|
+
import { readAuthCredentials } from '../../core/auth-file.js';
|
|
6
|
+
import { PoolCredentialStore } from '../../core/pool-credential-store.js';
|
|
7
|
+
import { dialogAuthInteraction } from '../../core/auth-interaction.js';
|
|
8
|
+
import { execFile } from 'node:child_process';
|
|
9
|
+
import { basename, dirname, join } from 'node:path';
|
|
10
|
+
import { applyTheme, defaultAgentDir } from '../../clients/attach/config.js';
|
|
11
|
+
import { ANTHROPIC_PROVIDER_ID, OPENAI_CODEX_PROVIDER_ID, isManagedProvider, promoteSubscription, readSubscriptionPool, renameSubscription, } from '../../core/subscription-state.js';
|
|
12
|
+
import { removeProviderRow } from '../../core/provider-management.js';
|
|
13
|
+
import { readConfig, readRawConfigAtRoot, readRawScopeConfig, updateRawConfigAtomically, persistDefaultKindModel, persistModelLadders, readMergedLaunchConfig } from '../../core/config.js';
|
|
14
|
+
import { findProjectScopeRoots, userScopeRoot } from '../../core/scope.js';
|
|
15
|
+
import { loadProfileManifest, profileRoot } from '../../core/profiles/manifest.js';
|
|
16
|
+
import { BINDING_CATALOG, formatBinding, formatGesture, matchesPiTuiInput, persistUserKeybindings, resolveKeybindings, KeybindingConcurrentEditError, KeybindingValidationError, } from '../../core/keybindings/index.js';
|
|
17
|
+
import { configuredLadderProviders, inferPortableModelSelection } from '../../core/runtime/model-selection.js';
|
|
18
|
+
import { cliClient } from '../api-client.js';
|
|
19
|
+
import { installTmuxBindings } from '../../core/runtime/tmux-chrome.js';
|
|
20
|
+
const ANSI_GREEN = (s) => `\x1b[32m${s}\x1b[39m`;
|
|
21
|
+
const ANSI_YELLOW = (s) => `\x1b[33m${s}\x1b[39m`;
|
|
22
|
+
const theme = {
|
|
23
|
+
fg(role, text) {
|
|
24
|
+
switch (role) {
|
|
25
|
+
case 'border':
|
|
26
|
+
return getMarkdownTheme().hr(text);
|
|
27
|
+
case 'accent':
|
|
28
|
+
return getMarkdownTheme().heading(text);
|
|
29
|
+
case 'dim':
|
|
30
|
+
return getSettingsListTheme().description(text);
|
|
31
|
+
case 'muted':
|
|
32
|
+
return getSelectListTheme().description(text);
|
|
33
|
+
case 'mdLink':
|
|
34
|
+
return getMarkdownTheme().link(text);
|
|
35
|
+
case 'mdLinkUrl':
|
|
36
|
+
return getMarkdownTheme().linkUrl(text);
|
|
37
|
+
case 'success':
|
|
38
|
+
return ANSI_GREEN(text);
|
|
39
|
+
case 'warning':
|
|
40
|
+
return ANSI_YELLOW(text);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
bg(_role, text) {
|
|
44
|
+
return text;
|
|
45
|
+
},
|
|
46
|
+
bold(text) {
|
|
47
|
+
return getMarkdownTheme().bold(text);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
import { buildSetupInitialState, executeSetupSubmission, formatSetupExecutionSummary, reconcileInboxFrontDoor, renderSetupStaticInstructions, resolveExaKeyPath, detectExaKey, SetupKeybindingsDraft, } from './setup-core.js';
|
|
51
|
+
function wrapText(text, width) {
|
|
52
|
+
const clean = text.trim();
|
|
53
|
+
if (clean === '')
|
|
54
|
+
return [''];
|
|
55
|
+
if (width <= 1)
|
|
56
|
+
return [truncateToWidth(clean, width)];
|
|
57
|
+
const words = clean.split(/\s+/);
|
|
58
|
+
const lines = [];
|
|
59
|
+
let current = '';
|
|
60
|
+
for (const word of words) {
|
|
61
|
+
if (current === '') {
|
|
62
|
+
current = word;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const next = `${current} ${word}`;
|
|
66
|
+
if (truncateToWidth(next, width) === next) {
|
|
67
|
+
current = next;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
lines.push(truncateToWidth(current, width));
|
|
71
|
+
current = word;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (current !== '')
|
|
75
|
+
lines.push(truncateToWidth(current, width));
|
|
76
|
+
return lines.length > 0 ? lines : [''];
|
|
77
|
+
}
|
|
78
|
+
function currentWidth() {
|
|
79
|
+
return Math.max(1, process.stdout.columns ?? 80);
|
|
80
|
+
}
|
|
81
|
+
function toolLabel(tool) {
|
|
82
|
+
return tool === 'nvim' ? 'nvim' : 'tmux';
|
|
83
|
+
}
|
|
84
|
+
function positiveInteger(value) {
|
|
85
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1)
|
|
86
|
+
return undefined;
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
function parsePositiveInteger(value) {
|
|
90
|
+
if (!/^\d+$/.test(value))
|
|
91
|
+
return undefined;
|
|
92
|
+
return positiveInteger(Number(value));
|
|
93
|
+
}
|
|
94
|
+
/** Inline badge for an optional API-key tab header: green ✓ when a key is
|
|
95
|
+
* already resolvable (naming its source so an env-provided key isn't mistaken
|
|
96
|
+
* for the writable file), dim — when absent. */
|
|
97
|
+
function keyStatusBadge(presence, envVar) {
|
|
98
|
+
if (!presence.present)
|
|
99
|
+
return theme.fg('dim', ' · not set');
|
|
100
|
+
const where = presence.source === 'env' ? `${envVar} env` : 'saved';
|
|
101
|
+
return theme.fg('success', ` ✓ configured (${where})`);
|
|
102
|
+
}
|
|
103
|
+
function renderRows(lines, width) {
|
|
104
|
+
return lines.map((line) => truncateToWidth(line, width));
|
|
105
|
+
}
|
|
106
|
+
function padAnsi(text, width) {
|
|
107
|
+
const used = visibleWidth(text);
|
|
108
|
+
if (used >= width)
|
|
109
|
+
return truncateToWidth(text, width);
|
|
110
|
+
return `${text}${' '.repeat(width - used)}`;
|
|
111
|
+
}
|
|
112
|
+
function rule(width) {
|
|
113
|
+
return theme.fg('border', '─'.repeat(Math.max(0, width)));
|
|
114
|
+
}
|
|
115
|
+
function tabPill(label, active) {
|
|
116
|
+
return active
|
|
117
|
+
? theme.bg('selectedBg', theme.fg('accent', theme.bold(` ${label} `)))
|
|
118
|
+
: theme.fg('dim', ` ${label} `);
|
|
119
|
+
}
|
|
120
|
+
/** Centered, selection-following [start, end) slice of `count` items that
|
|
121
|
+
* always includes `selected`, clamped to at most `capacity` entries. Mirrors
|
|
122
|
+
* the oauth/config/session selector formula used elsewhere in pi. Exported for
|
|
123
|
+
* direct unit coverage of the windowing math (see setup-providers-viewport.test.ts). */
|
|
124
|
+
export function visibleRange(count, selected, capacity) {
|
|
125
|
+
if (count <= 0)
|
|
126
|
+
return { start: 0, end: 0 };
|
|
127
|
+
const cap = Math.max(1, Math.min(capacity, count));
|
|
128
|
+
const start = Math.max(0, Math.min(selected - Math.floor(cap / 2), count - cap));
|
|
129
|
+
return { start, end: Math.min(count, start + cap) };
|
|
130
|
+
}
|
|
131
|
+
function framed(lines, width) {
|
|
132
|
+
if (width < 4)
|
|
133
|
+
return lines.map((line) => truncateToWidth(line, width));
|
|
134
|
+
const innerWidth = width - 4;
|
|
135
|
+
const border = theme.fg('border', '│');
|
|
136
|
+
const top = theme.fg('border', `┌${'─'.repeat(width - 2)}┐`);
|
|
137
|
+
const bottom = theme.fg('border', `└${'─'.repeat(width - 2)}┘`);
|
|
138
|
+
const body = lines.map((line) => {
|
|
139
|
+
const content = padAnsi(truncateToWidth(line, innerWidth), innerWidth);
|
|
140
|
+
return `${border} ${content} ${border}`;
|
|
141
|
+
});
|
|
142
|
+
return [top, ...body, bottom];
|
|
143
|
+
}
|
|
144
|
+
// The frame's top/bottom border rows, spent by `framed()`.
|
|
145
|
+
const FRAME_OVERHEAD = 2;
|
|
146
|
+
// Models panel chrome: title, subtitle, blank — the first lines dropped when the
|
|
147
|
+
// panel body has to fit a short terminal.
|
|
148
|
+
const MODELS_CHROME_LINES = 3;
|
|
149
|
+
/** Fits a modal's static content lines into `budget`, keeping the tail — the
|
|
150
|
+
* actionable line every modal ends on (a confirm prompt, a live text input,
|
|
151
|
+
* a login dialog's current prompt/hint) — and dropping from the head, where
|
|
152
|
+
* informational chrome (title, count, a dialog's older status lines) lives.
|
|
153
|
+
* Mirrors the roster/catalog priority (mandatory content survives, chrome
|
|
154
|
+
* collapses first) for the panel's static modal bodies. */
|
|
155
|
+
function fitTail(lines, budget) {
|
|
156
|
+
return budget >= lines.length ? lines : lines.slice(lines.length - budget);
|
|
157
|
+
}
|
|
158
|
+
// Every panel interested in the same auth file shares its in-flight snapshot. The setup wizard
|
|
159
|
+
// can rebuild panels faster than a cross-process lock round-trip; sharing that read avoids a
|
|
160
|
+
// backlog of obsolete lock contenders while each panel still updates from the completed snapshot.
|
|
161
|
+
const pendingAuthSnapshots = new Map();
|
|
162
|
+
function readAuthSnapshot(authPath) {
|
|
163
|
+
const existing = pendingAuthSnapshots.get(authPath);
|
|
164
|
+
if (existing !== undefined)
|
|
165
|
+
return existing;
|
|
166
|
+
const pending = readAuthCredentials(authPath);
|
|
167
|
+
pendingAuthSnapshots.set(authPath, pending);
|
|
168
|
+
void pending.then(() => { if (pendingAuthSnapshots.get(authPath) === pending)
|
|
169
|
+
pendingAuthSnapshots.delete(authPath); }, () => { if (pendingAuthSnapshots.get(authPath) === pending)
|
|
170
|
+
pendingAuthSnapshots.delete(authPath); });
|
|
171
|
+
return pending;
|
|
172
|
+
}
|
|
173
|
+
/** Curated setup-catalog view over pi's OAuth providers + the model registry. */
|
|
174
|
+
export function buildProviderCatalog(runtime, registry) {
|
|
175
|
+
const oauth = runtime.getProviders().filter((provider) => provider.auth.oauth !== undefined);
|
|
176
|
+
const oauthIds = new Set(oauth.map((provider) => provider.id));
|
|
177
|
+
const seen = new Set();
|
|
178
|
+
return [
|
|
179
|
+
...oauth.map((provider) => ({
|
|
180
|
+
providerId: provider.id,
|
|
181
|
+
name: provider.name,
|
|
182
|
+
managed: provider.id === ANTHROPIC_PROVIDER_ID || provider.id === OPENAI_CODEX_PROVIDER_ID,
|
|
183
|
+
authType: 'oauth',
|
|
184
|
+
})),
|
|
185
|
+
...registry.getAll().map((model) => ({
|
|
186
|
+
providerId: model.provider,
|
|
187
|
+
name: registry.getProviderDisplayName(model.provider),
|
|
188
|
+
managed: model.provider === ANTHROPIC_PROVIDER_ID || model.provider === OPENAI_CODEX_PROVIDER_ID,
|
|
189
|
+
authType: oauthIds.has(model.provider) ? 'oauth' : 'api_key',
|
|
190
|
+
})),
|
|
191
|
+
].filter((provider) => !seen.has(provider.providerId) && Boolean(seen.add(provider.providerId)));
|
|
192
|
+
}
|
|
193
|
+
/** Classifies a `startLogin` failure into a user-facing status line. */
|
|
194
|
+
export function classifyLoginFailure(error, aborted) {
|
|
195
|
+
if (aborted)
|
|
196
|
+
return 'Login cancelled';
|
|
197
|
+
if (error instanceof Error && error.name === 'AbortError')
|
|
198
|
+
return 'Login cancelled';
|
|
199
|
+
return `Login error: ${error instanceof Error ? error.message : String(error)}`;
|
|
200
|
+
}
|
|
201
|
+
class ProviderPanel {
|
|
202
|
+
tui;
|
|
203
|
+
agentDir;
|
|
204
|
+
runtime;
|
|
205
|
+
registry;
|
|
206
|
+
renameInput = new Input();
|
|
207
|
+
rows = [];
|
|
208
|
+
selected = 0;
|
|
209
|
+
mode = 'list';
|
|
210
|
+
notice = '';
|
|
211
|
+
catalog = [];
|
|
212
|
+
catalogIndex = 0;
|
|
213
|
+
loginProvider;
|
|
214
|
+
dialog;
|
|
215
|
+
loginFlow;
|
|
216
|
+
mutationInFlight = false;
|
|
217
|
+
reloadGeneration = 0;
|
|
218
|
+
disposed = false;
|
|
219
|
+
// Wired by the host wizard to bust its render-line cache. The panel proxies pi's
|
|
220
|
+
// LoginDialogComponent (it is not a real pi TUI child), so the host only repaints on
|
|
221
|
+
// synchronous input. startLogin drives OAuth through async promise chains whose state
|
|
222
|
+
// transitions land between keystrokes; notifyChange() lets each one force a fresh frame.
|
|
223
|
+
onChange;
|
|
224
|
+
constructor(tui, agentDir, runtime, registry) {
|
|
225
|
+
this.tui = tui;
|
|
226
|
+
this.agentDir = agentDir;
|
|
227
|
+
this.runtime = runtime;
|
|
228
|
+
this.registry = registry;
|
|
229
|
+
this.renameInput.onSubmit = () => this.rename();
|
|
230
|
+
this.renameInput.onEscape = () => { this.mode = 'list'; };
|
|
231
|
+
this.reload();
|
|
232
|
+
}
|
|
233
|
+
// Repaint the host after an async login transition: bust the wizard's cached lines
|
|
234
|
+
// (onChange) so render() recomputes the NEW state, then ask pi's loop to draw a frame.
|
|
235
|
+
notifyChange() {
|
|
236
|
+
this.onChange?.();
|
|
237
|
+
this.tui.requestRender();
|
|
238
|
+
}
|
|
239
|
+
/** auth.json changed under us (a login landed, a provider was removed). pi 0.82
|
|
240
|
+
* serves provider auth status from the runtime's SNAPSHOT rather than a live file
|
|
241
|
+
* read, so the snapshot has to be re-taken before the roster can see the change.
|
|
242
|
+
* `refresh()` is local-only here (the runtime is composed with model network access
|
|
243
|
+
* off), so this is a credential re-list, not a catalog fetch. */
|
|
244
|
+
reloadAfterAuthChange() {
|
|
245
|
+
this.reload();
|
|
246
|
+
void this.registry.refresh().then(() => {
|
|
247
|
+
this.reload();
|
|
248
|
+
this.notifyChange();
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
reload() {
|
|
252
|
+
const registry = this.registry;
|
|
253
|
+
const authPath = join(this.agentDir, 'auth.json');
|
|
254
|
+
const rows = [];
|
|
255
|
+
for (const provider of buildProviderCatalog(this.runtime, registry)) {
|
|
256
|
+
const status = registry.getProviderAuthStatus(provider.providerId);
|
|
257
|
+
if (provider.managed) {
|
|
258
|
+
const pool = readSubscriptionPool(provider.providerId);
|
|
259
|
+
if (pool.length === 0 && !status.source)
|
|
260
|
+
continue;
|
|
261
|
+
// Every stored account carries a credential, so pool occupancy is what makes the
|
|
262
|
+
// provider configured.
|
|
263
|
+
rows.push({ ...provider, configured: pool.length > 0 || status.configured, source: status.source, sourceLabel: status.label });
|
|
264
|
+
pool.forEach((account, index) => rows.push({ ...provider, label: account.label, preferred: index === 0, cooldownUntil: account.rateLimitedUntil, accountId: account.accountId }));
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
if (!status.source)
|
|
268
|
+
continue;
|
|
269
|
+
rows.push({ ...provider, configured: status.configured, source: status.source, sourceLabel: status.label });
|
|
270
|
+
}
|
|
271
|
+
this.rows = rows;
|
|
272
|
+
this.selected = Math.min(this.selected, Math.max(0, rows.length));
|
|
273
|
+
const generation = ++this.reloadGeneration;
|
|
274
|
+
void readAuthSnapshot(authPath).then((credentials) => {
|
|
275
|
+
if (this.disposed || generation !== this.reloadGeneration)
|
|
276
|
+
return;
|
|
277
|
+
for (const row of this.rows) {
|
|
278
|
+
if (row.managed)
|
|
279
|
+
continue;
|
|
280
|
+
const accountId = credentials[row.providerId]?.accountId;
|
|
281
|
+
row.accountId = typeof accountId === 'string' ? accountId : undefined;
|
|
282
|
+
}
|
|
283
|
+
this.notifyChange();
|
|
284
|
+
}).catch((error) => {
|
|
285
|
+
if (this.disposed || generation !== this.reloadGeneration)
|
|
286
|
+
return;
|
|
287
|
+
this.notice = error instanceof Error ? error.message : String(error);
|
|
288
|
+
this.notifyChange();
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
selectedRow() { return this.rows[this.selected]; }
|
|
292
|
+
openBrowser(url) {
|
|
293
|
+
const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'cmd' : 'xdg-open';
|
|
294
|
+
const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
|
|
295
|
+
execFile(command, args, { timeout: 5_000 }, () => { });
|
|
296
|
+
}
|
|
297
|
+
openCatalog() {
|
|
298
|
+
this.catalog = buildProviderCatalog(this.runtime, this.registry);
|
|
299
|
+
this.catalogIndex = 0;
|
|
300
|
+
this.mode = 'catalog';
|
|
301
|
+
}
|
|
302
|
+
startLogin(provider, label) {
|
|
303
|
+
this.loginProvider = provider;
|
|
304
|
+
let flow;
|
|
305
|
+
const complete = (message) => {
|
|
306
|
+
if (!flow.active || this.loginFlow !== flow)
|
|
307
|
+
return;
|
|
308
|
+
flow.active = false;
|
|
309
|
+
this.loginFlow = undefined;
|
|
310
|
+
this.dialog = undefined;
|
|
311
|
+
this.mode = 'list';
|
|
312
|
+
this.notice = message;
|
|
313
|
+
this.reloadAfterAuthChange();
|
|
314
|
+
this.notifyChange();
|
|
315
|
+
};
|
|
316
|
+
const dialog = new LoginDialogComponent(this.tui, provider.providerId, (success, message) => {
|
|
317
|
+
if (!success)
|
|
318
|
+
complete(message ? `Login failed: ${message}` : 'Login cancelled');
|
|
319
|
+
}, provider.name);
|
|
320
|
+
flow = { dialog, active: true, committing: false };
|
|
321
|
+
this.loginFlow = flow;
|
|
322
|
+
this.dialog = dialog;
|
|
323
|
+
this.mode = 'login';
|
|
324
|
+
const handleDialogInput = dialog.handleInput.bind(dialog);
|
|
325
|
+
dialog.handleInput = (data) => { if (!flow.committing)
|
|
326
|
+
handleDialogInput(data); };
|
|
327
|
+
const isActive = () => flow.active && this.loginFlow === flow && !dialog.signal.aborted;
|
|
328
|
+
const beginCommit = () => {
|
|
329
|
+
if (!isActive())
|
|
330
|
+
return false;
|
|
331
|
+
flow.committing = true;
|
|
332
|
+
dialog.showDetails(['Saving credentials…']);
|
|
333
|
+
return true;
|
|
334
|
+
};
|
|
335
|
+
const fail = (error) => {
|
|
336
|
+
complete(classifyLoginFailure(error, dialog.signal.aborted));
|
|
337
|
+
};
|
|
338
|
+
if (provider.authType === 'api_key') {
|
|
339
|
+
void dialog.showPrompt(`Enter API key for ${provider.name}:`, 'sk-...').then(async (key) => {
|
|
340
|
+
if (!isActive())
|
|
341
|
+
return;
|
|
342
|
+
if (!key.trim()) {
|
|
343
|
+
complete('No key entered — login cancelled');
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
// Interactive collection stays client-side (TTY); the WRITE moves to the
|
|
347
|
+
// API (PUT /model-auth/{provider}) so this process never touches auth.json.
|
|
348
|
+
if (!beginCommit())
|
|
349
|
+
return;
|
|
350
|
+
await cliClient().installCredential(provider.providerId, { kind: 'api_key', api_key: key.trim() });
|
|
351
|
+
complete(`API key saved for ${provider.name}`);
|
|
352
|
+
}).catch(fail);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
// pi 0.82 collapsed the six login callbacks into one AuthInteraction; the adapter
|
|
356
|
+
// onto LoginDialogComponent is shared with the attach viewer's /login overlay.
|
|
357
|
+
const interaction = dialogAuthInteraction(dialog, {
|
|
358
|
+
openBrowser: (url) => this.openBrowser(url),
|
|
359
|
+
onChange: () => this.notifyChange(),
|
|
360
|
+
isActive,
|
|
361
|
+
});
|
|
362
|
+
const oauth = this.runtime.getProvider(provider.providerId)?.auth.oauth;
|
|
363
|
+
if (!oauth) {
|
|
364
|
+
complete(`Unknown OAuth provider: ${provider.providerId}`);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (!provider.managed) {
|
|
368
|
+
// Collect tokens client-side (browser/TTY), then WRITE via the API so this
|
|
369
|
+
// process never touches auth.json. In 0.82 `provider.auth.oauth.login()`
|
|
370
|
+
// RETURNS the credential without persisting it (persistence is app-owned),
|
|
371
|
+
// which is exactly the collect-without-persist half this needs.
|
|
372
|
+
void oauth.login(interaction).then(async (credentials) => {
|
|
373
|
+
if (!isActive())
|
|
374
|
+
return;
|
|
375
|
+
if (!beginCommit())
|
|
376
|
+
return;
|
|
377
|
+
// Forward non-standard credential keys (e.g. github-copilot's `enterpriseUrl`)
|
|
378
|
+
// so enterprise routing and token refresh retain the provider data they require.
|
|
379
|
+
// The named tokens and store `type` are handled separately; all other keys travel
|
|
380
|
+
// through `extra` and the handler writes them into auth.json.
|
|
381
|
+
const { type: _type, access, refresh, expires, ...extra } = credentials;
|
|
382
|
+
await cliClient().installCredential(provider.providerId, {
|
|
383
|
+
kind: 'oauth',
|
|
384
|
+
access_token: access,
|
|
385
|
+
refresh_token: refresh,
|
|
386
|
+
expires_at: new Date(expires).toISOString(),
|
|
387
|
+
...(Object.keys(extra).length > 0 ? { extra } : {}),
|
|
388
|
+
});
|
|
389
|
+
if (isActive())
|
|
390
|
+
complete(`Logged in to ${provider.name}`);
|
|
391
|
+
}).catch(fail);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
// Snapshot the newest pool cooldown before OAuth so a later 429 remains authoritative.
|
|
395
|
+
const lastRateLimitedAt = Math.max(0, ...readSubscriptionPool(provider.providerId).map((entry) => entry.lastRateLimitedAt));
|
|
396
|
+
void oauth.login(interaction).then(async (credential) => {
|
|
397
|
+
if (!isActive())
|
|
398
|
+
return;
|
|
399
|
+
if (!beginCommit())
|
|
400
|
+
return;
|
|
401
|
+
const accountId = typeof credential.accountId === 'string' && credential.accountId.trim() ? credential.accountId.trim() : undefined;
|
|
402
|
+
// Collected via pi's managed login (client); the API persists it into the pool, where
|
|
403
|
+
// account identity selects an existing row or labels a newly seen account.
|
|
404
|
+
await cliClient().installCredential(provider.providerId, {
|
|
405
|
+
kind: 'managed_account',
|
|
406
|
+
...(label ? { label } : {}),
|
|
407
|
+
...(label ? {} : { auto_label: true }),
|
|
408
|
+
...(accountId ? { account_id: accountId } : {}),
|
|
409
|
+
access_token: credential.access,
|
|
410
|
+
refresh_token: credential.refresh,
|
|
411
|
+
expires_at: new Date(credential.expires).toISOString(),
|
|
412
|
+
last_rate_limited_at: lastRateLimitedAt,
|
|
413
|
+
});
|
|
414
|
+
if (isActive())
|
|
415
|
+
complete(`Logged in to ${provider.name}`);
|
|
416
|
+
}).catch(fail);
|
|
417
|
+
}
|
|
418
|
+
isNestedFlowActive() { return this.mode === 'login'; }
|
|
419
|
+
dispose() {
|
|
420
|
+
this.disposed = true;
|
|
421
|
+
const flow = this.loginFlow;
|
|
422
|
+
if (!flow)
|
|
423
|
+
return;
|
|
424
|
+
flow.active = false;
|
|
425
|
+
this.loginFlow = undefined;
|
|
426
|
+
this.dialog = undefined;
|
|
427
|
+
flow.dialog.handleInput('\u001b');
|
|
428
|
+
}
|
|
429
|
+
runMutation(operation) {
|
|
430
|
+
if (this.mutationInFlight)
|
|
431
|
+
return;
|
|
432
|
+
this.mutationInFlight = true;
|
|
433
|
+
void operation().catch((error) => {
|
|
434
|
+
this.notice = error instanceof Error ? error.message : String(error);
|
|
435
|
+
}).finally(() => {
|
|
436
|
+
this.mutationInFlight = false;
|
|
437
|
+
this.notifyChange();
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
rename() {
|
|
441
|
+
const row = this.selectedRow();
|
|
442
|
+
if (!row?.managed || !row.label)
|
|
443
|
+
return;
|
|
444
|
+
this.mode = 'list';
|
|
445
|
+
this.runMutation(async () => {
|
|
446
|
+
await renameSubscription(row.providerId, row.label, this.renameInput.getValue());
|
|
447
|
+
this.notice = `Renamed ${row.name} account`;
|
|
448
|
+
this.reload();
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
remove(row) {
|
|
452
|
+
this.runMutation(async () => {
|
|
453
|
+
this.notice = await removeProviderRow(this.agentDir, row);
|
|
454
|
+
this.reloadAfterAuthChange();
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
promote(row) {
|
|
458
|
+
this.runMutation(async () => {
|
|
459
|
+
await promoteSubscription(row.providerId, row.label);
|
|
460
|
+
this.notice = `Preferred ${row.name} account`;
|
|
461
|
+
this.reload();
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
handleInput(data) {
|
|
465
|
+
if (this.mode === 'login') {
|
|
466
|
+
this.dialog?.handleInput(data);
|
|
467
|
+
return true;
|
|
468
|
+
}
|
|
469
|
+
if (this.mutationInFlight)
|
|
470
|
+
return true;
|
|
471
|
+
if (this.mode === 'rename' || this.mode === 'label') {
|
|
472
|
+
this.renameInput.handleInput(data);
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
if (this.mode === 'catalog') {
|
|
476
|
+
if (matchesKey(data, 'escape')) {
|
|
477
|
+
this.mode = 'list';
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
480
|
+
if (matchesKey(data, 'j') || matchesKey(data, 'down')) {
|
|
481
|
+
this.catalogIndex = Math.min(this.catalog.length - 1, this.catalogIndex + 1);
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
if (matchesKey(data, 'k') || matchesKey(data, 'up')) {
|
|
485
|
+
this.catalogIndex = Math.max(0, this.catalogIndex - 1);
|
|
486
|
+
return true;
|
|
487
|
+
}
|
|
488
|
+
if (matchesKey(data, 'enter')) {
|
|
489
|
+
const provider = this.catalog[this.catalogIndex];
|
|
490
|
+
if (provider.managed) {
|
|
491
|
+
this.loginProvider = provider;
|
|
492
|
+
this.renameInput.setValue('');
|
|
493
|
+
this.renameInput.onSubmit = () => { const label = this.renameInput.getValue().trim(); if (label)
|
|
494
|
+
this.startLogin(provider, label); };
|
|
495
|
+
this.mode = 'label';
|
|
496
|
+
}
|
|
497
|
+
else
|
|
498
|
+
this.startLogin(provider);
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
if (this.mode === 'remove') {
|
|
504
|
+
if (matchesKey(data, 'y') || matchesKey(data, 'enter')) {
|
|
505
|
+
const row = this.selectedRow();
|
|
506
|
+
if (row && (row.managed || row.configured)) {
|
|
507
|
+
this.remove(row);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
this.mode = 'list';
|
|
511
|
+
return true;
|
|
512
|
+
}
|
|
513
|
+
if (matchesKey(data, 'j') || matchesKey(data, 'down')) {
|
|
514
|
+
this.selected = Math.min(this.rows.length, this.selected + 1);
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
if (matchesKey(data, 'k') || matchesKey(data, 'up')) {
|
|
518
|
+
this.selected = Math.max(0, this.selected - 1);
|
|
519
|
+
return true;
|
|
520
|
+
}
|
|
521
|
+
const row = this.selectedRow();
|
|
522
|
+
if (matchesKey(data, 'p') && row?.managed && row.label) {
|
|
523
|
+
this.promote(row);
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
if (matchesKey(data, 'r') && row?.managed && row.label) {
|
|
527
|
+
this.renameInput.setValue(row.label);
|
|
528
|
+
this.renameInput.onSubmit = () => this.rename();
|
|
529
|
+
this.mode = 'rename';
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
532
|
+
if (matchesKey(data, 'x') && (row?.managed || row?.configured)) {
|
|
533
|
+
this.mode = 'remove';
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
if (matchesKey(data, 'a')) {
|
|
537
|
+
this.openCatalog();
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
const viewOnly = row?.source === 'environment' || row?.source === 'runtime';
|
|
541
|
+
if (matchesKey(data, 'l') && row && !viewOnly) {
|
|
542
|
+
if (row.managed && row.label)
|
|
543
|
+
this.startLogin(row, row.label);
|
|
544
|
+
else
|
|
545
|
+
this.startLogin(row);
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
if (matchesKey(data, 'enter')) {
|
|
549
|
+
if (row && !viewOnly)
|
|
550
|
+
this.startLogin(row, row.managed && row.label ? row.label : undefined);
|
|
551
|
+
else if (!row)
|
|
552
|
+
this.openCatalog();
|
|
553
|
+
return true;
|
|
554
|
+
}
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
// `height` is the panel's full framed budget (as returned by `framed()` — border
|
|
558
|
+
// rows included), supplied by the host wizard's live terminal-row callback. It can
|
|
559
|
+
// shrink to just a couple of rows, so every part of the panel below the mandatory
|
|
560
|
+
// content is chrome that collapses under pressure. For the roster/catalog list this
|
|
561
|
+
// is: the frame itself drops first (there's no room for both borders and a row),
|
|
562
|
+
// then the title/count header, then the hint/notice/empty-state line, then the
|
|
563
|
+
// position indicator — never letting the selected row scroll out of view. The
|
|
564
|
+
// login/rename/label/remove modals have no list to window, so they apply the same
|
|
565
|
+
// budget via `fitTail`: their bodies always end on the actionable line (a live
|
|
566
|
+
// input, a confirm prompt, a login dialog's current prompt), so clipping from the
|
|
567
|
+
// head sheds chrome (title/count/older status lines) first and keeps that line.
|
|
568
|
+
render(width, height) {
|
|
569
|
+
const titleLine = theme.fg('accent', theme.bold('Providers'));
|
|
570
|
+
const countLine = theme.fg('dim', `${this.rows.filter((row) => row.label === undefined).length} configured`);
|
|
571
|
+
const useFrame = height >= FRAME_OVERHEAD + 1;
|
|
572
|
+
const contentBudget = Math.max(1, useFrame ? height - FRAME_OVERHEAD : height);
|
|
573
|
+
let body;
|
|
574
|
+
if (this.mode === 'login') {
|
|
575
|
+
body = fitTail(this.dialog?.render(Math.max(1, width - 4)) ?? [], contentBudget);
|
|
576
|
+
}
|
|
577
|
+
else if (this.mode === 'rename' || this.mode === 'label') {
|
|
578
|
+
body = fitTail([titleLine, countLine, '', theme.fg('accent', this.mode === 'rename' ? 'Rename account' : `Name the ${this.loginProvider?.name ?? 'provider'} account`), ...this.renameInput.render(Math.max(1, width - 8))], contentBudget);
|
|
579
|
+
}
|
|
580
|
+
else if (this.mode === 'remove') {
|
|
581
|
+
const target = this.selectedRow();
|
|
582
|
+
const label = target?.label ?? (target?.managed ? `${target.name} · all accounts` : target?.name ?? 'account');
|
|
583
|
+
body = fitTail([titleLine, countLine, '', theme.fg('warning', `Remove ${label}? y/enter confirm · any other key cancel`)], contentBudget);
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
// The title/count header is the first chrome to give way: only as many of its
|
|
587
|
+
// two lines are kept as fit while still reserving at least one row for the
|
|
588
|
+
// mandatory selected entry.
|
|
589
|
+
const header = [titleLine, countLine].slice(0, Math.max(0, contentBudget - 1));
|
|
590
|
+
const remaining = contentBudget - header.length; // always >= 1
|
|
591
|
+
body = [...header];
|
|
592
|
+
if (this.mode === 'catalog') {
|
|
593
|
+
const items = this.catalog.length;
|
|
594
|
+
const clipped = items > remaining;
|
|
595
|
+
// Only trade a row for the position indicator when there's a spare row to trade;
|
|
596
|
+
// at `remaining === 1` the sole row goes to the mandatory selected entry instead.
|
|
597
|
+
const reserveIndicator = clipped && remaining >= 2;
|
|
598
|
+
const rowBudget = reserveIndicator ? remaining - 1 : remaining;
|
|
599
|
+
const { start, end } = visibleRange(items, this.catalogIndex, rowBudget);
|
|
600
|
+
let leftover = remaining - (end - start) - (reserveIndicator ? 1 : 0);
|
|
601
|
+
if (leftover > 0) {
|
|
602
|
+
body.push(theme.fg('dim', 'Select a provider to add · esc back'));
|
|
603
|
+
leftover -= 1;
|
|
604
|
+
}
|
|
605
|
+
for (let index = start; index < end; index++) {
|
|
606
|
+
const provider = this.catalog[index];
|
|
607
|
+
body.push(`${index === this.catalogIndex ? theme.fg('accent', '▶') : ' '} ${provider.name}`);
|
|
608
|
+
}
|
|
609
|
+
if (reserveIndicator)
|
|
610
|
+
body.push(theme.fg('dim', `(${this.catalogIndex + 1}/${items})`));
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
const totalEntries = this.rows.length + 1; // + the trailing "Add provider" sentinel
|
|
614
|
+
const clipped = totalEntries > remaining;
|
|
615
|
+
const reserveIndicator = clipped && remaining >= 2;
|
|
616
|
+
const rowBudget = reserveIndicator ? remaining - 1 : remaining;
|
|
617
|
+
const { start, end } = visibleRange(totalEntries, this.selected, rowBudget);
|
|
618
|
+
let leftover = remaining - (end - start) - (reserveIndicator ? 1 : 0);
|
|
619
|
+
const showEmpty = this.rows.length === 0 && leftover > 0;
|
|
620
|
+
if (showEmpty)
|
|
621
|
+
leftover -= 1;
|
|
622
|
+
const showNotice = Boolean(this.notice) && leftover > 0;
|
|
623
|
+
if (showEmpty)
|
|
624
|
+
body.push(theme.fg('warning', 'No provider configured yet.'));
|
|
625
|
+
for (let index = start; index < end; index++) {
|
|
626
|
+
if (index === this.rows.length) {
|
|
627
|
+
body.push(`${this.selected === this.rows.length ? theme.fg('accent', '▶') : ' '} ${theme.fg('accent', '+ Add provider')}`);
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
const row = this.rows[index];
|
|
631
|
+
const selected = index === this.selected ? theme.fg('accent', '▶') : ' ';
|
|
632
|
+
if (!row.label) {
|
|
633
|
+
const state = row.managed
|
|
634
|
+
? `${this.rows.filter((item) => item.providerId === row.providerId && item.label).length} accounts`
|
|
635
|
+
: row.source === 'environment' || row.source === 'runtime'
|
|
636
|
+
? `${row.source}${row.sourceLabel ? ` · ${row.sourceLabel}` : ''} (view only)`
|
|
637
|
+
: 'configured';
|
|
638
|
+
body.push(`${selected} ${theme.fg('accent', row.name)}${theme.fg('dim', ` ${state}`)}`);
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
const health = row.cooldownUntil && row.cooldownUntil > Date.now() ? `cooldown ${Math.ceil((row.cooldownUntil - Date.now()) / 60000)}m` : 'ready';
|
|
642
|
+
const identity = row.accountId ? ` · ${row.accountId.length > 12 ? `${row.accountId.slice(0, 8)}…${row.accountId.slice(-4)}` : row.accountId}` : '';
|
|
643
|
+
body.push(`${selected} ${row.preferred ? theme.fg('success', '●') : ' '} ${row.label}${theme.fg('dim', identity)} ${theme.fg('dim', health)}${row.preferred ? theme.fg('accent', ' preferred') : ''}`);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (reserveIndicator)
|
|
647
|
+
body.push(theme.fg('dim', `(${this.selected + 1}/${totalEntries})`));
|
|
648
|
+
if (showNotice)
|
|
649
|
+
body.push(theme.fg('dim', this.notice));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return useFrame ? framed(body, width) : body.map((line) => truncateToWidth(line, width));
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
const STRENGTHS = ['ultra', 'strong', 'medium', 'light'];
|
|
656
|
+
const LADDER_PROVIDER_KEYS = ['anthropic', 'openai'];
|
|
657
|
+
const THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
658
|
+
const RUNTIME_PROVIDER_ID = { anthropic: ANTHROPIC_PROVIDER_ID, openai: OPENAI_CODEX_PROVIDER_ID };
|
|
659
|
+
const PROVIDER_LABEL = { anthropic: 'Anthropic', openai: 'OpenAI' };
|
|
660
|
+
const KIND_COLUMNS = [
|
|
661
|
+
{ mode: 'base', dimension: 'provider' },
|
|
662
|
+
{ mode: 'base', dimension: 'strength' },
|
|
663
|
+
{ mode: 'orchestrator', dimension: 'provider' },
|
|
664
|
+
{ mode: 'orchestrator', dimension: 'strength' },
|
|
665
|
+
];
|
|
666
|
+
function modelConfigTargets() {
|
|
667
|
+
const userRoot = userScopeRoot();
|
|
668
|
+
const profileId = process.env['CRTR_PROFILE_ID'] || null;
|
|
669
|
+
let profileTarget;
|
|
670
|
+
if (profileId !== null) {
|
|
671
|
+
try {
|
|
672
|
+
const entry = loadProfileManifest(profileId);
|
|
673
|
+
profileTarget = { label: `Profile: ${entry.manifest.name}`, root: profileRoot(entry.profileId) };
|
|
674
|
+
}
|
|
675
|
+
catch {
|
|
676
|
+
// A stale profile env should not make setup unusable; user/project
|
|
677
|
+
// targets remain valid and launch resolution already ignores it.
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
const projectRoots = findProjectScopeRoots(process.cwd(), profileId);
|
|
681
|
+
const projectTargets = projectRoots.map((root) => ({
|
|
682
|
+
label: `Project: ${basename(dirname(root))}`,
|
|
683
|
+
root,
|
|
684
|
+
}));
|
|
685
|
+
return {
|
|
686
|
+
targets: [{ label: 'User', root: userRoot }, ...(profileTarget ? [profileTarget] : []), ...projectTargets],
|
|
687
|
+
precedenceRoots: [...projectRoots, ...(profileTarget ? [profileTarget.root] : []), userRoot],
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
/** Parse a model ref `<provider>/<modelId>:<level>` into parts. */
|
|
691
|
+
function parseModelRef(ref) {
|
|
692
|
+
if (!ref)
|
|
693
|
+
return {};
|
|
694
|
+
const trimmed = ref.trim();
|
|
695
|
+
const slash = trimmed.indexOf('/');
|
|
696
|
+
const provider = slash === -1 ? undefined : trimmed.slice(0, slash);
|
|
697
|
+
const rest = slash === -1 ? trimmed : trimmed.slice(slash + 1);
|
|
698
|
+
const m = rest.match(/^(.*?):(off|minimal|low|medium|high|xhigh|max)$/i);
|
|
699
|
+
return { provider, id: m ? m[1] : rest, level: m ? m[2].toLowerCase() : undefined };
|
|
700
|
+
}
|
|
701
|
+
/** Short display for a ladder cell value — strip the `<provider>/` prefix. */
|
|
702
|
+
function shortRef(ref) {
|
|
703
|
+
if (!ref)
|
|
704
|
+
return '\u2014';
|
|
705
|
+
const slash = ref.indexOf('/');
|
|
706
|
+
return slash === -1 ? ref : ref.slice(slash + 1);
|
|
707
|
+
}
|
|
708
|
+
class ModelsPanel {
|
|
709
|
+
tui;
|
|
710
|
+
runtime;
|
|
711
|
+
registry;
|
|
712
|
+
matches;
|
|
713
|
+
label;
|
|
714
|
+
mode = 'list';
|
|
715
|
+
ladders;
|
|
716
|
+
kinds;
|
|
717
|
+
/** The ladder providers this panel offers — only columns whose runtime
|
|
718
|
+
* provider is signed in (all of them when nobody is, so config stays
|
|
719
|
+
* reachable pre-login). Recomputed with every reload/refresh so a login
|
|
720
|
+
* made on the Providers tab shows up when this tab is next entered. */
|
|
721
|
+
providerKeys = LADDER_PROVIDER_KEYS;
|
|
722
|
+
targets;
|
|
723
|
+
precedenceRoots;
|
|
724
|
+
targetIndex = 0;
|
|
725
|
+
rawTarget;
|
|
726
|
+
rows = [];
|
|
727
|
+
selected = 0;
|
|
728
|
+
column = 0;
|
|
729
|
+
notice = '';
|
|
730
|
+
modelSelector;
|
|
731
|
+
thinkingSelector;
|
|
732
|
+
pending;
|
|
733
|
+
// The kind cell being edited: which mode/dimension, the options to choose
|
|
734
|
+
// from, and the current mode selection so the untouched dimension survives.
|
|
735
|
+
pendingDim;
|
|
736
|
+
dimPickIndex = 0;
|
|
737
|
+
onChange;
|
|
738
|
+
constructor(tui, runtime, registry, matches, label) {
|
|
739
|
+
this.tui = tui;
|
|
740
|
+
this.runtime = runtime;
|
|
741
|
+
this.registry = registry;
|
|
742
|
+
this.matches = matches;
|
|
743
|
+
this.label = label;
|
|
744
|
+
const scopes = modelConfigTargets();
|
|
745
|
+
this.targets = scopes.targets;
|
|
746
|
+
this.precedenceRoots = scopes.precedenceRoots;
|
|
747
|
+
this.rawTarget = readRawConfigAtRoot(this.currentTarget().root);
|
|
748
|
+
const merged = readMergedLaunchConfig();
|
|
749
|
+
this.ladders = merged.modelLadders;
|
|
750
|
+
this.kinds = merged.kinds;
|
|
751
|
+
this.providerKeys = this.offeredProviders();
|
|
752
|
+
this.rows = this.buildRows();
|
|
753
|
+
}
|
|
754
|
+
/** Same signed-in rule as the broker's Alt+M cycle: pool occupancy for a
|
|
755
|
+
* managed provider (read live), else the registry's auth status. */
|
|
756
|
+
offeredProviders() {
|
|
757
|
+
try {
|
|
758
|
+
return configuredLadderProviders((providerId) => (isManagedProvider(providerId) && readSubscriptionPool(providerId).length > 0)
|
|
759
|
+
|| this.registry.getProviderAuthStatus(providerId).configured, this.ladders);
|
|
760
|
+
}
|
|
761
|
+
catch {
|
|
762
|
+
return LADDER_PROVIDER_KEYS; // auth state unreadable — offer the full grid
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
currentTarget() {
|
|
766
|
+
return this.targets[this.targetIndex];
|
|
767
|
+
}
|
|
768
|
+
cycleTarget() {
|
|
769
|
+
this.targetIndex = (this.targetIndex + 1) % this.targets.length;
|
|
770
|
+
this.rawTarget = readRawConfigAtRoot(this.currentTarget().root);
|
|
771
|
+
this.notice = '';
|
|
772
|
+
this.notify();
|
|
773
|
+
}
|
|
774
|
+
shadowingPath(hasOverride) {
|
|
775
|
+
for (const root of this.precedenceRoots) {
|
|
776
|
+
if (root === this.currentTarget().root)
|
|
777
|
+
break;
|
|
778
|
+
const raw = readRawConfigAtRoot(root);
|
|
779
|
+
if (raw && hasOverride(raw))
|
|
780
|
+
return join(root, 'config.json');
|
|
781
|
+
}
|
|
782
|
+
return undefined;
|
|
783
|
+
}
|
|
784
|
+
savedButShadowed(path) {
|
|
785
|
+
return `Saved to ${this.currentTarget().label}; overridden by ${path ?? 'a more specific config'}`;
|
|
786
|
+
}
|
|
787
|
+
buildRows() {
|
|
788
|
+
const rows = [{ section: 'ladder', kind: 'defaultProvider' }];
|
|
789
|
+
for (const strength of STRENGTHS)
|
|
790
|
+
rows.push({ section: 'ladder', kind: 'strength', strength });
|
|
791
|
+
for (const name of Object.keys(this.kinds)) {
|
|
792
|
+
if (name.includes('/'))
|
|
793
|
+
continue;
|
|
794
|
+
rows.push({ section: 'kind', name });
|
|
795
|
+
}
|
|
796
|
+
return rows;
|
|
797
|
+
}
|
|
798
|
+
reload() {
|
|
799
|
+
const merged = readMergedLaunchConfig();
|
|
800
|
+
this.ladders = merged.modelLadders;
|
|
801
|
+
this.kinds = merged.kinds;
|
|
802
|
+
this.rawTarget = readRawConfigAtRoot(this.currentTarget().root);
|
|
803
|
+
this.providerKeys = this.offeredProviders();
|
|
804
|
+
this.rows = this.buildRows();
|
|
805
|
+
this.selected = Math.min(this.selected, this.rows.length - 1);
|
|
806
|
+
this.clampColumn();
|
|
807
|
+
}
|
|
808
|
+
/** Re-read config and auth state — called when the Models tab is entered so
|
|
809
|
+
* a provider signed in (or out) on the Providers tab is reflected here. */
|
|
810
|
+
refresh() {
|
|
811
|
+
this.reload();
|
|
812
|
+
this.notify();
|
|
813
|
+
}
|
|
814
|
+
notify() {
|
|
815
|
+
this.onChange?.();
|
|
816
|
+
this.tui.requestRender();
|
|
817
|
+
}
|
|
818
|
+
isPickerOpen() {
|
|
819
|
+
return this.mode !== 'list';
|
|
820
|
+
}
|
|
821
|
+
currentRow() {
|
|
822
|
+
return this.rows[Math.min(this.selected, this.rows.length - 1)];
|
|
823
|
+
}
|
|
824
|
+
columnsFor(row) {
|
|
825
|
+
if (row.section === 'ladder')
|
|
826
|
+
return row.kind === 'strength' ? this.providerKeys.length : 1;
|
|
827
|
+
return KIND_COLUMNS.length;
|
|
828
|
+
}
|
|
829
|
+
clampColumn() {
|
|
830
|
+
this.column = Math.min(this.column, this.columnsFor(this.currentRow()) - 1);
|
|
831
|
+
}
|
|
832
|
+
handleInput(data) {
|
|
833
|
+
if (this.mode === 'dimension-picker') {
|
|
834
|
+
if (this.matches('crtr.setup.models.commit', data)) {
|
|
835
|
+
this.commitDimensionPick();
|
|
836
|
+
return true;
|
|
837
|
+
}
|
|
838
|
+
if (this.matches('crtr.setup.models.cancel', data)) {
|
|
839
|
+
this.closePicker();
|
|
840
|
+
return true;
|
|
841
|
+
}
|
|
842
|
+
if (this.matches('crtr.setup.list-down', data)) {
|
|
843
|
+
this.dimPickIndex = Math.min((this.pendingDim?.options.length ?? 1) - 1, this.dimPickIndex + 1);
|
|
844
|
+
return true;
|
|
845
|
+
}
|
|
846
|
+
if (this.matches('crtr.setup.list-up', data)) {
|
|
847
|
+
this.dimPickIndex = Math.max(0, this.dimPickIndex - 1);
|
|
848
|
+
return true;
|
|
849
|
+
}
|
|
850
|
+
return true;
|
|
851
|
+
}
|
|
852
|
+
if (this.mode === 'model-picker') {
|
|
853
|
+
const input = this.matches('crtr.setup.models.commit', data)
|
|
854
|
+
? '\r'
|
|
855
|
+
: this.matches('crtr.setup.models.cancel', data) ? '\u001b' : data;
|
|
856
|
+
this.modelSelector?.handleInput(input);
|
|
857
|
+
return true;
|
|
858
|
+
}
|
|
859
|
+
if (this.mode === 'thinking-picker') {
|
|
860
|
+
const input = this.matches('crtr.setup.models.commit', data)
|
|
861
|
+
? '\r'
|
|
862
|
+
: this.matches('crtr.setup.models.cancel', data) ? '\u001b' : data;
|
|
863
|
+
this.thinkingSelector?.getSelectList().handleInput(input);
|
|
864
|
+
return true;
|
|
865
|
+
}
|
|
866
|
+
if (this.matches('crtr.setup.list-down', data)) {
|
|
867
|
+
this.selected = Math.min(this.rows.length - 1, this.selected + 1);
|
|
868
|
+
this.clampColumn();
|
|
869
|
+
this.notice = '';
|
|
870
|
+
return true;
|
|
871
|
+
}
|
|
872
|
+
if (this.matches('crtr.setup.list-up', data)) {
|
|
873
|
+
this.selected = Math.max(0, this.selected - 1);
|
|
874
|
+
this.clampColumn();
|
|
875
|
+
this.notice = '';
|
|
876
|
+
return true;
|
|
877
|
+
}
|
|
878
|
+
if (this.matches('crtr.setup.cell-previous', data)) {
|
|
879
|
+
this.column = Math.max(0, this.column - 1);
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
if (this.matches('crtr.setup.cell-next', data)) {
|
|
883
|
+
this.column = Math.min(this.columnsFor(this.currentRow()) - 1, this.column + 1);
|
|
884
|
+
return true;
|
|
885
|
+
}
|
|
886
|
+
if (this.matches('crtr.setup.models.scope-next', data)) {
|
|
887
|
+
this.cycleTarget();
|
|
888
|
+
return true;
|
|
889
|
+
}
|
|
890
|
+
if (this.matches('crtr.setup.models.open', data)) {
|
|
891
|
+
this.activateCell();
|
|
892
|
+
return true;
|
|
893
|
+
}
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
activateCell() {
|
|
897
|
+
const row = this.currentRow();
|
|
898
|
+
this.notice = '';
|
|
899
|
+
if (row.section === 'ladder' && row.kind === 'defaultProvider') {
|
|
900
|
+
const currentProvider = inferPortableModelSelection(undefined, this.ladders).provider;
|
|
901
|
+
// Cycle within the offered providers only; with a single signed-in
|
|
902
|
+
// provider the default has nowhere else to go.
|
|
903
|
+
const offered = this.providerKeys;
|
|
904
|
+
const next = offered[(Math.max(0, offered.indexOf(currentProvider)) + 1) % offered.length];
|
|
905
|
+
if (next === currentProvider)
|
|
906
|
+
return;
|
|
907
|
+
try {
|
|
908
|
+
persistModelLadders(this.currentTarget().root, { defaultProvider: next });
|
|
909
|
+
}
|
|
910
|
+
catch (error) {
|
|
911
|
+
this.notice = `Could not save: ${error instanceof Error ? error.message : String(error)}`;
|
|
912
|
+
this.notify();
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
this.reload();
|
|
916
|
+
if ((this.ladders.defaultProvider ?? 'anthropic') !== next) {
|
|
917
|
+
const path = this.shadowingPath((raw) => raw.modelLadders?.defaultProvider !== undefined);
|
|
918
|
+
this.notice = this.savedButShadowed(path);
|
|
919
|
+
}
|
|
920
|
+
this.notify();
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
if (row.section === 'ladder' && row.kind === 'strength') {
|
|
924
|
+
this.openModelPicker(this.providerKeys[this.column], row.strength);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
if (row.section === 'kind') {
|
|
928
|
+
const col = KIND_COLUMNS[this.column];
|
|
929
|
+
if (!col)
|
|
930
|
+
return;
|
|
931
|
+
this.openDimensionPicker(row.name, col.mode, col.dimension);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
/** Snapshot of the mode's current provider+strength. For orchestrator this
|
|
935
|
+
* falls back to the base `model` when no explicit override exists, so the
|
|
936
|
+
* inherited pair is what an edit preserves. */
|
|
937
|
+
kindSelection(name, mode) {
|
|
938
|
+
const cfg = this.kinds[name];
|
|
939
|
+
const value = mode === 'orchestrator' ? (cfg?.orchestratorModel ?? cfg?.model) : cfg?.model;
|
|
940
|
+
return inferPortableModelSelection(value, this.ladders);
|
|
941
|
+
}
|
|
942
|
+
openDimensionPicker(name, mode, dimension) {
|
|
943
|
+
const current = this.kindSelection(name, mode);
|
|
944
|
+
const options = dimension === 'provider' ? this.providerKeys : STRENGTHS;
|
|
945
|
+
const currentToken = dimension === 'provider' ? current.provider : current.strength;
|
|
946
|
+
this.pendingDim = { name, mode, dimension, options, current };
|
|
947
|
+
this.dimPickIndex = Math.max(0, options.indexOf(currentToken));
|
|
948
|
+
this.mode = 'dimension-picker';
|
|
949
|
+
this.notify();
|
|
950
|
+
}
|
|
951
|
+
commitDimensionPick() {
|
|
952
|
+
const pending = this.pendingDim;
|
|
953
|
+
const chosen = pending?.options[this.dimPickIndex];
|
|
954
|
+
if (!pending || chosen === undefined) {
|
|
955
|
+
this.closePicker();
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
const provider = pending.dimension === 'provider' ? chosen : pending.current.provider;
|
|
959
|
+
const strength = pending.dimension === 'strength' ? chosen : pending.current.strength;
|
|
960
|
+
const token = `${provider}/${strength}`;
|
|
961
|
+
try {
|
|
962
|
+
persistDefaultKindModel({
|
|
963
|
+
root: this.currentTarget().root,
|
|
964
|
+
kind: pending.name,
|
|
965
|
+
model: token,
|
|
966
|
+
orchestrator: pending.mode === 'orchestrator',
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
catch (error) {
|
|
970
|
+
this.notice = `Could not save: ${error instanceof Error ? error.message : String(error)}`;
|
|
971
|
+
this.mode = 'list';
|
|
972
|
+
this.pendingDim = undefined;
|
|
973
|
+
this.notify();
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
this.mode = 'list';
|
|
977
|
+
this.pendingDim = undefined;
|
|
978
|
+
this.reload();
|
|
979
|
+
const after = this.kinds[pending.name];
|
|
980
|
+
const effective = pending.mode === 'orchestrator' ? after?.orchestratorModel : after?.model;
|
|
981
|
+
if (effective !== token) {
|
|
982
|
+
const field = pending.mode === 'orchestrator' ? 'orchestratorModel' : 'model';
|
|
983
|
+
const path = this.shadowingPath((raw) => {
|
|
984
|
+
const entry = raw.kinds?.[pending.name];
|
|
985
|
+
return entry?.[field] !== undefined;
|
|
986
|
+
});
|
|
987
|
+
this.notice = this.savedButShadowed(path);
|
|
988
|
+
}
|
|
989
|
+
this.notify();
|
|
990
|
+
}
|
|
991
|
+
openModelPicker(providerKey, strength) {
|
|
992
|
+
const expectedRuntime = RUNTIME_PROVIDER_ID[providerKey];
|
|
993
|
+
const registry = this.registry;
|
|
994
|
+
const parsed = parseModelRef(this.ladders[providerKey][strength]);
|
|
995
|
+
const currentModel = parsed.provider && parsed.id ? registry.find(parsed.provider, parsed.id) : undefined;
|
|
996
|
+
const scoped = registry.getAvailable().filter((m) => m.provider === expectedRuntime).map((m) => ({ model: m }));
|
|
997
|
+
if (scoped.length === 0) {
|
|
998
|
+
this.notice = `No ${providerKey} models available \u2014 sign in first.`;
|
|
999
|
+
this.notify();
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
this.pending = { providerKey, strength, expectedRuntime };
|
|
1003
|
+
this.modelSelector = new ModelSelectorComponent(this.tui, currentModel, SettingsManager.inMemory(), this.runtime, scoped, (model) => this.onModelPicked(model), () => this.closePicker());
|
|
1004
|
+
this.modelSelector.focused = true;
|
|
1005
|
+
this.mode = 'model-picker';
|
|
1006
|
+
this.notify();
|
|
1007
|
+
}
|
|
1008
|
+
onModelPicked(model) {
|
|
1009
|
+
if (!this.pending) {
|
|
1010
|
+
this.closePicker();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (model.provider !== this.pending.expectedRuntime) {
|
|
1014
|
+
this.notice = `That is a ${model.provider} model \u2014 pick an ${this.pending.providerKey} model for this column.`;
|
|
1015
|
+
this.closePicker();
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
this.pending.model = model;
|
|
1019
|
+
if (model.reasoning) {
|
|
1020
|
+
const currentLevel = parseModelRef(this.ladders[this.pending.providerKey][this.pending.strength]).level ?? 'medium';
|
|
1021
|
+
this.thinkingSelector = new ThinkingSelectorComponent(currentLevel, [...THINKING_LEVELS], (level) => this.onThinkingPicked(level), () => this.closePicker());
|
|
1022
|
+
this.modelSelector = undefined;
|
|
1023
|
+
this.mode = 'thinking-picker';
|
|
1024
|
+
this.notify();
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
this.writeLadder(model, undefined);
|
|
1028
|
+
this.closePicker();
|
|
1029
|
+
}
|
|
1030
|
+
onThinkingPicked(level) {
|
|
1031
|
+
if (this.pending?.model)
|
|
1032
|
+
this.writeLadder(this.pending.model, level);
|
|
1033
|
+
this.closePicker();
|
|
1034
|
+
}
|
|
1035
|
+
writeLadder(model, level) {
|
|
1036
|
+
if (!this.pending)
|
|
1037
|
+
return;
|
|
1038
|
+
const ref = `${model.provider}/${model.id}${level && level !== 'off' ? `:${level}` : ''}`;
|
|
1039
|
+
const { providerKey, strength } = this.pending;
|
|
1040
|
+
try {
|
|
1041
|
+
persistModelLadders(this.currentTarget().root, { [providerKey]: { [strength]: ref } });
|
|
1042
|
+
}
|
|
1043
|
+
catch (error) {
|
|
1044
|
+
this.notice = `Could not save: ${error instanceof Error ? error.message : String(error)}`;
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
this.reload();
|
|
1048
|
+
if (this.ladders[providerKey][strength] !== ref) {
|
|
1049
|
+
const path = this.shadowingPath((raw) => raw.modelLadders?.[providerKey]?.[strength] !== undefined);
|
|
1050
|
+
this.notice = this.savedButShadowed(path);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
closePicker() {
|
|
1054
|
+
this.mode = 'list';
|
|
1055
|
+
this.modelSelector = undefined;
|
|
1056
|
+
this.thinkingSelector = undefined;
|
|
1057
|
+
this.pending = undefined;
|
|
1058
|
+
this.pendingDim = undefined;
|
|
1059
|
+
this.notify();
|
|
1060
|
+
}
|
|
1061
|
+
dispose() {
|
|
1062
|
+
this.closePicker();
|
|
1063
|
+
}
|
|
1064
|
+
targetLadderOverride(providerKey, strength) {
|
|
1065
|
+
const raw = this.rawTarget?.modelLadders;
|
|
1066
|
+
return raw?.[providerKey]?.[strength] !== undefined;
|
|
1067
|
+
}
|
|
1068
|
+
targetKindOverride(name, orchestrator) {
|
|
1069
|
+
const kinds = this.rawTarget?.kinds;
|
|
1070
|
+
const field = orchestrator ? 'orchestratorModel' : 'model';
|
|
1071
|
+
return kinds?.[name]?.[field] !== undefined;
|
|
1072
|
+
}
|
|
1073
|
+
footerHint() {
|
|
1074
|
+
if (this.mode === 'dimension-picker') {
|
|
1075
|
+
return `${this.label('crtr.setup.list-down')}/${this.label('crtr.setup.list-up')} choice \u00b7 ${this.label('crtr.setup.models.commit')} save \u00b7 ${this.label('crtr.setup.models.cancel')} cancel`;
|
|
1076
|
+
}
|
|
1077
|
+
if (this.mode === 'model-picker')
|
|
1078
|
+
return `type to search \u00b7 ${this.label('crtr.setup.models.commit')} select \u00b7 tab all/scoped \u00b7 ${this.label('crtr.setup.models.cancel')} cancel`;
|
|
1079
|
+
if (this.mode === 'thinking-picker')
|
|
1080
|
+
return `\u2191/\u2193 level \u00b7 ${this.label('crtr.setup.models.commit')} set \u00b7 ${this.label('crtr.setup.models.cancel')} cancel`;
|
|
1081
|
+
return '';
|
|
1082
|
+
}
|
|
1083
|
+
/** Body lines only — the caller frames and windows them. */
|
|
1084
|
+
renderDimensionPicker(width) {
|
|
1085
|
+
const pending = this.pendingDim;
|
|
1086
|
+
if (!pending)
|
|
1087
|
+
return [theme.fg('warning', 'No setting selected.')];
|
|
1088
|
+
const modeLabel = pending.mode === 'orchestrator' ? 'orchestrator' : 'base';
|
|
1089
|
+
const dimLabel = pending.dimension;
|
|
1090
|
+
const paired = pending.dimension === 'provider'
|
|
1091
|
+
? `strength ${pending.current.strength}`
|
|
1092
|
+
: `provider ${PROVIDER_LABEL[pending.current.provider]}`;
|
|
1093
|
+
const body = [
|
|
1094
|
+
theme.fg('accent', theme.bold(`Choose ${modeLabel} ${dimLabel}`)),
|
|
1095
|
+
theme.fg('dim', `${pending.name} \u00b7 keeps ${modeLabel} ${paired}`),
|
|
1096
|
+
'',
|
|
1097
|
+
];
|
|
1098
|
+
for (const [index, option] of pending.options.entries()) {
|
|
1099
|
+
const active = index === this.dimPickIndex;
|
|
1100
|
+
const marker = active ? theme.fg('accent', '\u25b6') : ' ';
|
|
1101
|
+
const label = pending.dimension === 'provider' ? PROVIDER_LABEL[option] : option;
|
|
1102
|
+
body.push(`${marker} ${active ? theme.fg('accent', `[${label}]`) : theme.fg('dim', ` ${label} `)}`);
|
|
1103
|
+
}
|
|
1104
|
+
return body;
|
|
1105
|
+
}
|
|
1106
|
+
/** Fits the panel body into `budget` rows. The wizard draws header/tabs above
|
|
1107
|
+
* and a footer below, so a body taller than its budget pushes the tab strip
|
|
1108
|
+
* off the top of the terminal — the panel must window itself instead. Chrome
|
|
1109
|
+
* (title/subtitle/blank) sheds first, then the remaining lines scroll just
|
|
1110
|
+
* far enough to keep the selected row on screen. */
|
|
1111
|
+
fitBody(lines, selected, budget) {
|
|
1112
|
+
if (lines.length <= budget)
|
|
1113
|
+
return lines;
|
|
1114
|
+
const chrome = Math.min(MODELS_CHROME_LINES, lines.length - budget);
|
|
1115
|
+
const rest = lines.slice(chrome);
|
|
1116
|
+
if (rest.length <= budget)
|
|
1117
|
+
return rest;
|
|
1118
|
+
const anchor = Math.max(0, selected - chrome);
|
|
1119
|
+
const start = Math.max(0, Math.min(anchor - budget + 2, rest.length - budget));
|
|
1120
|
+
return rest.slice(start, start + budget);
|
|
1121
|
+
}
|
|
1122
|
+
render(width, height) {
|
|
1123
|
+
const useFrame = height >= FRAME_OVERHEAD + 1;
|
|
1124
|
+
const contentBudget = Math.max(1, useFrame ? height - FRAME_OVERHEAD : height);
|
|
1125
|
+
const frame = (lines) => (useFrame ? framed(lines, width) : renderRows(lines, width));
|
|
1126
|
+
if (this.mode === 'dimension-picker')
|
|
1127
|
+
return frame(fitTail(this.renderDimensionPicker(width), contentBudget));
|
|
1128
|
+
if (this.mode === 'model-picker')
|
|
1129
|
+
return frame(fitTail(this.modelSelector?.render(Math.max(1, width - 4)) ?? [], contentBudget));
|
|
1130
|
+
if (this.mode === 'thinking-picker')
|
|
1131
|
+
return frame(fitTail(this.thinkingSelector?.render(Math.max(1, width - 4)) ?? [], contentBudget));
|
|
1132
|
+
let selectedLine = 0;
|
|
1133
|
+
const body = [
|
|
1134
|
+
theme.fg('accent', theme.bold('Models')),
|
|
1135
|
+
theme.fg('dim', 'global user defaults \u00b7 project/profile scopes can shadow these'),
|
|
1136
|
+
'',
|
|
1137
|
+
];
|
|
1138
|
+
const selectedRow = this.currentRow();
|
|
1139
|
+
const strengthSelected = selectedRow.section === 'ladder' && selectedRow.kind === 'strength';
|
|
1140
|
+
// Ladder grid layout. The provider columns share the width left after the
|
|
1141
|
+
// 2-space marker gutter and the strength label, divided across as many
|
|
1142
|
+
// columns as fit at a minimum cell width; any that don't fit scroll into a
|
|
1143
|
+
// horizontal viewport that follows the selected column, so the grid scales
|
|
1144
|
+
// to N providers instead of truncating the last column off-screen.
|
|
1145
|
+
const innerWidth = Math.max(1, width - 4);
|
|
1146
|
+
const ladderLabelWidth = Math.max(12, Math.min(20, Math.floor(innerWidth * 0.24)));
|
|
1147
|
+
const providerCount = this.providerKeys.length;
|
|
1148
|
+
const gridWidth = Math.max(1, innerWidth - 2 - ladderLabelWidth);
|
|
1149
|
+
const minCellWidth = 12;
|
|
1150
|
+
const maxVisible = Math.max(1, Math.floor((gridWidth + 1) / (minCellWidth + 1)));
|
|
1151
|
+
const visibleCount = Math.min(providerCount, maxVisible);
|
|
1152
|
+
const ladderCellWidth = Math.max(minCellWidth, Math.floor((gridWidth - (visibleCount - 1)) / visibleCount));
|
|
1153
|
+
const activeColumn = strengthSelected ? Math.min(this.column, providerCount - 1) : 0;
|
|
1154
|
+
const viewStart = Math.max(0, Math.min(activeColumn >= visibleCount ? activeColumn - visibleCount + 1 : 0, providerCount - visibleCount));
|
|
1155
|
+
const viewEnd = viewStart + visibleCount;
|
|
1156
|
+
const visibleCols = this.providerKeys
|
|
1157
|
+
.map((provider, column) => ({ provider, column }))
|
|
1158
|
+
.slice(viewStart, viewEnd);
|
|
1159
|
+
const moreLeft = viewStart > 0;
|
|
1160
|
+
const moreRight = viewEnd < providerCount;
|
|
1161
|
+
const scrollHint = moreLeft || moreRight
|
|
1162
|
+
? ` ${theme.fg('dim', `${moreLeft ? '\u2039 ' : ''}${viewStart + 1}\u2013${viewEnd} of ${providerCount}${moreRight ? ' \u203a' : ''}`)}`
|
|
1163
|
+
: '';
|
|
1164
|
+
const target = this.currentTarget();
|
|
1165
|
+
body.push(`${theme.fg('accent', 'Editing config')} ${theme.fg('accent', `[${target.label}]`)}${theme.fg('dim', ` ${this.targetIndex + 1}/${this.targets.length}`)}`);
|
|
1166
|
+
body.push(theme.fg('muted', join(target.root, 'config.json')), '');
|
|
1167
|
+
body.push(theme.fg('accent', 'Strength ladders') + scrollHint);
|
|
1168
|
+
const effectiveDefaultProvider = inferPortableModelSelection(undefined, this.ladders).provider;
|
|
1169
|
+
const defaultRow = this.rows.find((row) => row.section === 'ladder' && row.kind === 'defaultProvider');
|
|
1170
|
+
const defaultSelected = defaultRow === selectedRow;
|
|
1171
|
+
if (defaultSelected)
|
|
1172
|
+
selectedLine = body.length;
|
|
1173
|
+
body.push(`${defaultSelected ? theme.fg('accent', '\u25b6') : ' '} ${padAnsi(defaultSelected ? theme.fg('accent', 'Default provider') : 'Default provider', 20)} ${theme.fg('success', effectiveDefaultProvider)}`);
|
|
1174
|
+
const providerHeading = (provider, column) => {
|
|
1175
|
+
const heading = padAnsi(theme.bold(PROVIDER_LABEL[provider]), ladderCellWidth);
|
|
1176
|
+
return strengthSelected && this.column === column ? theme.fg('accent', heading) : theme.fg('dim', heading);
|
|
1177
|
+
};
|
|
1178
|
+
const ladderCell = (text, active) => {
|
|
1179
|
+
const content = padAnsi(truncateToWidth(text, Math.max(1, ladderCellWidth - 2)), Math.max(1, ladderCellWidth - 2));
|
|
1180
|
+
return active ? theme.fg('accent', `[${content}]`) : theme.fg('dim', ` ${content} `);
|
|
1181
|
+
};
|
|
1182
|
+
body.push(`${' '.repeat(2)}${padAnsi(theme.fg('dim', 'Strength'), ladderLabelWidth)}${visibleCols.map(({ provider, column }) => providerHeading(provider, column)).join(' ')}`);
|
|
1183
|
+
for (const row of this.rows) {
|
|
1184
|
+
if (row.section !== 'ladder' || row.kind !== 'strength')
|
|
1185
|
+
continue;
|
|
1186
|
+
const isSel = row === selectedRow;
|
|
1187
|
+
const marker = isSel ? theme.fg('accent', '\u25b6') : ' ';
|
|
1188
|
+
if (isSel)
|
|
1189
|
+
selectedLine = body.length;
|
|
1190
|
+
const cells = visibleCols.map(({ provider, column }) => {
|
|
1191
|
+
const over = this.targetLadderOverride(provider, row.strength) ? theme.fg('warning', '\u2022') : ' ';
|
|
1192
|
+
return ladderCell(`${over}${shortRef(this.ladders[provider][row.strength])}`, isSel && column === this.column);
|
|
1193
|
+
});
|
|
1194
|
+
body.push(`${marker} ${padAnsi(row.strength, ladderLabelWidth)}${cells.join(' ')}`);
|
|
1195
|
+
}
|
|
1196
|
+
body.push('', theme.fg('accent', 'Kind defaults'));
|
|
1197
|
+
body.push(theme.fg('dim', `${theme.fg('warning', '\u2022')} override in ${target.label} \u00b7 orchestrator inherits base until you set it`));
|
|
1198
|
+
const nameW = 16;
|
|
1199
|
+
const provCellW = 12;
|
|
1200
|
+
const strCellW = 9;
|
|
1201
|
+
const groupW = provCellW + 1 + strCellW;
|
|
1202
|
+
// Fixed-width cell: `[value]` when the column is selected, faint (muted) for
|
|
1203
|
+
// an inherited orchestrator value, plain dim otherwise. The 2 brackets/spaces
|
|
1204
|
+
// keep every cell exactly `w` wide so the column headers line up.
|
|
1205
|
+
const cell = (raw, w, active, faint) => {
|
|
1206
|
+
const inner = padAnsi(truncateToWidth(raw, Math.max(1, w - 2)), Math.max(1, w - 2));
|
|
1207
|
+
return active ? theme.fg('accent', `[${inner}]`) : faint ? theme.fg('muted', ` ${inner} `) : theme.fg('dim', ` ${inner} `);
|
|
1208
|
+
};
|
|
1209
|
+
body.push(`${' '.repeat(2 + nameW)}${padAnsi(theme.bold(theme.fg('dim', 'Base')), groupW)} ${padAnsi(theme.bold(theme.fg('dim', 'Orchestrator')), groupW)}`);
|
|
1210
|
+
body.push(`${' '.repeat(2)}${padAnsi(theme.fg('dim', 'Kind'), nameW)}${padAnsi(theme.fg('dim', 'Provider'), provCellW)} ${padAnsi(theme.fg('dim', 'Strength'), strCellW)} ${padAnsi(theme.fg('dim', 'Provider'), provCellW)} ${padAnsi(theme.fg('dim', 'Strength'), strCellW)}`);
|
|
1211
|
+
for (const row of this.rows) {
|
|
1212
|
+
if (row.section !== 'kind')
|
|
1213
|
+
continue;
|
|
1214
|
+
const isSel = row === selectedRow;
|
|
1215
|
+
const marker = isSel ? theme.fg('accent', '\u25b6') : ' ';
|
|
1216
|
+
if (isSel)
|
|
1217
|
+
selectedLine = body.length;
|
|
1218
|
+
const cfg = this.kinds[row.name];
|
|
1219
|
+
const baseSel = inferPortableModelSelection(cfg?.model, this.ladders);
|
|
1220
|
+
const orchInherited = cfg?.orchestratorModel === undefined;
|
|
1221
|
+
const orchSel = inferPortableModelSelection(cfg?.orchestratorModel ?? cfg?.model, this.ladders);
|
|
1222
|
+
const baseOver = this.targetKindOverride(row.name, false) ? theme.fg('warning', '\u2022') : ' ';
|
|
1223
|
+
const orchOver = this.targetKindOverride(row.name, true) ? theme.fg('warning', '\u2022') : ' ';
|
|
1224
|
+
const cells = [
|
|
1225
|
+
cell(`${baseOver}${PROVIDER_LABEL[baseSel.provider]}`, provCellW, isSel && this.column === 0, false),
|
|
1226
|
+
cell(`${baseOver}${baseSel.strength}`, strCellW, isSel && this.column === 1, false),
|
|
1227
|
+
cell(`${orchOver}${PROVIDER_LABEL[orchSel.provider]}`, provCellW, isSel && this.column === 2, orchInherited),
|
|
1228
|
+
cell(`${orchOver}${orchSel.strength}`, strCellW, isSel && this.column === 3, orchInherited),
|
|
1229
|
+
];
|
|
1230
|
+
body.push(`${marker} ${padAnsi(row.name, nameW)}${cells[0]} ${cells[1]} ${cells[2]} ${cells[3]}`);
|
|
1231
|
+
}
|
|
1232
|
+
if (this.notice)
|
|
1233
|
+
body.push('', theme.fg('warning', this.notice));
|
|
1234
|
+
return frame(this.fitBody(body, selectedLine, contentBudget));
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
export class SetupWizard {
|
|
1238
|
+
manifest;
|
|
1239
|
+
installedPackageIds;
|
|
1240
|
+
systemTools;
|
|
1241
|
+
exaInput = new Input();
|
|
1242
|
+
keyInput = new Input();
|
|
1243
|
+
brokerWarningInput = new Input();
|
|
1244
|
+
brokerHardCapInput = new Input();
|
|
1245
|
+
openingBindings;
|
|
1246
|
+
keyDraft;
|
|
1247
|
+
terminalRows;
|
|
1248
|
+
selectedPackageIds = new Set();
|
|
1249
|
+
selectedSystemTools = new Set();
|
|
1250
|
+
providers;
|
|
1251
|
+
models;
|
|
1252
|
+
activeTab = 0;
|
|
1253
|
+
pluginIndex = 0;
|
|
1254
|
+
systemIndex = 0;
|
|
1255
|
+
expandedPluginId = null;
|
|
1256
|
+
confirming = false;
|
|
1257
|
+
keyIndex = 0;
|
|
1258
|
+
keyScroll = 0;
|
|
1259
|
+
keyFilter = '';
|
|
1260
|
+
filteringKeys = false;
|
|
1261
|
+
editingKey = null;
|
|
1262
|
+
keyEditError;
|
|
1263
|
+
keyDiagnostics = [];
|
|
1264
|
+
keyConfirm = null;
|
|
1265
|
+
keyNotice;
|
|
1266
|
+
brokerLimitIndex = 0;
|
|
1267
|
+
brokerLimitNotice;
|
|
1268
|
+
cachedWidth;
|
|
1269
|
+
cachedHeight;
|
|
1270
|
+
cachedLines;
|
|
1271
|
+
_focused = false;
|
|
1272
|
+
onSubmit;
|
|
1273
|
+
onCancel;
|
|
1274
|
+
constructor(manifest, installedPackageIds, systemTools, tui, agentDir, runtime, registry, openingBindings, rawKeybindings, terminalRows) {
|
|
1275
|
+
this.manifest = manifest;
|
|
1276
|
+
this.providers = new ProviderPanel(tui, agentDir, runtime, registry);
|
|
1277
|
+
// The panel drives OAuth async; bust our line cache when it transitions so the panel's
|
|
1278
|
+
// requestRender repaints the NEW frame (progress → success notice → roster) without a keypress.
|
|
1279
|
+
this.providers.onChange = () => this.invalidate();
|
|
1280
|
+
this.models = new ModelsPanel(tui, runtime, registry, (id, data) => this.matches(id, data), (id) => this.label(id));
|
|
1281
|
+
this.models.onChange = () => this.invalidate();
|
|
1282
|
+
this.installedPackageIds = installedPackageIds;
|
|
1283
|
+
this.systemTools = systemTools;
|
|
1284
|
+
this.terminalRows = terminalRows;
|
|
1285
|
+
this.openingBindings = openingBindings;
|
|
1286
|
+
this.keyDraft = new SetupKeybindingsDraft(rawKeybindings);
|
|
1287
|
+
this.keyDiagnostics = this.keyDraft.resolution().diagnostics;
|
|
1288
|
+
for (const entry of this.manifest)
|
|
1289
|
+
this.selectedPackageIds.add(entry.id);
|
|
1290
|
+
for (const tool of this.systemTools) {
|
|
1291
|
+
if (tool.plan.checked)
|
|
1292
|
+
this.selectedSystemTools.add(tool.tool);
|
|
1293
|
+
}
|
|
1294
|
+
const firstMissingSystem = this.systemTools.findIndex((tool) => !tool.installed);
|
|
1295
|
+
this.systemIndex = firstMissingSystem >= 0 ? firstMissingSystem : 0;
|
|
1296
|
+
this.exaInput.onSubmit = () => this.finalize();
|
|
1297
|
+
this.exaInput.onEscape = () => this.cancel();
|
|
1298
|
+
const brokerThresholds = readConfig('user').brokerThresholds;
|
|
1299
|
+
this.brokerWarningInput.setValue(String(brokerThresholds.warning));
|
|
1300
|
+
this.brokerWarningInput.handleInput('\x05');
|
|
1301
|
+
this.brokerHardCapInput.setValue(String(brokerThresholds.automaticReviveCap));
|
|
1302
|
+
this.brokerHardCapInput.handleInput('\x05');
|
|
1303
|
+
this.brokerWarningInput.onSubmit = () => this.saveBrokerLimits();
|
|
1304
|
+
this.brokerHardCapInput.onSubmit = () => this.saveBrokerLimits();
|
|
1305
|
+
// Edit-mode Enter/Escape are routed through the opening snapshot's
|
|
1306
|
+
// `crtr.setup.keybindings.commit-edit` / `.cancel-edit` bindings in
|
|
1307
|
+
// handleKeybindingsInput (before the pi Input sees them), so the pi Input's
|
|
1308
|
+
// own submit/escape handlers stay unset — those catalog rows are honored
|
|
1309
|
+
// even when remapped away from Enter/Escape.
|
|
1310
|
+
}
|
|
1311
|
+
set focused(value) {
|
|
1312
|
+
this._focused = value;
|
|
1313
|
+
this.exaInput.focused = value && this.activeTab === 3 && !this.confirming;
|
|
1314
|
+
this.keyInput.focused = value && this.activeTab === 4 && this.editingKey !== null;
|
|
1315
|
+
this.brokerWarningInput.focused = value && this.activeTab === 6 && this.brokerLimitIndex === 0;
|
|
1316
|
+
this.brokerHardCapInput.focused = value && this.activeTab === 6 && this.brokerLimitIndex === 1;
|
|
1317
|
+
}
|
|
1318
|
+
get focused() {
|
|
1319
|
+
return this._focused;
|
|
1320
|
+
}
|
|
1321
|
+
invalidate() {
|
|
1322
|
+
this.cachedWidth = undefined;
|
|
1323
|
+
this.cachedHeight = undefined;
|
|
1324
|
+
this.cachedLines = undefined;
|
|
1325
|
+
}
|
|
1326
|
+
setTab(next) {
|
|
1327
|
+
// Entering Models re-reads auth state so a provider signed in (or out) on
|
|
1328
|
+
// the Providers tab immediately gains (or loses) its column here.
|
|
1329
|
+
if (next === 5 && this.activeTab !== 5)
|
|
1330
|
+
this.models.refresh();
|
|
1331
|
+
this.activeTab = next;
|
|
1332
|
+
this.exaInput.focused = this.focused && next === 3 && !this.confirming;
|
|
1333
|
+
this.keyInput.focused = this.focused && next === 4 && this.editingKey !== null;
|
|
1334
|
+
this.brokerWarningInput.focused = this.focused && next === 6 && this.brokerLimitIndex === 0;
|
|
1335
|
+
this.brokerHardCapInput.focused = this.focused && next === 6 && this.brokerLimitIndex === 1;
|
|
1336
|
+
this.invalidate();
|
|
1337
|
+
}
|
|
1338
|
+
moveTab(delta) {
|
|
1339
|
+
const next = ((this.activeTab + delta + 7) % 7);
|
|
1340
|
+
this.setTab(next);
|
|
1341
|
+
}
|
|
1342
|
+
cancel() {
|
|
1343
|
+
if (this.confirming) {
|
|
1344
|
+
this.confirming = false;
|
|
1345
|
+
this.invalidate();
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
this.providers.dispose();
|
|
1349
|
+
this.models.dispose();
|
|
1350
|
+
this.onCancel?.();
|
|
1351
|
+
}
|
|
1352
|
+
dispose() { this.providers.dispose(); this.models.dispose(); }
|
|
1353
|
+
matches(id, data) {
|
|
1354
|
+
return matchesPiTuiInput(this.openingBindings, id, data, (input, gesture) => matchesKey(input, gesture));
|
|
1355
|
+
}
|
|
1356
|
+
/** Human hint label for an action, derived from the opening snapshot so footers
|
|
1357
|
+
* reflect the effective (possibly remapped) gestures the wizard actually honors. */
|
|
1358
|
+
label(id) {
|
|
1359
|
+
return formatBinding(this.openingBindings, id);
|
|
1360
|
+
}
|
|
1361
|
+
/** Like `label`, but drops gestures a focused pi text Input consumes as data
|
|
1362
|
+
* (single printable chars and the arrow keys), so the Exa footer does
|
|
1363
|
+
* not claim keys that never reach the wizard while a field owns focus. */
|
|
1364
|
+
fieldSafeLabel(id) {
|
|
1365
|
+
const survives = this.openingBindings.gestures(id).filter((gesture) => {
|
|
1366
|
+
if (gesture.includes(' > '))
|
|
1367
|
+
return true;
|
|
1368
|
+
const key = gesture.split('+').pop();
|
|
1369
|
+
if (key === 'up' || key === 'down' || key === 'left' || key === 'right')
|
|
1370
|
+
return false;
|
|
1371
|
+
return key.length > 1 || gesture.includes('+');
|
|
1372
|
+
});
|
|
1373
|
+
return survives.length === 0 ? 'Disabled' : survives.map(formatGesture).join(' / ');
|
|
1374
|
+
}
|
|
1375
|
+
handleGlobalTabSwitch(data) {
|
|
1376
|
+
if (this.matches('crtr.setup.tab-next', data)) {
|
|
1377
|
+
this.moveTab(1);
|
|
1378
|
+
return true;
|
|
1379
|
+
}
|
|
1380
|
+
if (this.matches('crtr.setup.tab-previous', data)) {
|
|
1381
|
+
this.moveTab(-1);
|
|
1382
|
+
return true;
|
|
1383
|
+
}
|
|
1384
|
+
return false;
|
|
1385
|
+
}
|
|
1386
|
+
selectedPackage() {
|
|
1387
|
+
return this.manifest[this.pluginIndex];
|
|
1388
|
+
}
|
|
1389
|
+
selectedSystem() {
|
|
1390
|
+
return this.systemTools[this.systemIndex];
|
|
1391
|
+
}
|
|
1392
|
+
movePlugin(delta) {
|
|
1393
|
+
if (this.manifest.length === 0)
|
|
1394
|
+
return;
|
|
1395
|
+
this.pluginIndex = (this.pluginIndex + delta + this.manifest.length) % this.manifest.length;
|
|
1396
|
+
this.invalidate();
|
|
1397
|
+
}
|
|
1398
|
+
moveSystem(delta) {
|
|
1399
|
+
const interactives = this.systemTools
|
|
1400
|
+
.map((tool, index) => ({ tool, index }))
|
|
1401
|
+
.filter(({ tool }) => !tool.installed);
|
|
1402
|
+
if (interactives.length === 0)
|
|
1403
|
+
return;
|
|
1404
|
+
const currentIndex = interactives.findIndex(({ index }) => index === this.systemIndex);
|
|
1405
|
+
const nextPos = ((currentIndex >= 0 ? currentIndex : 0) + delta + interactives.length) % interactives.length;
|
|
1406
|
+
this.systemIndex = interactives[nextPos].index;
|
|
1407
|
+
this.invalidate();
|
|
1408
|
+
}
|
|
1409
|
+
togglePackage() {
|
|
1410
|
+
const entry = this.selectedPackage();
|
|
1411
|
+
if (!entry)
|
|
1412
|
+
return;
|
|
1413
|
+
if (this.selectedPackageIds.has(entry.id))
|
|
1414
|
+
this.selectedPackageIds.delete(entry.id);
|
|
1415
|
+
else
|
|
1416
|
+
this.selectedPackageIds.add(entry.id);
|
|
1417
|
+
this.invalidate();
|
|
1418
|
+
}
|
|
1419
|
+
toggleSystem() {
|
|
1420
|
+
const tool = this.selectedSystem();
|
|
1421
|
+
if (!tool || tool.installed)
|
|
1422
|
+
return;
|
|
1423
|
+
if (this.selectedSystemTools.has(tool.tool))
|
|
1424
|
+
this.selectedSystemTools.delete(tool.tool);
|
|
1425
|
+
else
|
|
1426
|
+
this.selectedSystemTools.add(tool.tool);
|
|
1427
|
+
this.invalidate();
|
|
1428
|
+
}
|
|
1429
|
+
toggleDetails() {
|
|
1430
|
+
const entry = this.selectedPackage();
|
|
1431
|
+
if (!entry)
|
|
1432
|
+
return;
|
|
1433
|
+
this.expandedPluginId = this.expandedPluginId === entry.id ? null : entry.id;
|
|
1434
|
+
this.invalidate();
|
|
1435
|
+
}
|
|
1436
|
+
hasPendingInstalls() {
|
|
1437
|
+
const packages = this.manifest.some((entry) => this.selectedPackageIds.has(entry.id) && !this.installedPackageIds.has(entry.id));
|
|
1438
|
+
const system = this.systemTools.some((tool) => !tool.installed && this.selectedSystemTools.has(tool.tool));
|
|
1439
|
+
return packages || system;
|
|
1440
|
+
}
|
|
1441
|
+
buildSubmission() {
|
|
1442
|
+
return {
|
|
1443
|
+
packages: this.manifest.filter((entry) => this.selectedPackageIds.has(entry.id)),
|
|
1444
|
+
installedPackageIds: new Set(this.installedPackageIds),
|
|
1445
|
+
systemDeps: this.systemTools.filter((tool) => !tool.installed && this.selectedSystemTools.has(tool.tool)).map((tool) => tool.plan),
|
|
1446
|
+
exaKey: this.exaInput.getValue().trim(),
|
|
1447
|
+
exaKeyPath: resolveExaKeyPath(),
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
finalize() {
|
|
1451
|
+
if (this.confirming) {
|
|
1452
|
+
this.onSubmit?.(this.buildSubmission());
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
if (this.hasPendingInstalls()) {
|
|
1456
|
+
this.confirming = true;
|
|
1457
|
+
this.invalidate();
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
this.onSubmit?.(this.buildSubmission());
|
|
1461
|
+
}
|
|
1462
|
+
filteredKeybindings() {
|
|
1463
|
+
const resolution = this.keyDraft.resolution();
|
|
1464
|
+
const needle = this.keyFilter.trim().toLowerCase();
|
|
1465
|
+
if (needle === '')
|
|
1466
|
+
return BINDING_CATALOG;
|
|
1467
|
+
return BINDING_CATALOG.filter((definition) => {
|
|
1468
|
+
const rendered = formatBinding(resolution, definition.id);
|
|
1469
|
+
return [definition.name, definition.id, definition.group, definition.description, rendered]
|
|
1470
|
+
.some((value) => value.toLowerCase().includes(needle));
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
selectedKeybinding() {
|
|
1474
|
+
const rows = this.filteredKeybindings();
|
|
1475
|
+
if (rows.length === 0)
|
|
1476
|
+
return undefined;
|
|
1477
|
+
this.keyIndex = Math.max(0, Math.min(this.keyIndex, rows.length - 1));
|
|
1478
|
+
return rows[this.keyIndex];
|
|
1479
|
+
}
|
|
1480
|
+
moveKey(delta) {
|
|
1481
|
+
const rows = this.filteredKeybindings();
|
|
1482
|
+
if (rows.length === 0)
|
|
1483
|
+
return;
|
|
1484
|
+
this.keyIndex = Math.max(0, Math.min(rows.length - 1, this.keyIndex + delta));
|
|
1485
|
+
const page = this.keyPageSize();
|
|
1486
|
+
if (this.keyIndex < this.keyScroll)
|
|
1487
|
+
this.keyScroll = this.keyIndex;
|
|
1488
|
+
if (this.keyIndex >= this.keyScroll + page)
|
|
1489
|
+
this.keyScroll = this.keyIndex - page + 1;
|
|
1490
|
+
this.keyEditError = undefined;
|
|
1491
|
+
this.invalidate();
|
|
1492
|
+
}
|
|
1493
|
+
// Max output lines the row region may emit before it starts clipping the
|
|
1494
|
+
// confirm prompt / notice / footer. Budgets the fixed chrome around the list:
|
|
1495
|
+
// header (3) + blank + tab header/count (2) + blank + footer (1) plus a small
|
|
1496
|
+
// reserve for a diagnostic line and the notice/confirm block.
|
|
1497
|
+
keyViewportLines() {
|
|
1498
|
+
return Math.max(4, this.terminalRows() - 11);
|
|
1499
|
+
}
|
|
1500
|
+
// Rows moved per PageUp/PageDown and used for scroll clamping. Kept below the
|
|
1501
|
+
// raw viewport so interleaved group-heading lines and the selected row's
|
|
1502
|
+
// diagnostic line cannot push the selection off-screen.
|
|
1503
|
+
keyPageSize() {
|
|
1504
|
+
return Math.max(3, this.keyViewportLines() - 4);
|
|
1505
|
+
}
|
|
1506
|
+
beginKeyEdit() {
|
|
1507
|
+
const row = this.selectedKeybinding();
|
|
1508
|
+
if (!row)
|
|
1509
|
+
return;
|
|
1510
|
+
if (this.keyDraft.hasInvalidRoot()) {
|
|
1511
|
+
this.keyNotice = `Saved keybindings root is invalid — ${this.label('crtr.setup.keybindings.reset-all')} (reset all) before editing.`;
|
|
1512
|
+
this.invalidate();
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
this.editingKey = row.id;
|
|
1516
|
+
this.keyInput.setValue(this.keyDraft.expression(row.id));
|
|
1517
|
+
// pi Input.setValue only clamps the cursor; seed it, then send ctrl+e
|
|
1518
|
+
// (cursorLineEnd) so the cursor sits at end-of-value and the first keystroke
|
|
1519
|
+
// appends after the seed instead of prepending before it.
|
|
1520
|
+
this.keyInput.handleInput('\x05');
|
|
1521
|
+
this.keyInput.focused = this.focused;
|
|
1522
|
+
this.keyEditError = undefined;
|
|
1523
|
+
this.invalidate();
|
|
1524
|
+
}
|
|
1525
|
+
commitKeyEdit() {
|
|
1526
|
+
if (this.editingKey === null)
|
|
1527
|
+
return;
|
|
1528
|
+
const result = this.keyDraft.edit(this.editingKey, this.keyInput.getValue());
|
|
1529
|
+
if (!result.ok) {
|
|
1530
|
+
this.keyEditError = result.diagnostics[0]?.message ?? 'Invalid keybinding';
|
|
1531
|
+
this.keyDiagnostics = result.diagnostics;
|
|
1532
|
+
this.invalidate();
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
this.editingKey = null;
|
|
1536
|
+
this.keyInput.focused = false;
|
|
1537
|
+
this.keyEditError = undefined;
|
|
1538
|
+
this.keyDiagnostics = this.keyDraft.resolution().diagnostics;
|
|
1539
|
+
this.keyNotice = undefined;
|
|
1540
|
+
this.invalidate();
|
|
1541
|
+
}
|
|
1542
|
+
cancelKeyEdit() {
|
|
1543
|
+
this.editingKey = null;
|
|
1544
|
+
this.keyInput.focused = false;
|
|
1545
|
+
this.keyEditError = undefined;
|
|
1546
|
+
// Drop the rejected edit's collision diagnostics: the draft never took the
|
|
1547
|
+
// offending value, so restore diagnostics from the committed draft state.
|
|
1548
|
+
this.keyDiagnostics = this.keyDraft.resolution().diagnostics;
|
|
1549
|
+
this.invalidate();
|
|
1550
|
+
}
|
|
1551
|
+
saveKeybindings() {
|
|
1552
|
+
const resolution = this.keyDraft.resolution();
|
|
1553
|
+
this.keyDiagnostics = resolution.diagnostics;
|
|
1554
|
+
const errors = resolution.diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
|
|
1555
|
+
if (errors.length > 0) {
|
|
1556
|
+
this.keyNotice = errors[0].message;
|
|
1557
|
+
this.invalidate();
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
try {
|
|
1561
|
+
const saved = persistUserKeybindings(this.keyDraft.overrides(), {
|
|
1562
|
+
expectedKeybindings: this.keyDraft.expectedKeybindings(),
|
|
1563
|
+
});
|
|
1564
|
+
this.keyDraft.markSaved(saved.overrides);
|
|
1565
|
+
this.keyNotice = 'Saved. Reload attach and reopen active views to apply changes; refreshing tmux…';
|
|
1566
|
+
// The config is already persisted; a tmux-refresh failure (installer throw)
|
|
1567
|
+
// must land in the notice, never as an unhandled rejection that tears down
|
|
1568
|
+
// the wizard mid-TUI right after a good save.
|
|
1569
|
+
void this.refreshTmuxBindingsAfterSave().catch((error) => {
|
|
1570
|
+
this.keyNotice = `Saved, but tmux refresh failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
1571
|
+
this.invalidate();
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
catch (error) {
|
|
1575
|
+
if (error instanceof KeybindingConcurrentEditError) {
|
|
1576
|
+
this.keyNotice = 'Keybindings changed on disk. Reopen setup before saving.';
|
|
1577
|
+
}
|
|
1578
|
+
else if (error instanceof KeybindingValidationError) {
|
|
1579
|
+
this.keyDiagnostics = error.diagnostics;
|
|
1580
|
+
this.keyNotice = error.message;
|
|
1581
|
+
}
|
|
1582
|
+
else {
|
|
1583
|
+
this.keyNotice = error instanceof Error ? error.message : String(error);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
this.invalidate();
|
|
1587
|
+
}
|
|
1588
|
+
async refreshTmuxBindingsAfterSave() {
|
|
1589
|
+
// Unit 2's frozen tmux-chrome seam: no-arg install re-reads the
|
|
1590
|
+
// just-persisted user config and reconciles the crouter-owned bindings.
|
|
1591
|
+
const result = installTmuxBindings();
|
|
1592
|
+
const occupied = result.diagnostics.filter((diagnostic) => diagnostic.code === 'occupied');
|
|
1593
|
+
if (result.ok && occupied.length === 0) {
|
|
1594
|
+
this.keyNotice = 'Saved and applied to tmux. Reload attach and reopen active views.';
|
|
1595
|
+
}
|
|
1596
|
+
else if (result.ok) {
|
|
1597
|
+
this.keyNotice = `Saved; tmux kept occupied keys: ${occupied.map((diagnostic) => diagnostic.message).join('; ')}`;
|
|
1598
|
+
}
|
|
1599
|
+
else {
|
|
1600
|
+
this.keyNotice = `Saved, but tmux refresh failed: ${result.diagnostics.find((diagnostic) => diagnostic.code === 'tmux-error')?.message ?? 'tmux unavailable'}`;
|
|
1601
|
+
}
|
|
1602
|
+
this.invalidate();
|
|
1603
|
+
}
|
|
1604
|
+
confirmKeyAction() {
|
|
1605
|
+
if (this.keyConfirm === 'reset-all') {
|
|
1606
|
+
this.keyDraft.resetAll();
|
|
1607
|
+
this.keyDiagnostics = [];
|
|
1608
|
+
this.keyNotice = 'All rows reset to catalog defaults. Press save to write.';
|
|
1609
|
+
}
|
|
1610
|
+
else if (this.keyConfirm === 'discard') {
|
|
1611
|
+
this.keyDraft.discard();
|
|
1612
|
+
this.keyDiagnostics = this.keyDraft.resolution().diagnostics;
|
|
1613
|
+
this.keyNotice = 'Unsaved keybinding changes discarded.';
|
|
1614
|
+
}
|
|
1615
|
+
this.keyConfirm = null;
|
|
1616
|
+
this.invalidate();
|
|
1617
|
+
}
|
|
1618
|
+
selectedBrokerLimitInput() {
|
|
1619
|
+
return this.brokerLimitIndex === 0 ? this.brokerWarningInput : this.brokerHardCapInput;
|
|
1620
|
+
}
|
|
1621
|
+
moveBrokerLimit(delta) {
|
|
1622
|
+
this.brokerLimitIndex = ((this.brokerLimitIndex + delta + 2) % 2);
|
|
1623
|
+
this.brokerWarningInput.focused = this.focused && this.brokerLimitIndex === 0;
|
|
1624
|
+
this.brokerHardCapInput.focused = this.focused && this.brokerLimitIndex === 1;
|
|
1625
|
+
this.brokerLimitNotice = undefined;
|
|
1626
|
+
this.invalidate();
|
|
1627
|
+
}
|
|
1628
|
+
saveBrokerLimits() {
|
|
1629
|
+
const warningThreshold = parsePositiveInteger(this.brokerWarningInput.getValue());
|
|
1630
|
+
const automaticReviveHardCap = parsePositiveInteger(this.brokerHardCapInput.getValue());
|
|
1631
|
+
if (warningThreshold === undefined || automaticReviveHardCap === undefined) {
|
|
1632
|
+
this.brokerLimitNotice = 'Both broker limits must be positive integers.';
|
|
1633
|
+
this.invalidate();
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
if (warningThreshold > automaticReviveHardCap) {
|
|
1637
|
+
this.brokerLimitNotice = 'Warning threshold cannot exceed the automatic-revive hard cap.';
|
|
1638
|
+
this.invalidate();
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
updateRawConfigAtomically('user', (latest) => ({
|
|
1642
|
+
...latest,
|
|
1643
|
+
brokerThresholds: { warning: warningThreshold, automaticReviveCap: automaticReviveHardCap },
|
|
1644
|
+
}));
|
|
1645
|
+
this.brokerLimitNotice = `Saved to user config. Applies next tick. ${BROKER_LIMIT_OVERRIDE_PRECEDENCE}`;
|
|
1646
|
+
this.invalidate();
|
|
1647
|
+
}
|
|
1648
|
+
handleBrokerLimitsInput(data) {
|
|
1649
|
+
// Values take precedence over remappable navigation keys, so binding a
|
|
1650
|
+
// setup action to a digit never makes that digit impossible to enter here.
|
|
1651
|
+
if (/^\d+$/.test(data)) {
|
|
1652
|
+
this.selectedBrokerLimitInput().handleInput(data);
|
|
1653
|
+
this.brokerLimitNotice = undefined;
|
|
1654
|
+
this.invalidate();
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1657
|
+
if (this.matches('crtr.setup.list-down', data)) {
|
|
1658
|
+
this.moveBrokerLimit(1);
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
if (this.matches('crtr.setup.list-up', data)) {
|
|
1662
|
+
this.moveBrokerLimit(-1);
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
// Input receives bracketed pastes as one event. Reject a non-digit event as
|
|
1666
|
+
// a whole so a saved broker limit is always an unambiguous positive integer.
|
|
1667
|
+
if (data.length > 0 && [...data].every((char) => char.codePointAt(0) >= 32) && !/^\d+$/.test(data)) {
|
|
1668
|
+
this.brokerLimitNotice = 'Broker limits accept digits only.';
|
|
1669
|
+
this.invalidate();
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
this.selectedBrokerLimitInput().handleInput(data);
|
|
1673
|
+
// Input invokes its submit callback synchronously for Enter; preserve that
|
|
1674
|
+
// callback's validation or saved notice instead of immediately clearing it.
|
|
1675
|
+
if (data !== '\r' && data !== '\n')
|
|
1676
|
+
this.brokerLimitNotice = undefined;
|
|
1677
|
+
this.invalidate();
|
|
1678
|
+
}
|
|
1679
|
+
handleKeybindingsInput(data) {
|
|
1680
|
+
if (this.keyConfirm !== null) {
|
|
1681
|
+
if (this.matches('crtr.setup.confirm.accept', data))
|
|
1682
|
+
this.confirmKeyAction();
|
|
1683
|
+
else if (this.matches('crtr.setup.confirm.back', data)) {
|
|
1684
|
+
this.keyConfirm = null;
|
|
1685
|
+
this.invalidate();
|
|
1686
|
+
}
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
if (this.editingKey !== null) {
|
|
1690
|
+
// Honor the catalog rows for commit/cancel BEFORE the pi Input sees the
|
|
1691
|
+
// keystroke, so a remap of `commit-edit`/`cancel-edit` takes effect.
|
|
1692
|
+
if (this.matches('crtr.setup.keybindings.commit-edit', data)) {
|
|
1693
|
+
this.commitKeyEdit();
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
if (this.matches('crtr.setup.keybindings.cancel-edit', data)) {
|
|
1697
|
+
this.cancelKeyEdit();
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
if (this.matches('crtr.setup.keybindings.page-up', data)) {
|
|
1701
|
+
this.moveKey(-this.keyPageSize());
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
if (this.matches('crtr.setup.keybindings.page-down', data)) {
|
|
1705
|
+
this.moveKey(this.keyPageSize());
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
this.keyInput.handleInput(data);
|
|
1709
|
+
this.invalidate();
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (this.filteringKeys) {
|
|
1713
|
+
if (this.matches('crtr.setup.keybindings.filter-clear', data)) {
|
|
1714
|
+
this.keyFilter = '';
|
|
1715
|
+
this.filteringKeys = false;
|
|
1716
|
+
this.keyIndex = 0;
|
|
1717
|
+
this.keyScroll = 0;
|
|
1718
|
+
}
|
|
1719
|
+
else if (this.matches('crtr.setup.keybindings.edit', data)) {
|
|
1720
|
+
// Enter commits the filter: leave filter-entry but KEEP keyFilter so the
|
|
1721
|
+
// narrowed list can be navigated and its rows edited.
|
|
1722
|
+
this.filteringKeys = false;
|
|
1723
|
+
}
|
|
1724
|
+
else if (this.matches('crtr.setup.keybindings.filter-delete', data)) {
|
|
1725
|
+
this.keyFilter = this.keyFilter.slice(0, -1);
|
|
1726
|
+
this.keyIndex = 0;
|
|
1727
|
+
this.keyScroll = 0;
|
|
1728
|
+
}
|
|
1729
|
+
else if (data.length === 1 && data.charCodeAt(0) >= 32) {
|
|
1730
|
+
this.keyFilter += data;
|
|
1731
|
+
this.keyIndex = 0;
|
|
1732
|
+
this.keyScroll = 0;
|
|
1733
|
+
}
|
|
1734
|
+
this.invalidate();
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
if (this.matches('crtr.setup.keybindings.filter', data)) {
|
|
1738
|
+
this.filteringKeys = true;
|
|
1739
|
+
}
|
|
1740
|
+
else if (this.matches('crtr.setup.list-down', data)) {
|
|
1741
|
+
this.moveKey(1);
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
else if (this.matches('crtr.setup.list-up', data)) {
|
|
1745
|
+
this.moveKey(-1);
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
else if (this.matches('crtr.setup.keybindings.page-up', data)) {
|
|
1749
|
+
this.moveKey(-this.keyPageSize());
|
|
1750
|
+
return;
|
|
1751
|
+
}
|
|
1752
|
+
else if (this.matches('crtr.setup.keybindings.page-down', data)) {
|
|
1753
|
+
this.moveKey(this.keyPageSize());
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
else if (this.matches('crtr.setup.keybindings.edit', data)) {
|
|
1757
|
+
this.beginKeyEdit();
|
|
1758
|
+
return;
|
|
1759
|
+
}
|
|
1760
|
+
else if (this.matches('crtr.setup.keybindings.unbind', data)) {
|
|
1761
|
+
const row = this.selectedKeybinding();
|
|
1762
|
+
if (row) {
|
|
1763
|
+
const result = this.keyDraft.unbind(row.id);
|
|
1764
|
+
this.keyDiagnostics = result.ok ? this.keyDraft.resolution().diagnostics : result.diagnostics;
|
|
1765
|
+
this.keyEditError = result.ok ? undefined : result.diagnostics[0]?.message;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
else if (this.matches('crtr.setup.keybindings.reset-row', data)) {
|
|
1769
|
+
const row = this.selectedKeybinding();
|
|
1770
|
+
if (row)
|
|
1771
|
+
this.keyDraft.resetRow(row.id);
|
|
1772
|
+
this.keyDiagnostics = this.keyDraft.resolution().diagnostics;
|
|
1773
|
+
}
|
|
1774
|
+
else if (this.matches('crtr.setup.keybindings.reset-all', data)) {
|
|
1775
|
+
this.keyConfirm = 'reset-all';
|
|
1776
|
+
}
|
|
1777
|
+
else if (this.matches('crtr.setup.keybindings.save', data)) {
|
|
1778
|
+
this.saveKeybindings();
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
else if (this.matches('crtr.setup.keybindings.discard', data)) {
|
|
1782
|
+
// A committed (kept) filter is cleared first, before discard is considered.
|
|
1783
|
+
if (this.keyFilter !== '') {
|
|
1784
|
+
this.keyFilter = '';
|
|
1785
|
+
this.keyIndex = 0;
|
|
1786
|
+
this.keyScroll = 0;
|
|
1787
|
+
this.keyNotice = undefined;
|
|
1788
|
+
}
|
|
1789
|
+
else if (this.keyDraft.dirty)
|
|
1790
|
+
this.keyConfirm = 'discard';
|
|
1791
|
+
else
|
|
1792
|
+
this.keyNotice = 'No unsaved keybinding changes.';
|
|
1793
|
+
}
|
|
1794
|
+
else {
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
this.invalidate();
|
|
1798
|
+
}
|
|
1799
|
+
handleInput(data) {
|
|
1800
|
+
// A nested provider login owns all input until it settles. In particular, do not let
|
|
1801
|
+
// wizard-wide q/Tab navigation abandon the panel while its OAuth promise can still resolve.
|
|
1802
|
+
if (this.activeTab === 0 && this.providers.isNestedFlowActive()) {
|
|
1803
|
+
if (this.providers.handleInput(data))
|
|
1804
|
+
this.invalidate();
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
// A nested model/thinking picker owns all input until it settles, before any
|
|
1808
|
+
// wizard-wide cancel/tab gesture can steal it.
|
|
1809
|
+
if (this.activeTab === 5 && this.models.isPickerOpen()) {
|
|
1810
|
+
if (this.models.handleInput(data))
|
|
1811
|
+
this.invalidate();
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
if (this.confirming) {
|
|
1815
|
+
if (this.matches('crtr.setup.confirm.accept', data)) {
|
|
1816
|
+
this.onSubmit?.(this.buildSubmission());
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1819
|
+
if (this.matches('crtr.setup.confirm.back', data)) {
|
|
1820
|
+
this.confirming = false;
|
|
1821
|
+
this.invalidate();
|
|
1822
|
+
}
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
// Keybindings sub-states (editing / filtering / confirm) own input before the
|
|
1826
|
+
// wizard-level cancel and tab gestures can steal it.
|
|
1827
|
+
if (this.activeTab === 4 && (this.editingKey !== null || this.filteringKeys || this.keyConfirm !== null)) {
|
|
1828
|
+
this.handleKeybindingsInput(data);
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
// Printable chars and arrows on the API-key tab go to the focused field.
|
|
1832
|
+
if (this.activeTab === 3
|
|
1833
|
+
&& ((data.length === 1 && data.charCodeAt(0) >= 32)
|
|
1834
|
+
|| matchesKey(data, 'left') || matchesKey(data, 'right') || matchesKey(data, 'up') || matchesKey(data, 'down'))) {
|
|
1835
|
+
this.exaInput.handleInput(data);
|
|
1836
|
+
this.invalidate();
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
// Numeric broker-limit input owns digits before remappable setup navigation
|
|
1840
|
+
// can consume them as a tab or list binding.
|
|
1841
|
+
if (this.activeTab === 6 && /^\d+$/.test(data)) {
|
|
1842
|
+
this.handleBrokerLimitsInput(data);
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
// On the keybindings tab in list mode, a dirty draft must not be dropped
|
|
1846
|
+
// silently by the wizard-level cancel gesture — route it through the same
|
|
1847
|
+
// discard-confirm the discard path uses.
|
|
1848
|
+
if (this.activeTab === 4 && this.keyDraft.dirty && this.matches('crtr.setup.cancel', data)) {
|
|
1849
|
+
this.keyConfirm = 'discard';
|
|
1850
|
+
this.invalidate();
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
if (this.matches('crtr.setup.cancel', data)) {
|
|
1854
|
+
this.cancel();
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
if (this.handleGlobalTabSwitch(data))
|
|
1858
|
+
return;
|
|
1859
|
+
if (this.activeTab === 0) {
|
|
1860
|
+
if (this.providers.handleInput(data))
|
|
1861
|
+
this.invalidate();
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
1864
|
+
if (this.activeTab === 1) {
|
|
1865
|
+
if (this.matches('crtr.setup.list-down', data))
|
|
1866
|
+
this.movePlugin(1);
|
|
1867
|
+
else if (this.matches('crtr.setup.list-up', data))
|
|
1868
|
+
this.movePlugin(-1);
|
|
1869
|
+
else if (this.matches('crtr.setup.toggle', data))
|
|
1870
|
+
this.togglePackage();
|
|
1871
|
+
else if (this.matches('crtr.setup.details', data))
|
|
1872
|
+
this.toggleDetails();
|
|
1873
|
+
else if (this.matches('crtr.setup.advance', data))
|
|
1874
|
+
this.moveTab(1);
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
if (this.activeTab === 2) {
|
|
1878
|
+
if (this.matches('crtr.setup.list-down', data))
|
|
1879
|
+
this.moveSystem(1);
|
|
1880
|
+
else if (this.matches('crtr.setup.list-up', data))
|
|
1881
|
+
this.moveSystem(-1);
|
|
1882
|
+
else if (this.matches('crtr.setup.toggle', data))
|
|
1883
|
+
this.toggleSystem();
|
|
1884
|
+
else if (this.matches('crtr.setup.advance', data))
|
|
1885
|
+
this.moveTab(1);
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
if (this.activeTab === 3) {
|
|
1889
|
+
this.exaInput.handleInput(data);
|
|
1890
|
+
this.invalidate();
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
if (this.activeTab === 4) {
|
|
1894
|
+
this.handleKeybindingsInput(data);
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
if (this.activeTab === 5) {
|
|
1898
|
+
if (this.models.handleInput(data))
|
|
1899
|
+
this.invalidate();
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
this.handleBrokerLimitsInput(data);
|
|
1903
|
+
}
|
|
1904
|
+
renderHeader(width) {
|
|
1905
|
+
const tabs = ['Providers', 'Plugins', 'System', 'Exa', 'Keybindings', 'Models', 'Broker limits'];
|
|
1906
|
+
const fullTabLine = tabs
|
|
1907
|
+
.map((label, index) => tabPill(label, index === this.activeTab))
|
|
1908
|
+
.join(theme.fg('dim', ' · '));
|
|
1909
|
+
const tabLine = visibleWidth(fullTabLine) <= width
|
|
1910
|
+
? fullTabLine
|
|
1911
|
+
: `${theme.fg('dim', `${this.activeTab + 1}/${tabs.length}`)} ${tabPill(tabs[this.activeTab], true)}`;
|
|
1912
|
+
return [
|
|
1913
|
+
truncateToWidth(theme.fg('accent', theme.bold('crtr sys setup')), width),
|
|
1914
|
+
truncateToWidth(tabLine, width),
|
|
1915
|
+
truncateToWidth(rule(width), width),
|
|
1916
|
+
];
|
|
1917
|
+
}
|
|
1918
|
+
renderFooter(width) {
|
|
1919
|
+
const tabs = `${this.label('crtr.setup.tab-next')} next · ${this.label('crtr.setup.tab-previous')} prev`;
|
|
1920
|
+
if (this.activeTab === 5) {
|
|
1921
|
+
const hint = this.models.isPickerOpen()
|
|
1922
|
+
? this.models.footerHint()
|
|
1923
|
+
: `${this.label('crtr.setup.list-down')}/${this.label('crtr.setup.list-up')} row · ${this.label('crtr.setup.cell-previous')}/${this.label('crtr.setup.cell-next')} column · ${this.label('crtr.setup.models.scope-next')} scope · ${this.label('crtr.setup.models.open')} edit · ${this.label('crtr.setup.tab-next')} next · ${this.label('crtr.setup.cancel')} cancel`;
|
|
1924
|
+
return [truncateToWidth(theme.fg('dim', hint), width)];
|
|
1925
|
+
}
|
|
1926
|
+
if (this.activeTab === 6) {
|
|
1927
|
+
return [truncateToWidth(theme.fg('dim', `${this.label('crtr.setup.list-down')}/${this.label('crtr.setup.list-up')} field · type value · Enter save · ${this.fieldSafeLabel('crtr.setup.tab-next')}/${this.fieldSafeLabel('crtr.setup.tab-previous')} switch tabs · ${this.label('crtr.setup.cancel')} cancel`), width)];
|
|
1928
|
+
}
|
|
1929
|
+
const line = this.confirming
|
|
1930
|
+
? `${this.label('crtr.setup.confirm.accept')} confirm · ${this.label('crtr.setup.confirm.back')} go back`
|
|
1931
|
+
: this.activeTab === 0 && this.providers.isNestedFlowActive()
|
|
1932
|
+
? 'OAuth in progress · esc cancel'
|
|
1933
|
+
: this.activeTab === 0
|
|
1934
|
+
? `↑/↓ select · a add · p prefer · r rename · l re-login · x remove · ${this.label('crtr.setup.tab-next')} next · ${this.label('crtr.setup.cancel')} cancel`
|
|
1935
|
+
: this.activeTab === 1
|
|
1936
|
+
? `${this.label('crtr.setup.list-down')}/${this.label('crtr.setup.list-up')} move · ${this.label('crtr.setup.toggle')} toggle · ${this.label('crtr.setup.details')} details · ${this.label('crtr.setup.advance')} advance · ${tabs} · ${this.label('crtr.setup.cancel')} cancel`
|
|
1937
|
+
: this.activeTab === 2
|
|
1938
|
+
? `${this.label('crtr.setup.list-down')}/${this.label('crtr.setup.list-up')} move · ${this.label('crtr.setup.toggle')} toggle · ${this.label('crtr.setup.advance')} advance · ${tabs} · ${this.label('crtr.setup.cancel')} cancel`
|
|
1939
|
+
: this.activeTab === 3
|
|
1940
|
+
? `type EXA_API_KEY · Enter finish · ${this.fieldSafeLabel('crtr.setup.tab-next')}/${this.fieldSafeLabel('crtr.setup.tab-previous')} switch tabs · Esc or ${this.fieldSafeLabel('crtr.setup.cancel')} cancel`
|
|
1941
|
+
: this.keyConfirm !== null
|
|
1942
|
+
? `${this.label('crtr.setup.confirm.accept')} confirm · ${this.label('crtr.setup.confirm.back')} go back`
|
|
1943
|
+
: this.editingKey !== null
|
|
1944
|
+
? `type gestures separated by commas · ${this.label('crtr.setup.keybindings.commit-edit')} commit · ${this.label('crtr.setup.keybindings.cancel-edit')} cancel · ${this.label('crtr.setup.keybindings.page-up')}/${this.label('crtr.setup.keybindings.page-down')} scroll`
|
|
1945
|
+
: this.filteringKeys
|
|
1946
|
+
? `filter: ${this.keyFilter || 'type to search'} · ${this.label('crtr.setup.keybindings.edit')} keep · ${this.label('crtr.setup.keybindings.filter-delete')} delete · ${this.label('crtr.setup.keybindings.filter-clear')} clear`
|
|
1947
|
+
: `${this.label('crtr.setup.list-down')}/${this.label('crtr.setup.list-up')} move · ${this.label('crtr.setup.keybindings.edit')} edit · ${this.label('crtr.setup.keybindings.unbind')} disable · ${this.label('crtr.setup.keybindings.reset-row')} reset · ${this.label('crtr.setup.keybindings.reset-all')} reset all · ${this.label('crtr.setup.keybindings.filter')} filter · ${this.label('crtr.setup.keybindings.save')} save · ${this.label('crtr.setup.keybindings.discard')} ${this.keyFilter !== '' ? 'clear filter' : 'discard'}`;
|
|
1948
|
+
return [truncateToWidth(theme.fg('dim', line), width)];
|
|
1949
|
+
}
|
|
1950
|
+
renderProviders(width) {
|
|
1951
|
+
return this.providers.render(width, Math.max(1, this.terminalRows() - 6));
|
|
1952
|
+
}
|
|
1953
|
+
renderPlugins(width) {
|
|
1954
|
+
const out = [];
|
|
1955
|
+
out.push(truncateToWidth(`${theme.fg('accent', theme.bold('Plugins'))}${theme.fg('dim', ' default ON')}`, width));
|
|
1956
|
+
for (const [index, entry] of this.manifest.entries()) {
|
|
1957
|
+
const selected = index === this.pluginIndex;
|
|
1958
|
+
const checked = this.selectedPackageIds.has(entry.id) ? theme.fg('success', '[x]') : theme.fg('dim', '[ ]');
|
|
1959
|
+
const marker = selected ? theme.fg('accent', '▶') : theme.fg('dim', ' ');
|
|
1960
|
+
const name = selected ? theme.fg('accent', entry.name) : entry.name;
|
|
1961
|
+
const status = this.installedPackageIds.has(entry.id)
|
|
1962
|
+
? theme.fg('success', '✓ installed')
|
|
1963
|
+
: theme.fg('warning', 'not installed');
|
|
1964
|
+
const line = `${marker} ${checked} ${name} ${theme.fg('dim', '—')} ${theme.fg('muted', entry.shortDescription)} ${status}`;
|
|
1965
|
+
out.push(truncateToWidth(line, width));
|
|
1966
|
+
if (this.expandedPluginId === entry.id) {
|
|
1967
|
+
for (const line of wrapText(entry.longDescription, Math.max(1, width - 4))) {
|
|
1968
|
+
out.push(truncateToWidth(theme.fg('dim', ` ${line}`), width));
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
return out;
|
|
1973
|
+
}
|
|
1974
|
+
renderSystems(width) {
|
|
1975
|
+
const out = [];
|
|
1976
|
+
out.push(truncateToWidth(`${theme.fg('accent', theme.bold('System deps'))}${theme.fg('dim', ' tmux + nvim check')}`, width));
|
|
1977
|
+
for (const [index, tool] of this.systemTools.entries()) {
|
|
1978
|
+
const selected = index === this.systemIndex;
|
|
1979
|
+
const marker = selected ? theme.fg('accent', '▶') : theme.fg('dim', ' ');
|
|
1980
|
+
if (tool.installed) {
|
|
1981
|
+
const line = `${marker} ${theme.fg('success', '✓ installed')} ${theme.fg('muted', toolLabel(tool.tool))}`;
|
|
1982
|
+
out.push(truncateToWidth(line, width));
|
|
1983
|
+
continue;
|
|
1984
|
+
}
|
|
1985
|
+
const checked = this.selectedSystemTools.has(tool.tool) ? theme.fg('success', '[x]') : theme.fg('dim', '[ ]');
|
|
1986
|
+
const label = tool.plan.command ?? tool.plan.hint;
|
|
1987
|
+
const name = selected ? theme.fg('accent', `Install ${toolLabel(tool.tool)}`) : `Install ${toolLabel(tool.tool)}`;
|
|
1988
|
+
const line = `${marker} ${checked} ${name} ${theme.fg('dim', '—')} ${theme.fg('muted', label)} ${theme.fg('warning', 'not installed')}`;
|
|
1989
|
+
out.push(truncateToWidth(line, width));
|
|
1990
|
+
}
|
|
1991
|
+
return out;
|
|
1992
|
+
}
|
|
1993
|
+
renderExa(width) {
|
|
1994
|
+
const out = [];
|
|
1995
|
+
out.push(truncateToWidth(`${theme.fg('accent', theme.bold('Exa key'))}${theme.fg('dim', ' optional')}${keyStatusBadge(detectExaKey(), 'EXA_API_KEY')}`, width));
|
|
1996
|
+
out.push(truncateToWidth(`${theme.fg('mdLink', 'Create a key: ')}${theme.fg('mdLinkUrl', 'https://dashboard.exa.ai/api-keys')}`, width));
|
|
1997
|
+
out.push(truncateToWidth(theme.fg('dim', `Will write to: ${resolveExaKeyPath()}`), width));
|
|
1998
|
+
out.push(...framed([
|
|
1999
|
+
theme.fg('accent', theme.bold('Paste EXA_API_KEY here')),
|
|
2000
|
+
theme.fg('dim', detectExaKey().present ? 'Leave blank to keep the existing key; paste to replace it.' : 'Leave blank to skip.'),
|
|
2001
|
+
...this.exaInput.render(Math.max(1, width - 4)),
|
|
2002
|
+
], width));
|
|
2003
|
+
return out;
|
|
2004
|
+
}
|
|
2005
|
+
renderConfirm(width) {
|
|
2006
|
+
const out = [truncateToWidth(theme.fg('warning', theme.bold('Confirm installs')), width)];
|
|
2007
|
+
const submission = this.buildSubmission();
|
|
2008
|
+
if (submission.packages.length === 0 && submission.systemDeps.length === 0 && submission.exaKey === '') {
|
|
2009
|
+
out.push(truncateToWidth(theme.fg('success', `Nothing to install; ${this.label('crtr.setup.confirm.accept')} finish.`), width));
|
|
2010
|
+
return out;
|
|
2011
|
+
}
|
|
2012
|
+
if (submission.packages.length > 0) {
|
|
2013
|
+
out.push(truncateToWidth(theme.fg('accent', 'Packages'), width));
|
|
2014
|
+
for (const entry of submission.packages) {
|
|
2015
|
+
const action = this.installedPackageIds.has(entry.id)
|
|
2016
|
+
? theme.fg('success', 'skip (already installed)')
|
|
2017
|
+
: theme.fg('muted', `pi install ${entry.installSource}`);
|
|
2018
|
+
out.push(truncateToWidth(` • ${entry.name} ${theme.fg('dim', '→')} ${action}`, width));
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
if (submission.systemDeps.length > 0) {
|
|
2022
|
+
out.push(truncateToWidth(theme.fg('accent', 'System deps'), width));
|
|
2023
|
+
for (const plan of submission.systemDeps) {
|
|
2024
|
+
out.push(truncateToWidth(` • ${plan.tool} ${theme.fg('dim', '→')} ${theme.fg('muted', plan.command ?? plan.hint)}`, width));
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
if (submission.exaKey !== '') {
|
|
2028
|
+
out.push(truncateToWidth(`${theme.fg('accent', 'Exa key')} ${theme.fg('dim', '→')} ${theme.fg('warning', `write ${submission.exaKeyPath}`)}`, width));
|
|
2029
|
+
}
|
|
2030
|
+
out.push(truncateToWidth(theme.fg('dim', `${this.label('crtr.setup.confirm.accept')} confirm · ${this.label('crtr.setup.confirm.back')} go back`), width));
|
|
2031
|
+
return out;
|
|
2032
|
+
}
|
|
2033
|
+
// Does the row at `index` contribute a diagnostic line in the current state?
|
|
2034
|
+
// Mirrors the emit loop's `message` computation so the line-cost accounting
|
|
2035
|
+
// and the render stay in lockstep.
|
|
2036
|
+
keyRowHasMessage(rows, index) {
|
|
2037
|
+
const definition = rows[index];
|
|
2038
|
+
const selected = index === this.keyIndex;
|
|
2039
|
+
const editing = this.editingKey === definition.id;
|
|
2040
|
+
if (!selected && !editing)
|
|
2041
|
+
return false;
|
|
2042
|
+
if (editing && this.keyEditError)
|
|
2043
|
+
return true;
|
|
2044
|
+
const diagnostic = this.keyDiagnostics.find((entry) => entry.bindingId === definition.id || entry.relatedBindingIds?.includes(definition.id));
|
|
2045
|
+
return diagnostic !== undefined;
|
|
2046
|
+
}
|
|
2047
|
+
// Output lines the visible rows [start..end] cost, counting the per-row group
|
|
2048
|
+
// heading (the first visible row always re-emits its heading) and any
|
|
2049
|
+
// diagnostic line. Used to clamp the scroll so the anchor row always renders.
|
|
2050
|
+
keyLineCost(rows, start, end) {
|
|
2051
|
+
let lines = 0;
|
|
2052
|
+
let previousGroup;
|
|
2053
|
+
for (let index = start; index <= end; index += 1) {
|
|
2054
|
+
const definition = rows[index];
|
|
2055
|
+
lines += (definition.group !== previousGroup ? 1 : 0) + 1 + (this.keyRowHasMessage(rows, index) ? 1 : 0);
|
|
2056
|
+
previousGroup = definition.group;
|
|
2057
|
+
}
|
|
2058
|
+
return lines;
|
|
2059
|
+
}
|
|
2060
|
+
renderKeybindings(width) {
|
|
2061
|
+
const out = [];
|
|
2062
|
+
const rows = this.filteredKeybindings();
|
|
2063
|
+
const resolution = this.keyDraft.resolution();
|
|
2064
|
+
const viewport = this.keyViewportLines();
|
|
2065
|
+
const pageSize = this.keyPageSize();
|
|
2066
|
+
const maxScroll = Math.max(0, rows.length - pageSize);
|
|
2067
|
+
this.keyScroll = Math.max(0, Math.min(this.keyScroll, maxScroll));
|
|
2068
|
+
if (this.keyIndex < this.keyScroll)
|
|
2069
|
+
this.keyScroll = this.keyIndex;
|
|
2070
|
+
if (this.keyIndex >= this.keyScroll + pageSize)
|
|
2071
|
+
this.keyScroll = Math.max(0, this.keyIndex - pageSize + 1);
|
|
2072
|
+
// Anchor that must stay on screen: the row being edited (so the editor never
|
|
2073
|
+
// vanishes while paging moves the selection — m3), else the selection itself.
|
|
2074
|
+
// Injected group-heading and diagnostic lines can make a pageSize-row window
|
|
2075
|
+
// exceed the raw viewport, so instead of a fixed reserve, clamp the scroll
|
|
2076
|
+
// dynamically until the anchor is guaranteed to render within `viewport`.
|
|
2077
|
+
const editIndex = this.editingKey !== null ? rows.findIndex((row) => row.id === this.editingKey) : -1;
|
|
2078
|
+
const anchor = editIndex >= 0 ? editIndex : this.keyIndex;
|
|
2079
|
+
if (anchor >= 0) {
|
|
2080
|
+
if (anchor < this.keyScroll)
|
|
2081
|
+
this.keyScroll = anchor;
|
|
2082
|
+
while (this.keyScroll < anchor && this.keyLineCost(rows, this.keyScroll, anchor) > viewport) {
|
|
2083
|
+
this.keyScroll += 1;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
const dirty = this.keyDraft.dirty ? theme.fg('warning', 'unsaved') : theme.fg('success', 'saved');
|
|
2087
|
+
out.push(truncateToWidth(`${theme.fg('accent', theme.bold('Keybindings'))}${theme.fg('dim', ' crouter-owned only · ')}${dirty}`, width));
|
|
2088
|
+
out.push(truncateToWidth(theme.fg('dim', this.keyFilter === ''
|
|
2089
|
+
? `${rows.length} actions`
|
|
2090
|
+
: `${rows.length} matches for “${this.keyFilter}”${this.filteringKeys ? '' : ` · ${this.label('crtr.setup.keybindings.discard')} clears filter`}`), width));
|
|
2091
|
+
if (resolution.diagnostics.some((diagnostic) => diagnostic.code === 'invalid-keybindings')) {
|
|
2092
|
+
out.push(truncateToWidth(theme.fg('warning', theme.bold(`Saved keybindings root is invalid — ${this.label('crtr.setup.keybindings.reset-all')} (reset all) to clear it before editing.`)), width));
|
|
2093
|
+
}
|
|
2094
|
+
if (rows.length === 0) {
|
|
2095
|
+
out.push('');
|
|
2096
|
+
out.push(truncateToWidth(theme.fg('warning', 'No matching keybindings.'), width));
|
|
2097
|
+
return out;
|
|
2098
|
+
}
|
|
2099
|
+
const nameWidth = Math.max(16, Math.min(28, Math.floor(width * 0.28)));
|
|
2100
|
+
const keyWidth = Math.max(18, Math.min(34, Math.floor(width * 0.34)));
|
|
2101
|
+
const showDescription = width >= 72;
|
|
2102
|
+
let emitted = 0;
|
|
2103
|
+
let previousGroup;
|
|
2104
|
+
for (let index = this.keyScroll; index < rows.length; index += 1) {
|
|
2105
|
+
const definition = rows[index];
|
|
2106
|
+
const selected = index === this.keyIndex;
|
|
2107
|
+
const editing = this.editingKey === definition.id;
|
|
2108
|
+
const diagnostics = (selected || editing)
|
|
2109
|
+
? this.keyDiagnostics.filter((diagnostic) => diagnostic.bindingId === definition.id || diagnostic.relatedBindingIds?.includes(definition.id))
|
|
2110
|
+
: [];
|
|
2111
|
+
const message = editing ? (this.keyEditError ?? diagnostics[0]?.message) : (selected ? diagnostics[0]?.message : undefined);
|
|
2112
|
+
// Budget output lines (heading + row + optional diagnostic) so the list
|
|
2113
|
+
// never clips the confirm prompt / notice / footer below it.
|
|
2114
|
+
const cost = (definition.group !== previousGroup ? 1 : 0) + 1 + (message ? 1 : 0);
|
|
2115
|
+
if (emitted > 0 && emitted + cost > viewport)
|
|
2116
|
+
break;
|
|
2117
|
+
if (definition.group !== previousGroup) {
|
|
2118
|
+
out.push(truncateToWidth(theme.fg('accent', definition.group), width));
|
|
2119
|
+
previousGroup = definition.group;
|
|
2120
|
+
}
|
|
2121
|
+
const marker = selected ? theme.fg('accent', '▶') : ' ';
|
|
2122
|
+
const sourceMark = resolution.get(definition.id).source === 'user' ? theme.fg('warning', '•') : ' ';
|
|
2123
|
+
const name = padAnsi(selected ? theme.fg('accent', definition.name) : definition.name, nameWidth);
|
|
2124
|
+
// Render the edit field whenever THIS row is the one being edited — even if
|
|
2125
|
+
// paging has moved the selection elsewhere — so the active editor stays
|
|
2126
|
+
// visible while it captures input.
|
|
2127
|
+
const keyText = editing ? (this.keyInput.render(keyWidth)[0] ?? '') : formatBinding(resolution, definition.id);
|
|
2128
|
+
const key = padAnsi(keyText, keyWidth);
|
|
2129
|
+
const description = showDescription ? ` ${theme.fg('dim', definition.description)}` : '';
|
|
2130
|
+
out.push(truncateToWidth(`${marker}${sourceMark} ${name} ${key}${description}`, width));
|
|
2131
|
+
if (message)
|
|
2132
|
+
out.push(truncateToWidth(theme.fg('warning', ` ${message}`), width));
|
|
2133
|
+
emitted += cost;
|
|
2134
|
+
}
|
|
2135
|
+
if (this.keyConfirm !== null) {
|
|
2136
|
+
out.push('');
|
|
2137
|
+
out.push(truncateToWidth(theme.fg('warning', theme.bold(this.keyConfirm === 'reset-all'
|
|
2138
|
+
? 'Reset every keybinding to its catalog default?'
|
|
2139
|
+
: 'Discard every unsaved keybinding change?')), width));
|
|
2140
|
+
}
|
|
2141
|
+
if (this.keyNotice)
|
|
2142
|
+
out.push(truncateToWidth(theme.fg('muted', this.keyNotice), width));
|
|
2143
|
+
return out;
|
|
2144
|
+
}
|
|
2145
|
+
renderModels(width) {
|
|
2146
|
+
return this.models.render(width, Math.max(1, this.terminalRows() - 6));
|
|
2147
|
+
}
|
|
2148
|
+
renderBrokerLimits(width) {
|
|
2149
|
+
const out = [];
|
|
2150
|
+
const inputWidth = Math.max(8, width - 28);
|
|
2151
|
+
const renderLimit = (index, label, description, input) => {
|
|
2152
|
+
const selected = index === this.brokerLimitIndex;
|
|
2153
|
+
const marker = selected ? theme.fg('accent', '▶') : ' ';
|
|
2154
|
+
const name = selected ? theme.fg('accent', label) : label;
|
|
2155
|
+
const value = input.render(inputWidth)[0] ?? '';
|
|
2156
|
+
out.push(truncateToWidth(`${marker} ${padAnsi(name, 24)} ${value}`, width));
|
|
2157
|
+
out.push(truncateToWidth(theme.fg('dim', ` ${description}`), width));
|
|
2158
|
+
};
|
|
2159
|
+
out.push(truncateToWidth(`${theme.fg('accent', theme.bold('Broker limits'))}${theme.fg('dim', ' user scope · defaults 128 / 256')}`, width));
|
|
2160
|
+
out.push(truncateToWidth(theme.fg('dim', 'These bounds govern daemon automatic revive; explicit node revives remain available.'), width));
|
|
2161
|
+
out.push('');
|
|
2162
|
+
renderLimit(0, 'Warning threshold', 'Warn when live brokers reach this count. Default: 128.', this.brokerWarningInput);
|
|
2163
|
+
renderLimit(1, 'Automatic-revive hard cap', 'Defer automatic revives at this count. Default: 256.', this.brokerHardCapInput);
|
|
2164
|
+
out.push('');
|
|
2165
|
+
for (const line of wrapText(`Configured limits apply next tick. ${BROKER_LIMIT_OVERRIDE_PRECEDENCE}`, width)) {
|
|
2166
|
+
out.push(theme.fg('dim', line));
|
|
2167
|
+
}
|
|
2168
|
+
if (this.brokerLimitNotice) {
|
|
2169
|
+
const role = this.brokerLimitNotice.startsWith('Saved') ? 'success' : 'warning';
|
|
2170
|
+
for (const line of wrapText(this.brokerLimitNotice, width))
|
|
2171
|
+
out.push(theme.fg(role, line));
|
|
2172
|
+
}
|
|
2173
|
+
return out;
|
|
2174
|
+
}
|
|
2175
|
+
render(width) {
|
|
2176
|
+
const bypass = this.activeTab === 5 && this.models.isPickerOpen();
|
|
2177
|
+
const height = this.terminalRows();
|
|
2178
|
+
if (!bypass && this.cachedLines && this.cachedWidth === width && this.cachedHeight === height)
|
|
2179
|
+
return this.cachedLines;
|
|
2180
|
+
const lines = [
|
|
2181
|
+
...this.renderHeader(width),
|
|
2182
|
+
'',
|
|
2183
|
+
...(this.confirming
|
|
2184
|
+
? this.renderConfirm(width)
|
|
2185
|
+
: this.activeTab === 0
|
|
2186
|
+
? this.renderProviders(width)
|
|
2187
|
+
: this.activeTab === 1
|
|
2188
|
+
? this.renderPlugins(width)
|
|
2189
|
+
: this.activeTab === 2
|
|
2190
|
+
? this.renderSystems(width)
|
|
2191
|
+
: this.activeTab === 3
|
|
2192
|
+
? this.renderExa(width)
|
|
2193
|
+
: this.activeTab === 4
|
|
2194
|
+
? this.renderKeybindings(width)
|
|
2195
|
+
: this.activeTab === 5
|
|
2196
|
+
? this.renderModels(width)
|
|
2197
|
+
: this.renderBrokerLimits(width)),
|
|
2198
|
+
'',
|
|
2199
|
+
...this.renderFooter(width),
|
|
2200
|
+
];
|
|
2201
|
+
const rendered = renderRows(lines, width);
|
|
2202
|
+
if (!bypass) {
|
|
2203
|
+
this.cachedWidth = width;
|
|
2204
|
+
this.cachedHeight = height;
|
|
2205
|
+
this.cachedLines = rendered;
|
|
2206
|
+
}
|
|
2207
|
+
return rendered;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
export async function runSetup() {
|
|
2211
|
+
const state = buildSetupInitialState();
|
|
2212
|
+
// Front-door reconciliation: invoking `crtr sys setup` — TTY or not —
|
|
2213
|
+
// refreshes crouter-owned tmux bindings and registers known nodes' interaction
|
|
2214
|
+
// roots so resolved tickets can call back into the asking node. Best-effort +
|
|
2215
|
+
// idempotent, so it is safe to run on every invocation regardless of whether
|
|
2216
|
+
// the wizard is opened, canceled, or submitted (the post-submission call
|
|
2217
|
+
// re-runs it harmlessly).
|
|
2218
|
+
await reconcileInboxFrontDoor();
|
|
2219
|
+
if (!process.stdout.isTTY) {
|
|
2220
|
+
process.stdout.write(renderSetupStaticInstructions(state));
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2223
|
+
applyTheme({ cwd: process.cwd() });
|
|
2224
|
+
const agentDir = defaultAgentDir();
|
|
2225
|
+
// The runtime reads the SAME credentials every crouter surface does, through crouter's
|
|
2226
|
+
// own CredentialStore (pi 0.82 made credential storage app-owned): the subscription pool
|
|
2227
|
+
// for managed providers, auth.json for the rest. `registry` is pi's synchronous facade
|
|
2228
|
+
// over it, which the panels' sync reads need.
|
|
2229
|
+
const runtime = await ModelRuntime.create({
|
|
2230
|
+
credentials: new PoolCredentialStore(join(agentDir, 'auth.json')),
|
|
2231
|
+
modelsPath: join(agentDir, 'models.json'),
|
|
2232
|
+
});
|
|
2233
|
+
const registry = new ModelRegistry(runtime);
|
|
2234
|
+
const rawUserConfig = readRawScopeConfig('user');
|
|
2235
|
+
const rawKeybindings = rawUserConfig?.keybindings;
|
|
2236
|
+
const openingBindings = resolveKeybindings(rawKeybindings);
|
|
2237
|
+
const terminal = new ProcessTerminal();
|
|
2238
|
+
const tui = new TUI(terminal, true);
|
|
2239
|
+
const wizard = new SetupWizard(state.manifest, state.installedPackageIds, state.systemTools, tui, agentDir, runtime, registry, openingBindings, rawKeybindings, () => terminal.rows);
|
|
2240
|
+
tui.addChild(wizard);
|
|
2241
|
+
tui.setFocus(wizard);
|
|
2242
|
+
await new Promise((resolve, reject) => {
|
|
2243
|
+
let restored = false;
|
|
2244
|
+
const restore = () => {
|
|
2245
|
+
if (restored)
|
|
2246
|
+
return;
|
|
2247
|
+
restored = true;
|
|
2248
|
+
wizard.dispose();
|
|
2249
|
+
try {
|
|
2250
|
+
tui.stop();
|
|
2251
|
+
}
|
|
2252
|
+
catch {
|
|
2253
|
+
/* best-effort terminal restore */
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
let done = false;
|
|
2257
|
+
const finish = () => {
|
|
2258
|
+
if (done)
|
|
2259
|
+
return;
|
|
2260
|
+
done = true;
|
|
2261
|
+
restore();
|
|
2262
|
+
resolve();
|
|
2263
|
+
};
|
|
2264
|
+
const fail = (error) => {
|
|
2265
|
+
if (done)
|
|
2266
|
+
return;
|
|
2267
|
+
done = true;
|
|
2268
|
+
restore();
|
|
2269
|
+
reject(error);
|
|
2270
|
+
};
|
|
2271
|
+
const onSignal = () => finish();
|
|
2272
|
+
process.once('exit', restore);
|
|
2273
|
+
process.once('SIGTERM', onSignal);
|
|
2274
|
+
process.once('SIGHUP', onSignal);
|
|
2275
|
+
process.once('SIGINT', onSignal);
|
|
2276
|
+
// Emergency cancel: the control gestures of `crtr.setup.cancel` (ctrl+c /
|
|
2277
|
+
// ctrl+d in the shipped catalog) must always exit setup — from filter entry,
|
|
2278
|
+
// the confirm prompts, or while a nested ProviderPanel login flow owns focus —
|
|
2279
|
+
// where the focused component would otherwise swallow them. Matching is driven
|
|
2280
|
+
// by the opening snapshot; the control-char guard keeps printable cancel gestures
|
|
2281
|
+
// (e.g. q) as data for text fields and the filter buffer, which the wizard
|
|
2282
|
+
// handles as cancel only in its own non-text states.
|
|
2283
|
+
tui.addInputListener((data) => {
|
|
2284
|
+
if (data.length > 0 && data.charCodeAt(0) < 32
|
|
2285
|
+
&& matchesPiTuiInput(openingBindings, 'crtr.setup.cancel', data, (input, gesture) => matchesKey(input, gesture))) {
|
|
2286
|
+
finish();
|
|
2287
|
+
return { consume: true };
|
|
2288
|
+
}
|
|
2289
|
+
return undefined;
|
|
2290
|
+
});
|
|
2291
|
+
wizard.onCancel = finish;
|
|
2292
|
+
wizard.onSubmit = (submission) => {
|
|
2293
|
+
restore();
|
|
2294
|
+
void executeSetupSubmission(submission)
|
|
2295
|
+
.then((summary) => {
|
|
2296
|
+
if (done)
|
|
2297
|
+
return;
|
|
2298
|
+
done = true;
|
|
2299
|
+
process.stdout.write(formatSetupExecutionSummary(summary));
|
|
2300
|
+
resolve();
|
|
2301
|
+
}, fail);
|
|
2302
|
+
};
|
|
2303
|
+
try {
|
|
2304
|
+
tui.start();
|
|
2305
|
+
}
|
|
2306
|
+
catch (error) {
|
|
2307
|
+
fail(error);
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
}
|