@aliou/pi-processes 0.9.4 → 0.10.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/CONTRIBUTING.md +40 -42
- package/README.md +54 -84
- package/extensions/process-tabs.ts +26 -0
- package/extensions/processes/client.ts +194 -0
- package/extensions/processes/commands/clear.ts +29 -0
- package/extensions/processes/commands/kill.ts +152 -0
- package/extensions/processes/commands/overview.ts +102 -0
- package/extensions/processes/components/overview-component.ts +729 -0
- package/extensions/processes/components/overview-panel.ts +177 -0
- package/extensions/processes/config/defaults.ts +28 -0
- package/extensions/processes/config/index.ts +13 -0
- package/extensions/processes/config/loader.ts +62 -0
- package/extensions/processes/config/migrations/000-import-legacy-process-config.ts +113 -0
- package/extensions/processes/config/migrations/001-v0-9-4-to-v0-10-0-config.ts +184 -0
- package/extensions/processes/config/migrations/002-stamp-v0-10-0-config-version.ts +21 -0
- package/extensions/processes/config/migrations/index.ts +25 -0
- package/extensions/processes/config/schema.ts +9 -0
- package/extensions/processes/config/types.ts +72 -0
- package/extensions/processes/constants.ts +1 -0
- package/extensions/processes/handlers/commands.ts +113 -0
- package/extensions/processes/handlers/kill-process.ts +31 -0
- package/extensions/processes/handlers/notifications.ts +147 -0
- package/extensions/processes/handlers/requests.ts +114 -0
- package/extensions/processes/handlers/subscriptions.ts +144 -0
- package/extensions/processes/hooks/background-blocker.ts +201 -0
- package/extensions/processes/hooks/cleanup.ts +43 -0
- package/extensions/processes/hooks/event-bridge.ts +32 -0
- package/extensions/processes/i18n/index.ts +3 -0
- package/extensions/processes/i18n/messages.ts +27 -0
- package/extensions/processes/i18n/translator.ts +49 -0
- package/extensions/processes/index.ts +109 -0
- package/extensions/processes/message-renderer.ts +117 -0
- package/extensions/processes/notification-sender.ts +43 -0
- package/extensions/processes/notifications/classify.ts +27 -0
- package/extensions/processes/notifications/log-matchers.ts +146 -0
- package/extensions/processes/notifications/registry.ts +225 -0
- package/extensions/processes/notifications/render-content.ts +122 -0
- package/extensions/processes/notifications/service.ts +336 -0
- package/extensions/processes/notifications/types.ts +11 -0
- package/extensions/processes/settings/apply-setting-change.ts +30 -0
- package/extensions/processes/settings/build-sections.ts +420 -0
- package/extensions/processes/settings/index.ts +42 -0
- package/extensions/processes/tools/clear/index.ts +21 -0
- package/extensions/processes/tools/clear/render.ts +40 -0
- package/extensions/processes/tools/components/index.ts +4 -0
- package/extensions/processes/tools/components/process-action-header.ts +31 -0
- package/extensions/processes/tools/components/process-action-title.ts +17 -0
- package/extensions/processes/tools/components/tool-layout.ts +70 -0
- package/extensions/processes/tools/components/watch.ts +53 -0
- package/extensions/processes/tools/index.ts +265 -0
- package/extensions/processes/tools/list/index.ts +157 -0
- package/extensions/processes/tools/list/render.ts +211 -0
- package/extensions/processes/tools/notify.ts +191 -0
- package/extensions/processes/tools/output/index.ts +307 -0
- package/extensions/processes/tools/output/render.ts +229 -0
- package/extensions/processes/tools/schema.ts +263 -0
- package/extensions/processes/tools/start/index.ts +64 -0
- package/extensions/processes/tools/start/render.ts +67 -0
- package/extensions/processes/tools/stop/index.ts +35 -0
- package/extensions/processes/tools/stop/render.ts +43 -0
- package/extensions/processes/tools/update/index.ts +320 -0
- package/extensions/processes/tools/update/render.ts +251 -0
- package/extensions/processes/tools/utils.ts +112 -0
- package/extensions/processes/tools/watch-format.ts +14 -0
- package/extensions/processes/tools/write/index.ts +75 -0
- package/extensions/processes/tools/write/render.ts +68 -0
- package/extensions/processes/utils/truncate.ts +285 -0
- package/extensions/processes-dock/client.ts +60 -0
- package/extensions/processes-dock/commands/dock.ts +70 -0
- package/extensions/processes-dock/commands/pin.ts +166 -0
- package/extensions/processes-dock/components/log-dock-component.ts +375 -0
- package/extensions/processes-dock/dock-state.ts +33 -0
- package/extensions/processes-dock/index.ts +28 -0
- package/extensions/processes-dock/logs-client.ts +5 -0
- package/extensions/processes-dock/widget/setup.ts +520 -0
- package/extensions/processes-dock/widget/status.ts +149 -0
- package/extensions/processes-dock/widget/types.ts +16 -0
- package/extensions/processes-logs/client.ts +51 -0
- package/extensions/processes-logs/commands/logs.ts +108 -0
- package/extensions/processes-logs/completions.ts +31 -0
- package/extensions/processes-logs/components/log-file-viewer.ts +274 -0
- package/extensions/processes-logs/components/log-overlay-component.ts +685 -0
- package/extensions/processes-logs/index.ts +27 -0
- package/extensions/processes-logs/logs-client.ts +101 -0
- package/extensions/shared/line-buffer.ts +35 -0
- package/extensions/shared/output-payload.ts +28 -0
- package/extensions/shared/ui.ts +146 -0
- package/package.json +47 -20
- package/schema.json +134 -0
- package/skills/pi-processes/SKILL.md +496 -25
- package/src/get-manager.ts +15 -0
- package/src/manager/index.ts +182 -0
- package/src/manager/internal-types.ts +130 -0
- package/src/manager/limits.ts +15 -0
- package/src/manager/process-log-store.ts +422 -0
- package/src/manager/process-output.ts +345 -0
- package/src/manager/process-registry.ts +78 -0
- package/src/manager/process-runtime-controller.ts +499 -0
- package/src/protocol/broadcasts.ts +14 -0
- package/src/protocol/channels.ts +30 -0
- package/src/protocol/commands.ts +24 -0
- package/src/protocol/index.ts +34 -0
- package/src/protocol/logs.ts +23 -0
- package/src/protocol/notifications.ts +48 -0
- package/src/protocol/requests.ts +76 -0
- package/src/types.ts +66 -0
- package/src/utils/ansi.ts +2 -4
- package/src/utils/format.ts +24 -32
- package/src/utils/index.ts +5 -1
- package/src/utils/is-record.ts +3 -0
- package/src/utils/match-line.ts +32 -0
- package/src/utils/platform.ts +13 -0
- package/src/utils/shorten-path.ts +11 -0
- package/src/utils/signals.ts +22 -0
- package/src/commands/clear/command.ts +0 -14
- package/src/commands/clear/index.ts +0 -1
- package/src/commands/completions.ts +0 -38
- package/src/commands/dock/command.ts +0 -29
- package/src/commands/dock/index.ts +0 -1
- package/src/commands/index.ts +0 -33
- package/src/commands/kill/command.ts +0 -69
- package/src/commands/kill/index.ts +0 -1
- package/src/commands/logs/command.ts +0 -47
- package/src/commands/logs/index.ts +0 -1
- package/src/commands/pick-process.ts +0 -34
- package/src/commands/pin/command.ts +0 -34
- package/src/commands/pin/index.ts +0 -1
- package/src/commands/processes/command.ts +0 -39
- package/src/commands/processes/index.ts +0 -1
- package/src/commands/settings/apply-setting-change.ts +0 -72
- package/src/commands/settings/build-sections.ts +0 -160
- package/src/commands/settings/command.ts +0 -20
- package/src/commands/settings/index.ts +0 -1
- package/src/components/log-dock-component.test.ts +0 -29
- package/src/components/log-dock-component.ts +0 -236
- package/src/components/log-file-viewer.ts +0 -317
- package/src/components/log-overlay-component.ts +0 -546
- package/src/components/panel-helpers.ts +0 -37
- package/src/components/process-picker-component.ts +0 -166
- package/src/components/processes-component.ts +0 -485
- package/src/components/status-format.ts +0 -38
- package/src/config.ts +0 -107
- package/src/constants/index.ts +0 -16
- package/src/constants/types.ts +0 -106
- package/src/hooks/background-blocker.ts +0 -66
- package/src/hooks/cleanup.ts +0 -10
- package/src/hooks/index.ts +0 -32
- package/src/hooks/message-renderer.ts +0 -115
- package/src/hooks/process-end.ts +0 -69
- package/src/hooks/process-watch.ts +0 -85
- package/src/hooks/utils.ts +0 -23
- package/src/hooks/widget/index.ts +0 -2
- package/src/hooks/widget/setup.ts +0 -167
- package/src/hooks/widget/status-widget.ts +0 -105
- package/src/hooks/widget/types.ts +0 -20
- package/src/index.ts +0 -35
- package/src/manager.test.ts +0 -331
- package/src/manager.ts +0 -758
- package/src/tools/actions/clear.ts +0 -20
- package/src/tools/actions/debug.ts +0 -148
- package/src/tools/actions/index.ts +0 -171
- package/src/tools/actions/kill.ts +0 -89
- package/src/tools/actions/list.ts +0 -188
- package/src/tools/actions/logs.ts +0 -117
- package/src/tools/actions/output.ts +0 -269
- package/src/tools/actions/start.ts +0 -245
- package/src/tools/actions/write.ts +0 -113
- package/src/tools/index.ts +0 -207
- package/src/utils/ansi.test.ts +0 -22
- package/src/utils/command-executor.test.ts +0 -48
- package/src/utils/keybindings.ts +0 -71
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
KillResult,
|
|
5
|
+
ManagerEvent,
|
|
6
|
+
ProcessInfo,
|
|
7
|
+
WriteResult,
|
|
8
|
+
} from "../types";
|
|
9
|
+
import { formatProcess } from "./internal-types";
|
|
10
|
+
import { ProcessLogStore } from "./process-log-store";
|
|
11
|
+
import { ProcessOutput } from "./process-output";
|
|
12
|
+
import { ProcessRegistry } from "./process-registry";
|
|
13
|
+
import { ProcessRuntimeController } from "./process-runtime-controller";
|
|
14
|
+
|
|
15
|
+
interface ProcessManagerOptions {
|
|
16
|
+
getConfiguredShellPath?: () => string | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ProcessManager {
|
|
20
|
+
private events = new EventEmitter();
|
|
21
|
+
|
|
22
|
+
private registry: ProcessRegistry;
|
|
23
|
+
private logStore: ProcessLogStore;
|
|
24
|
+
private output: ProcessOutput;
|
|
25
|
+
private runtime: ProcessRuntimeController;
|
|
26
|
+
|
|
27
|
+
constructor(options?: ProcessManagerOptions) {
|
|
28
|
+
const emit = (event: ManagerEvent): void => {
|
|
29
|
+
this.events.emit("event", event);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
this.registry = new ProcessRegistry();
|
|
33
|
+
this.logStore = new ProcessLogStore();
|
|
34
|
+
|
|
35
|
+
this.output = new ProcessOutput({
|
|
36
|
+
emit,
|
|
37
|
+
logStore: this.logStore,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
this.runtime = new ProcessRuntimeController({
|
|
41
|
+
registry: this.registry,
|
|
42
|
+
logs: this.logStore,
|
|
43
|
+
output: this.output,
|
|
44
|
+
emit,
|
|
45
|
+
getConfiguredShellPath:
|
|
46
|
+
options?.getConfiguredShellPath ?? (() => undefined),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onEvent(listener: (event: ManagerEvent) => void): () => void {
|
|
51
|
+
this.events.on("event", listener);
|
|
52
|
+
return () => this.events.off("event", listener);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
start(name: string, command: string, cwd: string): ProcessInfo {
|
|
56
|
+
const managed = this.runtime.start(name, command, cwd);
|
|
57
|
+
return formatProcess(managed);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
list(): ProcessInfo[] {
|
|
61
|
+
return this.registry.list();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get(id: string): ProcessInfo | null {
|
|
65
|
+
return this.registry.getPublicInfo(id);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
rename(id: string, name: string): ProcessInfo | null {
|
|
69
|
+
const info = this.registry.rename(id, name);
|
|
70
|
+
if (info) {
|
|
71
|
+
this.events.emit("event", {
|
|
72
|
+
type: "processes_changed",
|
|
73
|
+
} satisfies ManagerEvent);
|
|
74
|
+
}
|
|
75
|
+
return info;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getOutput(
|
|
79
|
+
id: string,
|
|
80
|
+
tailLines = 100,
|
|
81
|
+
): { stdout: string[]; stderr: string[]; status: string } | null {
|
|
82
|
+
const managed = this.registry.getRecord(id);
|
|
83
|
+
if (!managed) return null;
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
stdout: this.logStore.readTailLines(managed.stdoutFile, tailLines),
|
|
87
|
+
stderr: this.logStore.readTailLines(managed.stderrFile, tailLines),
|
|
88
|
+
status: managed.status,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getCombinedOutput(
|
|
93
|
+
id: string,
|
|
94
|
+
tailLines = 100,
|
|
95
|
+
): Array<{ type: "stdout" | "stderr"; text: string }> | null {
|
|
96
|
+
const managed = this.registry.getRecord(id);
|
|
97
|
+
if (!managed) return null;
|
|
98
|
+
return this.logStore.getCombinedOutput(managed.combinedFile, tailLines);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Return output capped at 16 MiB per stream. Use getLogFiles() and stream
|
|
103
|
+
* the returned paths when an exact, unbounded read is required.
|
|
104
|
+
*/
|
|
105
|
+
getFullOutput(id: string): { stdout: string; stderr: string } | null {
|
|
106
|
+
const managed = this.registry.getRecord(id);
|
|
107
|
+
if (!managed) return null;
|
|
108
|
+
return {
|
|
109
|
+
stdout: this.logStore.readFullFile(managed.stdoutFile),
|
|
110
|
+
stderr: this.logStore.readFullFile(managed.stderrFile),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
getLogFiles(
|
|
115
|
+
id: string,
|
|
116
|
+
): { stdoutFile: string; stderrFile: string; combinedFile: string } | null {
|
|
117
|
+
const managed = this.registry.getRecord(id);
|
|
118
|
+
if (!managed) return null;
|
|
119
|
+
return {
|
|
120
|
+
stdoutFile: managed.stdoutFile,
|
|
121
|
+
stderrFile: managed.stderrFile,
|
|
122
|
+
combinedFile: managed.combinedFile,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
getFileSize(id: string): { stdout: number; stderr: number } | null {
|
|
127
|
+
const managed = this.registry.getRecord(id);
|
|
128
|
+
if (!managed) return null;
|
|
129
|
+
return this.logStore.getFileSize({
|
|
130
|
+
stdoutFile: managed.stdoutFile,
|
|
131
|
+
stderrFile: managed.stderrFile,
|
|
132
|
+
combinedFile: managed.combinedFile,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async kill(
|
|
137
|
+
id: string,
|
|
138
|
+
opts?: { signal?: NodeJS.Signals; timeoutMs?: number },
|
|
139
|
+
): Promise<KillResult> {
|
|
140
|
+
return this.runtime.kill(id, opts);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
writeToStdin(
|
|
144
|
+
id: string,
|
|
145
|
+
data: string,
|
|
146
|
+
opts?: { end?: boolean },
|
|
147
|
+
): WriteResult {
|
|
148
|
+
return this.runtime.writeToStdin(id, data, opts);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
killAll(): void {
|
|
152
|
+
this.runtime.killAll();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
clearFinished(): number {
|
|
156
|
+
return this.runtime.clearFinished();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
stopWatcher(): void {
|
|
160
|
+
this.runtime.stopWatcher();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
cleanup(): void {
|
|
164
|
+
this.runtime.beginShutdown();
|
|
165
|
+
this.runtime.stopWatcher();
|
|
166
|
+
this.output.clearAll();
|
|
167
|
+
this.runtime.killAllLive();
|
|
168
|
+
this.logStore.cleanup();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[Symbol.dispose](): void {
|
|
172
|
+
this.cleanup();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export type {
|
|
177
|
+
KillResult,
|
|
178
|
+
ManagerEvent,
|
|
179
|
+
ProcessInfo,
|
|
180
|
+
ProcessStatus,
|
|
181
|
+
WriteResult,
|
|
182
|
+
} from "../types";
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Writable } from "node:stream";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ProcessEndReason,
|
|
5
|
+
ProcessInfo,
|
|
6
|
+
ProcessSignalInfo,
|
|
7
|
+
ProcessStatus,
|
|
8
|
+
} from "../types";
|
|
9
|
+
|
|
10
|
+
export interface ProcessLogPaths {
|
|
11
|
+
stdoutFile: string;
|
|
12
|
+
stderrFile: string;
|
|
13
|
+
combinedFile: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Stable process metadata and lifecycle status.
|
|
18
|
+
*
|
|
19
|
+
* This is the part of a managed process that can be safely projected into the
|
|
20
|
+
* public `ProcessInfo` API. It intentionally contains no Node handles, mutable
|
|
21
|
+
* stream buffers, or manager bookkeeping fields.
|
|
22
|
+
*/
|
|
23
|
+
interface ProcessPublicState {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
pid: number;
|
|
27
|
+
command: string;
|
|
28
|
+
cwd: string;
|
|
29
|
+
startTime: number;
|
|
30
|
+
endTime: number | null;
|
|
31
|
+
status: ProcessStatus;
|
|
32
|
+
exitCode: number | null;
|
|
33
|
+
success: boolean | null;
|
|
34
|
+
stdoutFile: string;
|
|
35
|
+
stderrFile: string;
|
|
36
|
+
endReason: ProcessEndReason | null;
|
|
37
|
+
signal: ProcessSignalInfo | null;
|
|
38
|
+
errorMessage: string | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Process handles and signal bookkeeping used by runtime control.
|
|
43
|
+
*
|
|
44
|
+
* Only `ProcessRuntimeController` should need these fields. They are not safe
|
|
45
|
+
* to expose because they allow direct mutation/control outside manager methods.
|
|
46
|
+
*/
|
|
47
|
+
interface ProcessRuntimeState {
|
|
48
|
+
stdin: Writable | null;
|
|
49
|
+
stdinClosed: boolean;
|
|
50
|
+
lastSignalSent: NodeJS.Signals | null;
|
|
51
|
+
completionSequence: number | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Internal log storage details.
|
|
56
|
+
*
|
|
57
|
+
* `stdoutFile` and `stderrFile` are public because agents/users can inspect
|
|
58
|
+
* them. The combined log file is an implementation detail used by manager/UI
|
|
59
|
+
* read APIs, so it stays internal.
|
|
60
|
+
*/
|
|
61
|
+
interface ProcessLogState {
|
|
62
|
+
combinedFile: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Output parser state for incomplete line chunks.
|
|
67
|
+
*
|
|
68
|
+
* Node streams can split a single logical line across multiple chunks. These
|
|
69
|
+
* buffers let `ProcessOutput` emit only completed lines in events/logs.
|
|
70
|
+
*/
|
|
71
|
+
interface ProcessLineBufferState {
|
|
72
|
+
stdoutPendingLine: Buffer;
|
|
73
|
+
stderrPendingLine: Buffer;
|
|
74
|
+
/** The line head was emitted; discard the tail through the next newline. */
|
|
75
|
+
stdoutLineOverflowed: boolean;
|
|
76
|
+
/** The line head was emitted; discard the tail through the next newline. */
|
|
77
|
+
stderrLineOverflowed: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Output lines accumulated since the last `process_output_changed` event.
|
|
82
|
+
*
|
|
83
|
+
* `ProcessOutput` drains this buffer when it emits an output event. This
|
|
84
|
+
* gives extension code live lines without re-reading log files or polling.
|
|
85
|
+
*/
|
|
86
|
+
interface ProcessOutputEventBufferState {
|
|
87
|
+
appendedLines: Array<{ type: "stdout" | "stderr"; text: string }>;
|
|
88
|
+
droppedLineCount: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Internal mutable record owned by `ProcessManager`.
|
|
93
|
+
*
|
|
94
|
+
* This is intentionally broader than public `ProcessInfo`: it combines public
|
|
95
|
+
* lifecycle state with runtime handles, log implementation details, and output
|
|
96
|
+
* parser buffers. Callers must receive `ProcessInfo` snapshots instead, created
|
|
97
|
+
* by `formatProcess()` below.
|
|
98
|
+
*/
|
|
99
|
+
export interface ManagedProcessRecord
|
|
100
|
+
extends ProcessPublicState,
|
|
101
|
+
ProcessRuntimeState,
|
|
102
|
+
ProcessLogState,
|
|
103
|
+
ProcessLineBufferState,
|
|
104
|
+
ProcessOutputEventBufferState {}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Convert an internal mutable record into the public process snapshot.
|
|
108
|
+
*
|
|
109
|
+
* Keep this function explicit instead of using object spread so new internal
|
|
110
|
+
* fields cannot accidentally leak into the public manager API.
|
|
111
|
+
*/
|
|
112
|
+
export function formatProcess(record: ManagedProcessRecord): ProcessInfo {
|
|
113
|
+
return {
|
|
114
|
+
id: record.id,
|
|
115
|
+
name: record.name,
|
|
116
|
+
pid: record.pid,
|
|
117
|
+
command: record.command,
|
|
118
|
+
cwd: record.cwd,
|
|
119
|
+
startTime: record.startTime,
|
|
120
|
+
endTime: record.endTime,
|
|
121
|
+
status: record.status,
|
|
122
|
+
exitCode: record.exitCode,
|
|
123
|
+
success: record.success,
|
|
124
|
+
stdoutFile: record.stdoutFile,
|
|
125
|
+
stderrFile: record.stderrFile,
|
|
126
|
+
endReason: record.endReason,
|
|
127
|
+
signal: record.signal,
|
|
128
|
+
errorMessage: record.errorMessage,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Max bytes retained for an unterminated line before force-flush. */
|
|
2
|
+
export const MAX_PENDING_LINE_BYTES = 64 * 1024;
|
|
3
|
+
/** Max bytes retained for any single line in an event payload. */
|
|
4
|
+
export const MAX_LINE_BYTES = 32 * 1024;
|
|
5
|
+
/** Max lines carried in one process_output_changed payload. */
|
|
6
|
+
export const MAX_LINES_PER_EMIT = 2000;
|
|
7
|
+
/** Max bytes read when tailing a log file. */
|
|
8
|
+
export const MAX_TAIL_READ_BYTES = 2 * 1024 * 1024;
|
|
9
|
+
/** Max bytes retained per log file before truncate-and-restart. */
|
|
10
|
+
export const MAX_LOG_FILE_BYTES = 64 * 1024 * 1024;
|
|
11
|
+
export const TRUNCATION_SUFFIX = " … [line truncated]";
|
|
12
|
+
/** Max finished process records retained after the grace period. */
|
|
13
|
+
export const MAX_FINISHED_RECORDS = 50;
|
|
14
|
+
/** Keep recently finished records available to the UI before reaping. */
|
|
15
|
+
export const FINISHED_RECORD_GRACE_MS = 5 * 60 * 1000;
|