@linxin666/dsh-client-ui-task-board-ssh 0.4.20 → 0.4.22

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.
@@ -192,6 +192,10 @@ export type TaskBoardLaunchDecision = {
192
192
  promptPreamble?: string;
193
193
  } | {
194
194
  kind: 'external';
195
+ } | {
196
+ kind: 'refuse';
197
+ code: string;
198
+ reason: string;
195
199
  };
196
200
  /**
197
201
  * One launch interception. Synchronous by contract: the runner may not await a
@@ -235,6 +239,10 @@ export interface TaskBoardExtension {
235
239
  stop?(): void;
236
240
  /** Route one dispatched action; the returned value goes back to the dispatcher. */
237
241
  handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>;
242
+ /** Model-facing summary of one owned card, merged into `task_board_get` / `task_board_list`. */
243
+ describeTask?(task: TaskRecord): Record<string, unknown> | undefined;
244
+ /** Handle of the run taken over for `taskId`, merged into `task_board_run`'s answer. */
245
+ describeRun?(taskId: string): Record<string, unknown> | undefined;
238
246
  }
239
247
  /** Board mirror an extension's browser half observes. */
240
248
  export interface TaskBoardClientMirror {
@@ -105,6 +105,12 @@ export interface SshRunRecord {
105
105
  error?: string;
106
106
  /** Follow-up messages delivered into this run's session. */
107
107
  followUps?: number;
108
+ /** Execution id handed out at launch; the settled board execution record takes it. */
109
+ executionId?: string;
110
+ /** Last instant the remote log grew (ms epoch). */
111
+ lastActivityAt?: number;
112
+ /** Stable failure code of a failed run. */
113
+ errorCode?: string;
108
114
  }
109
115
  /** One diagnostic about a malformed value, addressed by its path inside it. */
110
116
  export interface SshValidationIssue {
@@ -25,6 +25,17 @@ export interface ExecutionRecord {
25
25
  settledAt?: number;
26
26
  /** Settlement, absent while the execution is still running. */
27
27
  result?: ExecutionOutcome;
28
+ /** Conclusion of a succeeded run. */
29
+ summary?: {
30
+ text: string;
31
+ seq?: number;
32
+ };
33
+ /** Failure text of a failed run. */
34
+ error?: string;
35
+ /** Stable failure code a provider reported. */
36
+ errorCode?: string;
37
+ /** Who recorded the execution (`ssh:<runId>` for this provider). */
38
+ initiatedBy?: string;
28
39
  }
29
40
  /** One card, as a provider reads it through the capability face. */
30
41
  export interface TaskRecord {
@@ -27,6 +27,10 @@ export type BoardAction = {
27
27
  result: 'succeeded' | 'failed';
28
28
  initiatedBy: string;
29
29
  summary?: string;
30
+ executionId?: string;
31
+ startedAt?: number;
32
+ errorCode?: string;
33
+ retryHint?: string;
30
34
  };
31
35
  /**
32
36
  * The board service's `apply`, as this package drives it.
@@ -21,8 +21,10 @@
21
21
  import { type SshAgentCommand, type SshAgentRunInput, type SshCustomTemplates } from '../core/adapters/index.ts';
22
22
  import type { DshSshHost, DshSshService, TaskBoardExtensionHost } from '../core/contract.ts';
23
23
  import { type SshAgentKind, type SshAgentTarget, type SshRunPhase, type SshRunRecord, type SshTarget } from '../core/target.ts';
24
+ import type { TaskRecord } from '../core/task-record.ts';
24
25
  import { type BoardActionSeat } from './board.ts';
25
26
  import { type HostSshPayload } from './payload.ts';
27
+ import { type SshActivity, type SshLogStats, type SshPreflightFailure } from './inspect.ts';
26
28
  import type { SshProviderSettings } from './settings.ts';
27
29
  import type { HostTimerFace } from './timers.ts';
28
30
  import { type SshWorkspaceStrategyResolver } from './workspace-seam.ts';
@@ -30,6 +32,8 @@ import { type SshWorkspaceStrategyResolver } from './workspace-seam.ts';
30
32
  export declare const DEFAULT_POLL_INTERVAL_MS = 2000;
31
33
  /** Consecutive unreadable polls after which a run is recorded as lost. */
32
34
  export declare const LOST_AFTER_FAILURES = 3;
35
+ /** Expected run length when no earlier run says better, in milliseconds. */
36
+ export declare const DEFAULT_ESTIMATED_DURATION_MS = 180000;
33
37
  /** What the engine needs from its mount; every member is injectable so a spec can pin it. */
34
38
  export interface SshRunEngineOptions {
35
39
  /** The board's capability face for this extension. */
@@ -60,6 +64,8 @@ export interface SshRunEngineOptions {
60
64
  uuid?: () => string;
61
65
  /** Poll cadence, in milliseconds. */
62
66
  pollIntervalMs?: number;
67
+ /** Wait source for a blocking status call; defaults to a real timer. */
68
+ sleep?: (ms: number) => Promise<void>;
63
69
  /** Ceiling for one remote command, in milliseconds. */
64
70
  commandTimeoutMs?: number;
65
71
  /** Where a refusal or a failed remote call is reported. */
@@ -104,6 +110,59 @@ export interface SshRunStatusView {
104
110
  /** Whether an instruction waits for the next run. */
105
111
  pending?: 'follow-up' | 'rework';
106
112
  }
113
+ /** A target as the agent-facing views report it. */
114
+ export interface SshTargetView {
115
+ host: string;
116
+ agent: SshAgentKind;
117
+ mode: 'direct' | 'proxy';
118
+ workspaceKind: 'in-place' | 'git';
119
+ workspacePath?: string;
120
+ }
121
+ /** The one shape a run is reported in, running or settled; absent facts are null. */
122
+ export interface SshStatusView {
123
+ taskId: string;
124
+ target: SshTargetView | null;
125
+ /** `none` before any run, otherwise the run's phase; never missing. */
126
+ phase: SshRunPhase | 'none';
127
+ /** Whether the run reached a terminal phase and its verdict is recorded. */
128
+ settled: boolean;
129
+ runId: string | null;
130
+ executionId: string | null;
131
+ exitCode: number | null;
132
+ /** The verdict once settled (succeeded, failed, cancelled, lost); null while running. */
133
+ result: SshRunPhase | null;
134
+ /** What the agent reported on success. */
135
+ summary: string | null;
136
+ /** The failure only: code, message and a retry hint. */
137
+ error: {
138
+ code: string;
139
+ message: string;
140
+ retryHint: string;
141
+ } | null;
142
+ durationMs: number | null;
143
+ remoteSessionId: string | null;
144
+ lastActivityAt: number | null;
145
+ bytes: number | null;
146
+ pendingInstruction: 'follow-up' | 'rework' | null;
147
+ }
148
+ /** One filtered page of a run's log, or the refusal that says why there is none. */
149
+ export type SshLogReply = {
150
+ ok: true;
151
+ runId: string;
152
+ filtered: boolean;
153
+ stats: SshLogStats;
154
+ /** First filtered line in `text`, 1-based. */
155
+ from: number;
156
+ lines: number;
157
+ /** Pass as `since` to continue where this page ended. */
158
+ nextSince: number;
159
+ more: boolean;
160
+ text: string;
161
+ } | {
162
+ ok: false;
163
+ code: string;
164
+ error: string;
165
+ };
107
166
  /** One page of a run's log. */
108
167
  export type SshLogPage = {
109
168
  ok: true;
@@ -160,6 +219,9 @@ export declare class SshRunEngine {
160
219
  private readonly now;
161
220
  private readonly uuid;
162
221
  private readonly pollIntervalMs;
222
+ private readonly sleep;
223
+ /** Ids handed out at launch, keyed by card, until the run record takes them over. */
224
+ private readonly reserved;
163
225
  private readonly log;
164
226
  private readonly remote;
165
227
  /** Runs this process follows, keyed by card id: a card has at most one. */
@@ -213,6 +275,62 @@ export declare class SshRunEngine {
213
275
  payloadOf(taskId: string): HostSshPayload | undefined;
214
276
  /** The target a card pins, when it pins one. */
215
277
  targetOf(taskId: string): SshTarget | undefined;
278
+ /**
279
+ * One card's run in a single shape, whether it is still running or settled.
280
+ *
281
+ * The active run wins; with none, the newest settled one answers, so the same
282
+ * fields exist before and after the run ends and `phase` is never missing.
283
+ * Absent facts are `null`, never undefined, so a caller reads one schema.
284
+ * @param taskId - card to read.
285
+ * @returns the uniform view.
286
+ */
287
+ statusView(taskId: string): SshStatusView;
288
+ /**
289
+ * Block until the card's run settles or the wait runs out.
290
+ * @param taskId - card to wait on.
291
+ * @param timeoutMs - longest wait, clamped to ten minutes.
292
+ * @returns the uniform view and whether the wait ran out.
293
+ */
294
+ waitStatus(taskId: string, timeoutMs?: number): Promise<{
295
+ view: SshStatusView;
296
+ timedOut: boolean;
297
+ }>;
298
+ /**
299
+ * What the agent did last, read from the tail of the run's filtered log.
300
+ * @param taskId - card to inspect.
301
+ * @returns the last tool call or message, or undefined when none can be read.
302
+ */
303
+ activityOf(taskId: string): Promise<SshActivity | undefined>;
304
+ /**
305
+ * One filtered, bounded read of a run's log.
306
+ *
307
+ * The filter, the line selection and the byte cap all run on the host, so a
308
+ * 12 MB stream-json log costs one short reply; the reply carries the filtered
309
+ * line count and size so a caller sees the cost before asking for more.
310
+ * @param taskId - card whose run to read.
311
+ * @param options - run, tail/since window, raw switch, cap and stats-only.
312
+ * @returns the page, or the refusal that says why there is none.
313
+ */
314
+ queryLog(taskId: string, options?: {
315
+ runId?: string;
316
+ tail?: number;
317
+ since?: number;
318
+ raw?: boolean;
319
+ maxBytes?: number;
320
+ statsOnly?: boolean;
321
+ }): Promise<SshLogReply>;
322
+ /**
323
+ * Check a target can work before a card is bound to it or a run starts.
324
+ * @param target - the candidate target.
325
+ * @returns the first failed check, or undefined when the target is usable.
326
+ */
327
+ preflight(target: SshTarget): Promise<SshPreflightFailure | undefined>;
328
+ /** Summary of one card this provider owns, for `task_board_get` / `task_board_list`. */
329
+ describeTask(task: TaskRecord): Record<string, unknown> | undefined;
330
+ /** The handle of the run just taken over for one card, for `task_board_run`. */
331
+ describeRun(taskId: string): Record<string, unknown> | undefined;
332
+ /** Expected duration of a run: the median of earlier successful runs, else a default. */
333
+ private estimateDuration;
216
334
  /** One card's remote-run state. */
217
335
  status(taskId: string): SshRunStatusView;
218
336
  /**
@@ -225,6 +343,33 @@ export declare class SshRunEngine {
225
343
  * @returns the reply the caller renders.
226
344
  */
227
345
  setTarget(taskId: string, target: SshTarget): SshEngineReply;
346
+ /**
347
+ * Create a card already bound to a target, in one step.
348
+ *
349
+ * The target is checked first and the card is created only when the check
350
+ * passes, with the target in the same write, so a refused target leaves no
351
+ * half-made card behind and a created card is never unbound.
352
+ * @param draft - card content.
353
+ * @param target - the target to bind.
354
+ * @param options - `preflight: false` skips the reachability check.
355
+ * @returns the new card id, or the stable refusal.
356
+ */
357
+ createBound(draft: {
358
+ title: string;
359
+ prompt: string;
360
+ description?: string;
361
+ workspaceId?: string;
362
+ parentId?: string;
363
+ }, target: SshTarget, options?: {
364
+ preflight?: boolean;
365
+ }): Promise<SshEngineReply>;
366
+ /**
367
+ * Start a card's pinned run and wait for the board to accept or refuse it, so
368
+ * the run's handle exists when this returns.
369
+ * @param taskId - card to run.
370
+ * @returns the reply; a board or provider refusal keeps its stable code.
371
+ */
372
+ runCard(taskId: string): Promise<SshEngineReply>;
228
373
  /**
229
374
  * Start a card's pinned run now, through the board's own run action so the
230
375
  * card reaches the running column the same way the run button puts it there.
@@ -42,6 +42,8 @@ export interface SshExtensionOptions {
42
42
  now?: () => number;
43
43
  /** Identifier source for request ids and run ids. */
44
44
  uuid?: () => string;
45
+ /** Wait source of a blocking status call; a real timer when absent. */
46
+ sleep?: (ms: number) => Promise<void>;
45
47
  /** Poll cadence, in milliseconds. */
46
48
  pollIntervalMs?: number;
47
49
  /** Ceiling for one remote command, in milliseconds. */
@@ -0,0 +1,99 @@
1
+ import type { SshAgentTarget, SshTarget } from '../core/target.ts';
2
+ /** Stable refusal codes a target check or a run can answer with. */
3
+ export declare const SSH_PREFLIGHT_CODES: readonly ["host-unreachable", "agent-missing", "path-missing", "permission-required"];
4
+ /** One stable preflight code. */
5
+ export type SshPreflightCode = (typeof SSH_PREFLIGHT_CODES)[number];
6
+ /** A target check that failed, in words the caller can act on. */
7
+ export interface SshPreflightFailure {
8
+ code: SshPreflightCode;
9
+ message: string;
10
+ /** The next step, one sentence. */
11
+ hint: string;
12
+ }
13
+ /** Program a built-in agent kind starts on the host, or undefined when it is configured. */
14
+ export declare function agentProgram(agent: SshAgentTarget, override?: string): string | undefined;
15
+ /**
16
+ * The single remote command one preflight runs: it always exits zero and prints
17
+ * one `key=value` per fact, so a failed channel is told apart from a failed check.
18
+ */
19
+ export declare function preflightCommand(target: SshTarget, program: string | undefined): string;
20
+ /**
21
+ * Read one preflight answer.
22
+ * @param target - the checked target.
23
+ * @param program - the probed program, if any.
24
+ * @param result - what `exec` returned.
25
+ * @returns the first failed check, or undefined when the target can work.
26
+ */
27
+ export declare function readPreflight(target: SshTarget, program: string | undefined, result: {
28
+ success: boolean;
29
+ stdout: string;
30
+ stderr: string;
31
+ error?: string;
32
+ timedOut?: boolean;
33
+ }): SshPreflightFailure | undefined;
34
+ /** Longest line a filtered log returns, in bytes; longer ones are cut and marked. */
35
+ export declare const LOG_LINE_MAX_BYTES = 2000;
36
+ /** Default and ceiling of one log reply, in bytes. */
37
+ export declare const LOG_REPLY_DEFAULT_BYTES: number;
38
+ /** Lines `tail` returns when the caller names neither `tail` nor `since`. */
39
+ export declare const LOG_TAIL_DEFAULT_LINES = 40;
40
+ /** What one log query asks for. */
41
+ export interface SshLogQuery {
42
+ /** Absolute path of the run's stdout log. */
43
+ file: string;
44
+ /** Last N filtered lines (default 40). Ignored when `since` is given. */
45
+ tail?: number;
46
+ /** First filtered line to return, 1-based: the `nextSince` of an earlier reply. */
47
+ since?: number;
48
+ /** Skip the filter and read raw lines. */
49
+ raw?: boolean;
50
+ /** Cap on the reply text, in bytes. */
51
+ maxBytes?: number;
52
+ /** Count only: no text. */
53
+ statsOnly?: boolean;
54
+ }
55
+ /** Counts of one log, before any text is cost. */
56
+ export interface SshLogStats {
57
+ /** Size of the raw log on the host. */
58
+ rawBytes: number;
59
+ /** Lines the filter keeps. */
60
+ lines: number;
61
+ /** Bytes the kept lines take. */
62
+ bytes: number;
63
+ }
64
+ /** The command that answers one log query, text after a `stats` line. */
65
+ export declare function logCommand(query: SshLogQuery): string;
66
+ /** One answered log query. */
67
+ export interface SshLogAnswer {
68
+ stats: SshLogStats | undefined;
69
+ /** Filtered text, complete lines only, within the cap. */
70
+ text: string;
71
+ /** Filtered lines in `text`. */
72
+ lines: number;
73
+ /** Whether lines remain after `text`. */
74
+ more: boolean;
75
+ }
76
+ /**
77
+ * Parse the answer of {@link logCommand}.
78
+ * @param stdout - what the command printed.
79
+ * @param query - the query it answered.
80
+ * @returns stats and the complete lines that fit the cap.
81
+ */
82
+ export declare function readLogAnswer(stdout: string, query: SshLogQuery): SshLogAnswer;
83
+ /** First filtered line number a tail of `tail` lines starts at, given the totals. */
84
+ export declare function tailStart(stats: SshLogStats, tail: number): number;
85
+ /** The agent's last visible action: a tool call or a message. */
86
+ export interface SshActivity {
87
+ /** `tool_use`, `assistant` or `result`. */
88
+ kind: string;
89
+ /** Tool name for a tool call. */
90
+ name?: string;
91
+ /** One line of what it was given or said. */
92
+ detail: string;
93
+ }
94
+ /**
95
+ * The last tool call (or message) in a stretch of stream-json lines.
96
+ * @param text - filtered log lines, oldest first.
97
+ * @returns the last action, or undefined when none parses.
98
+ */
99
+ export declare function lastActivity(text: string): SshActivity | undefined;
@@ -50,6 +50,8 @@ export declare class SshRemote {
50
50
  private readonly starting;
51
51
  private readonly installing;
52
52
  constructor(ssh: DshSshService, options?: SshRemoteOptions);
53
+ /** The state directory of a host when it was already resolved, without a round trip. */
54
+ cachedStateDir(alias: string): string | undefined;
53
55
  /** Forget every cached path of one host, or of all hosts when none is named. */
54
56
  forget(alias?: string): void;
55
57
  /**
@@ -115,6 +117,21 @@ export declare class SshRemote {
115
117
  * @param ref - host, state directory and run.
116
118
  */
117
119
  removeRun(ref: SshRemoteRef): Promise<void>;
120
+ /**
121
+ * Run one read-only diagnostic command and hand back the raw result, whether
122
+ * or not it succeeded: the caller decides what a failure means.
123
+ * @param alias - host alias.
124
+ * @param command - command line, already quoted.
125
+ * @param timeoutMs - ceiling for this command.
126
+ * @returns what the forwarder reported; a thrown forwarder becomes a failed result.
127
+ */
128
+ probe(alias: string, command: string, timeoutMs?: number): Promise<{
129
+ success: boolean;
130
+ stdout: string;
131
+ stderr: string;
132
+ error?: string;
133
+ timedOut: boolean;
134
+ }>;
118
135
  /** Run one command and refuse a failed one in the host's own words. */
119
136
  private run;
120
137
  }
@@ -1,8 +1,9 @@
1
1
  import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
2
2
  import { type SshExecutionMode } from '../core/target.ts';
3
3
  import type { SshRunEngine } from './engine.ts';
4
- /** Tool names, in registration order. */
5
- export declare const SSH_TOOL_NAMES: readonly ["task_board_ssh_target", "task_board_ssh_status", "task_board_ssh_follow_up"];
4
+ import { SSH_PREFLIGHT_CODES } from './inspect.ts';
5
+ /** Tool names, in registration order; the first is the one surface, the rest are the compatibility layer. */
6
+ export declare const SSH_TOOL_NAMES: readonly ["task_board_ssh", "task_board_ssh_target", "task_board_ssh_status", "task_board_ssh_follow_up"];
6
7
  /** One tool name. */
7
8
  export type SshToolName = (typeof SSH_TOOL_NAMES)[number];
8
9
  /**
@@ -11,5 +12,6 @@ export type SshToolName = (typeof SSH_TOOL_NAMES)[number];
11
12
  * @returns the tool definitions, in registration order.
12
13
  */
13
14
  export declare function buildSshTools(engine: SshRunEngine): ToolDefinition[];
14
- /** Re-exported for the specs: the modes a target may pin. */
15
+ /** Re-exported for the specs: the modes a target may pin and the stable preflight codes. */
15
16
  export type { SshExecutionMode };
17
+ export { SSH_PREFLIGHT_CODES };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-task-board-ssh",
3
3
  "description": "Task board provider that runs a pinned card as a headless agent session on a remote host reached through dsh-ssh, with a POSIX launcher that survives the local host going away.",
4
- "version": "0.4.20",
4
+ "version": "0.4.22",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "engines": {
8
- "node": ">=24.9.0"
8
+ "node": "^24.22.3 || >=26.13.1"
9
9
  },
10
10
  "main": "lib/index.js",
11
11
  "types": "lib/types/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dsh": {
27
27
  "engines": {
28
- "dsh": ">=0.2.2-rc.3"
28
+ "dsh": ">=0.2.3-alpha.2"
29
29
  },
30
30
  "bundle": {
31
31
  "patch": "./cordis.patch.yml"
@@ -41,22 +41,22 @@
41
41
  }
42
42
  },
43
43
  "peerDependencies": {
44
- "@deepseek-ai/dsh": ">=0.2.2-rc.3",
44
+ "@deepseek-ai/dsh": ">=0.2.3-alpha.2",
45
45
  "react": "^18.2.0"
46
46
  },
47
47
  "dependencies": {
48
- "@deepseek-ai/schemastery": "^3.19.0"
48
+ "@deepseek-ai/schemastery": "~3.20.0-alpha.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@deepseek-ai/cordis": "^4.1.0",
52
- "@deepseek-ai/dsh-api-gateway": "^0.2.2-rc.3",
53
- "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.3",
54
- "@deepseek-ai/dsh-client-store": "^0.2.2-rc.3",
55
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.3",
56
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.3",
57
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.3",
58
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
59
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.3",
51
+ "@deepseek-ai/cordis": "~4.2.0-alpha.1",
52
+ "@deepseek-ai/dsh-api-gateway": "^0.2.3-alpha.2",
53
+ "@deepseek-ai/dsh-client-locale": "^0.2.3-alpha.2",
54
+ "@deepseek-ai/dsh-client-store": "^0.2.3-alpha.2",
55
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.3-alpha.2",
56
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.3-alpha.2",
57
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.3-alpha.2",
58
+ "@deepseek-ai/dsh-llm": "^0.2.3-alpha.2",
59
+ "@deepseek-ai/dsh-tools": "^0.2.3-alpha.2",
60
60
  "@testing-library/react": "^16.1.0",
61
61
  "@types/node": "^22.20.0",
62
62
  "@types/react": "~18.3.1",
@@ -207,6 +207,7 @@ export interface TaskBoardLaunchContext {
207
207
  export type TaskBoardLaunchDecision =
208
208
  | { kind: 'local'; promptPreamble?: string }
209
209
  | { kind: 'external' }
210
+ | { kind: 'refuse'; code: string; reason: string }
210
211
 
211
212
  /**
212
213
  * One launch interception. Synchronous by contract: the runner may not await a
@@ -256,6 +257,10 @@ export interface TaskBoardExtension {
256
257
  stop?(): void
257
258
  /** Route one dispatched action; the returned value goes back to the dispatcher. */
258
259
  handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>
260
+ /** Model-facing summary of one owned card, merged into `task_board_get` / `task_board_list`. */
261
+ describeTask?(task: TaskRecord): Record<string, unknown> | undefined
262
+ /** Handle of the run taken over for `taskId`, merged into `task_board_run`'s answer. */
263
+ describeRun?(taskId: string): Record<string, unknown> | undefined
259
264
  }
260
265
 
261
266
  /** Board mirror an extension's browser half observes. */
@@ -140,6 +140,9 @@ function boundRun(record: SshRunRecord): SshRunRecord {
140
140
  if (summary !== undefined) next.summary = summary
141
141
  if (error !== undefined) next.error = error
142
142
  if (record.followUps !== undefined) next.followUps = record.followUps
143
+ if (record.executionId !== undefined) next.executionId = boundText(record.executionId, 128)
144
+ if (record.lastActivityAt !== undefined) next.lastActivityAt = record.lastActivityAt
145
+ if (record.errorCode !== undefined) next.errorCode = boundText(record.errorCode, 64)
143
146
  return next
144
147
  }
145
148
 
@@ -155,6 +158,8 @@ function stripRunText(record: SshRunRecord): SshRunRecord {
155
158
  if (record.sessionId !== undefined) stripped.sessionId = record.sessionId
156
159
  if (record.bytes !== undefined) stripped.bytes = record.bytes
157
160
  if (record.followUps !== undefined) stripped.followUps = record.followUps
161
+ if (record.executionId !== undefined) stripped.executionId = record.executionId
162
+ if (record.lastActivityAt !== undefined) stripped.lastActivityAt = record.lastActivityAt
158
163
  return stripped
159
164
  }
160
165
 
@@ -122,6 +122,12 @@ export interface SshRunRecord {
122
122
  error?: string
123
123
  /** Follow-up messages delivered into this run's session. */
124
124
  followUps?: number
125
+ /** Execution id handed out at launch; the settled board execution record takes it. */
126
+ executionId?: string
127
+ /** Last instant the remote log grew (ms epoch). */
128
+ lastActivityAt?: number
129
+ /** Stable failure code of a failed run. */
130
+ errorCode?: string
125
131
  }
126
132
 
127
133
  /** One diagnostic about a malformed value, addressed by its path inside it. */
@@ -174,6 +180,7 @@ function isAbsolutePath(value: string): boolean {
174
180
 
175
181
  /** Whether a string is safe to compose into a git branch/ref name. */
176
182
  function isSafeGitRefSegment(value: string): boolean {
183
+ // oxlint-disable-next-line no-control-regex -- rejecting control characters in a ref name IS the check.
177
184
  if (/[\u0000-\u001f\u007f\s~^:?*[\\]/.test(value)) return false
178
185
  if (value.includes('..') || value.includes('@{') || value.startsWith('/') || value.endsWith('/') || value.endsWith('.') || value.endsWith('.lock') || value.includes('//')) {
179
186
  return false
@@ -381,7 +388,7 @@ export function parseSshRunRecord(value: unknown): SshValidationResult<SshRunRec
381
388
  if (!isPlainObject(value)) return { ok: false, errors: [{ path: '', message: 'must be an object' }] }
382
389
  rejectUnknownKeys(
383
390
  value,
384
- ['runId', 'phase', 'startedAt', 'finishedAt', 'exitCode', 'sessionId', 'bytes', 'branch', 'summary', 'error', 'followUps'],
391
+ ['runId', 'phase', 'startedAt', 'finishedAt', 'exitCode', 'sessionId', 'bytes', 'branch', 'summary', 'error', 'followUps', 'executionId', 'lastActivityAt', 'errorCode'],
385
392
  '',
386
393
  issues,
387
394
  )
@@ -391,11 +398,11 @@ export function parseSshRunRecord(value: unknown): SshValidationResult<SshRunRec
391
398
  issues.add('phase', 'must be one of: queued, running, succeeded, failed, cancelled, lost')
392
399
  }
393
400
  if (typeof value.startedAt !== 'number' || !Number.isFinite(value.startedAt)) issues.add('startedAt', 'must be a finite millisecond timestamp')
394
- for (const key of ['finishedAt', 'exitCode', 'bytes', 'followUps'] as const) {
401
+ for (const key of ['finishedAt', 'exitCode', 'bytes', 'followUps', 'lastActivityAt'] as const) {
395
402
  if (value[key] === undefined) continue
396
403
  if (typeof value[key] !== 'number' || !Number.isFinite(value[key])) issues.add(key, 'must be a finite number')
397
404
  }
398
- for (const key of ['sessionId', 'branch', 'summary', 'error'] as const) {
405
+ for (const key of ['sessionId', 'branch', 'summary', 'error', 'executionId', 'errorCode'] as const) {
399
406
  if (value[key] === undefined) continue
400
407
  readText(value[key], key, issues)
401
408
  }
@@ -28,6 +28,14 @@ export interface ExecutionRecord {
28
28
  settledAt?: number
29
29
  /** Settlement, absent while the execution is still running. */
30
30
  result?: ExecutionOutcome
31
+ /** Conclusion of a succeeded run. */
32
+ summary?: { text: string; seq?: number }
33
+ /** Failure text of a failed run. */
34
+ error?: string
35
+ /** Stable failure code a provider reported. */
36
+ errorCode?: string
37
+ /** Who recorded the execution (`ssh:<runId>` for this provider). */
38
+ initiatedBy?: string
31
39
  }
32
40
 
33
41
  /** One card, as a provider reads it through the capability face. */
package/src/host/board.ts CHANGED
@@ -25,6 +25,10 @@ export type BoardAction =
25
25
  result: 'succeeded' | 'failed'
26
26
  initiatedBy: string
27
27
  summary?: string
28
+ executionId?: string
29
+ startedAt?: number
30
+ errorCode?: string
31
+ retryHint?: string
28
32
  }
29
33
 
30
34
  /**