@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,1273 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* Combined `inbox` view — the PORTABLE CORE (manifest · init · sources ·
|
|
4
|
+
* commands · intents). One core renders in BOTH targets: the tmux TUI
|
|
5
|
+
* (`crtr view run inbox`, via `tui.mjs`) and the React+Tailwind web page
|
|
6
|
+
* (`crtr view serve inbox`, via `web.jsx`).
|
|
7
|
+
*
|
|
8
|
+
* Runs in BOTH Node and the browser, so it imports nothing host-bound — no
|
|
9
|
+
* `node:*`, no crtr. The LinkedIn data layer lives ONCE in the sibling
|
|
10
|
+
* browser-safe `../linkedin/core.mjs` (shared `Source`/`Command` descriptors +
|
|
11
|
+
* the single `classify`/`applyFromMe`), imported here rather than duplicated.
|
|
12
|
+
* Gmail's data logic is inlined as transport-agnostic `Source`/`Command`
|
|
13
|
+
* descriptors (`{id, request, parse}`): the core describes WHAT capture command
|
|
14
|
+
* to run, the host's Transport runs it (local `execFile` for the TUI, the HTTP
|
|
15
|
+
* bridge for web), and the pure `parse()` turns bytes → typed data | typed
|
|
16
|
+
* `SourceError`.
|
|
17
|
+
*
|
|
18
|
+
* NOTHING throws. Sources return a `Result<T>`; each source owns its
|
|
19
|
+
* discover→auth→settle recovery state machine, restated in the `refresh` intent
|
|
20
|
+
* via `ctx.resolve`/`ctx.execute`. Partial readiness is mandatory: a down source
|
|
21
|
+
* contributes zero rows + its own slim banner; every ready source's rows show.
|
|
22
|
+
*
|
|
23
|
+
* @module inbox/core
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
discoverTabSource,
|
|
28
|
+
contextSource,
|
|
29
|
+
conversationsSource,
|
|
30
|
+
openTabCommand,
|
|
31
|
+
navigateCommand,
|
|
32
|
+
viewThreadCommand,
|
|
33
|
+
sendMessageCommand,
|
|
34
|
+
reactCommand,
|
|
35
|
+
applyFromMe,
|
|
36
|
+
} from '../linkedin/core.mjs';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @typedef {import('../../core/view/contract.js').SourceError} SourceError
|
|
40
|
+
* @typedef {import('../../core/view/contract.js').IntentCtx<InboxState>} Ctx
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
// ── Merge currency (the shared shapes presenters read) ────────────────────────
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* One left-pane row in the merged stream.
|
|
47
|
+
* @typedef {Object} UnifiedRow
|
|
48
|
+
* @property {string} sourceId 'linkedin' | 'gmail'
|
|
49
|
+
* @property {string} key Globally-unique selection id (`<src>:<id>`).
|
|
50
|
+
* @property {string} name
|
|
51
|
+
* @property {string} snippet
|
|
52
|
+
* @property {boolean} unread
|
|
53
|
+
* @property {number} ts Epoch ms (0 if unknown).
|
|
54
|
+
* @property {any} ref Opaque source handle round-tripped to open/reply.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* One message in the right-pane thread.
|
|
58
|
+
* @typedef {Object} UnifiedMessage
|
|
59
|
+
* @property {string} sender
|
|
60
|
+
* @property {boolean} fromMe
|
|
61
|
+
* @property {string} text
|
|
62
|
+
* @property {number} ts
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Right-pane thread payload.
|
|
66
|
+
* @typedef {Object} UnifiedThread
|
|
67
|
+
* @property {string} title
|
|
68
|
+
* @property {string} [subtitle]
|
|
69
|
+
* @property {UnifiedMessage[]} messages
|
|
70
|
+
* @property {boolean} canReply
|
|
71
|
+
* @property {boolean} canReact
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* @typedef {Object} Conversation
|
|
75
|
+
* @property {string} urn
|
|
76
|
+
* @property {string} name
|
|
77
|
+
* @property {string} lastMessage
|
|
78
|
+
* @property {boolean} unread
|
|
79
|
+
* @property {number} ts
|
|
80
|
+
* @property {string} recipientId
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* The view's immutable state (the core owns it; intents replace it via ctx.set).
|
|
84
|
+
* @typedef {Object} InboxState
|
|
85
|
+
* @property {{linkedin:any, gmail:any}} subs Per-source auth/tab substate.
|
|
86
|
+
* @property {Record<string, UnifiedRow[]>} rowsBySource
|
|
87
|
+
* @property {UnifiedRow[]} rows
|
|
88
|
+
* @property {number} cursor
|
|
89
|
+
* @property {number} scroll
|
|
90
|
+
* @property {string|null} openKey
|
|
91
|
+
* @property {UnifiedRow|null} openRow
|
|
92
|
+
* @property {UnifiedThread|null} thread
|
|
93
|
+
* @property {number} threadScroll
|
|
94
|
+
* @property {'list'|'reply'|'react'} mode
|
|
95
|
+
* @property {string} draft
|
|
96
|
+
* @property {number} reactCursor
|
|
97
|
+
* @property {'all'|'linkedin'|'gmail'} filter
|
|
98
|
+
* @property {Record<string, SourceError|null>} banners
|
|
99
|
+
* @property {Record<string, boolean>} ready
|
|
100
|
+
* @property {number} lastFetch
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
// ── Result helpers (inlined — the core imports nothing) ───────────────────────
|
|
104
|
+
|
|
105
|
+
/** @template T @param {T} [data] @returns {{ok:true, data:any}} */
|
|
106
|
+
function ok(data) {
|
|
107
|
+
return { ok: true, data };
|
|
108
|
+
}
|
|
109
|
+
/** @param {SourceError} error @returns {{ok:false, error:SourceError}} */
|
|
110
|
+
function fail(error) {
|
|
111
|
+
return { ok: false, error };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ── Presenter-facing constants ────────────────────────────────────────────────
|
|
115
|
+
|
|
116
|
+
/** Fixed emoji set for the react picker. */
|
|
117
|
+
export const EMOJIS = ['👍', '❤️', '😂', '🔥', '👏', '😮'];
|
|
118
|
+
|
|
119
|
+
/** Severity rank for choosing one banner / one guided panel across sources. */
|
|
120
|
+
const LEVEL_RANK = { error: 3, action: 2, info: 1 };
|
|
121
|
+
|
|
122
|
+
/** Ordered source metadata (LinkedIn first). The presenters read this. */
|
|
123
|
+
export const SOURCES_META = [
|
|
124
|
+
{ id: 'linkedin', label: 'LinkedIn', badge: { glyph: 'in', fg: '36' }, connectKey: 'L' },
|
|
125
|
+
{ id: 'gmail', label: 'Gmail', badge: { glyph: '@', fg: '31' }, connectKey: 'G' },
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
/** id → meta, for badge/label lookup. */
|
|
129
|
+
const SOURCE_BY_ID = {};
|
|
130
|
+
for (const m of SOURCES_META) SOURCE_BY_ID[m.id] = m;
|
|
131
|
+
|
|
132
|
+
/** @param {string} id @returns {{glyph:string, fg:string}} */
|
|
133
|
+
export function badgeFor(id) {
|
|
134
|
+
const m = SOURCE_BY_ID[id];
|
|
135
|
+
return (m && m.badge) || { glyph: '?', fg: '37' };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @param {string} id @returns {string} */
|
|
139
|
+
function labelFor(id) {
|
|
140
|
+
const m = SOURCE_BY_ID[id];
|
|
141
|
+
return (m && m.label) || id;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ── Pure presenter helpers (shared by tui + web + text) ───────────────────────
|
|
145
|
+
|
|
146
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
147
|
+
|
|
148
|
+
/** @param {string} s @param {number} n @returns {string} */
|
|
149
|
+
export function truncate(s, n) {
|
|
150
|
+
const str = String(s == null ? '' : s);
|
|
151
|
+
return str.length > n ? str.slice(0, Math.max(0, n - 1)) + '…' : str;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** @param {string} s @param {number} n @returns {string} */
|
|
155
|
+
export function padEnd(s, n) {
|
|
156
|
+
const str = String(s == null ? '' : s);
|
|
157
|
+
return str.length >= n ? str.slice(0, n) : str + ' '.repeat(n - str.length);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Relative-timestamp ladder, max ~5 cols: now / {m}m / {h}h / {d}d /
|
|
162
|
+
* `Mon D` (this year) / `Mon ʼYY` (prior year).
|
|
163
|
+
* @param {number} ts epoch ms (0 ⇒ '') @param {number} [now] @returns {string}
|
|
164
|
+
*/
|
|
165
|
+
export function relTimestamp(ts, now = Date.now()) {
|
|
166
|
+
if (!ts) return '';
|
|
167
|
+
const s = Math.floor((now - ts) / 1000);
|
|
168
|
+
if (s < 60) return 'now';
|
|
169
|
+
const m = Math.floor(s / 60);
|
|
170
|
+
if (m < 60) return `${m}m`;
|
|
171
|
+
const h = Math.floor(m / 60);
|
|
172
|
+
if (h < 24) return `${h}h`;
|
|
173
|
+
const d = Math.floor(h / 24);
|
|
174
|
+
if (d < 7) return `${d}d`;
|
|
175
|
+
const dt = new Date(ts);
|
|
176
|
+
const mon = MONTHS[dt.getMonth()] || '';
|
|
177
|
+
const cur = new Date(now);
|
|
178
|
+
if (dt.getFullYear() === cur.getFullYear()) return `${mon} ${dt.getDate()}`;
|
|
179
|
+
return `${mon} ʼ${String(dt.getFullYear()).slice(-2)}`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Calendar-day key for day-divider grouping. @param {number} ts @returns {string} */
|
|
183
|
+
export function dayKey(ts) {
|
|
184
|
+
if (!ts) return '';
|
|
185
|
+
const d = new Date(ts);
|
|
186
|
+
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Human day label for the divider: Today / Yesterday / Mon D / Mon D, YYYY. */
|
|
190
|
+
export function dayLabel(ts, now = Date.now()) {
|
|
191
|
+
const d = new Date(ts);
|
|
192
|
+
const n = new Date(now);
|
|
193
|
+
const same = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
194
|
+
if (same(d, n)) return 'Today';
|
|
195
|
+
if (same(d, new Date(now - 86400000))) return 'Yesterday';
|
|
196
|
+
const mon = MONTHS[d.getMonth()] || '';
|
|
197
|
+
if (d.getFullYear() === n.getFullYear()) return `${mon} ${d.getDate()}`;
|
|
198
|
+
return `${mon} ${d.getDate()}, ${d.getFullYear()}`;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Prefix a source's banner with its label — `Gmail: log in, then press g`. Stays
|
|
203
|
+
* robust if a source baked the label in (no double-prefix).
|
|
204
|
+
* @param {string} label @param {string} banner @returns {string}
|
|
205
|
+
*/
|
|
206
|
+
export function labeled(label, banner) {
|
|
207
|
+
const b = String(banner == null ? '' : banner);
|
|
208
|
+
const lead = `${label}:`.toLowerCase();
|
|
209
|
+
return b.toLowerCase().startsWith(lead) ? b : `${label}: ${b}`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Sum unread across READY sources (independent of the visible filter). */
|
|
213
|
+
export function unreadCount(state) {
|
|
214
|
+
let n = 0;
|
|
215
|
+
for (const m of SOURCES_META) {
|
|
216
|
+
if (!state.ready[m.id]) continue;
|
|
217
|
+
for (const r of state.rowsBySource[m.id] || []) if (r.unread) n++;
|
|
218
|
+
}
|
|
219
|
+
return n;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Pick the most-severe down-source display for the no-rows guided panel
|
|
224
|
+
* (blocking states win decisively).
|
|
225
|
+
* @param {InboxState} state @returns {{label:string, d:any}|null}
|
|
226
|
+
*/
|
|
227
|
+
export function pickGuided(state) {
|
|
228
|
+
let best = null;
|
|
229
|
+
let bestScore = -1;
|
|
230
|
+
for (const m of SOURCES_META) {
|
|
231
|
+
const e = state.banners[m.id];
|
|
232
|
+
if (!e || !e.display) continue;
|
|
233
|
+
const score = (LEVEL_RANK[e.display.level] || 0) + (e.display.blocking ? 10 : 0);
|
|
234
|
+
if (score > bestScore) {
|
|
235
|
+
bestScore = score;
|
|
236
|
+
best = { label: m.label, d: e.display };
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return best;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// ── Shared capture plumbing (exec code strings + classifiers) ─────────────────
|
|
243
|
+
|
|
244
|
+
const GMAIL_URL = 'https://mail.google.com';
|
|
245
|
+
const CONVO_COUNT = 25;
|
|
246
|
+
const INBOX_COUNT = 25;
|
|
247
|
+
const SETTLE_MAX = 5;
|
|
248
|
+
const SETTLE_INTERVAL_MS = 1200;
|
|
249
|
+
/** Error kinds that waiting can't fix — stop the settle-poll and guide. */
|
|
250
|
+
const HARD_STOP = new Set(['no-cdp', 'not-logged-in', 'capture-not-dev', 'capture-missing']);
|
|
251
|
+
|
|
252
|
+
/** Pure: setTimeout exists in both Node and the browser. @param {number} ms */
|
|
253
|
+
function sleep(ms) {
|
|
254
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Serialize a JS arg object as a literal safe to splice into the exec code
|
|
259
|
+
* string (escape U+2028/U+2029).
|
|
260
|
+
* @param {Record<string, unknown>} obj @returns {string}
|
|
261
|
+
*/
|
|
262
|
+
function jsLiteral(obj) {
|
|
263
|
+
return JSON.stringify(obj).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Build the vault-lib exec code string. `libArgs === null` ⇒ a no-arg call.
|
|
268
|
+
* @param {string} lib @param {string} fn @param {Record<string, unknown>|null} libArgs
|
|
269
|
+
* @returns {string}
|
|
270
|
+
*/
|
|
271
|
+
function execCode(lib, fn, libArgs) {
|
|
272
|
+
const call = libArgs === null ? `${fn}()` : `${fn}(${jsLiteral(libArgs)})`;
|
|
273
|
+
return `import {${fn}} from '${lib}'; return await ${call}`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** Append --target / --port to an argv (in place). @param {string[]} argv */
|
|
277
|
+
function withTP(argv, target, port) {
|
|
278
|
+
if (target) argv.push('--target', String(target));
|
|
279
|
+
if (port != null && port !== '') argv.push('--port', String(port));
|
|
280
|
+
return argv;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Append only --port. @param {string[]} argv */
|
|
284
|
+
function withPort(argv, port) {
|
|
285
|
+
if (port != null && port !== '') argv.push('--port', String(port));
|
|
286
|
+
return argv;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Parse capture stdout JSON; '' ⇒ null. @param {string} stdout */
|
|
290
|
+
function parseJson(stdout) {
|
|
291
|
+
const out = String(stdout || '').trim();
|
|
292
|
+
if (out === '') return null;
|
|
293
|
+
return JSON.parse(out);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Pull a human message out of capture stderr: prefer the last `ERROR:` line,
|
|
298
|
+
* else the last non-empty line, else a generic fallback.
|
|
299
|
+
* @param {string} stderr @returns {string}
|
|
300
|
+
*/
|
|
301
|
+
function extractErrorMessage(stderr) {
|
|
302
|
+
const lines = String(stderr || '')
|
|
303
|
+
.split(/\r?\n/)
|
|
304
|
+
.map((l) => l.trim())
|
|
305
|
+
.filter(Boolean);
|
|
306
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
307
|
+
if (/^ERROR:/i.test(lines[i])) return lines[i].replace(/^ERROR:\s*/i, '').trim();
|
|
308
|
+
}
|
|
309
|
+
if (lines.length) return lines[lines.length - 1];
|
|
310
|
+
return 'capture exec failed';
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ── SourceError helper (shared by gmail descriptors + inbox-local glue) ───────
|
|
314
|
+
|
|
315
|
+
/** @param {string} kind @param {object} display @returns {SourceError} */
|
|
316
|
+
function srcError(kind, display) {
|
|
317
|
+
return { kind, display: /** @type {any} */ (display) };
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// ── Gmail: classify + display ─────────────────────────────────────────────────
|
|
321
|
+
|
|
322
|
+
const DEV_ONLY_MSG =
|
|
323
|
+
'This view needs a capture dev checkout (vault/ source + esbuild). Not available in the published package.';
|
|
324
|
+
|
|
325
|
+
/** @param {string} stderr @returns {{kind:string, message?:string}} */
|
|
326
|
+
function classifyGmail(stderr) {
|
|
327
|
+
const s = String(stderr || '');
|
|
328
|
+
if (/No browser with CDP found/i.test(s)) return { kind: 'no-cdp' };
|
|
329
|
+
if (/fetch failed/i.test(s) || /failed to fetch/i.test(s) || /ECONNREFUSED/i.test(s)) return { kind: 'no-cdp' };
|
|
330
|
+
if (/No tab found/i.test(s)) return { kind: 'no-tab' };
|
|
331
|
+
if (/DEV_ONLY/i.test(s) || /dev-only feature of capture/i.test(s) || /published package/i.test(s)) {
|
|
332
|
+
return { kind: 'capture-not-dev' };
|
|
333
|
+
}
|
|
334
|
+
if (/RateLimited/i.test(s) || /\b429\b/.test(s)) return { kind: 'rate-limited' };
|
|
335
|
+
if (
|
|
336
|
+
/Unauthenticated/i.test(s) ||
|
|
337
|
+
/XSRF token not found/i.test(s) ||
|
|
338
|
+
/GLOBALS not found/i.test(s) ||
|
|
339
|
+
/may not be logged in/i.test(s) ||
|
|
340
|
+
/not be logged in/i.test(s) ||
|
|
341
|
+
/Not on Gmail domain/i.test(s) ||
|
|
342
|
+
/Account number not found/i.test(s) ||
|
|
343
|
+
/Navigate to mail\.google\.com/i.test(s)
|
|
344
|
+
) {
|
|
345
|
+
return { kind: 'not-logged-in' };
|
|
346
|
+
}
|
|
347
|
+
return { kind: 'error', message: extractErrorMessage(s) };
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** @param {{kind:string, message?:string}} error @returns {SourceError} */
|
|
351
|
+
function toGmailSourceError(error) {
|
|
352
|
+
const kind = (error && error.kind) || 'error';
|
|
353
|
+
switch (kind) {
|
|
354
|
+
case 'no-cdp':
|
|
355
|
+
return srcError('no-cdp', {
|
|
356
|
+
headline: 'No debuggable browser',
|
|
357
|
+
explanation: 'crtr drives a browser over CDP and none is running.',
|
|
358
|
+
nextStep: 'Launch Chrome with --remote-debugging-port=9222 (or Arc), then press g',
|
|
359
|
+
banner: 'Gmail: no debuggable browser — launch one, then g',
|
|
360
|
+
level: 'error',
|
|
361
|
+
blocking: true,
|
|
362
|
+
});
|
|
363
|
+
case 'no-tab':
|
|
364
|
+
return srcError('no-tab', {
|
|
365
|
+
headline: 'No Gmail tab',
|
|
366
|
+
explanation: 'Open mail.google.com in the debuggable browser.',
|
|
367
|
+
nextStep: 'Press G to connect',
|
|
368
|
+
banner: 'Gmail: open mail.google.com, then press g',
|
|
369
|
+
level: 'action',
|
|
370
|
+
blocking: true,
|
|
371
|
+
});
|
|
372
|
+
case 'not-logged-in':
|
|
373
|
+
return srcError('not-logged-in', {
|
|
374
|
+
headline: 'Log in to Gmail',
|
|
375
|
+
explanation: 'Gmail needs a sign-in in the browser.',
|
|
376
|
+
nextStep: 'Log in in the opened tab, then press g',
|
|
377
|
+
banner: 'Gmail: log in, then press g',
|
|
378
|
+
level: 'action',
|
|
379
|
+
blocking: true,
|
|
380
|
+
});
|
|
381
|
+
case 'rate-limited':
|
|
382
|
+
return srcError('rate-limited', {
|
|
383
|
+
headline: 'Gmail is throttling',
|
|
384
|
+
explanation: 'Too many requests — wait a moment before retrying.',
|
|
385
|
+
nextStep: 'Press g to retry',
|
|
386
|
+
banner: 'Gmail: throttled — wait, then press g',
|
|
387
|
+
level: 'info',
|
|
388
|
+
blocking: false,
|
|
389
|
+
});
|
|
390
|
+
case 'capture-not-dev':
|
|
391
|
+
return srcError('capture-not-dev', {
|
|
392
|
+
headline: 'Browser bridge unavailable',
|
|
393
|
+
explanation: DEV_ONLY_MSG,
|
|
394
|
+
nextStep: null,
|
|
395
|
+
banner: 'Gmail: browser bridge unavailable — capture dev checkout required',
|
|
396
|
+
level: 'error',
|
|
397
|
+
blocking: true,
|
|
398
|
+
});
|
|
399
|
+
case 'still-loading':
|
|
400
|
+
return srcError('still-loading', {
|
|
401
|
+
headline: 'Still loading Gmail…',
|
|
402
|
+
explanation: 'Gmail is taking a while to load.',
|
|
403
|
+
nextStep: 'Press g to retry',
|
|
404
|
+
banner: 'Gmail: still loading — press g to retry',
|
|
405
|
+
level: 'action',
|
|
406
|
+
blocking: false,
|
|
407
|
+
});
|
|
408
|
+
case 'error':
|
|
409
|
+
default: {
|
|
410
|
+
const msg = (error && error.message) || 'Unknown error.';
|
|
411
|
+
return srcError('error', {
|
|
412
|
+
headline: 'Something went wrong',
|
|
413
|
+
explanation: msg,
|
|
414
|
+
nextStep: 'Press g to retry',
|
|
415
|
+
banner: `Gmail: ${truncate(msg, 80)}`,
|
|
416
|
+
level: 'error',
|
|
417
|
+
blocking: true,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** @returns {SourceError} */
|
|
424
|
+
function gmailCaptureMissing() {
|
|
425
|
+
return toGmailSourceError({ kind: 'error', message: 'capture binary not found — install capture or set CAPTURE_BIN.' });
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// ── Field mappers ─────────────────────────────────────────────────────────────
|
|
429
|
+
|
|
430
|
+
/** @param {unknown} v @returns {number} epoch ms (Gmail dates are already ms) */
|
|
431
|
+
function asMs(v) {
|
|
432
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : 0;
|
|
433
|
+
}
|
|
434
|
+
/** @param {any} addr @returns {string} */
|
|
435
|
+
function addrName(addr) {
|
|
436
|
+
const a = addr || {};
|
|
437
|
+
if (typeof a.name === 'string' && a.name.trim()) return a.name;
|
|
438
|
+
if (typeof a.email === 'string' && a.email.trim()) return a.email;
|
|
439
|
+
return 'Unknown';
|
|
440
|
+
}
|
|
441
|
+
/** @param {any} addr @returns {string} */
|
|
442
|
+
function addrEmail(addr) {
|
|
443
|
+
const a = addr || {};
|
|
444
|
+
return typeof a.email === 'string' ? a.email : '';
|
|
445
|
+
}
|
|
446
|
+
/** @param {any} m @returns {UnifiedRow} */
|
|
447
|
+
function toUnifiedRow(m) {
|
|
448
|
+
const o = m || {};
|
|
449
|
+
const threadId = typeof o.threadId === 'string' ? o.threadId : '';
|
|
450
|
+
const from = o.from || {};
|
|
451
|
+
return {
|
|
452
|
+
sourceId: 'gmail',
|
|
453
|
+
key: `gmail:${threadId}`,
|
|
454
|
+
name: addrName(from),
|
|
455
|
+
snippet: typeof o.snippet === 'string' && o.snippet ? o.snippet : typeof o.subject === 'string' ? o.subject : '',
|
|
456
|
+
unread: o.unread === true,
|
|
457
|
+
ts: asMs(o.date),
|
|
458
|
+
ref: {
|
|
459
|
+
threadId,
|
|
460
|
+
messageId: typeof o.messageId === 'string' ? o.messageId : '',
|
|
461
|
+
subject: typeof o.subject === 'string' ? o.subject : '',
|
|
462
|
+
fromEmail: addrEmail(from),
|
|
463
|
+
fromName: addrName(from),
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
/** @param {any} m @param {string} myEmail @returns {UnifiedMessage} */
|
|
468
|
+
function toUnifiedMessage(m, myEmail) {
|
|
469
|
+
const o = m || {};
|
|
470
|
+
const from = o.from || {};
|
|
471
|
+
const fromEmail = addrEmail(from);
|
|
472
|
+
return {
|
|
473
|
+
sender: addrName(from),
|
|
474
|
+
fromMe: !!myEmail && fromEmail.toLowerCase() === myEmail.toLowerCase(),
|
|
475
|
+
text: typeof o.body === 'string' && o.body ? o.body : typeof o.snippet === 'string' ? o.snippet : '',
|
|
476
|
+
ts: asMs(o.date),
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
/** Strip leading `Re:` chains, then prefix a single `Re: `. @param {string} s */
|
|
480
|
+
function reSubject(s) {
|
|
481
|
+
const base = String(s || '').replace(/^\s*(re:\s*)+/i, '').trim();
|
|
482
|
+
return base ? `Re: ${base}` : 'Re:';
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** @param {string} url @returns {boolean} */
|
|
486
|
+
function isGmailUrl(url) {
|
|
487
|
+
try {
|
|
488
|
+
return new URL(url).hostname.toLowerCase() === 'mail.google.com';
|
|
489
|
+
} catch {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// ── Sources (reads) ────────────────────────────────────────────────────────────
|
|
495
|
+
|
|
496
|
+
/** Gmail: discover the mail.google.com tab id via `capture list`. */
|
|
497
|
+
const gmailDiscover = {
|
|
498
|
+
id: 'gmail-discover',
|
|
499
|
+
request: (a) => ({ kind: 'exec', bin: 'capture', args: withPort(['list'], a && a.port) }),
|
|
500
|
+
parse: (raw) => {
|
|
501
|
+
if (!raw.ok) return fail(gmailCaptureMissing());
|
|
502
|
+
if (raw.exitCode !== 0) return fail(toGmailSourceError(classifyGmail(raw.stderr)));
|
|
503
|
+
let tabs;
|
|
504
|
+
try {
|
|
505
|
+
tabs = parseJson(raw.stdout) || [];
|
|
506
|
+
} catch {
|
|
507
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'could not parse capture list output' }));
|
|
508
|
+
}
|
|
509
|
+
if (!Array.isArray(tabs)) return fail(toGmailSourceError({ kind: 'no-tab' }));
|
|
510
|
+
const chosen = tabs.filter((t) => t && typeof t.url === 'string' && isGmailUrl(t.url))[0];
|
|
511
|
+
if (chosen && chosen.id) return ok(String(chosen.id));
|
|
512
|
+
return fail(toGmailSourceError({ kind: 'no-tab' }));
|
|
513
|
+
},
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
/** Gmail: read page auth context `{xsrf, account, email, globals}`. */
|
|
517
|
+
const gmailContext = {
|
|
518
|
+
id: 'gmail-context',
|
|
519
|
+
request: (a) => ({
|
|
520
|
+
kind: 'exec', bin: 'capture',
|
|
521
|
+
args: withTP(['exec', execCode('libs/gmail', 'getContext', null)], a && a.target, a && a.port),
|
|
522
|
+
}),
|
|
523
|
+
parse: (raw) => {
|
|
524
|
+
if (!raw.ok) return fail(gmailCaptureMissing());
|
|
525
|
+
if (raw.exitCode !== 0) return fail(toGmailSourceError(classifyGmail(raw.stderr)));
|
|
526
|
+
let d;
|
|
527
|
+
try {
|
|
528
|
+
d = parseJson(raw.stdout) || {};
|
|
529
|
+
} catch {
|
|
530
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'could not parse getContext output' }));
|
|
531
|
+
}
|
|
532
|
+
if (!d.xsrf || d.account == null || !d.globals) {
|
|
533
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'getContext() returned no xsrf/account/globals' }));
|
|
534
|
+
}
|
|
535
|
+
return ok({ xsrf: String(d.xsrf), account: Number(d.account), email: typeof d.email === 'string' ? d.email : '', globals: d.globals });
|
|
536
|
+
},
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
/** Gmail: list inbox rows (one per thread). */
|
|
540
|
+
const gmailInbox = {
|
|
541
|
+
id: 'gmail-inbox',
|
|
542
|
+
request: (a) => ({
|
|
543
|
+
kind: 'exec', bin: 'capture',
|
|
544
|
+
args: withTP(
|
|
545
|
+
['exec', execCode('libs/gmail', 'listInbox', { xsrf: a.xsrf, account: a.account, globals: a.globals, count: (a && a.count) || INBOX_COUNT })],
|
|
546
|
+
a && a.target, a && a.port
|
|
547
|
+
),
|
|
548
|
+
}),
|
|
549
|
+
parse: (raw) => {
|
|
550
|
+
if (!raw.ok) return fail(gmailCaptureMissing());
|
|
551
|
+
if (raw.exitCode !== 0) return fail(toGmailSourceError(classifyGmail(raw.stderr)));
|
|
552
|
+
let r;
|
|
553
|
+
try {
|
|
554
|
+
r = parseJson(raw.stdout) || {};
|
|
555
|
+
} catch {
|
|
556
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'could not parse listInbox output' }));
|
|
557
|
+
}
|
|
558
|
+
const arr = r && Array.isArray(r.messages) ? r.messages : [];
|
|
559
|
+
return ok(arr.map(toUnifiedRow));
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
/** Gmail: read a thread's raw messages (for buildThread + reply resolution). */
|
|
564
|
+
const gmailThread = {
|
|
565
|
+
id: 'gmail-thread',
|
|
566
|
+
request: (a) => ({
|
|
567
|
+
kind: 'exec', bin: 'capture',
|
|
568
|
+
args: withTP(
|
|
569
|
+
['exec', execCode('libs/gmail', 'readEmail', { xsrf: a.xsrf, account: a.account, globals: a.globals, threadId: a.threadId })],
|
|
570
|
+
a && a.target, a && a.port
|
|
571
|
+
),
|
|
572
|
+
}),
|
|
573
|
+
parse: (raw) => {
|
|
574
|
+
if (!raw.ok) return fail(gmailCaptureMissing());
|
|
575
|
+
if (raw.exitCode !== 0) return fail(toGmailSourceError(classifyGmail(raw.stderr)));
|
|
576
|
+
let r;
|
|
577
|
+
try {
|
|
578
|
+
r = parseJson(raw.stdout) || {};
|
|
579
|
+
} catch {
|
|
580
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'could not parse readEmail output' }));
|
|
581
|
+
}
|
|
582
|
+
return ok(r && Array.isArray(r.messages) ? r.messages : []);
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
// ── Commands (writes) ──────────────────────────────────────────────────────────
|
|
587
|
+
|
|
588
|
+
/** Gmail: open/reuse the mail.google.com tab → its tab id. */
|
|
589
|
+
const gmailOpen = {
|
|
590
|
+
id: 'gmail-open',
|
|
591
|
+
request: (a) => ({ kind: 'exec', bin: 'capture', args: withPort(['open', GMAIL_URL], a && a.port) }),
|
|
592
|
+
parse: (raw) => {
|
|
593
|
+
if (!raw.ok) return fail(gmailCaptureMissing());
|
|
594
|
+
if (raw.exitCode !== 0) return fail(toGmailSourceError(classifyGmail(raw.stderr)));
|
|
595
|
+
let body;
|
|
596
|
+
try {
|
|
597
|
+
body = parseJson(raw.stdout) || {};
|
|
598
|
+
} catch {
|
|
599
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'could not parse capture open output' }));
|
|
600
|
+
}
|
|
601
|
+
if (body && body.id) return ok(String(body.id));
|
|
602
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'capture open returned no tab id' }));
|
|
603
|
+
},
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
/** Gmail: send a reply. */
|
|
607
|
+
const gmailReply = {
|
|
608
|
+
id: 'gmail-reply',
|
|
609
|
+
request: (a) => ({
|
|
610
|
+
kind: 'exec', bin: 'capture',
|
|
611
|
+
args: withTP(
|
|
612
|
+
['exec', execCode('libs/gmail', 'replyEmail', {
|
|
613
|
+
xsrf: a.xsrf, account: a.account, globals: a.globals, threadId: a.threadId,
|
|
614
|
+
originalMsgId: a.originalMsgId, to: a.to, subject: a.subject, body: a.body,
|
|
615
|
+
})],
|
|
616
|
+
a && a.target, a && a.port
|
|
617
|
+
),
|
|
618
|
+
}),
|
|
619
|
+
parse: (raw) => {
|
|
620
|
+
if (!raw.ok) return fail(gmailCaptureMissing());
|
|
621
|
+
if (raw.exitCode !== 0) return fail(toGmailSourceError(classifyGmail(raw.stderr)));
|
|
622
|
+
let out;
|
|
623
|
+
try {
|
|
624
|
+
out = parseJson(raw.stdout) || {};
|
|
625
|
+
} catch {
|
|
626
|
+
return fail(toGmailSourceError({ kind: 'error', message: 'could not parse replyEmail output' }));
|
|
627
|
+
}
|
|
628
|
+
if (out && out.success === false) return fail(toGmailSourceError({ kind: 'error', message: 'Gmail rejected the reply' }));
|
|
629
|
+
return ok(undefined);
|
|
630
|
+
},
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// ── Orchestration (restated ensureReady state machines) ───────────────────────
|
|
634
|
+
|
|
635
|
+
/** @param {string} headline @param {any} e @returns {SourceError} */
|
|
636
|
+
function defensiveError(headline, e) {
|
|
637
|
+
const msg = e && e.message ? String(e.message) : headline;
|
|
638
|
+
return srcError('error', { headline, explanation: msg, nextStep: 'Press g to retry', banner: msg, level: 'error', blocking: false });
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/** Which auto-fix branch a LinkedIn error kind takes. @returns {'open'|'navigate'|null} */
|
|
642
|
+
function autoFixFor(kind) {
|
|
643
|
+
if (kind === 'no-tab') return 'open';
|
|
644
|
+
if (kind === 'not-messaging') return 'navigate';
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/** One LinkedIn readiness attempt: discover → context → listConversations. */
|
|
649
|
+
async function attemptLi(ctx, sub) {
|
|
650
|
+
if (!sub.target) {
|
|
651
|
+
const r = await ctx.resolve(discoverTabSource, { port: sub.port });
|
|
652
|
+
if (!r.ok) return r;
|
|
653
|
+
sub.target = r.data;
|
|
654
|
+
}
|
|
655
|
+
if (!sub.ctx) {
|
|
656
|
+
const r = await ctx.resolve(contextSource, { target: sub.target, port: sub.port });
|
|
657
|
+
if (!r.ok) return r;
|
|
658
|
+
sub.ctx = r.data;
|
|
659
|
+
}
|
|
660
|
+
const lc = await ctx.resolve(conversationsSource, { target: sub.target, port: sub.port, csrf: sub.ctx.csrf, memberId: sub.ctx.memberId, count: CONVO_COUNT });
|
|
661
|
+
if (!lc.ok) return lc;
|
|
662
|
+
sub.convos = lc.data;
|
|
663
|
+
return { ok: true };
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/** Bounded settle-poll after a LinkedIn auto open/navigate. */
|
|
667
|
+
async function settleLi(ctx, sub) {
|
|
668
|
+
for (let i = 1; i <= SETTLE_MAX; i++) {
|
|
669
|
+
await sleep(SETTLE_INTERVAL_MS);
|
|
670
|
+
const r = await attemptLi(ctx, sub);
|
|
671
|
+
if (r.ok) {
|
|
672
|
+
sub.loginTabOpened = false;
|
|
673
|
+
return { ok: true };
|
|
674
|
+
}
|
|
675
|
+
if (HARD_STOP.has(r.error.kind)) return r;
|
|
676
|
+
}
|
|
677
|
+
// Settle-exhaustion is inbox glue (a "still loading" nudge), not a classify dup.
|
|
678
|
+
return fail(srcError('settling', {
|
|
679
|
+
headline: 'Still loading',
|
|
680
|
+
explanation: 'LinkedIn is taking a moment to load.',
|
|
681
|
+
nextStep: 'Press g to retry',
|
|
682
|
+
banner: 'still loading — press g to retry',
|
|
683
|
+
level: 'action',
|
|
684
|
+
blocking: false,
|
|
685
|
+
}));
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** LinkedIn ensureReady: discover→auth→settle with auto-fix branches. */
|
|
689
|
+
async function ensureLinkedin(ctx, sub) {
|
|
690
|
+
const probe = await attemptLi(ctx, sub);
|
|
691
|
+
if (probe.ok) {
|
|
692
|
+
sub.loginTabOpened = false;
|
|
693
|
+
return { ok: true };
|
|
694
|
+
}
|
|
695
|
+
const error = probe.error;
|
|
696
|
+
const auto = autoFixFor(error.kind);
|
|
697
|
+
if (auto) {
|
|
698
|
+
const fix = auto === 'open'
|
|
699
|
+
? await ctx.execute(openTabCommand, { port: sub.port })
|
|
700
|
+
: await ctx.execute(navigateCommand, { target: sub.target, port: sub.port });
|
|
701
|
+
if (!fix.ok) return fix;
|
|
702
|
+
if (auto === 'open' && fix.data) sub.target = fix.data;
|
|
703
|
+
sub.ctx = null;
|
|
704
|
+
return settleLi(ctx, sub);
|
|
705
|
+
}
|
|
706
|
+
// not-logged-in: open the messaging tab ONCE per episode, then guide.
|
|
707
|
+
if (error.kind === 'not-logged-in' && !sub.loginTabOpened) {
|
|
708
|
+
const o = await ctx.execute(openTabCommand, { port: sub.port });
|
|
709
|
+
if (o.ok && o.data) sub.target = o.data;
|
|
710
|
+
sub.loginTabOpened = true;
|
|
711
|
+
}
|
|
712
|
+
return probe;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/** One Gmail readiness attempt: discover → context. */
|
|
716
|
+
async function attemptGmail(ctx, sub) {
|
|
717
|
+
if (!sub.target) {
|
|
718
|
+
const r = await ctx.resolve(gmailDiscover, { port: sub.port });
|
|
719
|
+
if (!r.ok) return r;
|
|
720
|
+
sub.target = r.data;
|
|
721
|
+
}
|
|
722
|
+
if (!sub.ctx) {
|
|
723
|
+
const r = await ctx.resolve(gmailContext, { target: sub.target, port: sub.port });
|
|
724
|
+
if (!r.ok) return r;
|
|
725
|
+
sub.ctx = r.data;
|
|
726
|
+
}
|
|
727
|
+
return { ok: true };
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
/** Bounded settle-poll after a Gmail auto open. */
|
|
731
|
+
async function settleGmail(ctx, sub) {
|
|
732
|
+
for (let i = 1; i <= SETTLE_MAX; i++) {
|
|
733
|
+
await sleep(SETTLE_INTERVAL_MS);
|
|
734
|
+
ctx.signal.setStatus(`Loading Gmail… (${i})`);
|
|
735
|
+
const r = await attemptGmail(ctx, sub);
|
|
736
|
+
if (r.ok) {
|
|
737
|
+
sub.loginTabOpened = false;
|
|
738
|
+
return { ok: true };
|
|
739
|
+
}
|
|
740
|
+
if (HARD_STOP.has(r.error.kind)) return r;
|
|
741
|
+
}
|
|
742
|
+
return fail(toGmailSourceError({ kind: 'still-loading' }));
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/** Gmail ensureReady: discover→auth→settle. */
|
|
746
|
+
async function ensureGmail(ctx, sub) {
|
|
747
|
+
const r = await attemptGmail(ctx, sub);
|
|
748
|
+
if (r.ok) {
|
|
749
|
+
sub.loginTabOpened = false;
|
|
750
|
+
return { ok: true };
|
|
751
|
+
}
|
|
752
|
+
const kind = r.error.kind;
|
|
753
|
+
if (kind === 'no-tab') {
|
|
754
|
+
ctx.signal.setStatus('Opening Gmail…');
|
|
755
|
+
const o = await ctx.execute(gmailOpen, { port: sub.port });
|
|
756
|
+
if (!o.ok) return o;
|
|
757
|
+
sub.target = o.data;
|
|
758
|
+
sub.ctx = null;
|
|
759
|
+
return settleGmail(ctx, sub);
|
|
760
|
+
}
|
|
761
|
+
if (kind === 'not-logged-in') {
|
|
762
|
+
if (!sub.loginTabOpened) {
|
|
763
|
+
const o = await ctx.execute(gmailOpen, { port: sub.port });
|
|
764
|
+
if (o.ok && o.data) sub.target = o.data;
|
|
765
|
+
sub.loginTabOpened = true;
|
|
766
|
+
}
|
|
767
|
+
return r;
|
|
768
|
+
}
|
|
769
|
+
return r;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/** Map cached LinkedIn conversations → UnifiedRows (pure). */
|
|
773
|
+
function liRowsFromConvos(sub) {
|
|
774
|
+
const csrf = sub.ctx ? sub.ctx.csrf : '';
|
|
775
|
+
const memberId = sub.ctx ? sub.ctx.memberId : '';
|
|
776
|
+
return (sub.convos || []).map((c) => ({
|
|
777
|
+
sourceId: 'linkedin',
|
|
778
|
+
key: `linkedin:${c.urn}`,
|
|
779
|
+
name: c.name || 'Unknown',
|
|
780
|
+
snippet: c.lastMessage || '',
|
|
781
|
+
unread: !!c.unread,
|
|
782
|
+
ts: c.ts || 0,
|
|
783
|
+
ref: { urn: c.urn, recipientId: c.recipientId, csrf, memberId },
|
|
784
|
+
}));
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** Load a LinkedIn thread; caches raw msgs (urns) for react; clears unread. */
|
|
788
|
+
async function loadLiThread(ctx, sub, ref) {
|
|
789
|
+
const csrf = (sub.ctx && sub.ctx.csrf) || ref.csrf;
|
|
790
|
+
const memberId = (sub.ctx && sub.ctx.memberId) || ref.memberId;
|
|
791
|
+
if (!csrf) {
|
|
792
|
+
return fail(srcError('error', {
|
|
793
|
+
headline: 'Something went wrong', explanation: 'not authenticated yet',
|
|
794
|
+
nextStep: 'Press g to retry', banner: 'not authenticated yet', level: 'error', blocking: false,
|
|
795
|
+
}));
|
|
796
|
+
}
|
|
797
|
+
const vc = await ctx.execute(viewThreadCommand, { target: sub.target, port: sub.port, csrf, conversationUrn: ref.urn });
|
|
798
|
+
if (!vc.ok) return vc;
|
|
799
|
+
// applyFromMe resolves fromMe and keeps each message's urn (needed by react).
|
|
800
|
+
const raw = applyFromMe(vc.data, memberId);
|
|
801
|
+
sub.threads = { ...sub.threads, [ref.urn]: raw };
|
|
802
|
+
const c = (sub.convos || []).find((x) => x.urn === ref.urn);
|
|
803
|
+
if (c) c.unread = false;
|
|
804
|
+
const name = c ? c.name : 'Conversation';
|
|
805
|
+
const messages = raw.map((m) => ({ sender: m.sender, fromMe: m.fromMe, text: m.text, ts: m.ts }));
|
|
806
|
+
return ok({ title: name || 'Conversation', messages, canReply: true, canReact: true });
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/** Load a Gmail thread → UnifiedThread (with from/to subtitle). */
|
|
810
|
+
async function loadGmailThread(ctx, sub, ref) {
|
|
811
|
+
const threadId = ref && ref.threadId ? ref.threadId : '';
|
|
812
|
+
if (!threadId) return fail(toGmailSourceError({ kind: 'error', message: 'loadThread: missing threadId' }));
|
|
813
|
+
const r = await ctx.resolve(gmailThread, { xsrf: sub.ctx.xsrf, account: sub.ctx.account, globals: sub.ctx.globals, threadId, target: sub.target, port: sub.port });
|
|
814
|
+
if (!r.ok) return r;
|
|
815
|
+
const msgs = r.data;
|
|
816
|
+
const myEmail = sub.ctx.email || '';
|
|
817
|
+
const first = msgs[0] || {};
|
|
818
|
+
const last = msgs[msgs.length - 1] || {};
|
|
819
|
+
const title = (typeof first.subject === 'string' && first.subject) || (ref && ref.subject) || '(no subject)';
|
|
820
|
+
const fromAddr = addrEmail(last.from) || addrEmail(first.from);
|
|
821
|
+
const toAddr = (last.to && last.to[0] && addrEmail(last.to[0])) || (first.to && first.to[0] && addrEmail(first.to[0])) || '';
|
|
822
|
+
const subtitle = fromAddr || toAddr ? `from ${fromAddr || '—'} · to ${toAddr || '—'}` : undefined;
|
|
823
|
+
return ok({
|
|
824
|
+
title,
|
|
825
|
+
...(subtitle ? { subtitle } : {}),
|
|
826
|
+
messages: msgs.map((m) => toUnifiedMessage(m, myEmail)),
|
|
827
|
+
canReply: true,
|
|
828
|
+
canReact: false,
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/** Resolve recipient + originalMsgId from a Gmail thread, then send the reply. */
|
|
833
|
+
async function sendGmail(ctx, sub, ref, text) {
|
|
834
|
+
const threadId = ref && ref.threadId ? ref.threadId : '';
|
|
835
|
+
if (!threadId) return fail(toGmailSourceError({ kind: 'error', message: 'reply: missing threadId' }));
|
|
836
|
+
const body = String(text == null ? '' : text);
|
|
837
|
+
if (!body.trim()) return fail(toGmailSourceError({ kind: 'error', message: 'reply: empty body' }));
|
|
838
|
+
const read = await ctx.resolve(gmailThread, { xsrf: sub.ctx.xsrf, account: sub.ctx.account, globals: sub.ctx.globals, threadId, target: sub.target, port: sub.port });
|
|
839
|
+
if (!read.ok) return read;
|
|
840
|
+
const msgs = read.data;
|
|
841
|
+
if (msgs.length === 0) return fail(toGmailSourceError({ kind: 'error', message: 'reply: thread has no messages' }));
|
|
842
|
+
const myEmail = (sub.ctx.email || '').toLowerCase();
|
|
843
|
+
const latest = msgs[msgs.length - 1] || {};
|
|
844
|
+
const originalMsgId = typeof latest.messageId === 'string' ? latest.messageId : (ref && ref.messageId) || '';
|
|
845
|
+
if (!originalMsgId) return fail(toGmailSourceError({ kind: 'error', message: 'reply: could not resolve message id' }));
|
|
846
|
+
let tgt = null;
|
|
847
|
+
for (let i = msgs.length - 1; i >= 0; i--) {
|
|
848
|
+
const fe = addrEmail((msgs[i] || {}).from).toLowerCase();
|
|
849
|
+
if (fe && fe !== myEmail) {
|
|
850
|
+
tgt = msgs[i];
|
|
851
|
+
break;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
let toEmail = tgt ? addrEmail(tgt.from) : '';
|
|
855
|
+
if (!toEmail) toEmail = (latest.to && latest.to[0] && addrEmail(latest.to[0])) || '';
|
|
856
|
+
if (!toEmail && ref && ref.fromEmail) toEmail = ref.fromEmail;
|
|
857
|
+
if (!toEmail) return fail(toGmailSourceError({ kind: 'error', message: 'reply: could not determine recipient' }));
|
|
858
|
+
const subject = reSubject((tgt && tgt.subject) || latest.subject || (ref && ref.subject) || '');
|
|
859
|
+
return ctx.execute(gmailReply, {
|
|
860
|
+
xsrf: sub.ctx.xsrf, account: sub.ctx.account, globals: sub.ctx.globals, threadId,
|
|
861
|
+
originalMsgId, to: toEmail, subject, body, target: sub.target, port: sub.port,
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// ── Merge / chrome helpers ─────────────────────────────────────────────────────
|
|
866
|
+
|
|
867
|
+
/** Sort the merged set unread-first then ts desc. Mutates `arr`. */
|
|
868
|
+
function sortRows(arr) {
|
|
869
|
+
arr.sort((a, b) => {
|
|
870
|
+
if (!!a.unread !== !!b.unread) return a.unread ? -1 : 1;
|
|
871
|
+
return (b.ts || 0) - (a.ts || 0);
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/** Re-merge rowsBySource into the visible, sorted list — keeping the cursor by key. */
|
|
876
|
+
function mergeRows(rowsBySource, filter, prevRows, prevCursor) {
|
|
877
|
+
const prev = prevRows[prevCursor];
|
|
878
|
+
const prevKey = prev && prev.key;
|
|
879
|
+
let all = [];
|
|
880
|
+
for (const m of SOURCES_META) {
|
|
881
|
+
if (filter !== 'all' && filter !== m.id) continue;
|
|
882
|
+
all = all.concat(rowsBySource[m.id] || []);
|
|
883
|
+
}
|
|
884
|
+
sortRows(all);
|
|
885
|
+
let cursor = prevCursor;
|
|
886
|
+
if (prevKey) {
|
|
887
|
+
const i = all.findIndex((r) => r.key === prevKey);
|
|
888
|
+
if (i >= 0) cursor = i;
|
|
889
|
+
}
|
|
890
|
+
if (cursor >= all.length) cursor = Math.max(0, all.length - 1);
|
|
891
|
+
if (cursor < 0) cursor = 0;
|
|
892
|
+
return { rows: all, cursor };
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/** Collapse per-source down-states into ONE host banner (label-prefixed). */
|
|
896
|
+
function applyBanners(ctx, banners) {
|
|
897
|
+
const downs = [];
|
|
898
|
+
for (const m of SOURCES_META) {
|
|
899
|
+
const e = banners && banners[m.id];
|
|
900
|
+
if (e && e.display) downs.push({ label: m.label, d: e.display });
|
|
901
|
+
}
|
|
902
|
+
if (downs.length === 0) {
|
|
903
|
+
ctx.signal.clearBanner();
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
let level = 'info';
|
|
907
|
+
for (const x of downs) if ((LEVEL_RANK[x.d.level] || 0) > (LEVEL_RANK[level] || 0)) level = x.d.level;
|
|
908
|
+
// LinkedIn's shared SourceError displays carry no `.banner`; fall back to
|
|
909
|
+
// explanation/headline so the merged chrome banner is never blank.
|
|
910
|
+
const msg = downs.map((x) => labeled(x.label, x.d.banner || x.d.explanation || x.d.headline)).join(' · ');
|
|
911
|
+
ctx.signal.setBanner(msg, /** @type {any} */ (level));
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/** Set a one-off banner for a per-action SourceError (open/reply/react). */
|
|
915
|
+
function bannerFromSource(ctx, id, error) {
|
|
916
|
+
const label = labelFor(id);
|
|
917
|
+
const d = error && error.display;
|
|
918
|
+
const text = d && (d.banner || d.explanation || d.headline);
|
|
919
|
+
if (text) ctx.signal.setBanner(labeled(label, text), (d && d.level) || 'error');
|
|
920
|
+
else ctx.signal.setBanner(`${label}: error`, 'error');
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** Drive the live "N unread · <filter>" subtitle from current state. */
|
|
924
|
+
function updateSubtitle(ctx) {
|
|
925
|
+
const s = ctx.state;
|
|
926
|
+
const n = unreadCount(s);
|
|
927
|
+
const parts = [];
|
|
928
|
+
if (n > 0) parts.push(`${n} unread`);
|
|
929
|
+
if (s.filter !== 'all') {
|
|
930
|
+
const m = SOURCE_BY_ID[s.filter];
|
|
931
|
+
parts.push(`${m ? m.label : s.filter} only`);
|
|
932
|
+
}
|
|
933
|
+
ctx.signal.setSubtitle(parts.length ? parts.join(' · ') : null);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// ── Sub cloning (immutable update discipline) ─────────────────────────────────
|
|
937
|
+
|
|
938
|
+
function cloneLi(sub) {
|
|
939
|
+
return { ...sub, threads: { ...(sub.threads || {}) }, convos: (sub.convos || []).map((c) => ({ ...c })) };
|
|
940
|
+
}
|
|
941
|
+
function cloneGmail(sub) {
|
|
942
|
+
return { ...sub };
|
|
943
|
+
}
|
|
944
|
+
function cloneSubs(subs) {
|
|
945
|
+
return { linkedin: cloneLi(subs.linkedin), gmail: cloneGmail(subs.gmail) };
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// ── The portable core ──────────────────────────────────────────────────────────
|
|
949
|
+
|
|
950
|
+
/** @type {import('../../core/view/contract.js').ViewCore<InboxState>} */
|
|
951
|
+
const core = {
|
|
952
|
+
manifest: {
|
|
953
|
+
id: 'inbox',
|
|
954
|
+
title: 'Inbox',
|
|
955
|
+
description: 'Combined inbox — triage LinkedIn + Gmail in one ranked list',
|
|
956
|
+
refreshMs: 30000,
|
|
957
|
+
},
|
|
958
|
+
|
|
959
|
+
/** Cheap + synchronous initial state. NO fetch — the host paints a loading
|
|
960
|
+
* frame, then dispatches the first 'refresh'. @returns {InboxState} */
|
|
961
|
+
init(opts) {
|
|
962
|
+
return {
|
|
963
|
+
subs: {
|
|
964
|
+
linkedin: { ctx: null, target: (opts && opts.target) || null, port: (opts && opts.port) || undefined, convos: [], threads: {}, loginTabOpened: false },
|
|
965
|
+
gmail: { target: null, port: undefined, ctx: null, loginTabOpened: false },
|
|
966
|
+
},
|
|
967
|
+
rowsBySource: {},
|
|
968
|
+
rows: [],
|
|
969
|
+
cursor: 0,
|
|
970
|
+
scroll: 0,
|
|
971
|
+
openKey: null,
|
|
972
|
+
openRow: null,
|
|
973
|
+
thread: null,
|
|
974
|
+
threadScroll: 0,
|
|
975
|
+
mode: 'list',
|
|
976
|
+
draft: '',
|
|
977
|
+
reactCursor: 0,
|
|
978
|
+
filter: 'all',
|
|
979
|
+
banners: {},
|
|
980
|
+
ready: {},
|
|
981
|
+
lastFetch: 0,
|
|
982
|
+
};
|
|
983
|
+
},
|
|
984
|
+
|
|
985
|
+
sources: { gmailDiscover, gmailContext, gmailInbox, gmailThread },
|
|
986
|
+
commands: { gmailOpen, gmailReply },
|
|
987
|
+
|
|
988
|
+
intents: {
|
|
989
|
+
/**
|
|
990
|
+
* For each source (LinkedIn first): ensureReady → list rows; merge + sort;
|
|
991
|
+
* set per-source banners. Partial readiness: one down source never blanks the
|
|
992
|
+
* view. Skips while composing/reacting so a poll can't disrupt input.
|
|
993
|
+
* @param {Ctx} ctx
|
|
994
|
+
*/
|
|
995
|
+
async refresh(ctx) {
|
|
996
|
+
if (ctx.state.mode !== 'list') return;
|
|
997
|
+
ctx.signal.setStatus('Refreshing…');
|
|
998
|
+
const s0 = ctx.state;
|
|
999
|
+
const subs = cloneSubs(s0.subs);
|
|
1000
|
+
/** @type {Record<string, UnifiedRow[]>} */
|
|
1001
|
+
const rowsBySource = {};
|
|
1002
|
+
/** @type {Record<string, SourceError|null>} */
|
|
1003
|
+
const banners = {};
|
|
1004
|
+
/** @type {Record<string, boolean>} */
|
|
1005
|
+
const ready = {};
|
|
1006
|
+
|
|
1007
|
+
for (const meta of SOURCES_META) {
|
|
1008
|
+
const id = meta.id;
|
|
1009
|
+
const sub = subs[id];
|
|
1010
|
+
let er;
|
|
1011
|
+
try {
|
|
1012
|
+
er = id === 'linkedin' ? await ensureLinkedin(ctx, sub) : await ensureGmail(ctx, sub);
|
|
1013
|
+
} catch (e) {
|
|
1014
|
+
er = { ok: false, error: defensiveError('source error', e) };
|
|
1015
|
+
}
|
|
1016
|
+
if (er.ok) {
|
|
1017
|
+
ready[id] = true;
|
|
1018
|
+
banners[id] = null;
|
|
1019
|
+
if (id === 'linkedin') {
|
|
1020
|
+
rowsBySource[id] = liRowsFromConvos(sub);
|
|
1021
|
+
} else {
|
|
1022
|
+
let lr;
|
|
1023
|
+
try {
|
|
1024
|
+
lr = await ctx.resolve(gmailInbox, { xsrf: sub.ctx.xsrf, account: sub.ctx.account, globals: sub.ctx.globals, count: INBOX_COUNT, target: sub.target, port: sub.port });
|
|
1025
|
+
} catch (e) {
|
|
1026
|
+
lr = { ok: false, error: defensiveError('list failed', e) };
|
|
1027
|
+
}
|
|
1028
|
+
if (lr.ok) {
|
|
1029
|
+
rowsBySource[id] = lr.data;
|
|
1030
|
+
} else {
|
|
1031
|
+
rowsBySource[id] = [];
|
|
1032
|
+
banners[id] = lr.error;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
} else {
|
|
1036
|
+
ready[id] = false;
|
|
1037
|
+
rowsBySource[id] = [];
|
|
1038
|
+
banners[id] = er.error;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
ctx.set((s) => {
|
|
1043
|
+
const { rows, cursor } = mergeRows(rowsBySource, s.filter, s.rows, s.cursor);
|
|
1044
|
+
return { ...s, subs, rowsBySource, banners, ready, rows, cursor, lastFetch: Date.now() };
|
|
1045
|
+
});
|
|
1046
|
+
ctx.signal.setStatus(null);
|
|
1047
|
+
applyBanners(ctx, banners);
|
|
1048
|
+
updateSubtitle(ctx);
|
|
1049
|
+
},
|
|
1050
|
+
|
|
1051
|
+
/** @param {Ctx} ctx */
|
|
1052
|
+
cursorDown: (ctx) => ctx.set((s) => ({ ...s, cursor: s.rows.length ? Math.min(s.rows.length - 1, s.cursor + 1) : 0 })),
|
|
1053
|
+
/** @param {Ctx} ctx */
|
|
1054
|
+
cursorUp: (ctx) => ctx.set((s) => ({ ...s, cursor: Math.max(0, s.cursor - 1) })),
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Open the row at `idx` (or the cursor): dispatch to its source's loadThread.
|
|
1058
|
+
* @param {Ctx} ctx @param {number} [idx]
|
|
1059
|
+
*/
|
|
1060
|
+
async open(ctx, idx) {
|
|
1061
|
+
const s0 = ctx.state;
|
|
1062
|
+
const i = typeof idx === 'number' ? idx : s0.cursor;
|
|
1063
|
+
const row = s0.rows[i];
|
|
1064
|
+
if (!row) return;
|
|
1065
|
+
ctx.signal.setStatus('Loading thread…');
|
|
1066
|
+
const subs = cloneSubs(s0.subs);
|
|
1067
|
+
const id = row.sourceId;
|
|
1068
|
+
let result;
|
|
1069
|
+
try {
|
|
1070
|
+
result = id === 'linkedin' ? await loadLiThread(ctx, subs.linkedin, row.ref) : await loadGmailThread(ctx, subs.gmail, row.ref);
|
|
1071
|
+
} catch (e) {
|
|
1072
|
+
result = { ok: false, error: defensiveError('could not load thread', e) };
|
|
1073
|
+
}
|
|
1074
|
+
ctx.signal.setStatus(null);
|
|
1075
|
+
if (!result.ok) {
|
|
1076
|
+
ctx.set((s) => ({ ...s, subs, openKey: row.key, openRow: row, thread: null, threadScroll: 0 }));
|
|
1077
|
+
bannerFromSource(ctx, id, result.error);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
ctx.set((s) => {
|
|
1081
|
+
// Mark the open row read (optimistic) across both views of it.
|
|
1082
|
+
const mark = (r) => (r.key === row.key ? { ...r, unread: false } : r);
|
|
1083
|
+
const rows = s.rows.map(mark);
|
|
1084
|
+
const rowsBySource = { ...s.rowsBySource };
|
|
1085
|
+
rowsBySource[id] = (rowsBySource[id] || []).map(mark);
|
|
1086
|
+
return { ...s, subs, rows, rowsBySource, openKey: row.key, openRow: row, thread: result.data, threadScroll: 0 };
|
|
1087
|
+
});
|
|
1088
|
+
updateSubtitle(ctx);
|
|
1089
|
+
},
|
|
1090
|
+
|
|
1091
|
+
/** @param {Ctx} ctx */
|
|
1092
|
+
cycleFilter(ctx) {
|
|
1093
|
+
ctx.set((s) => {
|
|
1094
|
+
const cyc = ['all', 'linkedin', 'gmail'];
|
|
1095
|
+
const i = cyc.indexOf(s.filter);
|
|
1096
|
+
const filter = cyc[(i + 1) % cyc.length] || 'all';
|
|
1097
|
+
const { rows, cursor } = mergeRows(s.rowsBySource, filter, s.rows, s.cursor);
|
|
1098
|
+
return { ...s, filter, rows, cursor };
|
|
1099
|
+
});
|
|
1100
|
+
updateSubtitle(ctx);
|
|
1101
|
+
},
|
|
1102
|
+
|
|
1103
|
+
/** @param {Ctx} ctx */
|
|
1104
|
+
startReply(ctx) {
|
|
1105
|
+
const s = ctx.state;
|
|
1106
|
+
if (!s.openKey || !s.thread) {
|
|
1107
|
+
ctx.signal.setBanner('Open a conversation first', 'action');
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
if (!s.thread.canReply) return;
|
|
1111
|
+
ctx.set((st) => ({ ...st, mode: 'reply', draft: '' }));
|
|
1112
|
+
ctx.signal.setMode('compose');
|
|
1113
|
+
},
|
|
1114
|
+
|
|
1115
|
+
/** @param {Ctx} ctx */
|
|
1116
|
+
startReact(ctx) {
|
|
1117
|
+
const s = ctx.state;
|
|
1118
|
+
if (!s.openKey || !s.thread) {
|
|
1119
|
+
ctx.signal.setBanner('Open a conversation first', 'action');
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
if (!s.thread.canReact || (s.thread.messages || []).length === 0) return;
|
|
1123
|
+
ctx.set((st) => ({ ...st, mode: 'react', reactCursor: 0 }));
|
|
1124
|
+
ctx.signal.setMode('react');
|
|
1125
|
+
},
|
|
1126
|
+
|
|
1127
|
+
/** @param {Ctx} ctx @param {string} payload */
|
|
1128
|
+
setDraft: (ctx, payload) => ctx.set((s) => ({ ...s, draft: typeof payload === 'string' ? payload : '' })),
|
|
1129
|
+
|
|
1130
|
+
/** @param {Ctx} ctx */
|
|
1131
|
+
async submitReply(ctx) {
|
|
1132
|
+
const s0 = ctx.state;
|
|
1133
|
+
const text = s0.draft.trim();
|
|
1134
|
+
ctx.set((s) => ({ ...s, mode: 'list' }));
|
|
1135
|
+
ctx.signal.setMode(null);
|
|
1136
|
+
if (!text) return;
|
|
1137
|
+
const row = s0.openRow;
|
|
1138
|
+
const id = row ? row.sourceId : null;
|
|
1139
|
+
if (!row || !id) {
|
|
1140
|
+
ctx.signal.setBanner('No open conversation to reply to.', 'error');
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
ctx.signal.setStatus('Sending…');
|
|
1144
|
+
const subs = cloneSubs(s0.subs);
|
|
1145
|
+
let result;
|
|
1146
|
+
try {
|
|
1147
|
+
result = id === 'linkedin'
|
|
1148
|
+
? await ctx.execute(sendMessageCommand, { target: subs.linkedin.target, port: subs.linkedin.port, csrf: (subs.linkedin.ctx && subs.linkedin.ctx.csrf) || row.ref.csrf, myMemberId: (subs.linkedin.ctx && subs.linkedin.ctx.memberId) || row.ref.memberId, recipient: row.ref.recipientId, text, conversationUrn: row.ref.urn })
|
|
1149
|
+
: await sendGmail(ctx, subs.gmail, row.ref, text);
|
|
1150
|
+
} catch (e) {
|
|
1151
|
+
result = { ok: false, error: defensiveError('send failed', e) };
|
|
1152
|
+
}
|
|
1153
|
+
if (!result.ok) {
|
|
1154
|
+
ctx.signal.setStatus(null);
|
|
1155
|
+
bannerFromSource(ctx, id, result.error);
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
// Reconcile by reloading the thread (best-effort).
|
|
1159
|
+
let thread = s0.thread;
|
|
1160
|
+
try {
|
|
1161
|
+
const reload = id === 'linkedin' ? await loadLiThread(ctx, subs.linkedin, row.ref) : await loadGmailThread(ctx, subs.gmail, row.ref);
|
|
1162
|
+
if (reload.ok) thread = reload.data;
|
|
1163
|
+
} catch { /* non-fatal */ }
|
|
1164
|
+
ctx.set((s) => ({ ...s, subs, draft: '', thread }));
|
|
1165
|
+
ctx.signal.setStatus('Sent');
|
|
1166
|
+
applyBanners(ctx, ctx.state.banners);
|
|
1167
|
+
},
|
|
1168
|
+
|
|
1169
|
+
/** @param {Ctx} ctx */
|
|
1170
|
+
reactPrev: (ctx) => ctx.set((s) => ({ ...s, reactCursor: Math.max(0, s.reactCursor - 1) })),
|
|
1171
|
+
/** @param {Ctx} ctx */
|
|
1172
|
+
reactNext: (ctx) => ctx.set((s) => ({ ...s, reactCursor: Math.min(EMOJIS.length - 1, s.reactCursor + 1) })),
|
|
1173
|
+
|
|
1174
|
+
/** @param {Ctx} ctx @param {number} [idx] */
|
|
1175
|
+
async submitReact(ctx, idx) {
|
|
1176
|
+
const s0 = ctx.state;
|
|
1177
|
+
const row = s0.openRow;
|
|
1178
|
+
const id = row ? row.sourceId : null;
|
|
1179
|
+
ctx.set((s) => ({ ...s, mode: 'list' }));
|
|
1180
|
+
ctx.signal.setMode(null);
|
|
1181
|
+
if (id !== 'linkedin' || !row) {
|
|
1182
|
+
ctx.signal.setBanner('Cannot react here.', 'error');
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
const emoji = EMOJIS[typeof idx === 'number' ? idx : s0.reactCursor] || EMOJIS[0];
|
|
1186
|
+
const subs = cloneSubs(s0.subs);
|
|
1187
|
+
const sub = subs.linkedin;
|
|
1188
|
+
const msgs = sub.threads[row.ref.urn] || [];
|
|
1189
|
+
const tgt = msgs.length ? msgs[msgs.length - 1] : null;
|
|
1190
|
+
if (!tgt || !tgt.urn) {
|
|
1191
|
+
ctx.signal.setBanner('LinkedIn: no message to react to', 'error');
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
const csrf = (sub.ctx && sub.ctx.csrf) || row.ref.csrf;
|
|
1195
|
+
if (!csrf) {
|
|
1196
|
+
ctx.signal.setBanner('LinkedIn: not authenticated yet', 'error');
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
ctx.signal.setStatus('Reacting…');
|
|
1200
|
+
let r;
|
|
1201
|
+
try {
|
|
1202
|
+
r = await ctx.execute(reactCommand, { target: sub.target, port: sub.port, csrf, messageUrn: tgt.urn, emoji });
|
|
1203
|
+
} catch (e) {
|
|
1204
|
+
r = { ok: false, error: defensiveError('react failed', e) };
|
|
1205
|
+
}
|
|
1206
|
+
if (!r.ok) {
|
|
1207
|
+
ctx.signal.setStatus(null);
|
|
1208
|
+
bannerFromSource(ctx, 'linkedin', r.error);
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
ctx.signal.setStatus('Reacted ' + emoji);
|
|
1212
|
+
applyBanners(ctx, ctx.state.banners);
|
|
1213
|
+
},
|
|
1214
|
+
|
|
1215
|
+
/** @param {Ctx} ctx */
|
|
1216
|
+
cancelCompose(ctx) {
|
|
1217
|
+
ctx.set((s) => ({ ...s, mode: 'list', draft: '' }));
|
|
1218
|
+
ctx.signal.setMode(null);
|
|
1219
|
+
},
|
|
1220
|
+
|
|
1221
|
+
/** @param {Ctx} ctx */
|
|
1222
|
+
async connectLinkedin(ctx) {
|
|
1223
|
+
const subs = cloneSubs(ctx.state.subs);
|
|
1224
|
+
const sub = subs.linkedin;
|
|
1225
|
+
ctx.signal.setStatus('Connecting LinkedIn…');
|
|
1226
|
+
let o;
|
|
1227
|
+
try {
|
|
1228
|
+
o = await ctx.execute(openTabCommand, { port: sub.port });
|
|
1229
|
+
} catch (e) {
|
|
1230
|
+
o = { ok: false, error: defensiveError('connect failed', e) };
|
|
1231
|
+
}
|
|
1232
|
+
ctx.signal.setStatus(null);
|
|
1233
|
+
if (!o.ok) {
|
|
1234
|
+
ctx.set((s) => ({ ...s, banners: { ...s.banners, linkedin: o.error } }));
|
|
1235
|
+
applyBanners(ctx, ctx.state.banners);
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
if (o.data) sub.target = o.data;
|
|
1239
|
+
sub.ctx = null;
|
|
1240
|
+
ctx.set((s) => ({ ...s, subs }));
|
|
1241
|
+
await ctx.dispatch('refresh');
|
|
1242
|
+
},
|
|
1243
|
+
|
|
1244
|
+
/** @param {Ctx} ctx */
|
|
1245
|
+
async connectGmail(ctx) {
|
|
1246
|
+
const subs = cloneSubs(ctx.state.subs);
|
|
1247
|
+
const sub = subs.gmail;
|
|
1248
|
+
ctx.signal.setStatus('Connecting Gmail…');
|
|
1249
|
+
let o;
|
|
1250
|
+
try {
|
|
1251
|
+
o = await ctx.execute(gmailOpen, { port: sub.port });
|
|
1252
|
+
} catch (e) {
|
|
1253
|
+
o = { ok: false, error: defensiveError('connect failed', e) };
|
|
1254
|
+
}
|
|
1255
|
+
ctx.signal.setStatus(null);
|
|
1256
|
+
if (!o.ok) {
|
|
1257
|
+
ctx.set((s) => ({ ...s, banners: { ...s.banners, gmail: o.error } }));
|
|
1258
|
+
applyBanners(ctx, ctx.state.banners);
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
if (o.data) sub.target = o.data;
|
|
1262
|
+
sub.ctx = null;
|
|
1263
|
+
sub.loginTabOpened = true; // we just opened it; don't double-open on ensureReady
|
|
1264
|
+
ctx.set((s) => ({ ...s, subs }));
|
|
1265
|
+
await ctx.dispatch('refresh');
|
|
1266
|
+
},
|
|
1267
|
+
|
|
1268
|
+
/** @param {Ctx} ctx */
|
|
1269
|
+
quit: (ctx) => ctx.signal.quit(),
|
|
1270
|
+
},
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
export default core;
|