Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
173 lines
5.1 KiB
TypeScript
173 lines
5.1 KiB
TypeScript
/// <reference path="./netcatty-bridge-script.d.ts" />
|
|
|
|
export type ScriptRunStatus = 'running' | 'paused' | 'completed' | 'failed';
|
|
|
|
export type ScriptProgressMode = 'activity' | 'determinate';
|
|
|
|
export interface ScriptRunLogEntry {
|
|
at: number;
|
|
message: string;
|
|
}
|
|
|
|
export interface ScriptRun {
|
|
runId: string;
|
|
scriptId?: string;
|
|
scriptLabel?: string;
|
|
sessionId: string;
|
|
status: ScriptRunStatus;
|
|
startedAt: number;
|
|
endedAt?: number;
|
|
/** @deprecated Use activityLabel for UI; kept for backward compatibility */
|
|
currentStep?: string;
|
|
stepIndex?: number;
|
|
/** Internal telemetry only; do not use for overlay percentage */
|
|
totalSteps?: number;
|
|
progressMode?: ScriptProgressMode;
|
|
activityLabel?: string;
|
|
progressLabel?: string;
|
|
progressCurrent?: number;
|
|
progressTotal?: number;
|
|
elapsedMs?: number;
|
|
waitingFor?: string;
|
|
logs: ScriptRunLogEntry[];
|
|
error?: string;
|
|
}
|
|
|
|
export interface ScriptScreenSnapshot {
|
|
rows: number;
|
|
cols: number;
|
|
currentRow: number;
|
|
lines: string[];
|
|
}
|
|
|
|
export interface ScriptDialogOption {
|
|
label: string;
|
|
value: string;
|
|
description?: string;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export type ScriptDialogConditionValue = string | number | boolean;
|
|
|
|
export type ScriptDialogCondition =
|
|
| { field: string; equals: ScriptDialogConditionValue }
|
|
| { field: string; notEquals: ScriptDialogConditionValue }
|
|
| { field: string; truthy: true }
|
|
| { field: string; falsy: true };
|
|
|
|
export interface ScriptDialogFieldBase {
|
|
name: string;
|
|
label: string;
|
|
description?: string;
|
|
required?: boolean;
|
|
visibleWhen?: ScriptDialogCondition;
|
|
}
|
|
|
|
export interface ScriptDialogChoiceField extends ScriptDialogFieldBase {
|
|
type: 'select' | 'radio';
|
|
options: ScriptDialogOption[];
|
|
defaultValue: string;
|
|
}
|
|
|
|
export interface ScriptDialogCheckboxField extends ScriptDialogFieldBase {
|
|
type: 'checkbox';
|
|
defaultValue: boolean;
|
|
}
|
|
|
|
export interface ScriptDialogTextareaField extends ScriptDialogFieldBase {
|
|
type: 'textarea';
|
|
defaultValue: string;
|
|
placeholder?: string;
|
|
}
|
|
|
|
export interface ScriptDialogNumberField extends ScriptDialogFieldBase {
|
|
type: 'number';
|
|
defaultValue?: number;
|
|
placeholder?: string;
|
|
min?: number;
|
|
max?: number;
|
|
step?: number;
|
|
}
|
|
|
|
export type ScriptDialogField =
|
|
| ScriptDialogChoiceField
|
|
| ScriptDialogCheckboxField
|
|
| ScriptDialogTextareaField
|
|
| ScriptDialogNumberField;
|
|
|
|
export interface ScriptDialogForm {
|
|
title?: string;
|
|
message: string;
|
|
submitLabel?: string;
|
|
cancelLabel?: string;
|
|
fields: ScriptDialogField[];
|
|
}
|
|
|
|
export type ScriptDialogFormValue = string | boolean | number | undefined;
|
|
|
|
export interface ScriptDialogRequest {
|
|
requestId: string;
|
|
type: 'alert' | 'confirm' | 'prompt' | 'waitForTimeout' | 'form';
|
|
message: string;
|
|
defaultValue?: string;
|
|
sensitive?: boolean;
|
|
pattern?: string;
|
|
timeoutMs?: number;
|
|
form?: ScriptDialogForm;
|
|
}
|
|
|
|
export interface ScriptRunParams {
|
|
/** Optional caller-generated id so a queued run can be cancelled before it starts. */
|
|
runId?: string;
|
|
/** Return after the run enters the backend queue instead of waiting for completion. */
|
|
returnWhenQueued?: boolean;
|
|
scriptId?: string;
|
|
scriptLabel?: string;
|
|
content: string;
|
|
sessionId?: string;
|
|
sessionIds?: string[];
|
|
mode?: 'sequential' | 'parallel';
|
|
permissionMode?: 'observer' | 'confirm' | 'auto';
|
|
/** Renderer-provided session state (worker SSH sessions are not in main-process map). */
|
|
sessionMeta?: {
|
|
connected?: boolean;
|
|
name?: string;
|
|
hostname?: string;
|
|
username?: string;
|
|
};
|
|
}
|
|
|
|
export type ScriptRecordingStep =
|
|
| { type: 'send'; value: string; sensitive?: boolean }
|
|
| { type: 'waitFor'; value: string; timeoutMs?: number }
|
|
| { type: 'waitForPrompt'; timeoutMs?: number }
|
|
| { type: 'sleep'; value: number };
|
|
|
|
declare global {
|
|
interface NetcattyBridge {
|
|
scriptRun(params: ScriptRunParams): Promise<{ runId: string; runIds: string[] }>;
|
|
scriptStop(runId: string): Promise<{ ok: boolean }>;
|
|
scriptPause(runId: string): Promise<{ ok: boolean }>;
|
|
scriptResume(runId: string): Promise<{ ok: boolean }>;
|
|
scriptGetRuns(sessionId?: string): Promise<ScriptRun[]>;
|
|
scriptDialogResponse(requestId: string, value?: unknown, cancelled?: boolean): Promise<{ ok: boolean }>;
|
|
scriptScreenSnapshotResponse(requestId: string, snapshot: ScriptScreenSnapshot): Promise<{ ok: boolean }>;
|
|
scriptRecordingStart(sessionId: string): Promise<{ ok: boolean }>;
|
|
scriptRecordingStop(sessionId: string): Promise<{ steps: ScriptRecordingStep[]; code: string }>;
|
|
scriptRecordingAppendStep(sessionId: string, step: ScriptRecordingStep): Promise<{
|
|
ok: boolean;
|
|
stopped?: boolean;
|
|
reason?: 'limit';
|
|
error?: string;
|
|
steps?: ScriptRecordingStep[];
|
|
code?: string;
|
|
}>;
|
|
onScriptRunsUpdated(cb: (payload: { runs: ScriptRun[] }) => void): () => void;
|
|
onScriptDialogRequest(cb: (payload: ScriptDialogRequest) => void): () => void;
|
|
onScriptScreenSnapshotRequest(cb: (payload: { requestId: string; sessionId: string }) => void): () => void;
|
|
onScriptSessionInput(cb: (payload: { sessionId: string; data: string }) => void): () => void;
|
|
}
|
|
}
|
|
|
|
export {};
|