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

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 (126) hide show
  1. package/LICENSE +202 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +85 -2
  4. package/README.zh.md +86 -0
  5. package/cordis.patch.yml +15 -0
  6. package/icon.svg +5 -0
  7. package/lib/client.js +4429 -0
  8. package/lib/index.js +6100 -0
  9. package/lib/types/client/PluginSettingsCard.d.ts +255 -0
  10. package/lib/types/client/RangeBubble.d.ts +46 -0
  11. package/lib/types/client/SegmentGroup.d.ts +28 -0
  12. package/lib/types/client/index.d.ts +100 -0
  13. package/lib/types/client/locales.d.ts +125 -0
  14. package/lib/types/client/seat-props.d.ts +53 -0
  15. package/lib/types/client/settings-entry-form.d.ts +49 -0
  16. package/lib/types/client/settings-form.d.ts +237 -0
  17. package/lib/types/client/ssh/card-decoration.d.ts +23 -0
  18. package/lib/types/client/ssh/compose-section.d.ts +7 -0
  19. package/lib/types/client/ssh/detail-section.d.ts +7 -0
  20. package/lib/types/client/ssh/extension.d.ts +54 -0
  21. package/lib/types/client/ssh/log-buffer.d.ts +128 -0
  22. package/lib/types/client/ssh/log-view.d.ts +37 -0
  23. package/lib/types/client/ssh/model.d.ts +130 -0
  24. package/lib/types/client/ssh/settings-section.d.ts +134 -0
  25. package/lib/types/client/ssh/summary.d.ts +160 -0
  26. package/lib/types/client/ssh/target-form.d.ts +60 -0
  27. package/lib/types/core/action.d.ts +89 -0
  28. package/lib/types/core/adapters/claude.d.ts +15 -0
  29. package/lib/types/core/adapters/codex.d.ts +15 -0
  30. package/lib/types/core/adapters/custom.d.ts +29 -0
  31. package/lib/types/core/adapters/dsh.d.ts +21 -0
  32. package/lib/types/core/adapters/index.d.ts +25 -0
  33. package/lib/types/core/adapters/types.d.ts +76 -0
  34. package/lib/types/core/contract.d.ts +445 -0
  35. package/lib/types/core/launcher-script.d.ts +13 -0
  36. package/lib/types/core/launcher.d.ts +153 -0
  37. package/lib/types/core/ledger.d.ts +123 -0
  38. package/lib/types/core/shell.d.ts +61 -0
  39. package/lib/types/core/target.d.ts +143 -0
  40. package/lib/types/core/task-record.d.ts +63 -0
  41. package/lib/types/core/workspace.d.ts +74 -0
  42. package/lib/types/host/board.d.ts +71 -0
  43. package/lib/types/host/engine.d.ts +418 -0
  44. package/lib/types/host/extension.d.ts +59 -0
  45. package/lib/types/host/logs.d.ts +135 -0
  46. package/lib/types/host/payload.d.ts +75 -0
  47. package/lib/types/host/prompt.d.ts +44 -0
  48. package/lib/types/host/queue.d.ts +53 -0
  49. package/lib/types/host/remote.d.ts +120 -0
  50. package/lib/types/host/settings.d.ts +149 -0
  51. package/lib/types/host/timers.d.ts +20 -0
  52. package/lib/types/host/tools.d.ts +15 -0
  53. package/lib/types/host/workspace/errors.d.ts +29 -0
  54. package/lib/types/host/workspace/git.d.ts +108 -0
  55. package/lib/types/host/workspace/in-place.d.ts +36 -0
  56. package/lib/types/host/workspace/index.d.ts +28 -0
  57. package/lib/types/host/workspace/layout.d.ts +62 -0
  58. package/lib/types/host/workspace/local-git.d.ts +72 -0
  59. package/lib/types/host/workspace/remote-git.d.ts +111 -0
  60. package/lib/types/host/workspace/remote.d.ts +85 -0
  61. package/lib/types/host/workspace/types.d.ts +28 -0
  62. package/lib/types/host/workspace-seam.d.ts +100 -0
  63. package/lib/types/index.d.ts +97 -0
  64. package/lib/types/mount-once.d.ts +55 -0
  65. package/locale/en.json +6 -0
  66. package/locale/zh.json +6 -0
  67. package/package.json +89 -3
  68. package/src/client/PluginSettingsCard.tsx +838 -0
  69. package/src/client/RangeBubble.tsx +164 -0
  70. package/src/client/SegmentGroup.tsx +93 -0
  71. package/src/client/css-modules.d.ts +5 -0
  72. package/src/client/index.ts +195 -0
  73. package/src/client/locales.ts +257 -0
  74. package/src/client/seat-props.ts +58 -0
  75. package/src/client/settings-card.module.css +821 -0
  76. package/src/client/settings-entry-form.ts +141 -0
  77. package/src/client/settings-form.ts +529 -0
  78. package/src/client/ssh/card-decoration.tsx +55 -0
  79. package/src/client/ssh/compose-section.tsx +147 -0
  80. package/src/client/ssh/detail-section.tsx +345 -0
  81. package/src/client/ssh/extension.ts +271 -0
  82. package/src/client/ssh/log-buffer.ts +224 -0
  83. package/src/client/ssh/log-view.tsx +149 -0
  84. package/src/client/ssh/model.ts +299 -0
  85. package/src/client/ssh/settings-section.tsx +401 -0
  86. package/src/client/ssh/summary.ts +388 -0
  87. package/src/client/ssh/target-form.tsx +380 -0
  88. package/src/client/ssh.module.css +617 -0
  89. package/src/core/action.ts +270 -0
  90. package/src/core/adapters/claude.ts +64 -0
  91. package/src/core/adapters/codex.ts +83 -0
  92. package/src/core/adapters/custom.ts +88 -0
  93. package/src/core/adapters/dsh.ts +87 -0
  94. package/src/core/adapters/index.ts +74 -0
  95. package/src/core/adapters/types.ts +95 -0
  96. package/src/core/contract.ts +510 -0
  97. package/src/core/launcher-script.ts +313 -0
  98. package/src/core/launcher.ts +283 -0
  99. package/src/core/ledger.ts +372 -0
  100. package/src/core/shell.ts +77 -0
  101. package/src/core/target.ts +413 -0
  102. package/src/core/task-record.ts +65 -0
  103. package/src/core/workspace.ts +78 -0
  104. package/src/host/board.ts +103 -0
  105. package/src/host/engine.ts +1602 -0
  106. package/src/host/extension.ts +304 -0
  107. package/src/host/logs.ts +297 -0
  108. package/src/host/payload.ts +134 -0
  109. package/src/host/prompt.ts +89 -0
  110. package/src/host/queue.ts +73 -0
  111. package/src/host/remote.ts +328 -0
  112. package/src/host/settings.ts +294 -0
  113. package/src/host/timers.ts +33 -0
  114. package/src/host/tools.ts +259 -0
  115. package/src/host/workspace/errors.ts +43 -0
  116. package/src/host/workspace/git.ts +305 -0
  117. package/src/host/workspace/in-place.ts +58 -0
  118. package/src/host/workspace/index.ts +37 -0
  119. package/src/host/workspace/layout.ts +122 -0
  120. package/src/host/workspace/local-git.ts +164 -0
  121. package/src/host/workspace/remote-git.ts +244 -0
  122. package/src/host/workspace/remote.ts +181 -0
  123. package/src/host/workspace/types.ts +34 -0
  124. package/src/host/workspace-seam.ts +132 -0
  125. package/src/index.ts +243 -0
  126. package/src/mount-once.ts +142 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * The provider's settings section, rendered inside the task board's own
