@north-light/crouter 0.3.353 → 0.3.355
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/dist/api/client.d.ts +35 -25
- package/dist/api/client.js +2 -2
- package/dist/api/dto/broker-ops.d.ts +2 -36
- package/dist/api/dto/canvas.d.ts +8 -13
- package/dist/api/dto/config.d.ts +4 -0
- package/dist/api/dto/delivery.d.ts +61 -0
- package/dist/api/dto/docs.d.ts +135 -0
- package/dist/api/dto/docs.js +1 -0
- package/dist/api/dto/health.d.ts +26 -79
- package/dist/api/dto/node-outcomes.d.ts +1 -3
- package/dist/api/dto/nodes.d.ts +5 -26
- package/dist/api/dto/objects.d.ts +168 -0
- package/dist/api/dto/objects.js +1 -0
- package/dist/api/dto/profiles.d.ts +14 -8
- package/dist/api/dto/reports.d.ts +9 -7
- package/dist/api/dto/reviews.d.ts +11 -3
- package/dist/api/dto/worktree.d.ts +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +1 -1
- package/dist/api/routes.d.ts +14 -12
- package/dist/api/routes.js +1 -1
- package/dist/build-root.js +1 -1
- package/dist/builtin-memory/00-runtime-base/00-authoring.md +10 -5
- package/dist/builtin-memory/02-turn-lifecycle/02-resident.md +1 -0
- package/dist/builtin-memory/04-orchestration-kernel.md +10 -31
- package/dist/builtin-memory/05-kinds/advisor/01-orchestrator.md +1 -1
- package/dist/builtin-memory/05-kinds/explore/00-base.md +2 -2
- package/dist/builtin-memory/05-kinds/explore/01-orchestrator.md +2 -2
- package/dist/builtin-memory/crouter-concepts/INDEX.md +2 -2
- package/dist/builtin-memory/crouter-concepts/lifecycle-and-wakes.md +1 -1
- package/dist/builtin-memory/crouter-concepts/memory.md +15 -15
- package/dist/builtin-memory/crouter-concepts/nodes-and-the-canvas.md +1 -1
- package/dist/builtin-memory/crouter-concepts/profiles-kinds-and-modes.md +5 -5
- package/dist/builtin-memory/crouter-concepts/scopes-and-trust.md +1 -1
- package/dist/builtin-memory/crouter-concepts/why-a-daemon.md +1 -1
- package/dist/builtin-memory/crouter-sdk/INDEX.md +2 -2
- package/dist/builtin-memory/crouter-sdk/README.md +5 -6
- package/dist/builtin-memory/crouter-sdk/errors.md +0 -13
- package/dist/builtin-memory/crouter-sdk/guides/README.md +0 -1
- package/dist/builtin-memory/crouter-sdk/guides/event-driven-assistant.md +2 -2
- package/dist/builtin-memory/crouter-sdk/nodes.md +0 -2
- package/dist/builtin-memory/crouter-sdk/resources.md +0 -1
- package/dist/builtin-memory/explore/exploration-doc.md +4 -4
- package/dist/builtin-memory/insights/capture.md +6 -6
- package/dist/builtin-memory/insights/init.md +14 -14
- package/dist/builtin-memory/internal/INDEX.md +4 -4
- package/dist/builtin-memory/internal/agent-shaping.md +20 -20
- package/dist/builtin-memory/internal/examples/imessage-assistant.md +2 -2
- package/dist/builtin-memory/internal/marketplaces.md +2 -2
- package/dist/builtin-memory/internal/memory-loading.md +31 -30
- package/dist/builtin-memory/internal/nodes-and-canvas.md +1 -1
- package/dist/builtin-memory/internal/plugins.md +16 -14
- package/dist/builtin-memory/internal/storage-tiers.md +4 -4
- package/dist/builtin-memory/memory-read-orientation.md +1 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +32 -40
- package/dist/clients/attach/input/controller.js +1 -1
- package/dist/clients/attach/input/ref-autocomplete.js +1 -1
- package/dist/clients/attach/input/titled-editor.js +1 -1
- package/dist/clients/attach/overlays/file-review.d.ts +1 -0
- package/dist/clients/attach/overlays/file-review.js +2 -2
- package/dist/clients/attach/render/chat-view.d.ts +6 -0
- package/dist/clients/attach/render/chat-view.js +2 -2
- package/dist/clients/attach/render/crtr-output.d.ts +1 -2
- package/dist/clients/attach/render/crtr-output.js +17 -17
- package/dist/clients/attach/render/doc-links.d.ts +34 -0
- package/dist/clients/attach/render/doc-links.js +1 -0
- package/dist/clients/attach/render/group-activity.d.ts +8 -8
- package/dist/clients/attach/render/group-activity.js +2 -2
- package/dist/clients/attach/render/group-recap.js +1 -1
- package/dist/clients/attach/render/markdown-source.js +5 -5
- package/dist/clients/attach/render/tool-calls.d.ts +1 -1
- package/dist/clients/attach/session/doc-materialize.d.ts +53 -0
- package/dist/clients/attach/session/doc-materialize.js +3 -0
- package/dist/clients/attach/session/document-links.d.ts +21 -0
- package/dist/clients/attach/session/document-links.js +1 -0
- package/dist/clients/attach/session/file-links.d.ts +2 -0
- package/dist/clients/attach/session/file-links.js +1 -1
- package/dist/clients/attach/session/profile-files.js +1 -1
- package/dist/clients/attach/slash/dispatch.js +1 -1
- package/dist/clients/attach/viewer.js +816 -1561
- package/dist/clients/inbox/review/review-client.d.ts +5 -1
- package/dist/clients/inbox/review/review-client.js +1 -1
- package/dist/commands/api-client.d.ts +2 -0
- package/dist/commands/api-client.js +3 -3
- package/dist/commands/canvas/edges.d.ts +2 -0
- package/dist/commands/canvas/edges.js +2 -0
- package/dist/commands/canvas/list.d.ts +4 -0
- package/dist/commands/canvas/list.js +3 -0
- package/dist/commands/canvas/read.d.ts +8 -0
- package/dist/commands/canvas/read.js +5 -0
- package/dist/commands/canvas/search.d.ts +2 -0
- package/dist/commands/canvas/search.js +3 -0
- package/dist/commands/canvas/unwatch.d.ts +2 -0
- package/dist/commands/canvas/unwatch.js +1 -0
- package/dist/commands/canvas/watch.d.ts +3 -0
- package/dist/commands/canvas/watch.js +1 -0
- package/dist/commands/canvas-analytics.js +1 -1
- package/dist/commands/canvas-history/grep.js +4 -4
- package/dist/commands/canvas-history/read.js +2 -2
- package/dist/commands/canvas-history/search.js +7 -7
- package/dist/commands/canvas-history/shared.d.ts +0 -1
- package/dist/commands/canvas-history/shared.js +1 -1
- package/dist/commands/canvas-history/stats.js +2 -2
- package/dist/commands/canvas-history.js +1 -1
- package/dist/commands/canvas.js +1 -1
- package/dist/commands/doc/delete.d.ts +2 -0
- package/dist/commands/doc/delete.js +1 -0
- package/dist/commands/doc/edit.d.ts +2 -0
- package/dist/commands/doc/edit.js +1 -0
- package/dist/commands/doc/history.d.ts +2 -0
- package/dist/commands/doc/history.js +2 -0
- package/dist/commands/doc/lint.d.ts +2 -0
- package/dist/commands/doc/lint.js +2 -0
- package/dist/commands/doc/list.d.ts +2 -0
- package/dist/commands/doc/list.js +1 -0
- package/dist/commands/doc/move.d.ts +2 -0
- package/dist/commands/doc/move.js +1 -0
- package/dist/commands/doc/read.d.ts +2 -0
- package/dist/commands/doc/read.js +1 -0
- package/dist/commands/doc/shared.d.ts +25 -0
- package/dist/commands/doc/shared.js +2 -0
- package/dist/commands/doc/write.d.ts +2 -0
- package/dist/commands/doc/write.js +1 -0
- package/dist/commands/{memory.d.ts → doc.d.ts} +1 -1
- package/dist/commands/doc.js +1 -0
- package/dist/commands/human/review.js +1 -1
- package/dist/commands/node/bash.js +2 -2
- package/dist/commands/node/create.js +1 -1
- package/dist/commands/node/inspect.js +10 -10
- package/dist/commands/node/lifecycle.js +2 -2
- package/dist/commands/node/outcome.js +1 -1
- package/dist/commands/node/subscription.js +1 -1
- package/dist/commands/node-context.js +2 -2
- package/dist/commands/pkg/browse/catalog.js +1 -1
- package/dist/commands/pkg/browse/doc-view.js +1 -1
- package/dist/commands/pkg/browse/model.d.ts +9 -17
- package/dist/commands/pkg/plugin-inspect.js +1 -1
- package/dist/commands/pkg/plugin-manage.d.ts +4 -8
- package/dist/commands/pkg/plugin-manage.js +15 -17
- package/dist/commands/profile/list.js +1 -1
- package/dist/commands/profile/new.js +1 -1
- package/dist/commands/profile/project.js +1 -1
- package/dist/commands/profile/show.js +1 -1
- package/dist/commands/push.js +3 -3
- package/dist/commands/sys/config.js +1 -1
- package/dist/commands/sys/context/admin/actions.d.ts +18 -43
- package/dist/commands/sys/context/admin/actions.js +1 -2
- package/dist/commands/sys/context/admin/detail-panel.d.ts +17 -25
- package/dist/commands/sys/context/admin/detail-panel.js +2 -1
- package/dist/commands/sys/context/admin/docs-panel.d.ts +7 -6
- package/dist/commands/sys/context/admin/docs-panel.js +1 -1
- package/dist/commands/sys/context/admin/list-view.d.ts +12 -12
- package/dist/commands/sys/context/admin/list-view.js +1 -1
- package/dist/commands/sys/context/admin/model.d.ts +96 -69
- package/dist/commands/sys/context/admin/model.js +1 -1
- package/dist/commands/sys/context/admin/rail-panel.d.ts +7 -5
- package/dist/commands/sys/context/admin/rail-panel.js +1 -1
- package/dist/commands/sys/context/admin/read-view.d.ts +10 -14
- package/dist/commands/sys/context/admin/read-view.js +1 -2
- package/dist/commands/sys/context/admin/shell.d.ts +26 -31
- package/dist/commands/sys/context/admin/shell.js +1 -1
- package/dist/commands/sys/context/admin.js +2 -2
- package/dist/commands/sys/context/doc.js +2 -3
- package/dist/commands/sys/context/expose.js +2 -2
- package/dist/commands/sys/context/prompt-review.js +4 -4
- package/dist/commands/sys/context/resolve.d.ts +92 -65
- package/dist/commands/sys/context/resolve.js +7 -9
- package/dist/commands/sys/context.js +1 -1
- package/dist/commands/sys/doctor.js +1 -1
- package/dist/commands/sys/migrate.js +1 -1
- package/dist/commands/sys/panels/profiles-panel.d.ts +3 -1
- package/dist/commands/sys/panels/profiles-panel.js +1 -1
- package/dist/commands/sys/sync-deps.d.ts +6 -11
- package/dist/commands/sys/sync-deps.js +7 -8
- package/dist/commands/sys/sync-project-guidance.js +5 -4
- package/dist/commands/sys/sync-shared.d.ts +41 -4
- package/dist/commands/sys/sync-shared.js +1 -1
- package/dist/commands/sys/sync-skills.js +2 -2
- package/dist/commands/sys/sync.js +1 -1
- package/dist/core/bash-job-supervisor.d.ts +2 -3
- package/dist/core/bash-job-supervisor.js +3 -3
- package/dist/core/bash-jobs.d.ts +0 -5
- package/dist/core/bash-jobs.js +7 -7
- package/dist/core/bootstrap.js +2 -2
- package/dist/core/canvas/canvas.d.ts +6 -50
- package/dist/core/canvas/canvas.js +16 -21
- package/dist/core/canvas/db.d.ts +4 -1
- package/dist/core/canvas/db.js +2 -2
- package/dist/core/canvas/history.d.ts +11 -39
- package/dist/core/canvas/history.js +9 -20
- package/dist/core/canvas/install-id.d.ts +2 -2
- package/dist/core/canvas/install-id.js +1 -1
- package/dist/core/canvas/memory-reads.d.ts +5 -0
- package/dist/core/canvas/memory-reads.js +1 -1
- package/dist/core/canvas/migrations.js +215 -41
- package/dist/core/canvas/node-agent-paths.js +1 -1
- package/dist/core/canvas/node-tokens.js +1 -1
- package/dist/core/canvas/paths.d.ts +0 -4
- package/dist/core/canvas/paths.js +1 -1
- package/dist/core/canvas/remote-canvas-source.d.ts +0 -1
- package/dist/core/canvas/remote-canvas-source.js +1 -1
- package/dist/core/canvas/render-source.d.ts +9 -6
- package/dist/core/canvas/render-source.js +6 -6
- package/dist/core/canvas/sessions.js +2 -2
- package/dist/core/canvas/source.d.ts +6 -0
- package/dist/core/canvas/tree.d.ts +29 -0
- package/dist/core/canvas/tree.js +12 -0
- package/dist/core/canvas/types.d.ts +0 -20
- package/dist/core/command-plugins/bundle.js +1 -1
- package/dist/core/config.d.ts +1 -1
- package/dist/core/conversation-store/listener.js +4 -2
- package/dist/core/feed/feed.d.ts +9 -7
- package/dist/core/feed/feed.js +3 -7
- package/dist/core/feed/inbox.d.ts +3 -5
- package/dist/core/feed/inbox.js +1 -10
- package/dist/core/feed/messages.d.ts +33 -6
- package/dist/core/feed/messages.js +10 -7
- package/dist/core/feed/reports.d.ts +10 -0
- package/dist/core/feed/reports.js +2 -0
- package/dist/core/grants/remove.js +1 -1
- package/dist/core/graph/access.d.ts +24 -0
- package/dist/core/graph/access.js +8 -0
- package/dist/core/graph/bodies.d.ts +6 -0
- package/dist/core/graph/bodies.js +1 -0
- package/dist/core/graph/deletion.d.ts +10 -0
- package/dist/core/graph/deletion.js +5 -0
- package/dist/core/graph/diff.d.ts +4 -0
- package/dist/core/graph/diff.js +4 -0
- package/dist/core/graph/documents.d.ts +167 -0
- package/dist/core/graph/documents.js +10 -0
- package/dist/core/graph/edges.d.ts +25 -0
- package/dist/core/graph/edges.js +1 -0
- package/dist/core/graph/events.d.ts +26 -0
- package/dist/core/graph/events.js +7 -0
- package/dist/core/graph/exposures.d.ts +53 -0
- package/dist/core/graph/exposures.js +4 -0
- package/dist/core/graph/jobs.d.ts +31 -0
- package/dist/core/graph/jobs.js +2 -0
- package/dist/core/graph/names.d.ts +30 -0
- package/dist/core/graph/names.js +3 -0
- package/dist/core/graph/objects.d.ts +55 -0
- package/dist/core/graph/objects.js +9 -0
- package/dist/core/graph/package-docs.d.ts +31 -0
- package/dist/core/graph/package-docs.js +5 -0
- package/dist/core/graph/package-files.d.ts +20 -0
- package/dist/core/graph/package-files.js +2 -0
- package/dist/core/graph/reader.d.ts +21 -0
- package/dist/core/graph/reader.js +3 -0
- package/dist/core/graph/repo-sync/exchange.d.ts +34 -0
- package/dist/core/graph/repo-sync/exchange.js +2 -0
- package/dist/core/graph/repo-sync/identity.d.ts +30 -0
- package/dist/core/graph/repo-sync/identity.js +1 -0
- package/dist/core/graph/repo-sync/index.d.ts +4 -0
- package/dist/core/graph/repo-sync/index.js +1 -0
- package/dist/core/graph/repo-sync/mirror.d.ts +30 -0
- package/dist/core/graph/repo-sync/mirror.js +6 -0
- package/dist/core/graph/repo-sync/ref-format.d.ts +76 -0
- package/dist/core/graph/repo-sync/ref-format.js +2 -0
- package/dist/core/graph/repo-sync/repos.d.ts +17 -0
- package/dist/core/graph/repo-sync/repos.js +3 -0
- package/dist/core/graph/repo-sync/sync.d.ts +42 -0
- package/dist/core/graph/repo-sync/sync.js +2 -0
- package/dist/core/graph/rules.d.ts +26 -0
- package/dist/core/graph/rules.js +3 -0
- package/dist/core/graph/spaces/app.d.ts +3 -0
- package/dist/core/graph/spaces/app.js +1 -0
- package/dist/core/graph/spaces/index.d.ts +19 -0
- package/dist/core/graph/spaces/index.js +1 -0
- package/dist/core/graph/spaces/person.d.ts +5 -0
- package/dist/core/graph/spaces/person.js +2 -0
- package/dist/core/graph/spaces/repo.d.ts +4 -0
- package/dist/core/graph/spaces/repo.js +1 -0
- package/dist/core/graph/types.d.ts +75 -0
- package/dist/core/graph/types.js +1 -0
- package/dist/core/graph/watches.d.ts +62 -0
- package/dist/core/graph/watches.js +18 -0
- package/dist/core/human/feedback-companion.js +1 -1
- package/dist/core/human/requests.d.ts +3 -1
- package/dist/core/human/requests.js +6 -6
- package/dist/core/inspector/model.js +2 -2
- package/dist/core/io.js +5 -5
- package/dist/core/layout-migrate/index.d.ts +24 -1
- package/dist/core/layout-migrate/index.js +4 -4
- package/dist/core/layout-migrate/paths.d.ts +4 -0
- package/dist/core/layout-migrate/paths.js +1 -1
- package/dist/core/layout-migrate/stored-paths.d.ts +7 -0
- package/dist/core/layout-migrate/stored-paths.js +11 -11
- package/dist/core/layout-migrate/stores.d.ts +19 -6
- package/dist/core/layout-migrate/stores.js +3 -4
- package/dist/core/manifest.d.ts +0 -2
- package/dist/core/manifest.js +1 -1
- package/dist/core/{memory/extensions.d.ts → plugin-extensions.d.ts} +9 -10
- package/dist/core/plugin-extensions.js +1 -0
- package/dist/core/preview-registry.d.ts +1 -1
- package/dist/core/preview-registry.js +3 -2
- package/dist/core/profiles/manifest.d.ts +7 -7
- package/dist/core/profiles/manifest.js +1 -1
- package/dist/core/profiles/select.js +3 -3
- package/dist/core/review/birth.js +1 -1
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/stage.d.ts +12 -1
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/store.d.ts +2 -0
- package/dist/core/review/store.js +1 -1
- package/dist/core/review/types.d.ts +7 -1
- package/dist/core/runs/events.js +1 -1
- package/dist/core/runs/operations.js +5 -5
- package/dist/core/runs/questions.js +2 -2
- package/dist/core/runtime/bearings-render.d.ts +13 -7
- package/dist/core/runtime/bearings-render.js +12 -12
- package/dist/core/runtime/bearings.d.ts +8 -18
- package/dist/core/runtime/bearings.js +7 -7
- package/dist/core/runtime/broker/daemon-ops.d.ts +7 -12
- package/dist/core/runtime/broker/daemon-ops.js +1 -1
- package/dist/core/runtime/broker/fault-retry.d.ts +2 -0
- package/dist/core/runtime/broker/fault-retry.js +1 -1
- package/dist/core/runtime/broker/frame-dispatch.d.ts +1 -1
- package/dist/core/runtime/broker/frame-memory-refs.d.ts +7 -2
- package/dist/core/runtime/broker/frame-memory-refs.js +1 -1
- package/dist/core/runtime/broker/inbox.d.ts +1 -4
- package/dist/core/runtime/broker/inbox.js +1 -10
- package/dist/core/runtime/broker/rebind.js +1 -1
- package/dist/core/runtime/broker/retry-card-elision.d.ts +7 -0
- package/dist/core/runtime/broker/retry-card-elision.js +1 -0
- package/dist/core/runtime/broker-extension-render.d.ts +0 -13
- package/dist/core/runtime/broker-extension-render.js +2 -4
- package/dist/core/runtime/broker-persona-guidance.js +3 -3
- package/dist/core/runtime/broker-protocol.d.ts +1 -1
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/close.d.ts +9 -4
- package/dist/core/runtime/close.js +1 -1
- package/dist/core/runtime/deliver-live.js +1 -1
- package/dist/core/runtime/kickoff.js +17 -19
- package/dist/core/runtime/launch-target.d.ts +7 -0
- package/dist/core/runtime/launch-target.js +1 -1
- package/dist/core/runtime/ledger.d.ts +10 -0
- package/dist/core/runtime/ledger.js +3 -0
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/nodes.d.ts +10 -2
- package/dist/core/runtime/nodes.js +1 -1
- package/dist/core/runtime/outcome-document.d.ts +2 -2
- package/dist/core/runtime/outcome-document.js +1 -1
- package/dist/core/runtime/persona.js +2 -2
- package/dist/core/runtime/placement.js +1 -1
- package/dist/core/runtime/promote.d.ts +2 -2
- package/dist/core/runtime/promote.js +1 -1
- package/dist/core/runtime/prospective-inventory-cli.js +2 -2
- package/dist/core/runtime/recycle.js +1 -1
- package/dist/core/runtime/reopen.js +1 -1
- package/dist/core/runtime/revive.js +2 -2
- package/dist/core/runtime/roadmap.d.ts +20 -9
- package/dist/core/runtime/roadmap.js +10 -6
- package/dist/core/runtime/spawn-env.js +1 -1
- package/dist/core/runtime/spawn.d.ts +5 -3
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/runtime/structured-output.d.ts +3 -1
- package/dist/core/runtime/structured-output.js +4 -4
- package/dist/core/scope.d.ts +1 -32
- package/dist/core/scope.js +1 -1
- package/dist/core/scoped-state/db.js +2 -1
- package/dist/core/scoped-state/migrate.js +2 -2
- package/dist/core/scoped-state/profiles.d.ts +11 -0
- package/dist/core/scoped-state/profiles.js +1 -1
- package/dist/core/scoped-state/schema.d.ts +1 -1
- package/dist/core/scoped-state/schema.js +7 -5
- package/dist/core/spaces/permissions.d.ts +0 -14
- package/dist/core/spaces/permissions.js +1 -1
- package/dist/core/spaces/stop.d.ts +13 -0
- package/dist/core/spaces/stop.js +2 -2
- package/dist/core/storage/tables.d.ts +1 -1
- package/dist/core/substrate/delivery/corpus.d.ts +21 -0
- package/dist/core/substrate/delivery/corpus.js +3 -0
- package/dist/core/substrate/delivery/deliver.d.ts +76 -0
- package/dist/core/substrate/delivery/deliver.js +6 -0
- package/dist/core/substrate/delivery/listings.d.ts +30 -0
- package/dist/core/substrate/delivery/listings.js +7 -0
- package/dist/core/substrate/delivery/match.d.ts +28 -0
- package/dist/core/substrate/delivery/match.js +1 -0
- package/dist/core/substrate/delivery/plan.d.ts +67 -0
- package/dist/core/substrate/delivery/plan.js +3 -0
- package/dist/core/substrate/delivery/render-boot.d.ts +20 -0
- package/dist/core/substrate/delivery/render-boot.js +54 -0
- package/dist/core/substrate/delivery/render-event.d.ts +54 -0
- package/dist/core/substrate/delivery/render-event.js +8 -0
- package/dist/core/substrate/delivery/sub-persona-menu.d.ts +2 -0
- package/dist/core/substrate/delivery/sub-persona-menu.js +6 -0
- package/dist/core/substrate/delivery/types.d.ts +30 -0
- package/dist/core/substrate/delivery/types.js +0 -0
- package/dist/core/substrate/gate-explain.d.ts +0 -13
- package/dist/core/substrate/gate-explain.js +1 -1
- package/dist/core/substrate/schema.d.ts +11 -139
- package/dist/core/substrate/schema.js +1 -1
- package/dist/core/substrate/subject-fields.d.ts +3 -0
- package/dist/core/substrate/subject.d.ts +2 -1
- package/dist/core/substrate/subject.js +1 -1
- package/dist/daemon/api/handlers/app-profiles.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +1 -2
- package/dist/daemon/api/handlers/broker-ops.js +1 -1
- package/dist/daemon/api/handlers/canvas.js +5 -5
- package/dist/daemon/api/handlers/daemon.js +1 -1
- package/dist/daemon/api/handlers/delivery.d.ts +2 -0
- package/dist/daemon/api/handlers/delivery.js +1 -0
- package/dist/daemon/api/handlers/{memory.d.ts → docs.d.ts} +1 -1
- package/dist/daemon/api/handlers/docs.js +1 -0
- package/dist/daemon/api/handlers/hook-exec.js +1 -1
- package/dist/daemon/api/handlers/messages.js +2 -2
- package/dist/daemon/api/handlers/node-records.js +2 -2
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/objects.d.ts +2 -0
- package/dist/daemon/api/handlers/objects.js +5 -0
- package/dist/daemon/api/handlers/package-docs.d.ts +2 -0
- package/dist/daemon/api/handlers/package-docs.js +1 -0
- package/dist/daemon/api/handlers/profiles.js +1 -1
- package/dist/daemon/api/handlers/reports.d.ts +2 -2
- package/dist/daemon/api/handlers/reports.js +4 -4
- package/dist/daemon/api/handlers/reviews.d.ts +4 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/map.d.ts +2 -2
- package/dist/daemon/api/map.js +2 -2
- package/dist/daemon/api/operations.d.ts +1 -1
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/reader.d.ts +17 -0
- package/dist/daemon/api/reader.js +1 -0
- package/dist/daemon/api/server.js +1 -1
- package/dist/daemon/control.d.ts +2 -3
- package/dist/daemon/crtrd.js +8 -6
- package/dist/daemon/fleet.js +4 -4
- package/dist/daemon/reconcilers/bash-deadline.d.ts +11 -1
- package/dist/daemon/reconcilers/bash-deadline.js +2 -1
- package/dist/daemon/reconcilers/broker-supervision.js +4 -4
- package/dist/daemon/reconcilers/live-obligation.js +1 -1
- package/dist/daemon/reconcilers/node-deadline.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -0
- package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
- package/dist/daemon/review/deliver.js +2 -2
- package/dist/daemon/review/finish.js +1 -1
- package/dist/hook-authoring.d.ts +0 -1
- package/dist/hook-authoring.js +3 -3
- package/dist/migrations/004-canvas-documents/apply.d.ts +10 -0
- package/dist/migrations/004-canvas-documents/apply.js +1 -0
- package/dist/migrations/004-canvas-documents/fields.d.ts +24 -0
- package/dist/migrations/004-canvas-documents/fields.js +2 -0
- package/dist/migrations/004-canvas-documents/index.d.ts +16 -0
- package/dist/migrations/004-canvas-documents/index.js +2 -0
- package/dist/migrations/004-canvas-documents/legacy/discover.d.ts +16 -0
- package/dist/migrations/004-canvas-documents/legacy/discover.js +1 -0
- package/dist/migrations/004-canvas-documents/legacy/history.d.ts +5 -0
- package/dist/migrations/004-canvas-documents/legacy/history.js +2 -0
- package/dist/migrations/004-canvas-documents/legacy/nested.d.ts +7 -0
- package/dist/migrations/004-canvas-documents/legacy/nested.js +1 -0
- package/dist/migrations/004-canvas-documents/legacy/parse.d.ts +14 -0
- package/dist/migrations/004-canvas-documents/legacy/parse.js +1 -0
- package/dist/migrations/004-canvas-documents/legacy/types.d.ts +91 -0
- package/dist/migrations/004-canvas-documents/legacy/types.js +0 -0
- package/dist/migrations/004-canvas-documents/legacy-edges.d.ts +6 -0
- package/dist/migrations/004-canvas-documents/legacy-edges.js +18 -0
- package/dist/migrations/004-canvas-documents/plan.d.ts +102 -0
- package/dist/migrations/004-canvas-documents/plan.js +3 -0
- package/dist/migrations/004-canvas-documents/pointers.d.ts +23 -0
- package/dist/migrations/004-canvas-documents/pointers.js +4 -0
- package/dist/migrations/activation.d.ts +9 -18
- package/dist/migrations/activation.js +2 -2
- package/dist/pi-extensions/broker-local.d.ts +2 -2
- package/dist/pi-extensions/broker-local.js +2 -2
- package/dist/pi-extensions/canvas-bash-valve.js +5 -4
- package/dist/pi-extensions/canvas-context-intro.js +2 -2
- package/dist/pi-extensions/canvas-doc-substrate.d.ts +0 -1
- package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
- package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
- package/dist/pi-extensions/canvas-passive-context.js +1 -1
- package/dist/pi-extensions/canvas-recap.js +2 -2
- package/dist/pi-extensions/canvas-stophook.d.ts +1 -1
- package/dist/pi-extensions/canvas-stophook.js +1 -1
- package/dist/prompts/review.js +3 -3
- package/dist/shared/env.d.ts +5 -0
- package/dist/shared/env.js +1 -1
- package/dist/shared/generated-context.js +2 -10
- package/dist/shared/inbox-entry-body.d.ts +22 -0
- package/dist/shared/inbox-entry-body.js +10 -0
- package/dist/{core/memory → shared}/inline-ref-guidance.d.ts +2 -2
- package/dist/shared/inline-ref-guidance.js +2 -0
- package/dist/types.d.ts +3 -1
- package/docs/cli/memory-and-preferences.md +12 -14
- package/docs/concepts/README.md +1 -1
- package/docs/concepts/lifecycle-and-wakes.md +1 -1
- package/docs/concepts/memory.md +15 -15
- package/docs/concepts/nodes-and-the-canvas.md +1 -1
- package/docs/concepts/profiles-kinds-and-modes.md +5 -5
- package/docs/concepts/scopes-and-trust.md +1 -1
- package/docs/concepts/why-a-daemon.md +1 -1
- package/docs/sdk/README.md +5 -6
- package/docs/sdk/errors.md +0 -13
- package/docs/sdk/guides/README.md +0 -1
- package/docs/sdk/nodes.md +0 -2
- package/docs/sdk/resources.md +0 -1
- package/package.json +2 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +11 -11
- package/scripts/lib/isolation-env.mjs +8 -2
- package/dist/api/dto/memory.d.ts +0 -171
- package/dist/api/dto/memory.js +0 -1
- package/dist/builtin-memory/crouter-sdk/guides/app-memory.md +0 -73
- package/dist/builtin-memory/crouter-sdk/memory.md +0 -87
- package/dist/commands/broker-permissions.d.ts +0 -2
- package/dist/commands/broker-permissions.js +0 -1
- package/dist/commands/memory/client.d.ts +0 -11
- package/dist/commands/memory/client.js +0 -1
- package/dist/commands/memory/delete.d.ts +0 -1
- package/dist/commands/memory/delete.js +0 -1
- package/dist/commands/memory/edit.d.ts +0 -1
- package/dist/commands/memory/edit.js +0 -21
- package/dist/commands/memory/find.d.ts +0 -1
- package/dist/commands/memory/find.js +0 -1
- package/dist/commands/memory/history.d.ts +0 -1
- package/dist/commands/memory/history.js +0 -5
- package/dist/commands/memory/lint.d.ts +0 -1
- package/dist/commands/memory/lint.js +0 -1
- package/dist/commands/memory/list.d.ts +0 -1
- package/dist/commands/memory/list.js +0 -1
- package/dist/commands/memory/move.d.ts +0 -1
- package/dist/commands/memory/move.js +0 -1
- package/dist/commands/memory/origin.d.ts +0 -1
- package/dist/commands/memory/origin.js +0 -1
- package/dist/commands/memory/read.d.ts +0 -1
- package/dist/commands/memory/read.js +0 -6
- package/dist/commands/memory/shared.d.ts +0 -22
- package/dist/commands/memory/shared.js +0 -1
- package/dist/commands/memory/write.d.ts +0 -1
- package/dist/commands/memory/write.js +0 -13
- package/dist/commands/memory.js +0 -1
- package/dist/commands/node-inspect-artifacts.d.ts +0 -1
- package/dist/commands/node-inspect-artifacts.js +0 -8
- package/dist/core/help/memory-extensions.d.ts +0 -3
- package/dist/core/help/memory-extensions.js +0 -2
- package/dist/core/memory/cli-selector.d.ts +0 -13
- package/dist/core/memory/cli-selector.js +0 -1
- package/dist/core/memory/doc-link-grammar.d.ts +0 -20
- package/dist/core/memory/doc-link-grammar.js +0 -2
- package/dist/core/memory/extensions.js +0 -1
- package/dist/core/memory/history.d.ts +0 -87
- package/dist/core/memory/history.js +0 -6
- package/dist/core/memory/identity.d.ts +0 -65
- package/dist/core/memory/identity.js +0 -1
- package/dist/core/memory/inline-ref-guidance.js +0 -2
- package/dist/core/memory/inline-ref-inventory.d.ts +0 -9
- package/dist/core/memory/inline-ref-inventory.js +0 -1
- package/dist/core/memory/lint.d.ts +0 -163
- package/dist/core/memory/lint.js +0 -2
- package/dist/core/memory/mutation-domain.d.ts +0 -113
- package/dist/core/memory/mutation-domain.js +0 -12
- package/dist/core/memory/mutations.d.ts +0 -74
- package/dist/core/memory/mutations.js +0 -1
- package/dist/core/memory/project-namespace.d.ts +0 -31
- package/dist/core/memory/project-namespace.js +0 -2
- package/dist/core/memory/repository-association.d.ts +0 -31
- package/dist/core/memory/repository-association.js +0 -1
- package/dist/core/memory/service.d.ts +0 -145
- package/dist/core/memory/service.js +0 -2
- package/dist/core/memory/tree.d.ts +0 -39
- package/dist/core/memory/tree.js +0 -1
- package/dist/core/memory-resolver.d.ts +0 -280
- package/dist/core/memory-resolver.js +0 -2
- package/dist/core/nested-stores.d.ts +0 -18
- package/dist/core/nested-stores.js +0 -1
- package/dist/core/runtime/memory.d.ts +0 -3
- package/dist/core/runtime/memory.js +0 -1
- package/dist/core/substrate/frontmatter-validation.d.ts +0 -11
- package/dist/core/substrate/frontmatter-validation.js +0 -1
- package/dist/core/substrate/gate.d.ts +0 -16
- package/dist/core/substrate/gate.js +0 -1
- package/dist/core/substrate/index.d.ts +0 -18
- package/dist/core/substrate/index.js +0 -1
- package/dist/core/substrate/injected-store.d.ts +0 -75
- package/dist/core/substrate/injected-store.js +0 -2
- package/dist/core/substrate/listings.d.ts +0 -28
- package/dist/core/substrate/listings.js +0 -1
- package/dist/core/substrate/memory-events.d.ts +0 -6
- package/dist/core/substrate/memory-events.js +0 -1
- package/dist/core/substrate/on-read-node.d.ts +0 -6
- package/dist/core/substrate/on-read-node.js +0 -1
- package/dist/core/substrate/on-read.d.ts +0 -101
- package/dist/core/substrate/on-read.js +0 -9
- package/dist/core/substrate/plan.d.ts +0 -94
- package/dist/core/substrate/plan.js +0 -1
- package/dist/core/substrate/render-node.d.ts +0 -12
- package/dist/core/substrate/render-node.js +0 -1
- package/dist/core/substrate/render.d.ts +0 -41
- package/dist/core/substrate/render.js +0 -65
- package/dist/core/substrate/session-cache.d.ts +0 -27
- package/dist/core/substrate/session-cache.js +0 -1
- package/dist/core/substrate/surface-match.d.ts +0 -73
- package/dist/core/substrate/surface-match.js +0 -1
- package/dist/daemon/api/handlers/memory.js +0 -5
- package/dist/migrations/001-surfaces-frontmatter.d.ts +0 -2
- package/dist/migrations/001-surfaces-frontmatter.js +0 -1
- package/dist/migrations/002-profile-project-memory.d.ts +0 -2
- package/dist/migrations/002-profile-project-memory.js +0 -1
- package/dist/migrations/003-repository-root-memory-identity/front-door.d.ts +0 -26
- package/dist/migrations/003-repository-root-memory-identity/front-door.js +0 -11
- package/dist/migrations/003-repository-root-memory-identity/index.d.ts +0 -2
- package/dist/migrations/003-repository-root-memory-identity/index.js +0 -5
- package/dist/migrations/003-repository-root-memory-identity/references.d.ts +0 -95
- package/dist/migrations/003-repository-root-memory-identity/references.js +0 -5
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.d.ts +0 -39
- package/dist/migrations/003-repository-root-memory-identity/repository-facts.js +0 -3
- package/dist/migrations/convergent.d.ts +0 -43
- package/dist/migrations/convergent.js +0 -2
- package/dist/migrations/corpus.d.ts +0 -75
- package/dist/migrations/corpus.js +0 -3
- package/dist/migrations/frontmatter-splice.d.ts +0 -15
- package/dist/migrations/frontmatter-splice.js +0 -8
- package/dist/migrations/profile-manifests.d.ts +0 -30
- package/dist/migrations/profile-manifests.js +0 -2
- package/dist/migrations/registry.d.ts +0 -7
- package/dist/migrations/registry.js +0 -1
- package/dist/migrations/runner.d.ts +0 -43
- package/dist/migrations/runner.js +0 -1
- package/dist/migrations/types.d.ts +0 -211
- package/dist/shared/birth-announcement.d.ts +0 -12
- package/dist/shared/birth-announcement.js +0 -1
- package/docs/sdk/guides/app-memory.md +0 -22
- package/docs/sdk/memory.md +0 -85
- /package/dist/{migrations/types.js → api/dto/delivery.js} +0 -0
- /package/dist/{core/memory → shared}/inline-ref-grammar.d.ts +0 -0
- /package/dist/{core/memory → shared}/inline-ref-grammar.js +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),
|
|
3
|
-
`)}c(
|
|
4
|
-
`).trimEnd()}c(
|
|
5
|
-
`).map(
|
|
6
|
-
`)}c(
|
|
7
|
-
`);if(t===-1)return"";const n
|
|
8
|
-
`)?
|
|
9
|
-
`)}c(
|
|
10
|
-
`)}c(
|
|
11
|
-
`),
|
|
12
|
-
`);const
|
|
13
|
-
`)}c(
|
|
14
|
-
`),r=[],
|
|
15
|
-
`)],t)}if(!r){if(
|
|
16
|
-
`),
|
|
17
|
-
`,1)[0];return t.startsWith("$ ")&&
|
|
1
|
+
var S=Object.defineProperty;var c=(n,t)=>S(n,"name",{value:t,configurable:!0});import{truncateToVisualLines as T}from"@earendil-works/pi-coding-agent";import{Box as j,Text as z,truncateToWidth as y,visibleWidth as R,wrapTextWithAnsi as B}from"@earendil-works/pi-tui";import{crtrPreviewRecords as U,HELP_ICON as D,iconForPath as V,suppressOutputForPath as G,summarizePath as Z}from"../../../core/preview-registry.js";import{FoldedToolCallController as K}from"./tool-calls.js";const Y=20,w=Y-3,P=/<<-?\s*(["']?)([A-Za-z_][A-Za-z0-9_]*)\1/g,v=/(?:^|[\n;&|()]\s*)(?:[A-Za-z_][A-Za-z0-9_]*=\S+\s+)*(?:[^\s;&|()]+\/)?(?:crtr|crouter)(?=\s|$)/,Ot="crtr-output";function E(n){const t=n.split(`
|
|
2
|
+
`),e=[];let r=0;for(;r<t.length;){const i=t[r];e.push(i),r++;const s=[];P.lastIndex=0;let o;for(;(o=P.exec(i))!==null;)s.push(o[2]);for(const l of s)for(;r<t.length;){const u=t[r].replace(/^\t+/,"");if(r++,u===l)break}}return e.join(`
|
|
3
|
+
`)}c(E,"stripHeredocBodies");function q(n){return typeof n=="string"&&v.test(E(n))}c(q,"isCrtrBashCommand");function $(n){const t=E(n),e=v.exec(t);if(e===null)return;const r=t.slice(e.index+e[0].length),i=r.search(/[\n;&|)]/),s=(i===-1?r:r.slice(0,i)).trim();return s===""?[]:J(Q(s))}c($,"extractCrtrInvocationTokens");const X=/^(?:\d*|&)(?:>>|<<|>|<)/;function J(n){const t=n.findIndex(e=>X.test(e));return t===-1?n:n.slice(0,t)}c(J,"dropRedirectTail");function Q(n){const t=[];let e="",r=!1,i=null;for(const s of n){if(i!==null){s===i?i=null:e+=s,r=!0;continue}if(s==='"'||s==="'"){i=s,r=!0;continue}if(/\s/.test(s)){r&&(t.push(e),e="",r=!1);continue}e+=s,r=!0}return r&&t.push(e),t}c(Q,"tokenizeShellSegment");function tt(n){if(typeof n!="string")return!1;const t=$(n);return t!==void 0&&t.some(e=>e==="-h"||e==="--help")}c(tt,"isCrtrHelpInvocation");function nt(n){const t=$(n);return{isHelp:t!==void 0&&t.some(r=>r==="-h"||r==="--help"),suppressOutput:t!==void 0&&t.length>0&&G(t)}}c(nt,"commandPreviewMeta");function O(n){if(!n||typeof n!="object")return"";const t=n.command;return typeof t=="string"?t:""}c(O,"commandFromArgs");const _=/^-{1,2}[A-Za-z0-9]/,et=/^(--?[A-Za-z0-9][^=]*)(=)(.*)$/,I=/^-?(?:\d+(?:\.\d+)?|\.\d+)$/;function rt(n,t){let e=!1;return n.map(r=>{const i=et.exec(r);if(i!==null){e=!1;const s=I.test(i[3])?"syntaxNumber":"syntaxString";return`${t.fg("syntaxKeyword",i[1])}${t.fg("syntaxOperator",i[2])}${t.fg(s,i[3])}`}return e&&!_.test(r)?(e=!1,t.fg(I.test(r)?"syntaxNumber":"syntaxString",r)):_.test(r)?(e=!0,t.fg("syntaxKeyword",r)):(e=!1,t.fg("toolTitle",t.bold(r)))}).join(" ")}c(rt,"styleFoldedCrtrTokens");function st(n){return(n.content??[]).filter(t=>t?.type==="text"||typeof t?.text=="string").map(t=>t.text??"").join(`
|
|
4
|
+
`).trimEnd()}c(st,"resultText");function L(n,t,e,r,i,s){const o=t===""?"":s.fg("accent",t);return`${n}${o}${s.fg("dim",e)}${s.fg("dim",r)}${s.fg("text",i)}`}c(L,"styledLabelValue");function A(n,t,e=!1){const r=n.trim();if(r==="")return"";if(/^<\/?(?:command|subcommand|runtime-state|crtr-[^>\s]+|error)(?:\s|>|$)/.test(r)){const a=r.startsWith("<error")?"error":"accent";return t.fg(a,t.bold(n))}if(/^(Input|Output|Effects|Branches|Globals|Output \(|Effects$)/.test(r))return t.fg("toolTitle",t.bold(n));if(/^(Spawned|Created|Updated|Wrote|Deleted|Promoted|Demoted|Closed|Revived|Recycled|Configured|Registered|Removed|Subscribed|Unsubscribed|Canceled)\b/i.test(r))return t.fg("success",n);if(/^(crtr:|Command exited|Command timed out|Command aborted|unknown subcommand|error\b)/i.test(r))return t.fg("error",n);if(/^(warning|warn|blocked|attention)\b/i.test(r)||r.includes("\u26A0"))return t.fg("warning",n);if(/^[●✓]/.test(r))return t.fg("success",n);if(/^[○◌]/.test(r))return t.fg("muted",n);if(/^[✗⊘]/.test(r))return t.fg("error",n);const i=/^(\s*)-\s+([^:]+)(:\s*)(.*)$/.exec(n);if(i!==null)return L(i[1],e?"- ":"\u2022 ",i[2],i[3],i[4],t);const s=/^(\s*)\*\*([^*]+):\*\*(\s*)(.*)$/.exec(n);if(s!==null)return e?`${s[1]}${t.fg("dim","**")}${t.fg("dim",s[2])}${t.fg("dim",":**")}${s[3]}${t.fg("text",s[4])}`:L(s[1],"",s[2],`:${s[3]}`,s[4],t);if(/^\s*-\s+/.test(n)){const a=/^(\s*)-\s+(.*)$/.exec(n),d=e?"-":"\u2022";return`${a[1]}${t.fg("accent",d)} ${t.fg("text",a[2])}`}const o=/^(\s*)(\d+\s+[^:]+:)$/.exec(n);if(o!==null)return`${o[1]}${t.fg("toolTitle",t.bold(o[2]))}`;const l=/^(\s*)(Next:)(\s*)(.*)$/.exec(n);if(l!==null)return`${l[1]}${t.fg("accent",t.bold(l[2]))}${l[3]}${t.fg("text",l[4])}`;const u=/^(\s*)([├└│─┬┼┌┐┘└]+\s*)(.*)$/.exec(n);return u!==null?`${u[1]}${t.fg("border",u[2])}${t.fg("text",u[3])}`:t.fg("text",n)}c(A,"lineStyle");function W(n,t,e=!1){return(n||"(no output)").split(`
|
|
5
|
+
`).map(i=>A(i,t,e)).join(`
|
|
6
|
+
`)}c(W,"renderCrtrOutputText");function it(n){if(!n.startsWith("$ "))return n;const t=n.indexOf(`
|
|
7
|
+
`);if(t===-1)return"";const e=n.slice(t+1);return e.startsWith(`
|
|
8
|
+
`)?e.slice(1):e}c(it,"stripCrtrEchoPrefix");function ot(n){const t=/<command name="[^"]*"([^>]*)>/.exec(n);return t===null?"leaf":/\bdescription="/.test(t[1])?"branch":"root"}c(ot,"classifyHelpText");function ct(n){const t=n.indexOf('<command name="'),e=(t===-1?n:n.slice(0,t)).trim(),r=[],i=/<command name="([^"]*)">\n([^\n]*)/g;let s;for(;(s=i.exec(n))!==null;)r.push(`${s[1]} \u2014 ${s[2]}`);return[e,...r.length>0?["",...r]:[]].join(`
|
|
9
|
+
`)}c(ct,"synthesizeRootPreview");function ut(n){const t=/^<command name="([^"]*)" description="([^"]*)">/.exec(n),e=t?.[1]??"",r=t?.[2]??"",i=[],s=/<subcommand name="([^"]*)" description="([^"]*)"[^>]*\/>/g;let o;for(;(o=s.exec(n))!==null;)i.push(`${o[1]} \u2014 ${o[2]}`);return[`${e} \u2014 ${r}`,...i.length>0?["",...i]:[]].join(`
|
|
10
|
+
`)}c(ut,"synthesizeBranchPreview");function lt(n){const t=n.split(`
|
|
11
|
+
`),e=[t[0]??""],r=t.indexOf("Input");if(r===-1)return e.join(`
|
|
12
|
+
`);const i=t.findIndex(u=>u.startsWith("Output (")),s=i===-1?t.length:i,o=t.slice(r+1,s).filter(u=>u.trim()!==""),l=o.map(u=>/^\s{2}(\S+)/.exec(u)?.[1]);return o.length>0&&l.every(u=>u!==void 0)?e.push("",`Params: ${l.join(", ")}`):o.length>0&&e.push("",o[0]),e.join(`
|
|
13
|
+
`)}c(lt,"synthesizeLeafPreview");function at(n){const t=it(n),e=ot(t);return e==="root"?ct(t):e==="branch"?ut(t):lt(t)}c(at,"synthesizeHelpPreviewText");function k(n,t,e=!1){if(n.text==="")return"";const r=/^(.*?)(\s*:\s{2})(.*)$/.exec(n.text);if(r!==null&&(n.tone===void 0||n.tone==="plain"))return`${t.fg("dim",r[1])}${t.fg("dim",r[2])}${t.fg("text",r[3])}`;const i=n.tone??"plain";if(i==="muted")return t.fg("muted",n.text);const s=i==="plain"?"text":i,o=t.fg(s,n.text);return e&&i==="plain"?t.bold(o):o}c(k,"renderSummaryLine");function dt(n,t){return n.isPartial?t.fg("warning","\u27F3 crtr running"):t.fg("error","\u2717 crtr failed")}c(dt,"statusLine");const H={isHelp:!1,suppressOutput:!1};function x(n,t){return t<=0?n.map(()=>""):n.map(e=>y(e,t,"\u2026"))}c(x,"clampRenderedLines");function M(n,t){return t<=0?n.map(()=>""):n.flatMap(e=>e===""?[""]:B(e,t))}c(M,"wrapRenderedLines");const ft=/^\[Showing lines \d+-\d+ of \d+ \([^)]+ limit\)\. Full output: .+\]$/;function pt(n){return ft.test(n.trim())}c(pt,"isPiTruncationMarker");function N(n){const t=n.trim();if(!t.includes("|"))return null;const e=t.replace(/^\|/,"").replace(/\|$/,""),r=[];let i="",s=0;for(;s<e.length;){const o=e[s];if(o==="\\"&&e[s+1]==="|"){i+="|",s+=2;continue}if(o==="|"){r.push(i.trim()),i="",s++;continue}i+=o,s++}return r.push(i.trim()),r.length>=2?r:null}c(N,"splitGenericTableRow");function mt(n){return n.every(t=>/^:?-{3,}:?$/.test(t))}c(mt,"isTableSeparator");function ht(n){const t=n.trim();return t.startsWith("|")||t.endsWith("|")}c(ht,"hasEdgePipe");function gt(n,t){const e=N(n[t]);if(e===null)return null;const r=[e];let i=t+1;for(;i<n.length;){const o=N(n[i]);if(o===null||o.length!==e.length)break;r.push(o),i++}if(r.length===1&&!ht(n[t]))return null;const s=r.findIndex(mt);return s===1?{next:i,rows:[r[0],...r.slice(2)],headerRows:1}:s!==-1?{next:i,rows:r.filter((o,l)=>l!==s),headerRows:0}:{next:i,rows:r,headerRows:0}}c(gt,"readGenericTableBlock");function xt(n){return n.reduce((t,e)=>t+e,0)}c(xt,"sum");function $t(n,t){const e=n[0]?.length??0;if(e===0)return[];const r=Math.max(0,e-1)*2,i=Math.max(e,t-r),s=i>=e*3?3:1,o=Array.from({length:e},(l,u)=>Math.max(1,...n.map(a=>R(a[u]??""))));for(;xt(o)>i;){let l=-1;for(let u=0;u<o.length;u++)o[u]>s&&(l===-1||o[u]>o[l])&&(l=u);if(l===-1)break;o[l]=o[l]-1}return o}c($t,"tableColumnWidths");function bt(n,t){const e=t-R(n);return e>0?`${n}${" ".repeat(e)}`:n}c(bt,"padToVisibleWidth");function wt(n,t){return n.map((e,r)=>bt(y(e,t[r]??1,"\u2026"),t[r]??1)).join(" ").trimEnd()}c(wt,"formatGenericTableRow");function Ct(n,t){const e=(n||"(no output)").split(`
|
|
14
|
+
`),r=[],i=c(o=>{r.push(o)},"push");let s=0;for(;s<e.length;){const o=gt(e,s);if(o!==null){const u=$t(o.rows,t);for(let a=0;a<o.rows.length;a++)i({text:wt(o.rows[a],u),tone:a<o.headerRows?"accent":void 0});s=o.next;continue}const l=e[s];i({text:l,tone:pt(l)?"muted":void 0}),s++}return r}c(Ct,"collectGenericPreviewLines");function Tt(n,t,e,r){const i=Ct(n,e).map(o=>o.tone!==void 0?k(o,r,o.tone==="accent"):A(o.text,r)),s=M(i,e);return s.length<=t?{lines:s,skippedCount:0}:{lines:s.slice(0,t),skippedCount:s.length-t}}c(Tt,"renderGenericPreview");class C{static{c(this,"CrtrResultComponent")}text;options;context;theme;command;staticPreview;structuredPreview;constructor(t,e,r,i,s,o=H,l){this.text=t,this.options=e,this.context=r,this.theme=i,this.command=s,this.staticPreview=o,this.structuredPreview=l}currentPreview(){return this.command===void 0?this.staticPreview:nt(this.command)}render(t){const e=this.currentPreview(),r=!!this.options.isPartial,i=!!this.context.isError,o=r||i?[dt(this.options,this.theme)]:[];if(this.options.expanded){const u=W(this.text,this.theme,!0),a=this.command!==void 0?[this.theme.fg("muted",`$ ${this.command}`),""]:[];return M(["",...o,...a,...u.split(`
|
|
15
|
+
`)],t)}if(!r){if(e.isHelp){const d=W(at(this.text),this.theme),m=T(d,w,t).visualLines??[],h=this.theme.fg("dim","(schema \u2014 ctrl+o to expand)");return x(["",...o,...m,h],t)}const u=this.command!==void 0?$(this.command):void 0,a=u!==void 0&&this.structuredPreview!==void 0?Z(this.structuredPreview,u):null;if(a!==null){const d=a.findIndex(g=>g.text!==""),p=a.map((g,f)=>k(g,this.theme,f===d)),h=T(p.join(`
|
|
16
|
+
`),w,t).visualLines??[],b=this.theme.fg("dim","(ctrl+o to expand)");return x(["",...o,...h,b],t)}if(!i&&e.suppressOutput){const d=this.theme.fg("dim","(suppressed \u2014 ctrl+o to expand)");return x(["",...o,d],t)}}const l=Tt(this.text,w,t,this.theme);if(l.skippedCount>0){const u=this.theme.fg("dim",`\u2026 (${l.skippedCount} more lines, ctrl+o to expand)`);return x(["",...o,...l.lines,u],t)}return x(["",...o,...l.lines],t)}invalidate(){}}function F(n){const t=n.split(`
|
|
17
|
+
`,1)[0];return t.startsWith("$ ")&&tt(t.slice(2))}c(F,"isHelpFromCrtrOutputContent");class _t extends j{static{c(this,"CrtrOutputMessageComponent")}content;theme;body;expanded;constructor(t,e,r){super(1,1,s=>r.bg("customMessageBg",s)),this.content=t,this.theme=r,this.expanded=e;const i={isHelp:F(t),suppressOutput:!1};this.body=new C(t,{expanded:e},{},r,void 0,i),this.addChild(this.body)}setExpanded(t){if(this.expanded===t)return;this.expanded=t;const e={isHelp:F(this.content),suppressOutput:!1};this.body=new C(this.content,{expanded:t},{},this.theme,void 0,e),this.clear(),this.addChild(this.body)}}function It(n,t=new K){const e=O(n);return q(e)?{definition:{name:"bash",label:"bash",description:"Render crtr bash output with crtr-specific chrome in the attach viewer.",parameters:{},renderCall(i,s,o){const l=O(i)||e,u=$(l),a=u!==void 0&&u.some(f=>f==="-h"||f==="--help"),d=(u??[]).filter(f=>f!=="-h"&&f!=="--help"),p=d.join(" "),m=a?D:V(d),h=a?`${m} crtr help`:`${m} crtr`,b=s.fg("accent",s.bold(h)),g=p?` ${t.folded?rt(d,s):s.fg("toolTitle",s.bold(p))}`:"";return t.capture(new z(`${b}${g}`,0,0))},renderResult(i,s,o,l){return new C(st(i),s,l,o,e,H,U(i).at(-1))}}}:void 0}c(It,"createCrtrBashToolDefinition");export{Ot as CRTR_OUTPUT_CUSTOM_TYPE,_t as CrtrOutputMessageComponent,nt as commandPreviewMeta,It as createCrtrBashToolDefinition,q as isCrtrBashCommand,tt as isCrtrHelpInvocation,W as renderCrtrOutputText,E as stripHeredocBodies};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The fragment a rendered document link carries. iTerm strips it before
|
|
2
|
+
* invoking Semantic History; the viewer recognizes a document by its path. */
|
|
3
|
+
export declare const DOC_OPEN_FRAGMENT = "crtr-doc-open";
|
|
4
|
+
/** What the renderer needs from the viewer. Every call is synchronous and reads
|
|
5
|
+
* live viewer state; a miss may schedule a fetch that re-renders later. */
|
|
6
|
+
export interface DocLinkContext {
|
|
7
|
+
/** The node this viewer is attached to. */
|
|
8
|
+
selfNodeId: string;
|
|
9
|
+
/** A node's display name, when known. */
|
|
10
|
+
nodeName(nodeId: string): string | undefined;
|
|
11
|
+
/** The local materialized file for a document ref, when one exists. */
|
|
12
|
+
pathFor(ref: string): string | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** Install (or clear) the viewer's document-link context. */
|
|
15
|
+
export declare function setDocLinkContext(context: DocLinkContext | undefined): void;
|
|
16
|
+
/** The node-id owner and remaining name of a ref, when its first segment is a node id. */
|
|
17
|
+
export declare function splitDocRef(ref: string, context?: DocLinkContext): {
|
|
18
|
+
nodeId?: string;
|
|
19
|
+
name: string;
|
|
20
|
+
};
|
|
21
|
+
/** A readable name for a document ref: `name`, plus the owning node's name
|
|
22
|
+
* when another node owns it. Plain text, for pickers and notices. */
|
|
23
|
+
export declare function docLinkLabel(ref: string, context?: DocLinkContext | undefined): {
|
|
24
|
+
name: string;
|
|
25
|
+
owner?: string;
|
|
26
|
+
};
|
|
27
|
+
/** One-line plain-text label: `name` or `name · owner`. */
|
|
28
|
+
export declare function docLinkText(ref: string, context?: DocLinkContext | undefined): string;
|
|
29
|
+
/** Every `[[ref]]` in `text`, in order of appearance, without brackets. */
|
|
30
|
+
export declare function extractDocRefs(text: string): string[];
|
|
31
|
+
/** Rewrite each `[[ref]]` in a prose fragment (never a code span or fence —
|
|
32
|
+
* the caller skips those) into its readable, openable display form. Without
|
|
33
|
+
* an installed context the prose is returned unchanged. */
|
|
34
|
+
export declare function rewriteProseDocLinks(prose: string, context?: DocLinkContext | undefined): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var r=(e,n)=>p(e,"name",{value:n,configurable:!0});import{pathToFileURL as $}from"node:url";const x="crtr-doc-open",f=/\[\[([^[\]\n]+?)\]\]/g,N=/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/,D=r(e=>`\x1B[2m${e}\x1B[22m`,"DIM"),b=r(e=>`\x1B[4m${e}\x1B[24m`,"UNDERLINE");let c;function E(e){c=e}r(E,"setDocLinkContext");function I(e,n){const t=e.indexOf("/");if(t<=0)return{name:e};const o=e.slice(0,t);return o===n?.selfNodeId||n?.nodeName(o)!==void 0||N.test(o)?{nodeId:o,name:e.slice(t+1)}:{name:e}}r(I,"splitDocRef");function l(e,n=c){const{nodeId:t,name:o}=I(e,n);return t===void 0?{name:o}:t===n?.selfNodeId?{name:o}:{name:o,owner:n?.nodeName(t)??t.slice(t.lastIndexOf("-")+1)}}r(l,"docLinkLabel");function w(e,n=c){const t=l(e,n);return t.owner===void 0?t.name:`${t.name} \xB7 ${t.owner}`}r(w,"docLinkText");function O(e){return[...e.matchAll(f)].map(n=>n[1].trim()).filter(n=>n!=="")}r(O,"extractDocRefs");function R(e,n=c){return n===void 0||!e.includes("[[")?e:e.replace(f,(t,o)=>{const i=o.trim();if(i==="")return t;const d=l(i,n),s=n.pathFor(i),a=m(d.name),u=s===void 0?b(a):`[${a}](${$(s).href}#${x})`;return d.owner===void 0?u:`${u}${D(` \xB7 ${m(d.owner)}`)}`})}r(R,"rewriteProseDocLinks");function m(e){return e.replace(/([\\[\]*_`<>])/g,"\\$1")}r(m,"escapeLabel");export{x as DOC_OPEN_FRAGMENT,l as docLinkLabel,w as docLinkText,O as extractDocRefs,R as rewriteProseDocLinks,E as setDocLinkContext,I as splitDocRef};
|
|
@@ -9,12 +9,12 @@ export type FileActivity = {
|
|
|
9
9
|
hasKnownCounts: boolean;
|
|
10
10
|
countsIncomplete: boolean;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
12
|
+
/** One canvas document this group read, wrote, edited or deleted, by its full
|
|
13
|
+
* name (`<owner-handle>/<name>`). Documents are canvas rows, not files, so the
|
|
14
|
+
* chip carries no path to hyperlink. */
|
|
15
|
+
export type DocumentActivity = {
|
|
15
16
|
action: 'read' | 'write' | 'edit' | 'delete';
|
|
16
17
|
name: string;
|
|
17
|
-
path?: string;
|
|
18
18
|
};
|
|
19
19
|
/** One node this group started or saw finish. `name` is the spawn's display
|
|
20
20
|
* name, or the node id when the finish has no matching spawn in this session. */
|
|
@@ -35,7 +35,7 @@ export type EventActivity = {
|
|
|
35
35
|
};
|
|
36
36
|
export type GroupActivity = {
|
|
37
37
|
files: readonly FileActivity[];
|
|
38
|
-
|
|
38
|
+
documents: readonly DocumentActivity[];
|
|
39
39
|
nodes: readonly NodeActivity[];
|
|
40
40
|
cards: readonly CardActivity[];
|
|
41
41
|
events: readonly EventActivity[];
|
|
@@ -49,8 +49,8 @@ export declare class GroupActivityRecorder {
|
|
|
49
49
|
private readonly roster;
|
|
50
50
|
private readonly calls;
|
|
51
51
|
private readonly files;
|
|
52
|
-
private readonly
|
|
53
|
-
private readonly
|
|
52
|
+
private readonly documents;
|
|
53
|
+
private readonly documentSet;
|
|
54
54
|
private readonly nodes;
|
|
55
55
|
private readonly nodeSet;
|
|
56
56
|
private readonly cards;
|
|
@@ -79,6 +79,6 @@ export declare class GroupActivityRecorder {
|
|
|
79
79
|
* an inserted output field can never break a chip. A record carrying an
|
|
80
80
|
* `error` is a failed call, which is not activity. */
|
|
81
81
|
private noteCrtrInvocation;
|
|
82
|
-
private
|
|
82
|
+
private addDocument;
|
|
83
83
|
private extract;
|
|
84
84
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)?0:1)}o(
|
|
1
|
+
var l=Object.defineProperty;var o=(s,t)=>l(s,"name",{value:t,configurable:!0});import{homedir as u}from"node:os";import{join as m,resolve as p}from"node:path";import{crtrPreviewRecords as w}from"../../../core/preview-registry.js";import{countDisplayDiffLines as v}from"./edit-diff.js";const g=3,O=Object.freeze({files:Object.freeze([]),documents:Object.freeze([]),nodes:Object.freeze([]),cards:Object.freeze([]),events:Object.freeze([]),eventsOmitted:0});function c(s){return typeof s=="object"&&s!==null?s:void 0}o(c,"object");function z(s){const t=c(s),e=t?.file_path??t?.path;return typeof e=="string"&&e!==""?e:void 0}o(z,"filePath");function y(s){return s.length===0?0:(s.match(/\n/g)?.length??0)+(s.endsWith(`
|
|
2
|
+
`)?0:1)}o(y,"lineCount");function a(s){return typeof s=="string"&&s!==""?s:void 0}o(a,"text");const b={"doc write":"write","doc edit":"edit","doc delete":"delete"};function j(s){if(s.type!=="document")return;const t=c(s.object),e=t===void 0?void 0:a(t.name);if(e===void 0)return;const n=a(c(t?.owner)?.handle);return n===void 0?e:`${n}/${e}`}o(j,"readDocumentName");function k(s,t){const e=s==="~"?u():s.startsWith("~/")?m(u(),s.slice(2)):s;return p(t,e)}o(k,"canonicalPath");function S(s,t,e){if(s==="edit"){const n=c(c(e)?.details)?.diff;return typeof n=="string"?{kind:"edit",...v(n),known:!0}:{kind:"edit",added:0,removed:0,known:!1}}if(s==="write"){const n=c(t)?.content;return typeof n=="string"?{kind:"write",added:y(n),removed:0,known:!0}:{kind:"write",added:0,removed:0,known:!1}}}o(S,"fileChange");class I{static{o(this,"GroupActivityRecorder")}cwd;roster;calls=new Map;files=new Map;documents=[];documentSet=new Set;nodes=[];nodeSet=new Set;cards=[];cardSet=new Set;events=new Map;eventsOmitted=0;constructor(t,e=new Map){this.cwd=t,this.roster=e}noteCard(t,e){switch(e.groupFolded){case"omit":return;case"event":this.addEvent(e.summary(t));return;case"activity":this.addCard({summary:e.summary(t)});return;case"senders":this.addFinishedSenders(t);return}}noteCall(t,e,n){this.calls.get(t)?.settled||this.calls.set(t,{name:e,args:n,settled:!1})}settle(t,e,n){const i=this.calls.get(t);!i||i.settled||(i.settled=!0,!n&&c(e)?.isError!==!0&&this.extract(i,e),i.args=void 0)}resolveWithoutResult(t){const e=this.calls.get(t);!e||e.settled||(e.settled=!0,e.args=void 0)}activity(){if(this.files.size===0&&this.documents.length===0&&this.nodes.length===0&&this.cards.length===0&&this.events.size===0)return O;const t=[...this.files.values()].map(d=>Object.freeze({...d})),e=this.documents.map(d=>Object.freeze({...d})),n=this.nodes.map(d=>Object.freeze({...d})),i=this.cards.map(d=>Object.freeze({...d})),f=[...this.events].map(([d,r])=>Object.freeze({text:d,count:r}));return Object.freeze({files:Object.freeze(t),documents:Object.freeze(e),nodes:Object.freeze(n),cards:Object.freeze(i),events:Object.freeze(f),eventsOmitted:this.eventsOmitted})}addFinishedSenders(t){for(const e of t.senders){const n=e.entries.length>0&&e.entries.every(i=>i.disposition==="human-answer");!e.finished||n||this.addNode({action:"finished",name:this.roster.get(e.id)??e.id,id:e.id})}}addCard(t){const e=t.summary;this.cardSet.has(e)||(this.cardSet.add(e),this.cards.push(t))}addEvent(t){const e=t.trim();if(e==="")return;const n=this.events.get(e);if(n!==void 0){this.events.set(e,n+1);return}if(this.events.size>=g){this.eventsOmitted+=1;return}this.events.set(e,1)}addNode(t){const e=`${t.action}:${t.id}`;this.nodeSet.has(e)||(this.nodeSet.add(e),this.nodes.push(t),t.action==="spawned"&&this.roster.set(t.id,t.name))}noteCrtrInvocation(t){if(t.error!==void 0||t.result===void 0)return;const e=t.result;switch(t.path){case"canvas read":{const n=j(e);n!==void 0&&this.addDocument({action:"read",name:n});return}case"doc write":case"doc edit":case"doc delete":{const n=a(e.name);if(n===void 0)return;this.addDocument({action:b[t.path],name:n});return}case"node new":{if(e.frozen_at!==void 0&&e.frozen_at!==null)return;const n=a(e.node_id),i=a(e.name);n!==void 0&&i!==void 0&&this.addNode({action:"spawned",name:i,id:n});return}default:return}}addDocument(t){const e=`${t.action}:${t.name}`;this.documentSet.has(e)||(this.documentSet.add(e),this.documents.push(t))}extract(t,e){if(t.name==="bash"){for(const h of w(e))this.noteCrtrInvocation(h);return}const n=z(t.args),i=S(t.name,t.args,e);if(!n||!i)return;const f=k(n,this.cwd),d=`${i.kind}:${f}`;let r=this.files.get(d);r||(r={key:f,displayPath:n,kind:i.kind,added:0,removed:0,hasKnownCounts:!1,countsIncomplete:!1},this.files.set(d,r)),r.added+=i.added,r.removed+=i.removed,r.hasKnownCounts||=i.known,r.countsIncomplete||=!i.known}}export{I as GroupActivityRecorder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var S=Object.defineProperty;var t=(i,n)=>S(i,"name",{value:n,configurable:!0});import{Container as b,Spacer as x,Text as f,getCapabilities as _,hyperlink as k,truncateToWidth as p,visibleWidth as O}from"@earendil-works/pi-tui";import{homedir as F}from"node:os";import{pathToFileURL as P}from"node:url";import{ICON as l}from"../../../core/inspector/model.js";import{TOOL_ICON as h}from"../../../core/preview-registry.js";const A=String.fromCodePoint(61485),v=String.fromCodePoint(61944),N=String.fromCodePoint(61530);function c(i,n,d){return`${i} ${i===1?n:d}`}t(c,"count");function L(i){const n=F();return i.startsWith(n)?`~${i.slice(n.length)}`:i}t(L,"shortened");function M(i){const n=L(i.displayPath);return _().hyperlinks?k(n,P(i.key).href):n}t(M,"filePath");function U(i,n){return i.filter(d=>d.action===n).length}t(U,"countDocuments");const T={read:A,write:h.write,edit:h.edit,delete:v},W=[["read","document read","documents read"],["write","document saved","documents saved"],["edit","document revised","documents revised"],["delete","document deleted","documents deleted"]];function K(i){return new Set(i.map(n=>n.key)).size}t(K,"distinctFileCount");function D(i,n){return i.filter(d=>d.action===n).length}t(D,"countNodes");class C{static{t(this,"RecapDetailLine")}prefix;path;suffix;constructor(n,d,o){this.prefix=n,this.path=d,this.suffix=o}invalidate(){}render(n){const d=Math.max(1,n-O(this.prefix)-O(this.suffix)),o=p(this.path,d,"\u2026");return[p(`${this.prefix}${o}${this.suffix}`,n,"")]}}class J extends b{static{t(this,"GroupRecapComponent")}setRecap(n,d,o,r,e){if(this.clear(),!n)return;if(this.addChild(new x(1)),r){for(const s of o.nodes)this.addChild(new C(`${e.accent(l.graph)} `,e.muted(s.name),e.muted(s.action==="spawned"?" spawned":" finished")));for(const s of o.documents){const m=T[s.action],a=s.action==="delete"?e.diffRemoved:e.info;this.addChild(new C(`${a(m)} `,e.muted(s.name),""))}for(const s of o.files)this.addFile(s,e)}const u=`${e.active(h.bash)} ${e.muted(c(d,"tool call","tool calls"))}`;if(r)this.addChild(new f(u,0,0));else{const s=[u],m=D(o.nodes,"spawned");m>=1&&s.push(`${e.accent(l.graph)} ${e.muted(c(m,"node spawned","nodes spawned"))}`);const a=D(o.nodes,"finished");a>=1&&s.push(`${e.accent(l.graph)} ${e.muted(c(a,"node finished","nodes finished"))}`);const w=K(o.files);w>=1&&s.push(`${e.warning(h.edit)} ${e.muted(c(w,"file changed","files changed"))}`),n.filesDeleted>=1&&s.push(`${e.diffRemoved(v)} ${e.muted(c(n.filesDeleted,"file deleted","files deleted"))}`);for(const[$,R,E]of W){const g=U(o.documents,$);if(g<1)continue;const I=$==="delete"?e.diffRemoved:e.info;s.push(`${I(T[$])} ${e.muted(c(g,R,E))}`)}this.addChild(new f(s.join(e.muted(" \xB7 ")),0,0))}this.addCardEvidence(o,e);for(const s of n.bullets)this.addChild(new f(e.muted(` \u2022 ${s.trim()}`),0,0));this.addChild(new x(1))}addCardEvidence(n,d){for(const o of n.cards)this.addChild(new f(`${d.info(N)} ${d.muted(o.summary)}`,0,0));for(const o of n.events){const r=o.count>1?` \xD7${o.count}`:"";this.addChild(new f(`${d.info(N)} ${d.muted(`${o.text}${r}`)}`,0,0))}n.eventsOmitted>0&&this.addChild(new f(d.muted(` ${c(n.eventsOmitted,"more runtime event","more runtime events")}`),0,0))}addFile(n,d){const o=n.hasKnownCounts?`${d.diffAdded(`+${n.added}`)}${n.kind==="edit"?` ${d.diffRemoved(`-${n.removed}`)}`:""}`:"",r=n.countsIncomplete?d.muted(n.hasKnownCounts?" \xB7 counts incomplete":"counts unavailable"):"",e=o||r?` ${o}${r}`:"",u=n.kind==="write"?h.write:h.edit;this.addChild(new C(`${d.warning(u)} `,M(n),e))}}export{J as GroupRecapComponent};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),n=[];let e;for(let o=0;o<i.length;o++){const r=i[o],u=h.exec(r);if(e!==void 0){u?.[1][0]===e&&(e=void 0),n.push(r);continue}if(u){e=u[1][0],n.push(r);continue}const l=
|
|
3
|
-
`)}c(
|
|
4
|
-
`).map(n=>{const e=h.exec(n);return i!==void 0?(e?.[1][0]===i&&(i=void 0),n):e?(i=e[1][0],n):
|
|
5
|
-
`)}c(
|
|
1
|
+
var m=Object.defineProperty;var c=(t,i)=>m(t,"name",{value:i,configurable:!0});import{pathToFileURL as x}from"node:url";import{expandGlyphCodepoints as y}from"./glyph-codepoints.js";import{rewriteProseDocLinks as $}from"./doc-links.js";const A=/^(\s{0,3})(#{3,6})(?:[ \t]+|$)(.*?)([ \t]+#+[ \t]*)?$/,h=/^\s{0,3}(`{3,}|~{3,})/,L=/^([ \t]{0,3})(<\/?)([A-Za-z][\w.:-]*)((?:[ \t]+[^<>]*?)?)(\/?)>[ \t]*$/,b=/([^\s=]+)(?:=("[^"]*"|'[^']*'|[^\s]*))?/g,k=[[232,194,104],[207,194,145],[181,184,174],[157,170,180],[135,153,164],[116,135,147]],d=[104,112,124],M=[138,166,196],a=[124,146,164],E=[168,142,118];function f(t,i){return`\x1B[38;2;${t[0]};${t[1]};${t[2]}m${i}\x1B[39m`}c(f,"paint");function w(t){const[i,n,e]=k[t-1];return o=>`\x1B[1;38;2;${i};${n};${e}m${o}\x1B[22;39m`}c(w,"headingColor");function T(t){const i=A.exec(t);if(!i)return;const[,n,e,o]=i;if(o!=="")return`${n}${w(e.length)(o)}`}c(T,"styleHeadingLine");function _(t){return t.replace(b,(i,n,e)=>e===void 0?f(a,i):`${f(a,n)}${f(d,"=")}${f(E,e)}`)}c(_,"styleAttributes");function N(t){const i=L.exec(t);if(!i)return;const[,n,e,o,r,u]=i;return n+f(d,e)+f(M,o)+_(r)+f(d,`${u}>`)}c(N,"styleXmlTagLine");function I(t){const i=t.split(`
|
|
2
|
+
`),n=[];let e;for(let o=0;o<i.length;o++){const r=i[o],u=h.exec(r);if(e!==void 0){u?.[1][0]===e&&(e=void 0),n.push(r);continue}if(u){e=u[1][0],n.push(r);continue}const l=N(r);if(l!==void 0){n.length>0&&n[n.length-1].trim()!==""&&n.push(""),n.push(l),i[o+1]!==void 0&&i[o+1].trim()!==""&&n.push("");continue}n.push(T(r)??r)}return n.join(`
|
|
3
|
+
`)}c(I,"styleAttachMarkdownSource");function s(t){return y(I(X(t)))}c(s,"styleAttachAgentMarkdown");function X(t){let i;return t.split(`
|
|
4
|
+
`).map(n=>{const e=h.exec(n);return i!==void 0?(e?.[1][0]===i&&(i=void 0),n):e?(i=e[1][0],n):C(n)}).join(`
|
|
5
|
+
`)}c(X,"rewriteAbsoluteFileLinks");function C(t){let i="",n=t;for(;n!=="";){const e=n.match(/`+/),o=e===null?n:n.slice(0,e.index);if(i+=U($(o)),e===null)break;const r=e[0],u=n.indexOf(r,o.length+r.length);if(u===-1)return i+n.slice(o.length);i+=n.slice(o.length,u+r.length),n=n.slice(u+r.length)}return i}c(C,"rewriteInlineFileLinks");function U(t){let i="",n=0;for(;n<t.length;){const e=t.indexOf("[",n);if(e===-1)return i+t.slice(n);const o=F(t,e);if(o===void 0){i+=t.slice(n,e+1),n=e+1;continue}i+=t.slice(n,e)+`[${o.label}](${x(o.path).href}#crtr-file-open)`,n=o.end}return i}c(U,"rewriteProseFileLinks");function F(t,i){const n=p(t,i+1,"]");if(n===void 0||t[n+1]!=="(")return;const e=n+2;if(t[e]==="<"){const r=p(t,e+1,">");if(r===void 0||t[r+1]!==")")return;const u=g(t.slice(e+1,r));return u===void 0?void 0:{label:t.slice(i+1,n),path:u,end:r+2}}let o=0;for(let r=e;r<t.length;r++){if(t[r]==="\\"){r++;continue}if(t[r]==="("){o++;continue}if(t[r]!==")"||o-- >0)continue;const u=g(t.slice(e,r));return u===void 0?void 0:{label:t.slice(i+1,n),path:u,end:r+1}}}c(F,"parseLocalMarkdownLink");function p(t,i,n){for(let e=i;e<t.length;e++){if(t[e]==="\\"){e++;continue}if(t[e]===n)return e}}c(p,"closingDelimiter");function g(t){const i=t.replace(/\\([!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~-])/g,"$1");let n=i;try{n=decodeURIComponent(i)}catch{}return n.startsWith("/")?n:void 0}c(g,"localPathFromDestination");function j(t){if(typeof t!="object"||t===null||!("content"in t))return t;const i=t;return typeof i.content=="string"?{...i,content:s(i.content)}:Array.isArray(i.content)?{...i,content:i.content.map(n=>{if(typeof n!="object"||n===null)return n;const e=n;return e.type==="text"&&typeof e.text=="string"?{...e,text:s(e.text)}:e.type==="thinking"&&typeof e.thinking=="string"?{...e,thinking:s(e.thinking)}:n})}:t}c(j,"styleAttachMessageMarkdown");function G(t){return{...t,summary:s(t.summary)}}c(G,"styleAttachSummaryMarkdown");export{s as styleAttachAgentMarkdown,I as styleAttachMarkdownSource,j as styleAttachMessageMarkdown,G as styleAttachSummaryMarkdown};
|
|
@@ -9,7 +9,7 @@ type Theme = {
|
|
|
9
9
|
/** A settled tool result on its way to the transcript. `MinimizableToolComponent`
|
|
10
10
|
* hands it to a definition's observer BEFORE the imported shell renders it, so a
|
|
11
11
|
* definition whose folded call row states a fact from the result (an edit's
|
|
12
|
-
* changed-line counts
|
|
12
|
+
* * changed-line counts) still has that fact once the fold
|
|
13
13
|
* renders instead of the result record — on the live stream and on a rebuilt
|
|
14
14
|
* transcript alike. */
|
|
15
15
|
export type ObservedToolResult = {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Environment variable carrying the edited document path to the reattached viewer. */
|
|
2
|
+
export declare const DOC_SAVEBACK_ENV = "CRTR_ATTACH_DOC_SAVEBACK";
|
|
3
|
+
/** The document a materialized file was read from. */
|
|
4
|
+
export interface MaterializedDoc {
|
|
5
|
+
/** The ref as the transcript wrote it (no brackets). */
|
|
6
|
+
ref: string;
|
|
7
|
+
id: string;
|
|
8
|
+
/** Canonical `<owner>/<name>` (or the ref when no owner). */
|
|
9
|
+
name: string;
|
|
10
|
+
revision: number;
|
|
11
|
+
/** The heads the body was read at — the base a save-back is made from. */
|
|
12
|
+
heads_key: string;
|
|
13
|
+
/** sha256 of the body as written. */
|
|
14
|
+
sha256: string;
|
|
15
|
+
}
|
|
16
|
+
/** The subset of a document read this module needs. */
|
|
17
|
+
export interface DocumentSnapshot {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
revision: number;
|
|
21
|
+
heads_key: string;
|
|
22
|
+
body: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function docMaterializeRoot(): string;
|
|
25
|
+
/** Write the snapshot's body to its stable path (idempotent) and return the path.
|
|
26
|
+
* An existing file at that path is kept: it may hold the person's unsaved edit. */
|
|
27
|
+
export declare function materializeDocument(ref: string, snap: DocumentSnapshot, root?: string): string;
|
|
28
|
+
/** The document a local path was materialized from, or undefined for a plain file. */
|
|
29
|
+
export declare function documentForPath(path: string, root?: string): MaterializedDoc | undefined;
|
|
30
|
+
/** Save a person's edit of a materialized document. */
|
|
31
|
+
export type DocSaveOutcome = {
|
|
32
|
+
outcome: 'unchanged';
|
|
33
|
+
} | {
|
|
34
|
+
outcome: 'saved';
|
|
35
|
+
revision: number;
|
|
36
|
+
} | {
|
|
37
|
+
outcome: 'stale';
|
|
38
|
+
path: string;
|
|
39
|
+
} | {
|
|
40
|
+
outcome: 'missing';
|
|
41
|
+
} | {
|
|
42
|
+
outcome: 'failed';
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
/** The document write the save-back uses: `crtr doc edit`'s body replacement,
|
|
46
|
+
* made from an explicit base. Resolves `stale` rather than throwing on a
|
|
47
|
+
* moved document. */
|
|
48
|
+
export type DocEditFn = (id: string, body: string, base: string) => Promise<{
|
|
49
|
+
revision: number;
|
|
50
|
+
} | 'stale'>;
|
|
51
|
+
export declare function saveDocumentEdit(path: string, edit: DocEditFn, root?: string): Promise<DocSaveOutcome>;
|
|
52
|
+
/** The notice a save-back outcome shows, or undefined for none. */
|
|
53
|
+
export declare function saveOutcomeNotice(name: string, outcome: DocSaveOutcome): string | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var l=Object.defineProperty;var o=(e,t)=>l(e,"name",{value:t,configurable:!0});import{createHash as S}from"node:crypto";import{existsSync as d,mkdirSync as $,readFileSync as y,renameSync as _,writeFileSync as p}from"node:fs";import{tmpdir as x}from"node:os";import{basename as A,dirname as g,join as c}from"node:path";const N="CRTR_ATTACH_DOC_SAVEBACK",a=".crtr-doc.json";function u(){return c(x(),"crtr-docs")}o(u,"docMaterializeRoot");const f=o(e=>S("sha256").update(e).digest("hex"),"sha");function h(e){return e.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,120)||"doc"}o(h,"safeSegment");function b(e,t,r=u()){const n=c(r,h(t.id),`r${t.revision}`),s=c(n,`${h(A(t.name))}.md`),i=c(n,a);if(d(s)&&d(i))return s;$(n,{recursive:!0});const v={ref:e,id:t.id,name:t.name,revision:t.revision,heads_key:t.heads_key,sha256:f(t.body)};return m(s,t.body),m(i,`${JSON.stringify(v)}
|
|
2
|
+
`),s}o(b,"materializeDocument");function m(e,t){const r=`${e}.${process.pid}.tmp`;p(r,t),_(r,e)}o(m,"writeAtomic");function C(e,t=u()){if(e.startsWith(`${t}/`))try{const r=JSON.parse(y(c(g(e),a),"utf8"));return typeof r.id=="string"&&typeof r.heads_key=="string"?r:void 0}catch{return}}o(C,"documentForPath");async function R(e,t,r=u()){const n=C(e,r);if(n===void 0||!d(e))return{outcome:"missing"};const s=y(e,"utf8");if(f(s)===n.sha256)return{outcome:"unchanged"};try{const i=await t(n.id,s,n.heads_key);return i==="stale"?{outcome:"stale",path:e}:(m(c(g(e),a),`${JSON.stringify({...n,sha256:f(s)})}
|
|
3
|
+
`),{outcome:"saved",revision:i.revision})}catch(i){return{outcome:"failed",message:i instanceof Error?i.message:String(i)}}}o(R,"saveDocumentEdit");function z(e,t){switch(t.outcome){case"unchanged":return;case"saved":return`Saved ${e} as revision ${t.revision}`;case"stale":return`${e} changed while you edited it \u2014 not saved; your text is kept at ${t.path}`;case"missing":return`Could not find the edited copy of ${e}`;case"failed":return`Could not save ${e}: ${t.message}`}}o(z,"saveOutcomeNotice");export{N as DOC_SAVEBACK_ENV,u as docMaterializeRoot,C as documentForPath,b as materializeDocument,R as saveDocumentEdit,z as saveOutcomeNotice};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CanvasSource } from '../../../core/canvas/source.js';
|
|
2
|
+
export interface DocumentLinks {
|
|
3
|
+
/** Whether a clicked local path is a materialized document. */
|
|
4
|
+
isDocumentPath(path: string): boolean;
|
|
5
|
+
/** Re-read a clicked document and return the path to open (its current revision). */
|
|
6
|
+
prepareOpen(path: string): Promise<{
|
|
7
|
+
path: string;
|
|
8
|
+
} | {
|
|
9
|
+
notice: string;
|
|
10
|
+
}>;
|
|
11
|
+
/** The save-back a reattaching viewer was handed, if any. */
|
|
12
|
+
consumeSaveBack(notify: (message: string) => void): Promise<void>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createDocumentLinks(opts: {
|
|
16
|
+
selfNodeId: string;
|
|
17
|
+
remote: boolean;
|
|
18
|
+
canvasSource: CanvasSource;
|
|
19
|
+
/** Re-render the transcript's Markdown after a name or path lands. */
|
|
20
|
+
refresh: () => void;
|
|
21
|
+
}): DocumentLinks;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=Object.defineProperty;var i=(o,r)=>k(o,"name",{value:r,configurable:!0});import{APIError as C}from"../../../api/errors.js";import{cliClient as v}from"../../../commands/api-client.js";import{setDocLinkContext as y}from"../render/doc-links.js";import{DOC_SAVEBACK_ENV as g,documentForPath as h,materializeDocument as b,saveDocumentEdit as E,saveOutcomeNotice as L}from"./doc-materialize.js";async function w(o){const r=await v().objects.read(o);if(r.state!=="object"||r.type!=="document")return`${o} is not a readable document`;const n=r;if(n.needs_merge||n.bodies.length!==1)return`${o} has ${n.heads.length} heads and needs a merge`;const s=n.object.owner?.handle;return{id:n.object.id,name:s===void 0?n.object.name:`${s}/${n.object.name}`,revision:n.revision,heads_key:n.heads.map(d=>d.rev_id).sort().join(","),body:n.bodies[0]}}i(w,"readSnapshot");function z(o){const r=new Map,n=new Map,s=new Set,d=new Set;let m=!1,f=!1,l=!1;const j=i(()=>{m||f||(f=!0,o.canvasSource.listNodes().then(t=>{for(const e of t)r.set(e.node_id,e.name);m=!0,l||o.refresh()}).catch(()=>{m=!0}).finally(()=>{f=!1}))},"loadRoster"),N=i(t=>{o.remote||s.has(t)||d.has(t)||(s.add(t),w(t).then(e=>{if(typeof e=="string"){d.add(t);return}n.set(t,b(t,e)),l||o.refresh()}).catch(()=>{d.add(t)}).finally(()=>{s.delete(t)}))},"materialize"),S={selfNodeId:o.selfNodeId,nodeName:i(t=>{const e=r.get(t);return e===void 0&&j(),e},"nodeName"),pathFor:i(t=>{const e=n.get(t);return e===void 0&&N(t),e},"pathFor")};return y(S),{isDocumentPath:i(t=>h(t)!==void 0,"isDocumentPath"),async prepareOpen(t){if(o.remote)return{notice:"Opening a document is unavailable in a remote attach"};const e=h(t);if(e===void 0)return{notice:"Not a document link"};try{const a=await w(e.id);if(typeof a=="string")return{notice:a};const c=b(e.ref,a);return n.set(e.ref,c),{path:c}}catch(a){return{notice:`Could not read ${e.name}: ${a instanceof Error?a.message:String(a)}`}}},async consumeSaveBack(t){const e=process.env[g];if(e===void 0||e==="")return;delete process.env[g];const a=h(e),c=await E(e,async(_,$,D)=>{try{return{revision:(await v().docs.edit(_,{body:$,base:D,rationale:"edited by the person in the attach viewer"})).revision}}catch(u){if(u instanceof C&&u.code==="stale_revision")return"stale";throw u}}),p=L(a?.name??e,c);p!==void 0&&t(p)},dispose(){l=!0,y(void 0)}}}i(z,"createDocumentLinks");export{z as createDocumentLinks};
|
|
@@ -17,6 +17,8 @@ export declare function openLinkedFileInPane(opts: {
|
|
|
17
17
|
cwd: string;
|
|
18
18
|
nodeId: string;
|
|
19
19
|
observer: boolean;
|
|
20
|
+
/** A materialized canvas document: the reattaching viewer saves its edit back. */
|
|
21
|
+
saveBackEnv?: string;
|
|
20
22
|
/** Clear viewer-local pane identity immediately before the pane runs Neovim. */
|
|
21
23
|
beforeRespawn: () => void;
|
|
22
24
|
}): LinkedFileOpenResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=Object.defineProperty;var r=(e,n)=>s(e,"name",{value:n,configurable:!0});import{existsSync as o}from"node:fs";import{respawnPaneInBackground as u,shellQuote as c,viewerSplitEnv as l}from"../../../core/runtime/placement-tmux.js";const d="\x1B_crtr-file-open;",f="\x1B\\";function I(e){const n=e.indexOf(d);if(n===-1)return;const t=n+d.length,i=e.indexOf(f,t);return i===-1?void 0:{file:a(e.slice(t,i)),remaining:e.slice(0,n)+e.slice(i+f.length)}}r(I,"extractFileOpenInput");function a(e){const n=e.startsWith("'")?h(e):x(e);return n!==void 0&&n.startsWith("/")&&!/[\x00-\x1f\x7f]/.test(n)?n:void 0}r(a,"decodeShellEscapedPath");function h(e){let n="",t=1;for(;;){const i=e.indexOf("'",t);if(i===-1)return;if(n+=e.slice(t,i),t=i+1,t===e.length)return n;if(e.slice(t,t+3)!=="\\''")return;n+="'",t+=3}}r(h,"decodeSingleQuotedPath");function x(e){let n="";for(let t=0;t<e.length;t++){if(e[t]!=="\\"){n+=e[t];continue}const i=e[++t];if(i===void 0)return;n+=i}return n}r(x,"decodeBackslashPath");function P(e){if(!o(e.file))return"missing";const n=`crtr surface attach to ${c(e.nodeId)}${e.observer?" --observer":""}`,t=e.saveBackEnv===void 0?"":`env ${e.saveBackEnv}=${c(e.file)} `,i=`nvim ${c(e.file)} || :; exec ${t}${n}`;return e.beforeRespawn(),u({pane:e.pane,cwd:e.cwd,env:l(),command:i})?"opened":"failed"}r(P,"openLinkedFileInPane");export{I as extractFileOpenInput,P as openLinkedFileInPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N=Object.defineProperty;var l=(e,t)=>N(e,"name",{value:t,configurable:!0});import{constants as _,accessSync as j,existsSync as P,mkdtempSync as k,readFileSync as E,rmSync as d,statSync as z}from"node:fs";import{tmpdir as F}from"node:os";import{delimiter as C,join as p,resolve as I,sep as $}from"node:path";import{execFile as v,spawnSync as T}from"node:child_process";import{loadProfileManifest as q,profileMemoryDir as M}from"../../../core/profiles/manifest.js";import{contextDir as O}from"../../../core/canvas/node-agent-paths.js";import{shellQuote as c}from"../../../core/runtime/placement-tmux.js";import{surfaceTmuxStyleArgs as S}from"../../../core/runtime/surface-bg.js";function A(e,t){const n=new Map(e.map(i=>[i.node_id,i])),r=new Set([t]);for(let i=n.get(t);i?.parent!==null&&i?.parent!==void 0;){const f=i.parent;if(r.has(f))break;r.add(f),i=n.get(f)}const s=[t];for(;s.length>0;){const i=s.pop();for(const f of e)f.parent!==i||r.has(f.node_id)||(r.add(f.node_id),s.push(f.node_id))}return e.filter(i=>r.has(i.node_id)).map(i=>i.node_id)}l(A,"relatedNodeIds");function oe(e,t){const n=new Set(A(e,t));return e.filter(r=>n.has(r.node_id)).map(r=>r.cwd)}l(oe,"relatedNodeDirs");function H(e){const t=[];for(const n of e)try{t.push(O(n))}catch{continue}return y(t)}l(H,"familyDocumentDirs");function L(e){try{return z(e).isDirectory()}catch{return!1}}l(L,"isDirectory");function R(e,t){const n=[...t==null?[]:[t],...(process.env.PATH??"").split(C).filter(Boolean).map(r=>p(r,e))];return[...new Set(n)]}l(R,"executableCandidates");function h(e,t){for(const n of R(e,t)){try{j(n,_.X_OK)}catch{continue}if(T(n,["--version"],{stdio:"ignore"}).status===0)return n}return null}l(h,"workingExecutable");function W(e){if(e===null||e==="")return{projects:[],memory:null};try{const{profileId:t,manifest:n}=q(e);return{projects:n.projects.map(r=>r.path),memory:M(t)}}catch{return{projects:[],memory:null}}}l(W,"profileSearchRoots");function y(e){const t=new Set,n=[];for(const r of e){const s=I(r);t.has(s)||!L(s)||(t.add(s),n.push(s))}return n}l(y,"dedupeExistingDirs");function B(e){return e.filter(t=>!e.some(n=>n!==t&&t.startsWith(n+$)))}l(B,"outermostDirs");const K=20;function Q(e){try{const t=E(e);if(t.length===0)return null;const n=t[t.length-1]===0?t.length-1:t.length;return t.subarray(0,n).toString("utf8")||null}catch{return null}}l(Q,"selectionPath");function ie(e){const t=h("fd",e.fdPath);if(t===null){e.onNotice("fd is required for profile file search");return}const n=h("fzf");if(n===null){e.onNotice("fzf is required for profile file search");return}const r=h("nvim");if(r===null){e.onNotice("Neovim is required for profile file search");return}const s=W(e.profileId),i=y([e.cwd,...e.nodeDirs,...s.projects]);if(i.length===0){e.onNotice("No profile file-search directories exist");return}const f=B(i),w=y([...s.memory===null?[]:[s.memory]]),u=k(p(F(),"crtr-profile-files-")),g=p(u,"selection"),x=p(u,"candidates"),b=H(e.nodeIds).filter(o=>!f.some(a=>o===a||o.startsWith(a+$))),D=`{ ${[...f.map(o=>`${c(t)} --type f --hidden --exclude .git . ${c(o)}`),...b.map(o=>`${c(t)} --type f --hidden --exclude .git --exclude ${c("/jobs")} . ${c(o)}`),...w.map(o=>`${c(t)} --type f --hidden --exclude .git --no-ignore . ${c(o)}`)].map(o=>`${o} &`).join(" ")} wait; } > ${c(x)} && ${c(n)} --print0 --scheme=path --hscroll-off=${K} --header ${c("fuzzy path \u2022 ctrl-y yank file path")} --bind ${c("ctrl-y:execute-silent(printf '%s' {} | { if command -v pbcopy >/dev/null 2>&1; then pbcopy; elif command -v wl-copy >/dev/null 2>&1; then wl-copy; elif command -v xclip >/dev/null 2>&1; then xclip -selection clipboard; else cat >/dev/null; fi; }; printf '%s' {} | tmux load-buffer -w -)+abort")} --preview ${c("head -100 -- {}")} < ${c(x)} > ${c(g)}`;try{v("tmux",["display-popup","-E","-T"," profile files ","-w","80%","-h","60%",...S(),D],()=>{const o=Q(g);if(o===null||!P(o)){d(u,{recursive:!0,force:!0});return}const a=`exec ${c(r)} -- ${c(o)}`;try{v("tmux",["display-popup","-E","-T"," profile file ","-w","90%","-h","90%",...S(),a],()=>d(u,{recursive:!0,force:!0}))}catch(m){d(u,{recursive:!0,force:!0}),e.onNotice(`Could not open profile file: ${m instanceof Error?m.message:String(m)}`)}})}catch(o){d(u,{recursive:!0,force:!0}),e.onNotice(`Could not open profile file search: ${o instanceof Error?o.message:String(o)}`)}}l(ie,"launchProfileFileSearch");export{ie as launchProfileFileSearch,oe as relatedNodeDirs,A as relatedNodeIds};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var i=(t,e)=>E(t,"name",{value:e,configurable:!0});import{execFile as p}from"node:child_process";import{BUILTIN_SLASH_COMMANDS as h}from"../../../core/runtime/pi-vendored.js";import{surfaceTmuxStyleArgs as O}from"../../../core/runtime/surface-bg.js";import{viewerOperationForSlash as _}from"../input/capabilities.js";import{shellQuote as y}from"../../../shared/shell-quote.js";const g=[{name:"tutorial",description:"The guided crouter tutorial \u2014 your agent teaches it, one lesson at a time"},{name:"clear",description:"Clear the conversation and free context \u2014 a fresh, empty session (like /new)"},{name:"graph",description:"Toggle the canvas GRAPH view (your local subscription tree)"},{name:"inbox",description:"Toggle the human inbox \u2014 pending asks and reviews for you"},{name:"promote",description:"Promote this node to an orchestrator \u2014 /promote, or /promote <kind> to specialize"},{name:"resume",description:"Open the canvas navigator and swap THIS pane onto the chosen node; parked residents wake only on submitted input"},{name:"resume-session",description:"Switch this node onto one of its saved pi sessions \u2014 picker, or /resume-session <session-path>"},{name:"context",description:"Browse this node + its subscriptions\u2019 context dirs in a read-only nvim popup"},{name:"plugins",description:"Open the interactive plugin browser for this machine"},{name:"node-metadata",description:"Inspect this node \u2014 identity, lifecycle, runtime, graph, artifacts, paths, and agent surfaces"},{name:"mcp",description:"MCP servers \u2014 status from the adapter\u2019s config/cache; Enter (or /mcp <server>) connects, reconnects, or re-auths"},{name:"rename",description:"Rename this node everywhere \u2014 node row, viewer window, session chip, tmux pane: /rename <name>"},{name:"color",description:"Color this node \u2014 tmux pane outline + name chip: /color <color> (red, blue, #rrggbb, \u2026) or /color none"},{name:"mouse",description:"Toggle mouse wheel scrolling and drag-select \u2014 off restores tmux drag-select and copy-mode mouse"},{name:"copy-message",description:"Copy the newest message visible in the transcript viewport"},{name:"copy-tool",description:"Copy the newest tool call output"},{name:"copy-transcript",description:"Copy every copyable transcript block"},{name:"fold-tools",description:"View setting \u2014 fold every FINISHED tool call to its single call line (Alt+C \u2192 z \u2192 f)"}],$=new Map([["resume-node","resume"]]),w=new Set([...g.map(t=>t.name),...$.keys()]),U=new Set(["black","red","green","yellow","blue","magenta","cyan","white","brightred","brightgreen","brightyellow","brightblue","brightmagenta","brightcyan","orange","grey","gray","default"]),T=new Set(["trust"]),N=new Set(Object.keys({off:!0,minimal:!0,low:!0,medium:!0,high:!0,xhigh:!0,max:!0})),v=new Set(h.map(t=>t.name));function b(t){return t.capabilities.nodeId}i(b,"nodeIdFor");function H(t){return t.capabilities.profileId}i(H,"profileIdFor");function P(t,e){const n=_(t,v.has(t),w.has(t));return n===void 0?void 0:e.capabilities.refusal(n,t)}i(P,"readOnlyRefusal");function te(){return new Set([...v,...w,...T])}i(te,"locallyConsumedCommandNames");function j(t){const e=/^\/(\S+)\s*([\s\S]*)$/.exec(t.trim());return e===null?void 0:{name:e[1],arg:e[2].trim()}}i(j,"parseSlashCommand");function oe(t){return t.trimStart().startsWith("/")}i(oe,"isSlashCommand");function re(t,e){const n=j(t);if(n===void 0)return!1;const{arg:o}=n,r=$.get(n.name)??n.name;if(T.has(r))return e.notify(`/${r} is not supported in attach (Phase 4)`),!0;if(w.has(r)){const s=P(r,e);return s!==void 0?(e.notify(s),!0):X(r,o,e)}if(!v.has(r))return!1;const u=P(r,e);if(u!==void 0)return e.notify(u),!0;switch(r){case"new":return e.send({type:"new_session"}),!0;case"reload":return e.send({type:"reload"}),!0;case"compact":return e.send({type:"compact",instructions:o||void 0}),!0;case"quit":return e.onQuit?(e.onQuit(),!0):(e.send({type:"bye"}),e.notify("Detaching \u2014 the engine keeps running"),!0);case"name":return o?(e.send({type:"set_session_name",name:o}),!0):m(e,"/name <display name>");case"export":{const{path:s,format:a}=W(o,e.cwd??process.cwd());return e.send({type:"export",path:s,format:a}),e.notify(`Exporting session \u2192 ${s}`),!0}case"import":return o?(e.send({type:"switch_session",path:o}),!0):m(e,"/import <path-to-session.jsonl>");case"model":return o?(e.send({type:"set_model",model:o}),!0):f(e.openModelPicker,e,"model","/model <provider/id>");case"fork":return o?(e.send({type:"fork",entryId:o}),!0):f(e.openForkPicker,e,"fork point","/fork <entryId>");case"tree":return o?(e.send({type:"navigate_tree",targetId:o}),!0):f(e.openTreePicker,e,"tree","/tree <entryId>");case"scoped-models":return e.openScopedModelsPicker?(e.openScopedModelsPicker(),!0):(e.notify("The scoped-models view needs the read-op channel, which this viewer has not wired"),!0);case"settings":return Q(o,e);case"session":return e.notify(Y(e.state)),!0;case"copy":return e.onCopy?(e.onCopy(),!0):(e.notify("/copy is not available in this viewer"),!0);case"login":return e.openLoginPicker?(e.openLoginPicker(),!0):(e.notify("/login is not available in this viewer"),!0);case"logout":return e.openLogoutPicker?(e.openLogoutPicker(),!0):(e.notify("/logout is not available in this viewer"),!0);case"share":return e.send({type:"share"}),e.notify("Sharing session\u2026"),!0;case"clone":return e.send({type:"clone"}),e.notify("Cloning session\u2026"),!0;case"changelog":return e.notify("/changelog: see https://github.com/earendil-works/pi for release notes (no bundled changelog in this build)"),!0;case"hotkeys":return e.onHelp?(e.onHelp(),!0):(e.notify("/hotkeys is not available in this viewer"),!0);default:return e.notify(`/${r} is not available in attach (Phase 4)`),!0}}i(re,"dispatchSlashCommand");function M(t,e){const n=i(a=>{const l=_(a,!1,!0);return l===void 0||e.permits(l)},"permitted"),o=g.filter(a=>n(a.name)),r=new Map(g.map(a=>[a.name,a])),u=t.flatMap(a=>{const l=r.get(a.name);return l===void 0?[a]:n(a.name)?[l]:[]}),s=new Set(t.map(a=>a.name));return[...u,...o.filter(a=>!s.has(a.name))]}i(M,"withCanvasCommands");function ie(t,e){return M(t??h,e).map(n=>({name:n.name,description:n.description}))}i(ie,"slashCommandList");function se(t,e){return M(t??h,e).map(n=>({value:`/${n.name}`,label:`/${n.name}`,description:n.description}))}i(se,"commandAutocompleteItems");function X(t,e,n){switch(t){case"clear":return n.send({type:"new_session"}),!0;case"graph":return n.onGraph?n.onGraph():n.notify("The GRAPH overlay is not wired into the viewer yet"),!0;case"inbox":return n.onInbox?n.onInbox():n.notify("The inbox surface is not wired into the viewer yet"),!0;case"tutorial":return n.send({type:"prompt",text:"The user asked for the crouter tutorial. Run `crtr sys tutorial -h`, pick the track that matches what they want to learn, and teach it one lesson per invocation \u2014 in your own words, letting them try each thing before you move on."}),!0;case"promote":return B(e,n),!0;case"resume":return e?m(n,"/resume \u2014 no argument; use /resume-session <path> to switch pi sessions"):G(n);case"resume-session":return e?(n.send({type:"switch_session",path:e}),!0):f(n.openSessionPicker,n,"session","/resume-session <session-path>");case"mcp":return n.openMcpPicker?n.openMcpPicker(e||void 0):n.notify("The MCP panel is not wired into this viewer"),!0;case"context":return V(n);case"plugins":return q(n);case"node-metadata":return n.onNodeMetadata?n.onNodeMetadata():n.notify("Node metadata is not wired into this viewer"),!0;case"rename":return F(e,n),!0;case"color":return R(e,n);case"fold-tools":return n.onFoldTools?n.onFoldTools():n.notify("The fold-tools view setting is not wired into this viewer"),!0;case"mouse":return n.onToggleMouse?n.onToggleMouse():n.notify("Mouse reporting is not wired into this viewer"),!0;case"copy-message":return n.onCopyTarget?n.onCopyTarget("message"):n.notify("/copy-message is not available in this viewer"),!0;case"copy-tool":return n.onCopyTarget?n.onCopyTarget("tool"):n.notify("/copy-tool is not available in this viewer"),!0;case"copy-transcript":return n.onCopyTarget?n.onCopyTarget("transcript"):n.notify("/copy-transcript is not available in this viewer"),!0;default:return n.notify(`/${t} is not available in attach`),!0}}i(X,"dispatchCanvasCommand");function B(t,e){const n=b(e).trim();if(n===""){e.notify("/promote: no node to promote (viewer has no node id)");return}const o=t.trim().toLowerCase();e.notify(o?`Promoting \u2192 ${o}\u2026`:"Promoting\u2026");const r=["node","promote","--node",n,"--json"];o!==""&&r.push("--kind",o),p("crtr",r,{timeout:15e3,maxBuffer:4*1024*1024},(s,a)=>{let l=null,d=null;try{l=JSON.parse(a)}catch{l=null}if(s&&l===null){const L=typeof s.stdout=="string"?s.stdout:"";try{const C=JSON.parse(L);d=typeof C.message=="string"?C.message:null}catch{d=null}d===null&&(d=s.message)}if(l===null){e.notify(`promote failed: ${d??"unknown error"}`);return}const S=(l.roadmap_path??"").trim();e.notify(`Promoted to ${l.kind??"orchestrator"} orchestrator \u2014 authoring roadmap${S!==""?` (${S})`:""}.`),e.send({type:"prompt",text:"You have just been promoted to an orchestrator. Your new-role guidance is arriving \u2014 read it, author your roadmap, and start delegating."})}).stdin?.end()}i(B,"promoteNode");function F(t,e){const n=b(e).trim();if(n===""){e.notify("/rename: no node to rename (viewer has no node id)");return}if(t===""){e.notify("Usage: /rename <name>");return}e.send({type:"set_session_name",name:t});const o=process.env.TMUX_PANE;process.env.TMUX!==void 0&&o!==void 0&&o!==""&&p("tmux",["select-pane","-t",o,"-T",t],()=>{}),p("crtr",["node","config","--node",n,"--name",t,"--json"],{timeout:15e3,maxBuffer:4*1024*1024},(r,u)=>{if(r){let s=null;try{const a=JSON.parse(u);s=typeof a.message=="string"?a.message:null}catch{s=null}e.notify(`rename failed: ${s??r.message}`);return}e.notify(`Renamed node \u2192 ${t}`)})}i(F,"renameNode");function c(t){return new Promise(e=>{p("tmux",t,{timeout:5e3},(n,o)=>e(n?"":o))})}i(c,"tmuxCall");async function D(t,e,n){if(n){await c(["set-option","-p","-u","-t",t,"@crtr_color"]);return}await c(["set-option","-p","-t",t,"@crtr_color",e]);for(const o of["pane-border-style","pane-active-border-style"]){const r=(await c(["show-options","-wqv","-t",t,o])).trim();if(r.includes("@crtr_color"))continue;let u=r!==""?r:(await c(["show-options","-gqv",o])).trim();u===""&&(u=o==="pane-active-border-style"?"fg=green":"default");const s=`#{?#{!=:#{@crtr_color},},fg=#{@crtr_color},${u.replace(/,/g,"#,")}}`;await c(["set-option","-w","-t",t,o,s])}}i(D,"paintPaneBorder");function R(t,e){const n=t.trim().toLowerCase();if(n==="")return e.notify("Usage: /color <color> \u2014 a name (red, blue, orange\u2026), colourN, or #rrggbb; /color none to clear"),!0;const o=n==="none"||n==="clear";if(!(o||U.has(n)||/^colour\d{1,3}$/.test(n)||/^#[0-9a-f]{6}$/.test(n)))return e.notify(`Invalid color "${n}" \u2014 use a tmux colour name (${["red","green","yellow","blue","magenta","cyan","orange"].join(", ")}, \u2026), colourN, or #rrggbb`),!0;const u=process.env.TMUX_PANE,s=process.env.TMUX!==void 0&&u!==void 0&&u!=="";return s&&D(u,n,o),e.onColor?.(o?null:n),e.notify(o?"Node color cleared":`Node colored ${n}${s?"":" (chip only \u2014 no tmux pane)"}`),!0}i(R,"colorNode");function G(t){const e=process.env.TMUX_PANE;if(process.env.TMUX===void 0||e===void 0||e==="")return t.notify("/resume needs tmux"),!0;const n=y(t.cwd??process.cwd()),o=H(t),r=o===void 0||o===""?"":` --profile-id ${y(o)}`,u=`crtr canvas browse --return-pane ${e} --cwd ${n}${r}`;return k(u,{w:"97%",h:"95%"}),!0}i(G,"resumeNode");function V(t){if(process.env.TMUX===void 0)return t.notify("/context needs tmux"),!0;const e=b(t).trim();return e===""?(t.notify("/context: no node to root on (viewer has no node id)"),!0):(k(`crtr node inspect context --node ${y(e)}`),!0)}i(V,"openContext");function q(t){return process.env.TMUX===void 0?(t.notify("/plugins needs tmux"),!0):(k("crtr pkg browse"),!0)}i(q,"openPlugins");function k(t,e={w:"90%",h:"85%"}){try{p("tmux",["display-popup","-E","-w",e.w,"-h",e.h,...O(),t],()=>{})}catch{}}i(k,"popup");function m(t,e){return t.notify(`Usage: ${e}`),!0}i(m,"usage");function J(t,e,n){return t.notify(`Interactive ${e} picker isn't available over view.sock yet \u2014 use ${n}`),!0}i(J,"pickerHint");function f(t,e,n,o){return t?(t(),!0):J(e,n,o)}i(f,"openOrHint");function Q(t,e){const[n,...o]=t.split(/\s+/),r=o.join(" ").trim();switch(n){case"thinking":return r?N.has(r)?(e.send({type:"set_thinking_level",level:r}),!0):(e.notify(`Invalid thinking level "${r}" \u2014 choose one of: ${[...N].join(", ")}`),!0):m(e,"/settings thinking <level>");case"auto-retry":return e.send({type:"set_auto_retry",enabled:A(r)}),!0;case"auto-compaction":return e.send({type:"set_auto_compaction",enabled:A(r)}),!0;case"":return e.openSettingsPicker?(e.openSettingsPicker(),!0):I(e);default:return I(e)}}i(Q,"handleSettings");function I(t){return t.notify("Settings: /settings thinking <level> | auto-retry on|off | auto-compaction on|off"),!0}i(I,"settingsSummary");function A(t){return/^(on|true|yes|1|enabled?)$/i.test(t.trim())}i(A,"parseBool");function W(t,e){const n=t||`${e}/pi-export-${Date.now()}.html`,o=n.endsWith(".jsonl")?"jsonl":"html";return{path:n,format:o}}i(W,"parseExport");function Y(t){return t?`Session ${t.sessionName?`"${t.sessionName}" `:""}${t.sessionId} \xB7 model ${t.model?.id??"unknown"} \xB7 thinking ${t.thinkingLevel}`:"Session info unavailable"}i(Y,"describeSession");export{g as CANVAS_SLASH_COMMANDS,se as commandAutocompleteItems,re as dispatchSlashCommand,oe as isSlashCommand,te as locallyConsumedCommandNames,ie as slashCommandList};
|
|
1
|
+
var E=Object.defineProperty;var i=(o,e)=>E(o,"name",{value:e,configurable:!0});import{execFile as p}from"node:child_process";import{BUILTIN_SLASH_COMMANDS as h}from"../../../core/runtime/pi-vendored.js";import{surfaceTmuxStyleArgs as O}from"../../../core/runtime/surface-bg.js";import{viewerOperationForSlash as _}from"../input/capabilities.js";import{shellQuote as y}from"../../../shared/shell-quote.js";const g=[{name:"tutorial",description:"The guided crouter tutorial \u2014 your agent teaches it, one lesson at a time"},{name:"clear",description:"Clear the conversation and free context \u2014 a fresh, empty session (like /new)"},{name:"graph",description:"Toggle the canvas GRAPH view (your local subscription tree)"},{name:"inbox",description:"Toggle the human inbox \u2014 pending asks and reviews for you"},{name:"promote",description:"Promote this node to an orchestrator \u2014 /promote, or /promote <kind> to specialize"},{name:"resume",description:"Open the canvas navigator and swap THIS pane onto the chosen node; parked residents wake only on submitted input"},{name:"resume-session",description:"Switch this node onto one of its saved pi sessions \u2014 picker, or /resume-session <session-path>"},{name:"context",description:"Browse this node + its subscriptions\u2019 context dirs in a read-only nvim popup"},{name:"plugins",description:"Open the interactive plugin browser for this machine"},{name:"node-metadata",description:"Inspect this node \u2014 identity, lifecycle, runtime, graph, artifacts, paths, and agent surfaces"},{name:"mcp",description:"MCP servers \u2014 status from the adapter\u2019s config/cache; Enter (or /mcp <server>) connects, reconnects, or re-auths"},{name:"rename",description:"Rename this node everywhere \u2014 node row, viewer window, session chip, tmux pane: /rename <name>"},{name:"color",description:"Color this node \u2014 tmux pane outline + name chip: /color <color> (red, blue, #rrggbb, \u2026) or /color none"},{name:"mouse",description:"Toggle mouse wheel scrolling and drag-select \u2014 off restores tmux drag-select and copy-mode mouse"},{name:"copy-message",description:"Copy the newest message visible in the transcript viewport"},{name:"copy-tool",description:"Copy the newest tool call output"},{name:"copy-transcript",description:"Copy every copyable transcript block"},{name:"fold-tools",description:"View setting \u2014 fold every FINISHED tool call to its single call line (Alt+C \u2192 z \u2192 f)"}],$=new Map([["resume-node","resume"]]),w=new Set([...g.map(o=>o.name),...$.keys()]),U=new Set(["black","red","green","yellow","blue","magenta","cyan","white","brightred","brightgreen","brightyellow","brightblue","brightmagenta","brightcyan","orange","grey","gray","default"]),T=new Set(["trust"]),N=new Set(Object.keys({off:!0,minimal:!0,low:!0,medium:!0,high:!0,xhigh:!0,max:!0})),v=new Set(h.map(o=>o.name));function b(o){return o.capabilities.nodeId}i(b,"nodeIdFor");function H(o){return o.capabilities.profileId}i(H,"profileIdFor");function M(o,e){const n=_(o,v.has(o),w.has(o));return n===void 0?void 0:e.capabilities.refusal(n,o)}i(M,"readOnlyRefusal");function oe(){return new Set([...v,...w,...T])}i(oe,"locallyConsumedCommandNames");function j(o){const e=/^\/(\S+)\s*([\s\S]*)$/.exec(o.trim());return e===null?void 0:{name:e[1],arg:e[2].trim()}}i(j,"parseSlashCommand");function te(o){return o.trimStart().startsWith("/")}i(te,"isSlashCommand");function re(o,e){const n=j(o);if(n===void 0)return!1;const{arg:t}=n,r=$.get(n.name)??n.name;if(T.has(r))return e.notify(`/${r} is not supported in attach (Phase 4)`),!0;if(w.has(r)){const s=M(r,e);return s!==void 0?(e.notify(s),!0):X(r,t,e)}if(!v.has(r))return!1;const u=M(r,e);if(u!==void 0)return e.notify(u),!0;switch(r){case"new":return e.send({type:"new_session"}),!0;case"reload":return e.send({type:"reload"}),!0;case"compact":return e.send({type:"compact",instructions:t||void 0}),!0;case"quit":return e.onQuit?(e.onQuit(),!0):(e.send({type:"bye"}),e.notify("Detaching \u2014 the engine keeps running"),!0);case"name":return t?(e.send({type:"set_session_name",name:t}),!0):f(e,"/name <display name>");case"export":{const{path:s,format:a}=W(t,e.cwd??process.cwd());return e.send({type:"export",path:s,format:a}),e.notify(`Exporting session \u2192 ${s}`),!0}case"import":return t?(e.send({type:"switch_session",path:t}),!0):f(e,"/import <path-to-session.jsonl>");case"model":return t?(e.send({type:"set_model",model:t}),!0):m(e.openModelPicker,e,"model","/model <provider/id>");case"fork":return t?(e.send({type:"fork",entryId:t}),!0):m(e.openForkPicker,e,"fork point","/fork <entryId>");case"tree":return t?(e.send({type:"navigate_tree",targetId:t}),!0):m(e.openTreePicker,e,"tree","/tree <entryId>");case"scoped-models":return e.openScopedModelsPicker?(e.openScopedModelsPicker(),!0):(e.notify("The scoped-models view needs the read-op channel, which this viewer has not wired"),!0);case"settings":return Q(t,e);case"session":return e.notify(Y(e.state)),!0;case"copy":return e.onCopy?(e.onCopy(),!0):(e.notify("/copy is not available in this viewer"),!0);case"login":return e.openLoginPicker?(e.openLoginPicker(),!0):(e.notify("/login is not available in this viewer"),!0);case"logout":return e.openLogoutPicker?(e.openLogoutPicker(),!0):(e.notify("/logout is not available in this viewer"),!0);case"share":return e.send({type:"share"}),e.notify("Sharing session\u2026"),!0;case"clone":return e.send({type:"clone"}),e.notify("Cloning session\u2026"),!0;case"changelog":return e.notify("/changelog: see https://github.com/earendil-works/pi for release notes (no bundled changelog in this build)"),!0;case"hotkeys":return e.onHelp?(e.onHelp(),!0):(e.notify("/hotkeys is not available in this viewer"),!0);default:return e.notify(`/${r} is not available in attach (Phase 4)`),!0}}i(re,"dispatchSlashCommand");function P(o,e){const n=i(a=>{const l=_(a,!1,!0);return l===void 0||e.permits(l)},"permitted"),t=g.filter(a=>n(a.name)),r=new Map(g.map(a=>[a.name,a])),u=o.flatMap(a=>{const l=r.get(a.name);return l===void 0?[a]:n(a.name)?[l]:[]}),s=new Set(o.map(a=>a.name));return[...u,...t.filter(a=>!s.has(a.name))]}i(P,"withCanvasCommands");function ie(o,e){return P(o??h,e).map(n=>({name:n.name,description:n.description}))}i(ie,"slashCommandList");function se(o,e){return P(o??h,e).map(n=>({value:`/${n.name}`,label:`/${n.name}`,description:n.description}))}i(se,"commandAutocompleteItems");function X(o,e,n){switch(o){case"clear":return n.send({type:"new_session"}),!0;case"graph":return n.onGraph?n.onGraph():n.notify("The GRAPH overlay is not wired into the viewer yet"),!0;case"inbox":return n.onInbox?n.onInbox():n.notify("The inbox surface is not wired into the viewer yet"),!0;case"tutorial":return n.send({type:"prompt",text:"The user asked for the crouter tutorial. Run `crtr sys tutorial -h`, pick the track that matches what they want to learn, and teach it one lesson per invocation \u2014 in your own words, letting them try each thing before you move on."}),!0;case"promote":return B(e,n),!0;case"resume":return e?f(n,"/resume \u2014 no argument; use /resume-session <path> to switch pi sessions"):G(n);case"resume-session":return e?(n.send({type:"switch_session",path:e}),!0):m(n.openSessionPicker,n,"session","/resume-session <session-path>");case"mcp":return n.openMcpPicker?n.openMcpPicker(e||void 0):n.notify("The MCP panel is not wired into this viewer"),!0;case"context":return V(n);case"plugins":return q(n);case"node-metadata":return n.onNodeMetadata?n.onNodeMetadata():n.notify("Node metadata is not wired into this viewer"),!0;case"rename":return F(e,n),!0;case"color":return D(e,n);case"fold-tools":return n.onFoldTools?n.onFoldTools():n.notify("The fold-tools view setting is not wired into this viewer"),!0;case"mouse":return n.onToggleMouse?n.onToggleMouse():n.notify("Mouse reporting is not wired into this viewer"),!0;case"copy-message":return n.onCopyTarget?n.onCopyTarget("message"):n.notify("/copy-message is not available in this viewer"),!0;case"copy-tool":return n.onCopyTarget?n.onCopyTarget("tool"):n.notify("/copy-tool is not available in this viewer"),!0;case"copy-transcript":return n.onCopyTarget?n.onCopyTarget("transcript"):n.notify("/copy-transcript is not available in this viewer"),!0;default:return n.notify(`/${o} is not available in attach`),!0}}i(X,"dispatchCanvasCommand");function B(o,e){const n=b(e).trim();if(n===""){e.notify("/promote: no node to promote (viewer has no node id)");return}const t=o.trim().toLowerCase();e.notify(t?`Promoting \u2192 ${t}\u2026`:"Promoting\u2026");const r=["node","promote","--node",n,"--json"];t!==""&&r.push("--kind",t),p("crtr",r,{timeout:15e3,maxBuffer:4*1024*1024},(s,a)=>{let l=null,d=null;try{l=JSON.parse(a)}catch{l=null}if(s&&l===null){const L=typeof s.stdout=="string"?s.stdout:"";try{const C=JSON.parse(L);d=typeof C.message=="string"?C.message:null}catch{d=null}d===null&&(d=s.message)}if(l===null){e.notify(`promote failed: ${d??"unknown error"}`);return}const S=(l.roadmap_ref??"").trim();e.notify(`Promoted to ${l.kind??"orchestrator"} orchestrator \u2014 authoring roadmap${S!==""?` (${S})`:""}.`),e.send({type:"prompt",text:"You have just been promoted to an orchestrator. Your new-role guidance is arriving \u2014 read it, author your roadmap, and start delegating."})}).stdin?.end()}i(B,"promoteNode");function F(o,e){const n=b(e).trim();if(n===""){e.notify("/rename: no node to rename (viewer has no node id)");return}if(o===""){e.notify("Usage: /rename <name>");return}e.send({type:"set_session_name",name:o});const t=process.env.TMUX_PANE;process.env.TMUX!==void 0&&t!==void 0&&t!==""&&p("tmux",["select-pane","-t",t,"-T",o],()=>{}),p("crtr",["node","config","--node",n,"--name",o,"--json"],{timeout:15e3,maxBuffer:4*1024*1024},(r,u)=>{if(r){let s=null;try{const a=JSON.parse(u);s=typeof a.message=="string"?a.message:null}catch{s=null}e.notify(`rename failed: ${s??r.message}`);return}e.notify(`Renamed node \u2192 ${o}`)})}i(F,"renameNode");function c(o){return new Promise(e=>{p("tmux",o,{timeout:5e3},(n,t)=>e(n?"":t))})}i(c,"tmuxCall");async function R(o,e,n){if(n){await c(["set-option","-p","-u","-t",o,"@crtr_color"]);return}await c(["set-option","-p","-t",o,"@crtr_color",e]);for(const t of["pane-border-style","pane-active-border-style"]){const r=(await c(["show-options","-wqv","-t",o,t])).trim();if(r.includes("@crtr_color"))continue;let u=r!==""?r:(await c(["show-options","-gqv",t])).trim();u===""&&(u=t==="pane-active-border-style"?"fg=green":"default");const s=`#{?#{!=:#{@crtr_color},},fg=#{@crtr_color},${u.replace(/,/g,"#,")}}`;await c(["set-option","-w","-t",o,t,s])}}i(R,"paintPaneBorder");function D(o,e){const n=o.trim().toLowerCase();if(n==="")return e.notify("Usage: /color <color> \u2014 a name (red, blue, orange\u2026), colourN, or #rrggbb; /color none to clear"),!0;const t=n==="none"||n==="clear";if(!(t||U.has(n)||/^colour\d{1,3}$/.test(n)||/^#[0-9a-f]{6}$/.test(n)))return e.notify(`Invalid color "${n}" \u2014 use a tmux colour name (${["red","green","yellow","blue","magenta","cyan","orange"].join(", ")}, \u2026), colourN, or #rrggbb`),!0;const u=process.env.TMUX_PANE,s=process.env.TMUX!==void 0&&u!==void 0&&u!=="";return s&&R(u,n,t),e.onColor?.(t?null:n),e.notify(t?"Node color cleared":`Node colored ${n}${s?"":" (chip only \u2014 no tmux pane)"}`),!0}i(D,"colorNode");function G(o){const e=process.env.TMUX_PANE;if(process.env.TMUX===void 0||e===void 0||e==="")return o.notify("/resume needs tmux"),!0;const n=y(o.cwd??process.cwd()),t=H(o),r=t===void 0||t===""?"":` --profile-id ${y(t)}`,u=`crtr canvas browse --return-pane ${e} --cwd ${n}${r}`;return k(u,{w:"97%",h:"95%"}),!0}i(G,"resumeNode");function V(o){if(process.env.TMUX===void 0)return o.notify("/context needs tmux"),!0;const e=b(o).trim();return e===""?(o.notify("/context: no node to root on (viewer has no node id)"),!0):(k(`crtr node inspect context --node ${y(e)}`),!0)}i(V,"openContext");function q(o){return process.env.TMUX===void 0?(o.notify("/plugins needs tmux"),!0):(k("crtr pkg browse"),!0)}i(q,"openPlugins");function k(o,e={w:"90%",h:"85%"}){try{p("tmux",["display-popup","-E","-w",e.w,"-h",e.h,...O(),o],()=>{})}catch{}}i(k,"popup");function f(o,e){return o.notify(`Usage: ${e}`),!0}i(f,"usage");function J(o,e,n){return o.notify(`Interactive ${e} picker isn't available over view.sock yet \u2014 use ${n}`),!0}i(J,"pickerHint");function m(o,e,n,t){return o?(o(),!0):J(e,n,t)}i(m,"openOrHint");function Q(o,e){const[n,...t]=o.split(/\s+/),r=t.join(" ").trim();switch(n){case"thinking":return r?N.has(r)?(e.send({type:"set_thinking_level",level:r}),!0):(e.notify(`Invalid thinking level "${r}" \u2014 choose one of: ${[...N].join(", ")}`),!0):f(e,"/settings thinking <level>");case"auto-retry":return e.send({type:"set_auto_retry",enabled:A(r)}),!0;case"auto-compaction":return e.send({type:"set_auto_compaction",enabled:A(r)}),!0;case"":return e.openSettingsPicker?(e.openSettingsPicker(),!0):I(e);default:return I(e)}}i(Q,"handleSettings");function I(o){return o.notify("Settings: /settings thinking <level> | auto-retry on|off | auto-compaction on|off"),!0}i(I,"settingsSummary");function A(o){return/^(on|true|yes|1|enabled?)$/i.test(o.trim())}i(A,"parseBool");function W(o,e){const n=o||`${e}/pi-export-${Date.now()}.html`,t=n.endsWith(".jsonl")?"jsonl":"html";return{path:n,format:t}}i(W,"parseExport");function Y(o){return o?`Session ${o.sessionName?`"${o.sessionName}" `:""}${o.sessionId} \xB7 model ${o.model?.id??"unknown"} \xB7 thinking ${o.thinkingLevel}`:"Session info unavailable"}i(Y,"describeSession");export{g as CANVAS_SLASH_COMMANDS,se as commandAutocompleteItems,re as dispatchSlashCommand,te as isSlashCommand,oe as locallyConsumedCommandNames,ie as slashCommandList};
|