@reticlehq/core 3.7.0 → 3.8.0

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.
Files changed (108) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/drive-script.d.ts +64 -64
  4. package/dist/artifacts/flow-constants.d.ts +15 -0
  5. package/dist/artifacts/flow-constants.js +15 -0
  6. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  7. package/dist/artifacts/flow-results.d.ts +11 -0
  8. package/dist/artifacts/flow-types.d.ts +164 -118
  9. package/dist/artifacts/flow-types.js +12 -0
  10. package/dist/artifacts/harness-credits.d.ts +6 -3
  11. package/dist/artifacts/harness-credits.js +9 -6
  12. package/dist/artifacts/harness-map.d.ts +6 -6
  13. package/dist/artifacts/impact.d.ts +77 -80
  14. package/dist/artifacts/impact.js +34 -17
  15. package/dist/artifacts/journal.d.ts +25 -6
  16. package/dist/artifacts/journal.js +13 -0
  17. package/dist/artifacts/prompt-context.d.ts +12 -0
  18. package/dist/artifacts/prompt-context.js +14 -3
  19. package/dist/graph/app-graph.d.ts +137 -0
  20. package/dist/graph/app-graph.js +498 -0
  21. package/dist/hooks/hook-events.d.ts +22 -22
  22. package/dist/hud-entry.js +1 -1
  23. package/dist/identity/checkout.d.ts +41 -0
  24. package/dist/identity/checkout.js +118 -0
  25. package/dist/identity/state-dir.d.ts +23 -0
  26. package/dist/identity/state-dir.js +43 -0
  27. package/dist/index.d.ts +10 -0
  28. package/dist/index.js +10 -0
  29. package/dist/onboarding.d.ts +22 -1
  30. package/dist/onboarding.js +19 -0
  31. package/dist/registry/dev-server-registry.d.ts +2 -2
  32. package/dist/schema/event-message.json +3 -1
  33. package/dist/schema/event-payloads.json +116 -1
  34. package/dist/schema/event-type.json +3 -1
  35. package/dist/schema/hello-message.json +21 -0
  36. package/dist/schema/reticle-event.json +3 -1
  37. package/dist/schema/reticle-message.json +24 -1
  38. package/dist/telemetry-bug.d.ts +6 -6
  39. package/dist/telemetry-entry.d.ts +1 -1
  40. package/dist/telemetry-entry.js +1 -1
  41. package/dist/telemetry-feedback.d.ts +14 -0
  42. package/dist/telemetry-feedback.js +19 -0
  43. package/dist/telemetry-refusal.d.ts +2 -2
  44. package/dist/telemetry-session.d.ts +23 -8
  45. package/dist/telemetry-session.js +15 -4
  46. package/dist/telemetry-signals.d.ts +227 -9
  47. package/dist/telemetry-signals.js +88 -1
  48. package/dist/telemetry.d.ts +379 -72
  49. package/dist/telemetry.js +71 -5
  50. package/dist/verdict/check-sentence.d.ts +34 -0
  51. package/dist/verdict/check-sentence.js +228 -0
  52. package/dist/verdict/consequence.d.ts +15 -0
  53. package/dist/verdict/consequence.js +11 -0
  54. package/dist/verdict/findings.d.ts +10 -0
  55. package/dist/verdict/findings.js +13 -0
  56. package/dist/verdict/instrumentation-coverage.d.ts +3 -34
  57. package/dist/verdict/instrumentation-coverage.js +14 -58
  58. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  59. package/dist/verdict/instrumentation-gap.js +64 -0
  60. package/dist/verdict/predicate-tree.d.ts +2 -0
  61. package/dist/verdict/predicate-tree.js +16 -0
  62. package/dist/verdict/predicate.d.ts +2 -1
  63. package/dist/verdict/predicate.js +103 -12
  64. package/dist/verdict/property-assertion.d.ts +2 -2
  65. package/dist/verdict/run-report.d.ts +166 -0
  66. package/dist/verdict/run-report.js +53 -0
  67. package/dist/verdict/security.d.ts +36 -2
  68. package/dist/verdict/security.js +94 -14
  69. package/dist/verdict/verification-run.d.ts +95 -38
  70. package/dist/verdict/verification-run.js +33 -2
  71. package/dist/verdict/verify-progress.d.ts +6 -6
  72. package/dist/wire/constants/constants.d.ts +56 -141
  73. package/dist/wire/constants/constants.js +64 -144
  74. package/dist/wire/constants/discovery.d.ts +4 -4
  75. package/dist/wire/constants/discovery.js +4 -4
  76. package/dist/wire/constants/event-types.d.ts +35 -1
  77. package/dist/wire/constants/event-types.js +33 -1
  78. package/dist/wire/constants/hud-controls.js +0 -2
  79. package/dist/wire/constants/hud-use.d.ts +4 -0
  80. package/dist/wire/constants/hud-use.js +4 -0
  81. package/dist/wire/constants/mcp-wire.d.ts +16 -0
  82. package/dist/wire/constants/mcp-wire.js +16 -0
  83. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  84. package/dist/wire/constants/response-body-reason.js +18 -0
  85. package/dist/wire/constants/reticle-env.d.ts +138 -0
  86. package/dist/wire/constants/reticle-env.js +138 -0
  87. package/dist/wire/constants/session-constants.d.ts +11 -0
  88. package/dist/wire/constants/session-constants.js +11 -0
  89. package/dist/wire/event-payloads.d.ts +150 -36
  90. package/dist/wire/event-payloads.js +83 -16
  91. package/dist/wire/messages.d.ts +102 -36
  92. package/dist/wire/messages.js +16 -0
  93. package/dist/wire/narrow.d.ts +6 -0
  94. package/dist/wire/narrow.js +26 -0
  95. package/dist/wire/next-step.d.ts +90 -0
  96. package/dist/wire/next-step.js +37 -0
  97. package/dist/wire/platform-link.d.ts +7 -0
  98. package/dist/wire/platform-link.js +12 -6
  99. package/dist/wire/production/activation-ticket.d.ts +64 -0
  100. package/dist/wire/production/activation-ticket.js +148 -0
  101. package/dist/wire/production/hello-mode.d.ts +35 -0
  102. package/dist/wire/production/hello-mode.js +32 -0
  103. package/dist/wire/production/production-policy.d.ts +138 -0
  104. package/dist/wire/production/production-policy.js +133 -0
  105. package/dist/wire/tool-names.d.ts +2 -0
  106. package/dist/wire/tool-names.js +2 -0
  107. package/dist/wire/types.d.ts +73 -48
  108. package/package.json +5 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Which git checkout a directory is in, and which checkout is the main one.
