@iamu-dev/iamu 0.8.0-beta.0 → 0.8.0-beta.1

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.
@@ -28,6 +28,7 @@ export interface IndexedElement {
28
28
  name: string;
29
29
  type?: string;
30
30
  disabled?: boolean;
31
+ checked?: boolean;
31
32
  }
32
33
  export declare const INDEXED_SELECTOR: string;
33
34
  export declare function markAndQueryIndexedElements(page: Page): Promise<IndexedElement[]>;
@@ -43,7 +43,7 @@ export interface BrowserDriver {
43
43
  /** The full command line of `pid`, or null when it is gone or cannot be read. */
44
44
  commandLine(pid: number): Promise<string | null>;
45
45
  /** Send SIGTERM to `pid`. Never throws. */
46
- kill(pid: number): void;
46
+ kill(pid: number, signal?: NodeJS.Signals | number): void;
47
47
  }
48
48
  /** How long a CDP liveness probe may take before the port counts as dead. */
49
49
  export declare const CDP_PROBE_TIMEOUT_MS = 1000;
@@ -65,10 +65,9 @@ export declare const CDP_PROBE_TIMEOUT_MS = 1000;
65
65
  */
66
66
  export declare function probeCdp(port: number, timeoutMs?: number): Promise<boolean>;
67
67
  /**
68
- * The command line of a running process, read without a shell:
69
- * `/proc/<pid>/cmdline` on Linux, else `ps -ww -o args= -p <pid>`.
70
- * Windows has no equivalent we trust, so it answers null there — and
71
- * callers then leave the process alone.
68
+ * The command line of a running process:
69
+ * `/proc/<pid>/cmdline` on Linux, PowerShell CIM query on Windows,
70
+ * else `ps -ww -o args= -p <pid>`.
72
71
  *
73
72
  * @param pid - Process ID to inspect.
74
73
  * @param platform - Defaults to `process.platform`.
@@ -82,6 +81,12 @@ export declare function probeCdp(port: number, timeoutMs?: number): Promise<bool
82
81
  * @public
83
82
  */
84
83
  export declare function readProcessCommandLine(pid: number, platform?: NodeJS.Platform): Promise<string | null>;
84
+ /**
85
+ * Supported browser executable names in process command lines.
86
+ *
87
+ * @public
88
+ */
89
+ export declare const BROWSER_NAME_RE: RegExp;
85
90
  /**
86
91
  * Was this command line launched with exactly this `--user-data-dir`?
87
92
  * The profile directory is ours alone, so a match means the PID is the
@@ -117,5 +122,20 @@ export declare function isOurBrowser(commandLine: string | null, profileDir: str
117
122
  * @public
118
123
  */
119
124
  export declare function reapBrowser(pid: number, profileDir: string, driver: Pick<BrowserDriver, "commandLine" | "kill">): Promise<boolean>;
125
+ /**
126
+ * Select the target page to act on from all open pages in the context.
127
+ * Filters out devtools and browser internal/extension pages unless only internal pages exist.
128
+ * Respects pageIndex when valid; otherwise prefers the last active non-blank page.
129
+ *
130
+ * @param rawPages - All pages returned by the browser context.
131
+ * @param pageIndex - Optional explicit zero-based index into the filtered pages array.
132
+ * @returns The selected Page and the list of user/available pages.
133
+ *
134
+ * @public
135
+ */
136
+ export declare function selectTargetPage(rawPages: Page[], pageIndex?: number): {
137
+ page: Page | undefined;
138
+ pages: Page[];
139
+ };
120
140
  /** The real driver: spawns Chrome and speaks CDP through playwright-core. */
121
141
  export declare const cdpDriver: BrowserDriver;
