@felan-ai/ext-background-bash 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -14
- package/dist/coordinator.d.ts +24 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +212 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +496 -410
- package/dist/index.js.map +1 -1
- package/dist/job-store.d.ts +17 -2
- package/dist/job-store.d.ts.map +1 -1
- package/dist/job-store.js +113 -51
- package/dist/job-store.js.map +1 -1
- package/dist/logs.d.ts +2 -3
- package/dist/logs.d.ts.map +1 -1
- package/dist/logs.js +38 -23
- package/dist/logs.js.map +1 -1
- package/dist/process-manager.d.ts +12 -1
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +170 -29
- package/dist/process-manager.js.map +1 -1
- package/dist/runtime-support.d.ts +1 -0
- package/dist/runtime-support.d.ts.map +1 -1
- package/dist/runtime-support.js +5 -1
- package/dist/runtime-support.js.map +1 -1
- package/dist/ui/background-bash-view.js +2 -2
- package/dist/ui/background-bash-view.js.map +1 -1
- package/dist/ui/completion-message.js +2 -2
- package/dist/ui/completion-message.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @felan-ai/ext-background-bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`bash` with
|
|
3
|
+
Provider-neutral project-local Bash execution for Felan sessions. The extension augments
|
|
4
|
+
`bash` with explicit backgrounding, bounded foreground waiting, optional PTY input,
|
|
5
|
+
and adds tools to list, read, wait for, write to, and stop processes.
|
|
5
6
|
Output and process metadata live under
|
|
6
7
|
`<session-storage>/background-bash/<workspace-key>/jobs`. Local Felan maps
|
|
7
8
|
`<session-storage>` to
|
|
@@ -24,29 +25,39 @@ the host runtime. Git Bash's process tools use its `ps -l` format when GNU
|
|
|
24
25
|
through dependency onboarding; Felan does not install operating-system
|
|
25
26
|
utilities.
|
|
26
27
|
|
|
27
|
-
The
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
identical behavior without duplicating model filters in their composition
|
|
31
|
-
roots.
|
|
28
|
+
The same process surface is available to every selected model. Model-specific
|
|
29
|
+
policy belongs to the model-facing prompt/tool composition, not to process
|
|
30
|
+
ownership or runtime capability checks.
|
|
32
31
|
|
|
33
|
-
This release requires `@felan-ai/agent-core` `^0.6.
|
|
32
|
+
This release requires `@felan-ai/agent-core` `^0.6.1` because it uses the
|
|
34
33
|
runtime's explicit POSIX shell flavor.
|
|
35
34
|
|
|
36
35
|
## Tools and controls
|
|
37
36
|
|
|
38
37
|
- `bash({ command, background: true })` starts a detached process.
|
|
38
|
+
- `bash({ command, timeout: 120 })` waits in the tool, then promotes the same process without restarting it.
|
|
39
|
+
- `bash({ command, timeout: 0, tty: true })` starts an interactive PTY immediately.
|
|
40
|
+
- `write_background_bash({ id, chars })` sends exact stdin/control bytes to a PTY job.
|
|
39
41
|
- `list_background_bash` lists workspace processes and statuses.
|
|
40
|
-
- `read_background_bash` reads trailing process output.
|
|
42
|
+
- `read_background_bash` reads trailing process output, capped at 128 KiB of log content. Larger files use POSIX `tail` without loading the whole log.
|
|
41
43
|
- `wait_background_bash` waits for terminal status without returning log output.
|
|
42
44
|
- `stop_background_bash` sends `SIGTERM` or `SIGKILL`.
|
|
43
|
-
- `/
|
|
45
|
+
- `/processes` and `Ctrl+Shift+J` open the interactive process/log view inline in the TUI.
|
|
44
46
|
|
|
45
47
|
The process/log view uses an inline frame. Automatic completion messages use a
|
|
46
48
|
compact one-line summary; `Alt+A` reveals bounded details.
|
|
47
49
|
|
|
48
|
-
The
|
|
49
|
-
|
|
50
|
+
The default foreground promotion window is 120 seconds and can be changed with
|
|
51
|
+
`extensionConfig.backgroundBash.foregroundTimeoutSeconds`. Cancelling a foreground
|
|
52
|
+
wait terminates its process tree; cancelling a wait for an already-backgrounded job
|
|
53
|
+
does not terminate that job. Detached jobs remain discoverable after restart when
|
|
54
|
+
their runtime storage persists. PTY handles are root-session-scoped and are not
|
|
55
|
+
reattachable after shutdown. The footer status shows the number of running processes.
|
|
56
|
+
Live PTY status comes from its root-session handle, not detached-runner PID probes.
|
|
57
|
+
Status reads and input remain available while another caller waits in the foreground.
|
|
58
|
+
Terminal outcomes and completion timestamps are recorded once. An orphaned PTY is
|
|
59
|
+
reported as `unknown`; its stored PID is not used to reattach or signal a process.
|
|
60
|
+
Processes started by the active session deliver a
|
|
50
61
|
completion message automatically. The message steers an active run at its next
|
|
51
62
|
model-call boundary or triggers a turn when the agent is idle. A terminal result
|
|
52
63
|
returned directly by `list_background_bash`, `read_background_bash`,
|
|
@@ -85,8 +96,8 @@ the POSIX shell/process facilities listed in
|
|
|
85
96
|
does not install operating-system utilities, and the feature remains inactive
|
|
86
97
|
when they are unavailable.
|
|
87
98
|
|
|
88
|
-
The extension owns detached job records, logs, lifecycle,
|
|
89
|
-
|
|
99
|
+
The extension owns detached job records, logs, lifecycle, PTY controls, and the
|
|
100
|
+
six model-facing process controls. It does not provide a sandbox.
|
|
90
101
|
|
|
91
102
|
## Related documentation
|
|
92
103
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentRuntime, AgentRuntimeProcess } from '@felan-ai/agent-core';
|
|
2
|
+
export interface InteractiveBashProcess {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly process: AgentRuntimeProcess;
|
|
5
|
+
readonly output: string;
|
|
6
|
+
readonly running: boolean;
|
|
7
|
+
readonly nextOffset: number;
|
|
8
|
+
readonly exitCode?: number;
|
|
9
|
+
readonly signal?: 'SIGTERM' | 'SIGKILL';
|
|
10
|
+
}
|
|
11
|
+
/** Owns live PTY handles; persisted detached jobs remain owned by BackgroundBashManager. */
|
|
12
|
+
export declare class BackgroundBashCoordinator {
|
|
13
|
+
#private;
|
|
14
|
+
private readonly runtime;
|
|
15
|
+
constructor(runtime: AgentRuntime);
|
|
16
|
+
start(id: string, command: string, cwd?: string, onSnapshot?: (snapshot: InteractiveBashProcess) => Promise<void>): Promise<InteractiveBashProcess>;
|
|
17
|
+
read(id: string, waitMs?: number, signal?: AbortSignal): Promise<InteractiveBashProcess>;
|
|
18
|
+
write(id: string, chars: string): Promise<InteractiveBashProcess>;
|
|
19
|
+
stop(id: string, signal?: 'SIGTERM' | 'SIGKILL'): Promise<InteractiveBashProcess>;
|
|
20
|
+
has(id: string): boolean;
|
|
21
|
+
isStarting(id: string): boolean;
|
|
22
|
+
shutdown(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../src/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAM9E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACzC;AAcD,4FAA4F;AAC5F,qBAAa,yBAAyB;;IAKxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,YAAY;IAE5C,KAAK,CACT,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,GAC/D,OAAO,CAAC,sBAAsB,CAAC;IAgD5B,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,SAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAcnF,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAMjE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,SAAS,GAAG,SAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAwBlG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIzB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAoFhC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
2
|
+
const encoder = new TextEncoder();
|
|
3
|
+
const decoder = new TextDecoder();
|
|
4
|
+
/** Owns live PTY handles; persisted detached jobs remain owned by BackgroundBashManager. */
|
|
5
|
+
export class BackgroundBashCoordinator {
|
|
6
|
+
runtime;
|
|
7
|
+
#entries = new Map();
|
|
8
|
+
#starting = new Map();
|
|
9
|
+
#shutdownPromise;
|
|
10
|
+
constructor(runtime) {
|
|
11
|
+
this.runtime = runtime;
|
|
12
|
+
}
|
|
13
|
+
async start(id, command, cwd, onSnapshot) {
|
|
14
|
+
if (this.#shutdownPromise)
|
|
15
|
+
throw new Error('Background process coordinator is shut down');
|
|
16
|
+
if (this.#entries.has(id) || this.#starting.has(id)) {
|
|
17
|
+
throw new Error(`Interactive background process already exists: ${id}`);
|
|
18
|
+
}
|
|
19
|
+
const terminals = this.runtime.terminals;
|
|
20
|
+
if (!terminals)
|
|
21
|
+
throw new Error('Interactive background processes require PTY support');
|
|
22
|
+
const starting = (async () => {
|
|
23
|
+
const process = await terminals.startShell(command, {
|
|
24
|
+
shellFlavor: 'posix',
|
|
25
|
+
...(cwd === undefined ? {} : { cwd }),
|
|
26
|
+
});
|
|
27
|
+
const entry = {
|
|
28
|
+
process,
|
|
29
|
+
onSnapshot,
|
|
30
|
+
offset: 0,
|
|
31
|
+
output: '',
|
|
32
|
+
operation: Promise.resolve(),
|
|
33
|
+
decoder: new TextDecoder(),
|
|
34
|
+
};
|
|
35
|
+
this.#entries.set(id, entry);
|
|
36
|
+
try {
|
|
37
|
+
return await this.read(id);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const errors = [error];
|
|
41
|
+
try {
|
|
42
|
+
await process.terminate('SIGTERM');
|
|
43
|
+
}
|
|
44
|
+
catch (cleanupError) {
|
|
45
|
+
errors.push(cleanupError);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
await process.dispose();
|
|
49
|
+
}
|
|
50
|
+
catch (cleanupError) {
|
|
51
|
+
errors.push(cleanupError);
|
|
52
|
+
}
|
|
53
|
+
if (errors.length > 1)
|
|
54
|
+
throw new AggregateError(errors, `Failed to clean up interactive startup ${id}`);
|
|
55
|
+
this.#entries.delete(id);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
})();
|
|
59
|
+
this.#starting.set(id, starting);
|
|
60
|
+
try {
|
|
61
|
+
return await starting;
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
this.#starting.delete(id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async read(id, waitMs = 0, signal) {
|
|
68
|
+
const entry = this.#require(id);
|
|
69
|
+
signal?.throwIfAborted();
|
|
70
|
+
// A foreground wait must not hold the snapshot/persistence queue needed by other callers.
|
|
71
|
+
if (waitMs > 0) {
|
|
72
|
+
await entry.process.read(entry.offset, {
|
|
73
|
+
waitMs,
|
|
74
|
+
...(signal === undefined ? {} : { signal }),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
signal?.throwIfAborted();
|
|
78
|
+
return this.#serialize(entry, () => this.#readUnlocked(id, entry), signal);
|
|
79
|
+
}
|
|
80
|
+
async write(id, chars) {
|
|
81
|
+
const entry = this.#require(id);
|
|
82
|
+
await entry.process.write(encoder.encode(chars));
|
|
83
|
+
return this.#serialize(entry, () => this.#readUnlocked(id, entry));
|
|
84
|
+
}
|
|
85
|
+
async stop(id, signal = 'SIGTERM') {
|
|
86
|
+
await this.#starting.get(id);
|
|
87
|
+
const entry = this.#require(id);
|
|
88
|
+
const stopping = entry.stopping ??= this.#terminate(entry, signal);
|
|
89
|
+
try {
|
|
90
|
+
await stopping;
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
if (entry.stopping === stopping)
|
|
94
|
+
delete entry.stopping;
|
|
95
|
+
}
|
|
96
|
+
return this.#serialize(entry, () => this.#readUnlocked(id, entry));
|
|
97
|
+
}
|
|
98
|
+
async #terminate(entry, signal) {
|
|
99
|
+
const current = await entry.process.read(entry.offset);
|
|
100
|
+
if (!current.running)
|
|
101
|
+
return;
|
|
102
|
+
entry.signal = signal;
|
|
103
|
+
try {
|
|
104
|
+
await entry.process.terminate(signal);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
delete entry.signal;
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
has(id) {
|
|
112
|
+
return this.#entries.has(id) || this.#starting.has(id);
|
|
113
|
+
}
|
|
114
|
+
isStarting(id) {
|
|
115
|
+
return this.#starting.has(id);
|
|
116
|
+
}
|
|
117
|
+
async shutdown() {
|
|
118
|
+
if (this.#shutdownPromise)
|
|
119
|
+
return this.#shutdownPromise;
|
|
120
|
+
this.#shutdownPromise = (async () => {
|
|
121
|
+
const starts = await Promise.allSettled(this.#starting.values());
|
|
122
|
+
const entries = [...this.#entries.entries()];
|
|
123
|
+
const results = await Promise.allSettled(entries.map(async ([id, entry]) => {
|
|
124
|
+
const errors = [];
|
|
125
|
+
try {
|
|
126
|
+
await this.stop(id);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
errors.push(error);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
await entry.process.dispose();
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
errors.push(error);
|
|
136
|
+
}
|
|
137
|
+
if (errors.length > 0)
|
|
138
|
+
throw new AggregateError(errors, `Failed to clean up interactive process ${id}`);
|
|
139
|
+
this.#entries.delete(id);
|
|
140
|
+
}));
|
|
141
|
+
const failures = [...starts, ...results].filter((result) => result.status === 'rejected');
|
|
142
|
+
if (failures.length > 0) {
|
|
143
|
+
throw new AggregateError(failures.map((result) => result.reason), 'Failed to shut down interactive background processes');
|
|
144
|
+
}
|
|
145
|
+
})();
|
|
146
|
+
return this.#shutdownPromise;
|
|
147
|
+
}
|
|
148
|
+
#serialize(entry, operation, signal) {
|
|
149
|
+
const result = entry.operation.then(() => {
|
|
150
|
+
signal?.throwIfAborted();
|
|
151
|
+
return operation();
|
|
152
|
+
});
|
|
153
|
+
entry.operation = result.then(() => { }, () => { });
|
|
154
|
+
if (!signal)
|
|
155
|
+
return result;
|
|
156
|
+
return new Promise((resolve, reject) => {
|
|
157
|
+
const onAbort = () => {
|
|
158
|
+
signal.removeEventListener('abort', onAbort);
|
|
159
|
+
reject(signal.reason);
|
|
160
|
+
};
|
|
161
|
+
if (signal.aborted)
|
|
162
|
+
onAbort();
|
|
163
|
+
else
|
|
164
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
165
|
+
void result.then((value) => { signal.removeEventListener('abort', onAbort); resolve(value); }, (error) => { signal.removeEventListener('abort', onAbort); reject(error); });
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async #readUnlocked(id, entry) {
|
|
169
|
+
const snapshot = await entry.process.read(entry.offset);
|
|
170
|
+
entry.offset = snapshot.nextOffset;
|
|
171
|
+
if (snapshot.output.length > 0) {
|
|
172
|
+
entry.output = boundedTail(`${entry.output}${entry.decoder.decode(snapshot.output, { stream: snapshot.running })}`);
|
|
173
|
+
}
|
|
174
|
+
if (!snapshot.running)
|
|
175
|
+
entry.output = boundedTail(`${entry.output}${entry.decoder.decode()}`);
|
|
176
|
+
const result = {
|
|
177
|
+
id,
|
|
178
|
+
process: entry.process,
|
|
179
|
+
output: entry.output,
|
|
180
|
+
running: snapshot.running,
|
|
181
|
+
nextOffset: snapshot.nextOffset,
|
|
182
|
+
...(snapshot.exitCode === undefined ? {} : { exitCode: snapshot.exitCode }),
|
|
183
|
+
...(entry.signal === undefined ? {} : { signal: entry.signal }),
|
|
184
|
+
};
|
|
185
|
+
const previous = entry.snapshot;
|
|
186
|
+
if (!previous
|
|
187
|
+
|| previous.nextOffset !== result.nextOffset
|
|
188
|
+
|| previous.running !== result.running
|
|
189
|
+
|| previous.exitCode !== result.exitCode
|
|
190
|
+
|| previous.signal !== result.signal) {
|
|
191
|
+
await entry.onSnapshot?.(result);
|
|
192
|
+
entry.snapshot = result;
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
#require(id) {
|
|
197
|
+
const entry = this.#entries.get(id);
|
|
198
|
+
if (!entry)
|
|
199
|
+
throw new Error(`Interactive background process not found: ${id}`);
|
|
200
|
+
return entry;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function boundedTail(value) {
|
|
204
|
+
const bytes = encoder.encode(value);
|
|
205
|
+
if (bytes.byteLength <= MAX_OUTPUT_BYTES)
|
|
206
|
+
return value;
|
|
207
|
+
let start = bytes.byteLength - MAX_OUTPUT_BYTES;
|
|
208
|
+
while ((bytes[start] & 0xc0) === 0x80)
|
|
209
|
+
start += 1;
|
|
210
|
+
return decoder.decode(bytes.subarray(start));
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../src/coordinator.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,CAA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,KAAK,MAAM,CAAC,QAAQ;eACrC,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EACpC,CAAC;YACD,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;YACjC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC1B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,EAAE,EAAE,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,UAAU,IAAI,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACvD,IAAI,KAAK,GAAG,KAAK,CAAC,UAAU,GAAG,gBAAgB,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAE,GAAG,IAAI,CAAC,KAAK,IAAI;QAAE,KAAK,IAAI,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FelanExtension } from '@felan-ai/agent-core';
|
|
2
|
+
import { BackgroundBashCoordinator } from './coordinator.js';
|
|
3
|
+
export declare function supportsBackgroundBashModel(model: unknown): boolean;
|
|
2
4
|
interface BackgroundBashDetails {
|
|
3
5
|
background: true;
|
|
4
6
|
id: string;
|
|
@@ -13,12 +15,17 @@ interface BackgroundBashDetails {
|
|
|
13
15
|
cwd: string;
|
|
14
16
|
startedAt: number;
|
|
15
17
|
}
|
|
16
|
-
export declare
|
|
18
|
+
export declare const BACKGROUND_BASH_CONFIG: import("@felan-ai/agent-core").ExtensionConfigDefinition<{
|
|
19
|
+
readonly foregroundTimeoutSeconds: import("@felan-ai/agent-core").ExtensionConfigField<number>;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function createBackgroundBashExtension(coordinator?: BackgroundBashCoordinator, ownsCoordinator?: boolean): FelanExtension;
|
|
17
22
|
declare const backgroundBashExtension: FelanExtension;
|
|
18
23
|
export { inspectBackgroundBashRuntime } from './runtime-support.js';
|
|
19
24
|
export type { BackgroundBashRuntimeStatus } from './runtime-support.js';
|
|
20
25
|
export type { BackgroundBashDetails };
|
|
21
26
|
export { BackgroundBashManager } from './process-manager.js';
|
|
27
|
+
export { BackgroundBashCoordinator } from './coordinator.js';
|
|
28
|
+
export type { InteractiveBashProcess } from './coordinator.js';
|
|
22
29
|
export type { BackgroundBashInfo, BackgroundBashJob, BackgroundBashMeta, BackgroundBashStatus, BackgroundBashStatusFile, BackgroundBashStatusFilter, } from './job-store.js';
|
|
23
30
|
export default backgroundBashExtension;
|
|
24
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAmB7D,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEnE;AA+CD,UAAU,qBAAqB;IAC7B,UAAU,EAAE,IAAI,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAA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