libretto 0.1.5 → 0.2.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 +213 -17
- package/bin/libretto.mjs +18 -0
- package/dist/cli/cli.js +201 -0
- package/dist/cli/commands/ai.js +21 -0
- package/dist/cli/commands/browser.js +56 -0
- package/dist/cli/commands/execution.js +407 -0
- package/dist/cli/commands/logs.js +65 -0
- package/dist/cli/commands/snapshot.js +99 -0
- package/dist/cli/core/ai-config.js +149 -0
- package/dist/cli/core/browser.js +687 -0
- package/dist/cli/core/context.js +113 -0
- package/dist/cli/core/pause-signals.js +29 -0
- package/dist/cli/core/session.js +183 -0
- package/dist/cli/core/snapshot-analyzer.js +492 -0
- package/dist/cli/core/telemetry.js +350 -0
- package/dist/cli/index.js +13 -0
- package/dist/cli/workers/run-integration-runtime.js +204 -0
- package/dist/cli/workers/run-integration-worker-protocol.js +0 -0
- package/dist/cli/workers/run-integration-worker.js +83 -0
- package/dist/index.cjs +127 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +110 -0
- package/dist/runtime/download/download.cjs +70 -0
- package/dist/runtime/download/download.d.cts +35 -0
- package/dist/runtime/download/download.d.ts +35 -0
- package/dist/runtime/download/download.js +45 -0
- package/dist/runtime/download/index.cjs +30 -0
- package/dist/runtime/download/index.d.cts +3 -0
- package/dist/runtime/download/index.d.ts +3 -0
- package/dist/runtime/download/index.js +8 -0
- package/dist/runtime/extract/extract.cjs +87 -0
- package/dist/runtime/extract/extract.d.cts +23 -0
- package/dist/runtime/extract/extract.d.ts +23 -0
- package/dist/runtime/extract/extract.js +63 -0
- package/dist/runtime/extract/index.cjs +28 -0
- package/dist/runtime/extract/index.d.cts +5 -0
- package/dist/runtime/extract/index.d.ts +5 -0
- package/dist/runtime/extract/index.js +4 -0
- package/dist/runtime/network/index.cjs +28 -0
- package/dist/runtime/network/index.d.cts +4 -0
- package/dist/runtime/network/index.d.ts +4 -0
- package/dist/runtime/network/index.js +6 -0
- package/dist/runtime/network/network.cjs +91 -0
- package/dist/runtime/network/network.d.cts +28 -0
- package/dist/runtime/network/network.d.ts +28 -0
- package/dist/runtime/network/network.js +67 -0
- package/dist/runtime/recovery/agent.cjs +218 -0
- package/dist/runtime/recovery/agent.d.cts +13 -0
- package/dist/runtime/recovery/agent.d.ts +13 -0
- package/dist/runtime/recovery/agent.js +194 -0
- package/dist/runtime/recovery/errors.cjs +122 -0
- package/dist/runtime/recovery/errors.d.cts +31 -0
- package/dist/runtime/recovery/errors.d.ts +31 -0
- package/dist/runtime/recovery/errors.js +98 -0
- package/dist/runtime/recovery/index.cjs +34 -0
- package/dist/runtime/recovery/index.d.cts +7 -0
- package/dist/runtime/recovery/index.d.ts +7 -0
- package/dist/runtime/recovery/index.js +10 -0
- package/dist/runtime/recovery/recovery.cjs +53 -0
- package/dist/runtime/recovery/recovery.d.cts +12 -0
- package/dist/runtime/recovery/recovery.d.ts +12 -0
- package/dist/runtime/recovery/recovery.js +29 -0
- package/dist/runtime/step/index.cjs +31 -0
- package/dist/runtime/step/index.d.cts +7 -0
- package/dist/runtime/step/index.d.ts +7 -0
- package/dist/runtime/step/index.js +6 -0
- package/dist/runtime/step/runner.cjs +208 -0
- package/dist/runtime/step/runner.d.cts +16 -0
- package/dist/runtime/step/runner.d.ts +16 -0
- package/dist/runtime/step/runner.js +187 -0
- package/dist/runtime/step/step.cjs +67 -0
- package/dist/runtime/step/step.d.cts +23 -0
- package/dist/runtime/step/step.d.ts +23 -0
- package/dist/runtime/step/step.js +43 -0
- package/dist/runtime/step/types.cjs +16 -0
- package/dist/runtime/step/types.d.cts +72 -0
- package/dist/runtime/step/types.d.ts +72 -0
- package/dist/runtime/step/types.js +0 -0
- package/dist/shared/config/config.cjs +44 -0
- package/dist/shared/config/config.d.cts +10 -0
- package/dist/shared/config/config.d.ts +10 -0
- package/dist/shared/config/config.js +18 -0
- package/dist/shared/config/index.cjs +32 -0
- package/dist/shared/config/index.d.cts +1 -0
- package/dist/shared/config/index.d.ts +1 -0
- package/dist/shared/config/index.js +10 -0
- package/dist/shared/debug/index.cjs +32 -0
- package/dist/shared/debug/index.d.cts +2 -0
- package/dist/shared/debug/index.d.ts +2 -0
- package/dist/shared/debug/index.js +10 -0
- package/dist/shared/debug/pause.cjs +56 -0
- package/dist/shared/debug/pause.d.cts +23 -0
- package/dist/shared/debug/pause.d.ts +23 -0
- package/dist/shared/debug/pause.js +30 -0
- package/dist/shared/instrumentation/errors.cjs +81 -0
- package/dist/shared/instrumentation/errors.d.cts +12 -0
- package/dist/shared/instrumentation/errors.d.ts +12 -0
- package/dist/shared/instrumentation/errors.js +57 -0
- package/dist/shared/instrumentation/index.cjs +35 -0
- package/dist/shared/instrumentation/index.d.cts +6 -0
- package/dist/shared/instrumentation/index.d.ts +6 -0
- package/dist/shared/instrumentation/index.js +12 -0
- package/dist/shared/instrumentation/instrument.cjs +206 -0
- package/dist/shared/instrumentation/instrument.d.cts +32 -0
- package/dist/shared/instrumentation/instrument.d.ts +32 -0
- package/dist/shared/instrumentation/instrument.js +190 -0
- package/dist/shared/llm/client.cjs +139 -0
- package/dist/shared/llm/client.d.cts +6 -0
- package/dist/shared/llm/client.d.ts +6 -0
- package/dist/shared/llm/client.js +115 -0
- package/dist/shared/llm/index.cjs +28 -0
- package/dist/shared/llm/index.d.cts +3 -0
- package/dist/shared/llm/index.d.ts +3 -0
- package/dist/shared/llm/index.js +4 -0
- package/dist/shared/llm/types.cjs +16 -0
- package/dist/shared/llm/types.d.cts +34 -0
- package/dist/shared/llm/types.d.ts +34 -0
- package/dist/shared/llm/types.js +0 -0
- package/dist/shared/logger/index.cjs +35 -0
- package/dist/shared/logger/index.d.cts +2 -0
- package/dist/shared/logger/index.d.ts +2 -0
- package/dist/shared/logger/index.js +12 -0
- package/dist/shared/logger/logger.cjs +200 -0
- package/dist/shared/logger/logger.d.cts +70 -0
- package/dist/shared/logger/logger.d.ts +70 -0
- package/dist/shared/logger/logger.js +176 -0
- package/dist/shared/logger/sinks.cjs +160 -0
- package/dist/shared/logger/sinks.d.cts +9 -0
- package/dist/shared/logger/sinks.d.ts +9 -0
- package/dist/shared/logger/sinks.js +124 -0
- package/dist/shared/paths/paths.cjs +104 -0
- package/dist/shared/paths/paths.d.cts +10 -0
- package/dist/shared/paths/paths.d.ts +10 -0
- package/dist/shared/paths/paths.js +73 -0
- package/dist/shared/run/api.cjs +35 -0
- package/dist/shared/run/api.d.cts +3 -0
- package/dist/shared/run/api.d.ts +3 -0
- package/dist/shared/run/api.js +12 -0
- package/dist/shared/run/browser.cjs +98 -0
- package/dist/shared/run/browser.d.cts +22 -0
- package/dist/shared/run/browser.d.ts +22 -0
- package/dist/shared/run/browser.js +74 -0
- package/dist/shared/state/index.cjs +38 -0
- package/dist/shared/state/index.d.cts +2 -0
- package/dist/shared/state/index.d.ts +2 -0
- package/dist/shared/state/index.js +16 -0
- package/dist/shared/state/session-state.cjs +85 -0
- package/dist/shared/state/session-state.d.cts +34 -0
- package/dist/shared/state/session-state.d.ts +34 -0
- package/dist/shared/state/session-state.js +56 -0
- package/dist/shared/visualization/ghost-cursor.cjs +174 -0
- package/dist/shared/visualization/ghost-cursor.d.cts +37 -0
- package/dist/shared/visualization/ghost-cursor.d.ts +37 -0
- package/dist/shared/visualization/ghost-cursor.js +145 -0
- package/dist/shared/visualization/highlight.cjs +134 -0
- package/dist/shared/visualization/highlight.d.cts +22 -0
- package/dist/shared/visualization/highlight.d.ts +22 -0
- package/dist/shared/visualization/highlight.js +108 -0
- package/dist/shared/visualization/index.cjs +45 -0
- package/dist/shared/visualization/index.d.cts +3 -0
- package/dist/shared/visualization/index.d.ts +3 -0
- package/dist/shared/visualization/index.js +24 -0
- package/dist/shared/workflow/workflow.cjs +47 -0
- package/dist/shared/workflow/workflow.d.cts +33 -0
- package/dist/shared/workflow/workflow.d.ts +33 -0
- package/dist/shared/workflow/workflow.js +21 -0
- package/package.json +123 -26
- package/.npmignore +0 -2
- package/bin/libretto +0 -31
- package/lib/connect.js +0 -34
- package/lib/export.js +0 -224
- package/lib/import.js +0 -166
- package/lib/index.js +0 -8
- package/lib/log.js +0 -9
- package/lib/validate.js +0 -20
- package/makefile +0 -8
- package/src/connect.coffee +0 -25
- package/src/export.coffee +0 -222
- package/src/import.coffee +0 -166
- package/src/index.coffee +0 -3
- package/src/log.coffee +0 -3
- package/src/validate.coffee +0 -10
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
function generateId() {
|
|
2
|
+
return Math.random().toString(36).substring(2, 15);
|
|
3
|
+
}
|
|
4
|
+
const sinkLifecycleState = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function getSinkLifecycleState(sink) {
|
|
6
|
+
const existingState = sinkLifecycleState.get(sink);
|
|
7
|
+
if (existingState) {
|
|
8
|
+
return existingState;
|
|
9
|
+
}
|
|
10
|
+
const initialState = { closed: false };
|
|
11
|
+
sinkLifecycleState.set(sink, initialState);
|
|
12
|
+
return initialState;
|
|
13
|
+
}
|
|
14
|
+
function isSinkClosedOrClosing(sink) {
|
|
15
|
+
const state = sinkLifecycleState.get(sink);
|
|
16
|
+
return Boolean(state?.closed || state?.closing);
|
|
17
|
+
}
|
|
18
|
+
async function closeSinkOnce(sink) {
|
|
19
|
+
if (!sink.close) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const state = getSinkLifecycleState(sink);
|
|
23
|
+
if (state.closed) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (state.closing) {
|
|
27
|
+
return state.closing;
|
|
28
|
+
}
|
|
29
|
+
state.closing = (async () => {
|
|
30
|
+
try {
|
|
31
|
+
await sink.close?.();
|
|
32
|
+
} catch {
|
|
33
|
+
} finally {
|
|
34
|
+
state.closed = true;
|
|
35
|
+
state.closing = void 0;
|
|
36
|
+
}
|
|
37
|
+
})();
|
|
38
|
+
return state.closing;
|
|
39
|
+
}
|
|
40
|
+
function isObject(value) {
|
|
41
|
+
return typeof value === "object" && value !== null;
|
|
42
|
+
}
|
|
43
|
+
function removeUndefined(data) {
|
|
44
|
+
if (typeof data === "object" && data !== null) {
|
|
45
|
+
return Object.fromEntries(
|
|
46
|
+
Object.entries(data).filter(([_, value]) => value !== void 0)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
class Logger {
|
|
52
|
+
constructor(scopes = [], sinks = [], scopeData = {}) {
|
|
53
|
+
this.scopes = scopes;
|
|
54
|
+
this.sinks = sinks;
|
|
55
|
+
this.scopeData = scopeData;
|
|
56
|
+
this.prefix = scopes.join(".");
|
|
57
|
+
}
|
|
58
|
+
prefix;
|
|
59
|
+
entry(entry) {
|
|
60
|
+
this.sinks.forEach((sink) => {
|
|
61
|
+
if (isSinkClosedOrClosing(sink)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
sink.write({
|
|
65
|
+
id: generateId(),
|
|
66
|
+
scope: this.prefix,
|
|
67
|
+
level: entry.level,
|
|
68
|
+
event: entry.event,
|
|
69
|
+
data: removeUndefined({ ...this.scopeData, ...entry.data }),
|
|
70
|
+
options: entry.options
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
log(event, data, options) {
|
|
75
|
+
this.entry({ level: "log", event, data, options });
|
|
76
|
+
}
|
|
77
|
+
error(event, dataOrError, options) {
|
|
78
|
+
const data = dataOrError instanceof Error ? {
|
|
79
|
+
error: {
|
|
80
|
+
type: dataOrError.constructor.name,
|
|
81
|
+
message: dataOrError.message,
|
|
82
|
+
stack: dataOrError.stack || null
|
|
83
|
+
}
|
|
84
|
+
} : isObject(dataOrError) && dataOrError.error instanceof Error ? {
|
|
85
|
+
...dataOrError,
|
|
86
|
+
error: {
|
|
87
|
+
type: dataOrError.error.constructor.name,
|
|
88
|
+
message: dataOrError.error.message,
|
|
89
|
+
stack: dataOrError.error.stack || null
|
|
90
|
+
}
|
|
91
|
+
} : isObject(dataOrError) ? dataOrError : dataOrError !== void 0 ? { error: dataOrError } : void 0;
|
|
92
|
+
this.entry({
|
|
93
|
+
level: "error",
|
|
94
|
+
event,
|
|
95
|
+
data,
|
|
96
|
+
options
|
|
97
|
+
});
|
|
98
|
+
if (dataOrError instanceof Error) {
|
|
99
|
+
return dataOrError;
|
|
100
|
+
}
|
|
101
|
+
if (isObject(dataOrError) && dataOrError.error instanceof Error) {
|
|
102
|
+
return dataOrError.error;
|
|
103
|
+
}
|
|
104
|
+
let message = event;
|
|
105
|
+
if (data !== void 0) {
|
|
106
|
+
try {
|
|
107
|
+
message += "\n" + JSON.stringify(data, void 0, 2);
|
|
108
|
+
} catch {
|
|
109
|
+
message += "\n[Unserializable error data]";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return new Error(message);
|
|
113
|
+
}
|
|
114
|
+
warn(event, dataOrError, options) {
|
|
115
|
+
const data = dataOrError instanceof Error ? {
|
|
116
|
+
error: {
|
|
117
|
+
type: dataOrError.constructor.name,
|
|
118
|
+
message: dataOrError.message,
|
|
119
|
+
stack: dataOrError.stack || null
|
|
120
|
+
}
|
|
121
|
+
} : isObject(dataOrError) && dataOrError.error instanceof Error ? {
|
|
122
|
+
...dataOrError,
|
|
123
|
+
error: {
|
|
124
|
+
type: dataOrError.error.constructor.name,
|
|
125
|
+
message: dataOrError.error.message,
|
|
126
|
+
stack: dataOrError.error.stack || null
|
|
127
|
+
}
|
|
128
|
+
} : isObject(dataOrError) ? dataOrError : dataOrError !== void 0 ? { error: dataOrError } : void 0;
|
|
129
|
+
this.entry({
|
|
130
|
+
level: "warn",
|
|
131
|
+
event,
|
|
132
|
+
data,
|
|
133
|
+
options
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
info(event, data, options) {
|
|
137
|
+
this.entry({ level: "info", event, data, options });
|
|
138
|
+
}
|
|
139
|
+
withScope(scope, context = {}) {
|
|
140
|
+
return new Logger([...this.scopes, scope], this.sinks, {
|
|
141
|
+
...this.scopeData,
|
|
142
|
+
...context
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
withContext(context) {
|
|
146
|
+
return new Logger(this.scopes, this.sinks, {
|
|
147
|
+
...this.scopeData,
|
|
148
|
+
...context
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
withSink(sink) {
|
|
152
|
+
return new Logger(this.scopes, [...this.sinks, sink]);
|
|
153
|
+
}
|
|
154
|
+
async flush() {
|
|
155
|
+
for (let i = this.sinks.length - 1; i >= 0; i--) {
|
|
156
|
+
const sink = this.sinks[i];
|
|
157
|
+
if (!sink) continue;
|
|
158
|
+
if (isSinkClosedOrClosing(sink)) continue;
|
|
159
|
+
try {
|
|
160
|
+
await sink.flush?.();
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async close() {
|
|
166
|
+
await this.flush();
|
|
167
|
+
for (let i = this.sinks.length - 1; i >= 0; i--) {
|
|
168
|
+
const sink = this.sinks[i];
|
|
169
|
+
if (!sink) continue;
|
|
170
|
+
await closeSinkOnce(sink);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
Logger
|
|
176
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var sinks_exports = {};
|
|
30
|
+
__export(sinks_exports, {
|
|
31
|
+
createFileLogSink: () => createFileLogSink,
|
|
32
|
+
jsonlConsoleSink: () => jsonlConsoleSink,
|
|
33
|
+
prettyConsoleSink: () => prettyConsoleSink
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(sinks_exports);
|
|
36
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
37
|
+
var path = __toESM(require("node:path"), 1);
|
|
38
|
+
function createFileLogSink({
|
|
39
|
+
filePath
|
|
40
|
+
}) {
|
|
41
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
42
|
+
const writeStream = fs.createWriteStream(filePath, { flags: "a" });
|
|
43
|
+
return {
|
|
44
|
+
write: ({ id, scope, level, event, data, options }) => {
|
|
45
|
+
if (writeStream.destroyed || writeStream.writableEnded) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const timestamp = options?.timestamp || /* @__PURE__ */ new Date();
|
|
49
|
+
const logEntry = {
|
|
50
|
+
timestamp: timestamp.toISOString(),
|
|
51
|
+
id,
|
|
52
|
+
level,
|
|
53
|
+
scope,
|
|
54
|
+
event,
|
|
55
|
+
data
|
|
56
|
+
};
|
|
57
|
+
const jsonLine = JSON.stringify(logEntry) + "\n";
|
|
58
|
+
try {
|
|
59
|
+
writeStream.write(jsonLine, (error) => {
|
|
60
|
+
if (error) {
|
|
61
|
+
console.error("Failed to write to log file:", error);
|
|
62
|
+
console[level]({ id, scope, event, data, timestamp });
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error("Failed to write to log file:", error);
|
|
67
|
+
console[level]({ id, scope, event, data, timestamp });
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
flush: () => new Promise((resolve, reject) => {
|
|
71
|
+
if (!writeStream.writable || writeStream.writableEnded || writeStream.destroyed) {
|
|
72
|
+
resolve();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
writeStream.write("", (error) => {
|
|
76
|
+
if (error) {
|
|
77
|
+
reject(error);
|
|
78
|
+
} else {
|
|
79
|
+
resolve();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}),
|
|
83
|
+
close: () => new Promise((resolve) => {
|
|
84
|
+
if (writeStream.destroyed || writeStream.closed) {
|
|
85
|
+
resolve();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
let settled = false;
|
|
89
|
+
const done = () => {
|
|
90
|
+
if (settled) return;
|
|
91
|
+
settled = true;
|
|
92
|
+
resolve();
|
|
93
|
+
};
|
|
94
|
+
writeStream.once("finish", done);
|
|
95
|
+
writeStream.once("close", done);
|
|
96
|
+
writeStream.once("error", done);
|
|
97
|
+
try {
|
|
98
|
+
writeStream.end();
|
|
99
|
+
} catch {
|
|
100
|
+
done();
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const colors = {
|
|
106
|
+
reset: "\x1B[0m",
|
|
107
|
+
gray: "\x1B[90m",
|
|
108
|
+
red: "\x1B[31m",
|
|
109
|
+
yellow: "\x1B[33m",
|
|
110
|
+
blue: "\x1B[34m",
|
|
111
|
+
cyan: "\x1B[36m"
|
|
112
|
+
};
|
|
113
|
+
function formatTimestamp(date) {
|
|
114
|
+
return date.toISOString().replace("T", " ").replace("Z", "");
|
|
115
|
+
}
|
|
116
|
+
const prettyConsoleSink = {
|
|
117
|
+
write: ({ scope, level, event, data, options }) => {
|
|
118
|
+
const timestamp = `${colors.gray}${formatTimestamp(options?.timestamp || /* @__PURE__ */ new Date())}${colors.reset}`;
|
|
119
|
+
const levelColor = level === "error" ? colors.red : level === "warn" ? colors.yellow : colors.blue;
|
|
120
|
+
const coloredScope = scope ? `${colors.cyan}[${scope}]${colors.reset}` : "";
|
|
121
|
+
const logPrefix = `${timestamp} ${levelColor}${level.toUpperCase()}${colors.reset} ${coloredScope} ${event}`;
|
|
122
|
+
if (level === "error" && data.error) {
|
|
123
|
+
const { error, ...otherData } = data;
|
|
124
|
+
console.error(logPrefix);
|
|
125
|
+
if (error.stack) {
|
|
126
|
+
console.error(` ${error.stack}`);
|
|
127
|
+
} else if (error.type && error.message) {
|
|
128
|
+
console.error(` ${error.type}: ${error.message}`);
|
|
129
|
+
}
|
|
130
|
+
if (Object.keys(otherData).length > 0) {
|
|
131
|
+
console.error(JSON.stringify(otherData, null, 2));
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
console[level](logPrefix);
|
|
135
|
+
if (Object.keys(data).length > 0) {
|
|
136
|
+
console[level](JSON.stringify(data, null, 2));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const jsonlConsoleSink = {
|
|
142
|
+
write: ({ id, scope, level, event, data, options }) => {
|
|
143
|
+
const timestamp = options?.timestamp || /* @__PURE__ */ new Date();
|
|
144
|
+
const logEntry = {
|
|
145
|
+
timestamp: timestamp.toISOString(),
|
|
146
|
+
id,
|
|
147
|
+
level,
|
|
148
|
+
scope: scope || void 0,
|
|
149
|
+
event,
|
|
150
|
+
data
|
|
151
|
+
};
|
|
152
|
+
console.log(JSON.stringify(logEntry));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
createFileLogSink,
|
|
158
|
+
jsonlConsoleSink,
|
|
159
|
+
prettyConsoleSink
|
|
160
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoggerSink } from './logger.cjs';
|
|
2
|
+
|
|
3
|
+
declare function createFileLogSink({ filePath, }: {
|
|
4
|
+
filePath: string;
|
|
5
|
+
}): LoggerSink;
|
|
6
|
+
declare const prettyConsoleSink: LoggerSink;
|
|
7
|
+
declare const jsonlConsoleSink: LoggerSink;
|
|
8
|
+
|
|
9
|
+
export { createFileLogSink, jsonlConsoleSink, prettyConsoleSink };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoggerSink } from './logger.js';
|
|
2
|
+
|
|
3
|
+
declare function createFileLogSink({ filePath, }: {
|
|
4
|
+
filePath: string;
|
|
5
|
+
}): LoggerSink;
|
|
6
|
+
declare const prettyConsoleSink: LoggerSink;
|
|
7
|
+
declare const jsonlConsoleSink: LoggerSink;
|
|
8
|
+
|
|
9
|
+
export { createFileLogSink, jsonlConsoleSink, prettyConsoleSink };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
function createFileLogSink({
|
|
4
|
+
filePath
|
|
5
|
+
}) {
|
|
6
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
7
|
+
const writeStream = fs.createWriteStream(filePath, { flags: "a" });
|
|
8
|
+
return {
|
|
9
|
+
write: ({ id, scope, level, event, data, options }) => {
|
|
10
|
+
if (writeStream.destroyed || writeStream.writableEnded) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const timestamp = options?.timestamp || /* @__PURE__ */ new Date();
|
|
14
|
+
const logEntry = {
|
|
15
|
+
timestamp: timestamp.toISOString(),
|
|
16
|
+
id,
|
|
17
|
+
level,
|
|
18
|
+
scope,
|
|
19
|
+
event,
|
|
20
|
+
data
|
|
21
|
+
};
|
|
22
|
+
const jsonLine = JSON.stringify(logEntry) + "\n";
|
|
23
|
+
try {
|
|
24
|
+
writeStream.write(jsonLine, (error) => {
|
|
25
|
+
if (error) {
|
|
26
|
+
console.error("Failed to write to log file:", error);
|
|
27
|
+
console[level]({ id, scope, event, data, timestamp });
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error("Failed to write to log file:", error);
|
|
32
|
+
console[level]({ id, scope, event, data, timestamp });
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
flush: () => new Promise((resolve, reject) => {
|
|
36
|
+
if (!writeStream.writable || writeStream.writableEnded || writeStream.destroyed) {
|
|
37
|
+
resolve();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
writeStream.write("", (error) => {
|
|
41
|
+
if (error) {
|
|
42
|
+
reject(error);
|
|
43
|
+
} else {
|
|
44
|
+
resolve();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}),
|
|
48
|
+
close: () => new Promise((resolve) => {
|
|
49
|
+
if (writeStream.destroyed || writeStream.closed) {
|
|
50
|
+
resolve();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let settled = false;
|
|
54
|
+
const done = () => {
|
|
55
|
+
if (settled) return;
|
|
56
|
+
settled = true;
|
|
57
|
+
resolve();
|
|
58
|
+
};
|
|
59
|
+
writeStream.once("finish", done);
|
|
60
|
+
writeStream.once("close", done);
|
|
61
|
+
writeStream.once("error", done);
|
|
62
|
+
try {
|
|
63
|
+
writeStream.end();
|
|
64
|
+
} catch {
|
|
65
|
+
done();
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const colors = {
|
|
71
|
+
reset: "\x1B[0m",
|
|
72
|
+
gray: "\x1B[90m",
|
|
73
|
+
red: "\x1B[31m",
|
|
74
|
+
yellow: "\x1B[33m",
|
|
75
|
+
blue: "\x1B[34m",
|
|
76
|
+
cyan: "\x1B[36m"
|
|
77
|
+
};
|
|
78
|
+
function formatTimestamp(date) {
|
|
79
|
+
return date.toISOString().replace("T", " ").replace("Z", "");
|
|
80
|
+
}
|
|
81
|
+
const prettyConsoleSink = {
|
|
82
|
+
write: ({ scope, level, event, data, options }) => {
|
|
83
|
+
const timestamp = `${colors.gray}${formatTimestamp(options?.timestamp || /* @__PURE__ */ new Date())}${colors.reset}`;
|
|
84
|
+
const levelColor = level === "error" ? colors.red : level === "warn" ? colors.yellow : colors.blue;
|
|
85
|
+
const coloredScope = scope ? `${colors.cyan}[${scope}]${colors.reset}` : "";
|
|
86
|
+
const logPrefix = `${timestamp} ${levelColor}${level.toUpperCase()}${colors.reset} ${coloredScope} ${event}`;
|
|
87
|
+
if (level === "error" && data.error) {
|
|
88
|
+
const { error, ...otherData } = data;
|
|
89
|
+
console.error(logPrefix);
|
|
90
|
+
if (error.stack) {
|
|
91
|
+
console.error(` ${error.stack}`);
|
|
92
|
+
} else if (error.type && error.message) {
|
|
93
|
+
console.error(` ${error.type}: ${error.message}`);
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(otherData).length > 0) {
|
|
96
|
+
console.error(JSON.stringify(otherData, null, 2));
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
console[level](logPrefix);
|
|
100
|
+
if (Object.keys(data).length > 0) {
|
|
101
|
+
console[level](JSON.stringify(data, null, 2));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const jsonlConsoleSink = {
|
|
107
|
+
write: ({ id, scope, level, event, data, options }) => {
|
|
108
|
+
const timestamp = options?.timestamp || /* @__PURE__ */ new Date();
|
|
109
|
+
const logEntry = {
|
|
110
|
+
timestamp: timestamp.toISOString(),
|
|
111
|
+
id,
|
|
112
|
+
level,
|
|
113
|
+
scope: scope || void 0,
|
|
114
|
+
event,
|
|
115
|
+
data
|
|
116
|
+
};
|
|
117
|
+
console.log(JSON.stringify(logEntry));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
createFileLogSink,
|
|
122
|
+
jsonlConsoleSink,
|
|
123
|
+
prettyConsoleSink
|
|
124
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var paths_exports = {};
|
|
20
|
+
__export(paths_exports, {
|
|
21
|
+
ensureLibrettoPauseSignalDir: () => ensureLibrettoPauseSignalDir,
|
|
22
|
+
ensureLibrettoRunnerLogDir: () => ensureLibrettoRunnerLogDir,
|
|
23
|
+
ensureLibrettoSessionStatePath: () => ensureLibrettoSessionStatePath,
|
|
24
|
+
getLibrettoPauseSignalDir: () => getLibrettoPauseSignalDir,
|
|
25
|
+
getLibrettoPausedSignalPath: () => getLibrettoPausedSignalPath,
|
|
26
|
+
getLibrettoResumeSignalPath: () => getLibrettoResumeSignalPath,
|
|
27
|
+
getPauseSignalPathForDir: () => getPauseSignalPathForDir,
|
|
28
|
+
getRunnerLogPathForDir: () => getRunnerLogPathForDir
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(paths_exports);
|
|
31
|
+
var import_node_fs = require("node:fs");
|
|
32
|
+
var import_node_path = require("node:path");
|
|
33
|
+
const LIBRETTO_DIRNAME = ".libretto";
|
|
34
|
+
const LIBRETTO_SESSIONS_DIRNAME = "sessions";
|
|
35
|
+
const SESSION_STATE_FILENAME = "state.json";
|
|
36
|
+
const RUNNER_LOG_DIRNAME = "logs";
|
|
37
|
+
const RUNNER_LOG_FILENAME = "logs.jsonl";
|
|
38
|
+
const PAUSED_SIGNAL_SUFFIX = "paused";
|
|
39
|
+
const RESUME_SIGNAL_SUFFIX = "resume";
|
|
40
|
+
function getLibrettoRoot(cwd = process.cwd()) {
|
|
41
|
+
return (0, import_node_path.join)(cwd, LIBRETTO_DIRNAME);
|
|
42
|
+
}
|
|
43
|
+
function getLibrettoSessionsDir(cwd = process.cwd()) {
|
|
44
|
+
return (0, import_node_path.join)(getLibrettoRoot(cwd), LIBRETTO_SESSIONS_DIRNAME);
|
|
45
|
+
}
|
|
46
|
+
function getLibrettoSessionDir(sessionName, cwd = process.cwd()) {
|
|
47
|
+
return (0, import_node_path.join)(getLibrettoSessionsDir(cwd), sessionName);
|
|
48
|
+
}
|
|
49
|
+
function getLibrettoSessionStatePath(sessionName, cwd = process.cwd()) {
|
|
50
|
+
return (0, import_node_path.join)(getLibrettoSessionDir(sessionName, cwd), SESSION_STATE_FILENAME);
|
|
51
|
+
}
|
|
52
|
+
function getLibrettoPauseSignalDir(sessionName, cwd = process.cwd()) {
|
|
53
|
+
return getLibrettoSessionDir(sessionName, cwd);
|
|
54
|
+
}
|
|
55
|
+
function getLibrettoRunnerLogDir(sessionName, cwd = process.cwd()) {
|
|
56
|
+
return (0, import_node_path.join)(getLibrettoSessionDir(sessionName, cwd), RUNNER_LOG_DIRNAME);
|
|
57
|
+
}
|
|
58
|
+
function getRunnerLogPathForDir(logDir) {
|
|
59
|
+
return (0, import_node_path.join)(logDir, RUNNER_LOG_FILENAME);
|
|
60
|
+
}
|
|
61
|
+
function getPauseSignalPathForDir(signalDir, sessionName, signal) {
|
|
62
|
+
const suffix = signal === "paused" ? PAUSED_SIGNAL_SUFFIX : RESUME_SIGNAL_SUFFIX;
|
|
63
|
+
return (0, import_node_path.join)(signalDir, `${sessionName}.${suffix}`);
|
|
64
|
+
}
|
|
65
|
+
function getLibrettoPausedSignalPath(sessionName, cwd = process.cwd()) {
|
|
66
|
+
return getPauseSignalPathForDir(
|
|
67
|
+
getLibrettoPauseSignalDir(sessionName, cwd),
|
|
68
|
+
sessionName,
|
|
69
|
+
"paused"
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function getLibrettoResumeSignalPath(sessionName, cwd = process.cwd()) {
|
|
73
|
+
return getPauseSignalPathForDir(
|
|
74
|
+
getLibrettoPauseSignalDir(sessionName, cwd),
|
|
75
|
+
sessionName,
|
|
76
|
+
"resume"
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function ensureLibrettoSessionStatePath(sessionName, cwd = process.cwd()) {
|
|
80
|
+
const filePath = getLibrettoSessionStatePath(sessionName, cwd);
|
|
81
|
+
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(filePath), { recursive: true });
|
|
82
|
+
return filePath;
|
|
83
|
+
}
|
|
84
|
+
function ensureLibrettoPauseSignalDir(sessionName, cwd = process.cwd()) {
|
|
85
|
+
const dir = getLibrettoPauseSignalDir(sessionName, cwd);
|
|
86
|
+
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
87
|
+
return dir;
|
|
88
|
+
}
|
|
89
|
+
function ensureLibrettoRunnerLogDir(sessionName, cwd = process.cwd()) {
|
|
90
|
+
const dir = getLibrettoRunnerLogDir(sessionName, cwd);
|
|
91
|
+
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
92
|
+
return dir;
|
|
93
|
+
}
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
ensureLibrettoPauseSignalDir,
|
|
97
|
+
ensureLibrettoRunnerLogDir,
|
|
98
|
+
ensureLibrettoSessionStatePath,
|
|
99
|
+
getLibrettoPauseSignalDir,
|
|
100
|
+
getLibrettoPausedSignalPath,
|
|
101
|
+
getLibrettoResumeSignalPath,
|
|
102
|
+
getPauseSignalPathForDir,
|
|
103
|
+
getRunnerLogPathForDir
|
|
104
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function getLibrettoPauseSignalDir(sessionName: string, cwd?: string): string;
|
|
2
|
+
declare function getRunnerLogPathForDir(logDir: string): string;
|
|
3
|
+
declare function getPauseSignalPathForDir(signalDir: string, sessionName: string, signal: "paused" | "resume"): string;
|
|
4
|
+
declare function getLibrettoPausedSignalPath(sessionName: string, cwd?: string): string;
|
|
5
|
+
declare function getLibrettoResumeSignalPath(sessionName: string, cwd?: string): string;
|
|
6
|
+
declare function ensureLibrettoSessionStatePath(sessionName: string, cwd?: string): string;
|
|
7
|
+
declare function ensureLibrettoPauseSignalDir(sessionName: string, cwd?: string): string;
|
|
8
|
+
declare function ensureLibrettoRunnerLogDir(sessionName: string, cwd?: string): string;
|
|
9
|
+
|
|
10
|
+
export { ensureLibrettoPauseSignalDir, ensureLibrettoRunnerLogDir, ensureLibrettoSessionStatePath, getLibrettoPauseSignalDir, getLibrettoPausedSignalPath, getLibrettoResumeSignalPath, getPauseSignalPathForDir, getRunnerLogPathForDir };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function getLibrettoPauseSignalDir(sessionName: string, cwd?: string): string;
|
|
2
|
+
declare function getRunnerLogPathForDir(logDir: string): string;
|
|
3
|
+
declare function getPauseSignalPathForDir(signalDir: string, sessionName: string, signal: "paused" | "resume"): string;
|
|
4
|
+
declare function getLibrettoPausedSignalPath(sessionName: string, cwd?: string): string;
|
|
5
|
+
declare function getLibrettoResumeSignalPath(sessionName: string, cwd?: string): string;
|
|
6
|
+
declare function ensureLibrettoSessionStatePath(sessionName: string, cwd?: string): string;
|
|
7
|
+
declare function ensureLibrettoPauseSignalDir(sessionName: string, cwd?: string): string;
|
|
8
|
+
declare function ensureLibrettoRunnerLogDir(sessionName: string, cwd?: string): string;
|
|
9
|
+
|
|
10
|
+
export { ensureLibrettoPauseSignalDir, ensureLibrettoRunnerLogDir, ensureLibrettoSessionStatePath, getLibrettoPauseSignalDir, getLibrettoPausedSignalPath, getLibrettoResumeSignalPath, getPauseSignalPathForDir, getRunnerLogPathForDir };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { mkdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
const LIBRETTO_DIRNAME = ".libretto";
|
|
4
|
+
const LIBRETTO_SESSIONS_DIRNAME = "sessions";
|
|
5
|
+
const SESSION_STATE_FILENAME = "state.json";
|
|
6
|
+
const RUNNER_LOG_DIRNAME = "logs";
|
|
7
|
+
const RUNNER_LOG_FILENAME = "logs.jsonl";
|
|
8
|
+
const PAUSED_SIGNAL_SUFFIX = "paused";
|
|
9
|
+
const RESUME_SIGNAL_SUFFIX = "resume";
|
|
10
|
+
function getLibrettoRoot(cwd = process.cwd()) {
|
|
11
|
+
return join(cwd, LIBRETTO_DIRNAME);
|
|
12
|
+
}
|
|
13
|
+
function getLibrettoSessionsDir(cwd = process.cwd()) {
|
|
14
|
+
return join(getLibrettoRoot(cwd), LIBRETTO_SESSIONS_DIRNAME);
|
|
15
|
+
}
|
|
16
|
+
function getLibrettoSessionDir(sessionName, cwd = process.cwd()) {
|
|
17
|
+
return join(getLibrettoSessionsDir(cwd), sessionName);
|
|
18
|
+
}
|
|
19
|
+
function getLibrettoSessionStatePath(sessionName, cwd = process.cwd()) {
|
|
20
|
+
return join(getLibrettoSessionDir(sessionName, cwd), SESSION_STATE_FILENAME);
|
|
21
|
+
}
|
|
22
|
+
function getLibrettoPauseSignalDir(sessionName, cwd = process.cwd()) {
|
|
23
|
+
return getLibrettoSessionDir(sessionName, cwd);
|
|
24
|
+
}
|
|
25
|
+
function getLibrettoRunnerLogDir(sessionName, cwd = process.cwd()) {
|
|
26
|
+
return join(getLibrettoSessionDir(sessionName, cwd), RUNNER_LOG_DIRNAME);
|
|
27
|
+
}
|
|
28
|
+
function getRunnerLogPathForDir(logDir) {
|
|
29
|
+
return join(logDir, RUNNER_LOG_FILENAME);
|
|
30
|
+
}
|
|
31
|
+
function getPauseSignalPathForDir(signalDir, sessionName, signal) {
|
|
32
|
+
const suffix = signal === "paused" ? PAUSED_SIGNAL_SUFFIX : RESUME_SIGNAL_SUFFIX;
|
|
33
|
+
return join(signalDir, `${sessionName}.${suffix}`);
|
|
34
|
+
}
|
|
35
|
+
function getLibrettoPausedSignalPath(sessionName, cwd = process.cwd()) {
|
|
36
|
+
return getPauseSignalPathForDir(
|
|
37
|
+
getLibrettoPauseSignalDir(sessionName, cwd),
|
|
38
|
+
sessionName,
|
|
39
|
+
"paused"
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function getLibrettoResumeSignalPath(sessionName, cwd = process.cwd()) {
|
|
43
|
+
return getPauseSignalPathForDir(
|
|
44
|
+
getLibrettoPauseSignalDir(sessionName, cwd),
|
|
45
|
+
sessionName,
|
|
46
|
+
"resume"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function ensureLibrettoSessionStatePath(sessionName, cwd = process.cwd()) {
|
|
50
|
+
const filePath = getLibrettoSessionStatePath(sessionName, cwd);
|
|
51
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
52
|
+
return filePath;
|
|
53
|
+
}
|
|
54
|
+
function ensureLibrettoPauseSignalDir(sessionName, cwd = process.cwd()) {
|
|
55
|
+
const dir = getLibrettoPauseSignalDir(sessionName, cwd);
|
|
56
|
+
mkdirSync(dir, { recursive: true });
|
|
57
|
+
return dir;
|
|
58
|
+
}
|
|
59
|
+
function ensureLibrettoRunnerLogDir(sessionName, cwd = process.cwd()) {
|
|
60
|
+
const dir = getLibrettoRunnerLogDir(sessionName, cwd);
|
|
61
|
+
mkdirSync(dir, { recursive: true });
|
|
62
|
+
return dir;
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
ensureLibrettoPauseSignalDir,
|
|
66
|
+
ensureLibrettoRunnerLogDir,
|
|
67
|
+
ensureLibrettoSessionStatePath,
|
|
68
|
+
getLibrettoPauseSignalDir,
|
|
69
|
+
getLibrettoPausedSignalPath,
|
|
70
|
+
getLibrettoResumeSignalPath,
|
|
71
|
+
getPauseSignalPathForDir,
|
|
72
|
+
getRunnerLogPathForDir
|
|
73
|
+
};
|