3
+ *
4
+ * Agents work in git worktrees. Every worktree of a project is the same project, so it must find
5
+ * the same config, the same daemon and the same cloud link as the main checkout. But it must keep
6
+ * its own results. This reads the two facts that make that possible from the `.git` entry, with no
7
+ * `git` process: a worktree's `.git` is a file that says `gitdir: <main>/.git/worktrees/<name>`.
8
+ *
9
+ * Pure. The caller supplies `readFile` (undefined for a missing file), so core stays free of Node.
10
+ */
11
+ /** A git checkout, as read from disk. */
12
+ export interface Checkout {
13
+ /** The top directory of this checkout. */
14
+ root: string;
15
+ /** The top directory of the main checkout. Equals `root` when there is no other. */
16
+ mainRoot: string;
17
+ /**
18
+ * The repository's own git directory, which every worktree of it shares (`git rev-parse
19
+ * --git-common-dir`). Two checkouts are worktrees of one repository when this is equal. A bare
20
+ * repository has worktrees but no main checkout, so `mainRoot` cannot tell them apart.
21
+ */
22
+ commonDir: string;
23
+ /** The branch checked out. Absent on a detached HEAD. */
24
+ branch?: string;
25
+ /** True for a linked worktree (`git worktree add`). */
26
+ linked: boolean;
27
+ }
28
+ export declare function checkoutOf(dir: string, readFile: (path: string) => string | undefined): Checkout | undefined;
29
+ /**
30
+ * The same path in the main checkout, when `path` sits in a linked worktree; otherwise undefined.
31
+ *
32
+ * What a fresh worktree does not have yet is often in the main checkout: an uncommitted or
33
+ * git-ignored `.reticle/cloud.json`, or a flow saved there and not yet committed. Callers read the
34
+ * twin only as a fallback, and never write to it.
35
+ */
36
+ export declare function mainCheckoutTwin(path: string, readFile: (path: string) => string | undefined): string | undefined;
37
+ /**
38
+ * True when two paths that `checkoutOf` returned name one directory. A Windows path ignores case, and
39
+ * the same folder arrives as `C:\wt\a` from a shell and as `C:/wt/a` from Vite and git.
40
+ */
41
+ export declare function samePath(a: string, b: string): boolean;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Which git checkout a directory is in, and which checkout is the main one.
3
+ *
4
+ * Agents work in git worktrees. Every worktree of a project is the same project, so it must find
5
+ * the same config, the same daemon and the same cloud link as the main checkout. But it must keep
6
+ * its own results. This reads the two facts that make that possible from the `.git` entry, with no
7
+ * `git` process: a worktree's `.git` is a file that says `gitdir: <main>/.git/worktrees/<name>`.
8
+ *
9
+ * Pure. The caller supplies `readFile` (undefined for a missing file), so core stays free of Node.
10
+ */
11
+ /** How far up to walk for a `.git`. A backstop for a deep tree, not a policy. */
12
+ const MAX_UP_LEVELS = 50;
13
+ const GITDIR_PREFIX = 'gitdir:';
14
+ const BRANCH_PREFIX = 'ref: refs/heads/';
15
+ const WORKTREES_SEGMENT = 'worktrees';
16
+ const GIT_DIR_NAME = '.git';
17
+ /** A path that starts with a drive letter. */
18
+ const WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
19
+ export function checkoutOf(dir, readFile) {
20
+ const sep = dir.includes('\\') ? '\\' : '/';
21
+ let current = trimEnd(dir, sep);
22
+ for (let level = 0; level <= MAX_UP_LEVELS; level += 1) {
23
+ const head = readFile(`${current}${sep}${GIT_DIR_NAME}${sep}HEAD`);
24
+ if (head !== undefined) {
25
+ return withBranch({
26
+ root: current,
27
+ mainRoot: current,
28
+ commonDir: `${current}${sep}${GIT_DIR_NAME}`,
29
+ linked: false,
30
+ }, head);
31
+ }
32
+ const pointer = readFile(`${current}${sep}${GIT_DIR_NAME}`);
33
+ if (pointer !== undefined && pointer.trim().startsWith(GITDIR_PREFIX)) {
34
+ return linkedCheckout(current, pointer.trim().slice(GITDIR_PREFIX.length).trim(), sep, readFile);
35
+ }
36
+ const parent = parentOf(current, sep);
37
+ if (parent === undefined)
38
+ return undefined;
39
+ current = parent;
40
+ }
41
+ return undefined;
42
+ }
43
+ /**
44
+ * The same path in the main checkout, when `path` sits in a linked worktree; otherwise undefined.
45
+ *
46
+ * What a fresh worktree does not have yet is often in the main checkout: an uncommitted or
47
+ * git-ignored `.reticle/cloud.json`, or a flow saved there and not yet committed. Callers read the
48
+ * twin only as a fallback, and never write to it.
49
+ */
50
+ export function mainCheckoutTwin(path, readFile) {
51
+ const checkout = checkoutOf(path, readFile);
52
+ if (checkout === undefined || checkout.root === checkout.mainRoot)
53
+ return undefined;
54
+ return `${checkout.mainRoot}${path.slice(checkout.root.length)}`;
55
+ }
56
+ /**
57
+ * True when two paths that `checkoutOf` returned name one directory. A Windows path ignores case, and
58
+ * the same folder arrives as `C:\wt\a` from a shell and as `C:/wt/a` from Vite and git.
59
+ */
60
+ export function samePath(a, b) {
61
+ if (a === b)
62
+ return true;
63
+ if (!WINDOWS_PATH.test(a) || !WINDOWS_PATH.test(b))
64
+ return false;
65
+ return a.replaceAll('\\', '/').toLowerCase() === b.replaceAll('\\', '/').toLowerCase();
66
+ }
67
+ function linkedCheckout(root, gitdir, sep, readFile) {
68
+ const absolute = resolvePath(root, gitdir.split(/[\\/]/).join(sep), sep);
69
+ const parts = absolute.split(sep);
70
+ // `<main>/.git/worktrees/<name>`: a worktree. Anything else (`.git/modules/x`) is a submodule.
71
+ const isWorktree = WORKTREES_SEGMENT === parts[parts.length - 2];
72
+ const gitDirOfRepo = parts.slice(0, -2);
73
+ const commonDir = isWorktree ? gitDirOfRepo.join(sep) : absolute;
74
+ // A bare repository has no main checkout to share; the worktree is its own main checkout.
75
+ const mainRoot = isWorktree && GIT_DIR_NAME === gitDirOfRepo[gitDirOfRepo.length - 1]
76
+ ? gitDirOfRepo.slice(0, -1).join(sep)
77
+ : root;
78
+ const head = readFile(`${absolute}${sep}HEAD`);
79
+ const checkout = { root, mainRoot, commonDir, linked: isWorktree };
80
+ return head === undefined ? checkout : withBranch(checkout, head);
81
+ }
82
+ function withBranch(checkout, head) {
83
+ const ref = head.trim();
84
+ return ref.startsWith(BRANCH_PREFIX)
85
+ ? { ...checkout, branch: ref.slice(BRANCH_PREFIX.length) }
86
+ : checkout;
87
+ }
88
+ /** `rel` against `base`, with `.` and `..` folded. An absolute `rel` (POSIX or drive) wins. */
89
+ function resolvePath(base, rel, sep) {
90
+ const absolute = rel.startsWith(sep) || /^[A-Za-z]:/.test(rel);
91
+ const parts = (absolute ? rel : `${base}${sep}${rel}`).split(sep);
92
+ const out = [];
93
+ for (const part of parts) {
94
+ if ('.' === part || ('' === part && out.length > 0))
95
+ continue;
96
+ if ('..' === part) {
97
+ if (out.length > 1)
98
+ out.pop();
99
+ continue;
100
+ }
101
+ out.push(part);
102
+ }
103
+ return out.join(sep);
104
+ }
105
+ function parentOf(path, sep) {
106
+ const at = path.lastIndexOf(sep);
107
+ if (at <= 0)
108
+ return undefined;
109
+ const parent = path.slice(0, at);
110
+ // `C:` alone is not a directory we can append to; stop at the drive root.
111
+ return /^[A-Za-z]:$/.test(parent) ? undefined : parent;
112
+ }
113
+ function trimEnd(path, sep) {
114
+ let end = path.length;
115
+ while (end > 1 && sep === path[end - 1])
116
+ end -= 1;
117
+ return path.slice(0, end);
118
+ }
@@ -0,0 +1,23 @@
1
+ /** Why a state or token folder was refused. Names the variables that move it. */
2
+ export declare const stateDirNotAbsolute: (dir: string) => string;
3
+ /** Why a relative override was used against the working folder. */
4
+ export declare const stateDirResolvedFromCwd: (dir: string, resolved: string) => string;
5
+ /** Why a Windows drive path was not used on a POSIX system. */
6
+ export declare const stateDirWindowsPathOnPosix: (dir: string, fallback: string) => string;
7
+ /** The `node:path` rules the caller uses. Core imports no Node module, so the caller passes them. */
8
+ export interface StatePathRules {
9
+ isAbsolute: (path: string) => boolean;
10
+ resolve: (path: string) => string;
11
+ sep: string;
12
+ }
13
+ /**
14
+ * The folder for the pairing token or other machine state: the override when it is set, else the
15
+ * fallback. A setting that cannot be used never stops Reticle. It gets one warning and a folder:
16
+ *
17
+ * - A relative override is resolved against the working folder, as Reticle did up to 3.7.
18
+ * - A Windows drive path on POSIX (WSL, a container) is not used. Such a path is relative there, and
19
+ * it made a `C:` folder inside the app, with the pairing token under it. The fallback is used.
20
+ *
21
+ * Throws only when the fallback is not absolute, because then no folder is safe to use.
22
+ */
23
+ export declare function resolveStateDir(override: string | undefined, fallback: string, rules: StatePathRules, warn: (message: string) => void): string;
@@ -0,0 +1,43 @@
1
+ import { ReticleEnv } from '../wire/constants/reticle-env.js';
2
+ /** Why a state or token folder was refused. Names the variables that move it. */
3
+ export const stateDirNotAbsolute = (dir) => `The Reticle state folder "${dir}" is not an absolute path, so Reticle did not use it. A ` +
4
+ 'relative folder is made inside the folder this process runs in, which is often the project. ' +
5
+ `Set ${ReticleEnv.PAIRING_TOKEN_DIR} and ${ReticleEnv.STATE_DIR} to absolute paths, or unset them.`;
6
+ /** Why a relative override was used against the working folder. */
7
+ export const stateDirResolvedFromCwd = (dir, resolved) => `The Reticle state folder "${dir}" is a relative path. Reticle uses "${resolved}", in the folder ` +
8
+ `this process runs in. Set ${ReticleEnv.PAIRING_TOKEN_DIR} to an absolute path to remove this warning.`;
9
+ /** Why a Windows drive path was not used on a POSIX system. */
10
+ export const stateDirWindowsPathOnPosix = (dir, fallback) => `The Reticle state folder "${dir}" is a Windows path, and this system does not use Windows paths. ` +
11
+ `Reticle did not use it, and uses "${fallback}". Set ${ReticleEnv.PAIRING_TOKEN_DIR} to a path ` +
12
+ 'for this system, or unset it.';
13
+ /** A Windows drive path: `C:\...`, `C:/...` or the drive-relative `C:x`. */
14
+ const WINDOWS_DRIVE = /^[A-Za-z]:/;
15
+ /** The separator of POSIX path rules. */
16
+ const POSIX_SEPARATOR = '/';
17
+ /**
18
+ * The folder for the pairing token or other machine state: the override when it is set, else the
19
+ * fallback. A setting that cannot be used never stops Reticle. It gets one warning and a folder:
20
+ *
21
+ * - A relative override is resolved against the working folder, as Reticle did up to 3.7.
22
+ * - A Windows drive path on POSIX (WSL, a container) is not used. Such a path is relative there, and
23
+ * it made a `C:` folder inside the app, with the pairing token under it. The fallback is used.
24
+ *
25
+ * Throws only when the fallback is not absolute, because then no folder is safe to use.
26
+ */
27
+ export function resolveStateDir(override, fallback, rules, warn) {
28
+ if (override !== undefined && override.length > 0) {
29
+ if (rules.isAbsolute(override)) {
30
+ return override;
31
+ }
32
+ if (rules.sep !== POSIX_SEPARATOR || !WINDOWS_DRIVE.test(override)) {
33
+ const resolved = rules.resolve(override);
34
+ warn(stateDirResolvedFromCwd(override, resolved));
35
+ return resolved;
36
+ }
37
+ warn(stateDirWindowsPathOnPosix(override, fallback));
38
+ }
39
+ if (!rules.isAbsolute(fallback)) {
40
+ throw new Error(stateDirNotAbsolute(fallback));
41
+ }
42
+ return fallback;
43
+ }
package/dist/index.d.ts CHANGED
@@ -23,13 +23,16 @@ export * from './artifacts/flow-order.js';
23
23
  export * from './artifacts/flow-select.js';
