@revoengine/cli 1.0.31 → 1.0.34
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/CHANGELOG.md +25 -0
- package/README.md +152 -24
- package/dist/src/argument-contract.d.ts +17 -0
- package/dist/src/argument-contract.js +359 -0
- package/dist/src/automation-contract.generated.d.ts +56 -22
- package/dist/src/automation-contract.generated.js +68 -26
- package/dist/src/cli.js +15 -13
- package/dist/src/client.d.ts +34 -2
- package/dist/src/client.js +76 -13
- package/dist/src/commands/agents.js +5 -1
- package/dist/src/commands/auth.js +2 -0
- package/dist/src/commands/component.js +34 -17
- package/dist/src/commands/database-tables.js +15 -4
- package/dist/src/commands/database-views.js +5 -1
- package/dist/src/commands/endpoints.js +5 -1
- package/dist/src/commands/env.js +5 -1
- package/dist/src/commands/events.js +5 -1
- package/dist/src/commands/groups.js +5 -1
- package/dist/src/commands/info.js +2 -0
- package/dist/src/commands/job-templates.js +5 -1
- package/dist/src/commands/metadata.js +2 -0
- package/dist/src/commands/migrate.d.ts +2 -2
- package/dist/src/commands/migrate.js +33 -7
- package/dist/src/commands/project.js +19 -14
- package/dist/src/commands/request.js +2 -0
- package/dist/src/commands/role-groups.js +5 -1
- package/dist/src/commands/schedules.js +5 -1
- package/dist/src/commands/search.js +2 -0
- package/dist/src/commands/service-accounts.js +5 -1
- package/dist/src/commands/studio.js +2 -0
- package/dist/src/commands/terminal-browser-central-profile.d.ts +65 -0
- package/dist/src/commands/terminal-browser-central-profile.js +203 -0
- package/dist/src/commands/terminal-browser-human-input.d.ts +3 -1
- package/dist/src/commands/terminal-browser-human-input.js +3 -1
- package/dist/src/commands/terminal-browser-interaction.js +1 -1
- package/dist/src/commands/terminal-browser-live-protocol.d.ts +34 -2
- package/dist/src/commands/terminal-browser-live-protocol.js +28 -12
- package/dist/src/commands/terminal-browser-live-transport.d.ts +1 -0
- package/dist/src/commands/terminal-browser-live-transport.js +9 -5
- package/dist/src/commands/terminal-browser-live.d.ts +24 -3
- package/dist/src/commands/terminal-browser-live.js +199 -30
- package/dist/src/commands/terminal-browser-page-input.d.ts +4 -1
- package/dist/src/commands/terminal-browser-page-input.js +46 -1
- package/dist/src/commands/terminal-browser-profile-crypto.d.ts +30 -0
- package/dist/src/commands/terminal-browser-profile-crypto.js +101 -0
- package/dist/src/commands/terminal-browser-profile-import-runner.d.ts +31 -0
- package/dist/src/commands/terminal-browser-profile-import-runner.js +112 -0
- package/dist/src/commands/terminal-browser-profile-import.d.ts +28 -0
- package/dist/src/commands/terminal-browser-profile-import.js +125 -0
- package/dist/src/commands/terminal-browser-profile-import.protocol.d.ts +50 -0
- package/dist/src/commands/terminal-browser-profile-import.protocol.js +52 -0
- package/dist/src/commands/terminal-browser-profile-preferences.d.ts +1 -0
- package/dist/src/commands/terminal-browser-profile-preferences.js +16 -0
- package/dist/src/commands/terminal-browser-profile-sync.d.ts +14 -0
- package/dist/src/commands/terminal-browser-profile-sync.js +169 -0
- package/dist/src/commands/terminal-browser-profile-sync.protocol.d.ts +50 -0
- package/dist/src/commands/terminal-browser-profile-sync.protocol.js +19 -0
- package/dist/src/commands/terminal-browser-profile.d.ts +10 -1
- package/dist/src/commands/terminal-browser-profile.js +30 -4
- package/dist/src/commands/terminal-browser-recording.d.ts +39 -0
- package/dist/src/commands/terminal-browser-recording.js +74 -0
- package/dist/src/commands/terminal-browser-recording.protocol.d.ts +49 -0
- package/dist/src/commands/terminal-browser-recording.protocol.js +16 -0
- package/dist/src/commands/terminal-browser.d.ts +14 -1
- package/dist/src/commands/terminal-browser.js +98 -33
- package/dist/src/commands/terminal-file-descriptor.d.ts +9 -0
- package/dist/src/commands/terminal-file-descriptor.js +39 -0
- package/dist/src/commands/terminal-file.js +41 -6
- package/dist/src/commands/terminal-image.js +3 -31
- package/dist/src/commands/terminal-output-buffer.d.ts +18 -1
- package/dist/src/commands/terminal-output-buffer.js +95 -8
- package/dist/src/commands/terminal-process-group.d.ts +25 -0
- package/dist/src/commands/terminal-process-group.js +144 -0
- package/dist/src/commands/terminal.d.ts +3 -1
- package/dist/src/commands/terminal.js +366 -80
- package/dist/src/commands/tests.js +2 -0
- package/dist/src/component-lock.d.ts +15 -1
- package/dist/src/component-lock.js +96 -10
- package/dist/src/env-sync.js +12 -6
- package/dist/src/migration.d.ts +7 -0
- package/dist/src/migration.js +39 -21
- package/dist/src/planning-snapshot.d.ts +3 -0
- package/dist/src/planning-snapshot.js +60 -2
- package/dist/src/project.d.ts +1 -0
- package/dist/src/project.js +7 -8
- package/dist/src/resource-syncs/agent-sync.js +76 -24
- package/dist/src/resource-syncs/database-table-sync.d.ts +8 -1
- package/dist/src/resource-syncs/database-table-sync.js +66 -32
- package/dist/src/resource-syncs/database-view-sync.js +41 -28
- package/dist/src/resource-syncs/endpoint-sync.js +90 -18
- package/dist/src/resource-syncs/event-sync.js +33 -14
- package/dist/src/resource-syncs/group-sync.js +21 -11
- package/dist/src/resource-syncs/job-template-sync.js +98 -37
- package/dist/src/resource-syncs/role-group-sync.js +22 -11
- package/dist/src/resource-syncs/schedule-sync.js +26 -11
- package/dist/src/resource-syncs/service-account-sync.js +22 -11
- package/dist/src/reviewed-plan.js +3 -0
- package/dist/src/runtime-view.js +2 -18
- package/dist/src/sync-omit-command.d.ts +6 -0
- package/dist/src/sync-omit-command.js +49 -0
- package/dist/src/sync-omit-write-fence.d.ts +10 -0
- package/dist/src/sync-omit-write-fence.js +134 -0
- package/dist/src/sync-omit.d.ts +59 -0
- package/dist/src/sync-omit.js +469 -0
- package/dist/src/sync-output.d.ts +3 -3
- package/dist/src/ui.js +11 -5
- package/dist/src/update-notifier.d.ts +1 -1
- package/dist/src/update-notifier.js +2 -1
- package/dist/src/utils.js +46 -17
- package/dist/src/workspace-prune.js +11 -3
- package/dist/src/workspace-write-lock.d.ts +7 -0
- package/dist/src/workspace-write-lock.js +144 -0
- package/package.json +6 -5
|
@@ -1,24 +1,111 @@
|
|
|
1
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export const TERMINAL_CAPTURE_MAX_BYTES = 1_000_000_000;
|
|
5
|
+
export const TERMINAL_CAPTURE_MAX_CHUNKS = 1_000_000;
|
|
6
|
+
const WINDOW_BYTES = 256_000;
|
|
7
|
+
/** Private, process-local replay spool. Only a committed server ACK prunes its index. */
|
|
2
8
|
export class TerminalOutputBuffer {
|
|
3
|
-
chunks =
|
|
9
|
+
chunks = new Map();
|
|
4
10
|
sequence = 0;
|
|
5
11
|
acknowledged = 0;
|
|
12
|
+
sentThrough = 0;
|
|
13
|
+
inFlightBytes = 0;
|
|
14
|
+
bytes = 0;
|
|
15
|
+
directory;
|
|
16
|
+
fd;
|
|
17
|
+
disposed = false;
|
|
18
|
+
options;
|
|
19
|
+
constructor(options = {}) { this.options = options; }
|
|
6
20
|
get lastSequence() { return this.sequence; }
|
|
7
21
|
get lastAcknowledged() { return this.acknowledged; }
|
|
8
22
|
append(stream, text) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
23
|
+
if (this.disposed)
|
|
24
|
+
throw new Error('terminal_output_disposed');
|
|
25
|
+
const bytes = Buffer.byteLength(text);
|
|
26
|
+
if (bytes > 12_000 || this.bytes + bytes > TERMINAL_CAPTURE_MAX_BYTES || this.sequence >= TERMINAL_CAPTURE_MAX_CHUNKS)
|
|
27
|
+
throw new Error('terminal_output_capture_limit');
|
|
28
|
+
if (this.options.spool) {
|
|
29
|
+
if (this.fd === undefined) {
|
|
30
|
+
this.directory = fs.mkdtempSync(path.join(os.tmpdir(), 'revo-output-'));
|
|
31
|
+
fs.chmodSync(this.directory, 0o700);
|
|
32
|
+
this.fd = fs.openSync(path.join(this.directory, 'output'), 'wx+', 0o600);
|
|
33
|
+
}
|
|
34
|
+
const data = Buffer.from(text);
|
|
35
|
+
for (let written = 0; written < bytes;) {
|
|
36
|
+
const count = fs.writeSync(this.fd, data, written, bytes - written, this.bytes + written);
|
|
37
|
+
if (!count)
|
|
38
|
+
throw new Error('terminal_output_spool_write_failed');
|
|
39
|
+
written += count;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const sequence = ++this.sequence;
|
|
43
|
+
this.chunks.set(sequence, { stream, offset: this.bytes, bytes, ...(this.options.spool ? {} : { text }) });
|
|
44
|
+
this.bytes += bytes;
|
|
45
|
+
return { sequence, stream, text };
|
|
12
46
|
}
|
|
13
47
|
acknowledge(sequence) {
|
|
14
48
|
if (!Number.isSafeInteger(sequence) || sequence < 0 || sequence > this.sequence)
|
|
15
49
|
return false;
|
|
16
50
|
if (sequence <= this.acknowledged)
|
|
17
51
|
return true;
|
|
52
|
+
for (let cursor = this.acknowledged + 1; cursor <= sequence; cursor++) {
|
|
53
|
+
const entry = this.chunks.get(cursor);
|
|
54
|
+
if (entry && cursor <= this.sentThrough)
|
|
55
|
+
this.inFlightBytes -= entry.bytes + 256;
|
|
56
|
+
this.chunks.delete(cursor);
|
|
57
|
+
}
|
|
18
58
|
this.acknowledged = sequence;
|
|
19
|
-
|
|
20
|
-
this.chunks.shift();
|
|
59
|
+
this.sentThrough = Math.max(this.sentThrough, this.acknowledged);
|
|
21
60
|
return true;
|
|
22
61
|
}
|
|
23
|
-
|
|
62
|
+
read(sequence, entry) {
|
|
63
|
+
if (entry.text !== undefined)
|
|
64
|
+
return { sequence, stream: entry.stream, text: entry.text };
|
|
65
|
+
const bytes = Buffer.allocUnsafe(entry.bytes);
|
|
66
|
+
for (let read = 0; read < bytes.length;) {
|
|
67
|
+
const count = fs.readSync(this.fd, bytes, read, bytes.length - read, entry.offset + read);
|
|
68
|
+
if (!count)
|
|
69
|
+
throw new Error('terminal_output_spool_read_failed');
|
|
70
|
+
read += count;
|
|
71
|
+
}
|
|
72
|
+
return { sequence, stream: entry.stream, text: bytes.toString('utf8') };
|
|
73
|
+
}
|
|
74
|
+
pending() { return this.page(this.acknowledged, WINDOW_BYTES); }
|
|
75
|
+
page(after, budget) {
|
|
76
|
+
const result = [];
|
|
77
|
+
let bytes = 0;
|
|
78
|
+
for (let cursor = after + 1; cursor <= this.sequence; cursor++) {
|
|
79
|
+
const entry = this.chunks.get(cursor);
|
|
80
|
+
if (!entry)
|
|
81
|
+
continue;
|
|
82
|
+
if (bytes + entry.bytes + 256 > budget)
|
|
83
|
+
break;
|
|
84
|
+
result.push(this.read(cursor, entry));
|
|
85
|
+
bytes += entry.bytes + 256;
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
takeUnsent() {
|
|
90
|
+
const chunks = this.page(this.sentThrough, WINDOW_BYTES - this.inFlightBytes);
|
|
91
|
+
for (const chunk of chunks)
|
|
92
|
+
this.inFlightBytes += Buffer.byteLength(chunk.text) + 256;
|
|
93
|
+
if (chunks.length)
|
|
94
|
+
this.sentThrough = chunks.at(-1).sequence;
|
|
95
|
+
return chunks;
|
|
96
|
+
}
|
|
97
|
+
resetTransport() { this.sentThrough = this.acknowledged; this.inFlightBytes = 0; }
|
|
98
|
+
dispose() {
|
|
99
|
+
this.disposed = true;
|
|
100
|
+
this.chunks.clear();
|
|
101
|
+
try {
|
|
102
|
+
if (this.fd !== undefined)
|
|
103
|
+
fs.closeSync(this.fd);
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
this.fd = undefined;
|
|
107
|
+
if (this.directory)
|
|
108
|
+
fs.rmSync(this.directory, { recursive: true, force: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
24
111
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type TerminalProcessIdentity = {
|
|
2
|
+
pid: number;
|
|
3
|
+
group: number;
|
|
4
|
+
birth: string;
|
|
5
|
+
running: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type TerminalProcessProbe = {
|
|
8
|
+
identity(pid: number): TerminalProcessIdentity | undefined;
|
|
9
|
+
group(group: number): TerminalProcessIdentity[];
|
|
10
|
+
};
|
|
11
|
+
export type TerminalGroupState = 'owned' | 'stopped' | 'unverified';
|
|
12
|
+
export declare function parseDarwinTerminalProcessIdentities(output: string): TerminalProcessIdentity[];
|
|
13
|
+
export declare function parseLinuxTerminalProcessStat(pid: number, value: string): TerminalProcessIdentity;
|
|
14
|
+
export declare const nativeTerminalProcessProbe: TerminalProcessProbe;
|
|
15
|
+
export declare function assertTerminalProcessProbeAvailable(): void;
|
|
16
|
+
/** Signal only a group with continuity to an observed PID/birth identity. Never fall back to a positive PID. */
|
|
17
|
+
export declare class ControlledTerminalProcessGroup {
|
|
18
|
+
private readonly owned;
|
|
19
|
+
private readonly pid;
|
|
20
|
+
private readonly probe;
|
|
21
|
+
private readonly kill;
|
|
22
|
+
constructor(pid: number, probe?: TerminalProcessProbe, kill?: (pid: number, signal: NodeJS.Signals) => unknown);
|
|
23
|
+
state(): TerminalGroupState;
|
|
24
|
+
signal(signal: NodeJS.Signals): TerminalGroupState;
|
|
25
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
export function parseDarwinTerminalProcessIdentities(output) {
|
|
4
|
+
const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
5
|
+
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
6
|
+
return output.split('\n').flatMap(line => {
|
|
7
|
+
if (!line.trim())
|
|
8
|
+
return [];
|
|
9
|
+
// Native Darwin ps reports ? / ?E during process churn. Such rows still
|
|
10
|
+
// carry a birth identity and must never be mistaken for a stopped process.
|
|
11
|
+
const match = /^\s*(\d+)\s+(\d+)\s+([?A-Z][A-Za-z0-9+<=>?*\-]*)\s+(.+?)\s*$/u.exec(line);
|
|
12
|
+
if (!match)
|
|
13
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
14
|
+
const pid = Number(match[1]);
|
|
15
|
+
const group = Number(match[2]);
|
|
16
|
+
if (!Number.isSafeInteger(pid) || !Number.isSafeInteger(group))
|
|
17
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
18
|
+
if (pid === 0 && match[4] === '-')
|
|
19
|
+
return [];
|
|
20
|
+
const birth = /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})$/u.exec(match[4]);
|
|
21
|
+
if (!birth)
|
|
22
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
23
|
+
const day = Number(birth[3]);
|
|
24
|
+
const hour = Number(birth[4]);
|
|
25
|
+
const minute = Number(birth[5]);
|
|
26
|
+
const second = Number(birth[6]);
|
|
27
|
+
const year = Number(birth[7]);
|
|
28
|
+
const month = months.indexOf(birth[2]);
|
|
29
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second));
|
|
30
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day
|
|
31
|
+
|| hour > 23 || minute > 59 || second > 59 || weekdays[date.getUTCDay()] !== birth[1])
|
|
32
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
33
|
+
return [{ pid, group, birth: match[4].replace(/\s+/gu, ' '), running: !/^[ZX]/u.test(match[3]) }];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function processIdentities(id, selection) {
|
|
37
|
+
let output;
|
|
38
|
+
try {
|
|
39
|
+
output = execFileSync('/bin/ps', [selection === 'pid' ? '-p' : '-g', String(id), '-o', 'pid=,pgid=,stat=,lstart='], { encoding: 'utf8', timeout: 1_000, maxBuffer: 4 * 1024 * 1024, env: { LC_ALL: 'C', PATH: '/usr/bin:/bin' }, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error.status === 1 && !error.stdout?.trim())
|
|
43
|
+
return [];
|
|
44
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
45
|
+
}
|
|
46
|
+
return parseDarwinTerminalProcessIdentities(output);
|
|
47
|
+
}
|
|
48
|
+
export function parseLinuxTerminalProcessStat(pid, value) {
|
|
49
|
+
const end = value.lastIndexOf(')');
|
|
50
|
+
const fields = value.slice(end + 1).trim().split(/\s+/u);
|
|
51
|
+
const actualPid = Number(value.slice(0, value.indexOf('(')).trim());
|
|
52
|
+
const group = Number(fields[2]);
|
|
53
|
+
const birth = fields[19];
|
|
54
|
+
if (end < 0 || actualPid !== pid || !Number.isSafeInteger(group) || group < 0 || !birth || !/^\d+$/u.test(birth)) {
|
|
55
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
56
|
+
}
|
|
57
|
+
return { pid, group, birth: `linux:${birth}`, running: !/^[ZX]/u.test(fields[0] || '') };
|
|
58
|
+
}
|
|
59
|
+
function linuxProcessIdentity(pid) {
|
|
60
|
+
try {
|
|
61
|
+
return parseLinuxTerminalProcessStat(pid, fs.readFileSync(`/proc/${pid}/stat`, 'utf8'));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (['ENOENT', 'ESRCH'].includes(error.code || ''))
|
|
65
|
+
return undefined;
|
|
66
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const nativeTerminalProcessProbe = {
|
|
70
|
+
identity: pid => process.platform === 'linux' ? linuxProcessIdentity(pid) : processIdentities(pid, 'pid').find(item => item.pid === pid),
|
|
71
|
+
group: group => {
|
|
72
|
+
const started = Date.now();
|
|
73
|
+
const names = process.platform === 'linux' ? fs.readdirSync('/proc').filter(name => /^\d+$/u.test(name)) : [];
|
|
74
|
+
if (names.length > 16_384)
|
|
75
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
76
|
+
const identities = process.platform === 'linux'
|
|
77
|
+
? names.flatMap(name => {
|
|
78
|
+
if (Date.now() - started > 1_000)
|
|
79
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
80
|
+
const identity = linuxProcessIdentity(Number(name));
|
|
81
|
+
return identity ? [identity] : [];
|
|
82
|
+
}) : processIdentities(group, 'group');
|
|
83
|
+
if (Date.now() - started > 1_000)
|
|
84
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
85
|
+
return identities.filter(item => item.group === group);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export function assertTerminalProcessProbeAvailable() {
|
|
89
|
+
const current = nativeTerminalProcessProbe.identity(process.pid);
|
|
90
|
+
if (!current?.birth)
|
|
91
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
92
|
+
nativeTerminalProcessProbe.group(current.group);
|
|
93
|
+
}
|
|
94
|
+
/** Signal only a group with continuity to an observed PID/birth identity. Never fall back to a positive PID. */
|
|
95
|
+
export class ControlledTerminalProcessGroup {
|
|
96
|
+
owned = new Map();
|
|
97
|
+
pid;
|
|
98
|
+
probe;
|
|
99
|
+
kill;
|
|
100
|
+
constructor(pid, probe = nativeTerminalProcessProbe, kill = process.kill.bind(process)) {
|
|
101
|
+
if (!Number.isSafeInteger(pid) || pid < 1)
|
|
102
|
+
throw new Error('terminal_process_identity_unavailable');
|
|
103
|
+
this.pid = pid;
|
|
104
|
+
this.probe = probe;
|
|
105
|
+
this.kill = kill;
|
|
106
|
+
try {
|
|
107
|
+
const leader = probe.identity(pid);
|
|
108
|
+
if (leader?.pid === pid && leader.birth)
|
|
109
|
+
this.owned.set(pid, leader.birth);
|
|
110
|
+
this.state();
|
|
111
|
+
}
|
|
112
|
+
catch { /* A missing proof never authorizes a signal. */ }
|
|
113
|
+
}
|
|
114
|
+
state() {
|
|
115
|
+
let members;
|
|
116
|
+
try {
|
|
117
|
+
members = this.probe.group(this.pid).filter(item => item.group === this.pid);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return 'unverified';
|
|
121
|
+
}
|
|
122
|
+
if (!members.some(item => item.running))
|
|
123
|
+
return 'stopped';
|
|
124
|
+
if (!members.some(item => this.owned.get(item.pid) === item.birth))
|
|
125
|
+
return 'unverified';
|
|
126
|
+
// Membership can evolve only while at least one original identity still
|
|
127
|
+
// proves continuity. A reused leader/group cannot acquire ownership here.
|
|
128
|
+
for (const member of members)
|
|
129
|
+
this.owned.set(member.pid, member.birth);
|
|
130
|
+
return 'owned';
|
|
131
|
+
}
|
|
132
|
+
signal(signal) {
|
|
133
|
+
const state = this.state();
|
|
134
|
+
if (state !== 'owned')
|
|
135
|
+
return state;
|
|
136
|
+
try {
|
|
137
|
+
this.kill(-this.pid, signal);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
return error.code === 'ESRCH' ? 'stopped' : 'unverified';
|
|
141
|
+
}
|
|
142
|
+
return 'owned';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -35,6 +35,7 @@ type CommandResult = {
|
|
|
35
35
|
logTruncated: boolean;
|
|
36
36
|
logPath: string;
|
|
37
37
|
policyExpired?: boolean;
|
|
38
|
+
captureTruncated?: boolean;
|
|
38
39
|
};
|
|
39
40
|
export type RunningProcess = {
|
|
40
41
|
pid: number | undefined;
|
|
@@ -54,6 +55,7 @@ export declare function runCommand(input: {
|
|
|
54
55
|
workdir: string;
|
|
55
56
|
workspace: string;
|
|
56
57
|
timeoutMs: number;
|
|
58
|
+
captureOutput?: boolean;
|
|
57
59
|
background?: boolean;
|
|
58
60
|
sandbox?: TerminalSandbox;
|
|
59
61
|
networkAccess?: TerminalNetworkAccess;
|
|
@@ -63,7 +65,7 @@ export declare function runCommand(input: {
|
|
|
63
65
|
rows?: number;
|
|
64
66
|
executionId?: string;
|
|
65
67
|
logDir?: string;
|
|
66
|
-
}, onDone: (result: CommandResult) => void, onChunk?: (stream: 'stdout' | 'stderr', text: string) =>
|
|
68
|
+
}, onDone: (result: CommandResult) => void, onChunk?: (stream: 'stdout' | 'stderr', text: string) => unknown): Promise<RunningProcess>;
|
|
67
69
|
export declare function runWorkspacePatch(input: {
|
|
68
70
|
patch: string;
|
|
69
71
|
workspace: string;
|