libretto 0.3.0 → 0.3.2
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 +51 -125
- package/dist/cli/cli.js +298 -0
- package/dist/cli/commands/ai.js +21 -0
- package/dist/cli/commands/browser.js +103 -0
- package/dist/cli/commands/execution.js +490 -0
- package/dist/cli/commands/init.js +166 -0
- package/dist/cli/commands/logs.js +93 -0
- package/dist/cli/commands/snapshot.js +217 -0
- package/dist/cli/core/ai-config.js +156 -0
- package/dist/cli/core/browser.js +669 -0
- package/dist/cli/core/context.js +117 -0
- package/dist/cli/core/pause-signals.js +29 -0
- package/dist/cli/core/session-telemetry.js +491 -0
- package/dist/cli/core/session.js +183 -0
- package/dist/cli/core/snapshot-analyzer.js +570 -0
- package/dist/cli/core/telemetry.js +362 -0
- package/dist/cli/index.js +14 -0
- package/dist/cli/workers/run-integration-runtime.js +234 -0
- package/dist/cli/workers/run-integration-worker-protocol.js +12 -0
- package/dist/cli/workers/run-integration-worker.js +67 -0
- package/dist/index.cjs +144 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +114 -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 +88 -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 +64 -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 +223 -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 +199 -0
- package/dist/runtime/recovery/errors.cjs +124 -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 +100 -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 +55 -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 +31 -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 +30 -0
- package/dist/shared/debug/index.d.cts +1 -0
- package/dist/shared/debug/index.d.ts +1 -0
- package/dist/shared/debug/index.js +5 -0
- package/dist/shared/debug/pause.cjs +90 -0
- package/dist/shared/debug/pause.d.cts +16 -0
- package/dist/shared/debug/pause.d.ts +16 -0
- package/dist/shared/debug/pause.js +55 -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/ai-sdk-adapter.cjs +67 -0
- package/dist/shared/llm/ai-sdk-adapter.d.cts +22 -0
- package/dist/shared/llm/ai-sdk-adapter.d.ts +22 -0
- package/dist/shared/llm/ai-sdk-adapter.js +43 -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 +31 -0
- package/dist/shared/llm/index.d.cts +5 -0
- package/dist/shared/llm/index.d.ts +5 -0
- package/dist/shared/llm/index.js +6 -0
- package/dist/shared/llm/types.cjs +16 -0
- package/dist/shared/llm/types.d.cts +66 -0
- package/dist/shared/llm/types.d.ts +66 -0
- package/dist/shared/llm/types.js +0 -0
- package/dist/shared/logger/index.cjs +37 -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 +13 -0
- package/dist/shared/logger/logger.cjs +232 -0
- package/dist/shared/logger/logger.d.cts +86 -0
- package/dist/shared/logger/logger.d.ts +86 -0
- package/dist/shared/logger/logger.js +207 -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 +28 -0
- package/dist/shared/run/api.d.cts +2 -0
- package/dist/shared/run/api.d.ts +2 -0
- package/dist/shared/run/api.js +4 -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 +92 -0
- package/dist/shared/state/session-state.d.cts +40 -0
- package/dist/shared/state/session-state.d.ts +40 -0
- package/dist/shared/state/session-state.js +62 -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 +21 -0
- package/dist/shared/workflow/workflow.d.ts +21 -0
- package/dist/shared/workflow/workflow.js +21 -0
- package/package.json +37 -95
- package/bin/libretto.mjs +0 -18
- package/scripts/postinstall.mjs +0 -48
- /package/{skill → .agents/skills/libretto}/SKILL.md +0 -0
- /package/{skill → .agents/skills/libretto}/code-generation-rules.md +0 -0
- /package/{skill → .agents/skills/libretto}/integration-approach-selection.md +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libretto",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "AI-powered browser automation library and CLI built on Playwright",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,91 +8,42 @@
|
|
|
8
8
|
"url": "https://github.com/saffron-health/libretto"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
+
"packageManager": "pnpm@9.15.4",
|
|
11
12
|
"publishConfig": {
|
|
12
13
|
"access": "public"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"dist",
|
|
16
|
-
"
|
|
17
|
-
"scripts",
|
|
18
|
-
"skill"
|
|
17
|
+
".agents/skills/libretto"
|
|
19
18
|
],
|
|
20
19
|
"bin": {
|
|
21
|
-
"libretto": "./
|
|
22
|
-
"libretto-cli": "./
|
|
20
|
+
"libretto": "./dist/cli/index.js",
|
|
21
|
+
"libretto-cli": "./dist/cli/index.js"
|
|
23
22
|
},
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
26
25
|
"types": "./dist/index.d.ts",
|
|
27
26
|
"import": "./dist/index.js",
|
|
28
27
|
"require": "./dist/index.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./logger": {
|
|
31
|
-
"types": "./dist/shared/logger/index.d.ts",
|
|
32
|
-
"import": "./dist/shared/logger/index.js",
|
|
33
|
-
"require": "./dist/shared/logger/index.cjs"
|
|
34
|
-
},
|
|
35
|
-
"./recovery": {
|
|
36
|
-
"types": "./dist/runtime/recovery/index.d.ts",
|
|
37
|
-
"import": "./dist/runtime/recovery/index.js",
|
|
38
|
-
"require": "./dist/runtime/recovery/index.cjs"
|
|
39
|
-
},
|
|
40
|
-
"./extract": {
|
|
41
|
-
"types": "./dist/runtime/extract/index.d.ts",
|
|
42
|
-
"import": "./dist/runtime/extract/index.js",
|
|
43
|
-
"require": "./dist/runtime/extract/index.cjs"
|
|
44
|
-
},
|
|
45
|
-
"./network": {
|
|
46
|
-
"types": "./dist/runtime/network/index.d.ts",
|
|
47
|
-
"import": "./dist/runtime/network/index.js",
|
|
48
|
-
"require": "./dist/runtime/network/index.cjs"
|
|
49
|
-
},
|
|
50
|
-
"./download": {
|
|
51
|
-
"types": "./dist/runtime/download/index.d.ts",
|
|
52
|
-
"import": "./dist/runtime/download/index.js",
|
|
53
|
-
"require": "./dist/runtime/download/index.cjs"
|
|
54
|
-
},
|
|
55
|
-
"./debug": {
|
|
56
|
-
"types": "./dist/shared/debug/index.d.ts",
|
|
57
|
-
"import": "./dist/shared/debug/index.js",
|
|
58
|
-
"require": "./dist/shared/debug/index.cjs"
|
|
59
|
-
},
|
|
60
|
-
"./config": {
|
|
61
|
-
"types": "./dist/shared/config/index.d.ts",
|
|
62
|
-
"import": "./dist/shared/config/index.js",
|
|
63
|
-
"require": "./dist/shared/config/index.cjs"
|
|
64
|
-
},
|
|
65
|
-
"./instrumentation": {
|
|
66
|
-
"types": "./dist/shared/instrumentation/index.d.ts",
|
|
67
|
-
"import": "./dist/shared/instrumentation/index.js",
|
|
68
|
-
"require": "./dist/shared/instrumentation/index.cjs"
|
|
69
|
-
},
|
|
70
|
-
"./visualization": {
|
|
71
|
-
"types": "./dist/shared/visualization/index.d.ts",
|
|
72
|
-
"import": "./dist/shared/visualization/index.js",
|
|
73
|
-
"require": "./dist/shared/visualization/index.cjs"
|
|
74
|
-
},
|
|
75
|
-
"./llm": {
|
|
76
|
-
"types": "./dist/shared/llm/index.d.ts",
|
|
77
|
-
"import": "./dist/shared/llm/index.js",
|
|
78
|
-
"require": "./dist/shared/llm/index.cjs"
|
|
79
|
-
},
|
|
80
|
-
"./state": {
|
|
81
|
-
"types": "./dist/shared/state/index.d.ts",
|
|
82
|
-
"import": "./dist/shared/state/index.js",
|
|
83
|
-
"require": "./dist/shared/state/index.cjs"
|
|
84
|
-
},
|
|
85
|
-
"./run": {
|
|
86
|
-
"types": "./dist/shared/run/api.d.ts",
|
|
87
|
-
"import": "./dist/shared/run/api.js",
|
|
88
|
-
"require": "./dist/shared/run/api.cjs"
|
|
89
28
|
}
|
|
90
29
|
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"postinstall": "playwright install chromium",
|
|
32
|
+
"build": "pnpm run build:runtime && pnpm run build:cli",
|
|
33
|
+
"build:runtime": "tsup --config tsup.config.ts",
|
|
34
|
+
"build:cli": "tsup --config tsup.cli.config.ts",
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
36
|
+
"test": "pnpm run build && vitest run",
|
|
37
|
+
"eval": "pnpm run build && vitest run --config vitest.evals.config.ts",
|
|
38
|
+
"benchmark": "pnpm run build && tsx benchmarks/run.ts",
|
|
39
|
+
"test:watch": "vitest",
|
|
40
|
+
"cli": "node dist/index.js",
|
|
41
|
+
"prepack": "pnpm run build"
|
|
42
|
+
},
|
|
91
43
|
"peerDependencies": {
|
|
92
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
93
|
-
"@ai-sdk/google-vertex": "^4.0.
|
|
94
|
-
"@ai-sdk/openai": "^3.0.
|
|
95
|
-
"zod": ">=3.0.0"
|
|
44
|
+
"@ai-sdk/anthropic": "^3.0.58",
|
|
45
|
+
"@ai-sdk/google-vertex": "^4.0.80",
|
|
46
|
+
"@ai-sdk/openai": "^3.0.41"
|
|
96
47
|
},
|
|
97
48
|
"peerDependenciesMeta": {
|
|
98
49
|
"@ai-sdk/anthropic": {
|
|
@@ -106,31 +57,22 @@
|
|
|
106
57
|
}
|
|
107
58
|
},
|
|
108
59
|
"devDependencies": {
|
|
109
|
-
"@ai-sdk
|
|
110
|
-
"@ai-sdk/
|
|
111
|
-
"@ai-sdk/
|
|
112
|
-
"@
|
|
113
|
-
"@types/
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"typescript": "^5.
|
|
118
|
-
"vitest": "^4.0
|
|
119
|
-
"zod": "^3.25.0"
|
|
60
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.75",
|
|
61
|
+
"@ai-sdk/anthropic": "^3.0.58",
|
|
62
|
+
"@ai-sdk/google-vertex": "^4.0.80",
|
|
63
|
+
"@ai-sdk/openai": "^3.0.41",
|
|
64
|
+
"@types/node": "^25.5.0",
|
|
65
|
+
"@types/yargs": "^17.0.35",
|
|
66
|
+
"openai": "^6.29.0",
|
|
67
|
+
"tsup": "^8.5.1",
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"vitest": "^4.1.0"
|
|
120
70
|
},
|
|
121
71
|
"dependencies": {
|
|
122
|
-
"ai": "^6.0.
|
|
123
|
-
"playwright": "^1.
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
"postinstall": "node ./scripts/postinstall.mjs; npx playwright install chromium",
|
|
128
|
-
"build": "pnpm run build:runtime && pnpm run build:cli",
|
|
129
|
-
"build:runtime": "tsup --config tsup.config.ts",
|
|
130
|
-
"build:cli": "tsup --config tsup.cli.config.ts",
|
|
131
|
-
"type-check": "tsc --noEmit",
|
|
132
|
-
"dev": "tsx src/cli/index.ts",
|
|
133
|
-
"test": "pnpm run build && vitest run",
|
|
134
|
-
"test:watch": "vitest"
|
|
72
|
+
"ai": "^6.0.116",
|
|
73
|
+
"playwright": "^1.58.2",
|
|
74
|
+
"tsx": "^4.21.0",
|
|
75
|
+
"yargs": "^18.0.0",
|
|
76
|
+
"zod": "^4.3.6"
|
|
135
77
|
}
|
|
136
|
-
}
|
|
78
|
+
}
|
package/bin/libretto.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { execSync } from "node:child_process";
|
|
6
|
-
|
|
7
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const cliRoot = join(__dirname, "..");
|
|
9
|
-
const distEntry = join(cliRoot, "dist", "cli", "index.js");
|
|
10
|
-
|
|
11
|
-
if (!existsSync(distEntry)) {
|
|
12
|
-
// Build from the libretto monorepo root (builds core then CLI in order)
|
|
13
|
-
const monorepoRoot = join(cliRoot, "..", "..");
|
|
14
|
-
console.error("[libretto] dist not found, building...");
|
|
15
|
-
execSync("pnpm build", { cwd: monorepoRoot, stdio: "inherit" });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
await import(distEntry);
|
package/scripts/postinstall.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { cpSync, existsSync, lstatSync, mkdirSync } from "node:fs";
|
|
2
|
-
import { dirname, join, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
function isDirectory(path) {
|
|
6
|
-
if (!existsSync(path)) return false;
|
|
7
|
-
return lstatSync(path).isDirectory();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function log(message) {
|
|
11
|
-
console.log(`[libretto postinstall] ${message}`);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function main() {
|
|
15
|
-
const packageDir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
16
|
-
const initCwd = process.env.INIT_CWD ? resolve(process.env.INIT_CWD) : null;
|
|
17
|
-
const installRoot = initCwd ?? process.cwd();
|
|
18
|
-
|
|
19
|
-
const sourceSkillDir = join(packageDir, "skill");
|
|
20
|
-
if (!isDirectory(sourceSkillDir)) {
|
|
21
|
-
log(`Skipped: source skill directory not found at "${sourceSkillDir}".`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const targets = [
|
|
26
|
-
join(installRoot, ".agents", "skills"),
|
|
27
|
-
join(installRoot, ".claude", "skills"),
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
for (const skillsRoot of targets) {
|
|
31
|
-
if (!isDirectory(skillsRoot)) {
|
|
32
|
-
log(`Skipped: "${skillsRoot}" does not exist.`);
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const destinationSkillDir = join(skillsRoot, "libretto");
|
|
37
|
-
mkdirSync(destinationSkillDir, { recursive: true });
|
|
38
|
-
cpSync(sourceSkillDir, destinationSkillDir, { recursive: true, force: true });
|
|
39
|
-
log(`Synced skill "libretto" to "${skillsRoot}/libretto".`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
main();
|
|
45
|
-
} catch (error) {
|
|
46
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
-
console.warn(`[libretto postinstall] Warning: ${message}`);
|
|
48
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|