24
24
  export * from './artifacts/flow-unreached.js';
25
25
  export * from './artifacts/flow-mutation-target.js';
26
+ export * from './graph/app-graph.js';
26
27
  export * from './wire/constants/constants.js';
28
+ export * from './wire/constants/response-body-reason.js';
27
29
  export * from './identity/source-constants.js';
28
30
  export * from './identity/testid-attribute.js';
29
31
  export * from './wire/event-classification.js';
30
32
  export * from './wire/global-press.js';
31
33
  export * from './wire/hold.js';
32
34
  export * from './verdict/verified-constants.js';
35
+ export * from './verdict/run-report.js';
33
36
  export * from './verdict/verdict-attribution.js';
34
37
  export * from './verdict/verify-progress.js';
35
38
  export * from './wire/constants/session-constants.js';
@@ -40,6 +43,9 @@ export * from './wire/constants/discovery.js';
40
43
  export * from './identity/document-identity.js';
41
44
  export * from './identity/edit-epoch.js';
42
45
  export * from './wire/messages.js';
46
+ export * from './wire/production/hello-mode.js';
47
+ export * from './wire/production/production-policy.js';
48
+ export * from './wire/production/activation-ticket.js';
43
49
  export * from './wire/event-payloads.js';
44
50
  export * from './wire/event-priority.js';
