@fish-under-sea/dsh-client-ui-task-board-fish 2.2.3 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.en.md +4 -4
  2. package/package.json +1 -1
  3. package/README.i18n.yaml +0 -6
  4. package/README.md +0 -31
  5. package/README.zh.md +0 -31
  6. package/lib/client.js +0 -15861
  7. package/lib/client.js.map +0 -1
  8. package/lib/index.js +0 -12653
  9. package/lib/types/client/CardDefaultPresetField.d.ts +0 -35
  10. package/lib/types/client/PluginSettingsCard.d.ts +0 -255
  11. package/lib/types/client/RangeBubble.d.ts +0 -46
  12. package/lib/types/client/SegmentGroup.d.ts +0 -28
  13. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -155
  14. package/lib/types/client/apply-guard.d.ts +0 -25
  15. package/lib/types/client/board/AttachmentField.d.ts +0 -70
  16. package/lib/types/client/board/ClampedMarkdown.d.ts +0 -3
  17. package/lib/types/client/board/ConfirmDialog.d.ts +0 -15
  18. package/lib/types/client/board/EditTaskModal.d.ts +0 -17
  19. package/lib/types/client/board/ExecutionLog.d.ts +0 -24
  20. package/lib/types/client/board/LinkSubtaskModal.d.ts +0 -14
  21. package/lib/types/client/board/NewTaskModal.d.ts +0 -26
  22. package/lib/types/client/board/ReasoningEffortField.d.ts +0 -25
  23. package/lib/types/client/board/TagManagerModal.d.ts +0 -26
  24. package/lib/types/client/board/TaskBoard.d.ts +0 -26
  25. package/lib/types/client/board/TaskCard.d.ts +0 -36
  26. package/lib/types/client/board/TaskDetail.d.ts +0 -9
  27. package/lib/types/client/board/TaskForm.d.ts +0 -76
  28. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  29. package/lib/types/client/board/card-view.d.ts +0 -113
  30. package/lib/types/client/board/icons.d.ts +0 -32
  31. package/lib/types/client/board/model-options.d.ts +0 -87
  32. package/lib/types/client/board/overlay.d.ts +0 -69
  33. package/lib/types/client/board/parse-model-pref.d.ts +0 -4
  34. package/lib/types/client/board/preset-label.d.ts +0 -43
  35. package/lib/types/client/board/preset-roster.d.ts +0 -45
  36. package/lib/types/client/board/source-group.d.ts +0 -27
  37. package/lib/types/client/board/status-key.d.ts +0 -19
  38. package/lib/types/client/board/task-markdown.d.ts +0 -19
  39. package/lib/types/client/body-mutations.d.ts +0 -45
  40. package/lib/types/client/host-api.d.ts +0 -88
  41. package/lib/types/client/index.d.ts +0 -128
  42. package/lib/types/client/locales.d.ts +0 -521
  43. package/lib/types/client/main-session.d.ts +0 -32
  44. package/lib/types/client/native-panel.d.ts +0 -48
  45. package/lib/types/client/pending-verify.d.ts +0 -47
  46. package/lib/types/client/plugin-card-seat.d.ts +0 -110
  47. package/lib/types/client/schedule-presets.d.ts +0 -10
  48. package/lib/types/client/schedule-zone.d.ts +0 -97
  49. package/lib/types/client/seats.d.ts +0 -18
  50. package/lib/types/client/service.d.ts +0 -35
  51. package/lib/types/client/settings-entry-form.d.ts +0 -49
  52. package/lib/types/client/settings-form.d.ts +0 -235
  53. package/lib/types/core/attachment.d.ts +0 -132
  54. package/lib/types/core/card-defaults.d.ts +0 -78
  55. package/lib/types/core/controller.d.ts +0 -422
  56. package/lib/types/core/degraded-reason.d.ts +0 -46
  57. package/lib/types/core/execution-summary.d.ts +0 -52
  58. package/lib/types/core/extension.d.ts +0 -399
  59. package/lib/types/core/freeze-snapshot.d.ts +0 -71
  60. package/lib/types/core/handover.d.ts +0 -70
  61. package/lib/types/core/issue-form.d.ts +0 -16
  62. package/lib/types/core/launch-width.d.ts +0 -31
  63. package/lib/types/core/package-name.d.ts +0 -9
  64. package/lib/types/core/poll-cadence.d.ts +0 -31
  65. package/lib/types/core/reasoning-effort.d.ts +0 -57
  66. package/lib/types/core/schedule.d.ts +0 -124
  67. package/lib/types/core/session-reuse.d.ts +0 -30
  68. package/lib/types/core/spend-budget.d.ts +0 -28
  69. package/lib/types/core/store.d.ts +0 -64
  70. package/lib/types/core/subtask.d.ts +0 -204
  71. package/lib/types/core/tasks.d.ts +0 -685
  72. package/lib/types/core/use-cases/task-archive.d.ts +0 -20
  73. package/lib/types/core/use-cases/task-create.d.ts +0 -32
  74. package/lib/types/core/use-cases/task-delete.d.ts +0 -27
  75. package/lib/types/core/use-cases/task-parent.d.ts +0 -21
  76. package/lib/types/core/use-cases/task-schedule.d.ts +0 -96
  77. package/lib/types/core/use-cases/task-tag.d.ts +0 -84
  78. package/lib/types/core/use-cases/task-update.d.ts +0 -77
  79. package/lib/types/core/verification-budget.d.ts +0 -52
  80. package/lib/types/core/verification.d.ts +0 -753
  81. package/lib/types/core/wire-projection.d.ts +0 -35
  82. package/lib/types/core/workspace-target.d.ts +0 -61
  83. package/lib/types/dsh-home.d.ts +0 -16
  84. package/lib/types/host/agent-tools.d.ts +0 -27
  85. package/lib/types/host/attachments.d.ts +0 -250
  86. package/lib/types/host/extension-registry.d.ts +0 -151
  87. package/lib/types/host/launch-admission.d.ts +0 -71
  88. package/lib/types/host/llm-dispatch.d.ts +0 -63
  89. package/lib/types/host/verification-gate.d.ts +0 -95
  90. package/lib/types/host/verification-runner.d.ts +0 -139
  91. package/lib/types/host/workspace-evidence.d.ts +0 -53
  92. package/lib/types/host-ai.d.ts +0 -51
  93. package/lib/types/host-ledger.d.ts +0 -452
  94. package/lib/types/host-routes.d.ts +0 -99
  95. package/lib/types/host-runner.d.ts +0 -401
  96. package/lib/types/host-service.d.ts +0 -517
  97. package/lib/types/host-spend.d.ts +0 -52
  98. package/lib/types/http.d.ts +0 -59
  99. package/lib/types/index.d.ts +0 -441
  100. package/lib/types/loopback.d.ts +0 -64
  101. package/lib/types/mount-once.d.ts +0 -55
  102. package/lib/types/power-inhibitor.d.ts +0 -73
  103. package/lib/types/protocol.d.ts +0 -253
  104. package/lib/types/tool-surface.d.ts +0 -72
