libretto 0.6.11 → 0.6.12
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 +4 -0
- package/README.template.md +4 -0
- package/dist/cli/cli.js +4 -3
- package/dist/cli/commands/ai.js +3 -2
- package/dist/cli/commands/browser.js +17 -17
- package/dist/cli/commands/execution.js +254 -234
- package/dist/cli/commands/experiments.js +100 -0
- package/dist/cli/commands/setup.js +20 -34
- package/dist/cli/commands/shared.js +10 -0
- package/dist/cli/commands/snapshot.js +81 -9
- package/dist/cli/commands/status.js +5 -4
- package/dist/cli/core/ai-model.js +6 -3
- package/dist/cli/core/browser.js +300 -121
- package/dist/cli/core/config.js +4 -2
- package/dist/cli/core/context.js +4 -0
- package/dist/cli/core/daemon/config.js +0 -6
- package/dist/cli/core/daemon/daemon.js +535 -89
- package/dist/cli/core/daemon/ipc.js +170 -129
- package/dist/cli/core/daemon/snapshot.js +72 -6
- package/dist/cli/core/experiments.js +66 -0
- package/dist/cli/core/session.js +5 -4
- package/dist/cli/core/skill-version.js +2 -1
- package/dist/cli/core/snapshot-analyzer.js +4 -3
- package/dist/cli/core/workflow-runner/runner.js +147 -0
- package/dist/cli/core/workflow-runtime.js +60 -0
- package/dist/cli/router.js +4 -1
- package/dist/shared/debug/pause-handler.d.ts +9 -0
- package/dist/shared/debug/pause-handler.js +15 -0
- package/dist/shared/debug/pause.d.ts +1 -2
- package/dist/shared/debug/pause.js +13 -36
- package/dist/shared/ipc/child-process-transport.d.ts +7 -0
- package/dist/shared/ipc/child-process-transport.js +60 -0
- package/dist/shared/ipc/child-process-transport.spec.d.ts +2 -0
- package/dist/shared/ipc/child-process-transport.spec.js +68 -0
- package/dist/shared/ipc/ipc.d.ts +46 -0
- package/dist/shared/ipc/ipc.js +165 -0
- package/dist/shared/ipc/ipc.spec.d.ts +2 -0
- package/dist/shared/ipc/ipc.spec.js +114 -0
- package/dist/shared/ipc/socket-transport.d.ts +9 -0
- package/dist/shared/ipc/socket-transport.js +143 -0
- package/dist/shared/ipc/socket-transport.spec.d.ts +2 -0
- package/dist/shared/ipc/socket-transport.spec.js +117 -0
- package/dist/shared/package-manager.d.ts +7 -0
- package/dist/shared/package-manager.js +60 -0
- package/dist/shared/paths/paths.d.ts +1 -8
- package/dist/shared/paths/paths.js +1 -49
- package/dist/shared/snapshot/capture-snapshot.d.ts +9 -0
- package/dist/shared/snapshot/capture-snapshot.js +463 -0
- package/dist/shared/snapshot/diff-snapshots.d.ts +72 -0
- package/dist/shared/snapshot/diff-snapshots.js +358 -0
- package/dist/shared/snapshot/render-snapshot.d.ts +39 -0
- package/dist/shared/snapshot/render-snapshot.js +651 -0
- package/dist/shared/snapshot/snapshot.spec.d.ts +2 -0
- package/dist/shared/snapshot/snapshot.spec.js +333 -0
- package/dist/shared/snapshot/types.d.ts +40 -0
- package/dist/shared/snapshot/types.js +0 -0
- package/dist/shared/snapshot/wait-for-page-stable.d.ts +17 -0
- package/dist/shared/snapshot/wait-for-page-stable.js +281 -0
- package/dist/shared/state/session-state.d.ts +1 -0
- package/dist/shared/state/session-state.js +1 -0
- package/docs/experiments.md +67 -0
- package/package.json +4 -2
- package/skills/libretto/SKILL.md +3 -1
- package/skills/libretto-readonly/SKILL.md +1 -1
- package/src/cli/AGENTS.md +7 -0
- package/src/cli/cli.ts +4 -3
- package/src/cli/commands/ai.ts +3 -2
- package/src/cli/commands/browser.ts +13 -11
- package/src/cli/commands/execution.ts +303 -271
- package/src/cli/commands/experiments.ts +120 -0
- package/src/cli/commands/setup.ts +18 -36
- package/src/cli/commands/shared.ts +20 -0
- package/src/cli/commands/snapshot.ts +99 -11
- package/src/cli/commands/status.ts +5 -4
- package/src/cli/core/ai-model.ts +6 -3
- package/src/cli/core/browser.ts +369 -147
- package/src/cli/core/config.ts +3 -1
- package/src/cli/core/context.ts +4 -0
- package/src/cli/core/daemon/config.ts +35 -19
- package/src/cli/core/daemon/daemon.ts +686 -106
- package/src/cli/core/daemon/ipc.ts +330 -214
- package/src/cli/core/daemon/snapshot.ts +106 -8
- package/src/cli/core/experiments.ts +85 -0
- package/src/cli/core/session.ts +5 -4
- package/src/cli/core/skill-version.ts +2 -1
- package/src/cli/core/snapshot-analyzer.ts +4 -3
- package/src/cli/core/workflow-runner/runner.ts +237 -0
- package/src/cli/core/workflow-runtime.ts +85 -0
- package/src/cli/router.ts +4 -1
- package/src/shared/debug/pause-handler.ts +20 -0
- package/src/shared/debug/pause.ts +14 -48
- package/src/shared/ipc/AGENTS.md +24 -0
- package/src/shared/ipc/child-process-transport.spec.ts +86 -0
- package/src/shared/ipc/child-process-transport.ts +96 -0
- package/src/shared/ipc/ipc.spec.ts +161 -0
- package/src/shared/ipc/ipc.ts +288 -0
- package/src/shared/ipc/socket-transport.spec.ts +141 -0
- package/src/shared/ipc/socket-transport.ts +189 -0
- package/src/shared/package-manager.ts +76 -0
- package/src/shared/paths/paths.ts +0 -72
- package/src/shared/snapshot/capture-snapshot.ts +615 -0
- package/src/shared/snapshot/diff-snapshots.ts +579 -0
- package/src/shared/snapshot/render-snapshot.ts +962 -0
- package/src/shared/snapshot/snapshot.spec.ts +388 -0
- package/src/shared/snapshot/types.ts +43 -0
- package/src/shared/snapshot/wait-for-page-stable.ts +425 -0
- package/src/shared/state/session-state.ts +1 -0
- package/dist/cli/core/daemon/index.js +0 -16
- package/dist/cli/core/daemon/spawn.js +0 -90
- package/dist/cli/core/pause-signals.js +0 -29
- package/dist/cli/workers/run-integration-runtime.js +0 -235
- package/dist/cli/workers/run-integration-worker-protocol.js +0 -17
- package/dist/cli/workers/run-integration-worker.js +0 -64
- package/src/cli/core/daemon/index.ts +0 -24
- package/src/cli/core/daemon/spawn.ts +0 -171
- package/src/cli/core/pause-signals.ts +0 -35
- package/src/cli/workers/run-integration-runtime.ts +0 -326
- package/src/cli/workers/run-integration-worker-protocol.ts +0 -19
- package/src/cli/workers/run-integration-worker.ts +0 -72
package/src/cli/core/config.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname } from "node:path";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { SessionAccessModeSchema } from "../../shared/state/index.js";
|
|
5
5
|
import { LIBRETTO_CONFIG_PATH } from "./context.js";
|
|
6
|
+
import { librettoCommand } from "../../shared/package-manager.js";
|
|
6
7
|
|
|
7
8
|
export const CURRENT_CONFIG_VERSION = 1;
|
|
8
9
|
|
|
@@ -26,6 +27,7 @@ export const LibrettoConfigSchema = z
|
|
|
26
27
|
windowPosition: WindowPositionConfigSchema.optional(),
|
|
27
28
|
provider: z.string().optional(),
|
|
28
29
|
sessionMode: SessionAccessModeSchema.optional(),
|
|
30
|
+
experiments: z.record(z.string(), z.boolean()).optional(),
|
|
29
31
|
})
|
|
30
32
|
.passthrough();
|
|
31
33
|
export type LibrettoConfig = z.infer<typeof LibrettoConfigSchema>;
|
|
@@ -67,7 +69,7 @@ function invalidConfigError(configPath: string, detail?: string): Error {
|
|
|
67
69
|
' - "snapshotModel", "viewport", "windowPosition", and "sessionMode" are optional.',
|
|
68
70
|
' - "snapshotModel" must be a provider/model string like "openai/gpt-5.4" or "anthropic/claude-sonnet-4-6".',
|
|
69
71
|
"Fix the file to match this shape, or delete it and rerun:",
|
|
70
|
-
`
|
|
72
|
+
` ${librettoCommand("ai configure openai | anthropic | gemini | vertex | openrouter")}`,
|
|
71
73
|
]
|
|
72
74
|
.filter(Boolean)
|
|
73
75
|
.join("\n"),
|
package/src/cli/core/context.ts
CHANGED
|
@@ -38,6 +38,10 @@ export function getSessionActionsLogPath(session: string): string {
|
|
|
38
38
|
return join(getSessionDir(session), "actions.jsonl");
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export function getSessionProviderClosePath(session: string): string {
|
|
42
|
+
return join(getSessionDir(session), "provider-close.json");
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
export function getSessionSnapshotsDir(session: string): string {
|
|
42
46
|
return join(getSessionDir(session), "snapshots");
|
|
43
47
|
}
|
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
* Serialized as JSON in `process.argv[2]` when spawning the daemon.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type { Experiments } from "../experiments.js";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Config for daemon-managed browser launch (`libretto open`).
|
|
9
11
|
* The daemon owns the browser lifecycle and will close it on shutdown.
|
|
10
12
|
*/
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
url: string;
|
|
14
|
-
session: string;
|
|
13
|
+
export type DaemonBrowserLaunchConfig = {
|
|
14
|
+
kind: "launch";
|
|
15
15
|
headed: boolean;
|
|
16
16
|
viewport: { width: number; height: number };
|
|
17
17
|
storageStatePath?: string;
|
|
18
18
|
windowPosition?: { x: number; y: number };
|
|
19
|
+
remoteDebuggingPort?: number;
|
|
20
|
+
initialUrl?: string;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -23,24 +25,38 @@ export type DaemonLaunchConfig = {
|
|
|
23
25
|
* The daemon borrows the CDP connection and will disconnect (not close) on
|
|
24
26
|
* shutdown — the browser outlives the session.
|
|
25
27
|
*/
|
|
26
|
-
export type
|
|
27
|
-
|
|
28
|
-
session: string;
|
|
28
|
+
export type DaemonBrowserConnectConfig = {
|
|
29
|
+
kind: "connect";
|
|
29
30
|
cdpEndpoint: string;
|
|
30
|
-
|
|
31
|
-
url?: string;
|
|
31
|
+
initialUrl?: string;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* as a launch config.
|
|
35
|
+
* Config for a daemon-owned cloud browser provider. The daemon creates the
|
|
36
|
+
* provider session during startup, connects over CDP, and closes the provider
|
|
37
|
+
* session during daemon shutdown.
|
|
39
38
|
*/
|
|
40
|
-
export type
|
|
39
|
+
export type DaemonBrowserProviderConfig = {
|
|
40
|
+
kind: "provider";
|
|
41
|
+
providerName: string;
|
|
42
|
+
initialUrl?: string;
|
|
43
|
+
};
|
|
41
44
|
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
export type DaemonWorkflowConfig = {
|
|
46
|
+
integrationPath: string;
|
|
47
|
+
params?: unknown;
|
|
48
|
+
visualize?: boolean;
|
|
49
|
+
stayOpenOnSuccess?: boolean;
|
|
50
|
+
tsconfigPath?: string;
|
|
51
|
+
authProfileDomain?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type DaemonConfig = {
|
|
55
|
+
session: string;
|
|
56
|
+
experiments: Experiments;
|
|
57
|
+
browser:
|
|
58
|
+
| DaemonBrowserLaunchConfig
|
|
59
|
+
| DaemonBrowserConnectConfig
|
|
60
|
+
| DaemonBrowserProviderConfig;
|
|
61
|
+
workflow?: DaemonWorkflowConfig;
|
|
62
|
+
};
|