45
51
  export * from './artifacts/flow-constants.js';
@@ -61,6 +67,8 @@ export * from './verdict/predicate.js';
61
67
  export * from './verdict/predicate-tree.js';
62
68
  export * from './artifacts/flow-expect-flat.js';
63
69
  export * from './identity/project-id.js';
70
+ export * from './identity/checkout.js';
71
+ export * from './identity/state-dir.js';
64
72
  export * from './words/notices.js';
65
73
  export * from './artifacts/journal.js';
66
74
  export * from './words/browser-misdirect.js';
@@ -71,6 +79,7 @@ export * from './verdict/intent.js';
71
79
  export * from './verdict/run-context.js';
72
80
  export * from './verdict/instrumentation-gap.js';
73
81
  export * from './verdict/instrumentation-coverage.js';
82
+ export * from './verdict/check-sentence.js';
74
83
  export * from './verdict/security.js';
75
84
  export * from './wire/redaction.js';
76
85
  export * from './wire/state-select.js';
@@ -81,6 +90,7 @@ export * from './words/no-session-reason.js';
81
90
  export * from './telemetry-refusal.js';
82
91
  export * from './wire/narrow.js';
83
92
  export * from './wire/tool-names.js';
93
+ export * from './wire/next-step.js';
84
94
  export * from './wire/snapshot-tree.js';
