@nac3/runtime 2.6.0 → 2.8.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.
package/dist/nac.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Generated by build.mjs -- do not edit. Source: js/nac.js
2
- // Core runtime surface for @nac3/runtime v2.6.0.
2
+ // Core runtime surface for @nac3/runtime v2.8.0.
3
3
  // The data-table (dt_*) + brownfield primitives live in the
4
4
  // extensions entry: import '@nac3/runtime/extensions' and see
5
5
  // the NACExtensions interface in nac-v2-extensions.d.ts.
@@ -21,6 +21,10 @@ export interface ManifestElement {
21
21
  role: string;
22
22
  label_i18n?: Record<string, string>;
23
23
  actions?: Array<{ verb: string; label_i18n?: Record<string, string> }>;
24
+ /** The id that has to be operated before this element can be
25
+ * (SPEC.md 4.2, since 2.7.0). click() still refuses the element
26
+ * while it is hidden, and names this id when it does. */
27
+ undrivable_until?: string;
24
28
  [k: string]: unknown;
25
29
  }
26
30
 
@@ -80,6 +84,9 @@ export interface PluginDescriptor {
80
84
  slug: string;
81
85
  label: string | null;
82
86
  hint: string | null;
87
+ /** v2.7 (SPEC 19.1): does this plugin declare the headless profile --
88
+ every binding reachable with no document at all? */
89
+ headless: boolean;
83
90
  verbs: Array<{
84
91
  verb_path: string;
85
92
  backend: string | null;
@@ -105,6 +112,45 @@ export interface PluginDescriptor {
105
112
  }>;
106
113
  }
107
114
 
115
+ /** What NAC.profile() answers (v2.7, SPEC 19.1). `headless` is
116
+ MEASURED from the manifest; `declared_headless` is what the
117
+ manifest claimed. They differ when a manifest would work with no
118
+ document but never said so. */
119
+ export interface PluginProfile {
120
+ slug: string;
121
+ declared_headless: boolean;
122
+ headless: boolean;
123
+ dom_required: Array<{
124
+ kind: 'verb' | 'state' | 'event';
125
+ path: string;
126
+ backend: string | null;
127
+ why: string;
128
+ binding_index?: number;
129
+ observes?: string;
130
+ }>;
131
+ }
132
+
133
+ /** One provenance row as a sink receives it (v2.7, SPEC 19.4). Same
134
+ type names and same detail shape as the DOM event family of 15.7 --
135
+ the bus changes, the contract does not. */
136
+ export interface ProvenanceRow {
137
+ type: string;
138
+ detail: Record<string, unknown>;
139
+ }
140
+
141
+ /** What NAC.provenanceStatus() answers (v2.7, SPEC 19.4). `dropped`
142
+ counts the rows that reached NEITHER bus, so a loss outside the
143
+ headless profile is readable instead of silent. */
144
+ export interface ProvenanceStatus {
145
+ document: boolean;
146
+ sink: boolean;
147
+ observable: boolean;
148
+ to_document: number;
149
+ to_sink: number;
150
+ dropped: number;
151
+ sink_errors: number;
152
+ }
153
+
108
154
  /** Subscription handle returned by NAC.subscribe (V25-01). */
109
155
  export interface SubscriptionHandle {
110
156
  __v25_sub: true;
@@ -144,6 +190,26 @@ export interface NACRuntime {
144
190
  list(...args: unknown[]): unknown;
145
191
  find(...args: unknown[]): unknown;
146
192
  read_feedback(...args: unknown[]): unknown;
193
+
194
+ /* the role vocabulary (v2.8). Typed out in full rather than as
195
+ unknown[], because the whole point of 2.8 is that a consumer can
196
+ learn the vocabulary without reading the implementation -- and a
197
+ declaration that says unknown sends it back to the source. */
198
+ roles(): {
199
+ spec_version: string;
200
+ canonical: string[];
201
+ aliases: Record<string, string>;
202
+ registered: Array<{
203
+ role: string; events: string[]; clickable: boolean;
204
+ describes: string | null; plugin: string | null; source: 'registered';
205
+ }>;
206
+ click_events: Record<string, string[]>;
207
+ no_click_event: string[];
208
+ };
209
+ canonical_role(role: string): string;
210
+ register_role(name: string, spec?: {
211
+ events?: string[]; describes?: string; plugin?: string;
212
+ }): { ok: true; role: string; already: boolean };
147
213
  snapshot_state(...args: unknown[]): unknown;
148
214
  validate(...args: unknown[]): unknown;
149
215
  validate_global(): ValidateGlobalReport;
@@ -183,7 +249,7 @@ export interface NACRuntime {
183
249
  revoke_authority(scope: string): void;
184
250
 
185
251
  /* v2.5 V25-01 Block A -- plugin extension contract (canvas + API) */
186
- registerPlugin(slug: string, manifest: { label?: string; hint?: string; verbs?: object; state?: object; events?: object }): void;
252
+ registerPlugin(slug: string, manifest: { label?: string; hint?: string; headless?: boolean; verbs?: object; state?: object; events?: object }): void;
187
253
  call(plugin: string, verb_path: string, args?: unknown): Promise<unknown>;
188
254
  read(plugin: string, state_path: string): Promise<unknown>;
189
255
  subscribe(plugin: string, event_path: string, cb: (...args: unknown[]) => void): SubscriptionHandle;
@@ -198,6 +264,16 @@ export interface NACRuntime {
198
264
  unregisterApiHandle(name: string): boolean;
199
265
  apiHandles(): string[];
200
266
 
267
+ /* v2.7 -- the headless profile (SPEC 19, decision D-26). The manifest
268
+ IS the surface where no document exists: profile() says whether a
269
+ plugin needs one, setEventSink() carries the nac:plugin:* family
270
+ over a bus that is not the DOM, and provenanceStatus() makes both
271
+ the delivery and any loss readable. */
272
+ profile(slug: string): PluginProfile;
273
+ setEventSink(fn: ((row: ProvenanceRow) => void) | null): ((row: ProvenanceRow) => void) | null;
274
+ eventSink(): ((row: ProvenanceRow) => void) | null;
275
+ provenanceStatus(): ProvenanceStatus;
276
+
201
277
  /* v2.5 V25-03 Block C -- asistive labels */
202
278
  narrate(plugin: string | null, nac_id: string): string | null;
203
279