@iamu-dev/iamu 0.2.0-beta.1 → 0.2.0-beta.3
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/dist/bin.js +29 -8
- package/dist/index.js +29 -8
- package/dist/templates/skills/iamu-setup.md +40 -33
- package/package.json +2 -2
- package/dist/adapters/claude-plugin.d.ts +0 -13
- package/dist/adapters/registry.d.ts +0 -6
- package/dist/adapters/types.d.ts +0 -19
- package/dist/bin.d.ts +0 -2
- package/dist/build-info.d.ts +0 -53
- package/dist/cloud-url.d.ts +0 -19
- package/dist/commands/auth-http.d.ts +0 -37
- package/dist/commands/auth-project-choice.d.ts +0 -74
- package/dist/commands/auth-token-input.d.ts +0 -21
- package/dist/commands/auth.d.ts +0 -84
- package/dist/commands/browse-actions.d.ts +0 -56
- package/dist/commands/browse-driver.d.ts +0 -117
- package/dist/commands/browse.d.ts +0 -156
- package/dist/commands/cloud-push.d.ts +0 -27
- package/dist/commands/complete.d.ts +0 -131
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/context.d.ts +0 -58
- package/dist/commands/credentials.d.ts +0 -144
- package/dist/commands/diff-filter.d.ts +0 -11
- package/dist/commands/doctor.d.ts +0 -24
- package/dist/commands/evaluate.d.ts +0 -30
- package/dist/commands/findings.d.ts +0 -7
- package/dist/commands/init.d.ts +0 -9
- package/dist/commands/instructions-walk.d.ts +0 -59
- package/dist/commands/list.d.ts +0 -5
- package/dist/commands/match.d.ts +0 -12
- package/dist/commands/mcp-config.d.ts +0 -10
- package/dist/commands/new-entity.d.ts +0 -15
- package/dist/commands/new-finding.d.ts +0 -19
- package/dist/commands/open.d.ts +0 -8
- package/dist/commands/port.d.ts +0 -17
- package/dist/commands/prune.d.ts +0 -11
- package/dist/commands/pull.d.ts +0 -5
- package/dist/commands/register-cloud.d.ts +0 -5
- package/dist/commands/register-findings.d.ts +0 -5
- package/dist/commands/register-project.d.ts +0 -5
- package/dist/commands/register-walkthrough.d.ts +0 -5
- package/dist/commands/register.d.ts +0 -10
- package/dist/commands/report.d.ts +0 -3
- package/dist/commands/serve.d.ts +0 -11
- package/dist/commands/skills.d.ts +0 -34
- package/dist/commands/start-run.d.ts +0 -49
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/step-numbering.d.ts +0 -87
- package/dist/commands/step.d.ts +0 -95
- package/dist/commands/sync.d.ts +0 -6
- package/dist/commands/triage.d.ts +0 -21
- package/dist/commands/update.d.ts +0 -4
- package/dist/commands/validate.d.ts +0 -8
- package/dist/commands/view-results.d.ts +0 -9
- package/dist/index.d.ts +0 -9
- package/dist/sync-mcp/fatal.d.ts +0 -42
- package/dist/sync-mcp/server.d.ts +0 -1
- package/dist/sync-mcp/tools.d.ts +0 -12
- package/dist/templates.d.ts +0 -10
- package/dist/ui/journey-diff.d.ts +0 -3
- package/dist/ui/json.d.ts +0 -6
- package/dist/ui/logger.d.ts +0 -5
- package/dist/ui/panic.d.ts +0 -11
- package/dist/ui/symbols.d.ts +0 -11
- package/dist/ui/table.d.ts +0 -20
- package/dist/ui/update-check.d.ts +0 -6
- package/dist/worktree-state.d.ts +0 -49
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The page actions `iamu browse` can perform — one table shared by the
|
|
3
|
-
* direct commands (`iamu browse click …`) and by `iamu browse step
|
|
4
|
-
* click …`, so the two can never drift apart.
|
|
5
|
-
*/
|
|
6
|
-
import type { Page } from "playwright-core";
|
|
7
|
-
/** Options an action reads. */
|
|
8
|
-
export interface ActionOptions {
|
|
9
|
-
/** Pick the nth (0-based) match instead of the first. */
|
|
10
|
-
nth?: string;
|
|
11
|
-
/** Press Enter after fill/select. */
|
|
12
|
-
submit?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* One page action: how it is called, what it targets (for the "nothing
|
|
16
|
-
* matches" error), and what it does.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export interface PageAction {
|
|
21
|
-
/** Call shape after `iamu browse`, e.g. `click <role> "<name>" [--nth N]`. */
|
|
22
|
-
usage: string;
|
|
23
|
-
/** Positional arguments required after the action name. */
|
|
24
|
-
minArgs: number;
|
|
25
|
-
/** What the action looks for, named the way the error message says it. */
|
|
26
|
-
target?: (args: string[]) => string;
|
|
27
|
-
run(page: Page, args: string[], opts: ActionOptions): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Every page action, by name. `shot` does nothing to the page; the
|
|
31
|
-
* screenshot is taken after any action when one is asked for.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* const action = PAGE_ACTIONS.click;
|
|
36
|
-
* if (args.length >= action.minArgs) await action.run(page, args, {});
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare const PAGE_ACTIONS: Readonly<Record<string, PageAction>>;
|
|
42
|
-
/**
|
|
43
|
-
* Look up a page action by name, own properties only (so `toString`
|
|
44
|
-
* and friends are not actions).
|
|
45
|
-
*
|
|
46
|
-
* @param name - The action name as typed.
|
|
47
|
-
* @returns The action, or undefined.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```ts
|
|
51
|
-
* findPageAction("click")?.usage; // 'click <role> "<name>" [--nth N]'
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
export declare function findPageAction(name: string): PageAction | undefined;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type { Page } from "playwright-core";
|
|
2
|
-
/** A page size in CSS pixels. */
|
|
3
|
-
export interface Size {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The page a command acts on, plus how to let go of it. Detaching
|
|
9
|
-
* disconnects from the browser; it never closes the page.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export interface AttachedPage {
|
|
14
|
-
page: Page;
|
|
15
|
-
detach(): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* What `iamu browse` needs from the machine and the browser — the real
|
|
19
|
-
* one spawns Chrome and speaks CDP; tests pass a fake.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export interface BrowserDriver {
|
|
24
|
-
/** Is a browser answering CDP on this port? Must not hang. */
|
|
25
|
-
isRunning(port: number): Promise<boolean>;
|
|
26
|
-
/** Launch Chrome detached with these arguments; returns its PID. */
|
|
27
|
-
launch(chrome: string, args: string[]): number | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Fit the running window's content area to the viewport
|
|
30
|
-
* (`Browser.setWindowBounds`), so a person watching sees the
|
|
31
|
-
* persona's screen. Best effort: a window cannot be phone-narrow, and
|
|
32
|
-
* every command emulates the stored viewport on its page anyway.
|
|
33
|
-
*/
|
|
34
|
-
resize(port: number, viewport: Size | null): Promise<void>;
|
|
35
|
-
/** Attach over CDP to the page the persona is on. Throws when nothing answers. */
|
|
36
|
-
attach(port: number): Promise<AttachedPage>;
|
|
37
|
-
/** Ask the browser on this port to close (`Browser.close`). Best effort. */
|
|
38
|
-
closeBrowser(port: number): Promise<void>;
|
|
39
|
-
/** The full command line of `pid`, or null when it is gone or cannot be read. */
|
|
40
|
-
commandLine(pid: number): Promise<string | null>;
|
|
41
|
-
/** Send SIGTERM to `pid`. Never throws. */
|
|
42
|
-
kill(pid: number): void;
|
|
43
|
-
}
|
|
44
|
-
/** How long a CDP liveness probe may take before the port counts as dead. */
|
|
45
|
-
export declare const CDP_PROBE_TIMEOUT_MS = 1000;
|
|
46
|
-
/**
|
|
47
|
-
* Is a browser answering CDP on `port`? A process that accepts the
|
|
48
|
-
* connection but never answers (a hung Chrome, something else on the
|
|
49
|
-
* port) counts as not running once `timeoutMs` passes.
|
|
50
|
-
*
|
|
51
|
-
* @param port - CDP port on 127.0.0.1.
|
|
52
|
-
* @param timeoutMs - Give up after this long.
|
|
53
|
-
* @returns True when `/json/version` answers 2xx in time.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* if (!(await probeCdp(9333))) console.log("no browser");
|
|
58
|
-
* ```
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export declare function probeCdp(port: number, timeoutMs?: number): Promise<boolean>;
|
|
63
|
-
/**
|
|
64
|
-
* The command line of a running process, read without a shell:
|
|
65
|
-
* `/proc/<pid>/cmdline` on Linux, else `ps -ww -o args= -p <pid>`.
|
|
66
|
-
* Windows has no equivalent we trust, so it answers null there — and
|
|
67
|
-
* callers then leave the process alone.
|
|
68
|
-
*
|
|
69
|
-
* @param pid - Process ID to inspect.
|
|
70
|
-
* @param platform - Defaults to `process.platform`.
|
|
71
|
-
* @returns The arguments joined by spaces, or null.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* const cmd = await readProcessCommandLine(12345);
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
export declare function readProcessCommandLine(pid: number, platform?: NodeJS.Platform): Promise<string | null>;
|
|
81
|
-
/**
|
|
82
|
-
* Was this command line launched with exactly this `--user-data-dir`?
|
|
83
|
-
* The profile directory is ours alone, so a match means the PID is the
|
|
84
|
-
* Chrome `iamu browse start` launched, not a process that reused its PID.
|
|
85
|
-
*
|
|
86
|
-
* @param commandLine - From {@link readProcessCommandLine}.
|
|
87
|
-
* @param profileDir - The `--user-data-dir` we launched with.
|
|
88
|
-
* @returns True only on an exact flag match.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```ts
|
|
92
|
-
* isOurBrowser("chrome --user-data-dir=/h/.iamu/browse/profile", "/h/.iamu/browse/profile"); // true
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
export declare function isOurBrowser(commandLine: string | null, profileDir: string): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* SIGTERM `pid` only if it is verifiably our Chrome (see
|
|
100
|
-
* {@link isOurBrowser}). PIDs get reused; anything else is left alone
|
|
101
|
-
* and Chrome's own profile lock guards a second launch.
|
|
102
|
-
*
|
|
103
|
-
* @param pid - PID recorded in the browse state.
|
|
104
|
-
* @param profileDir - The `--user-data-dir` it was launched with.
|
|
105
|
-
* @param driver - Supplies `commandLine` and `kill`.
|
|
106
|
-
* @returns True when the process was signalled.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* await reapBrowser(state.pid, profileDir, cdpDriver);
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* @public
|
|
114
|
-
*/
|
|
115
|
-
export declare function reapBrowser(pid: number, profileDir: string, driver: Pick<BrowserDriver, "commandLine" | "kill">): Promise<boolean>;
|
|
116
|
-
/** The real driver: spawns Chrome and speaks CDP through playwright-core. */
|
|
117
|
-
export declare const cdpDriver: BrowserDriver;
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import type { Page } from "playwright-core";
|
|
2
|
-
import { type BrowserDriver, type Size } from "./browse-driver.js";
|
|
3
|
-
export type { BrowserDriver } from "./browse-driver.js";
|
|
4
|
-
/** Parsed options for `iamu browse <command>`. */
|
|
5
|
-
export interface BrowseOptions {
|
|
6
|
-
shot?: string;
|
|
7
|
-
nth?: string;
|
|
8
|
-
submit?: boolean;
|
|
9
|
-
full?: boolean;
|
|
10
|
-
viewport?: string;
|
|
11
|
-
width?: string;
|
|
12
|
-
height?: string;
|
|
13
|
-
headless?: boolean;
|
|
14
|
-
port?: string | number;
|
|
15
|
-
/** `start`: size the browser for this run's persona. */
|
|
16
|
-
run?: string;
|
|
17
|
-
action?: string;
|
|
18
|
-
note?: string;
|
|
19
|
-
surface?: string;
|
|
20
|
-
maxSteps?: string | number;
|
|
21
|
-
json?: boolean;
|
|
22
|
-
}
|
|
23
|
-
interface BrowseState {
|
|
24
|
-
port: number;
|
|
25
|
-
viewport: Size | null;
|
|
26
|
-
pid?: number;
|
|
27
|
-
headless?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The state `iamu browse start` left in `~/.iamu/browse/state.json`, or
|
|
31
|
-
* null when no browser was started (or the file is unreadable).
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* const state = readBrowseState();
|
|
36
|
-
* if (state) console.log(`CDP on :${state.port}`);
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare function readBrowseState(): BrowseState | null;
|
|
42
|
-
/**
|
|
43
|
-
* Parse `"390x844"` into a size.
|
|
44
|
-
*
|
|
45
|
-
* @param value - `WxH`, 2–5 digits each.
|
|
46
|
-
* @returns The size, or null when absent or malformed.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* parseViewport("390x844"); // { width: 390, height: 844 }
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
export declare function parseViewport(value: string | undefined): Size | null;
|
|
56
|
-
/**
|
|
57
|
-
* The installed Chrome/Chromium to drive: `IAMU_BROWSER`, else the
|
|
58
|
-
* usual install location for this platform.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* const chrome = findChrome();
|
|
63
|
-
* if (!chrome) console.error("Install Chrome or set IAMU_BROWSER");
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
export declare function findChrome(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, exists?: (p: string) => boolean): string | null;
|
|
69
|
-
/**
|
|
70
|
-
* Should `start` launch without a window? `--headless` wins, then
|
|
71
|
-
* `IAMU_HEADLESS`, then CI or a Linux box with no `DISPLAY`.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* isHeadlessEnvironment({ headless: true }); // true
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
export declare function isHeadlessEnvironment(opts?: BrowseOptions): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Should Chrome run with `--no-sandbox`? Only when it cannot start
|
|
83
|
-
* otherwise — as root (Chrome refuses to sandbox as root, typical in
|
|
84
|
-
* containers) — or when explicitly asked via `IAMU_BROWSE_NO_SANDBOX=1`.
|
|
85
|
-
* Being headless or in CI is not a reason: the sandbox is what keeps a
|
|
86
|
-
* page the persona visits away from the machine.
|
|
87
|
-
*
|
|
88
|
-
* @param env - Defaults to `process.env`.
|
|
89
|
-
* @param uid - Effective user ID; defaults to `process.getuid()` (undefined on Windows).
|
|
90
|
-
* @returns True when `--no-sandbox` should be passed.
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```ts
|
|
94
|
-
* shouldDisableSandbox({ IAMU_BROWSE_NO_SANDBOX: "1" }, 1000); // true
|
|
95
|
-
* shouldDisableSandbox({ CI: "true" }, 1000); // false
|
|
96
|
-
* ```
|
|
97
|
-
*
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export declare function shouldDisableSandbox(env?: NodeJS.ProcessEnv, uid?: number | undefined): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Start the browser, or converge the one already running: a running
|
|
103
|
-
* browser is reused, and resized when the requested viewport differs
|
|
104
|
-
* from the one it was started with — never silently left at another
|
|
105
|
-
* persona's size.
|
|
106
|
-
*
|
|
107
|
-
* A PID left by an earlier `start` whose CDP no longer answers is
|
|
108
|
-
* terminated only when its command line shows our `--user-data-dir`;
|
|
109
|
-
* a PID the OS has since handed to another process is left alone.
|
|
110
|
-
*
|
|
111
|
-
* @param opts - `viewport`, `run`, `port`, `width`, `height`, `headless`, `json`.
|
|
112
|
-
* @param driver - Machine/browser seam; tests pass a fake.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```ts
|
|
116
|
-
* await start({ viewport: "390x844" });
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* @public
|
|
120
|
-
*/
|
|
121
|
-
export declare function start(opts: BrowseOptions, driver?: BrowserDriver): Promise<void>;
|
|
122
|
-
/** Where the page ended up after an action. */
|
|
123
|
-
export interface PageResult {
|
|
124
|
-
url: string;
|
|
125
|
-
title: string;
|
|
126
|
-
/** Absolute path of the screenshot written, or null when none was asked for. */
|
|
127
|
-
screenshot: string | null;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Attach to the running browser, run `fn` on the page the persona is
|
|
131
|
-
* on, optionally screenshot it, and return where the page is. Prints
|
|
132
|
-
* nothing on success — the caller decides the output shape. Detaching
|
|
133
|
-
* never closes the page.
|
|
134
|
-
*
|
|
135
|
-
* @public
|
|
136
|
-
*/
|
|
137
|
-
export declare function withPage(opts: BrowseOptions, driver: BrowserDriver, fn: (page: Page) => Promise<void>,
|
|
138
|
-
/** What the action looks for, named for the error message. */
|
|
139
|
-
target?: string): Promise<PageResult | null>;
|
|
140
|
-
/**
|
|
141
|
-
* `iamu browse <command> [args…]` — dispatch one browse subcommand.
|
|
142
|
-
* Failures print to stderr and set exit code 1.
|
|
143
|
-
*
|
|
144
|
-
* @param command - `start`, `stop`, `step`, `snapshot`, `shot`, or a page action.
|
|
145
|
-
* @param args - Positional arguments after the command.
|
|
146
|
-
* @param opts - Parsed CLI options.
|
|
147
|
-
* @param driver - Machine/browser seam; tests pass a fake.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* await browse("click", ["button", "Sign in"], { json: true });
|
|
152
|
-
* ```
|
|
153
|
-
*
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
export declare function browse(command: string, args: string[], opts: BrowseOptions, driver?: BrowserDriver): Promise<void>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** What happened to a run's cloud copy, as `--json` and the terminal show it. */
|
|
2
|
-
export interface CloudRunInfo {
|
|
3
|
-
mirrored: boolean;
|
|
4
|
-
status: string;
|
|
5
|
-
skipped_reason?: string;
|
|
6
|
-
/** Dashboard URL — set only when the cloud holds this run. */
|
|
7
|
-
url?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Push one run to the cloud when the project is cloud-linked. Returns
|
|
11
|
-
* `undefined` for a local-only project, so callers print nothing.
|
|
12
|
-
*
|
|
13
|
-
* Called by every command that changes what the run's cloud copy shows
|
|
14
|
-
* (`complete`, `evaluate-record`): offering "Open in Iamu Cloud" after a
|
|
15
|
-
* local-only write would open a stale report.
|
|
16
|
-
*/
|
|
17
|
-
export declare function pushRunToCloud(projectRoot: string, runId: string): Promise<CloudRunInfo | undefined>;
|
|
18
|
-
/** Project dashboard URL, or `null` for a local-only project. */
|
|
19
|
-
export declare function projectDashboardUrl(projectRoot: string): Promise<string | null>;
|
|
20
|
-
/**
|
|
21
|
-
* Dashboard URL of a run this machine already pushed, or `null` when the
|
|
22
|
-
* project is local-only or the run never reached the cloud. Reads local
|
|
23
|
-
* sync tracking only — no network.
|
|
24
|
-
*/
|
|
25
|
-
export declare function pushedRunUrl(projectRoot: string, runId: string): Promise<string | null>;
|
|
26
|
-
/** Terminal lines for a run's cloud state; prints nothing when local-only. */
|
|
27
|
-
export declare function printCloudRunInfo(info: CloudRunInfo | undefined): void;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { type JourneyDiff, type RevisitPlaceCoverage, type VerificationSummary, type WalkthroughManifest } from "@iamu-dev/local-store";
|
|
2
|
-
import { type CanonicalWalkthrough, type RunViewport } from "@iamu-dev/protocol";
|
|
3
|
-
import { type CloudRunInfo } from "./cloud-push.js";
|
|
4
|
-
export interface CompleteOptions {
|
|
5
|
-
cwd?: string;
|
|
6
|
-
json?: boolean;
|
|
7
|
-
force?: boolean;
|
|
8
|
-
yes?: boolean;
|
|
9
|
-
prompt?: boolean;
|
|
10
|
-
view?: boolean;
|
|
11
|
-
strictProvenance?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** Non-fatal observations made while completing, reported after assembly. */
|
|
14
|
-
export interface CompletionExtras {
|
|
15
|
-
revisit: RevisitReport | null;
|
|
16
|
-
viewportWarning: string | null;
|
|
17
|
-
codeWarning: string | null;
|
|
18
|
-
cloudInfo: CloudRunInfo | undefined;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* `iamu complete <run-id>`: assemble canonical.json + report.md, mark the
|
|
22
|
-
* run completed, push it when cloud-linked and report the outcome.
|
|
23
|
-
*/
|
|
24
|
-
export declare function complete(runId: string, opts?: CompleteOptions): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* The run's completion time. `--force` reassembles the report of a finished
|
|
27
|
-
* run; the run still finished when it first completed. Re-stamping would
|
|
28
|
-
* move every re-assembled run to "now", which breaks run ordering and
|
|
29
|
-
* durations downstream.
|
|
30
|
-
*/
|
|
31
|
-
export declare function pickCompletedAt(manifest: Pick<WalkthroughManifest, "completed_at">, now?: () => Date): string;
|
|
32
|
-
/** The manifest with its status flipped to completed. */
|
|
33
|
-
export declare function completedManifest(manifest: WalkthroughManifest, completedAt: string): WalkthroughManifest;
|
|
34
|
-
/** Persist the completed manifest to disk atomically. */
|
|
35
|
-
export declare function persistManifest(manifestPath: string, manifest: WalkthroughManifest, completedAt: string): Promise<WalkthroughManifest>;
|
|
36
|
-
/** `complete --json` output: the canonical plus whichever extras exist. */
|
|
37
|
-
export declare function completeJsonPayload(canonical: CanonicalWalkthrough, extras: CompletionExtras): Record<string, unknown>;
|
|
38
|
-
/** Non-fatal provenance warnings; prints nothing for a clean audit. */
|
|
39
|
-
export declare function printProvenanceWarnings(audit: ProvenanceAudit): void;
|
|
40
|
-
/** Width and height from a PNG's IHDR chunk; null if it is not a PNG. */
|
|
41
|
-
export declare function pngSize(head: Buffer): {
|
|
42
|
-
width: number;
|
|
43
|
-
height: number;
|
|
44
|
-
} | null;
|
|
45
|
-
/**
|
|
46
|
-
* Is a screenshot `width` px wide consistent with a viewport `expected`
|
|
47
|
-
* CSS px wide? At 1× within 20%; at a 2× or 3× device pixel ratio the
|
|
48
|
-
* width is an exact multiple, so within 5% — wide enough for a scrollbar,
|
|
49
|
-
* narrow enough that a 1280 px desktop shot never passes as a 3× phone.
|
|
50
|
-
*/
|
|
51
|
-
export declare function screenshotFitsViewport(width: number, expected: number): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* A warning when the run's first screenshot is not the width of the
|
|
54
|
-
* device its persona uses — the browser was left at another persona's
|
|
55
|
-
* size. Null when the run recorded no viewport, has no screenshots, or
|
|
56
|
-
* the sizes agree. Never fatal.
|
|
57
|
-
*/
|
|
58
|
-
export declare function screenshotSizeWarning(runDirPath: string, viewport: RunViewport | null): Promise<string | null>;
|
|
59
|
-
export interface ProvenanceAudit {
|
|
60
|
-
verified: boolean;
|
|
61
|
-
warnings: string[];
|
|
62
|
-
step_count: number;
|
|
63
|
-
duration_seconds: number | null;
|
|
64
|
-
avg_step_interval_seconds: number | null;
|
|
65
|
-
uniform_intervals: boolean;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Audit steps for suspicious timing anomalies that indicate programmatic batch
|
|
69
|
-
* generation (scripts, mocks) rather than interactive human/LLM persona execution.
|
|
70
|
-
*/
|
|
71
|
-
export declare function auditStepProvenance(steps: Array<{
|
|
72
|
-
timestamp?: string;
|
|
73
|
-
action?: string;
|
|
74
|
-
step_number?: number;
|
|
75
|
-
}>): ProvenanceAudit;
|
|
76
|
-
/** Strictly validate runtime canonical structure against the protocol schema. */
|
|
77
|
-
export declare function validateCanonicalWalkthrough(canonical: unknown): CanonicalWalkthrough;
|
|
78
|
-
/**
|
|
79
|
-
* Read recorded judge verdicts (if present) and overlay them onto the canonical
|
|
80
|
-
* walkthrough for report markdown rendering.
|
|
81
|
-
*/
|
|
82
|
-
export declare function applyRecordedVerdicts(canonical: CanonicalWalkthrough, runDirPath: string): Promise<CanonicalWalkthrough>;
|
|
83
|
-
/** Persist canonical.json to disk atomically. */
|
|
84
|
-
export declare function persistCanonical(runDirPath: string, canonical: CanonicalWalkthrough): Promise<string>;
|
|
85
|
-
/** Persist report.md to disk atomically. */
|
|
86
|
-
export declare function persistReport(runDirPath: string, canonical: CanonicalWalkthrough): Promise<string>;
|
|
87
|
-
/**
|
|
88
|
-
* Build canonical.json (with the verification delta) and report.md for a
|
|
89
|
-
* run. The report keeps any verdicts already recorded by
|
|
90
|
-
* `evaluate-record`, so re-assembling after the judge (`--force`,
|
|
91
|
-
* `match-record`) does not drop them.
|
|
92
|
-
*/
|
|
93
|
-
export declare function assembleRun(projectRoot: string, runId: string, manifest: WalkthroughManifest, completedAt: string): Promise<{
|
|
94
|
-
canonical: CanonicalWalkthrough;
|
|
95
|
-
verification: VerificationSummary | null;
|
|
96
|
-
journeyDiff: JourneyDiff | null;
|
|
97
|
-
canonicalWithVerification: CanonicalWalkthrough & {
|
|
98
|
-
provenance_audit?: ProvenanceAudit;
|
|
99
|
-
};
|
|
100
|
-
canonicalPath: string;
|
|
101
|
-
reportPath: string;
|
|
102
|
-
}>;
|
|
103
|
-
/** One requested place, whether the run reached it, and what awaits there. */
|
|
104
|
-
export type RevisitReportPlace = RevisitPlaceCoverage & {
|
|
105
|
-
findings: Array<{
|
|
106
|
-
id: string;
|
|
107
|
-
title: string;
|
|
108
|
-
}>;
|
|
109
|
-
};
|
|
110
|
-
/** Coverage of the run's places to pass through, with finding titles. */
|
|
111
|
-
export interface RevisitReport {
|
|
112
|
-
requested: number;
|
|
113
|
-
reached: number;
|
|
114
|
-
places: RevisitReportPlace[];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Did the run reach the places `start-run` asked it to pass through
|
|
118
|
-
* (manifest `revisit`)? Null when it asked for none. Local only: the
|
|
119
|
-
* cloud manifest has no field for it. Titles are for the person reading
|
|
120
|
-
* this output — the walker never saw them.
|
|
121
|
-
*/
|
|
122
|
-
export declare function revisitReport(projectRoot: string, runId: string, manifest: WalkthroughManifest): Promise<RevisitReport | null>;
|
|
123
|
-
/** Print "Re-check places: reached N of M — not reached: …". */
|
|
124
|
-
export declare function printRevisit(r: RevisitReport): void;
|
|
125
|
-
/**
|
|
126
|
-
* Print the delta against this scenario's previous completed run. Its
|
|
127
|
-
* counts are relative to that one run — "new" here means "not in that
|
|
128
|
-
* run", which is not the matcher's "first seen" (never recorded before)
|
|
129
|
-
* — so the heading says what it compares with.
|
|
130
|
-
*/
|
|
131
|
-
export declare function printVerification(verification: VerificationSummary): void;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { readEntity } from "@iamu-dev/local-store";
|
|
2
|
-
import type { EntityType, ProjectConfig } from "@iamu-dev/protocol";
|
|
3
|
-
export interface ProjectContext {
|
|
4
|
-
projectRoot: string;
|
|
5
|
-
config: ProjectConfig;
|
|
6
|
-
}
|
|
7
|
-
export interface CloudContext extends ProjectContext {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
apiUrl: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function commandError(message: string, opts?: {
|
|
12
|
-
json?: boolean | string;
|
|
13
|
-
}): void;
|
|
14
|
-
/**
|
|
15
|
-
* Resolve a run directory, reporting an unusable run id as a command
|
|
16
|
-
* error (message + exit code 1) instead of letting it reach the
|
|
17
|
-
* filesystem. Returns `null` once the error has been reported.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveRunDir(projectRoot: string, runId: string, opts?: {
|
|
20
|
-
json?: boolean;
|
|
21
|
-
}): string | null;
|
|
22
|
-
/**
|
|
23
|
-
* Last-resort handler for a rejection that escaped a command action.
|
|
24
|
-
* Prints one line — JSON-shaped when the invocation carried `--json` —
|
|
25
|
-
* and leaves a non-zero exit code behind. Without it, Commander's
|
|
26
|
-
* `parseAsync()` rejection reaches Node as an unhandled rejection: a
|
|
27
|
-
* stack trace at the user, and historically exit code 0.
|
|
28
|
-
*
|
|
29
|
-
* @param err - The value the command rejected with.
|
|
30
|
-
* @param argv - Invocation argv; only `--json` is read from it.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* await program.parseAsync().catch(reportFatalError);
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function reportFatalError(err: unknown, argv?: readonly string[]): void;
|
|
38
|
-
export declare function resolveProject(opts?: {
|
|
39
|
-
json?: boolean | string;
|
|
40
|
-
}): Promise<ProjectContext | null>;
|
|
41
|
-
/**
|
|
42
|
-
* Resolves both project context and run directory path.
|
|
43
|
-
* Returns null if either fails (error already reported).
|
|
44
|
-
*/
|
|
45
|
-
export declare function resolveProjectAndRunDir(runId: string, opts?: {
|
|
46
|
-
cwd?: string;
|
|
47
|
-
json?: boolean;
|
|
48
|
-
}): Promise<{
|
|
49
|
-
projectRoot: string;
|
|
50
|
-
config: ProjectConfig;
|
|
51
|
-
runDirPath: string;
|
|
52
|
-
} | null>;
|
|
53
|
-
export declare function resolveCloudProject(opts?: {
|
|
54
|
-
json?: boolean | string;
|
|
55
|
-
}): Promise<CloudContext | null>;
|
|
56
|
-
export declare function safeReadEntity<T extends object = Record<string, unknown>>(projectRoot: string, type: EntityType, slug: string, opts?: {
|
|
57
|
-
json?: boolean | string;
|
|
58
|
-
}): Promise<Awaited<ReturnType<typeof readEntity<T>>> | null>;
|