85
95
  export * from './wire/platform.js';
86
96
  export * from './wire/channel.js';
package/dist/index.js CHANGED
@@ -24,13 +24,16 @@ export * from './artifacts/flow-order.js'; // orderFlows — prerequisites first
24
24
  export * from './artifacts/flow-select.js'; // selectFlows — which flows a run replays, and what it held back
25
25
  export * from './artifacts/flow-unreached.js'; // unreachedRoutes — known routes this run never visited
26
26
  export * from './artifacts/flow-mutation-target.js'; // what a flow says it depends on: mutationTargetsFor + perturbationFor
27
+ export * from './graph/app-graph.js'; // the App Graph: an app as screens, actions, requests; one fold for cloud and daemon
27
28
  export * from './wire/constants/constants.js'; // EventType, ActionType, wire constants, TRANSPORT_LIMITS, …
29
+ export * from './wire/constants/response-body-reason.js'; // why a NET_REQUEST carries no response body (#1520)
28
30
  export * from './identity/source-constants.js'; // DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT_GLOBAL
29
31
  export * from './identity/testid-attribute.js'; // DEFAULT_TESTID_ATTR, ALTERNATIVE_TESTID_ATTRS
30
32
  export * from './wire/event-classification.js'; // CHURN_TYPES — shared eviction priority for buffer/queue
31
33
  export * from './wire/global-press.js'; // which press is a document key (Escape / Tab / a shortcut)
32
34
  export * from './wire/hold.js'; // clampHoldMs — the bounded hold both input paths honour
33
35
  export * from './verdict/verified-constants.js'; // Verified — the one field an agent gates on
36
+ export * from './verdict/run-report.js'; // the end-of-run report an agent shows the user
34
37
  // Its own module so a page that never needs it does not download it — see first-load-size.
35
38
  export * from './verdict/verdict-attribution.js';