@@ -1,110 +0,0 @@
1
- /**
2
- * Family plugin-card seat.
3
- *
4
- * A family plugin contributes its settings card to whichever plugin-card seat
5
- * the running host actually renders:
6
- *
7
- * - `web-ui.plugin.item` — the list seat declared by the dsh-web-settings
8
- * group section (this family's own first-level "Web UI plugins" section);
9
- * - `plugins.bundle.config` — the official keyed seat of the harness's plugin
10
- * manager page, keyed by the bundle's package name and rendered on that
11
- * bundle's page. alpha.2 removed the `settings.plugin.item` keyed seat of the
12
- * `ui-settings-plugins` tab that this helper used before, so a card keyed by
13
- * its settings namespace has no seat to land in any more.
14
- *
15
- * SEAT SELECTION IS NOT A DECLARATION PROBE. The official plugin surface
16
- * belongs to the harness bundle and declares its seats before any external
17
- * plugin's `apply()` runs, so "is the official seat declared?" answers yes even
18
- * in the deployment whose whole point is the family group. Choosing on that
19
- * probe sends every family card to the official page and leaves the group's own
20
- * section permanently empty — the family of reports where the section renders
21
- * its heading and zero cards.
22
- *
23
- * The signal that actually distinguishes the two deployments is whether
24
- * dsh-web-settings is loaded: it is the package that owns the group section and
25
- * it publishes the `webUiSettings` service during `apply()`, which every
26
- * family plugin already reads for its settings form. Group loaded -> the family
27
- * seat; group absent -> the official seat.
28
- *
29
- * The decision is re-evaluated on every `slots/changed` because the group may
30
- * apply after this plugin (the family aggregate orders it first, a profile that
31
- * installs the group separately need not): the initial contribution goes to the
32
- * official seat, then moves to the family seat the moment the group's section
33
- * registers. The entry is disposed before the replacement is registered, so a
34
- * card is never in two seats at once.
35
- *
36
- * The shared tree has no client-SDK dependency, so this module reads its
37
- * context through the structural shape below; callers pass the plugin's own
38
- * `ctx`.
39
- */
40
- /** The family list seat key. */
41
- export declare const FAMILY_PLUGIN_CARD_SEAT = "web-ui.plugin.item";
42
- /** The official keyed plugin-card seat key (the alpha.2 bundle-configuration seat). */
43
- export declare const OFFICIAL_PLUGIN_CARD_SEAT = "plugins.bundle.config";
44
- /** The service dsh-web-settings publishes while it is loaded. */
45
- export declare const FAMILY_GROUP_SERVICE = "webUiSettings";
46
- /** The slot-registry member this helper uses (structurally satisfied by ctx.slots). */
47
- export interface PluginCardSlots {
48
- /** Contribution of one card entry. */
49
- register(options: never, component: never): unknown;
50
- /** Declaration probe: a target seat may appear after this plugin applies. */
51
- spec?(key: string): unknown;
52
- }
53
- /** The slice of the client context a card contribution needs. */
54
- export interface PluginCardContext {
55
- slots: PluginCardSlots;
56
- /** Service lookup; absent on a context double that only models the slots. */
57
- get?(name: string): unknown;
58
- /** Event subscription seat; absent on an event-less test double. */
59
- on?(event: never, listener: never): unknown;
60
- }
61
- /** Owner share of a family list-seat card (that seat supplies nothing). */
62
- export interface SettingsPluginItemOwnerProps {
63
- /** Marker field: card owner props are intentionally empty. */
64
- children?: never;
65
- }
66
- /** One family plugin's card contribution. */
67
- export interface PluginCardSeat {
68
- /**
69
- * Npm package name of the bundle this card configures; the official keyed
70
- * seat dispatches on it. Every family package ships its own bundle patch, so
71
- * a standalone install lists that package as the bundle whose page renders
72
- * this card.
73
- */
74
- bundle: string;
75
- /** Family list-seat entry id. */
76
- id: string;
77
- /** Family list-seat sort order. */
78
- order?: number;
79
- /** Family list-seat display label; the official keyed seat carries none. */
80
- label?: () => string;
81
- /** Locale namespace the card renders with. */
82
- locale: string;
83
- /**
84
- * Child slots this card declares and renders. Forwarded to whichever seat
85
- * the host renders; absent for a card that declares none.
86
- */
87
- children?: Record<string, unknown>;
88
- /** Business-face factory of the registration. */
89
- inject?: () => object;
90
- /**
91
- * The card component. Its props type is the seat's composed shape, which is
92
- * chosen at runtime, so the helper takes it erased; the registrant keeps its
93
- * own precise typing at the call site.
94
- */
95
- component: unknown;
96
- }
97
- /**
98
- * Whether the family group (dsh-web-settings) is loaded in this page. The
99
- * service is the group package's own contract, so the probe cannot be fooled
100
- * by a harness release that starts declaring the official seat differently.
101
- */
102
- export declare function familyGroupLoaded(ctx: PluginCardContext): boolean;
103
- /**
104
- * Contribute one family plugin card to the seat this host renders, following
105
- * the group if it loads later. The entry is disposed and re-registered on a
106
- * seat change, never duplicated.
107
- * @param ctx - client context (its slot registry decides the seat).
108
- * @param seat - the card contribution.
109
- */
110
- export declare function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat): void;
@@ -1,10 +0,0 @@
1
- /**
2
- * Shared scheduled-run presets for the schedule editors (the new-task dialog
3
- * and the task detail panel): cron expression → locale label.
4
- */
5
- import type { TaskBoardKey } from './locales.ts';
6
- /** Common scheduled-run presets (cron → locale label). */
7
- export declare const SCHEDULE_PRESETS: ReadonlyArray<{
8
- cron: string;
9
- label: TaskBoardKey;
10
- }>;
@@ -1,97 +0,0 @@
1
- import { type ScheduleRule, type ScheduleStopReason } from '../core/tasks.ts';
2
- import { type TaskBoardKey } from './locales.ts';
3
- /** One selectable zone, in the order the picker shows it. */
4
- export interface ZoneChoice {
5
- /** Canonical IANA id, or `''` for the Host-zone entry. */
6
- id: string;
7
- /** Display label. */
8
- label: string;
9
- }
10
- /**
11
- * Zones offered by the picker: the Host zone first (the default, and the entry
12
- * a rule with no stored zone follows), then the runtime's own inventory.
13
- *
14
- * The Host entry is always present, even before the Host snapshot reports a
15
- * zone: it is the entry that stores no zone, so dropping it would leave a rule
16
- * unable to express "follow the Host" and would let the control silently
17
- * display an unrelated zone.
18
- *
19
- * A stored zone the inventory does not list (a rule written on another machine
20
- * or under a different ICU build) is appended, so opening the editor can never
21
- * silently rewrite the rule's zone.
22
- * @param hostTimeZone - zone the Host reported for this deployment, when known.
23
- * @param storedTimeZone - zone the edited rule already stores, when any.
24
- * @returns the de-duplicated choice list.
25
- */
26
- export declare function zoneChoices(hostTimeZone: string | undefined, storedTimeZone?: string): ZoneChoice[];
27
- /**
28
- * The relative half of a next-run label: how far away the instant is, or how
29
- * far past it the board is running. `now` is passed in rather than sampled so
30
- * callers can share one clock reading across a row, and tests stay
31
- * deterministic.
32
- * @param targetMs - the instant being described.
33
- * @param now - the reference instant.
34
- * @returns localized relative wording.
35
- */
36
- export declare function relativeTimeLabel(targetMs: number, now: number): string;
37
- /**
38
- * The `datetime-local` input value for an instant, read in an explicit zone:
39
- * `YYYY-MM-DDTHH:mm`. Uses the shared engine's zone reader, so the editor
40
- * shows the same wall clock the Host schedules by.
41
- * @param epochMs - the instant to render.
42
- * @param timeZone - zone to read it in; absent uses the Host zone.
43
- * @returns the input value.
44
- */
45
- export declare function zonedInputValue(epochMs: number, timeZone?: string): string;
46
- /**
47
- * Parse a `datetime-local` input value back to an instant, read in an explicit
48
- * zone. Returns undefined when the text is not a whole calendar wall clock or
49
- * names one the zone skips (a spring-forward gap), so the editor can refuse an
50
- * unusable instant instead of silently moving it.
51
- * @param value - the input text.
52
- * @param timeZone - zone to interpret it in; absent uses the Host zone.
53
- * @returns the instant, or undefined when it is not a usable wall clock.
54
- */
55
- export declare function parseZonedInput(value: string, timeZone?: string): number | undefined;
56
- /**
57
- * The default instant a new one-shot editor opens on: the next whole hour,
58
- * rendered in the zone the rule will be read in.
59
- * @param now - reference instant.
60
- * @param timeZone - zone the rule is read in.
61
- * @returns the input value for a near-future default.
62
- */
63
- export declare function defaultZonedInputValue(now: number, timeZone?: string): string;
64
- /**
65
- * The editor's run-cap option for a stored cap: the two named presets, the
66
- * unlimited entry, or a custom value the editor shows in its own field.
67
- * @param maxRuns - the stored cap, when any.
68
- * @returns the select option value.
69
- */
70
- export declare function runCapOption(maxRuns: number | undefined): string;
71
- /** The locale key describing why a rule stopped or skipped an occurrence. */
72
- export declare function stopReasonKey(reason: ScheduleStopReason): TaskBoardKey;
73
- /**
74
- * The run-budget line: how many scheduled executions the Host opened and how
75
- * many remain. Derived from the counter and the cap rather than stored, so the
76
- * display cannot drift from the ledger.
77
- * @param rule - the schedule rule.
78
- * @returns localized wording.
79
- */
80
- export declare function budgetLabel(rule: ScheduleRule): string;
81
- /** The line describing a rule that stopped itself, or undefined while it may still fire. */
82
- export declare function endedLabel(rule: ScheduleRule): string | undefined;
83
- /** The line describing the last skipped occurrence, or undefined when none. */
84
- export declare function skippedLabel(rule: ScheduleRule): string | undefined;
85
- /**
86
- * The full next-run label: the absolute wall clock in the schedule's own zone,
87
- * plus the relative distance in parentheses. Showing both matters because a
88
- * rule's zone can differ from the reader's, so the wall clock alone is
89
- * ambiguous and the distance alone loses the actual moment.
90
- * @param targetMs - the instant being described.
91
- * @param timeZone - zone to render the absolute half in.
92
- * @param formatAbsolute - formatter for the absolute half (keeps Intl caching in the caller).
93
- * @param now - the reference instant.
94
- * @param translate - translate function, bound so this module stays dependency-light.
95
- * @returns the combined label.
96
- */
97
- export declare function nextRunLabel(targetMs: number, timeZone: string | undefined, formatAbsolute: (ms: number, timeZone?: string) => string, now: number): string;
@@ -1,18 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import { type TaskBoardCardDecorationProps, type TaskBoardDetailSectionProps, type TaskBoardSettingsSectionProps } from '../core/extension.ts';
3
- /** The three provider seats, adapted to plain render functions. */
4
- export interface TaskBoardSeats {
5
- detailSection: (props: TaskBoardDetailSectionProps) => ReactNode;
6
- settingsSection: (props: TaskBoardSettingsSectionProps) => ReactNode;
7
- cardDecoration: (props: TaskBoardCardDecorationProps) => ReactNode;
8
- }
9
- /** Nothing registered: every seat renders empty. */
10
- export declare const EMPTY_TASK_BOARD_SEATS: TaskBoardSeats;
11
- /** The framework `renderSlot` binding shape (key + owner props share). */
12
- export type SlotRenderBinding = (key: string, owner: Record<string, unknown>) => ReactNode;
13
- /** Adapt one framework renderSlot binding to the board's seat interface. */
14
- export declare function seatsFromRenderSlot(renderSlot: SlotRenderBinding | undefined): TaskBoardSeats;
15
- /** Provider the board's registered components wrap their subtree in. */
16
- export declare const TaskBoardSeatsProvider: import("react").Provider<TaskBoardSeats>;
17
- /** Read the current seat set (empty when no board registration is above). */
18
- export declare function useTaskBoardSeats(): TaskBoardSeats;
@@ -1,35 +0,0 @@
1
- /**
2
- * The board's browser-half extension service (`taskBoard`).
3
- *
4
- * It gives a provider's browser half the client capability face from the
5
- * contract: dispatch over the board's same-origin action channel, card
6
- * visibility predicates, and a subscription to the board mirror. The board
7
- * controller is attached and detached as the master switch mounts and unmounts
8
- * the UI, so the service can be provided before any controller exists.
9
- *
10
- * @module dsh-task-board/client/service
11
- */
12
- import type { BoardController } from '../core/controller.ts';
13
- import type { TaskBoardClientFace, TaskBoardClientMirror, TaskBoardExtensionActionRequest, TaskBoardGroupingSelector, TaskBoardVisibilityPredicate } from '../core/extension.ts';
14
- export declare class TaskBoardClientService implements TaskBoardClientFace {
15
- private controller;
16
- private enabled;
17
- private unsubscribeController;
18
- /** Predicates registered before the controller exists, replayed on attach. */
19
- private readonly pendingVisibility;
20
- /** Source selectors registered before the controller exists, replayed on attach. */
21
- private readonly pendingGrouping;
22
- private readonly listeners;
23
- /** Bind the live board controller (called when the UI mounts). */
24
- attach(controller: BoardController): void;
25
- /** Release the current controller (called when the UI unmounts). */
26
- detach(): void;
27
- /** Apply the board's master switch. */
28
- setEnabled(enabled: boolean): void;
29
- dispatch(request: TaskBoardExtensionActionRequest): Promise<boolean>;
30
- registerVisibility(predicate: TaskBoardVisibilityPredicate): () => void;
31
- registerGrouping(selector: TaskBoardGroupingSelector): () => void;
32
- subscribe(callback: (mirror: TaskBoardClientMirror) => void): () => void;
33
- snapshot(): TaskBoardClientMirror;
34
- private notify;
35
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Family settings form bound to the profile entry id a Host actually serves.
3
- *
4
- * Under the 0.1.7 settings model a form is addressed by PROFILE ENTRY ID, while
5
- * a family card knows only its own settings namespace. The family binder
6
- * (`ctx.get('webUiSettings')`, published by dsh-web-settings) resolves one onto
7
- * the other and is the preferred transport; this module is the fallback for a
8
- * page that serves no binder — the group plugin is not installed, or its client
9
- * half has not applied yet (the aggregate mounts its children in order, and a
10
- * child still waiting on its own injects publishes nothing).
11
- *
12
- * The shared describe mirror is the only local evidence of which row id this
13
- * profile serves, but it answers asynchronously: at plugin activation it usually
14
- * holds nothing yet. A one-shot guess therefore cannot be right for every
15
- * deployment, and the form is bound once per session:
16
- *
17
- * - binding the bare namespace made every save answer `No configurable plugin
18
- * entry "<namespace>"` on an aggregate install (the namespace is not an entry
19
- * id there), which the card reported as "the deployment did not accept these
20
- * values";
21
- * - binding the aggregate row id would break a standalone install, whose row id
22
- * is the namespace or the package's own `ui-*` row.
23
- *
24
- * So the fallback starts on the most likely row and REBINDS the moment the
25
- * mirror names one of this package's rows. Until the mirror answers, the form
26
- * reports the binding it holds (usually `loading`), which the card renders as an
27
- * unavailable form rather than a doomed one.
28
- */
29
- import type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client';
30
- /** Options of {@link createServedEntryForm}. */
31
- export interface ServedEntryFormOptions<T> {
32
- /** The shared configuration forms service (`ctx.configForms`). */
33
- forms: ConfigForms;
34
- /**
35
- * Profile entry ids this package's rows carry, most likely first: the
36
- * aggregate's generated row, the package's own standalone row, then the bare
37
- * namespace. The first is the fallback while the mirror has no answer; the
38
- * last is the answer when the mirror serves none of them.
39
- */
40
- entryIds: readonly string[];
41
- }
42
- /**
43
- * Create a settings form bound to the profile entry id this Host serves, and
44
- * rebound whenever the shared describe mirror names a different one of this
45
- * package's rows.
46
- * @param options - the shared forms service and this package's candidate row ids.
47
- * @returns a form delegating to the currently resolved entry's own form.
48
- */
49
- export declare function createServedEntryForm<T>(options: ServedEntryFormOptions<T>): ConfigForm<T>;
@@ -1,235 +0,0 @@
1
- /**
2
- * Form model behind the plugin settings card. Every control applies itself:
3
- * a pick (a segment, a select option, a reset) writes the moment it is made,
4
- * and typed text writes once typing pauses or the reader leaves the field.
5
- * Between the edit and the write the edit is held here as a draft, so what is
6
- * on screen is exactly what the write will store; a write the Host refuses
7
- * puts a pick back to the stored value and keeps typed text for correcting.
8
- * Family-shared slice inlined into each plugin's client bundle.
9
- */
10
- import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
11
- import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
12
- /** The write one field's draft text performs when it is applied. */
13
- export type FieldWrite = {
14
- kind: 'set';
15
- value: unknown;
16
- } | {
17
- kind: 'clear';
18
- };
19
- /** How one field converts between its stored value and its draft text. */
20
- export interface FieldSpec {
21
- /** Field name inside the namespace section. */
22
- field: string;
23
- /**
24
- * How the reader enters a value, which decides when it is written: a `pick`
25
- * is a whole value at once and applies immediately; `type` is text arriving
26
- * a keystroke at a time and applies once typing pauses or the field is left.
27
- */
28
- entry: 'pick' | 'type';
29
- /**
30
- * Whether the Host treats this field as a secret and redacts its value from
31
- * the read-back (role('secret') in the section schema). Redacted secrets are
32
- * never compared against the draft on save: the Host strips them from every
33
- * wire view layer, so the settled snapshot carries nothing to read back. A
34
- * staged secret set is judged by the mutation settling; the rest of its
35
- * batch, when one exists, is still judged by read-back, and the atomic
36
- * mutation lands every write or none.
37
- */
38
- secret?: boolean;
39
- /** Render a stored value as draft text; the empty string when the section carries none. */
40
- format: (value: unknown) => string;
41
- /**
42
- * The write this draft text performs, or undefined when the text is not a
43
- * value this field accepts — which holds the draft unwritten rather than
44
- * discarding it.
45
- */
46
- parse: (text: string) => FieldWrite | undefined;
47
- }
48
- /** One field as the card renders it. */
49
- export interface FieldState {
50
- /** Draft text the control renders. */
51
- text: string;
52
- /** Whether the field leaves (or will leave) a user-layer entry. */
53
- overridden: boolean;
54
- /** Whether the draft is not a value this field accepts, which holds it unwritten. */
55
- invalid: boolean;
56
- }
57
- /** Form state every plugin settings card shares. */
58
- export interface CardShell {
59
- /** False while the namespace is still loading; the card renders nothing. */
60
- available: boolean;
61
- /**
62
- * Whether the namespace is actually served to this client. False when the
63
- * Host deployment does not expose it (e.g. the owning plugin's settings
64
- * domain is not mounted): the card renders an explanation
65
- * instead of its form, so a missing namespace never looks like a missing
66
- * plugin.
67
- */
68
- exposed: boolean;
69
- /** Whether the Host document accepts writes. */
70
- writable: boolean;
71
- /** Whether the form holds drafts not yet written (typed text waiting for its pause). */
72
- dirty: boolean;
73
- /** Whether any draft is invalid, which holds it unwritten. */
74
- invalid: boolean;
75
- /** Whether a write is crossing the wire. */
76
- saving: boolean;
77
- /** Whether the last write did not land; cleared by the next edit or write. */
78
- failed: boolean;
79
- /**
80
- * The rejection code/message the Host returned for the last failed save,
81
- * surfaced next to the generic failure text. Undefined while no save has
82
- * failed (or the failure carried no server reason).
83
- */
84
- failedReason?: string;
85
- }
86
- /** The write actions the card's slot entry injects. */
87
- export interface CardActions {
88
- /** Take draft text for one field; a pick writes at once, typed text after a pause. */
89
- edit: (field: string, text: string) => void;
90
- /** Clear one field at once, so it re-inherits the composition layer. */
91
- resetField: (field: string) => void;
92
- /** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */
93
- save: () => void;
94
- /** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */
95
- discard: () => void;
96
- }
97
- /** How long typed text rests before it is written. */
98
- export declare const TYPE_PAUSE_MS = 600;
99
- /** One durable write inside the save's atomic form mutation. */
100
- export interface BatchedWrite {
101
- /** Field this entry writes. */
102
- field: string;
103
- /** set stores a value; unset drops the leaf. */
104
- op: 'set' | 'unset';
105
- /** Value for op set (absent for unset). */
106
- value?: unknown;
107
- }
108
- /** Constraints a numeric field's accepted drafts must satisfy, mirroring the host schema. */
109
- export interface NumberConstraints {
110
- /** The accepted value must be a whole number. */
111
- integer?: boolean;
112
- /** The accepted value must be at least this. */
113
- min?: number;
114
- }
115
- /** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
116
- export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
117
- /**
118
- * A free-text field. An empty draft clears the field. `entry` is `pick` when
119
- * the text arrives whole from a picker (a preset or a reasoning level).
120
- */
121
- export declare function textField(field: string, entry?: FieldSpec['entry']): FieldSpec;
122
- /**
123
- * A free-text field the Host treats as a secret and redacts from the read-back
124
- * (role('secret') in the section schema). The card still edits it like text,
125
- * but a save never compares the redacted value back: the staged set is judged
126
- * by the mutation settling (see {@link FieldSpec.secret}).
127
- */
128
- export declare function secretField(field: string): FieldSpec;
129
- /** A boolean field, edited through true/false draft text. */
130
- export declare function booleanField(field: string): FieldSpec;
131
- /** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */
132
- export declare function choiceField(field: string, choices: readonly string[]): FieldSpec;
133
- /**
134
- * Applies one card's edits to one settings namespace as the reader makes them.
135
- *
136
- * The Host is the only authority on whether a value was accepted — its
137
- * validators own the constraints no schema can express — so the outcome is
138
- * read back from the section rather than predicted here. A write that did not
139
- * land puts each pick back to the stored value, the way a switch that could not
140
- * flip springs back, and keeps typed text so the reader can correct it instead
141
- * of retyping.
142
- */
143
- export declare class CardForm<T> {
144
- private readonly scope;
145
- private readonly specs;
146
- private readonly staged;
147
- private readonly listeners;
148
- /** The form subscription installed in the constructor; released by dispose(). */
149
- private readonly disposeForm;
150
- private disposed;
151
- /** The pending write of typed text, waiting for typing to pause. */
152
- private typePause;
153
- private saving;
154
- /** A save asked for while one was in flight; it runs once the first settles (#1754). */
155
- private saveQueued;
156
- private failed;
157
- private failedReason;
158
- /** @param scope - the bound configuration form for this card's namespace. */
159
- constructor(scope: ConfigForm<T>, specs: FieldSpec[]);
160
- /**
161
- * Release the form subscription and every bound store listener. The card
162
- * must call this on teardown; later calls are no-ops.
163
- */
164
- dispose(): void;
165
- /** Publish a projection of this form, rebuilt whenever the form or a draft changes. */
166
- bind<S>(project: () => S): SnapshotStore<S>;
167
- /** Read the card-level state: what the Host serves, and what is still waiting to be written. */
168
- shell(): CardShell;
169
- /** Read one field's state from the effective section and its staged draft. */
170
- field(field: string): FieldState;
171
- /** The actions the card's slot registration injects. */
172
- actions(): CardActions;
173
- /**
174
- * Run one write, and re-run it once if another was asked for while this one
175
- * was still in flight.
176
- *
177
- * A write is a Host round trip that also drives the profile reconcile, and
178
- * the Host runs it inside one exclusive transaction. Answering an edit that
179
- * arrives mid-flight by returning immediately dropped it with no explanation
180
- * (#1754). Serializing instead means an edit made while another write is
181
- * still settling is written against the settled state.
182
- * @returns settlement after the mutation and the read-back.
183
- */
184
- requestSave(): Promise<void>;
185
- /**
186
- * Write every valid draft in one atomic form mutation, then re-seed from
187
- * what the Host accepted. A draft the field does not accept stays on screen,
188
- * unwritten, without holding the others back.
189
- *
190
- * The batch rides one mutate, so cross-field validate hooks (baseURL+model)
191
- * judge it as a unit: the Host either applies every write or refuses the
192
- * batch. The form contract answers a refusal or a skipped write with `false`
193
- * (it recovers with a fresh Host view instead of throwing), so the outcome is
194
- * judged twice: the answer itself, and then the settled snapshot read back
195
- * one planned write at a time. One missed write fails the whole batch. A
196
- * transport that rejects instead (the dsh-web bridge controller on a dead
197
- * connection) reports through the same failure path with its rejection
198
- * message. A batch that did not land puts its picks and clears back to the
199
- * stored value and keeps its typed text, so the reader can correct it.
200
- * @returns settlement after the mutation and the read-back.
201
- */
202
- save(): Promise<void>;
203
- /**
204
- * Every staged edit a write would carry. An entry whose draft is not a value
205
- * its field accepts carries no write: the form is still dirty, and the draft
206
- * stays on screen rather than being dropped. A staged edit that matches the
207
- * effective section is not a write at all.
208
- * @returns the planned writes, in the order the fields were staged.
209
- */
210
- private plan;
211
- /**
212
- * Read-back judgment for a planned set: the user layer must hold the
213
- * intended value once the mutation has settled.
214
- */
215
- private landedSet;
216
- /**
217
- * Read-back judgment for a planned unset: the field must be gone from the
218
- * user layer once the mutation has settled.
219
- */
220
- private landedUnset;
221
- /**
222
- * Take one edit and schedule its write: a pick or a clear is written now,
223
- * typed text once typing has rested for TYPE_PAUSE_MS.
224
- */
225
- private stage;
226
- /** Write every pending draft now, taking the place of a waiting pause. */
227
- private applyNow;
228
- private specOf;
229
- private snapshotOf;
230
- private sectionValue;
231
- private baseValue;
232
- private userLayer;
233
- private stored;
234
- private publish;
235
- }