@vehicle-sil/gui-client 0.1.0 → 0.2.0-rc.2

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 (39) hide show
  1. package/README.ja.md +412 -96
  2. package/README.md +403 -89
  3. package/dist/elements.js +872 -0
  4. package/dist/index.js +2869 -259
  5. package/package.json +20 -2
  6. package/timeline/vehicle-sil-timeline.d.ts +108 -0
  7. package/timeline/vehicle-sil-timeline.js +4577 -0
  8. package/timeline/vehicle-sil-timeline.mjs +4579 -0
  9. package/types/client.d.ts +47 -7
  10. package/types/connection.d.ts +4 -0
  11. package/types/elements/index.d.ts +25 -0
  12. package/types/elements/outside-parts.d.ts +20 -0
  13. package/types/elements/page-intent.d.ts +10 -0
  14. package/types/elements/part.d.ts +48 -0
  15. package/types/elements/reasons.d.ts +12 -0
  16. package/types/elements/run-parts.d.ts +21 -0
  17. package/types/elements/scenario-parts.d.ts +18 -0
  18. package/types/elements/variable-parts.d.ts +28 -0
  19. package/types/front-actions.d.ts +130 -0
  20. package/types/front-compose.d.ts +61 -0
  21. package/types/front-outside.d.ts +19 -0
  22. package/types/front-types.d.ts +360 -0
  23. package/types/front-variable.d.ts +28 -0
  24. package/types/front.d.ts +50 -0
  25. package/types/index.d.ts +13 -5
  26. package/types/protocol/launcher.d.ts +581 -0
  27. package/types/protocol/read.d.ts +72 -0
  28. package/types/protocol/server.d.ts +780 -0
  29. package/types/protocol.d.ts +10 -972
  30. package/types/run.d.ts +21 -6
  31. package/types/session-state.d.ts +66 -10
  32. package/types/session.d.ts +48 -2
  33. package/types/time.d.ts +16 -45
  34. package/types/values.d.ts +2 -0
  35. package/types/variable-binding.d.ts +20 -5
  36. package/types/variable-editor.d.ts +25 -0
  37. package/types/variable-state.d.ts +12 -6
  38. package/types/variables.d.ts +36 -4
  39. package/types/waveforms.d.ts +14 -0
@@ -1,5 +1,6 @@
1
1
  import { HttpTransport } from './http.js';
2
2
  import { Open } from './protocol.js';
3
+ import type { VariableAvailability } from './protocol.js';
3
4
  import { ErrorSink, Readable } from './values.js';
4
5
  import type { BindOptions, VariableBinding } from './variable-binding.js';
5
6
  /**
@@ -54,6 +55,13 @@ export interface VariablesState {
54
55
  /** Why the API is unavailable or cannot connect (the server's English text). null if none. */
55
56
  reason: string | null;
56
57
  peers: VariablePeer[];
58
+ /**
59
+ * Whether each ECU uses each variable now (participant, then variable name): information only (it changes neither
60
+ * how the variable is read nor whether it can be written). Kept apart from `peers`, which holds the declared
61
+ * definitions, so that a notification replaces this table and leaves `peers` as it is. Every variable in `peers` has
62
+ * an entry; `active` when the server does not say.
63
+ */
64
+ availability: ReadonlyMap<string, ReadonlyMap<string, VariableAvailability>>;
57
65
  /** Number of participants and variables beyond the limit that the server did not keep. */
58
66
  peersOmitted: number;
59
67
  variablesOmitted: number;
@@ -125,6 +133,13 @@ export interface OperationPeer {
125
133
  late: boolean;
126
134
  /** Why it went wrong (English text from the ECU or the Control Server). */
127
135
  reason: string | null;
136
+ /**
137
+ * How many of this participant's writes took effect, counted from the first (its writes are those
138
+ * of the request for it, in order). null: not known.
139
+ */
140
+ appliedWrites: number | null;
141
+ /** Position (from 0) of the write that `reason` is about. null: none, or not known. */
142
+ failedWrite: number | null;
128
143
  }
129
144
  /** Result of a write (operation). */
