@north-light/crouter 0.3.197 → 0.3.199
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 +19 -19
- package/dist/api/client.js +29 -37
- package/dist/api/dto/broker-ops.d.ts +3 -1
- package/dist/api/dto/broker.d.ts +13 -2
- package/dist/api/dto/broker.js +4 -4
- package/dist/api/dto/human.d.ts +6 -5
- package/dist/api/dto/inbox.d.ts +126 -33
- package/dist/api/dto/nodes.d.ts +8 -2
- package/dist/api/dto/profiles.d.ts +23 -0
- package/dist/api/dto/profiles.js +2 -2
- package/dist/api/dto/worktree.d.ts +3 -5
- package/dist/api/routes.d.ts +3 -5
- package/dist/api/routes.js +4 -6
- package/dist/builtin-memory/00-runtime-base.md +8 -8
- package/dist/builtin-memory/01-spine/01-no-manager.md +1 -1
- package/dist/builtin-memory/02-lifecycle/00-terminal.md +3 -3
- package/dist/builtin-memory/04-orchestration-kernel.md +6 -6
- package/dist/builtin-memory/05-kinds/design/00-base.md +1 -1
- package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +2 -2
- package/dist/builtin-memory/05-kinds/review/00-base.md +2 -2
- package/dist/builtin-memory/05-kinds/review/01-orchestrator.md +1 -1
- package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +1 -1
- package/dist/builtin-memory/insights/capture.md +2 -2
- package/dist/builtin-memory/insights/init.md +3 -3
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/memory-loading.md +1 -1
- package/dist/builtin-memory/internal/nodes-and-canvas.md +3 -3
- package/dist/builtin-memory/internal/plugins.md +59 -2
- package/dist/builtin-memory/internal/storage-tiers.md +3 -1
- package/dist/builtin-memory/spec/roadmap.md +2 -2
- package/dist/builtin-memory/testing.md +1 -1
- package/dist/builtin-memory/wedged-child-on-runaway-bash.md +1 -1
- package/dist/clients/attach/chrome/bash-jobs.js +3 -3
- package/dist/clients/attach/render/chat-view.d.ts +29 -9
- package/dist/clients/attach/render/chat-view.js +64 -35
- package/dist/clients/attach/render/markdown-source.js +0 -6
- package/dist/clients/attach/render/page-block.d.ts +34 -0
- package/dist/clients/attach/render/page-block.js +226 -0
- package/dist/clients/attach/render/tool-calls.js +16 -2
- package/dist/clients/attach/session/whip.d.ts +2 -0
- package/dist/clients/attach/session/whip.js +2 -0
- package/dist/clients/attach/viewer.js +1419 -982
- package/dist/clients/conversation/projection.js +18 -3
- package/dist/clients/inbox/__tests__/serial/inbox-controller.test.js +9 -6
- package/dist/clients/inbox/__tests__/serial/mount-panel.test.js +13 -14
- package/dist/clients/inbox/controller.js +10 -16
- package/dist/clients/inbox/page-adapter.d.ts +3 -4
- package/dist/clients/inbox/page-adapter.js +3 -4
- package/dist/clients/inbox/resolve.d.ts +1 -1
- package/dist/clients/inbox/resolve.js +3 -3
- package/dist/clients/inbox/review/document-surface.js +3 -1
- package/dist/clients/inbox/review/state.d.ts +2 -1
- package/dist/clients/inbox/review/state.js +5 -16
- package/dist/clients/inbox/tui/input.js +37 -19
- package/dist/clients/inbox/tui/panel.js +5 -31
- package/dist/clients/inbox/tui/render.d.ts +11 -0
- package/dist/clients/inbox/tui/render.js +101 -36
- package/dist/clients/inbox/tui/slots.d.ts +4 -4
- package/dist/clients/inbox/tui/slots.js +19 -44
- package/dist/clients/inbox/tui/types.d.ts +6 -10
- package/dist/clients/inbox/tui.js +2 -2
- package/dist/commands/__tests__/human.test.js +118 -24
- package/dist/commands/__tests__/node-message.test.js +14 -0
- package/dist/commands/attention.js +4 -4
- package/dist/commands/canvas-browse.js +1 -1
- package/dist/commands/canvas-snapshot.js +1 -1
- package/dist/commands/canvas.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/human/{doc.d.ts → components.d.ts} +1 -1
- package/dist/commands/human/components.js +77 -0
- package/dist/commands/human/feedback.d.ts +2 -0
- package/dist/commands/human/feedback.js +108 -0
- package/dist/commands/human/prompts.d.ts +17 -8
- package/dist/commands/human/prompts.js +217 -226
- package/dist/commands/human/queue.js +57 -88
- package/dist/commands/human/shared.d.ts +4 -15
- package/dist/commands/human/shared.js +19 -61
- package/dist/commands/human.js +32 -19
- package/dist/commands/memory/origin.js +2 -2
- package/dist/commands/node/bash.js +4 -4
- package/dist/commands/node/inspect.js +3 -3
- package/dist/commands/node/lifecycle.js +1 -1
- package/dist/commands/node/message.js +2 -2
- package/dist/commands/node-worktree.js +8 -8
- package/dist/commands/pkg/browse.js +1 -1
- package/dist/commands/pkg/plugin-manage.js +129 -10
- package/dist/commands/profile/delete.js +41 -15
- package/dist/commands/profile.js +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/surface/node/focus.js +29 -14
- package/dist/commands/surface-edit.js +3 -3
- package/dist/commands/surface-inbox.d.ts +2 -0
- package/dist/commands/{human/inbox.js → surface-inbox.js} +14 -18
- package/dist/commands/surface.js +2 -1
- package/dist/commands/sys/doctor.js +60 -3
- package/dist/commands/sys/feedback.js +79 -25
- package/dist/commands/sys/settings.js +1 -1
- package/dist/core/__tests__/cron-broker-capacity.test.js +1 -1
- package/dist/core/__tests__/daemon-boot.test.js +7 -4
- package/dist/core/__tests__/dead-node-policy-table.test.js +20 -36
- package/dist/core/__tests__/extension-abort.test.js +5 -2
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +13 -2
- package/dist/core/__tests__/fixtures/fake-engine.js +47 -3
- package/dist/core/__tests__/human-cancel-guard.test.js +31 -10
- package/dist/core/__tests__/human-deliver.test.js +41 -45
- package/dist/core/__tests__/human-node-not-supervised.test.js +1 -1
- package/dist/core/__tests__/plugin-page-components.test.js +157 -0
- package/dist/core/__tests__/seam/broker-crash-teardown.test.js +13 -11
- package/dist/core/__tests__/seam/dormancy-release.test.js +103 -4
- package/dist/core/__tests__/serial/flagship-lifecycle.test.js +2 -2
- package/dist/core/__tests__/serial/human-deliver-e2e.test.js +12 -16
- package/dist/core/__tests__/serial/live-mutation.test.js +1 -1
- package/dist/core/__tests__/serial/tmux-surface.test.js +4 -2
- package/dist/core/__tests__/serial/worktree.test.js +24 -198
- package/dist/core/__tests__/session-cycles.test.js +22 -0
- package/dist/core/__tests__/stop-guard.test.js +4 -4
- package/dist/core/__tests__/watchdog-abort-arms-retry.test.js +19 -4
- package/dist/core/bash-jobs.d.ts +6 -0
- package/dist/core/bash-jobs.js +10 -0
- package/dist/core/canvas/__tests__/attention.test.js +8 -5
- package/dist/core/canvas/__tests__/render-remote.test.js +5 -5
- package/dist/core/canvas/attention.js +8 -6
- package/dist/core/canvas/browse/app.d.ts +1 -1
- package/dist/core/canvas/browse/app.js +21 -3
- package/dist/core/canvas/browse/model.d.ts +8 -2
- package/dist/core/canvas/browse/model.js +11 -4
- package/dist/core/canvas/browse/render.d.ts +4 -0
- package/dist/core/canvas/browse/render.js +5 -1
- package/dist/core/canvas/canvas.d.ts +33 -0
- package/dist/core/canvas/canvas.js +92 -0
- package/dist/core/canvas/crons.d.ts +9 -0
- package/dist/core/canvas/crons.js +51 -0
- package/dist/core/canvas/node-order.d.ts +22 -1
- package/dist/core/canvas/node-order.js +26 -1
- package/dist/core/canvas/render-source.d.ts +5 -0
- package/dist/core/canvas/render-source.js +1 -0
- package/dist/core/canvas/types.d.ts +9 -3
- package/dist/core/command-plugins/bundle.d.ts +6 -1
- package/dist/core/command-plugins/bundle.js +26 -13
- package/dist/core/command.js +8 -12
- package/dist/core/config.d.ts +47 -1
- package/dist/core/config.js +138 -4
- package/dist/core/help.d.ts +3 -0
- package/dist/core/help.js +1 -1
- package/dist/core/human/__tests__/page-catalog.test.d.ts +1 -0
- package/dist/core/human/__tests__/page-catalog.test.js +20 -0
- package/dist/core/human/__tests__/page-tickets.test.js +68 -34
- package/dist/core/human/__tests__/page.test.js +60 -119
- package/dist/core/human/__tests__/serial/inbox-core.test.js +6 -16
- package/dist/core/human/answer-text.d.ts +3 -0
- package/dist/core/human/answer-text.js +98 -0
- package/dist/core/human/answer.d.ts +53 -0
- package/dist/core/human/answer.js +119 -0
- package/dist/core/human/component-docs.d.ts +18 -0
- package/dist/core/human/component-docs.js +434 -0
- package/dist/core/human/convention.d.ts +17 -3
- package/dist/core/human/convention.js +36 -5
- package/dist/core/human/feedback-companion.d.ts +20 -0
- package/dist/core/human/feedback-companion.js +98 -0
- package/dist/core/human/feedback.d.ts +65 -0
- package/dist/core/human/feedback.js +116 -0
- package/dist/core/human/page-catalog.d.ts +56 -5
- package/dist/core/human/page-catalog.js +151 -22
- package/dist/core/human/page-errors.d.ts +4 -0
- package/dist/core/human/page-errors.js +7 -0
- package/dist/core/human/page-eval.d.ts +20 -0
- package/dist/core/human/page-eval.js +123 -0
- package/dist/core/human/page-schema.d.ts +48 -116
- package/dist/core/human/page-schema.js +100 -72
- package/dist/core/human/page-synth.d.ts +2 -4
- package/dist/core/human/page-synth.js +20 -7
- package/dist/core/human/page.d.ts +13 -21
- package/dist/core/human/page.js +147 -391
- package/dist/core/human/review-schema.d.ts +1 -0
- package/dist/core/human/review-schema.js +1 -1
- package/dist/core/human/root.d.ts +6 -2
- package/dist/core/human/root.js +12 -4
- package/dist/core/human/scan.d.ts +3 -3
- package/dist/core/human/scan.js +21 -21
- package/dist/core/human/summary.d.ts +2 -6
- package/dist/core/human/summary.js +3 -59
- package/dist/core/human/tickets.d.ts +22 -15
- package/dist/core/human/tickets.js +90 -28
- package/dist/core/human/types.d.ts +14 -2
- package/dist/core/keybindings/catalog.d.ts +2 -2
- package/dist/core/keybindings/catalog.js +1 -0
- package/dist/core/preview-registry.js +8 -10
- package/dist/core/profiles/default-binding.d.ts +4 -0
- package/dist/core/profiles/default-binding.js +24 -0
- package/dist/core/profiles/deletion-reservation.d.ts +8 -0
- package/dist/core/profiles/deletion-reservation.js +38 -0
- package/dist/core/profiles/manifest.d.ts +3 -0
- package/dist/core/profiles/manifest.js +12 -0
- package/dist/core/profiles/select.js +2 -2
- package/dist/core/review/realize.js +12 -4
- package/dist/core/review/store.d.ts +6 -0
- package/dist/core/review/store.js +31 -0
- package/dist/core/runtime/bearings.d.ts +0 -4
- package/dist/core/runtime/bearings.js +4 -62
- package/dist/core/runtime/bin-contributions.d.ts +44 -0
- package/dist/core/runtime/bin-contributions.js +186 -0
- package/dist/core/runtime/boot-root.js +6 -1
- package/dist/core/runtime/broker/client-registry.d.ts +4 -0
- package/dist/core/runtime/broker/client-registry.js +13 -1
- package/dist/core/runtime/broker/extension-abort.d.ts +1 -1
- package/dist/core/runtime/broker/extension-abort.js +4 -2
- package/dist/core/runtime/broker/fault-retry.js +4 -0
- package/dist/core/runtime/broker/frame-dispatch.d.ts +3 -1
- package/dist/core/runtime/broker/frame-dispatch.js +5 -6
- package/dist/core/runtime/broker/read-ops.d.ts +1 -1
- package/dist/core/runtime/broker/read-ops.js +2 -2
- package/dist/core/runtime/broker/rebind.d.ts +1 -0
- package/dist/core/runtime/broker/rebind.js +6 -1
- package/dist/core/runtime/broker-extension-render.js +19 -0
- package/dist/core/runtime/broker-protocol.d.ts +14 -0
- package/dist/core/runtime/broker.d.ts +1 -1
- package/dist/core/runtime/broker.js +25 -12
- package/dist/core/runtime/busy.d.ts +4 -3
- package/dist/core/runtime/busy.js +4 -3
- package/dist/core/runtime/front-door-env.d.ts +5 -0
- package/dist/core/runtime/front-door-env.js +16 -0
- package/dist/core/runtime/front-door.d.ts +1 -5
- package/dist/core/runtime/front-door.js +2 -5
- package/dist/core/runtime/host.d.ts +1 -1
- package/dist/core/runtime/invocation.d.ts +6 -0
- package/dist/core/runtime/invocation.js +10 -0
- package/dist/core/runtime/kickoff.js +34 -0
- package/dist/core/runtime/launch.d.ts +2 -6
- package/dist/core/runtime/node-read.js +4 -1
- package/dist/core/runtime/nodes.js +2 -0
- package/dist/core/runtime/promote.d.ts +1 -0
- package/dist/core/runtime/promote.js +3 -1
- package/dist/core/runtime/session-cycles.d.ts +6 -0
- package/dist/core/runtime/session-cycles.js +15 -1
- package/dist/core/runtime/session-visibility.d.ts +17 -8
- package/dist/core/runtime/session-visibility.js +19 -10
- package/dist/core/runtime/spawn-env.d.ts +9 -1
- package/dist/core/runtime/spawn-env.js +62 -2
- package/dist/core/runtime/spawn.js +4 -4
- package/dist/core/runtime/stop-guard.d.ts +2 -2
- package/dist/core/runtime/stop-guard.js +2 -2
- package/dist/core/runtime/stop-signals.d.ts +1 -1
- package/dist/core/runtime/stop-signals.js +2 -2
- package/dist/core/runtime/tmux-bindings.js +1 -1
- package/dist/core/session-model/session-state.d.ts +4 -3
- package/dist/core/session-model/session-state.js +14 -1
- package/dist/core/user-settings.d.ts +36 -2
- package/dist/core/user-settings.js +56 -14
- package/dist/core/worktree.d.ts +15 -45
- package/dist/core/worktree.js +59 -261
- package/dist/daemon/api/__tests__/seam/profile-delete.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/seam/profile-delete.test.js +386 -0
- package/dist/daemon/api/handlers/bash-jobs.js +1 -1
- package/dist/daemon/api/handlers/broker-ops.js +9 -5
- package/dist/daemon/api/handlers/feedback-comments.d.ts +2 -0
- package/dist/daemon/api/handlers/feedback-comments.js +207 -0
- package/dist/daemon/api/handlers/human.js +24 -20
- package/dist/daemon/api/handlers/inbox.d.ts +10 -0
- package/dist/daemon/api/handlers/inbox.js +48 -109
- package/dist/daemon/api/handlers/profiles.js +11 -29
- package/dist/daemon/api/map.d.ts +6 -1
- package/dist/daemon/api/map.js +23 -0
- package/dist/daemon/api/server.js +3 -1
- package/dist/daemon/companion-retire.d.ts +2 -0
- package/dist/daemon/companion-retire.js +33 -0
- package/dist/daemon/cron-run.js +29 -17
- package/dist/daemon/crtrd.js +1 -1
- package/dist/daemon/fleet.d.ts +22 -10
- package/dist/daemon/fleet.js +43 -24
- package/dist/daemon/human/finish.d.ts +12 -6
- package/dist/daemon/human/finish.js +134 -54
- package/dist/daemon/human/sweep.js +9 -3
- package/dist/daemon/profile-delete.d.ts +7 -0
- package/dist/daemon/profile-delete.js +306 -0
- package/dist/daemon/reconcilers/broker-supervision.js +14 -9
- package/dist/daemon/reconcilers/dormant-inbox.js +11 -6
- package/dist/daemon/reconcilers/live-obligation.d.ts +21 -1
- package/dist/daemon/reconcilers/live-obligation.js +30 -2
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +5 -0
- package/dist/daemon/reconcilers/storage-maintenance.js +28 -1
- package/dist/daemon/review/deliver.js +3 -3
- package/dist/daemon/review/finish.d.ts +0 -2
- package/dist/daemon/review/finish.js +1 -29
- package/dist/daemon/review/sweep.js +12 -1
- package/dist/pi-extensions/__tests__/canvas-bash-valve.test.js +56 -1
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +4 -4
- package/dist/pi-extensions/canvas-bash-valve.d.ts +9 -1
- package/dist/pi-extensions/canvas-bash-valve.js +31 -13
- package/dist/pi-extensions/canvas-inbox-watcher.js +1 -1
- package/dist/pi-extensions/canvas-review-boundary.d.ts +4 -0
- package/dist/pi-extensions/canvas-review-boundary.js +18 -9
- package/dist/pi-extensions/canvas-stophook.js +4 -4
- package/dist/shared/generated-context.js +2 -2
- package/dist/types.d.ts +61 -5
- package/dist/types.js +8 -2
- package/package.json +4 -4
- package/runtime.lock.json +5 -33
- package/scripts/install-runtime.mjs +19 -24
- package/dist/builtin-memory/init.md +0 -38
- package/dist/builtin-memory/plan.md +0 -19
- package/dist/builtin-memory/spec.md +0 -19
- package/dist/clients/attach/render/html-markdown.d.ts +0 -13
- package/dist/clients/attach/render/html-markdown.js +0 -206
- package/dist/commands/human/doc.js +0 -144
- package/dist/commands/human/inbox.d.ts +0 -2
- package/dist/core/human/__tests__/page-render.test.js +0 -49
- package/dist/core/human/markdown-html.d.ts +0 -8
- package/dist/core/human/markdown-html.js +0 -581
- package/dist/core/human/page-render.d.ts +0 -3
- package/dist/core/human/page-render.js +0 -131
- package/dist/pages/bundle.css +0 -1
- package/dist/pages/bundle.js +0 -1347
- package/dist/pages/comments.d.ts +0 -43
- package/dist/pages/comments.js +0 -125
- package/dist/pages/elements/cards.d.ts +0 -17
- package/dist/pages/elements/cards.js +0 -802
- package/dist/pages/elements/chart.js +0 -648
- package/dist/pages/elements/options.d.ts +0 -21
- package/dist/pages/elements/options.js +0 -629
- package/dist/pages/elements/pages.d.ts +0 -24
- package/dist/pages/elements/pages.js +0 -355
- package/dist/pages/elements/slot.d.ts +0 -21
- package/dist/pages/elements/slot.js +0 -105
- package/dist/pages/elements/table.d.ts +0 -19
- package/dist/pages/elements/table.js +0 -935
- package/dist/pages/elements/text.d.ts +0 -25
- package/dist/pages/elements/text.js +0 -968
- package/dist/pages/entry.d.ts +0 -8
- package/dist/pages/entry.js +0 -8
- package/dist/pages/host.d.ts +0 -158
- package/dist/pages/host.js +0 -182
- package/dist/pages/register.d.ts +0 -2
- package/dist/pages/register.js +0 -3
- package/dist/pages/slot-config.d.ts +0 -36
- package/dist/pages/slot-config.js +0 -50
- package/dist/pages/types.d.ts +0 -98
- package/dist/pages/types.js +0 -23
- /package/dist/{core/human/__tests__/page-render.test.d.ts → commands/__tests__/node-message.test.d.ts} +0 -0
- /package/dist/{pages/elements/chart.d.ts → core/__tests__/plugin-page-components.test.d.ts} +0 -0
package/dist/pages/entry.d.ts
DELETED
package/dist/pages/entry.js
DELETED
package/dist/pages/host.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `window.crtr` — the one door out of a page.
|
|
3
|
-
*
|
|
4
|
-
* An element renders inside a host (Northlight's srcdoc host today, a crtrd-served
|
|
5
|
-
* page later) that installs this bridge before the bundle loads. Everything an element
|
|
6
|
-
* needs from the outside world arrives through it: there is no `fetch`, no `XMLHttpRequest`,
|
|
7
|
-
* no direct network access anywhere under `src/pages/`. An element that cannot get what it
|
|
8
|
-
* needs renders a named unavailable state; it never falls back to reaching out itself.
|
|
9
|
-
*
|
|
10
|
-
* Two things the bridge deliberately does NOT have:
|
|
11
|
-
*
|
|
12
|
-
* - **No `save` and no `dismiss`.** Both are host chrome — a frame around the page, not
|
|
13
|
-
* markup inside it — so they are the host's own UI actions and are never advertised to
|
|
14
|
-
* page code.
|
|
15
|
-
* - **No per-element resolution.** `respond()` is a local-state write plus a request that
|
|
16
|
-
* the host autosave the partial map; it does not resolve the ticket. Only the pager's
|
|
17
|
-
* submit affordance calls `submit()`, which posts the complete map once.
|
|
18
|
-
*
|
|
19
|
-
* `respond()` has one counterpart, `savedResponse()`: the host hands back the response it is
|
|
20
|
-
* currently holding for a slot, so a page reopened after a partial answer re-mounts SHOWING
|
|
21
|
-
* that answer instead of blank. Every response-bearing element reads it at mount and seeds
|
|
22
|
-
* its visible state from it — that is what keeps "what submit sends" and "what the screen
|
|
23
|
-
* shows" the same thing.
|
|
24
|
-
*
|
|
25
|
-
* The host is optional at the type level (`window.crtr?`) because a page can be opened
|
|
26
|
-
* bare — dropped in a browser, or rendered by a host that installs nothing. Elements read
|
|
27
|
-
* the bridge through the accessors below rather than touching `window.crtr` directly, so
|
|
28
|
-
* that absence is typed and total instead of an `as any` at each call site.
|
|
29
|
-
*/
|
|
30
|
-
import type { SlotResponse } from './types.js';
|
|
31
|
-
/** Live host theme tokens, as `--crtr-*` custom-property names mapped to values. */
|
|
32
|
-
export interface CrtrThemeBridge {
|
|
33
|
-
current(): Record<string, string>;
|
|
34
|
-
/** Registers `listener` for later theme changes; returns its unsubscribe. */
|
|
35
|
-
subscribe(listener: (tokens: Record<string, string>) => void): () => void;
|
|
36
|
-
}
|
|
37
|
-
/** Data behind a `source`-bearing config (table, cards, chart). */
|
|
38
|
-
export interface CrtrArtifactBridge {
|
|
39
|
-
/** Resolves the already-parsed data for `source`, or rejects when it is unreachable. */
|
|
40
|
-
data(source: string): Promise<unknown>;
|
|
41
|
-
}
|
|
42
|
-
/** What `mountWorkspaceComponent` can answer: the host rendered it, or it has no renderer. */
|
|
43
|
-
export type WorkspaceMountOutcome = 'mounted' | 'unavailable';
|
|
44
|
-
/** The bridge a host installs at `window.crtr`. */
|
|
45
|
-
export interface CrtrHost {
|
|
46
|
-
/**
|
|
47
|
-
* Records this slot's complete current response and asks the host to autosave the
|
|
48
|
-
* partial map. Called on every user change. NOT ticket resolution.
|
|
49
|
-
*/
|
|
50
|
-
respond(slotId: string, response: SlotResponse): void;
|
|
51
|
-
/**
|
|
52
|
-
* The response the host currently holds for this slot — an autosaved partial answer on a
|
|
53
|
-
* reopened page, or the published answer on a resolved one. `undefined` when the host has
|
|
54
|
-
* nothing for the slot. Elements read it at mount; it is the inbound half of `respond`.
|
|
55
|
-
*/
|
|
56
|
-
savedResponse(slotId: string): SlotResponse | undefined;
|
|
57
|
-
/** Posts the complete response map once. Only the pager's submit affordance calls it. */
|
|
58
|
-
submit(): Promise<void>;
|
|
59
|
-
/** Flushes the pending autosave of the partial map. */
|
|
60
|
-
progress(): Promise<void>;
|
|
61
|
-
readonly theme: CrtrThemeBridge;
|
|
62
|
-
readonly artifact: CrtrArtifactBridge;
|
|
63
|
-
/**
|
|
64
|
-
* Asks the host to render a product-registered (`unvalidated`) slot into `element`.
|
|
65
|
-
* A host with no renderer for `kind` answers `'unavailable'`.
|
|
66
|
-
*/
|
|
67
|
-
mountWorkspaceComponent(element: HTMLElement, kind: string, config: Record<string, unknown>): Promise<WorkspaceMountOutcome>;
|
|
68
|
-
}
|
|
69
|
-
declare global {
|
|
70
|
-
interface Window {
|
|
71
|
-
/**
|
|
72
|
-
* Installed by the host before the bundle loads. Optional: a page opened bare has
|
|
73
|
-
* no bridge, and every element must still render.
|
|
74
|
-
*/
|
|
75
|
-
crtr?: CrtrHost;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* The outcome of a bridge call. `unavailable` means the door is not there — no host, or a
|
|
80
|
-
* host that does not implement this method. `failed` means the host was asked and said no,
|
|
81
|
-
* and `reason` is what it said. Elements distinguish them because "this page is not hosted"
|
|
82
|
-
* and "the server rejected your answer" are different things to show a person.
|
|
83
|
-
*/
|
|
84
|
-
export type HostCall = {
|
|
85
|
-
status: 'ok';
|
|
86
|
-
} | {
|
|
87
|
-
status: 'unavailable';
|
|
88
|
-
reason: string;
|
|
89
|
-
} | {
|
|
90
|
-
status: 'failed';
|
|
91
|
-
reason: string;
|
|
92
|
-
};
|
|
93
|
-
/** The outcome of an artifact read, with the same three-way split as `HostCall`. */
|
|
94
|
-
export type ArtifactData = {
|
|
95
|
-
status: 'ok';
|
|
96
|
-
data: unknown;
|
|
97
|
-
} | {
|
|
98
|
-
status: 'unavailable';
|
|
99
|
-
reason: string;
|
|
100
|
-
} | {
|
|
101
|
-
status: 'failed';
|
|
102
|
-
reason: string;
|
|
103
|
-
};
|
|
104
|
-
/** The installed bridge, or `undefined` on a bare page. */
|
|
105
|
-
export declare function host(): CrtrHost | undefined;
|
|
106
|
-
/**
|
|
107
|
-
* Writes this slot's complete current response to the host's in-frame map and requests an
|
|
108
|
-
* autosave. Elements call this on every user change with the whole response object, never a
|
|
109
|
-
* delta. Safe on a bare page: the element's own local state is authoritative for rendering,
|
|
110
|
-
* so an unavailable host only means the answer is not being persisted.
|
|
111
|
-
*/
|
|
112
|
-
export declare function respond(slotId: string, response: SlotResponse): HostCall;
|
|
113
|
-
/**
|
|
114
|
-
* The response the host already holds for this slot, or `undefined` when it holds none — a
|
|
115
|
-
* bare page, a first open, or a host without the channel. Elements call this once at mount
|
|
116
|
-
* and seed their visible state from it, so a reopened page shows the answers the host would
|
|
117
|
-
* submit rather than an empty form beside a full response map.
|
|
118
|
-
*
|
|
119
|
-
* `T` is asserted, not verified, exactly like `readSlotConfig`'s config: the host's saved map
|
|
120
|
-
* was validated against this slot's kind before it was stored. What is not guaranteed is that
|
|
121
|
-
* a host implements the channel at all, which is what the `undefined` covers — so seed with
|
|
122
|
-
* the same defensiveness you would give any outside value (`savedIds`, `adoptComments`).
|
|
123
|
-
*/
|
|
124
|
-
export declare function savedResponse<T extends SlotResponse = SlotResponse>(slotId: string): T | undefined;
|
|
125
|
-
/** The string ids of a saved selection field, with anything else in it dropped. */
|
|
126
|
-
export declare function savedIds(value: unknown): string[];
|
|
127
|
-
/**
|
|
128
|
-
* Posts the complete response map once, resolving the ticket. Only the pager's submit
|
|
129
|
-
* affordance calls this.
|
|
130
|
-
*/
|
|
131
|
-
export declare function submit(): Promise<HostCall>;
|
|
132
|
-
/** Flushes the host's pending autosave of the partial map. Never resolves the ticket. */
|
|
133
|
-
export declare function progress(): Promise<HostCall>;
|
|
134
|
-
/**
|
|
135
|
-
* The host's current theme token values. Empty on a bare page — which is correct and needs
|
|
136
|
-
* no handling, because `bundle.css` declares every `--crtr-*` token at zero specificity and
|
|
137
|
-
* elements style through those custom properties rather than through this map. Read it only
|
|
138
|
-
* when a value must reach somewhere CSS cannot, such as an SVG attribute.
|
|
139
|
-
*/
|
|
140
|
-
export declare function themeTokens(): Record<string, string>;
|
|
141
|
-
/**
|
|
142
|
-
* Subscribes to later theme changes. Always returns an unsubscribe, so a caller can wire it
|
|
143
|
-
* to `disconnectedCallback` without checking whether a host was there.
|
|
144
|
-
*/
|
|
145
|
-
export declare function subscribeTheme(listener: (tokens: Record<string, string>) => void): () => void;
|
|
146
|
-
/**
|
|
147
|
-
* Reads the data behind a `source`-bearing config. The host resolves the reference and hands
|
|
148
|
-
* back parsed data; an element never resolves a reference itself and never fetches a URL.
|
|
149
|
-
* Anything other than `'ok'` is a named unavailable state to render, not a reason to retry
|
|
150
|
-
* some other way.
|
|
151
|
-
*/
|
|
152
|
-
export declare function artifactData(source: string): Promise<ArtifactData>;
|
|
153
|
-
/**
|
|
154
|
-
* Asks the host to render a product-registered slot into `element`. A bare page, a host with
|
|
155
|
-
* no registry, and a host whose mount threw all answer `'unavailable'` — the escape element's
|
|
156
|
-
* named unavailable state is the only other outcome.
|
|
157
|
-
*/
|
|
158
|
-
export declare function mountWorkspaceComponent(element: HTMLElement, kind: string, config: Record<string, unknown>): Promise<WorkspaceMountOutcome>;
|
package/dist/pages/host.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `window.crtr` — the one door out of a page.
|
|
3
|
-
*
|
|
4
|
-
* An element renders inside a host (Northlight's srcdoc host today, a crtrd-served
|
|
5
|
-
* page later) that installs this bridge before the bundle loads. Everything an element
|
|
6
|
-
* needs from the outside world arrives through it: there is no `fetch`, no `XMLHttpRequest`,
|
|
7
|
-
* no direct network access anywhere under `src/pages/`. An element that cannot get what it
|
|
8
|
-
* needs renders a named unavailable state; it never falls back to reaching out itself.
|
|
9
|
-
*
|
|
10
|
-
* Two things the bridge deliberately does NOT have:
|
|
11
|
-
*
|
|
12
|
-
* - **No `save` and no `dismiss`.** Both are host chrome — a frame around the page, not
|
|
13
|
-
* markup inside it — so they are the host's own UI actions and are never advertised to
|
|
14
|
-
* page code.
|
|
15
|
-
* - **No per-element resolution.** `respond()` is a local-state write plus a request that
|
|
16
|
-
* the host autosave the partial map; it does not resolve the ticket. Only the pager's
|
|
17
|
-
* submit affordance calls `submit()`, which posts the complete map once.
|
|
18
|
-
*
|
|
19
|
-
* `respond()` has one counterpart, `savedResponse()`: the host hands back the response it is
|
|
20
|
-
* currently holding for a slot, so a page reopened after a partial answer re-mounts SHOWING
|
|
21
|
-
* that answer instead of blank. Every response-bearing element reads it at mount and seeds
|
|
22
|
-
* its visible state from it — that is what keeps "what submit sends" and "what the screen
|
|
23
|
-
* shows" the same thing.
|
|
24
|
-
*
|
|
25
|
-
* The host is optional at the type level (`window.crtr?`) because a page can be opened
|
|
26
|
-
* bare — dropped in a browser, or rendered by a host that installs nothing. Elements read
|
|
27
|
-
* the bridge through the accessors below rather than touching `window.crtr` directly, so
|
|
28
|
-
* that absence is typed and total instead of an `as any` at each call site.
|
|
29
|
-
*/
|
|
30
|
-
/** The installed bridge, or `undefined` on a bare page. */
|
|
31
|
-
export function host() {
|
|
32
|
-
return typeof window === 'undefined' ? undefined : window.crtr;
|
|
33
|
-
}
|
|
34
|
-
function reasonOf(error) {
|
|
35
|
-
if (error instanceof Error && error.message !== '')
|
|
36
|
-
return error.message;
|
|
37
|
-
const text = String(error);
|
|
38
|
-
return text === '' ? 'unknown error' : text;
|
|
39
|
-
}
|
|
40
|
-
function missing(method) {
|
|
41
|
-
return { status: 'unavailable', reason: `host bridge does not provide ${method}()` };
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Writes this slot's complete current response to the host's in-frame map and requests an
|
|
45
|
-
* autosave. Elements call this on every user change with the whole response object, never a
|
|
46
|
-
* delta. Safe on a bare page: the element's own local state is authoritative for rendering,
|
|
47
|
-
* so an unavailable host only means the answer is not being persisted.
|
|
48
|
-
*/
|
|
49
|
-
export function respond(slotId, response) {
|
|
50
|
-
const bridge = host();
|
|
51
|
-
if (typeof bridge?.respond !== 'function')
|
|
52
|
-
return missing('respond');
|
|
53
|
-
try {
|
|
54
|
-
bridge.respond(slotId, response);
|
|
55
|
-
return { status: 'ok' };
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
return { status: 'failed', reason: reasonOf(error) };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* The response the host already holds for this slot, or `undefined` when it holds none — a
|
|
63
|
-
* bare page, a first open, or a host without the channel. Elements call this once at mount
|
|
64
|
-
* and seed their visible state from it, so a reopened page shows the answers the host would
|
|
65
|
-
* submit rather than an empty form beside a full response map.
|
|
66
|
-
*
|
|
67
|
-
* `T` is asserted, not verified, exactly like `readSlotConfig`'s config: the host's saved map
|
|
68
|
-
* was validated against this slot's kind before it was stored. What is not guaranteed is that
|
|
69
|
-
* a host implements the channel at all, which is what the `undefined` covers — so seed with
|
|
70
|
-
* the same defensiveness you would give any outside value (`savedIds`, `adoptComments`).
|
|
71
|
-
*/
|
|
72
|
-
export function savedResponse(slotId) {
|
|
73
|
-
const bridge = host();
|
|
74
|
-
if (typeof bridge?.savedResponse !== 'function')
|
|
75
|
-
return undefined;
|
|
76
|
-
try {
|
|
77
|
-
const saved = bridge.savedResponse(slotId);
|
|
78
|
-
return typeof saved === 'object' && saved !== null && !Array.isArray(saved) ? saved : undefined;
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/** The string ids of a saved selection field, with anything else in it dropped. */
|
|
85
|
-
export function savedIds(value) {
|
|
86
|
-
return Array.isArray(value) ? value.filter((id) => typeof id === 'string') : [];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Posts the complete response map once, resolving the ticket. Only the pager's submit
|
|
90
|
-
* affordance calls this.
|
|
91
|
-
*/
|
|
92
|
-
export async function submit() {
|
|
93
|
-
const bridge = host();
|
|
94
|
-
if (typeof bridge?.submit !== 'function')
|
|
95
|
-
return missing('submit');
|
|
96
|
-
try {
|
|
97
|
-
await bridge.submit();
|
|
98
|
-
return { status: 'ok' };
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
return { status: 'failed', reason: reasonOf(error) };
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/** Flushes the host's pending autosave of the partial map. Never resolves the ticket. */
|
|
105
|
-
export async function progress() {
|
|
106
|
-
const bridge = host();
|
|
107
|
-
if (typeof bridge?.progress !== 'function')
|
|
108
|
-
return missing('progress');
|
|
109
|
-
try {
|
|
110
|
-
await bridge.progress();
|
|
111
|
-
return { status: 'ok' };
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
return { status: 'failed', reason: reasonOf(error) };
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* The host's current theme token values. Empty on a bare page — which is correct and needs
|
|
119
|
-
* no handling, because `bundle.css` declares every `--crtr-*` token at zero specificity and
|
|
120
|
-
* elements style through those custom properties rather than through this map. Read it only
|
|
121
|
-
* when a value must reach somewhere CSS cannot, such as an SVG attribute.
|
|
122
|
-
*/
|
|
123
|
-
export function themeTokens() {
|
|
124
|
-
const bridge = host();
|
|
125
|
-
if (typeof bridge?.theme?.current !== 'function')
|
|
126
|
-
return {};
|
|
127
|
-
try {
|
|
128
|
-
return bridge.theme.current();
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
return {};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Subscribes to later theme changes. Always returns an unsubscribe, so a caller can wire it
|
|
136
|
-
* to `disconnectedCallback` without checking whether a host was there.
|
|
137
|
-
*/
|
|
138
|
-
export function subscribeTheme(listener) {
|
|
139
|
-
const bridge = host();
|
|
140
|
-
if (typeof bridge?.theme?.subscribe !== 'function')
|
|
141
|
-
return () => { };
|
|
142
|
-
try {
|
|
143
|
-
const unsubscribe = bridge.theme.subscribe(listener);
|
|
144
|
-
return typeof unsubscribe === 'function' ? unsubscribe : () => { };
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
return () => { };
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Reads the data behind a `source`-bearing config. The host resolves the reference and hands
|
|
152
|
-
* back parsed data; an element never resolves a reference itself and never fetches a URL.
|
|
153
|
-
* Anything other than `'ok'` is a named unavailable state to render, not a reason to retry
|
|
154
|
-
* some other way.
|
|
155
|
-
*/
|
|
156
|
-
export async function artifactData(source) {
|
|
157
|
-
const bridge = host();
|
|
158
|
-
if (typeof bridge?.artifact?.data !== 'function')
|
|
159
|
-
return missing('artifact.data');
|
|
160
|
-
try {
|
|
161
|
-
return { status: 'ok', data: await bridge.artifact.data(source) };
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
return { status: 'failed', reason: reasonOf(error) };
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Asks the host to render a product-registered slot into `element`. A bare page, a host with
|
|
169
|
-
* no registry, and a host whose mount threw all answer `'unavailable'` — the escape element's
|
|
170
|
-
* named unavailable state is the only other outcome.
|
|
171
|
-
*/
|
|
172
|
-
export async function mountWorkspaceComponent(element, kind, config) {
|
|
173
|
-
const bridge = host();
|
|
174
|
-
if (typeof bridge?.mountWorkspaceComponent !== 'function')
|
|
175
|
-
return 'unavailable';
|
|
176
|
-
try {
|
|
177
|
-
return await bridge.mountWorkspaceComponent(element, kind, config);
|
|
178
|
-
}
|
|
179
|
-
catch {
|
|
180
|
-
return 'unavailable';
|
|
181
|
-
}
|
|
182
|
-
}
|
package/dist/pages/register.d.ts
DELETED
package/dist/pages/register.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading a slot's config out of the DOM.
|
|
3
|
-
*
|
|
4
|
-
* The host renders each slot as
|
|
5
|
-
* `<crtr-KIND slot-id="ID"><script type="application/json">CONFIG_JSON</script></crtr-KIND>`,
|
|
6
|
-
* and every element does the same three things in `connectedCallback`: find that script child,
|
|
7
|
-
* parse it, and render a named error state instead of throwing when it is missing or malformed.
|
|
8
|
-
* That is one behaviour, so it lives here once.
|
|
9
|
-
*
|
|
10
|
-
* **What is and is not checked.** The JSON's *shape* was already validated by
|
|
11
|
-
* `validatePageManifest` before the manifest was stored, and the renderer emits from that
|
|
12
|
-
* validated manifest — so an element may trust the parsed object against its own config type.
|
|
13
|
-
* What is not guaranteed is that the script child is there at all and that its text parses: a
|
|
14
|
-
* page can be hand-written, truncated, or rendered by something else. Those two failures are
|
|
15
|
-
* what this module reports.
|
|
16
|
-
*/
|
|
17
|
-
/** A parsed config, or the reason the element should render an error state instead. */
|
|
18
|
-
export type SlotConfigResult<T> = {
|
|
19
|
-
status: 'ok';
|
|
20
|
-
config: T;
|
|
21
|
-
} | {
|
|
22
|
-
status: 'invalid';
|
|
23
|
-
reason: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Reads and parses the JSON script child of `element`.
|
|
27
|
-
*
|
|
28
|
-
* `T` is the element's own mirrored config type and is asserted, not verified — see the note
|
|
29
|
-
* above on why that is sound. Never throws.
|
|
30
|
-
*/
|
|
31
|
-
export declare function readSlotConfig<T = Record<string, unknown>>(element: HTMLElement): SlotConfigResult<T>;
|
|
32
|
-
/**
|
|
33
|
-
* The slot id the host addressed this element by — the key `respond()` takes. Absent on a
|
|
34
|
-
* display-only slot, which has no id and produces no response.
|
|
35
|
-
*/
|
|
36
|
-
export declare function readSlotId(element: HTMLElement): string | undefined;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading a slot's config out of the DOM.
|
|
3
|
-
*
|
|
4
|
-
* The host renders each slot as
|
|
5
|
-
* `<crtr-KIND slot-id="ID"><script type="application/json">CONFIG_JSON</script></crtr-KIND>`,
|
|
6
|
-
* and every element does the same three things in `connectedCallback`: find that script child,
|
|
7
|
-
* parse it, and render a named error state instead of throwing when it is missing or malformed.
|
|
8
|
-
* That is one behaviour, so it lives here once.
|
|
9
|
-
*
|
|
10
|
-
* **What is and is not checked.** The JSON's *shape* was already validated by
|
|
11
|
-
* `validatePageManifest` before the manifest was stored, and the renderer emits from that
|
|
12
|
-
* validated manifest — so an element may trust the parsed object against its own config type.
|
|
13
|
-
* What is not guaranteed is that the script child is there at all and that its text parses: a
|
|
14
|
-
* page can be hand-written, truncated, or rendered by something else. Those two failures are
|
|
15
|
-
* what this module reports.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Reads and parses the JSON script child of `element`.
|
|
19
|
-
*
|
|
20
|
-
* `T` is the element's own mirrored config type and is asserted, not verified — see the note
|
|
21
|
-
* above on why that is sound. Never throws.
|
|
22
|
-
*/
|
|
23
|
-
export function readSlotConfig(element) {
|
|
24
|
-
const script = element.querySelector('script[type="application/json"]');
|
|
25
|
-
if (script === null)
|
|
26
|
-
return { status: 'invalid', reason: 'slot has no application/json config' };
|
|
27
|
-
const text = script.textContent ?? '';
|
|
28
|
-
if (text.trim() === '')
|
|
29
|
-
return { status: 'invalid', reason: 'slot config is empty' };
|
|
30
|
-
let parsed;
|
|
31
|
-
try {
|
|
32
|
-
parsed = JSON.parse(text);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
const detail = error instanceof Error && error.message !== '' ? error.message : 'invalid JSON';
|
|
36
|
-
return { status: 'invalid', reason: `slot config is not valid JSON: ${detail}` };
|
|
37
|
-
}
|
|
38
|
-
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
39
|
-
return { status: 'invalid', reason: 'slot config must be a JSON object' };
|
|
40
|
-
}
|
|
41
|
-
return { status: 'ok', config: parsed };
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The slot id the host addressed this element by — the key `respond()` takes. Absent on a
|
|
45
|
-
* display-only slot, which has no id and produces no response.
|
|
46
|
-
*/
|
|
47
|
-
export function readSlotId(element) {
|
|
48
|
-
const id = element.getAttribute('slot-id')?.trim();
|
|
49
|
-
return id === undefined || id === '' ? undefined : id;
|
|
50
|
-
}
|
package/dist/pages/types.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The response contract the page bundle produces, as plain browser-safe types.
|
|
3
|
-
*
|
|
4
|
-
* These mirror `src/core/human/page-schema.ts` field-for-field — `commentSchema`,
|
|
5
|
-
* `commentAnchorSchema`, and the four `*ResponseSchema`s — and are deliberately a
|
|
6
|
-
* separate declaration rather than an import: nothing under `src/pages/` may reach
|
|
7
|
-
* a runtime package (zod) or a module outside this directory, because the bundle is
|
|
8
|
-
* a browser IIFE. The schemas remain the source of truth; a change there is a change
|
|
9
|
-
* that must land here in the same commit.
|
|
10
|
-
*
|
|
11
|
-
* Two rules the shapes are built around:
|
|
12
|
-
*
|
|
13
|
-
* 1. **One comment shape everywhere.** Every response-bearing element carries
|
|
14
|
-
* comments, and every comment is `{ id, anchor, text }`. A comment on an option,
|
|
15
|
-
* a table row, a card, or a range of prose differs only in its `anchor`.
|
|
16
|
-
* 2. **Selection is ids, never indexes or values.** The agent authored the ids it is
|
|
17
|
-
* asking about, so the response keys straight off them.
|
|
18
|
-
*
|
|
19
|
-
* Config types are NOT here: a config is one element's private input, mirrored in that
|
|
20
|
-
* element's own module. A response is what crosses `window.crtr.respond`, so it is
|
|
21
|
-
* shared.
|
|
22
|
-
*/
|
|
23
|
-
/** What a comment is attached to. One union across every element. */
|
|
24
|
-
export type CommentAnchor =
|
|
25
|
-
/** The presented content as a whole. */
|
|
26
|
-
{
|
|
27
|
-
kind: 'whole';
|
|
28
|
-
}
|
|
29
|
-
/** One option of an `options` element. */
|
|
30
|
-
| {
|
|
31
|
-
kind: 'option';
|
|
32
|
-
optionId: string;
|
|
33
|
-
}
|
|
34
|
-
/** One row of a `table`. */
|
|
35
|
-
| {
|
|
36
|
-
kind: 'row';
|
|
37
|
-
rowId: string;
|
|
38
|
-
}
|
|
39
|
-
/** One column of a `table`. */
|
|
40
|
-
| {
|
|
41
|
-
kind: 'column';
|
|
42
|
-
columnId: string;
|
|
43
|
-
}
|
|
44
|
-
/** One card of a `cards` grid. */
|
|
45
|
-
| {
|
|
46
|
-
kind: 'card';
|
|
47
|
-
cardId: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* A character range of a `text` element's final text, review-style. `quote` is the
|
|
51
|
-
* text as it read when the comment was left, so the comment survives (readably) an
|
|
52
|
-
* edit that moves the offsets.
|
|
53
|
-
*/
|
|
54
|
-
| {
|
|
55
|
-
kind: 'range';
|
|
56
|
-
start: number;
|
|
57
|
-
end: number;
|
|
58
|
-
quote: string;
|
|
59
|
-
};
|
|
60
|
-
/** A user comment. The same shape in every element's response. */
|
|
61
|
-
export type Comment = {
|
|
62
|
-
/** Stable per comment; frame-local, minted by `newCommentId()`. */
|
|
63
|
-
id: string;
|
|
64
|
-
anchor: CommentAnchor;
|
|
65
|
-
text: string;
|
|
66
|
-
};
|
|
67
|
-
/** `options` — single or multi select, per-option comments, optional freetext. */
|
|
68
|
-
export type OptionsResponse = {
|
|
69
|
-
/** Always an array; a single-select answer is a one-element array. */
|
|
70
|
-
selectedOptionIds: string[];
|
|
71
|
-
comments: Comment[];
|
|
72
|
-
/** Present only when the config allows freetext and the user typed something. */
|
|
73
|
-
freetext?: string;
|
|
74
|
-
};
|
|
75
|
-
/** `text` — an edited draft and/or anchored comments on presented prose. */
|
|
76
|
-
export type TextResponse = {
|
|
77
|
-
/** The text as the user is leaving it. */
|
|
78
|
-
text: string;
|
|
79
|
-
/** True once `text` differs from what the agent presented. */
|
|
80
|
-
edited: boolean;
|
|
81
|
-
comments: Comment[];
|
|
82
|
-
};
|
|
83
|
-
/** `table` — row and/or column selection with anchored comments. */
|
|
84
|
-
export type TableResponse = {
|
|
85
|
-
selectedRowIds: string[];
|
|
86
|
-
selectedColumnIds: string[];
|
|
87
|
-
comments: Comment[];
|
|
88
|
-
};
|
|
89
|
-
/** `cards` — card selection with per-card comments. */
|
|
90
|
-
export type CardsResponse = {
|
|
91
|
-
selectedCardIds: string[];
|
|
92
|
-
comments: Comment[];
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Any slot response. The open member covers a product-registered `unvalidated` slot,
|
|
96
|
-
* whose shape only the product renderer knows.
|
|
97
|
-
*/
|
|
98
|
-
export type SlotResponse = OptionsResponse | TextResponse | TableResponse | CardsResponse | Record<string, unknown>;
|
package/dist/pages/types.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The response contract the page bundle produces, as plain browser-safe types.
|
|
3
|
-
*
|
|
4
|
-
* These mirror `src/core/human/page-schema.ts` field-for-field — `commentSchema`,
|
|
5
|
-
* `commentAnchorSchema`, and the four `*ResponseSchema`s — and are deliberately a
|
|
6
|
-
* separate declaration rather than an import: nothing under `src/pages/` may reach
|
|
7
|
-
* a runtime package (zod) or a module outside this directory, because the bundle is
|
|
8
|
-
* a browser IIFE. The schemas remain the source of truth; a change there is a change
|
|
9
|
-
* that must land here in the same commit.
|
|
10
|
-
*
|
|
11
|
-
* Two rules the shapes are built around:
|
|
12
|
-
*
|
|
13
|
-
* 1. **One comment shape everywhere.** Every response-bearing element carries
|
|
14
|
-
* comments, and every comment is `{ id, anchor, text }`. A comment on an option,
|
|
15
|
-
* a table row, a card, or a range of prose differs only in its `anchor`.
|
|
16
|
-
* 2. **Selection is ids, never indexes or values.** The agent authored the ids it is
|
|
17
|
-
* asking about, so the response keys straight off them.
|
|
18
|
-
*
|
|
19
|
-
* Config types are NOT here: a config is one element's private input, mirrored in that
|
|
20
|
-
* element's own module. A response is what crosses `window.crtr.respond`, so it is
|
|
21
|
-
* shared.
|
|
22
|
-
*/
|
|
23
|
-
export {};
|
|
File without changes
|
|
File without changes
|