36
39
  export * from './verdict/verify-progress.js'; // VerifyPhase — what a run is doing while it is still doing it
@@ -42,6 +45,9 @@ export * from './wire/constants/discovery.js'; // the call-the-founder invitatio
42
45
  export * from './identity/document-identity.js'; // which document an observation belongs to
43
46
  export * from './identity/edit-epoch.js'; // which round of source edits an observation belongs to
44
47
  export * from './wire/messages.js'; // ReticleEvent + the message schemas
48
+ export * from './wire/production/hello-mode.js'; // HelloEnv / HelloScope: a leaf the SDK sends
49
+ export * from './wire/production/production-policy.js'; // the production action policy: rules + refused requests
50
+ export * from './wire/production/activation-ticket.js'; // the signed ticket a live page checks before it loads the SDK
45
51
  export * from './wire/event-payloads.js'; // per-event payload schemas + wire vocab
46
52
  export * from './wire/event-priority.js'; // which events survive the bridge rate cap
47
53
  export * from './artifacts/flow-constants.js'; // moved off wire/constants/constants, which had no use for them
@@ -77,6 +83,8 @@ export * from './verdict/predicate-tree.js';
77
83
  // The version 1 reader: a flat expect lifted to the predicate a v2 file stores directly.
78
84
  export * from './artifacts/flow-expect-flat.js';
79
85
  export * from './identity/project-id.js';
86
+ export * from './identity/checkout.js';
87
+ export * from './identity/state-dir.js'; // resolveStateDir: refuses a state folder that is not absolute
80
88
  export * from './words/notices.js';
81
89
  export * from './artifacts/journal.js';
82
90
  // Not an API — three names that exist so importing the BROWSER SDK from here fails with a sentence
@@ -90,6 +98,7 @@ export * from './verdict/intent.js'; // what a change was supposed to make true,
90
98
  export * from './verdict/run-context.js'; // what a run established, folded and capped, for the agent to pull back
91
99
  export * from './verdict/instrumentation-gap.js'; // what Reticle could not see, and the change that would let it
92
100
  export * from './verdict/instrumentation-coverage.js'; // how much of an app Reticle sees, and the prompt that closes the rest
101
+ export * from './verdict/check-sentence.js'; // a recorded check as a person's sentence, and the part that failed
93
102
  export * from './verdict/security.js'; // sanitize/serialize helpers shared by browser + server
94
103
  export * from './wire/redaction.js'; // isSensitiveKey / scrubKnownSecrets — the shared redaction rules
95
104
  export * from './wire/state-select.js'; // selectPath / capDepth — shared by browser SDK + server fallback
@@ -100,6 +109,7 @@ export * from './words/no-session-reason.js';
100
109
  export * from './telemetry-refusal.js';
101
110
  export * from './wire/narrow.js';
102
111
  export * from './wire/tool-names.js';
112
+ export * from './wire/next-step.js'; // who does what next after a refusal, and the connect command
103
113
  export * from './wire/snapshot-tree.js'; // parseInteractive — the browser writes this format, Node reads it
104
114
  export * from './wire/platform.js';
105
115
  export * from './wire/channel.js';