3
+ * settings card.
4
+ *
5
+ * It is the surface that turns this provider on: the board declares the
6
+ * provider-settings seat, and this extension is a provider of that board, so its
7
+ * configuration belongs where the board it configures is configured. The section
8
+ * is therefore NOT gated by the extension's own switch — a section gated by the
9
+ * switch could never turn it back on — and it reads nothing but the settings
10
+ * namespace and the board service.
11
+ *
12
+ * The field names are the Host's own Config schema (`src/index.ts`): `enabled`,
13
+ * `defaultHost`, `defaultAgent`, `defaultMode`, `perHostCap` and the
14
+ * `agentCommands` rows. They are volatile on the Host side, so every write here
15
+ * binds the next run without a restart, and every control is staged by the
16
+ * family card's form: a pick writes when it is made, typed text writes once
17
+ * typing pauses or the field is left.
18
+ *
19
+ * @module dsh-task-board-ssh/client/ssh/settings-section
20
+ */
21
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
22
+ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
23
+ import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
24
+ import { type CardActions, type CardShell, type FieldState } from '../settings-form.ts';
25
+ import { type SshAgentKind, type SshExecutionMode } from '../../core/target.ts';
26
+ /** One agent whose built-in command line an operator may replace. */
27
+ export declare const OVERRIDE_AGENTS: readonly SshAgentKind[];
28
+ /** One stored command override, as the Host's Config carries it. */
29
+ export interface SshAgentCommandRow {
30
+ /** Agent the override applies to. */
31
+ kind: SshAgentKind;
32
+ /** Start template; must reference `{prompt_file}`. */
33
+ command: string;
34
+ /** Resume template, kept as stored when the card does not edit it. */
35
+ resumeCommand?: string;
36
+ }
37
+ /** The extension fields this section edits (the Host's Config schema). */
38
+ export interface SshSettings {
39
+ /** Master switch for the extension. */
40
+ enabled?: boolean;
41
+ /** Host alias a card's target form opens with. */
42
+ defaultHost?: string;
43
+ /** Execution mode a new target opens on. */
44
+ defaultMode?: SshExecutionMode;
45
+ /** Agent CLI a new target opens on. */
46
+ defaultAgent?: SshAgentKind;
47
+ /** How many cards may run at once on one host. */
48
+ perHostCap?: number;
49
+ /** Per-agent command templates that replace the built-in command line. */
50
+ agentCommands?: SshAgentCommandRow[];
51
+ }
52
+ /** What the section renders. */
53
+ export interface SshSettingsCardState extends CardShell {
54
+ /** The master switch. */
55
+ enabled: FieldState;
56
+ /** The default host alias. */
57
+ defaultHost: FieldState;
58
+ /** The default execution mode. */
59
+ defaultMode: FieldState;
60
+ /** The default agent CLI. */
61
+ defaultAgent: FieldState;
62
+ /** The per-host running cap. */
63
+ perHostCap: FieldState;
64
+ /** The agent command overrides, as one JSON draft. */
65
+ agentCommands: FieldState;
66
+ }
67
+ /** The registration-side face the section's slot entry injects. */
68
+ export interface SshSettingsCardFace extends CardActions {
69
+ hooks: {
70
+ /** Section snapshot bound by the renderer as useSshSettingsCard. */
71
+ sshSettingsCard: SnapshotStore<SshSettingsCardState>;
72
+ };
73
+ }
74
+ /**
75
+ * Bounds of the per-host cap, restated from the Host's own normalization
76
+ * (`src/host/queue.ts`'s `PER_HOST_CAP_MIN`/`PER_HOST_CAP_MAX`, which the Config
77
+ * schema in `src/index.ts` bounds too). The client may not import the host half,
78
+ * so `tests/client-limits.spec.ts` pins the two restatements against each other.
79
+ */
80
+ export declare const HOST_CAP: {
81
+ readonly min: 1;
82
+ readonly max: 16;
83
+ readonly step: 1;
84
+ readonly fallback: 2;
85
+ };
86
+ /**
87
+ * Read the stored override rows; anything unreadable reads as no override.
88
+ * @param value - the stored field value.
89
+ * @returns the rows, one per agent at most.
90
+ */
91
+ export declare function readAgentRows(value: unknown): SshAgentCommandRow[];
92
+ /**
93
+ * Read the override rows out of their JSON draft.
94
+ * @param text - the field's draft text.
95
+ * @returns the rows; an unreadable draft reads as no override.
96
+ */
97
+ export declare function parseAgentRowsText(text: string): SshAgentCommandRow[];
98
+ /**
99
+ * Replace one agent's start template, keeping everything else the row stores.
100
+ *
101
+ * A cleared template removes the row: an override without a command means "use
102
+ * the built-in command line", and storing an empty one would ask the Host to
103
+ * start nothing.
104
+ * @param text - the field's current draft text.
105
+ * @param kind - agent the edit belongs to.
106
+ * @param command - the new template.
107
+ * @returns the new draft text.
108
+ */
109
+ export declare function withAgentCommand(text: string, kind: SshAgentKind, command: string): string;
110
+ /** Bridges the extension's settings form onto the card's staged form. */
111
+ export declare class SshSettingsCardController {
112
+ private readonly form;
113
+ private readonly store;
114
+ /**
115
+ * @param scope - the bound configuration form of the entry that owns this namespace.
116
+ */
117
+ constructor(scope: ConfigForm<SshSettings>);
118
+ private projection;
119
+ /**
120
+ * Build the face the section's slot registration injects.
121
+ * @returns the section's snapshot store and its form actions.
122
+ */
123
+ inject(): SshSettingsCardFace;
124
+ /** Release the card's scope subscription and bound stores. */
125
+ dispose(): void;
126
+ }
127
+ /** Props the renderer binds for the board's provider-settings seat. */
128
+ export type SshSettingsSectionProps = PropsRuntime<'task-board.settings.section'> & PropsLocale<'task-board-ssh'> & InjectFace<SshSettingsCardFace>;
129
+ /**
130
+ * Render the SSH provider's settings section.
131
+ * @param props - locale copy, the section snapshot, and its form actions.
132
+ * @returns the section.
133
+ */
134
+ export declare function SshSettingsSection(props: SshSettingsSectionProps): import("react").JSX.Element;
@@ -0,0 +1,160 @@
1
+ import type { SshAgentKind, SshExecutionMode, SshRunPhase, SshWorkspaceKind } from '../../core/target.ts';
2
+ /** One host as the provider publishes it: no secret, no ProxyCommand text. */
3
+ export interface SshSummaryHost {
4
+ /** Alias every remote operation addresses. */
5
+ alias: string;
6
+ /** Hostname or IP. */
7
+ host: string;
8
+ /** Login user. */
9
+ user: string;
10
+ /** SSH port. */
11
+ port: number;
12
+ /** Deployment label, when the host carries one. */
13
+ environment?: string;
14
+ /** Free-form note, when the host carries one. */
15
+ description?: string;
16
+ }
17
+ /**
18
+ * One run's log increment.
19
+ *
20
+ * The provider reads the run's remote stdout file by byte offset and publishes
21
+ * what it read since the previous window: `[baseOffset, endOffset)` with the
22
+ * bytes themselves as `text`. A window that starts at zero is a replay from the
23
+ * first byte — the provider publishes one whenever a card's detail is opened —
24
+ * and a window that starts where the previous one ended is the running tail.
25
+ */
26
+ export interface SshSummaryLogWindow {
27
+ /** Run these bytes belong to. */
28
+ runId: string;
29
+ /** Byte offset of `text`'s first byte in the remote file. */
30
+ baseOffset: number;
31
+ /** Byte offset just past `text`'s last byte. */
32
+ endOffset: number;
33
+ /** The bytes themselves, verbatim. */
34
+ text: string;
35
+ /** Legacy flag: whether bytes were skipped before `baseOffset` (or trailing bytes remain when `hasMore` is also set). */
36
+ truncated?: boolean;
37
+ /** Explicit flag: whether more trailing bytes exist after `endOffset` on the remote host. */
38
+ hasMore?: boolean;
39
+ }
40
+ /** One registered local workspace exposed by the board mirror. */
41
+ export interface SshBoardWorkspaceOption {
42
+ workspaceId: string;
43
+ title: string;
44
+ }
45
+ /** Defaults the provider prefills a new target from. */
46
+ export interface SshSummaryDefaults {
47
+ /** Host alias a new target opens with. */
48
+ host?: string;
49
+ /** Execution mode. */
50
+ mode?: SshExecutionMode;
51
+ /** Agent CLI. */
52
+ agent?: SshAgentKind;
53
+ /** Filesystem mechanism. */
54
+ workspace?: SshWorkspaceKind;
55
+ }
56
+ /** One card's run, as the provider publishes its progress. */
57
+ export interface SshSummaryRun {
58
+ /** Card the run belongs to. */
59
+ taskId: string;
60
+ /** Run identifier. */
61
+ runId: string;
62
+ /** Phase the provider last recorded. */
63
+ phase: SshRunPhase;
64
+ /** Host the run addresses. */
65
+ host: string;
66
+ /** Bytes of the remote log the provider has read. */
67
+ bytes?: number;
68
+ /**
69
+ * Files the run left untracked in the workspace it came back from.
70
+ *
71
+ * Present only when the placement strategy reported any: an absent count
72
+ * means nothing was left behind, which reads the same as no notice at all.
73
+ */
74
+ untrackedFiles?: number;
75
+ }
76
+ /** The provider's read-only summary; every field is optional on the wire. */
77
+ export interface SshSummary {
78
+ /** Whether the host half currently runs its extension. */
79
+ enabled?: boolean;
80
+ /** Configured hosts, in `dsh-ssh` store order. */
81
+ hosts?: SshSummaryHost[];
82
+ /** Prefill values for a new target. */
83
+ defaults?: SshSummaryDefaults;
84
+ /** Per-host running cap, keyed by host alias. */
85
+ caps?: Record<string, number>;
86
+ /** Log increments, keyed by task id. */
87
+ logs?: Record<string, SshSummaryLogWindow>;
88
+ /** Runs in flight, one entry per card the provider follows. */
89
+ runs?: SshSummaryRun[];
90
+ }
91
+ /**
92
+ * Normalize whatever the board hands back; a foreign payload reads as absent.
93
+ * @param value - the mirror's entry for this extension.
94
+ * @returns the summary, or undefined when nothing usable is published.
95
+ */
96
+ export declare function decodeSummary(value: unknown): SshSummary | undefined;
97
+ /**
98
+ * What the browser can tell about the provider's host half.
99
+ *
100
+ * The board carries a published summary only while the extension's host half is
101
+ * registered and running: the ssh row mounts its extension behind one dependency
102
+ * scope that needs both `taskBoard` and `dshSsh`, and its `start()` publishes
103
+ * before that registration returns. So a mirror frame WITHOUT the `ssh` key is
104
+ * positive evidence that nothing is mounted — the case a deployment hits when
105
+ * `dsh-ssh` ships disabled and this row therefore never registers. What follows
106
+ * is the opposite mistake: no frame has arrived yet, so nothing is known and
107
+ * nothing is claimed.
108
+ */
109
+ export type SshHostHalfStatus =
110
+ /** No mirror frame has been observed yet: nothing is known, nothing is claimed. */
111
+ 'unknown'
112
+ /** A frame has carried this extension's summary, now or earlier in this page. */
113
+ | 'mounted'
114
+ /** Frames have arrived and never carried it: the host half is not mounted. */
115
+ | 'unmounted';
116
+ /**
117
+ * Read one client mirror frame: store this extension's summary and record
118
+ * whether the frame carried it at all.
119
+ *
120
+ * The presence of the key is the evidence, not the shape of its value: a
121
+ * registered provider publishes a summary even before it has anything to report,
122
+ * and an unregistered one publishes nothing at all.
123
+ * @param published - the mirror's `extensions` map.
124
+ */
125
+ export declare function acceptPublishedSummary(published: Readonly<Record<string, unknown>>): void;
126
+ /** Drop the summary (the board reports the extension is not running). */
127
+ export declare function clearSummary(): void;
128
+ /**
129
+ * Whether the provider's host half is mounted, as far as this page can tell.
130
+ * @returns the status; `unknown` until the first mirror frame arrives.
131
+ */
132
+ export declare function getHostHalfStatus(): SshHostHalfStatus;
133
+ /**
134
+ * Forget everything about this page's mirror history: for a fresh mount and for
135
+ * a spec that models one.
136
+ */
137
+ export declare function resetSummaryStore(): void;
138
+ /** Update supplemental board mirror context (local workspaces + last Host refusal). */
139
+ export declare function acceptBoardContext(context: {
140
+ workspaces?: readonly SshBoardWorkspaceOption[];
141
+ lastError?: string;
142
+ }): void;
143
+ /** Most recent Host transport/action refusal reported by the board mirror. */
144
+ export declare function getLastBoardError(): string | undefined;
145
+ /** Registered local workspaces observed from the board mirror. */
146
+ export declare function getBoardWorkspaces(): readonly SshBoardWorkspaceOption[];
147
+ /** Observe the registered local workspaces from a React component. */
148
+ export declare function useBoardWorkspaces(): readonly SshBoardWorkspaceOption[];
149
+ /** The current summary, or undefined while none is published. */
150
+ export declare function getSummary(): SshSummary | undefined;
151
+ /**
152
+ * Observe the published summary from a React component.
153
+ * @returns the current summary, or undefined while none is published.
154
+ */
155
+ export declare function usePublishedSummary(): SshSummary | undefined;
156
+ /**
157
+ * Observe whether the provider's host half is mounted.
158
+ * @returns the status, re-rendering when the first frame settles it.
159
+ */
160
+ export declare function useHostHalfStatus(): SshHostHalfStatus;
@@ -0,0 +1,60 @@
1
+ import { type SshDraftField, type SshTargetDraft } from './model.ts';
2
+ import type { SshTarget, SshValidationIssue } from '../../core/target.ts';
3
+ import { type SshBoardWorkspaceOption, type SshSummaryHost } from './summary.ts';
4
+ /**
5
+ * Localized copy for one parser refusal.
6
+ * @param field - the field the refusal is addressed to.
7
+ * @param issue - the parser's own sentence, used when the field has no copy of its own.
8
+ * @returns the sentence to render under the field.
9
+ */
10
+ export declare function refusalText(field: SshDraftField, issue: SshValidationIssue): string;
11
+ /** Props of the field set both target surfaces render. */
12
+ export interface SshTargetFieldsProps {
13
+ /** The values to render. */
14
+ draft: SshTargetDraft;
15
+ /** Refusals to show, keyed by the field that carries each one. */
16
+ errors: Partial<Record<SshDraftField, SshValidationIssue>>;
17
+ /** Hosts the picker offers; empty when the provider publishes none. */
18
+ hosts: readonly SshSummaryHost[];
19
+ /** Local workspaces the picker offers for `git` -> `workspace` source; falls back to board mirror. */
20
+ workspaces?: readonly SshBoardWorkspaceOption[];
21
+ /** The pinned alias that is no longer in the host list, when there is one. */
22
+ unknownHost?: string;
23
+ /** Whether every control is read-only because a write is in flight. */
24
+ disabled?: boolean;
25
+ /** One line under the mode choice; a frame with room for it passes one, a dialog skips it. */
26
+ modeHint?: string;
27
+ /** Called when the operator leaves a field (blur), so progressive validation can surface refusals. */
28
+ onTouch?(field: SshDraftField): void;
29
+ /** Called with the fields one control changed. */
30
+ onChange(patch: Partial<SshTargetDraft>): void;
31
+ }
32
+ /**
33
+ * Render the fields of one target, in the order a reader walks them.
34
+ * @param props - the values, the refusals, the hosts to offer and the edit callback.
35
+ * @returns the field set, in the shape the current draft asks for.
36
+ */
37
+ export declare function SshTargetFields({ draft, errors, hosts, workspaces, unknownHost, disabled, modeHint, onTouch, onChange }: SshTargetFieldsProps): import("react").JSX.Element;
38
+ /** Props of the target form. */
39
+ export interface SshTargetFormProps {
40
+ /** State the form opens with. */
41
+ initial: SshTargetDraft;
42
+ /** Hosts the picker offers; empty when the provider publishes none. */
43
+ hosts: readonly SshSummaryHost[];
44
+ /** The pinned alias that is no longer in the host list, when there is one. */
45
+ unknownHost?: string;
46
+ /** Whether a write is in flight. */
47
+ saving: boolean;
48
+ /** Text of the submit control. */
49
+ submitLabel: string;
50
+ /** Drop the form without writing, when the caller has somewhere to go back to. */
51
+ onCancel?: () => void;
52
+ /** Called with the parsed target once every field passes. */
53
+ onSubmit(target: SshTarget): void;
54
+ }
55
+ /**
56
+ * Render the target form: the same fields, framed by one save action.
57
+ * @param props - the opening state, the hosts to offer and the write callbacks.
58
+ * @returns the form, in the shape the current draft asks for.
59
+ */
60
+ export declare function SshTargetForm({ initial, hosts, unknownHost, saving, submitLabel, onCancel, onSubmit }: SshTargetFormProps): import("react").JSX.Element;
@@ -0,0 +1,89 @@
1
+ import { type SshTarget, type SshValidationIssue, type SshValidationResult } from './target.ts';
2
+ /** Extension id the board routes this provider's actions under. */
3
+ export declare const SSH_EXTENSION_ID = "ssh";
4
+ /** Every action this provider accepts, in the order the card surface offers them. */
5
+ export declare const SSH_ACTION_NAMES: readonly ["run", "cancel", "follow-up", "rework", "set-target", "refresh"];
6
+ /** One action name. */
7
+ export type SshActionName = (typeof SSH_ACTION_NAMES)[number];
8
+ /** Start the pinned card's remote run now. */
9
+ export interface SshRunActionRequest {
10
+ /** Action discriminator. */
11
+ action: 'run';
12
+ /** Card to run. */
13
+ taskId: string;
14
+ }
15
+ /** Stop the card's active remote run through the launcher's cancel verb. */
16
+ export interface SshCancelActionRequest {
17
+ /** Action discriminator. */
18
+ action: 'cancel';
19
+ /** Card whose run to stop. */
20
+ taskId: string;
21
+ }
22
+ /** Deliver one follow-up user message into the card's remote agent session. */
23
+ export interface SshFollowUpActionRequest {
24
+ /** Action discriminator. */
25
+ action: 'follow-up';
26
+ /** Card whose session receives the message. */
27
+ taskId: string;
28
+ /** Message text, bounded like every board message. */
29
+ text: string;
30
+ }
31
+ /** Send the card back with rework instructions, in the same remote session. */
32
+ export interface SshReworkActionRequest {
33
+ /** Action discriminator. */
34
+ action: 'rework';
35
+ /** Card to send back. */
36
+ taskId: string;
37
+ /** Rework instructions, bounded like every board message. */
38
+ instructions: string;
39
+ }
40
+ /** Pin or replace the card's execution target. */
41
+ export interface SshSetTargetActionRequest {
42
+ /** Action discriminator. */
43
+ action: 'set-target';
44
+ /** Card to retarget. */
45
+ taskId: string;
46
+ /** The target to pin. */
47
+ target: SshTarget;
48
+ }
49
+ /** Re-read a run's remote state (the card's poll bypass, and the settings probe). */
50
+ export interface SshRefreshActionRequest {
51
+ /** Action discriminator. */
52
+ action: 'refresh';
53
+ /** Card to refresh, or omitted to refresh every targeted card. */
54
+ taskId?: string;
55
+ /** One run of that card to re-read, or omitted to re-read whatever is active. */
56
+ runId?: string;
57
+ /** Byte offset to replay the run's log from (defaults to 0). */
58
+ offset?: number;
59
+ }
60
+ /** One request this provider's host half accepts. */
61
+ export type SshActionRequest = SshRunActionRequest | SshCancelActionRequest | SshFollowUpActionRequest | SshReworkActionRequest | SshSetTargetActionRequest | SshRefreshActionRequest;
62
+ /** A successful reply, as the browser half reads it. */
63
+ export interface SshActionReplyOk {
64
+ /** Discriminator. */
65
+ ok: true;
66
+ /** Card the reply is about, when it is about one. */
67
+ taskId?: string;
68
+ /** Run the reply is about, when it is about one. */
69
+ runId?: string;
70
+ /** One sentence the card shows next to the run state. */
71
+ message?: string;
72
+ }
73
+ /** A refused reply; `issues` carries the field diagnostics when there are any. */
74
+ export interface SshActionReplyFailure {
75
+ /** Discriminator. */
76
+ ok: false;
77
+ /** One sentence a person can act on. */
78
+ error: string;
79
+ /** Field-level diagnostics, when the refusal came from a malformed request. */
80
+ issues?: readonly SshValidationIssue[];
81
+ }
82
+ /** What an action returns; never a throw, so the browser always has a value. */
83
+ export type SshActionReply = SshActionReplyOk | SshActionReplyFailure;
84
+ /**
85
+ * Parse one dispatched envelope.
86
+ * @param value - candidate request as the board forwards it.
87
+ * @returns the typed request, or every reason it was refused.
88
+ */
89
+ export declare function parseSshActionRequest(value: unknown): SshValidationResult<SshActionRequest>;
@@ -0,0 +1,15 @@
1
+ import { type SshAgentCommand, type SshAgentOutput, type SshAgentRunInput } from './types.ts';
2
+ /** Program named on the remote host. */
3
+ export declare const CLAUDE_PROGRAM = "claude";
4
+ /**
5
+ * Build the Claude Code command line for one run.
6
+ * @param input - run facts.
7
+ * @returns the quoted command line, reading the prompt from stdin.
8
+ */
9
+ export declare function claudeAgentCommand(input: SshAgentRunInput): SshAgentCommand;
10
+ /**
11
+ * Read the session id and the final summary out of a Claude Code stream.
12
+ * @param output - captured stdout of one run.
13
+ * @returns whatever the stream reported.
14
+ */
15
+ export declare function readClaudeOutput(output: string): SshAgentOutput;
@@ -0,0 +1,15 @@
1
+ import { type SshAgentCommand, type SshAgentOutput, type SshAgentRunInput } from './types.ts';
2
+ /** Program named on the remote host. */
3
+ export declare const CODEX_PROGRAM = "codex";
4
+ /**
5
+ * Build the Codex command line for one run.
6
+ * @param input - run facts.
7
+ * @returns the quoted command line, reading the prompt from stdin.
8
+ */
9
+ export declare function codexAgentCommand(input: SshAgentRunInput): SshAgentCommand;
10
+ /**
11
+ * Read the thread id and the final message out of a Codex event stream.
12
+ * @param output - captured stdout of one run.
13
+ * @returns whatever the stream reported; unverified against a real binary.
14
+ */
15
+ export declare function readCodexOutput(output: string): SshAgentOutput;
@@ -0,0 +1,29 @@
1
+ import type { SshAgentCommand, SshAgentRunInput, SshCustomTemplates } from './types.ts';
2
+ /** Placeholders a template may carry. */
3
+ export declare const CUSTOM_PLACEHOLDERS: readonly ["prompt_file", "cwd", "session"];
4
+ /** One placeholder name. */
5
+ export type CustomPlaceholder = (typeof CUSTOM_PLACEHOLDERS)[number];
6
+ /**
7
+ * Check one template before a run depends on it.
8
+ * @param template - the template text.
9
+ * @returns the reason it cannot be used, or undefined when it can.
10
+ */
11
+ export declare function validateCustomTemplate(template: string): string | undefined;
12
+ /**
13
+ * Build a custom agent's command line for one run.
14
+ *
15
+ * The start template is used when `resumeSessionId` is absent. A resume without
16
+ * a resume template is a fresh run carrying the earlier summary, which is the
17
+ * documented degradation, so the start template answers it.
18
+ * @param input - run facts.
19
+ * @param templates - the user's templates.
20
+ * @returns the quoted command line.
21
+ * @throws RangeError when a template fails {@link validateCustomTemplate}.
22
+ */
23
+ export declare function customAgentCommand(input: SshAgentRunInput, templates: SshCustomTemplates): SshAgentCommand;
24
+ /**
25
+ * Whether a custom agent can continue a session.
26
+ * @param templates - the user's templates.
27
+ * @returns true when a resume template is present.
28
+ */
29
+ export declare function customResumeSupported(templates: SshCustomTemplates): boolean;
@@ -0,0 +1,21 @@
1
+ import { type SshAgentCommand, type SshAgentOutput, type SshAgentRunInput } from './types.ts';
2
+ /**
3
+ * Permission preset every remote run uses: unrestricted sandbox with approval
4
+ * policy `never`, which is what "fully unattended" means on a host nobody is
5
+ * watching.
6
+ */
7
+ export declare const DSH_FULL_ACCESS_PRESET = "danger-full-access";
8
+ /** Program named on the remote host. */
9
+ export declare const DSH_PROGRAM = "dsh";
10
+ /**
11
+ * Build the dsh command line for one run.
12
+ * @param input - run facts.
13
+ * @returns the quoted command line, reading the prompt from stdin.
14
+ */
15
+ export declare function dshAgentCommand(input: SshAgentRunInput): SshAgentCommand;
16
+ /**
17
+ * Read the session id and the final summary out of a dsh event stream.
18
+ * @param output - captured stdout of one run.
19
+ * @returns whatever the stream reported.
20
+ */
21
+ export declare function readDshOutput(output: string): SshAgentOutput;
@@ -0,0 +1,25 @@
1
+ import type { SshAgentCommand, SshAgentOutput, SshAgentRunInput, SshCustomTemplates } from './types.ts';
2
+ export * from './types.ts';
3
+ export { DSH_FULL_ACCESS_PRESET, DSH_PROGRAM, dshAgentCommand, readDshOutput } from './dsh.ts';
4
+ export { CLAUDE_PROGRAM, claudeAgentCommand, readClaudeOutput } from './claude.ts';
5
+ export { CODEX_PROGRAM, codexAgentCommand, readCodexOutput } from './codex.ts';
6
+ export { CUSTOM_PLACEHOLDERS, customAgentCommand, customResumeSupported, validateCustomTemplate, } from './custom.ts';
7
+ /**
8
+ * Build the command line one run starts with.
9
+ *
10
+ * The prompt reaches the agent through `stdinFile` for the three built-in CLIs,
11
+ * so a long prompt never has to fit in one argument; a custom template decides
12
+ * for itself and usually reads `{prompt_file}`.
13
+ * @param input - run facts; `resumeSessionId` selects the resume form.
14
+ * @param templates - the deployment's custom-agent templates, required for kind `custom`.
15
+ * @returns the quoted command line and the stdin file, when the agent reads one.
16
+ * @throws RangeError when a custom agent is selected without usable templates.
17
+ */
18
+ export declare function buildAgentCommandLine(input: SshAgentRunInput, templates?: SshCustomTemplates): SshAgentCommand;
19
+ /**
20
+ * Read the session id and the final summary out of one run's output stream.
21
+ * @param input - which agent produced the stream.
22
+ * @param output - captured stdout.
23
+ * @returns whatever the agent's reader found; a custom agent reports nothing.
24
+ */
25
+ export declare function readAgentOutput(input: SshAgentRunInput, output: string): SshAgentOutput;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * What every agent adapter consumes and produces.
3
+ *
4
+ * An adapter is a pure function pair: one maps a run's facts onto the command
5
+ * line the remote launcher runs, the other reads the agent's output stream for
6
+ * the session id and the final summary. Neither touches the network, the
7
+ * filesystem or the clock, so both are snapshot-testable and a new agent CLI is
8
+ * one module plus one row in the dispatch table.
9
+ *
10
+ * @module dsh-task-board-ssh/core/adapters/types
11
+ */
12
+ import type { SshAgentKind } from '../target.ts';
13
+ /** Everything one adapter needs about the run it is building a command for. */
14
+ export interface SshAgentRunInput {
15
+ /** Agent CLI kind; selects the adapter. */
16
+ agent: SshAgentKind;
17
+ /** Absolute remote path of the prompt file the caller wrote. */
18
+ promptFile: string;
19
+ /** Absolute remote directory the launcher changes into first. */
20
+ cwd: string;
21
+ /** Session to continue; absent builds the start command, present the resume command. */
22
+ resumeSessionId?: string;
23
+ }
24
+ /** One command line, fully quoted, plus the file it reads its prompt from. */
25
+ export interface SshAgentCommand {
26
+ /** Single-line POSIX command, every word already quoted. */
27
+ command: string;
28
+ /** Absolute remote file redirected into the command's stdin, when it reads one. */
29
+ stdinFile?: string;
30
+ }
31
+ /**
32
+ * What one run is worth, as the agent reported it.
33
+ *
34
+ * `ok: false` carries the agent's own failure text verbatim, because the card
35
+ * shows it; the caller bounds it before storing.
36
+ */
37
+ export type SshAgentOutcome = {
38
+ ok: true;
39
+ text: string;
40
+ } | {
41
+ ok: false;
42
+ error: string;
43
+ };
44
+ /** What a reader found in one output stream; both members are absent when it found neither. */
45
+ export interface SshAgentOutput {
46
+ /** Session id the agent reported, usable as `resumeSessionId` later. */
47
+ sessionId?: string;
48
+ /** Final summary, or the agent's own failure. */
49
+ outcome?: SshAgentOutcome;
50
+ }
51
+ /** User-supplied command templates of a custom agent. */
52
+ export interface SshCustomTemplates {
53
+ /** Start template; must reference `{prompt_file}`. */
54
+ command: string;
55
+ /** Resume template; absent degrades a follow-up to a fresh run. */
56
+ resumeCommand?: string;
57
+ }
58
+ /** One line of newline-delimited JSON, as an object. */
59
+ export type JsonLine = Record<string, unknown>;
60
+ /**
61
+ * Read newline-delimited JSON without throwing.
62
+ *
63
+ * Agents interleave progress notes and warnings with their event stream, and a
64
+ * truncated final line is normal when a run is killed mid-write, so a line that
65
+ * is not a JSON object is skipped instead of failing the read.
66
+ * @param output - the whole captured stream.
67
+ * @returns every line that parsed to an object, in order.
68
+ */
69
+ export declare function readJsonLines(output: string): JsonLine[];
70
+ /**
71
+ * Read one string field off an arbitrary JSON value without a cast.
72
+ * @param value - container to read.
73
+ * @param key - field name.
74
+ * @returns the string, or undefined when the field is absent or not a string.
75
+ */
76
+ export declare function readString(value: unknown, key: string): string | undefined;