@nordhavnhq/runner 0.106.1 → 0.106.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/dist/config.d.ts +2 -3
- package/dist/config.js +2 -6
- package/dist/runtime/git-credentials.d.ts +0 -1
- package/dist/runtime/git-credentials.js +1 -1
- package/dist/tools/_sonar/diagnose/detect.d.ts +0 -4
- package/dist/tools/_sonar/diagnose/detect.js +2 -2
- package/dist/tools/_sonar/diagnose/index.d.ts +0 -2
- package/dist/tools/_sonar/diagnose/index.js +1 -1
- package/dist/tools/_sonar/diagnose/pool.d.ts +0 -4
- package/dist/tools/_sonar/diagnose/pool.js +2 -2
- package/dist/tools/_sonar/serve.d.ts +0 -2
- package/dist/tools/_sonar/serve.js +1 -1
- package/dist/tools/console.d.ts +0 -6
- package/dist/tools/console.js +1 -1
- package/dist/tools/sonar.d.ts +0 -2
- package/dist/tools/sonar.js +1 -1
- package/dist/update/install-kind.d.ts +0 -2
- package/dist/update/install-kind.js +1 -1
- package/dist/update/manifest.d.ts +0 -2
- package/dist/update/manifest.js +1 -1
- package/dist/update/updater.d.ts +0 -4
- package/dist/update/updater.js +2 -2
- package/dist/utils/format.js +1 -1
- package/dist/version.json +3 -3
- package/node_modules/@nordhavnhq/runner-browser/dist/local-live.d.ts +0 -3
- package/node_modules/@nordhavnhq/runner-browser/dist/local-live.js +3 -3
- package/node_modules/@nordhavnhq/runner-browser/dist/marks.d.ts +0 -1
- package/node_modules/@nordhavnhq/runner-browser/dist/marks.js +1 -1
- package/node_modules/@nordhavnhq/runner-browser/dist/page-tools.d.ts +0 -6
- package/node_modules/@nordhavnhq/runner-browser/dist/page-tools.js +1 -1
- package/node_modules/@nordhavnhq/runner-browser/dist/shots.d.ts +0 -6
- package/node_modules/@nordhavnhq/runner-browser/dist/shots.js +1 -1
- package/node_modules/@nordhavnhq/runner-browser/dist/target.d.ts +0 -8
- package/node_modules/@nordhavnhq/runner-browser/dist/target.js +2 -2
- package/node_modules/@nordhavnhq/runner-browser/dist/tour.d.ts +1 -8
- package/node_modules/@nordhavnhq/runner-browser/dist/tour.js +3 -3
- package/node_modules/@nordhavnhq/runner-browser/package.json +1 -1
- package/node_modules/@nordhavnhq/runner-runtime/package.json +1 -1
- package/package.json +3 -3
package/dist/config.d.ts
CHANGED
|
@@ -83,13 +83,12 @@ export declare function hostedAgent(config: Config): AgentConfig | null;
|
|
|
83
83
|
* there and keeps only the pairing of the agent's organisation.
|
|
84
84
|
*/
|
|
85
85
|
export declare function addAgent(config: Config, agent: AgentConfig): Config;
|
|
86
|
-
export declare function removeAgent(config: Config, agent: AgentConfig): Config;
|
|
87
86
|
/**
|
|
88
87
|
* Drop a pairing and every agent that belongs to it.
|
|
89
88
|
*
|
|
90
89
|
* `flatHomeOrg` is deliberately NOT cleared or reassigned here. The agent home
|
|
91
|
-
* directories of the organisation being unlinked stay on disk (as they do
|
|
92
|
-
*
|
|
90
|
+
* directories of the organisation being unlinked stay on disk (as they do when
|
|
91
|
+
* an agent is removed), so handing the flat layout to the next organisation would
|
|
93
92
|
* point its agents at someone else's files. Whether the flat layer may be
|
|
94
93
|
* claimed again is decided by `canClaimFlatHome`, which asks the disk rather
|
|
95
94
|
* than trusting this field.
|
package/dist/config.js
CHANGED
|
@@ -226,16 +226,12 @@ export function addAgent(config, agent) {
|
|
|
226
226
|
config.hosts = config.hosts.filter(h => h.organisationSlug === agent.organisationSlug);
|
|
227
227
|
return config;
|
|
228
228
|
}
|
|
229
|
-
export function removeAgent(config, agent) {
|
|
230
|
-
config.agents = config.agents.filter(a => a !== agent);
|
|
231
|
-
return config;
|
|
232
|
-
}
|
|
233
229
|
/**
|
|
234
230
|
* Drop a pairing and every agent that belongs to it.
|
|
235
231
|
*
|
|
236
232
|
* `flatHomeOrg` is deliberately NOT cleared or reassigned here. The agent home
|
|
237
|
-
* directories of the organisation being unlinked stay on disk (as they do
|
|
238
|
-
*
|
|
233
|
+
* directories of the organisation being unlinked stay on disk (as they do when
|
|
234
|
+
* an agent is removed), so handing the flat layout to the next organisation would
|
|
239
235
|
* point its agents at someone else's files. Whether the flat layer may be
|
|
240
236
|
* claimed again is decided by `canClaimFlatHome`, which asks the disk rather
|
|
241
237
|
* than trusting this field.
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
* the agent token stays in the runner's config.
|
|
20
20
|
*/
|
|
21
21
|
export declare const GIT_RUN_ENV = "NORDHAVN_GIT_RUN";
|
|
22
|
-
export declare function studioGitCredentials(env?: NodeJS.ProcessEnv): boolean;
|
|
23
22
|
/**
|
|
24
23
|
* The env that points git at the studio credential of run `queueUid`, or
|
|
25
24
|
* `{}` when studio credentials are off or the run has no uid. `cli` is the
|
|
@@ -21,7 +21,7 @@ import { getConfigPath } from '../config.js';
|
|
|
21
21
|
*/
|
|
22
22
|
export const GIT_RUN_ENV = 'NORDHAVN_GIT_RUN';
|
|
23
23
|
const HELPER_KEY = 'credential.https://github.com.helper';
|
|
24
|
-
|
|
24
|
+
function studioGitCredentials(env = process.env) {
|
|
25
25
|
return env.NORDHAVN_GIT_CREDENTIALS?.trim().toLowerCase() === 'studio';
|
|
26
26
|
}
|
|
27
27
|
/** A word for `sh -c`, in double quotes. */
|
|
@@ -9,8 +9,6 @@ export type LintDetect = {
|
|
|
9
9
|
} | {
|
|
10
10
|
skip: string;
|
|
11
11
|
} | null;
|
|
12
|
-
/** The nearest folder at or above `dir` holding an eslint flat config, never past the git top. */
|
|
13
|
-
export declare function findEslintConfigDir(dir: string): string | null;
|
|
14
12
|
/**
|
|
15
13
|
* How to lint `absFile`: the setup, a reason to skip (a config without an
|
|
16
14
|
* installed eslint, e.g. a worktree before `npm ci`), or null when the file is
|
|
@@ -28,8 +26,6 @@ export type TypesDetect = {
|
|
|
28
26
|
} | {
|
|
29
27
|
skip: string;
|
|
30
28
|
} | null;
|
|
31
|
-
/** The nearest tsconfig.json at or above `dir`, never past the git top. */
|
|
32
|
-
export declare function findTsconfig(dir: string): string | null;
|
|
33
29
|
/**
|
|
34
30
|
* How to type-check `absFile`: the setup, a reason to skip, or null when the
|
|
35
31
|
* file is no type target or no tsconfig covers it. Never throws.
|
|
@@ -11,7 +11,7 @@ const CONFIG_NAMES = ['eslint.config.js', 'eslint.config.mjs', 'eslint.config.cj
|
|
|
11
11
|
/** Files the lint step looks at. Anything else is never linted. */
|
|
12
12
|
const LINTABLE = /\.(?:[cm]?[jt]sx?|vue)$/;
|
|
13
13
|
/** The nearest folder at or above `dir` holding an eslint flat config, never past the git top. */
|
|
14
|
-
|
|
14
|
+
function findEslintConfigDir(dir) {
|
|
15
15
|
let at = resolve(dir);
|
|
16
16
|
for (;;) {
|
|
17
17
|
if (CONFIG_NAMES.some(name => existsSync(join(at, name))))
|
|
@@ -66,7 +66,7 @@ export function detectLint(absFile) {
|
|
|
66
66
|
const TYPEABLE = /\.(?:[cm]?tsx?)$/;
|
|
67
67
|
const DECLARATION = /\.d\.[cm]?ts$/;
|
|
68
68
|
/** The nearest tsconfig.json at or above `dir`, never past the git top. */
|
|
69
|
-
|
|
69
|
+
function findTsconfig(dir) {
|
|
70
70
|
let at = resolve(dir);
|
|
71
71
|
for (;;) {
|
|
72
72
|
const file = join(at, 'tsconfig.json');
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ToolContext } from '../../index.js';
|
|
2
|
-
/** How long a write waits for its checks before handing them to the late lane. */
|
|
3
|
-
export declare const BUDGET_MS = 300;
|
|
4
2
|
/**
|
|
5
3
|
* The checks report for the file `abs` the run just wrote, or null: nothing
|
|
6
4
|
* new, nothing to check, or the checks are still running (then they reach the
|
|
@@ -20,7 +20,7 @@ import { clearRules, RULES_FILE, ruleProblems, rulesFor } from './rules.js';
|
|
|
20
20
|
// NORDHAVN_SONAR_DIAGNOSTICS=0 switches all of it off, NORDHAVN_SONAR_TYPES=0
|
|
21
21
|
// only the types. See docs/runner.md.
|
|
22
22
|
/** How long a write waits for its checks before handing them to the late lane. */
|
|
23
|
-
|
|
23
|
+
const BUDGET_MS = 300;
|
|
24
24
|
/** Late reports per run, by file and check: the newest write of a file wins. */
|
|
25
25
|
const late = new Map();
|
|
26
26
|
/** The newest write per file: a late report of an older write is dropped. */
|
|
@@ -10,10 +10,6 @@ export type CheckOutcome = {
|
|
|
10
10
|
error: string;
|
|
11
11
|
crashed?: boolean;
|
|
12
12
|
};
|
|
13
|
-
/** Heap cap of a typescript worker in MB: a language service of a big project can take gigabytes. */
|
|
14
|
-
export declare function typesHeapMb(): number;
|
|
15
|
-
/** Most typescript workers at once: the language service of a Nuxt server app alone holds about 2 GB. */
|
|
16
|
-
export declare function typesWorkerCap(): number;
|
|
17
13
|
/** Lint `text` as the file `filePath` with the project's eslint. Never rejects. */
|
|
18
14
|
export declare function lintInWorker(setup: LintSetup, filePath: string, text: string): Promise<CheckOutcome>;
|
|
19
15
|
/** Type-check `text` as the file `filePath` with the project's typescript. Never rejects. */
|
|
@@ -118,12 +118,12 @@ class Pool {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
/** Heap cap of a typescript worker in MB: a language service of a big project can take gigabytes. */
|
|
121
|
-
|
|
121
|
+
function typesHeapMb() {
|
|
122
122
|
const raw = Number(process.env.NORDHAVN_SONAR_TYPES_MAX_MB);
|
|
123
123
|
return Number.isFinite(raw) && raw >= 256 ? raw : 4096;
|
|
124
124
|
}
|
|
125
125
|
/** Most typescript workers at once: the language service of a Nuxt server app alone holds about 2 GB. */
|
|
126
|
-
|
|
126
|
+
function typesWorkerCap() {
|
|
127
127
|
const raw = Number(process.env.NORDHAVN_SONAR_TYPES_WORKERS);
|
|
128
128
|
return Number.isInteger(raw) && raw >= 1 ? raw : 2;
|
|
129
129
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type FsSonarQuery, type FsSonarResult, type FsSonarStatus } from '@nordhavnhq/runner-runtime';
|
|
2
2
|
import type { Config } from '../../config.js';
|
|
3
3
|
import { type LoadSonarOptions } from './index.js';
|
|
4
|
-
/** How long a query waits for the first build of a checkout: under the studio's 30 s for an `fs:sonar` answer. */
|
|
5
|
-
export declare const SONAR_FIRST_BUILD_WAIT_MS = 25000;
|
|
6
4
|
/** What an `fs:sonar` frame gets back: the index's answer, or its status. */
|
|
7
5
|
export interface SonarAnswer {
|
|
8
6
|
sonar?: FsSonarResult;
|
|
@@ -21,7 +21,7 @@ import { rememberSonarRoot } from './roots.js';
|
|
|
21
21
|
// runner's folder roots.
|
|
22
22
|
const execFileP = promisify(execFile);
|
|
23
23
|
/** How long a query waits for the first build of a checkout: under the studio's 30 s for an `fs:sonar` answer. */
|
|
24
|
-
|
|
24
|
+
const SONAR_FIRST_BUILD_WAIT_MS = 25_000;
|
|
25
25
|
/** The index of `base`, built first when it has no usable one (FS_SONAR_NOT_BUILT when that does not finish in time or fails). */
|
|
26
26
|
async function loadOrBuild(base, load) {
|
|
27
27
|
const opts = { cacheDir: load.cacheDir, now: load.now };
|
package/dist/tools/console.d.ts
CHANGED
|
@@ -25,12 +25,6 @@ export declare function commandEnv(context: ToolContext | undefined, base: strin
|
|
|
25
25
|
* result that is no JSON object gets the warning as a last line.
|
|
26
26
|
*/
|
|
27
27
|
export declare function withProjectNode(result: string, node: ProjectNode | null): Promise<string>;
|
|
28
|
-
/**
|
|
29
|
-
* Whether this runner lets an agent use sudo: only when the operator says so
|
|
30
|
-
* with `NORDHAVN_ALLOW_SUDO=1`, as the container image does (the agent owns
|
|
31
|
-
* that machine, docs/runner.md). On a person's own machine it stays blocked.
|
|
32
|
-
*/
|
|
33
|
-
export declare function sudoAllowed(): boolean;
|
|
34
28
|
export declare function isBlocked(command: string, options?: {
|
|
35
29
|
allowSudo?: boolean;
|
|
36
30
|
}): string | null;
|
package/dist/tools/console.js
CHANGED
|
@@ -195,7 +195,7 @@ export async function withProjectNode(result, node) {
|
|
|
195
195
|
* with `NORDHAVN_ALLOW_SUDO=1`, as the container image does (the agent owns
|
|
196
196
|
* that machine, docs/runner.md). On a person's own machine it stays blocked.
|
|
197
197
|
*/
|
|
198
|
-
|
|
198
|
+
function sudoAllowed() {
|
|
199
199
|
return process.env.NORDHAVN_ALLOW_SUDO === '1';
|
|
200
200
|
}
|
|
201
201
|
export function isBlocked(command, options = {}) {
|
package/dist/tools/sonar.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import type { ToolContext } from './index.js';
|
|
|
3
3
|
import { type LoadSonarOptions } from './_sonar/index.js';
|
|
4
4
|
/** What the tool says while the index of the checkout is still being built: the agent goes on without it for now. */
|
|
5
5
|
export declare const SONAR_BUILDING_ANSWER = "Error: sonar has no usable index for this checkout yet; a build runs in the background, ask again in a minute. Meanwhile go on with runner_grep and runner_outline.";
|
|
6
|
-
/** What the tool says when the index could not be built (the Sonar view shows why). */
|
|
7
|
-
export declare const SONAR_BUILD_FAILED_ANSWER = "Error: sonar could not build an index for this checkout (the Sonar view in the code app shows why). Go on with runner_grep and runner_outline.";
|
|
8
6
|
/** The tool with a configurable index load (tests pass a temp cacheDir, and how long to wait for a build). */
|
|
9
7
|
export declare function runSonar(params: Record<string, unknown>, context: ToolContext | undefined, load?: LoadSonarOptions & {
|
|
10
8
|
rebuildWaitMs?: number;
|
package/dist/tools/sonar.js
CHANGED
|
@@ -172,7 +172,7 @@ const SONAR_REBUILD_WAIT_MS = 15_000;
|
|
|
172
172
|
/** What the tool says while the index of the checkout is still being built: the agent goes on without it for now. */
|
|
173
173
|
export const SONAR_BUILDING_ANSWER = 'Error: sonar has no usable index for this checkout yet; a build runs in the background, ask again in a minute. Meanwhile go on with runner_grep and runner_outline.';
|
|
174
174
|
/** What the tool says when the index could not be built (the Sonar view shows why). */
|
|
175
|
-
|
|
175
|
+
const SONAR_BUILD_FAILED_ANSWER = 'Error: sonar could not build an index for this checkout (the Sonar view in the code app shows why). Go on with runner_grep and runner_outline.';
|
|
176
176
|
const notBuiltAnswer = (root, load) => sonarStatus(root, { cacheDir: load.cacheDir }).state === 'building' ? SONAR_BUILDING_ANSWER : SONAR_BUILD_FAILED_ANSWER;
|
|
177
177
|
/** The index of `root`, built again first when it has no usable one; throws SonarNotBuiltError when that does not finish in time or fails. */
|
|
178
178
|
async function loadOrRebuild(root, load) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** The scope the runner is published under, and the one it had before. */
|
|
2
2
|
export declare const PACKAGE_SCOPE = "@nordhavnhq";
|
|
3
|
-
/** Installs from before the scope rename; an update moves them to PACKAGE_SCOPE. */
|
|
4
|
-
export declare const LEGACY_PACKAGE_SCOPE = "@justmade";
|
|
5
3
|
export type InstallKind = {
|
|
6
4
|
kind: 'global';
|
|
7
5
|
/** The npm prefix the runner was installed into (`npm i -g --prefix <prefix>`). */
|
|
@@ -11,7 +11,7 @@ import { readRunnerVersion } from '../version.js';
|
|
|
11
11
|
/** The scope the runner is published under, and the one it had before. */
|
|
12
12
|
export const PACKAGE_SCOPE = '@nordhavnhq';
|
|
13
13
|
/** Installs from before the scope rename; an update moves them to PACKAGE_SCOPE. */
|
|
14
|
-
|
|
14
|
+
const LEGACY_PACKAGE_SCOPE = '@justmade';
|
|
15
15
|
export function detectInstallKind(opts = {}) {
|
|
16
16
|
const entry = opts.entry ?? process.argv[1];
|
|
17
17
|
const env = opts.env ?? process.env;
|
|
@@ -6,8 +6,6 @@ export interface ReleaseManifest {
|
|
|
6
6
|
size?: number;
|
|
7
7
|
releasedAt?: string;
|
|
8
8
|
}
|
|
9
|
-
/** The package the runner is published as. */
|
|
10
|
-
export declare const RUNNER_PACKAGE = "@nordhavnhq/runner";
|
|
11
9
|
/**
|
|
12
10
|
* Where this runner reads the latest release from: the npm registry
|
|
13
11
|
* (NORDHAVN_UPDATE_REGISTRY overrides it), or NORDHAVN_UPDATE_MANIFEST_URL
|
package/dist/update/manifest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
/** The package the runner is published as. */
|
|
3
|
-
|
|
3
|
+
const RUNNER_PACKAGE = '@nordhavnhq/runner';
|
|
4
4
|
const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
5
5
|
const FETCH_TIMEOUT_MS = 30_000;
|
|
6
6
|
const DOWNLOAD_TIMEOUT_MS = 10 * 60_000;
|
package/dist/update/updater.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { ReleaseManifest } from './manifest.js';
|
|
2
2
|
import type { PerformUpdateResult } from './install.js';
|
|
3
|
-
/** How often a running runtime asks npm for a newer release (a small JSON request). */
|
|
4
|
-
export declare const UPDATE_CHECK_INTERVAL_MS: number;
|
|
5
|
-
/** The first check after start: the studio's announcement on connect may be missing or behind. */
|
|
6
|
-
export declare const UPDATE_FIRST_CHECK_MS: number;
|
|
7
3
|
export interface UpdaterDeps {
|
|
8
4
|
currentVersion: string;
|
|
9
5
|
/** Global install and not opted out: install on its own. Otherwise only `requestRestart` acts. */
|
package/dist/update/updater.js
CHANGED
|
@@ -7,9 +7,9 @@ import { isNewerVersion } from '../utils/format.js';
|
|
|
7
7
|
// have started during the install). A failure is logged and left for the next
|
|
8
8
|
// trigger; the process keeps running the version it has.
|
|
9
9
|
/** How often a running runtime asks npm for a newer release (a small JSON request). */
|
|
10
|
-
|
|
10
|
+
const UPDATE_CHECK_INTERVAL_MS = 60 * 60_000;
|
|
11
11
|
/** The first check after start: the studio's announcement on connect may be missing or behind. */
|
|
12
|
-
|
|
12
|
+
const UPDATE_FIRST_CHECK_MS = 2 * 60_000;
|
|
13
13
|
/** After a failed attempt, triggers within this window are ignored (the periodic check is not). */
|
|
14
14
|
const FAILURE_BACKOFF_MS = 60 * 60_000;
|
|
15
15
|
export class Updater {
|
package/dist/utils/format.js
CHANGED
|
@@ -25,7 +25,7 @@ export const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
|
25
25
|
export const bold = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
26
26
|
/** Primary highlight - bold in the terminal's foreground colour. Use for
|
|
27
27
|
* headings and primary highlights. */
|
|
28
|
-
export const accent = bold;
|
|
28
|
+
export const accent = (s) => bold(s);
|
|
29
29
|
/** Secondary highlight - gray-300, for values, names and tool names. */
|
|
30
30
|
export const cyan = rgb(209, 213, 219);
|
|
31
31
|
/** Success / agent-online - green-500 (--color-agent-online). */
|
package/dist/version.json
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export declare const LOCAL_LIVE_PROTOCOL = 1;
|
|
2
|
-
export declare const LOCAL_LIVE_MAX_CLIENTS = 8;
|
|
3
|
-
export declare const CLOSE_UNAUTHORISED = 4401;
|
|
4
|
-
export declare const CLOSE_TOO_MANY = 4429;
|
|
5
2
|
export interface LocalLiveAgent {
|
|
6
3
|
agentSlug: string;
|
|
7
4
|
organisationSlug: string | null;
|
|
@@ -17,9 +17,9 @@ import { createLiveController, OPEN_REFUSED } from './live.js';
|
|
|
17
17
|
// it; a client without the token is closed with 4401. Opening a window stays a
|
|
18
18
|
// studio action (it needs the person's identity): browser:open is refused.
|
|
19
19
|
export const LOCAL_LIVE_PROTOCOL = 1;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const LOCAL_LIVE_MAX_CLIENTS = 8;
|
|
21
|
+
const CLOSE_UNAUTHORISED = 4401;
|
|
22
|
+
const CLOSE_TOO_MANY = 4429;
|
|
23
23
|
/** Frames above this backlog are dropped for that client (a slow reader). */
|
|
24
24
|
const MAX_BUFFERED_BYTES = 8 * 1024 * 1024;
|
|
25
25
|
const agentKey = (a) => `${a.organisationSlug ?? ''}/${a.agentSlug}`;
|
|
@@ -8,7 +8,6 @@ export declare const MARK_LABEL_MAX = 140;
|
|
|
8
8
|
export type MarkLayer = 'marks' | 'pick';
|
|
9
9
|
/** What the agent thinks of the element: drawn in its own colour. */
|
|
10
10
|
export type MarkTone = 'issue' | 'good' | 'info';
|
|
11
|
-
export declare const MARK_TONES: readonly MarkTone[];
|
|
12
11
|
export interface MarkInput {
|
|
13
12
|
ref?: string;
|
|
14
13
|
selector?: string;
|
|
@@ -11,7 +11,7 @@ export const MARKS_MAX = 12;
|
|
|
11
11
|
export const MARK_LABEL_MAX = 140;
|
|
12
12
|
const RESOLVE_TIMEOUT_MS = 3_000;
|
|
13
13
|
const HOST_IDS = { marks: '__justmade_marks__', pick: '__justmade_pick__' };
|
|
14
|
-
|
|
14
|
+
const MARK_TONES = ['issue', 'good', 'info'];
|
|
15
15
|
const TONE_COLOURS = {
|
|
16
16
|
default: '#ff3d7f',
|
|
17
17
|
issue: '#ef4444',
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { ToolContext, ToolDefinition } from '@nordhavnhq/runner-runtime';
|
|
2
|
-
import { type BrowserSession } from './session.js';
|
|
3
2
|
type Exec = (params: Record<string, unknown>, context?: ToolContext) => Promise<string>;
|
|
4
|
-
/**
|
|
5
|
-
* The console errors since the agent last read the logs, split by source: the
|
|
6
|
-
* site's own scripts, or third parties (trackers and ads can log dozens).
|
|
7
|
-
*/
|
|
8
|
-
export declare function unreadConsoleErrors(session: BrowserSession, pageUrl: string): string | null;
|
|
9
3
|
export declare const pageTools: {
|
|
10
4
|
definition: ToolDefinition;
|
|
11
5
|
execute: Exec;
|
|
@@ -200,7 +200,7 @@ function originOf(url) {
|
|
|
200
200
|
* The console errors since the agent last read the logs, split by source: the
|
|
201
201
|
* site's own scripts, or third parties (trackers and ads can log dozens).
|
|
202
202
|
*/
|
|
203
|
-
|
|
203
|
+
function unreadConsoleErrors(session, pageUrl) {
|
|
204
204
|
const own = originOf(pageUrl);
|
|
205
205
|
let mine = 0;
|
|
206
206
|
let third = 0;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { Locator, Page } from 'playwright-core';
|
|
2
2
|
import type { ToolContext } from '@nordhavnhq/runner-runtime';
|
|
3
|
-
/**
|
|
4
|
-
* Wait (at most PAINT_WAIT_MS) for the fonts and for the images in the
|
|
5
|
-
* viewport that are still loading, then two frames so they are painted.
|
|
6
|
-
* DOMContentLoaded alone gave shots with empty thumbnails. Never throws.
|
|
7
|
-
*/
|
|
8
|
-
export declare function waitForPaint(page: Page): Promise<void>;
|
|
9
3
|
/** Screenshot the page (or one element) as JPEG and either inline it into the
|
|
10
4
|
* next tool result (default) or upload it as a permanent project file. */
|
|
11
5
|
export declare function attachScreenshot(page: Page, params: Record<string, unknown>, context: ToolContext | undefined, base: Record<string, unknown>, nameHint: string, element?: Locator): Promise<Record<string, unknown>>;
|
|
@@ -36,7 +36,7 @@ const PAINT_WAIT_MS = 3_000;
|
|
|
36
36
|
* viewport that are still loading, then two frames so they are painted.
|
|
37
37
|
* DOMContentLoaded alone gave shots with empty thumbnails. Never throws.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
async function waitForPaint(page) {
|
|
40
40
|
// A dialog that is still open blocks evaluate itself: cap it here too.
|
|
41
41
|
let timer;
|
|
42
42
|
const cap = new Promise((resolve) => { timer = setTimeout(resolve, PAINT_WAIT_MS + 500); });
|
|
@@ -10,14 +10,6 @@ export interface Target {
|
|
|
10
10
|
export declare function resolveTarget(page: Page, params: Record<string, unknown>, required?: boolean): Target | {
|
|
11
11
|
error: string;
|
|
12
12
|
} | null;
|
|
13
|
-
/** The error line for a target that is not on the page, by how it was named. */
|
|
14
|
-
export declare function targetGoneError(target: Target): string;
|
|
15
|
-
/**
|
|
16
|
-
* Null when the target is in the page (given a short moment to appear), else
|
|
17
|
-
* the error line. Without this check an action on a target that is not there
|
|
18
|
-
* hangs for the whole action timeout before it fails.
|
|
19
|
-
*/
|
|
20
|
-
export declare function checkTargetAttached(target: Target): Promise<string | null>;
|
|
21
13
|
/** resolveTarget, plus the check that the target is in the page at all. */
|
|
22
14
|
export declare function resolveAttachedTarget(page: Page, params: Record<string, unknown>, required?: boolean): Promise<Target | {
|
|
23
15
|
error: string;
|
|
@@ -15,7 +15,7 @@ export function resolveTarget(page, params, required = true) {
|
|
|
15
15
|
return { error: 'Error: Pass `ref` (from runner_browser_snapshot) or `selector`.' };
|
|
16
16
|
}
|
|
17
17
|
/** The error line for a target that is not on the page, by how it was named. */
|
|
18
|
-
|
|
18
|
+
function targetGoneError(target) {
|
|
19
19
|
return target.kind === 'ref'
|
|
20
20
|
? `Error: ${target.name} is not on the page any more. Take a fresh runner_browser_snapshot: refs go stale when the page changes.`
|
|
21
21
|
: `Error: Nothing on the page matches ${target.name}. Check the selector against a runner_browser_snapshot.`;
|
|
@@ -25,7 +25,7 @@ export function targetGoneError(target) {
|
|
|
25
25
|
* the error line. Without this check an action on a target that is not there
|
|
26
26
|
* hangs for the whole action timeout before it fails.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
async function checkTargetAttached(target) {
|
|
29
29
|
try {
|
|
30
30
|
await target.locator.waitFor({ state: 'attached', timeout: ATTACH_WAIT_MS });
|
|
31
31
|
return null;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { ToolContext, ToolDefinition } from '@nordhavnhq/runner-runtime';
|
|
2
|
-
import { type BrowserSession
|
|
2
|
+
import { type BrowserSession } from './session.js';
|
|
3
3
|
type Exec = (params: Record<string, unknown>, context?: ToolContext) => Promise<string>;
|
|
4
|
-
export declare const TOUR_STOPS_MAX = 12;
|
|
5
|
-
/** Validate `stops`. */
|
|
6
|
-
export declare function readStops(raw: unknown): TourStop[] | {
|
|
7
|
-
error: string;
|
|
8
|
-
};
|
|
9
|
-
/** The page a stop is on: its own url, else that of the nearest stop before it, else the start. */
|
|
10
|
-
export declare function stopUrl(tour: TourState, index: number): string;
|
|
11
4
|
/** Put a stop on screen: go to its page when the tab is elsewhere, draw its marks. */
|
|
12
5
|
export declare function goToStop(session: BrowserSession, index: number): Promise<void>;
|
|
13
6
|
/** Stop the tour (the person closed it, or the agent moved on): its marks go too. */
|
|
@@ -2,7 +2,7 @@ import { NAV_TIMEOUT_MS, activePage, emit, ensureSession, } from './session.js';
|
|
|
2
2
|
import { MARKS_MAX, MARK_LABEL_MAX, clearMarks, drawMarks, readMarks } from './marks.js';
|
|
3
3
|
import { errorLine, readTrimmed } from './params.js';
|
|
4
4
|
import { liveUrlOf } from './show.js';
|
|
5
|
-
|
|
5
|
+
const TOUR_STOPS_MAX = 12;
|
|
6
6
|
const NOTE_MAX = 300;
|
|
7
7
|
const TOUR_SCHEMES = new Set(['http:', 'https:', 'file:']);
|
|
8
8
|
const tourDefinition = {
|
|
@@ -76,7 +76,7 @@ function readStop(raw, n, navigated) {
|
|
|
76
76
|
return { url, note, marks: (marks ?? []).map(m => ({ ...m, tone: m.tone ?? 'info' })), missed: [] };
|
|
77
77
|
}
|
|
78
78
|
/** Validate `stops`. */
|
|
79
|
-
|
|
79
|
+
function readStops(raw) {
|
|
80
80
|
if (!Array.isArray(raw) || raw.length === 0)
|
|
81
81
|
return { error: 'Error: Pass `stops`: at least one { note, url?, marks? }.' };
|
|
82
82
|
if (raw.length > TOUR_STOPS_MAX)
|
|
@@ -94,7 +94,7 @@ export function readStops(raw) {
|
|
|
94
94
|
return stops;
|
|
95
95
|
}
|
|
96
96
|
/** The page a stop is on: its own url, else that of the nearest stop before it, else the start. */
|
|
97
|
-
|
|
97
|
+
function stopUrl(tour, index) {
|
|
98
98
|
for (let i = index; i >= 0; i--) {
|
|
99
99
|
const url = tour.stops[i]?.url;
|
|
100
100
|
if (url)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhavnhq/runner-browser",
|
|
3
|
-
"version": "0.106.
|
|
3
|
+
"version": "0.106.2",
|
|
4
4
|
"description": "Nordhavn OS agent browser: Playwright sessions, the browser tools, the confirm-first guard and the live view, for the runner and the browser host",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhavnhq/runner",
|
|
3
|
-
"version": "0.106.
|
|
3
|
+
"version": "0.106.2",
|
|
4
4
|
"description": "Nordhavn OS runner CLI: runs agents headless on a host and supplies the host tools",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
26
26
|
"@vscode/ripgrep": "^1.18.0",
|
|
27
27
|
"mysql2": "^3.24.6",
|
|
28
|
-
"@nordhavnhq/runner-runtime": "0.106.
|
|
29
|
-
"@nordhavnhq/runner-browser": "0.106.
|
|
28
|
+
"@nordhavnhq/runner-runtime": "0.106.2",
|
|
29
|
+
"@nordhavnhq/runner-browser": "0.106.2"
|
|
30
30
|
},
|
|
31
31
|
"bundleDependencies": [
|
|
32
32
|
"@nordhavnhq/runner-runtime",
|