@vehicle-sil/gui-client 0.5.0 → 0.6.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/README.ja.md +452 -744
- package/README.md +451 -741
- package/dist/elements.js +656 -47
- package/dist/empty.js +2 -0
- package/dist/index.js +3202 -1813
- package/package.json +13 -1
- package/timeline/vehicle-sil-timeline.d.ts +76 -0
- package/timeline/vehicle-sil-timeline.js +817 -139
- package/timeline/vehicle-sil-timeline.mjs +817 -139
- package/types/client.d.ts +13 -0
- package/types/connection.d.ts +10 -2
- package/types/elements/contracts.d.ts +112 -0
- package/types/elements/index.d.ts +5 -3
- package/types/elements/outside-parts.d.ts +5 -0
- package/types/elements/page-intent.d.ts +1 -1
- package/types/elements/part.d.ts +11 -4
- package/types/elements/run-parts.d.ts +19 -0
- package/types/elements/scenario-parts.d.ts +5 -1
- package/types/elements/variable-parts.d.ts +58 -11
- package/types/frameworks/all-contracts.d.ts +18 -0
- package/types/frameworks/react.d.ts +40 -0
- package/types/frameworks/svelte.d.ts +22 -0
- package/types/frameworks/vue.d.ts +35 -0
- package/types/front-actions.d.ts +18 -0
- package/types/front-types.d.ts +63 -8
- package/types/front-variable.d.ts +5 -0
- package/types/front.d.ts +11 -24
- package/types/http.d.ts +2 -0
- package/types/index.d.ts +4 -4
- package/types/protocol/launcher.d.ts +70 -1
- package/types/protocol/server.d.ts +36 -1
- package/types/session-state.d.ts +7 -1
- package/types/variable-binding.d.ts +3 -1
- package/types/variables.d.ts +92 -50
package/types/front-types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GuiClient } from './client.js';
|
|
2
2
|
import type { RunTarget } from './session.js';
|
|
3
|
-
import type { AfterScenario, CheckResult, ConfigList, ConfigText, SavedConfig, Finding, OutsideState, Recording, RunAck, RunEnd, RuntimeStatus, ScenarioFile, ScenarioStatus, ScenarioStep } from './protocol.js';
|
|
3
|
+
import type { AfterScenario, CheckResult, CheckScenarioParam, ConfigList, ConfigText, SavedConfig, Finding, Open, OutsideState, Recording, RunAck, RunEnd, RuntimeStatus, ScenarioFile, ScenarioStatus, ScenarioStep } from './protocol.js';
|
|
4
4
|
import type { ValueCondition, WriteBlock, WriteStatus } from './variable-state.js';
|
|
5
|
-
import type { VariableRef, VariableValue } from './variables.js';
|
|
5
|
+
import type { VariableRef, VariableValue, WriteWaitOptions } from './variables.js';
|
|
6
6
|
import type { Readable } from './values.js';
|
|
7
7
|
import type { Reason } from './session-state.js';
|
|
8
8
|
/** A reason: a code that stays the same and one English sentence (defined with the session copy, which reads them too). */
|
|
@@ -96,6 +96,10 @@ export type OperationName = keyof FrontControls;
|
|
|
96
96
|
export interface FrontScenario {
|
|
97
97
|
file: string;
|
|
98
98
|
name: string | null;
|
|
99
|
+
/** Selected case name, if any. */
|
|
100
|
+
case?: string | null;
|
|
101
|
+
/** Resolved parameters of the scenario, if any. */
|
|
102
|
+
params?: readonly CheckScenarioParam[];
|
|
99
103
|
status: ScenarioStatus | null;
|
|
100
104
|
handed_over: boolean;
|
|
101
105
|
over_at_ms: number | null;
|
|
@@ -135,6 +139,8 @@ export interface Intent {
|
|
|
135
139
|
* the path the request file needs, which is relative to the configuration file's directory). Do not compose it.
|
|
136
140
|
*/
|
|
137
141
|
scenario?: string;
|
|
142
|
+
/** The named case of the scenario (`cases:`). Requires `scenario`. */
|
|
143
|
+
case?: string;
|
|
138
144
|
/** What to do once the scenario passes (`stop`, or `pause` to hand over to manual control). */
|
|
139
145
|
after_scenario?: AfterScenario;
|
|
140
146
|
variant?: string;
|
|
@@ -153,7 +159,7 @@ export interface Intent {
|
|
|
153
159
|
*/
|
|
154
160
|
connect?: Record<string, string>;
|
|
155
161
|
/** A run connected outside keeps real time (`realtime`, the launcher's default) unless `free` is chosen. */
|
|
156
|
-
time_policy?: 'realtime' | 'free'
|
|
162
|
+
time_policy?: Open<'realtime' | 'free'>;
|
|
157
163
|
}
|
|
158
164
|
/** A place where a network can be connected, as the bridge of one backend listed it. */
|
|
159
165
|
export interface ConnectTarget {
|
|
@@ -257,15 +263,64 @@ export interface VariableView {
|
|
|
257
263
|
block: WriteBlock | null;
|
|
258
264
|
write_status: WriteStatus;
|
|
259
265
|
}
|
|
266
|
+
/** Options of `variable.enqueue(value, options)` and `variable.write(value, options)`. */
|
|
267
|
+
export interface FrontWriteOptions {
|
|
268
|
+
/** Virtual time at which to apply the write (ms). Omitted: the next step of the ECU. */
|
|
269
|
+
atMs?: number;
|
|
270
|
+
/** If `atMs` cannot be met: `'reject'` (default; not applied) or `'apply'` (applied in the next step). */
|
|
271
|
+
late?: 'reject' | 'apply';
|
|
272
|
+
/** Watchdog timeout budget (ms; default `WRITE_TIMEOUT_MS`). Must be a finite number greater than 0. */
|
|
273
|
+
timeoutMs?: number;
|
|
274
|
+
/** Forwarded to `fetch(..., { keepalive })` so a release write sent on `pagehide` can outlive the page. */
|
|
275
|
+
keepalive?: boolean;
|
|
276
|
+
/** Aborts the write or wait (`ActionError('aborted', ...)`). */
|
|
277
|
+
signal?: AbortSignal;
|
|
278
|
+
}
|
|
279
|
+
/** Confirmed application of a variable write (`queued.applied()` / `variable.write()`). */
|
|
280
|
+
export interface WriteResult {
|
|
281
|
+
readonly session: string;
|
|
282
|
+
readonly seq: number;
|
|
283
|
+
readonly peer: string;
|
|
284
|
+
readonly name: string;
|
|
285
|
+
readonly value: number | boolean | string;
|
|
286
|
+
readonly appliedAtMs: number | null;
|
|
287
|
+
readonly late: boolean;
|
|
288
|
+
}
|
|
289
|
+
/** Handle returned once the server accepted a variable write and the ECU queued it (`variable.enqueue()`). */
|
|
290
|
+
export interface QueuedWrite {
|
|
291
|
+
readonly session: string;
|
|
292
|
+
readonly seq: number;
|
|
293
|
+
readonly peer: string;
|
|
294
|
+
readonly name: string;
|
|
295
|
+
readonly value: number | boolean | string;
|
|
296
|
+
/** Resolves with `WriteResult` once the ECU applies the write in a step; rejects with `ActionError` otherwise. */
|
|
297
|
+
applied(options?: WriteWaitOptions): Promise<WriteResult>;
|
|
298
|
+
}
|
|
260
299
|
/**
|
|
261
300
|
* A variable. Values arrive while someone subscribes (the first subscription asks the server for them, the last
|
|
262
|
-
* unsubscribe stops it: there is no close()). `write`
|
|
301
|
+
* unsubscribe stops it: there is no close()). `enqueue` and `write` need no subscription.
|
|
263
302
|
*/
|
|
264
303
|
export interface FrontVariable extends Readable<VariableView> {
|
|
265
|
-
/**
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Subscribes to changes of this variable's view. Optionally requests a polling interval (`periodMs`, finite
|
|
306
|
+
* `20..60_000` ms; default: the client's `watchPeriodMs`, or `WATCH_PERIOD_MS` = 100) while this subscription is
|
|
307
|
+
* active; the shortest active interval across all subscribers wins, and the slower interval is restored when faster
|
|
308
|
+
* subscribers unsubscribe. Note: latest-value polling at 20 ms does not guarantee capturing pulses shorter than 20 ms.
|
|
309
|
+
*/
|
|
310
|
+
subscribe(listener: (value: VariableView) => void, options?: {
|
|
311
|
+
/** Requested polling interval (ms; finite `20..60_000`, rounded to `WATCH_PERIODS_MS`). */
|
|
312
|
+
periodMs?: number;
|
|
313
|
+
}): () => void;
|
|
314
|
+
/**
|
|
315
|
+
* Sends the write and resolves once the server accepted it and the ECU queued it (stages 1+2).
|
|
316
|
+
* Rejects immediately with an `ActionError` if refused or already terminally failed (`invalid`, `busy`, `late`, ...).
|
|
317
|
+
*/
|
|
318
|
+
enqueue(value: number | boolean | string, options?: FrontWriteOptions): Promise<QueuedWrite>;
|
|
319
|
+
/**
|
|
320
|
+
* Resolves with `WriteResult` when the value has been applied in an ECU step (`enqueue(v, opts).then(q => q.applied(...))`).
|
|
321
|
+
* Rejects with an `ActionError` (`no-answer` is `unknown`: it is not sent again).
|
|
322
|
+
*/
|
|
323
|
+
write(value: number | boolean | string, options?: FrontWriteOptions): Promise<WriteResult>;
|
|
269
324
|
}
|
|
270
325
|
/** The front door: `connect()` returns it. */
|
|
271
326
|
export interface Front {
|
|
@@ -8,6 +8,11 @@ import { VariableRef } from './variables.js';
|
|
|
8
8
|
export declare function noteOf(condition: ValueCondition): string | null;
|
|
9
9
|
/** Split `"Peer.variable"` at the first dot (as the scenario files do); an object is taken as it is. */
|
|
10
10
|
export declare function refOf(ref: string | VariableRef): VariableRef;
|
|
11
|
+
export declare function validateFrontWriteOptions(options: unknown): ActionError | null;
|
|
12
|
+
export declare function validateFrontWaitOptions(options: unknown): ActionError | null;
|
|
13
|
+
export declare function validateFrontSubscribeOptions(options: unknown): {
|
|
14
|
+
periodMs?: number;
|
|
15
|
+
};
|
|
11
16
|
interface Track {
|
|
12
17
|
writing: boolean;
|
|
13
18
|
problem: Reason | null;
|
package/types/front.d.ts
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
import { ClientOptions } from './client.js';
|
|
2
|
-
import type { HttpTransport } from './http.js';
|
|
3
|
-
import type { SocketFactory } from './connection.js';
|
|
4
2
|
import { Front } from './front-types.js';
|
|
5
|
-
import {
|
|
6
|
-
/** Options of `connect()
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/** HTTP transport (default: fetch). For tests. */
|
|
15
|
-
http?: HttpTransport;
|
|
16
|
-
/** Function that opens the WebSocket (default: the platform's). For tests. */
|
|
17
|
-
socket?: SocketFactory;
|
|
18
|
-
/** How long to wait for the launcher's answer to a time command (ms; default 5000). */
|
|
19
|
-
answer_timeout_ms?: number;
|
|
20
|
-
/** Receives what subscribers threw (default: console.error). */
|
|
21
|
-
on_error?: ErrorSink;
|
|
3
|
+
import { Readable } from './values.js';
|
|
4
|
+
/** Options of `connect()`: the same camelCase options as `createFront()` and `createClient()`. */
|
|
5
|
+
export type ConnectOptions = ClientOptions;
|
|
6
|
+
/** Options of `until()`. */
|
|
7
|
+
export interface UntilOptions {
|
|
8
|
+
/** Maximum wait duration in milliseconds before rejecting with `ActionError('timeout', ..., 'unknown')`. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Signal to abort the wait with `ActionError('aborted', ..., 'unknown')`. */
|
|
11
|
+
signal?: AbortSignal;
|
|
22
12
|
}
|
|
23
13
|
/**
|
|
24
14
|
* Makes the front door without connecting and without waiting for the server (as `createClient` does for the client
|
|
@@ -42,9 +32,6 @@ export declare function watch<T extends unknown[]>(sources: {
|
|
|
42
32
|
}, fn: (...values: T) => void): () => void;
|
|
43
33
|
/**
|
|
44
34
|
* Resolves with the first value that satisfies `test` (the current one counts). Rejects with an ActionError `timeout`
|
|
45
|
-
* after `
|
|
35
|
+
* after `timeoutMs`, or `aborted` when `signal` aborts (`unknown`: the thing waited for may still happen).
|
|
46
36
|
*/
|
|
47
|
-
export declare function until<T>(source: Readable<T>, test: (value: T) => boolean, options?:
|
|
48
|
-
timeout_ms?: number;
|
|
49
|
-
signal?: AbortSignal;
|
|
50
|
-
}): Promise<T>;
|
|
37
|
+
export declare function until<T>(source: Readable<T>, test: (value: T) => boolean, options?: UntilOptions): Promise<T>;
|
package/types/http.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface HttpRequest {
|
|
|
9
9
|
timeoutMs?: number;
|
|
10
10
|
/** Forwarded to fetch() as `keepalive` so a request sent during `pagehide` can outlive the page. */
|
|
11
11
|
keepalive?: boolean;
|
|
12
|
+
/** Aborts an in-flight request when triggered. */
|
|
13
|
+
signal?: AbortSignal;
|
|
12
14
|
}
|
|
13
15
|
/** Default time to wait for an answer (ms). A check (`api/check`) waits for the server's check limit plus this. */
|
|
14
16
|
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
package/types/index.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ export type { ClientRun, StopAction } from './run.js';
|
|
|
6
6
|
export type { ClientTime, Lateness, NotSentReason, SendResult, TimeFailure, TimeState, } from './time.js';
|
|
7
7
|
export { ANSWER_TIMEOUT_MS } from './time.js';
|
|
8
8
|
export { connect, createFront, until, watch } from './front.js';
|
|
9
|
-
export type { ConnectOptions } from './front.js';
|
|
9
|
+
export type { ConnectOptions, UntilOptions } from './front.js';
|
|
10
10
|
export { ActionError } from './front-types.js';
|
|
11
|
-
export type { ConnectEntry, ConnectListError, ConnectTarget, Control, EndKind, Front, FrontClock, FrontControls, FrontResult, FrontRun, FrontScenario, FrontStatus, FrontTime, FrontVariable, Intent, Link, OperationName, Outside, Pacing, Reason, RunState, VariableView, } from './front-types.js';
|
|
11
|
+
export type { ConnectEntry, ConnectListError, ConnectTarget, Control, EndKind, Front, FrontClock, FrontControls, FrontResult, FrontRun, FrontScenario, FrontStatus, FrontTime, FrontVariable, FrontWriteOptions, Intent, Link, OperationName, Outside, Pacing, QueuedWrite, Reason, RunState, VariableView, WriteResult, } from './front-types.js';
|
|
12
12
|
export { TOKEN_STORAGE_KEY, takeToken } from './token.js';
|
|
13
13
|
export type { TokenPlace } from './token.js';
|
|
14
14
|
export { HISTORY_MAX, HISTORY_TOTAL_MAX, OPERATIONS_KEPT, WATCH_PERIODS_MS, WATCH_PERIOD_MS, WRITE_TIMEOUT_MS, WriteError, } from './variables.js';
|
|
15
|
-
export type { ClientVariables, HistoryPoint, OperationPeer, OperationView, VariableInfo, VariablePeer, VariableReading, VariableRef, VariableValue, VariableWatch, VariablesState, VariablesStatus, WatchOptions, WatchProblem, WatchValues, WriteOptions, } from './variables.js';
|
|
15
|
+
export type { ClientVariables, HistoryPoint, OperationPeer, OperationView, QueuedOperation, VariableInfo, VariablePeer, VariableReading, VariableRef, VariableValue, VariableWatch, VariablesState, VariablesStatus, WatchOptions, WatchProblem, WatchValues, WriteOptions, WriteWaitOptions, } from './variables.js';
|
|
16
16
|
export { DROPPED_MESSAGE } from './variable-binding.js';
|
|
17
17
|
export type { BindOptions, BoundVariable, VariableBinding } from './variable-binding.js';
|
|
18
18
|
export { hasRange, isWriteError, valueCondition, writeBlock } from './variable-state.js';
|
|
@@ -25,7 +25,7 @@ export type { FetchTransportOptions, HttpOutcome, HttpRequest, HttpTransport } f
|
|
|
25
25
|
export { isHolding, isLauncherAlive, isLauncherFinishing, isRunActive, isScenarioHandedOver, isScenarioRunning, isSessionRunning, launcherAnswer, phaseIndex, runOutcome, } from './session-state.js';
|
|
26
26
|
export type { CommandView, LauncherAnswer, LauncherView, LogLine, LogSource, ParticipantView, RunOutcome, ScenarioView, SessionView, TimeView, } from './session-state.js';
|
|
27
27
|
export { PHASES, PROTOCOL_VERSION, ProtocolError, readAppInfo, readCheckResponse, readConfigList, readConfigText, readSavedConfig, readConnections, readDashboardResponse, readPrepareResponse, readRecording, readRunResponse, readRuntimeStatus, readScenarioList, readServerMessage, readSessionAllowed, readSessionResponse, readSessionRuntime, readTimeResponse, readVariablesSummary, readWriteResponse, severityRank, } from './protocol.js';
|
|
28
|
-
export type { AfterScenario, AppInfo, AuthMessage, CheckNetwork, CheckOutcome, CheckParticipant, CheckRequest, CheckResult, CheckScenario, CheckStatus, CheckTextRequest, Caution, CommandReport, ConfigFile, ConfigList, ConfigText, SaveConfigRequest, SavedConfig, Connections, ConnectionsRequest, ControlLink, ControlOffer, ControlState, DashboardFile, DashboardFileError, DashboardFileItem, DashboardFileSection, DashboardPanelModule, DashboardResponse, DescribeRequest, DashboardVariable, Dropped, Finding, FromLauncher, LauncherAllowedItem, LauncherEvent, LauncherFields, LauncherMode, LogCounts, Open, OutsideState, ParticipantRole, ParticipantState, Phase, PrepareRequest, PrepareResponse, Recording, Replay, RunAck, RunParticipant, RunRequest, RunResult, RunEnd, RunResultName, RunTiming, RunTraffic, RuntimeMode, RuntimeState, RuntimeStatus, ScenarioFile, ScenarioList, ScenarioResult, ScenarioStatus, ScenarioStep, ScenarioStepStatus, ServerAllowed, ServerAllowedItem, ServerSaveItem, ServerMessage, ServerProblem, SessionSummary, Severity, Speed, StateReport, StopRequest, StopSessionRequestBody, SummaryCommand, SummaryLauncher, SummaryParticipant, SummaryScenario, SummaryState, TimeAnswer, TimeCommand, TimeCommandName, TimeReport, TrafficNetwork, TrafficParticipant, TrafficUnplaced, ValuesMessage, Variable, VariableSummary, VariablesSummary, OperationReport, VariableAvailability, WatchMessage, WriteAnswer, } from './protocol.js';
|
|
28
|
+
export type { AfterScenario, AppInfo, AuthMessage, CheckNetwork, CheckOutcome, CheckParticipant, CheckRequest, CheckResult, CheckScenario, CheckScenarioCaseDetail, CheckScenarioParam, CheckScenarioParamMeta, CheckStatus, CheckTextRequest, Caution, CommandReport, ConfigFile, ConfigList, ConfigText, SaveConfigRequest, SavedConfig, Connections, ConnectionsRequest, ControlLink, ControlOffer, ControlState, DashboardFile, DashboardFileError, DashboardFileItem, DashboardFileSection, DashboardPanelModule, DashboardResponse, DescribeRequest, DashboardVariable, Dropped, Finding, FromLauncher, LauncherAllowedItem, LauncherEvent, LauncherFields, LauncherMode, LogCounts, Open, OutsideState, ParticipantRole, ParticipantState, Phase, PrepareRequest, PrepareResponse, Recording, Replay, RunAck, RunParticipant, RunRequest, RunResult, RunEnd, RunResultName, RunTiming, RunTraffic, RuntimeMode, RuntimeState, RuntimeStatus, ScenarioCallFrame, ScenarioFile, ScenarioList, ScenarioParamType, ScenarioParamValue, ScenarioResult, ScenarioStatus, ScenarioStep, ScenarioStepStatus, ServerAllowed, ServerAllowedItem, ServerSaveItem, ServerMessage, ServerProblem, SessionIntent, SessionSummary, Severity, Speed, StateReport, StopRequest, StopSessionRequestBody, SummaryCommand, SummaryLauncher, SummaryParticipant, SummaryScenario, SummaryState, TimeAnswer, TimeCommand, TimeCommandName, TimeReport, TrafficNetwork, TrafficParticipant, TrafficUnplaced, ValuesMessage, Variable, VariableSummary, VariablesSummary, OperationReport, VariableAvailability, WatchMessage, WriteAnswer, } from './protocol.js';
|
|
29
29
|
export { createWaveforms } from './waveforms.js';
|
|
30
30
|
export type { Waveforms, WaveformSeries } from './waveforms.js';
|
|
31
31
|
export { createVariableEditor } from './variable-editor.js';
|
|
@@ -77,15 +77,54 @@ export interface Variable extends FromLauncher {
|
|
|
77
77
|
export type ScenarioStepStatus = Open<'running' | 'passed' | 'failed' | 'unfinished' | 'not_run' | 'skipped'>;
|
|
78
78
|
/** Overall result of a scenario. */
|
|
79
79
|
export type ScenarioStatus = Open<'passed' | 'failed' | 'incomplete' | 'not_run'>;
|
|
80
|
+
/** A resolved parameter scalar in a template call-stack frame or check parameter entry. */
|
|
81
|
+
export type ScenarioParamValue = string | number | boolean;
|
|
82
|
+
/** Declared parameter type derived from template parameter definitions. */
|
|
83
|
+
export type ScenarioParamType = Open<'integer' | 'number' | 'boolean' | 'string'>;
|
|
84
|
+
/** Metadata of one named case in a multi-case scenario (`scenario.case_details[]`). */
|
|
85
|
+
export interface CheckScenarioCaseDetail extends FromLauncher {
|
|
86
|
+
name: string;
|
|
87
|
+
/** Variant restriction (`only:`) of the case, or null if unrestricted. */
|
|
88
|
+
only: string[] | null;
|
|
89
|
+
}
|
|
90
|
+
/** Parameter metadata from template definitions (`scenario.param_meta[]`). */
|
|
91
|
+
export interface CheckScenarioParamMeta extends FromLauncher {
|
|
92
|
+
name: string;
|
|
93
|
+
type?: ScenarioParamType | null;
|
|
94
|
+
values?: string[] | null;
|
|
95
|
+
description?: string | null;
|
|
96
|
+
}
|
|
97
|
+
/** One resolved parameter entry (`params[]` of a check or scenario result). */
|
|
98
|
+
export interface CheckScenarioParam extends FromLauncher {
|
|
99
|
+
name: string;
|
|
100
|
+
value: ScenarioParamValue;
|
|
101
|
+
from: string;
|
|
102
|
+
type?: ScenarioParamType | null;
|
|
103
|
+
values?: string[] | null;
|
|
104
|
+
description?: string | null;
|
|
105
|
+
}
|
|
106
|
+
/** One frame in a step's template call stack (outermost to immediate caller). */
|
|
107
|
+
export interface ScenarioCallFrame extends FromLauncher {
|
|
108
|
+
file: string | null;
|
|
109
|
+
line: number | null;
|
|
110
|
+
name: string | null;
|
|
111
|
+
params: Readonly<Record<string, ScenarioParamValue>>;
|
|
112
|
+
}
|
|
113
|
+
export declare const readParamScalar: Reader<ScenarioParamValue>;
|
|
114
|
+
export declare const readCheckScenarioParam: (value: unknown, path: string, u?: Unreadable) => CheckScenarioParam;
|
|
80
115
|
/**
|
|
81
116
|
* One scenario step (the `scenario_step` event, `scenario.steps[]` of the result, `scenario.steps[]` of the summary).
|
|
82
117
|
*/
|
|
83
118
|
export interface ScenarioStep extends FromLauncher {
|
|
84
119
|
/** From 1. */
|
|
85
120
|
index: number;
|
|
86
|
-
/**
|
|
121
|
+
/** Source file path when defined in another file (e.g., a template). */
|
|
122
|
+
file?: string | null;
|
|
123
|
+
/** Line in the scenario (or source) file. */
|
|
87
124
|
line: number | null;
|
|
88
125
|
kind: Open<'set' | 'ramp' | 'wave' | 'dither' | 'expect' | 'wait_until'>;
|
|
126
|
+
/** Optional human-readable step name. */
|
|
127
|
+
name?: string | null;
|
|
89
128
|
/** Text of the step (shown in English, unchanged). */
|
|
90
129
|
text: string;
|
|
91
130
|
status: ScenarioStepStatus;
|
|
@@ -98,6 +137,8 @@ export interface ScenarioStep extends FromLauncher {
|
|
|
98
137
|
/** code and text of the failure finding (shown in English, unchanged). */
|
|
99
138
|
code: string | null;
|
|
100
139
|
message: string | null;
|
|
140
|
+
/** Caller frames when expanded from templates (outermost first). */
|
|
141
|
+
call_stack?: ScenarioCallFrame[] | null;
|
|
101
142
|
}
|
|
102
143
|
export declare const readScenarioStep: (value: unknown, path: string, u?: Unreadable) => ScenarioStep;
|
|
103
144
|
/** `scenario` of the check result (only with `--scenario`). */
|
|
@@ -105,8 +146,26 @@ export interface CheckScenario extends FromLauncher {
|
|
|
105
146
|
/** The scenario file (as passed to the launcher). */
|
|
106
147
|
file: string;
|
|
107
148
|
name: string | null;
|
|
149
|
+
/** Selected case name, or null if omitted. */
|
|
150
|
+
case?: string | null;
|
|
151
|
+
/** Available case names when the scenario defines `cases:`. */
|
|
152
|
+
cases?: string[];
|
|
153
|
+
/** Case metadata including variant restrictions (`only`). */
|
|
154
|
+
case_details?: CheckScenarioCaseDetail[];
|
|
108
155
|
/** Number of steps. */
|
|
109
156
|
steps: number;
|
|
157
|
+
/** Variant restriction (`only:`) of the scenario, if any. */
|
|
158
|
+
only?: string[];
|
|
159
|
+
/** Resolved parameters and their provenance/metadata. */
|
|
160
|
+
params?: CheckScenarioParam[];
|
|
161
|
+
/** Template parameter metadata (including parameters missing a value). */
|
|
162
|
+
param_meta?: CheckScenarioParamMeta[];
|
|
163
|
+
/** Required parameter names that have no value yet. */
|
|
164
|
+
missing_params?: string[];
|
|
165
|
+
/** Number of skipped steps when variables are absent in the variant. */
|
|
166
|
+
skipped_steps?: number;
|
|
167
|
+
/** Number of unchecked expect steps. */
|
|
168
|
+
unchecked_expects?: number;
|
|
110
169
|
/** Virtual end time from the scenario file (`end_ms`), or null if omitted. */
|
|
111
170
|
end_ms?: number | null;
|
|
112
171
|
}
|
|
@@ -114,6 +173,10 @@ export interface CheckScenario extends FromLauncher {
|
|
|
114
173
|
export interface ScenarioResult extends FromLauncher {
|
|
115
174
|
file: string;
|
|
116
175
|
name: string | null;
|
|
176
|
+
/** Selected case name, or null if omitted. */
|
|
177
|
+
case?: string | null;
|
|
178
|
+
/** Resolved parameters used by the scenario, if any. */
|
|
179
|
+
params?: CheckScenarioParam[];
|
|
117
180
|
status: ScenarioStatus;
|
|
118
181
|
/** The controller step at which the scenario ended (passed and failed; null otherwise). */
|
|
119
182
|
over_at_ms: number | null;
|
|
@@ -155,6 +218,12 @@ export type CheckOutcome = Open<'passed' | 'failed' | 'unreadable' | 'usage'>;
|
|
|
155
218
|
export interface CheckResult extends FromLauncher {
|
|
156
219
|
file: string | null;
|
|
157
220
|
result: CheckOutcome;
|
|
221
|
+
/** Selected variant name when the configuration has variants (null on usage). */
|
|
222
|
+
variant?: string | null;
|
|
223
|
+
/** Available variant names when the configuration defines `variants:`. */
|
|
224
|
+
variants?: string[];
|
|
225
|
+
/** Configuration-level parameters, if any. */
|
|
226
|
+
params?: CheckScenarioParam[];
|
|
158
227
|
errors: number;
|
|
159
228
|
warnings: number;
|
|
160
229
|
notes: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* come from the launcher (check, result, events) have the shapes of launcher.ts. Rules of the parsers: read.ts.
|
|
4
4
|
*/
|
|
5
5
|
import { Open, Reader, Unreadable } from './read.js';
|
|
6
|
-
import { CheckResult, ControlLink, Finding, LauncherEvent, ParticipantState, Phase, RunResult, ScenarioStatus, ScenarioStep, Speed, SummaryCommand, SummaryState, TimeReport, Caution } from './launcher.js';
|
|
6
|
+
import { CheckResult, CheckScenarioParam, ControlLink, Finding, LauncherEvent, ParticipantState, Phase, RunResult, ScenarioParamValue, ScenarioStatus, ScenarioStep, Speed, SummaryCommand, SummaryState, TimeReport, Caution } from './launcher.js';
|
|
7
7
|
/**
|
|
8
8
|
* The version of the GUI server's API that this library reads (`vehicle_sil_gui` of `api/app` and `hello`). It does not
|
|
9
9
|
* read a hello or an api/app of another version (their fields may mean something else). When to raise the version:
|
|
@@ -20,6 +20,10 @@ export interface ServerProblem {
|
|
|
20
20
|
skipped?: number;
|
|
21
21
|
/** For `check-failed`, the findings of the check that refused the start (`detail.findings`; unreadable ones left out). */
|
|
22
22
|
findings?: Finding[];
|
|
23
|
+
/** For `write-timeout` and `write-failed` after an operation number was assigned (`detail.operation`). */
|
|
24
|
+
operation?: number;
|
|
25
|
+
/** Last known operation state on `write-timeout` / `write-failed` (`detail.state`, e.g. `'sent'`). */
|
|
26
|
+
state?: string;
|
|
23
27
|
}
|
|
24
28
|
/** Reads a server notice (`{code, message, detail}`). The `error` in an HTTP error has the same shape. */
|
|
25
29
|
export declare const readServerProblem: Reader<ServerProblem>;
|
|
@@ -104,6 +108,8 @@ export interface CheckRequest {
|
|
|
104
108
|
manual?: string[];
|
|
105
109
|
/** The scenario (`path` from `GET api/scenarios`; only one in the list for that configuration file). */
|
|
106
110
|
scenario?: string;
|
|
111
|
+
/** The named case of the scenario (`cases:`). Requires `scenario`. */
|
|
112
|
+
case?: string;
|
|
107
113
|
/** What to do after the scenario passes (`stop`, or `pause` to hand over to manual control). */
|
|
108
114
|
after_scenario?: AfterScenario;
|
|
109
115
|
/** The variant of the configuration file. */
|
|
@@ -335,6 +341,27 @@ export interface LogCounts {
|
|
|
335
341
|
kept: number;
|
|
336
342
|
dropped: number;
|
|
337
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Root-relative intent of a started run (`session.intent`). Suitable for passing directly to
|
|
346
|
+
* `front.run.start(session.intent, { file: session.file })` to re-run with the same choices.
|
|
347
|
+
*/
|
|
348
|
+
export interface SessionIntent {
|
|
349
|
+
disable?: string[];
|
|
350
|
+
enable?: string[];
|
|
351
|
+
manual?: string[];
|
|
352
|
+
scenario?: string;
|
|
353
|
+
case?: string;
|
|
354
|
+
after_scenario?: AfterScenario;
|
|
355
|
+
variant?: string;
|
|
356
|
+
params?: Record<string, ScenarioParamValue>;
|
|
357
|
+
speed?: number | 'max';
|
|
358
|
+
start_paused?: boolean;
|
|
359
|
+
stop_at_ms?: number;
|
|
360
|
+
late_tolerance_ms?: number;
|
|
361
|
+
strict?: boolean;
|
|
362
|
+
connect?: Record<string, string>;
|
|
363
|
+
time_policy?: Open<'realtime' | 'free'>;
|
|
364
|
+
}
|
|
338
365
|
/**
|
|
339
366
|
* Summary of a server session (one run of the launcher). The screen rebuilds its state from it (the summary is
|
|
340
367
|
* authoritative).
|
|
@@ -396,6 +423,8 @@ export interface SessionSummary {
|
|
|
396
423
|
problems_omitted: number;
|
|
397
424
|
/** Progress of the scenario run (`scenario` of `api/run`). null for a run without a scenario. */
|
|
398
425
|
scenario: SummaryScenario | null;
|
|
426
|
+
/** Root-relative run intent suitable for re-running this session. Omitted on older servers. */
|
|
427
|
+
intent?: SessionIntent | null;
|
|
399
428
|
/**
|
|
400
429
|
* Names of the parts that could not be read (`result.participants`, `findings.code` and so on; set by the screen,
|
|
401
430
|
* not a server field). The missing fields of a result shrunk to fit the limits go here too.
|
|
@@ -409,6 +438,10 @@ export interface SummaryScenario {
|
|
|
409
438
|
/** The scenario file (relative to root). */
|
|
410
439
|
file: string;
|
|
411
440
|
name: string | null;
|
|
441
|
+
/** Selected case name, or null when none was selected. */
|
|
442
|
+
case?: string | null;
|
|
443
|
+
/** Resolved parameters of the scenario, if any. */
|
|
444
|
+
params?: CheckScenarioParam[];
|
|
412
445
|
/** Number of steps (from the check result; null until then). */
|
|
413
446
|
step_count: number | null;
|
|
414
447
|
/** Steps received (in index order). After the result, every step (not_run included). */
|
|
@@ -539,6 +572,8 @@ export interface VariableSummary {
|
|
|
539
572
|
type: Open<'bool' | 'integer' | 'real' | 'enum'>;
|
|
540
573
|
role: Open<'input' | 'output' | 'parameter'>;
|
|
541
574
|
writable: boolean;
|
|
575
|
+
/** Whether vehicle-sil added the variable (`ecu.connected`, `peer.*`, `j1939.*`, `can.*`, `lin.*`, `eth.*`) rather than the ECU application declaring it. */
|
|
576
|
+
builtin: boolean;
|
|
542
577
|
unit: string;
|
|
543
578
|
min: number | null;
|
|
544
579
|
max: number | null;
|
package/types/session-state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CheckResult, ControlLink, Dropped, Finding, LauncherEvent, LauncherMode, ParticipantState, Phase, RunResult, ScenarioStatus, ScenarioStep, ServerProblem, SessionSummary, Speed, StateReport, TimeReport } from './protocol.js';
|
|
1
|
+
import { CheckResult, CheckScenarioParam, ControlLink, Dropped, Finding, LauncherEvent, LauncherMode, ParticipantState, Phase, RunResult, ScenarioStatus, ScenarioStep, ServerProblem, SessionIntent, SessionSummary, Speed, StateReport, TimeReport } from './protocol.js';
|
|
2
2
|
/**
|
|
3
3
|
* A reason: a code that stays the same (an entry of the owner's reason codes, or one the client names) and one English
|
|
4
4
|
* sentence.
|
|
@@ -154,6 +154,10 @@ export interface ScenarioView {
|
|
|
154
154
|
/** The scenario file (relative to root). */
|
|
155
155
|
file: string;
|
|
156
156
|
name: string | null;
|
|
157
|
+
/** Selected case name, if any. */
|
|
158
|
+
case?: string | null;
|
|
159
|
+
/** Resolved parameters of the scenario, if any. */
|
|
160
|
+
params?: readonly CheckScenarioParam[];
|
|
157
161
|
/** Number of steps (from the check result; null until then). */
|
|
158
162
|
stepCount: number | null;
|
|
159
163
|
/** Steps received (in index order, the last state of each step). After the result, every step. */
|
|
@@ -246,6 +250,8 @@ export interface SessionView {
|
|
|
246
250
|
droppedMarks: number;
|
|
247
251
|
/** Progress of the scenario (null for a run without a scenario). */
|
|
248
252
|
scenario: ScenarioView | null;
|
|
253
|
+
/** Root-relative run intent suitable for re-running this session. Undefined on older servers. */
|
|
254
|
+
intent?: SessionIntent | null;
|
|
249
255
|
}
|
|
250
256
|
/** Where the run stands now (used by the status bar and the result display). */
|
|
251
257
|
export type RunOutcome =
|
|
@@ -3,7 +3,7 @@ import { ConnectionState } from './connection.js';
|
|
|
3
3
|
import { Reason, SessionView } from './session-state.js';
|
|
4
4
|
import { ErrorSink, Readable } from './values.js';
|
|
5
5
|
import { ValueCondition, WriteBlock, WriteStatus, WriteValue } from './variable-state.js';
|
|
6
|
-
import { HistoryPoint, OperationView, VariableInfo, VariableReading, VariableRef, VariableWatch, VariablesState, WatchOptions, WriteOptions } from './variables.js';
|
|
6
|
+
import { HistoryPoint, OperationView, QueuedOperation, VariableInfo, VariableReading, VariableRef, VariableWatch, VariablesState, WatchOptions, WriteOptions } from './variables.js';
|
|
7
7
|
/** Options of client.variables.bind. */
|
|
8
8
|
export interface BindOptions {
|
|
9
9
|
/** Interval at which values are received (ms; default WATCH_PERIOD_MS). */
|
|
@@ -109,6 +109,8 @@ export interface BindingSources {
|
|
|
109
109
|
readonly variables: {
|
|
110
110
|
readonly state: Readable<VariablesState>;
|
|
111
111
|
watch(variables: readonly VariableRef[], options?: WatchOptions): VariableWatch;
|
|
112
|
+
enqueue?(writes: Record<string, Record<string, number | boolean | string>>, options?: WriteOptions): Promise<QueuedOperation>;
|
|
113
|
+
enqueueForBinder?(writes: Record<string, Record<string, number | boolean | string>>, onQueued: (seq: number) => void): Promise<OperationView>;
|
|
112
114
|
write(writes: Record<string, Record<string, number | boolean | string>>, options?: WriteOptions): Promise<OperationView>;
|
|
113
115
|
isStale?(ref: VariableRef): boolean;
|
|
114
116
|
runEpoch?(): number;
|