@@ -47,8 +47,18 @@ export type OnboardingStepStatus = (typeof OnboardingStepStatus)[keyof typeof On
47
47
  export declare const OnboardingSteps: {
48
48
  readonly install: readonly ["script_started", "runtime_ready", "cli_installed", "agents_detected", "mcp_registered"];
49
49
  readonly onboard: readonly ["tour_started", "concept_shown", "first_look", "first_act", "first_verdict"];
50
- readonly first_run: readonly ["project_detected", "instrumented", "app_connected", "driven", "flow_recorded", "verdict_produced"];
50
+ readonly first_run: readonly ["project_detected", "next_step_offered", "instrumented", "app_connected", "driven", "flow_recorded", "verdict_produced"];
51
51
  };
52
+ /**
53
+ * The next step that the first session call in an unwired project offers. `lease` checks the
54
+ * running app now and installs nothing. `init_consent` asks the user to agree to wire the app,
55
+ * when no app is up to lease.
56
+ */
57
+ export declare const NextStepOffered: {
58
+ readonly LEASE: "lease";
59
+ readonly INIT_CONSENT: "init_consent";
60
+ };
61
+ export type NextStepOffered = (typeof NextStepOffered)[keyof typeof NextStepOffered];
52
62
  export declare const OnboardingStepSchema: z.ZodObject<{
53
63
  phase: z.ZodNativeEnum<{
54
64
  /** Getting the CLI onto the machine and the MCP registered with the agents that are there. */
@@ -100,6 +110,13 @@ export declare const OnboardingStepSchema: z.ZodObject<{
100
110
  * home that could not be written (which fires once per process instead).
101
111
  */
102
112
  firstEver: z.ZodOptional<z.ZodBoolean>;
113
+ /** Only on `next_step_offered`: the step the first session call offered. */
114
+ offered: z.ZodOptional<z.ZodNativeEnum<{
115
+ readonly LEASE: "lease";
116
+ readonly INIT_CONSENT: "init_consent";
117
+ }>>;
118
+ /** Only on a `completed` `next_step_offered`: the agent's next call did the offered step. */
119
+ nextFollowed: z.ZodOptional<z.ZodBoolean>;
103
120
  }, "strip", z.ZodTypeAny, {
104
121
  step: string;
105
122
  status: "skipped" | "completed" | "failed" | "started" | "abandoned";
@@ -109,6 +126,8 @@ export declare const OnboardingStepSchema: z.ZodObject<{
109
126
  elapsedMs?: number | undefined;
110
127
  unattended?: boolean | undefined;
111
128
  firstEver?: boolean | undefined;
129
+ offered?: "lease" | "init_consent" | undefined;
130
+ nextFollowed?: boolean | undefined;
112
131
  }, {
113
132
  step: string;
114
133
  status: "skipped" | "completed" | "failed" | "started" | "abandoned";
@@ -118,5 +137,7 @@ export declare const OnboardingStepSchema: z.ZodObject<{
118
137
  elapsedMs?: number | undefined;
119
138
  unattended?: boolean | undefined;
120
139
  firstEver?: boolean | undefined;
140
+ offered?: "lease" | "init_consent" | undefined;
141
+ nextFollowed?: boolean | undefined;
121
142
  }>;
122
143
  export type OnboardingStep = z.infer<typeof OnboardingStepSchema>;
@@ -71,6 +71,12 @@ export const OnboardingSteps = {
71
71
  ],
72
72
  [OnboardingPhase.FIRST_RUN]: [
73
73
  'project_detected',
74
+ /**
75
+ * The first session call in an unwired project named a next step (`offered`) and changed no
76
+ * file. Reported `started` when it is offered, and `completed` on the agent's next call, with
77
+ * `nextFollowed`.
78
+ */
79
+ 'next_step_offered',
74
80
  /** The SDK is in the bundle. Files written is NOT this — see `app_instrumented`. */
75
81
  'instrumented',
76
82
  /** A page loaded and the SDK dialled the bridge. The half of the install nothing else can see. */
@@ -89,6 +95,15 @@ export const OnboardingSteps = {
89
95
  'verdict_produced',
90
96
  ],
91
97
  };
98
+ /**
99
+ * The next step that the first session call in an unwired project offers. `lease` checks the
100
+ * running app now and installs nothing. `init_consent` asks the user to agree to wire the app,
101
+ * when no app is up to lease.
102
+ */
103
+ export const NextStepOffered = {
104
+ LEASE: 'lease',
105
+ INIT_CONSENT: 'init_consent',
106
+ };
92
107
  /**
93
108
  * ONE event for every step of every phase, rather than an event name per step.
94
109
  *
@@ -144,4 +159,8 @@ export const OnboardingStepSchema = z.object({
144
159
  * home that could not be written (which fires once per process instead).
145
160
  */
146
161
  firstEver: z.boolean().optional(),
162
+ /** Only on `next_step_offered`: the step the first session call offered. */
163
+ offered: z.nativeEnum(NextStepOffered).optional(),
164
+ /** Only on a `completed` `next_step_offered`: the agent's next call did the offered step. */
165
+ nextFollowed: z.boolean().optional(),
147
166
  });
@@ -33,18 +33,18 @@ export declare const DevServerEntrySchema: z.ZodObject<{
33
33
  projectId: z.ZodOptional<z.ZodString>;
34
34
  }, "strip", z.ZodTypeAny, {
35
35
  url: string;
36
+ root: string;
36
37
  port: number;
37
38
  pid: number;
38
39
  startedAt: number;
39
- root: string;
40
40
  projectId?: string | undefined;
41
41
  sdkVersion?: string | undefined;
42
42
  }, {
43
43
  url: string;
44
+ root: string;
44
45
  port: number;
45
46
  pid: number;
46
47
  startedAt: number;
47
- root: string;
48
48
  projectId?: string | undefined;
49
49
  sdkVersion?: string | undefined;
50
50
  }>;
@@ -55,7 +55,9 @@
55
55
  "human.control",
56
56
  "human.mark",
57
57
  "download",
58
- "hud.used"
58
+ "hud.used",
59
+ "media.state",
60
+ "canvas.digest"
59
61
  ]
60
62
  },
61
63
  "sessionId": {
@@ -57,6 +57,12 @@
57
57
  },
58
58
  "old": {
59
59
  "type": "string"
60
+ },
61
+ "testid": {
62
+ "type": "string"
63
+ },
64
+ "initial": {
65
+ "type": "boolean"
60
66
  }
61
67
  },
62
68
  "required": [
@@ -270,6 +276,9 @@
270
276
  "replace",
271
277
  "pop"
272
278
  ]