@@ -19,6 +19,10 @@ export interface BrowseOptions {
19
19
  surface?: string;
20
20
  maxSteps?: string | number;
21
21
  stepFile?: string;
22
+ /** Chained page actions executed sequentially in a single browse step before screenshot. */
23
+ then?: string[];
24
+ /** Include post-action indexed snapshot in browse step output (default: true). */
25
+ snapshot?: boolean;
22
26
  json?: boolean;
23
27
  /** Annotate snapshot with 1-based index numbers [#N] for click-index / fill-index */
24
28
  indexed?: boolean;
@@ -177,7 +181,16 @@ export declare function detectAntiBotChallenge(page: Page, allowEvaluate?: boole
177
181
  */
178
182
  export declare function withPage(opts: BrowseOptions, driver: BrowserDriver, fn: (page: Page) => Promise<void>,
179
183
  /** What the action looks for, named for the error message. */
180
- target?: string): Promise<PageResult | null>;
184
+ target?: string,
185
+ /** Optional post-screenshot hook executed before detaching from CDP. */
186
+ onPostShot?: (page: Page) => Promise<void>): Promise<PageResult | null>;
187
+ /**
188
+ * Obtain an ARIA accessibility snapshot with fallback from body to :root,
189
+ * handling empty or about:blank pages gracefully.
190
+ *
191
+ * @public
192
+ */
193
+ export declare function resilientAriaSnapshot(page: Page): Promise<string>;
181
194
  /** What {@link clearOriginStorage} removed. */
182
195
  export interface ClearedStorage {
183
196
  origin: string;
@@ -194,6 +207,13 @@ export declare function clearOriginStorage(origin: string, driver?: BrowserDrive
194
207
  returnTo?: string): Promise<ClearedStorage | {
195
208
  error: string;
196
209
  }>;
210
+ /**
211
+ * Split a chained action string (e.g. `fill-index 22 "2026-11-20"`) into tokens,
212
+ * respecting single and double quotes.
213
+ *
214
+ * @public
215
+ */
216
+ export declare function parseActionCommand(raw: string): string[];
197
217
  /**
198
218
  * `iamu browse <command> [args…]` — dispatch one browse subcommand.
199
219
  * Failures print to stderr and set exit code 1.
@@ -2,7 +2,7 @@ export interface EditEntityOptions {
2
2
  json?: boolean;
3
3
  }
4
4
  /**
5
- * Open an entity in the user's $EDITOR or $VISUAL, and validate its frontmatter
6
- * against the entity schema on exit.
5
+ * Open an entity or project configuration file in the user's $EDITOR or $VISUAL,
6
+ * and validate its frontmatter against the schema on exit.
7
7
  */
8
- export declare function editEntity(type: string, slug: string, opts?: EditEntityOptions): Promise<void>;
8
+ export declare function editEntity(type: string, slug?: string, opts?: EditEntityOptions): Promise<void>;
@@ -8,18 +8,18 @@ export declare function setupCommand(projectRoot: string, hosts: HostAdapter[]):
8
8
  * Detect the target port for local dev execution.
9
9
  * Checks, in order:
10
10
  * 1. process.env.PORT
11
- * 2. .env files (.env.local, .env.development, .env) for PORT, VITE_PORT, APP_URL, NEXT_PUBLIC_APP_URL
12
- * 3. package.json scripts for `-p <port>` or `--port <port>` flags
13
- * 4. package.json dependencies and framework config files (vite -> 5173, astro -> 4321)
11
+ * 2. Root .env files, vite/astro config `port:`, package.json scripts/deps
12
+ * 3. Monorepo workspace subdirectories (apps/*, packages/*, web, frontend, client)
14
13
  */
15
14
  export declare function detectTargetPort(projectRoot: string): number | undefined;
16
15
  export declare function detectTargetUrl(projectRoot: string): string;
17
- export declare function createDraftTestabilityContent(targetUrl?: string): string;
16
+ export declare function createDraftTestabilityContent(targetUrl?: string, status?: "draft" | "verified"): string;
18
17
  export interface InitOptions {
19
18
  name?: string;
20
19
  yes?: boolean;
21
20
  json?: boolean;
22
21
  cloud?: boolean;
22
+ target?: string;
23
23
  }
24
24
  /**
25
25
  * Scaffold `iamu/` and install skills for the detected hosts.
@@ -1,5 +1,11 @@
1
1
  import { type GuidanceRule, type RevisitPlace } from "@iamu-dev/local-store";
2
2
  import { type RunViewport, type ScenarioState } from "@iamu-dev/protocol";
3
+ /**
4
+ * How to invoke this very CLI from a subagent's shell. Aliases and
5
+ * shell functions do not exist there, so name the executable that is
6
+ * running now.
7
+ */
8
+ export declare function selfCommand(execPath?: string, scriptPath?: string): string;
3
9
  /** "The browser is sized as a phone screen, 390×844." */
4
10
  export declare function viewportLine(v: RunViewport): string;
5
11
  interface WalkerPromptParts {
@@ -10,14 +10,16 @@ export interface PreflightCheckResult {
10
10
  reason?: string;
11
11
  }
12
12
  /**
13
- * Detect the fast compile/typecheck/lint command for a target project.
13
+ * Detect the fast compile/typecheck command for a target project.
14
+ * Deliberately excludes lint scripts (`check`, `eslint`, `biome check`) so
15
+ * lint rules never block walkthrough execution.
14
16
  */
15
17
  export declare function detectPreflightCommand(targetDir: string): Promise<{
16
18
  command: string;
17
19
  args: string[];
18
20
  } | null>;
19
21
  /**
20
- * Executes a fast preflight type/lint check.
22
+ * Executes a fast preflight typecheck.
21
23
  */
22
24
  export declare function runPreflightCheck(targetDir: string): Promise<PreflightCheckResult>;
23
25
  /**
@@ -25,6 +25,8 @@ export interface RecordStepInput {
25
25
  note?: string | null;
26
26
  /** Path of an existing screenshot to copy in; a missing file is an error. */
27
27
  shot?: string | null;
28
+ /** When true, move `shot` into `screenshots/step-N.png` via rename instead of copying. */
29
+ moveShot?: boolean;
28
30
  url?: string | null;
29
31
  surface?: string | null;
30
32
  grounding?: string | null;