libretto 0.2.7 → 0.3.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/LICENSE +21 -0
- package/package.json +21 -15
- package/skill/SKILL.md +20 -18
- package/skill/code-generation-rules.md +3 -3
- package/skill/integration-approach-selection.md +3 -3
- package/dist/cli/cli.js +0 -209
- package/dist/cli/commands/ai.js +0 -21
- package/dist/cli/commands/browser.js +0 -82
- package/dist/cli/commands/execution.js +0 -461
- package/dist/cli/commands/init.js +0 -95
- package/dist/cli/commands/logs.js +0 -93
- package/dist/cli/commands/snapshot.js +0 -106
- package/dist/cli/core/ai-config.js +0 -149
- package/dist/cli/core/browser.js +0 -648
- package/dist/cli/core/context.js +0 -118
- package/dist/cli/core/pause-signals.js +0 -29
- package/dist/cli/core/session-telemetry.js +0 -491
- package/dist/cli/core/session.js +0 -183
- package/dist/cli/core/snapshot-analyzer.js +0 -492
- package/dist/cli/core/telemetry.js +0 -362
- package/dist/cli/index.js +0 -13
- package/dist/cli/workers/run-integration-runtime.js +0 -227
- package/dist/cli/workers/run-integration-worker-protocol.js +0 -12
- package/dist/cli/workers/run-integration-worker.js +0 -66
- package/dist/index.cjs +0 -116
- package/dist/index.d.cts +0 -21
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -97
- package/dist/runtime/download/download.cjs +0 -70
- package/dist/runtime/download/download.d.cts +0 -35
- package/dist/runtime/download/download.d.ts +0 -35
- package/dist/runtime/download/download.js +0 -45
- package/dist/runtime/download/index.cjs +0 -30
- package/dist/runtime/download/index.d.cts +0 -3
- package/dist/runtime/download/index.d.ts +0 -3
- package/dist/runtime/download/index.js +0 -8
- package/dist/runtime/extract/extract.cjs +0 -88
- package/dist/runtime/extract/extract.d.cts +0 -23
- package/dist/runtime/extract/extract.d.ts +0 -23
- package/dist/runtime/extract/extract.js +0 -64
- package/dist/runtime/extract/index.cjs +0 -28
- package/dist/runtime/extract/index.d.cts +0 -5
- package/dist/runtime/extract/index.d.ts +0 -5
- package/dist/runtime/extract/index.js +0 -4
- package/dist/runtime/network/index.cjs +0 -28
- package/dist/runtime/network/index.d.cts +0 -4
- package/dist/runtime/network/index.d.ts +0 -4
- package/dist/runtime/network/index.js +0 -6
- package/dist/runtime/network/network.cjs +0 -91
- package/dist/runtime/network/network.d.cts +0 -28
- package/dist/runtime/network/network.d.ts +0 -28
- package/dist/runtime/network/network.js +0 -67
- package/dist/runtime/recovery/agent.cjs +0 -223
- package/dist/runtime/recovery/agent.d.cts +0 -13
- package/dist/runtime/recovery/agent.d.ts +0 -13
- package/dist/runtime/recovery/agent.js +0 -199
- package/dist/runtime/recovery/errors.cjs +0 -124
- package/dist/runtime/recovery/errors.d.cts +0 -31
- package/dist/runtime/recovery/errors.d.ts +0 -31
- package/dist/runtime/recovery/errors.js +0 -100
- package/dist/runtime/recovery/index.cjs +0 -34
- package/dist/runtime/recovery/index.d.cts +0 -7
- package/dist/runtime/recovery/index.d.ts +0 -7
- package/dist/runtime/recovery/index.js +0 -10
- package/dist/runtime/recovery/recovery.cjs +0 -55
- package/dist/runtime/recovery/recovery.d.cts +0 -12
- package/dist/runtime/recovery/recovery.d.ts +0 -12
- package/dist/runtime/recovery/recovery.js +0 -31
- package/dist/shared/config/config.cjs +0 -44
- package/dist/shared/config/config.d.cts +0 -10
- package/dist/shared/config/config.d.ts +0 -10
- package/dist/shared/config/config.js +0 -18
- package/dist/shared/config/index.cjs +0 -32
- package/dist/shared/config/index.d.cts +0 -1
- package/dist/shared/config/index.d.ts +0 -1
- package/dist/shared/config/index.js +0 -10
- package/dist/shared/debug/index.cjs +0 -30
- package/dist/shared/debug/index.d.cts +0 -1
- package/dist/shared/debug/index.d.ts +0 -1
- package/dist/shared/debug/index.js +0 -5
- package/dist/shared/debug/pause.cjs +0 -90
- package/dist/shared/debug/pause.d.cts +0 -16
- package/dist/shared/debug/pause.d.ts +0 -16
- package/dist/shared/debug/pause.js +0 -55
- package/dist/shared/instrumentation/errors.cjs +0 -81
- package/dist/shared/instrumentation/errors.d.cts +0 -12
- package/dist/shared/instrumentation/errors.d.ts +0 -12
- package/dist/shared/instrumentation/errors.js +0 -57
- package/dist/shared/instrumentation/index.cjs +0 -35
- package/dist/shared/instrumentation/index.d.cts +0 -6
- package/dist/shared/instrumentation/index.d.ts +0 -6
- package/dist/shared/instrumentation/index.js +0 -12
- package/dist/shared/instrumentation/instrument.cjs +0 -206
- package/dist/shared/instrumentation/instrument.d.cts +0 -32
- package/dist/shared/instrumentation/instrument.d.ts +0 -32
- package/dist/shared/instrumentation/instrument.js +0 -190
- package/dist/shared/llm/ai-sdk-adapter.cjs +0 -67
- package/dist/shared/llm/ai-sdk-adapter.d.cts +0 -22
- package/dist/shared/llm/ai-sdk-adapter.d.ts +0 -22
- package/dist/shared/llm/ai-sdk-adapter.js +0 -43
- package/dist/shared/llm/client.cjs +0 -139
- package/dist/shared/llm/client.d.cts +0 -6
- package/dist/shared/llm/client.d.ts +0 -6
- package/dist/shared/llm/client.js +0 -115
- package/dist/shared/llm/index.cjs +0 -31
- package/dist/shared/llm/index.d.cts +0 -5
- package/dist/shared/llm/index.d.ts +0 -5
- package/dist/shared/llm/index.js +0 -6
- package/dist/shared/llm/types.cjs +0 -16
- package/dist/shared/llm/types.d.cts +0 -66
- package/dist/shared/llm/types.d.ts +0 -66
- package/dist/shared/llm/types.js +0 -0
- package/dist/shared/logger/index.cjs +0 -37
- package/dist/shared/logger/index.d.cts +0 -2
- package/dist/shared/logger/index.d.ts +0 -2
- package/dist/shared/logger/index.js +0 -13
- package/dist/shared/logger/logger.cjs +0 -232
- package/dist/shared/logger/logger.d.cts +0 -86
- package/dist/shared/logger/logger.d.ts +0 -86
- package/dist/shared/logger/logger.js +0 -207
- package/dist/shared/logger/sinks.cjs +0 -160
- package/dist/shared/logger/sinks.d.cts +0 -9
- package/dist/shared/logger/sinks.d.ts +0 -9
- package/dist/shared/logger/sinks.js +0 -124
- package/dist/shared/paths/paths.cjs +0 -104
- package/dist/shared/paths/paths.d.cts +0 -10
- package/dist/shared/paths/paths.d.ts +0 -10
- package/dist/shared/paths/paths.js +0 -73
- package/dist/shared/run/api.cjs +0 -28
- package/dist/shared/run/api.d.cts +0 -2
- package/dist/shared/run/api.d.ts +0 -2
- package/dist/shared/run/api.js +0 -4
- package/dist/shared/run/browser.cjs +0 -98
- package/dist/shared/run/browser.d.cts +0 -22
- package/dist/shared/run/browser.d.ts +0 -22
- package/dist/shared/run/browser.js +0 -74
- package/dist/shared/state/index.cjs +0 -38
- package/dist/shared/state/index.d.cts +0 -2
- package/dist/shared/state/index.d.ts +0 -2
- package/dist/shared/state/index.js +0 -16
- package/dist/shared/state/session-state.cjs +0 -85
- package/dist/shared/state/session-state.d.cts +0 -34
- package/dist/shared/state/session-state.d.ts +0 -34
- package/dist/shared/state/session-state.js +0 -56
- package/dist/shared/visualization/ghost-cursor.cjs +0 -174
- package/dist/shared/visualization/ghost-cursor.d.cts +0 -37
- package/dist/shared/visualization/ghost-cursor.d.ts +0 -37
- package/dist/shared/visualization/ghost-cursor.js +0 -145
- package/dist/shared/visualization/highlight.cjs +0 -134
- package/dist/shared/visualization/highlight.d.cts +0 -22
- package/dist/shared/visualization/highlight.d.ts +0 -22
- package/dist/shared/visualization/highlight.js +0 -108
- package/dist/shared/visualization/index.cjs +0 -45
- package/dist/shared/visualization/index.d.cts +0 -3
- package/dist/shared/visualization/index.d.ts +0 -3
- package/dist/shared/visualization/index.js +0 -24
- package/dist/shared/workflow/workflow.cjs +0 -47
- package/dist/shared/workflow/workflow.d.cts +0 -21
- package/dist/shared/workflow/workflow.d.ts +0 -21
- package/dist/shared/workflow/workflow.js +0 -21
|
@@ -1,44 +0,0 @@
|
|
|
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 config_exports = {};
|
|
20
|
-
__export(config_exports, {
|
|
21
|
-
isDebugMode: () => isDebugMode,
|
|
22
|
-
isDryRun: () => isDryRun,
|
|
23
|
-
shouldPauseBeforeMutation: () => shouldPauseBeforeMutation
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(config_exports);
|
|
26
|
-
function isDebugMode() {
|
|
27
|
-
return process.env.LIBRETTO_DEBUG === "true";
|
|
28
|
-
}
|
|
29
|
-
function isDryRun() {
|
|
30
|
-
const explicit = process.env.LIBRETTO_DRY_RUN;
|
|
31
|
-
if (explicit !== void 0) {
|
|
32
|
-
return explicit === "true";
|
|
33
|
-
}
|
|
34
|
-
return process.env.NODE_ENV === "development";
|
|
35
|
-
}
|
|
36
|
-
function shouldPauseBeforeMutation() {
|
|
37
|
-
return isDryRun() && isDebugMode();
|
|
38
|
-
}
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
isDebugMode,
|
|
42
|
-
isDryRun,
|
|
43
|
-
shouldPauseBeforeMutation
|
|
44
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime configuration for libretto.
|
|
3
|
-
*
|
|
4
|
-
* Values are derived from environment variables only.
|
|
5
|
-
*/
|
|
6
|
-
declare function isDebugMode(): boolean;
|
|
7
|
-
declare function isDryRun(): boolean;
|
|
8
|
-
declare function shouldPauseBeforeMutation(): boolean;
|
|
9
|
-
|
|
10
|
-
export { isDebugMode, isDryRun, shouldPauseBeforeMutation };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime configuration for libretto.
|
|
3
|
-
*
|
|
4
|
-
* Values are derived from environment variables only.
|
|
5
|
-
*/
|
|
6
|
-
declare function isDebugMode(): boolean;
|
|
7
|
-
declare function isDryRun(): boolean;
|
|
8
|
-
declare function shouldPauseBeforeMutation(): boolean;
|
|
9
|
-
|
|
10
|
-
export { isDebugMode, isDryRun, shouldPauseBeforeMutation };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function isDebugMode() {
|
|
2
|
-
return process.env.LIBRETTO_DEBUG === "true";
|
|
3
|
-
}
|
|
4
|
-
function isDryRun() {
|
|
5
|
-
const explicit = process.env.LIBRETTO_DRY_RUN;
|
|
6
|
-
if (explicit !== void 0) {
|
|
7
|
-
return explicit === "true";
|
|
8
|
-
}
|
|
9
|
-
return process.env.NODE_ENV === "development";
|
|
10
|
-
}
|
|
11
|
-
function shouldPauseBeforeMutation() {
|
|
12
|
-
return isDryRun() && isDebugMode();
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
isDebugMode,
|
|
16
|
-
isDryRun,
|
|
17
|
-
shouldPauseBeforeMutation
|
|
18
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
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 config_exports = {};
|
|
20
|
-
__export(config_exports, {
|
|
21
|
-
isDebugMode: () => import_config.isDebugMode,
|
|
22
|
-
isDryRun: () => import_config.isDryRun,
|
|
23
|
-
shouldPauseBeforeMutation: () => import_config.shouldPauseBeforeMutation
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(config_exports);
|
|
26
|
-
var import_config = require("./config.js");
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
isDebugMode,
|
|
30
|
-
isDryRun,
|
|
31
|
-
shouldPauseBeforeMutation
|
|
32
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isDebugMode, isDryRun, shouldPauseBeforeMutation } from './config.cjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isDebugMode, isDryRun, shouldPauseBeforeMutation } from './config.js';
|
|
@@ -1,30 +0,0 @@
|
|
|
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 debug_exports = {};
|
|
20
|
-
__export(debug_exports, {
|
|
21
|
-
pause: () => import_pause.pause,
|
|
22
|
-
setSessionForPause: () => import_pause.setSessionForPause
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(debug_exports);
|
|
25
|
-
var import_pause = require("./pause.js");
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
pause,
|
|
29
|
-
setSessionForPause
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { pause, setSessionForPause } from './pause.cjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { pause, setSessionForPause } from './pause.js';
|
|
@@ -1,90 +0,0 @@
|
|
|
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 pause_exports = {};
|
|
30
|
-
__export(pause_exports, {
|
|
31
|
-
pause: () => pause,
|
|
32
|
-
setSessionForPause: () => setSessionForPause
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(pause_exports);
|
|
35
|
-
var import_node_fs = require("node:fs");
|
|
36
|
-
var import_promises = require("node:fs/promises");
|
|
37
|
-
let _sessionName;
|
|
38
|
-
function setSessionForPause(session) {
|
|
39
|
-
_sessionName = session;
|
|
40
|
-
}
|
|
41
|
-
function getSessionFromProcessArgs() {
|
|
42
|
-
const rawPayload = process.argv[2];
|
|
43
|
-
if (!rawPayload) return void 0;
|
|
44
|
-
try {
|
|
45
|
-
const parsed = JSON.parse(rawPayload);
|
|
46
|
-
return typeof parsed.session === "string" ? parsed.session : void 0;
|
|
47
|
-
} catch {
|
|
48
|
-
return void 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function resolveSession() {
|
|
52
|
-
return _sessionName ?? getSessionFromProcessArgs();
|
|
53
|
-
}
|
|
54
|
-
async function pause() {
|
|
55
|
-
if (process.env.NODE_ENV === "production") {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const session = resolveSession();
|
|
59
|
-
if (!session) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const { getPauseSignalPaths, removeSignalIfExists } = await import("../../cli/core/pause-signals.js");
|
|
63
|
-
const { getSessionDir } = await import("../../cli/core/context.js");
|
|
64
|
-
const signalPaths = getPauseSignalPaths(session);
|
|
65
|
-
const { pausedSignalPath, resumeSignalPath } = signalPaths;
|
|
66
|
-
await (0, import_promises.mkdir)(getSessionDir(session), { recursive: true });
|
|
67
|
-
await removeSignalIfExists(resumeSignalPath);
|
|
68
|
-
const details = {
|
|
69
|
-
sessionName: session,
|
|
70
|
-
pausedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
71
|
-
url: "unknown"
|
|
72
|
-
};
|
|
73
|
-
await (0, import_promises.writeFile)(pausedSignalPath, JSON.stringify(details, null, 2), "utf8");
|
|
74
|
-
console.log(`[pause] Paused (session: ${session})`);
|
|
75
|
-
console.log("[pause] Waiting for resume signal...");
|
|
76
|
-
const RESUME_POLL_INTERVAL_MS = 250;
|
|
77
|
-
while (!(0, import_node_fs.existsSync)(resumeSignalPath)) {
|
|
78
|
-
await new Promise(
|
|
79
|
-
(resolve) => setTimeout(resolve, RESUME_POLL_INTERVAL_MS)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
await removeSignalIfExists(resumeSignalPath);
|
|
83
|
-
await removeSignalIfExists(pausedSignalPath);
|
|
84
|
-
console.log("[pause] Resume signal received. Continuing workflow...");
|
|
85
|
-
}
|
|
86
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
-
0 && (module.exports = {
|
|
88
|
-
pause,
|
|
89
|
-
setSessionForPause
|
|
90
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Called by the CLI runtime to make the session name available to `pause()`.
|
|
3
|
-
*/
|
|
4
|
-
declare function setSessionForPause(session: string): void;
|
|
5
|
-
/**
|
|
6
|
-
* Standalone pause function.
|
|
7
|
-
*
|
|
8
|
-
* - In production (`NODE_ENV === "production"`), returns immediately (no-op).
|
|
9
|
-
* - Otherwise, writes a `.paused` signal file and polls for a `.resume` signal,
|
|
10
|
-
* using the same file-based mechanism as the CLI runner.
|
|
11
|
-
*
|
|
12
|
-
* Import directly: `import { pause } from "libretto";`
|
|
13
|
-
*/
|
|
14
|
-
declare function pause(): Promise<void>;
|
|
15
|
-
|
|
16
|
-
export { pause, setSessionForPause };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Called by the CLI runtime to make the session name available to `pause()`.
|
|
3
|
-
*/
|
|
4
|
-
declare function setSessionForPause(session: string): void;
|
|
5
|
-
/**
|
|
6
|
-
* Standalone pause function.
|
|
7
|
-
*
|
|
8
|
-
* - In production (`NODE_ENV === "production"`), returns immediately (no-op).
|
|
9
|
-
* - Otherwise, writes a `.paused` signal file and polls for a `.resume` signal,
|
|
10
|
-
* using the same file-based mechanism as the CLI runner.
|
|
11
|
-
*
|
|
12
|
-
* Import directly: `import { pause } from "libretto";`
|
|
13
|
-
*/
|
|
14
|
-
declare function pause(): Promise<void>;
|
|
15
|
-
|
|
16
|
-
export { pause, setSessionForPause };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
|
-
let _sessionName;
|
|
4
|
-
function setSessionForPause(session) {
|
|
5
|
-
_sessionName = session;
|
|
6
|
-
}
|
|
7
|
-
function getSessionFromProcessArgs() {
|
|
8
|
-
const rawPayload = process.argv[2];
|
|
9
|
-
if (!rawPayload) return void 0;
|
|
10
|
-
try {
|
|
11
|
-
const parsed = JSON.parse(rawPayload);
|
|
12
|
-
return typeof parsed.session === "string" ? parsed.session : void 0;
|
|
13
|
-
} catch {
|
|
14
|
-
return void 0;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function resolveSession() {
|
|
18
|
-
return _sessionName ?? getSessionFromProcessArgs();
|
|
19
|
-
}
|
|
20
|
-
async function pause() {
|
|
21
|
-
if (process.env.NODE_ENV === "production") {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const session = resolveSession();
|
|
25
|
-
if (!session) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const { getPauseSignalPaths, removeSignalIfExists } = await import("../../cli/core/pause-signals.js");
|
|
29
|
-
const { getSessionDir } = await import("../../cli/core/context.js");
|
|
30
|
-
const signalPaths = getPauseSignalPaths(session);
|
|
31
|
-
const { pausedSignalPath, resumeSignalPath } = signalPaths;
|
|
32
|
-
await mkdir(getSessionDir(session), { recursive: true });
|
|
33
|
-
await removeSignalIfExists(resumeSignalPath);
|
|
34
|
-
const details = {
|
|
35
|
-
sessionName: session,
|
|
36
|
-
pausedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
37
|
-
url: "unknown"
|
|
38
|
-
};
|
|
39
|
-
await writeFile(pausedSignalPath, JSON.stringify(details, null, 2), "utf8");
|
|
40
|
-
console.log(`[pause] Paused (session: ${session})`);
|
|
41
|
-
console.log("[pause] Waiting for resume signal...");
|
|
42
|
-
const RESUME_POLL_INTERVAL_MS = 250;
|
|
43
|
-
while (!existsSync(resumeSignalPath)) {
|
|
44
|
-
await new Promise(
|
|
45
|
-
(resolve) => setTimeout(resolve, RESUME_POLL_INTERVAL_MS)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
await removeSignalIfExists(resumeSignalPath);
|
|
49
|
-
await removeSignalIfExists(pausedSignalPath);
|
|
50
|
-
console.log("[pause] Resume signal received. Continuing workflow...");
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
pause,
|
|
54
|
-
setSessionForPause
|
|
55
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
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 errors_exports = {};
|
|
20
|
-
__export(errors_exports, {
|
|
21
|
-
enrichTimeoutError: () => enrichTimeoutError
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(errors_exports);
|
|
24
|
-
async function enrichTimeoutError(err, locator, page) {
|
|
25
|
-
const reasons = [];
|
|
26
|
-
try {
|
|
27
|
-
const visible = await locator.isVisible().catch(() => null);
|
|
28
|
-
if (visible === false) {
|
|
29
|
-
reasons.push("Element is not visible");
|
|
30
|
-
}
|
|
31
|
-
if (typeof locator.isInViewport === "function") {
|
|
32
|
-
const inViewport = await locator.isInViewport().catch(() => null);
|
|
33
|
-
if (inViewport === false) {
|
|
34
|
-
reasons.push("Element is outside of the viewport");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const enabled = await locator.isEnabled().catch(() => null);
|
|
38
|
-
if (enabled === false) {
|
|
39
|
-
reasons.push("Element is not enabled (disabled)");
|
|
40
|
-
}
|
|
41
|
-
if (reasons.length === 0) {
|
|
42
|
-
const box = await locator.boundingBox().catch(() => null);
|
|
43
|
-
if (box) {
|
|
44
|
-
const centerX = box.x + box.width / 2;
|
|
45
|
-
const centerY = box.y + box.height / 2;
|
|
46
|
-
const interceptInfo = await page.evaluate(
|
|
47
|
-
({ x, y }) => {
|
|
48
|
-
const els = document.elementsFromPoint(x, y);
|
|
49
|
-
if (!els || els.length < 2) return null;
|
|
50
|
-
const topEl = els[0];
|
|
51
|
-
if (!topEl) return null;
|
|
52
|
-
const tag = topEl.tagName.toLowerCase();
|
|
53
|
-
const id = topEl.id ? `#${topEl.id}` : "";
|
|
54
|
-
const cls = topEl.className ? `.${String(topEl.className).split(/\s+/).slice(0, 2).join(".")}` : "";
|
|
55
|
-
const text = (topEl.textContent || "").trim().slice(0, 40);
|
|
56
|
-
return {
|
|
57
|
-
tag,
|
|
58
|
-
preview: `<${tag}${id}${cls}>${text ? ` "${text}"` : ""}`
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
{ x: centerX, y: centerY }
|
|
62
|
-
).catch(() => null);
|
|
63
|
-
if (interceptInfo) {
|
|
64
|
-
reasons.push(
|
|
65
|
-
`Element may be intercepted by ${interceptInfo.preview}`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} catch {
|
|
71
|
-
}
|
|
72
|
-
if (reasons.length > 0) {
|
|
73
|
-
const enrichment = `
|
|
74
|
-
[libretto diagnostics] ${reasons.join("; ")}`;
|
|
75
|
-
err.message = (err.message || "") + enrichment;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
-
0 && (module.exports = {
|
|
80
|
-
enrichTimeoutError
|
|
81
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Locator, Page } from 'playwright';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Enrich a timeout error from a pointer action (click/dblclick/hover) with
|
|
5
|
-
* diagnostic information about why the action may have failed.
|
|
6
|
-
*
|
|
7
|
-
* Mutates err.message in-place to append the enrichment.
|
|
8
|
-
* Best-effort: if any probe fails, we skip that check silently.
|
|
9
|
-
*/
|
|
10
|
-
declare function enrichTimeoutError(err: any, locator: Locator, page: Page): Promise<void>;
|
|
11
|
-
|
|
12
|
-
export { enrichTimeoutError };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Locator, Page } from 'playwright';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Enrich a timeout error from a pointer action (click/dblclick/hover) with
|
|
5
|
-
* diagnostic information about why the action may have failed.
|
|
6
|
-
*
|
|
7
|
-
* Mutates err.message in-place to append the enrichment.
|
|
8
|
-
* Best-effort: if any probe fails, we skip that check silently.
|
|
9
|
-
*/
|
|
10
|
-
declare function enrichTimeoutError(err: any, locator: Locator, page: Page): Promise<void>;
|
|
11
|
-
|
|
12
|
-
export { enrichTimeoutError };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
async function enrichTimeoutError(err, locator, page) {
|
|
2
|
-
const reasons = [];
|
|
3
|
-
try {
|
|
4
|
-
const visible = await locator.isVisible().catch(() => null);
|
|
5
|
-
if (visible === false) {
|
|
6
|
-
reasons.push("Element is not visible");
|
|
7
|
-
}
|
|
8
|
-
if (typeof locator.isInViewport === "function") {
|
|
9
|
-
const inViewport = await locator.isInViewport().catch(() => null);
|
|
10
|
-
if (inViewport === false) {
|
|
11
|
-
reasons.push("Element is outside of the viewport");
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const enabled = await locator.isEnabled().catch(() => null);
|
|
15
|
-
if (enabled === false) {
|
|
16
|
-
reasons.push("Element is not enabled (disabled)");
|
|
17
|
-
}
|
|
18
|
-
if (reasons.length === 0) {
|
|
19
|
-
const box = await locator.boundingBox().catch(() => null);
|
|
20
|
-
if (box) {
|
|
21
|
-
const centerX = box.x + box.width / 2;
|
|
22
|
-
const centerY = box.y + box.height / 2;
|
|
23
|
-
const interceptInfo = await page.evaluate(
|
|
24
|
-
({ x, y }) => {
|
|
25
|
-
const els = document.elementsFromPoint(x, y);
|
|
26
|
-
if (!els || els.length < 2) return null;
|
|
27
|
-
const topEl = els[0];
|
|
28
|
-
if (!topEl) return null;
|
|
29
|
-
const tag = topEl.tagName.toLowerCase();
|
|
30
|
-
const id = topEl.id ? `#${topEl.id}` : "";
|
|
31
|
-
const cls = topEl.className ? `.${String(topEl.className).split(/\s+/).slice(0, 2).join(".")}` : "";
|
|
32
|
-
const text = (topEl.textContent || "").trim().slice(0, 40);
|
|
33
|
-
return {
|
|
34
|
-
tag,
|
|
35
|
-
preview: `<${tag}${id}${cls}>${text ? ` "${text}"` : ""}`
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
{ x: centerX, y: centerY }
|
|
39
|
-
).catch(() => null);
|
|
40
|
-
if (interceptInfo) {
|
|
41
|
-
reasons.push(
|
|
42
|
-
`Element may be intercepted by ${interceptInfo.preview}`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
} catch {
|
|
48
|
-
}
|
|
49
|
-
if (reasons.length > 0) {
|
|
50
|
-
const enrichment = `
|
|
51
|
-
[libretto diagnostics] ${reasons.join("; ")}`;
|
|
52
|
-
err.message = (err.message || "") + enrichment;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
enrichTimeoutError
|
|
57
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
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 instrumentation_exports = {};
|
|
20
|
-
__export(instrumentation_exports, {
|
|
21
|
-
enrichTimeoutError: () => import_errors.enrichTimeoutError,
|
|
22
|
-
installInstrumentation: () => import_instrument.installInstrumentation,
|
|
23
|
-
instrumentContext: () => import_instrument.instrumentContext,
|
|
24
|
-
instrumentPage: () => import_instrument.instrumentPage
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(instrumentation_exports);
|
|
27
|
-
var import_instrument = require("./instrument.js");
|
|
28
|
-
var import_errors = require("./errors.js");
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
enrichTimeoutError,
|
|
32
|
-
installInstrumentation,
|
|
33
|
-
instrumentContext,
|
|
34
|
-
instrumentPage
|
|
35
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { InstrumentationOptions, InstrumentedPage, installInstrumentation, instrumentContext, instrumentPage } from './instrument.cjs';
|
|
2
|
-
export { enrichTimeoutError } from './errors.cjs';
|
|
3
|
-
import 'playwright';
|
|
4
|
-
import '../logger/logger.cjs';
|
|
5
|
-
import '../visualization/ghost-cursor.cjs';
|
|
6
|
-
import '../visualization/highlight.cjs';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { InstrumentationOptions, InstrumentedPage, installInstrumentation, instrumentContext, instrumentPage } from './instrument.js';
|
|
2
|
-
export { enrichTimeoutError } from './errors.js';
|
|
3
|
-
import 'playwright';
|
|
4
|
-
import '../logger/logger.js';
|
|
5
|
-
import '../visualization/ghost-cursor.js';
|
|
6
|
-
import '../visualization/highlight.js';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
instrumentPage,
|
|
3
|
-
installInstrumentation,
|
|
4
|
-
instrumentContext
|
|
5
|
-
} from "./instrument.js";
|
|
6
|
-
import { enrichTimeoutError } from "./errors.js";
|
|
7
|
-
export {
|
|
8
|
-
enrichTimeoutError,
|
|
9
|
-
installInstrumentation,
|
|
10
|
-
instrumentContext,
|
|
11
|
-
instrumentPage
|
|
12
|
-
};
|