130
145
  export interface OperationView {
@@ -199,7 +214,10 @@ export declare class WriteError extends Error {
199
214
  export interface ClientVariables {
200
215
  /** List and state of the variables. */
201
216
  readonly state: Readable<VariablesState>;
202
- /** Recent operations (results of writes; oldest first, up to OPERATIONS_KEPT; includes other clients' writes). */
217
+ /**
218
+ * Recent operations (results of writes; oldest first, up to OPERATIONS_KEPT; includes other clients' writes, not a
219
+ * scenario's own writes).
220
+ */
203
221
  readonly operations: Readable<readonly OperationView[]>;
204
222
  /**
205
223
  * The server refused a watch (`invalid-watch`, `too-many-watches`; null if not). Values of the refused subscription
@@ -259,7 +277,7 @@ export declare function readOperation(value: unknown, session: number): Operatio
259
277
  export interface VariablesLink {
260
278
  /** Sends if connected (does nothing otherwise; resume() sends what is needed on connect). */
261
279
  send(message: unknown): unknown;
262
- onBatch(listener: (batch: readonly unknown[]) => void): () => void;
280
+ onBatch(listener: (batch: readonly unknown[], current?: () => boolean, snapshotVersion?: number) => void): () => void;
263
281
  }
264
282
  /**
265
283
  * ECU variables: list and state, value watches, writes and their results. No framework needed.
@@ -281,6 +299,10 @@ export declare class VariablesFeed implements Omit<ClientVariables, 'bind'> {
281
299
  private readonly onError;
282
300
  /** Limits (from limits of api/app; the defaults until then). */
283
301
  private readonly limits;
302
+ private instanceId;
303
+ private snapshotVersionValue;
304
+ private snapshotIdentity;
305
+ private serverRevision;
284
306
  private readonly stateValue;
285
307
  private readonly operationsValue;
286
308
  private readonly handles;
@@ -314,8 +336,17 @@ export declare class VariablesFeed implements Omit<ClientVariables, 'bind'> {
314
336
  /** The client was closed: fail the pending writes (including those waiting for the HTTP answer). Watches stay. */
315
337
  dispose(): void;
316
338
  private receive;
317
- /** Applies the variables part of hello and of an HTTP summary (`session`). */
318
- adoptSummary(summary: unknown): void;
339
+ /** Returns whether any state changed. Only the availability table changes: `peers` keeps its identity. */
340
+ private takeAvailability;
341
+ snapshotVersion(): number;
342
+ /** Compare server capture order when available; legacy peers use the local best-effort watermark. */
343
+ isSnapshotCurrent(version: number, instance: string | null, session: number | null, rev: number | null): boolean;
344
+ private markSnapshot;
345
+ private applySnapshot;
346
+ /** A reused numeric session on another server is a different run. */
347
+ adoptInstance(value: unknown): void;
348
+ /** Applies a summary: an older snapshot can still carry a terminal write result. */
349
+ adoptSummary(summary: unknown, current?: () => boolean, snapshotCurrent?: () => boolean): number | null;
319
350
  /**
320
351
  * With the summary after a reconnect (or from api/session), settles as "no answer came" (lost) the writes waiting for
321
352
  * a result that will no longer arrive. For writes whose number is not known yet (before the HTTP answer), the summary
@@ -339,6 +370,7 @@ export declare class VariablesFeed implements Omit<ClientVariables, 'bind'> {
339
370
  * settled operations cut from the list are picked up from here.
340
371
  */
341
372
  private setOperations;
373
+ private prepareOperations;
342
374
  private settle;
343
375
  write(writes: Record<string, Record<string, number | boolean | string>>, options?: WriteOptions): Promise<OperationView>;
344
376
  watch(variables: readonly VariableRef[] | 'all', options?: WatchOptions): VariableWatch;
@@ -0,0 +1,14 @@
1
+ import { type GuiClient } from './client.js';
2
+ import { type Readable } from './values.js';
3
+ import type { HistoryPoint, VariableRef, WatchOptions } from './variables.js';
4
+ export interface WaveformSeries {
5
+ readonly ref: Readonly<VariableRef>;
6
+ readonly points: readonly Readonly<HistoryPoint>[];
7
+ }
8
+ export interface Waveforms {
9
+ readonly series: Readable<readonly WaveformSeries[]>;
10
+ setSignals(refs: readonly VariableRef[]): void;
11
+ close(): void;
12
+ }
13
+ /** Keeps histories for the selected signals of the current run in selection order. */
14
+ export declare function createWaveforms(client: GuiClient, options?: WatchOptions): Waveforms;