279
+ },
280
+ "pattern": {
281
+ "type": "string"
273
282
  }
274
283
  },
275
284
  "required": [
@@ -632,7 +641,8 @@
632
641
  "type": "string",
633
642
  "enum": [
634
643
  "input",
635
- "change"
644
+ "change",
645
+ "settled"
636
646
  ]
637
647
  },
638
648
  "length": {
@@ -645,6 +655,15 @@
645
655
  "redacted": {
646
656
  "type": "boolean",
647
657
  "const": true
658
+ },
659
+ "checked": {
660
+ "type": "boolean"
661
+ },
662
+ "previous": {
663
+ "type": "string"
664
+ },
665
+ "previousChecked": {
666
+ "type": "boolean"
648
667
  }
649
668
  },
650
669
  "required": [
@@ -916,6 +935,102 @@
916
935
  },
917
936
  "additionalProperties": false,
918
937
  "$schema": "http://json-schema.org/draft-07/schema#"
938
+ },
939
+ "media.state": {
940
+ "type": "object",
941
+ "properties": {
942
+ "event": {
943
+ "type": "string",
944
+ "enum": [
945
+ "play",
946
+ "playing",
947
+ "pause",
948
+ "seeked",
949
+ "ended",
950
+ "loadeddata",
951
+ "canplay",
952
+ "waiting",
953
+ "error"
954
+ ]
955
+ },
956
+ "tag": {
957
+ "type": "string",
958
+ "enum": [
959
+ "video",
960
+ "audio"
961
+ ]
962
+ },
963
+ "currentTime": {
964
+ "type": "number"
965
+ },
966
+ "duration": {
967
+ "type": "number"
968
+ },
969
+ "readyState": {
970
+ "type": "integer",
971
+ "minimum": 0,
972
+ "maximum": 4
973
+ },
974
+ "paused": {
975
+ "type": "boolean"
976
+ }
977
+ },
978
+ "required": [
979
+ "event",
980
+ "tag",
981
+ "currentTime",
982
+ "readyState",
983
+ "paused"
984
+ ],
985
+ "additionalProperties": false,
986
+ "$schema": "http://json-schema.org/draft-07/schema#"
987
+ },
988
+ "canvas.digest": {
989
+ "type": "object",
990
+ "properties": {
991
+ "digest": {
992
+ "type": "string"
993
+ },
994
+ "width": {
995
+ "type": "integer",
996
+ "minimum": 0
997
+ },
998
+ "height": {
999
+ "type": "integer",
1000
+ "minimum": 0
1001
+ },
1002
+ "mean": {
1003
+ "type": "array",
1004
+ "minItems": 3,
1005
+ "maxItems": 3,
1006
+ "items": [
1007
+ {
1008
+ "type": "number"
1009
+ },
1010
+ {
1011
+ "type": "number"
1012
+ },
1013
+ {
1014
+ "type": "number"
1015
+ }
1016
+ ]
1017
+ },
1018
+ "trigger": {
1019
+ "type": "string",
1020
+ "enum": [
1021
+ "poll",
1022
+ "act"
1023
+ ]
1024
+ }
1025
+ },
1026
+ "required": [
1027
+ "digest",
1028
+ "width",
1029
+ "height",
1030
+ "mean"
1031
+ ],
1032
+ "additionalProperties": false,
1033
+ "$schema": "http://json-schema.org/draft-07/schema#"
919
1034
  }
920
1035
  }
921
1036
  }
@@ -42,7 +42,9 @@
42
42
  "human.control",
43
43
  "human.mark",
44
44
  "download",
45
- "hud.used"
45
+ "hud.used",
46
+ "media.state",
47
+ "canvas.digest"
46
48
  ]
47
49
  }
48
50
  },
@@ -41,6 +41,20 @@
41
41
  "type": "string",
42
42
  "maxLength": 512
43
43
  },
44
+ "env": {
45
+ "type": "string",
46
+ "enum": [
47
+ "development",
48
+ "production"
49
+ ]
50
+ },
51
+ "scope": {
52
+ "type": "string",
53
+ "enum": [
54
+ "observe",
55
+ "act"
56
+ ]
57
+ },
44
58
  "platform": {
45
59
  "type": "string",
46
60
  "enum": [
@@ -117,6 +131,13 @@
117
131
  "sourceMapping": {
118
132
  "type": "boolean"
119
133
  },
134
+ "instrumentation": {
135
+ "type": "string",
136
+ "enum": [
137
+ "installed",
138
+ "injected"
139
+ ]
140
+ },
120
141
  "sdkVersion": {
121
142
  "type": "string",
122
143
  "maxLength": 128
@@ -48,7 +48,9 @@
48
48
  "human.control",
49
49
  "human.mark",
50
50
  "download",
51
- "hud.used"
51
+ "hud.used",
52
+ "media.state",
53
+ "canvas.digest"
52
54
  ]
53
55
  },
54
56
  "sessionId": {