@reticlehq/core 3.5.0 → 3.7.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.
- package/dist/artifacts/artifacts-entry.d.ts +4 -0
- package/dist/artifacts/artifacts-entry.js +4 -0
- package/dist/artifacts/drive-script.d.ts +1404 -0
- package/dist/artifacts/drive-script.js +220 -0
- package/dist/artifacts/flow-constants.d.ts +19 -0
- package/dist/artifacts/flow-constants.js +21 -0
- package/dist/artifacts/flow-results.d.ts +450 -0
- package/dist/artifacts/flow-results.js +1 -0
- package/dist/artifacts/flow-types.d.ts +75 -427
- package/dist/artifacts/flow-types.js +15 -2
- package/dist/artifacts/harness-credits.d.ts +39 -0
- package/dist/artifacts/harness-credits.js +69 -0
- package/dist/artifacts/harness-map.d.ts +98 -0
- package/dist/artifacts/harness-map.js +36 -0
- package/dist/artifacts/hud-notices.d.ts +134 -0
- package/dist/artifacts/hud-notices.js +124 -0
- package/dist/artifacts/impact.d.ts +489 -189
- package/dist/artifacts/impact.js +90 -47
- package/dist/artifacts/journal.d.ts +105 -5
- package/dist/artifacts/journal.js +41 -0
- package/dist/artifacts/prompt-context.d.ts +105 -0
- package/dist/artifacts/prompt-context.js +108 -0
- package/dist/artifacts/screenshot-upload.d.ts +51 -0
- package/dist/artifacts/screenshot-upload.js +26 -0
- package/dist/desktop-contract.cjs +1 -0
- package/dist/desktop-contract.d.cts +1 -0
- package/dist/hooks/hook-events.d.ts +4 -4
- package/dist/hud-entry.d.ts +2 -0
- package/dist/hud-entry.js +4 -0
- package/dist/identity/contract-fingerprint.d.ts +9 -0
- package/dist/identity/contract-fingerprint.js +12 -0
- package/dist/identity/testid-attribute.d.ts +18 -0
- package/dist/identity/testid-attribute.js +24 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +9 -1
- package/dist/onboarding.d.ts +10 -2
- package/dist/onboarding.js +6 -0
- package/dist/realm/registry.js +19 -1
- package/dist/schema/command-message.json +36 -0
- package/dist/schema/command-name.json +5 -1
- package/dist/schema/event-payloads.json +56 -2
- package/dist/schema/reticle-message.json +36 -0
- package/dist/telemetry-bug.d.ts +169 -0
- package/dist/telemetry-bug.js +123 -0
- package/dist/telemetry-entry.d.ts +1 -0
- package/dist/telemetry-entry.js +1 -0
- package/dist/telemetry-feedback.d.ts +2 -2
- package/dist/telemetry-refusal.d.ts +5 -4
- package/dist/telemetry-session.d.ts +79 -1
- package/dist/telemetry-session.js +57 -1
- package/dist/telemetry-signals.d.ts +339 -0
- package/dist/telemetry-signals.js +138 -0
- package/dist/telemetry.d.ts +330 -276
- package/dist/telemetry.js +40 -115
- package/dist/tour.d.ts +1 -0
- package/dist/tour.js +13 -5
- package/dist/verdict/consequence.d.ts +3 -0
- package/dist/verdict/disparity.d.ts +105 -0
- package/dist/verdict/disparity.js +40 -0
- package/dist/verdict/findings.d.ts +11 -0
- package/dist/verdict/findings.js +16 -0
- package/dist/verdict/instrumentation-coverage.d.ts +115 -0
- package/dist/verdict/instrumentation-coverage.js +226 -0
- package/dist/verdict/instrumentation-gap.js +1 -1
- package/dist/verdict/intent.d.ts +19 -5
- package/dist/verdict/intent.js +13 -1
- package/dist/verdict/predicate-tree.d.ts +15 -0
- package/dist/verdict/predicate-tree.js +21 -0
- package/dist/verdict/predicate.d.ts +28 -0
- package/dist/verdict/predicate.js +94 -15
- package/dist/verdict/security.d.ts +25 -0
- package/dist/verdict/security.js +82 -0
- package/dist/verdict/verdict-attribution.js +1 -0
- package/dist/verdict/verification-run.d.ts +638 -32
- package/dist/verdict/verification-run.js +90 -0
- package/dist/verdict/verified-constants.d.ts +19 -0
- package/dist/verdict/verified-constants.js +22 -0
- package/dist/wire/constants/constants.d.ts +60 -32
- package/dist/wire/constants/constants.js +61 -33
- package/dist/wire/constants/hud-controls.d.ts +1 -1
- package/dist/wire/constants/hud-controls.js +34 -1
- package/dist/wire/constants/hud-use.d.ts +89 -1
- package/dist/wire/constants/hud-use.js +62 -1
- package/dist/wire/constants/mcp-wire.d.ts +10 -0
- package/dist/wire/constants/mcp-wire.js +10 -0
- package/dist/wire/constants/reticle-chrome.d.ts +19 -0
- package/dist/wire/constants/reticle-chrome.js +19 -0
- package/dist/wire/constants/session-constants.d.ts +21 -0
- package/dist/wire/constants/session-constants.js +21 -0
- package/dist/wire/desktop-contract.d.ts +11 -0
- package/dist/wire/desktop-contract.js +14 -0
- package/dist/wire/event-payloads.d.ts +77 -4
- package/dist/wire/event-payloads.js +27 -0
- package/dist/wire/global-press.d.ts +34 -3
- package/dist/wire/global-press.js +91 -3
- package/dist/wire/hold.d.ts +14 -0
- package/dist/wire/hold.js +18 -0
- package/dist/wire/messages.d.ts +129 -32
- package/dist/wire/messages.js +17 -1
- package/dist/wire/platform-link.d.ts +238 -0
- package/dist/wire/platform-link.js +234 -0
- package/dist/wire/tool-names.d.ts +2 -0
- package/dist/wire/tool-names.js +2 -0
- package/dist/wire/types.d.ts +26 -6
- package/dist/wire/types.js +5 -0
- package/dist/words/no-session-reason.d.ts +7 -0
- package/dist/words/no-session-reason.js +7 -0
- package/dist/words/notices.d.ts +1 -1
- package/dist/words/notices.js +5 -3
- package/dist/words/upgrade.js +1 -1
- package/dist/words/writing-rule.d.ts +14 -0
- package/dist/words/writing-rule.js +17 -0
- package/package.json +1 -1
package/dist/artifacts/impact.js
CHANGED
|
@@ -140,47 +140,8 @@ export const AccountStateSchema = z.object({
|
|
|
140
140
|
email: z.string().optional(),
|
|
141
141
|
host: z.string().optional(),
|
|
142
142
|
});
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
*
|
|
146
|
-
* `claimed` is the only field that decides whether anything is shown, and ABSENCE of this whole
|
|
147
|
-
* object means "we do not know" — never "not claimed". That distinction is the difference between
|
|
148
|
-
* an offer and a nag: a machine that is offline, unlinked, or paired with an older daemon has not
|
|
149
|
-
* told us the person still needs this, and advertising at them anyway is how a dev-only HUD gets
|
|
150
|
-
* switched off for good. The account field beside this one already carries that warning; it applies
|
|
151
|
-
* here with more force, because this one is marketing.
|
|
152
|
-
*/
|
|
153
|
-
export const HarnessOfferSchema = z.object({
|
|
154
|
-
/** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
|
|
155
|
-
claimed: z.boolean(),
|
|
156
|
-
/** When the free period ends, epoch ms. Absent when nothing has been claimed. */
|
|
157
|
-
expiresAt: z.number().optional(),
|
|
158
|
-
/** Whole days left, already computed — the HUD has no clock worth trusting for this. */
|
|
159
|
-
daysRemaining: z.number().optional(),
|
|
160
|
-
/** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
|
|
161
|
-
claimUrl: z.string().optional(),
|
|
162
|
-
/**
|
|
163
|
-
* Whether a drive could actually run if the offer were taken.
|
|
164
|
-
*
|
|
165
|
-
* Entitlement is not readiness. A workspace can be fully entitled against a deployment that holds
|
|
166
|
-
* no key for its provider, and then every signal reads healthy while a drive cannot start —
|
|
167
|
-
* including the card, which would sell three free months of something unusable and burn the one
|
|
168
|
-
* claim the person gets. Absent means "not told", which is treated as drivable for the same
|
|
169
|
-
* reason `claimed` is required and the rest are not: silence from an older platform must not
|
|
170
|
-
* switch the feature off.
|
|
171
|
-
*/
|
|
172
|
-
drivable: z.boolean().optional(),
|
|
173
|
-
/**
|
|
174
|
-
* Whether claiming would still grant anything.
|
|
175
|
-
*
|
|
176
|
-
* Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
|
|
177
|
-
* `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
|
|
178
|
-
* three-month offer to the one group of people who can never accept it again, which is worse than
|
|
179
|
-
* saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
|
|
180
|
-
* report it also has no expiries to get wrong.
|
|
181
|
-
*/
|
|
182
|
-
eligible: z.boolean().optional(),
|
|
183
|
-
});
|
|
143
|
+
/** The grant Harness credits came from: sign-up, the card-started trial, or a paid plan. */
|
|
144
|
+
export const CreditKind = { FREE: 'free', TRIAL: 'trial', PAID: 'paid' };
|
|
184
145
|
/**
|
|
185
146
|
* What the platform says about autonomous driving for this project.
|
|
186
147
|
*
|
|
@@ -189,10 +150,69 @@ export const HarnessOfferSchema = z.object({
|
|
|
189
150
|
*/
|
|
190
151
|
export const HarnessConfigSchema = z.object({
|
|
191
152
|
provider: z.string(),
|
|
192
|
-
/** The switch somebody set.
|
|
153
|
+
/** The switch somebody set. Off for a new project: the Harness is opt-in. */
|
|
193
154
|
harnessEnabled: z.boolean(),
|
|
194
155
|
/** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
|
|
195
156
|
harnessEntitled: z.boolean(),
|
|
157
|
+
/** Whether the selected provider has a usable platform key. Older daemons may omit it. */
|
|
158
|
+
providerReady: z.boolean().optional(),
|
|
159
|
+
/** Harness credits used and held this 30 days; one is one Harness decision. Absent: unbounded or unknown. */
|
|
160
|
+
credits: z
|
|
161
|
+
.object({
|
|
162
|
+
used: z.number().int().min(0),
|
|
163
|
+
limit: z.number().int().min(0),
|
|
164
|
+
/** The grant they came from. Optional on the wire: an older platform omits it. */
|
|
165
|
+
kind: z.enum([CreditKind.FREE, CreditKind.TRIAL, CreditKind.PAID]).optional(),
|
|
166
|
+
/** Whole days the grant has left, counted by the daemon from the platform's end date. */
|
|
167
|
+
daysLeft: z.number().int().min(0).optional(),
|
|
168
|
+
})
|
|
169
|
+
.optional(),
|
|
170
|
+
/** The platform this answer came from, so the HUD's links go there and not to the hosted one. */
|
|
171
|
+
platformUrl: z.string().optional(),
|
|
172
|
+
/**
|
|
173
|
+
* The platform's own Harness coverage gate, which it enforces. The HUD prefers it to the daemon's
|
|
174
|
+
* local score; absent from an older platform, which leaves the local score to decide.
|
|
175
|
+
*/
|
|
176
|
+
gate: z
|
|
177
|
+
.object({
|
|
178
|
+
unlocked: z.boolean(),
|
|
179
|
+
/** floor(score × 100); absent before any app reported. */
|
|
180
|
+
percent: z.number().int().min(0).max(100).optional(),
|
|
181
|
+
reason: z.string().max(400).optional(),
|
|
182
|
+
prompt: z.string().max(4000).optional(),
|
|
183
|
+
})
|
|
184
|
+
.optional(),
|
|
185
|
+
/** The plan in force: which grant, trial days left, seats. Absent from a platform that sent none. */
|
|
186
|
+
plan: z
|
|
187
|
+
.object({
|
|
188
|
+
kind: z.enum([CreditKind.FREE, CreditKind.TRIAL, CreditKind.PAID]),
|
|
189
|
+
daysLeft: z.number().int().min(0).optional(),
|
|
190
|
+
seats: z.number().int().min(0).optional(),
|
|
191
|
+
})
|
|
192
|
+
.optional(),
|
|
193
|
+
/** Harness runs the platform holds for this project. Absent: the platform did not say. */
|
|
194
|
+
harnessRuns: z.number().int().min(0).optional(),
|
|
195
|
+
/** Memory entries the platform holds for this project. Absent: the platform did not say. */
|
|
196
|
+
memoryEntries: z.number().int().min(0).optional(),
|
|
197
|
+
});
|
|
198
|
+
/** The Harness drive running in this tab's project, so the panel can show progress and Stop. */
|
|
199
|
+
export const HarnessDriveSchema = z.object({ runId: z.string(), steps: z.number().int().min(0) });
|
|
200
|
+
/** The longest note a person can send their coding agent from the HUD. */
|
|
201
|
+
export const AGENT_NOTE_MAX = 500;
|
|
202
|
+
/** How many of a tab's latest notes the HUD shows. */
|
|
203
|
+
export const AGENT_NOTES_SHOWN = 5;
|
|
204
|
+
const AGENT_LABEL_MAX = 64;
|
|
205
|
+
/** A note sent to the coding agent from this tab. `seen` only once an agent's tool call took it. */
|
|
206
|
+
export const AgentNoteSchema = z.object({
|
|
207
|
+
text: z.string().max(AGENT_NOTE_MAX),
|
|
208
|
+
seen: z.boolean(),
|
|
209
|
+
/** Which agent took it, when the daemon knows. */
|
|
210
|
+
by: z.string().max(AGENT_LABEL_MAX).optional(),
|
|
211
|
+
});
|
|
212
|
+
/** The coding agents attached to the daemon now (friendly names), and this tab's latest notes. */
|
|
213
|
+
export const AgentLinkSchema = z.object({
|
|
214
|
+
agents: z.array(z.string().max(AGENT_LABEL_MAX)).max(8),
|
|
215
|
+
notes: z.array(AgentNoteSchema).max(AGENT_NOTES_SHOWN),
|
|
196
216
|
});
|
|
197
217
|
export const ImpactSnapshotSchema = z.object({
|
|
198
218
|
schemaVersion: z.number().int().positive(),
|
|
@@ -212,11 +232,6 @@ export const ImpactSnapshotSchema = z.object({
|
|
|
212
232
|
* kind of nag that gets a dev-only HUD switched off for good.
|
|
213
233
|
*/
|
|
214
234
|
account: AccountStateSchema.optional(),
|
|
215
|
-
/**
|
|
216
|
-
* The harness offer, when the daemon knows it. Absent is "unknown" and shows nothing — see
|
|
217
|
-
* `HarnessOfferSchema` for why that asymmetry is deliberate.
|
|
218
|
-
*/
|
|
219
|
-
harnessOffer: HarnessOfferSchema.optional(),
|
|
220
235
|
/**
|
|
221
236
|
* The harness switch and whether this workspace may drive on our spend.
|
|
222
237
|
*
|
|
@@ -230,6 +245,34 @@ export const ImpactSnapshotSchema = z.object({
|
|
|
230
245
|
* cannot be honoured is worse than showing none.
|
|
231
246
|
*/
|
|
232
247
|
harnessConfig: HarnessConfigSchema.optional(),
|
|
248
|
+
/** The drive running now, when there is one. Absent: nothing is driving. */
|
|
249
|
+
harnessDrive: HarnessDriveSchema.optional(),
|
|
250
|
+
/** Who is coding against this daemon, and what this tab said to them. Absent: an older daemon. */
|
|
251
|
+
agent: AgentLinkSchema.optional(),
|
|
252
|
+
/**
|
|
253
|
+
* The rail's notices, already chosen for this machine by the daemon (see `hud-notices.ts`).
|
|
254
|
+
* Absent means the daemon has nothing newer than the SDK's bundled slides, which then show.
|
|
255
|
+
*
|
|
256
|
+
* Loose here on purpose: this schema is on every page's first load, and the full notice schema
|
|
257
|
+
* (link rules, id pattern) is not. The lazily loaded panel validates each notice with
|
|
258
|
+
* `HudNoticeSchema` from `@reticlehq/core/hud` before rendering it.
|
|
259
|
+
*/
|
|
260
|
+
notices: z.array(z.unknown()).max(8).optional(),
|
|
261
|
+
/**
|
|
262
|
+
* Reticle Coverage: each level's percentage from the project's coverage ledger (`reached` routes,
|
|
263
|
+
* `proved` controls, `executed` code, ...). Numbers only. Absent until something was measured.
|
|
264
|
+
*/
|
|
265
|
+
coverage: z.record(z.number()).optional(),
|
|
266
|
+
/**
|
|
267
|
+
* Where this project's work stands with the platform (status, runs on it, waiting, refused, last
|
|
268
|
+
* push, and the sentence describing it). Loose here, shaped by the daemon's sync-status.
|
|
269
|
+
*/
|
|
270
|
+
sync: z.record(z.unknown()).optional(),
|
|
271
|
+
/**
|
|
272
|
+
* How much of THIS tab's app Reticle sees, and the prompt that asks a coding agent to close the
|
|
273
|
+
* rest (`covered`, `total`, `missing`, `prompt`). Loose here, shaped by the daemon's coverageOf.
|
|
274
|
+
*/
|
|
275
|
+
instrumentation: z.record(z.unknown()).optional(),
|
|
233
276
|
});
|
|
234
277
|
/** Empty counters - the starting point for a fresh store and the identity for merges. */
|
|
235
278
|
export function emptyImpactCounts() {
|
|
@@ -13,6 +13,28 @@ export declare const JOURNAL_FILE_VERSION = 1;
|
|
|
13
13
|
* to attribute events to this action (`attribution:"window"`); `effect` is a bounded summary of what
|
|
14
14
|
* the tool returned. Args are already edge-redacted by the browser before they reach here.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Who drove an action when it was not the agent on the other end of the connection: the Harness,
|
|
18
|
+
* dispatching through the same tools. A run folded from the journal splits on it, so a person can
|
|
19
|
+
* tell what their agent proved from what the Harness proved.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DrivenBySchema: z.ZodObject<{
|
|
22
|
+
/** One Harness drive; every action it took carries the same id. */
|
|
23
|
+
harness: z.ZodString;
|
|
24
|
+
/** Which model drove it: `server` is the platform's Harness. */
|
|
25
|
+
driver: z.ZodString;
|
|
26
|
+
/** The journey it was asked to complete, when one was named. */
|
|
27
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
harness: string;
|
|
30
|
+
driver: string;
|
|
31
|
+
persona?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
harness: string;
|
|
34
|
+
driver: string;
|
|
35
|
+
persona?: string | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export type DrivenBy = z.infer<typeof DrivenBySchema>;
|
|
16
38
|
export declare const JournalActionSchema: z.ZodObject<{
|
|
17
39
|
v: z.ZodLiteral<1>;
|
|
18
40
|
/** The command correlation id (`c<n>`) — the natural, cross-side-stable action identity. */
|
|
@@ -51,23 +73,52 @@ export declare const JournalActionSchema: z.ZodObject<{
|
|
|
51
73
|
}>;
|
|
52
74
|
/** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
|
|
53
75
|
at: z.ZodNumber;
|
|
76
|
+
/** Set only when the Harness drove this action; absent means the connected agent did. */
|
|
77
|
+
drivenBy: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
/** One Harness drive; every action it took carries the same id. */
|
|
79
|
+
harness: z.ZodString;
|
|
80
|
+
/** Which model drove it: `server` is the platform's Harness. */
|
|
81
|
+
driver: z.ZodString;
|
|
82
|
+
/** The journey it was asked to complete, when one was named. */
|
|
83
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
harness: string;
|
|
86
|
+
driver: string;
|
|
87
|
+
persona?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
harness: string;
|
|
90
|
+
driver: string;
|
|
91
|
+
persona?: string | undefined;
|
|
92
|
+
}>>;
|
|
93
|
+
/**
|
|
94
|
+
* The MCP client that made this call, as its handshake named it (`claude-code`, `cursor`…). Read
|
|
95
|
+
* per call rather than at session end: by teardown the agent has often detached, and two agents on
|
|
96
|
+
* one daemon cannot be told apart from anything but the call itself.
|
|
97
|
+
*/
|
|
98
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
54
99
|
}, "strip", z.ZodTypeAny, {
|
|
55
100
|
at: number;
|
|
56
101
|
tool: string;
|
|
57
|
-
args: Record<string, unknown>;
|
|
58
102
|
actionId: string;
|
|
103
|
+
args: Record<string, unknown>;
|
|
59
104
|
v: 1;
|
|
60
105
|
tRange: {
|
|
61
106
|
from: number;
|
|
62
107
|
to: number;
|
|
63
108
|
};
|
|
64
109
|
settled?: boolean | undefined;
|
|
110
|
+
agent?: string | undefined;
|
|
65
111
|
effect?: unknown;
|
|
66
112
|
settledInMs?: number | undefined;
|
|
67
113
|
seqRange?: {
|
|
68
114
|
from: number;
|
|
69
115
|
to: number;
|
|
70
116
|
} | undefined;
|
|
117
|
+
drivenBy?: {
|
|
118
|
+
harness: string;
|
|
119
|
+
driver: string;
|
|
120
|
+
persona?: string | undefined;
|
|
121
|
+
} | undefined;
|
|
71
122
|
}, {
|
|
72
123
|
at: number;
|
|
73
124
|
tool: string;
|
|
@@ -78,6 +129,7 @@ export declare const JournalActionSchema: z.ZodObject<{
|
|
|
78
129
|
to: number;
|
|
79
130
|
};
|
|
80
131
|
settled?: boolean | undefined;
|
|
132
|
+
agent?: string | undefined;
|
|
81
133
|
effect?: unknown;
|
|
82
134
|
args?: Record<string, unknown> | undefined;
|
|
83
135
|
settledInMs?: number | undefined;
|
|
@@ -85,6 +137,11 @@ export declare const JournalActionSchema: z.ZodObject<{
|
|
|
85
137
|
from: number;
|
|
86
138
|
to: number;
|
|
87
139
|
} | undefined;
|
|
140
|
+
drivenBy?: {
|
|
141
|
+
harness: string;
|
|
142
|
+
driver: string;
|
|
143
|
+
persona?: string | undefined;
|
|
144
|
+
} | undefined;
|
|
88
145
|
}>;
|
|
89
146
|
export type JournalAction = z.infer<typeof JournalActionSchema>;
|
|
90
147
|
/**
|
|
@@ -162,6 +219,13 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
|
|
|
162
219
|
}>;
|
|
163
220
|
/** `file:line` for the element driven, when the page told us one. */
|
|
164
221
|
source: z.ZodOptional<z.ZodString>;
|
|
222
|
+
/**
|
|
223
|
+
* What the check saw, in the engine's words ("present, visible, disabled"), when it said. Kept so
|
|
224
|
+
* a failed check can say what it found rather than only that the claim did not hold.
|
|
225
|
+
*/
|
|
226
|
+
observed: z.ZodOptional<z.ZodString>;
|
|
227
|
+
/** What the check required, in the engine's words ("an element … in state 'enabled'"). */
|
|
228
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
165
229
|
/**
|
|
166
230
|
* Which source of truth answering the claim required -- the predicate's own kind.
|
|
167
231
|
*
|
|
@@ -198,6 +262,26 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
|
|
|
198
262
|
* Absent is not `false`. `false` says the claim came afterwards; absent says nobody recorded which.
|
|
199
263
|
*/
|
|
200
264
|
declaredBeforeActing: z.ZodOptional<z.ZodBoolean>;
|
|
265
|
+
/**
|
|
266
|
+
* The requests seen in a failed check's window: method, url, status and a short excerpt of the
|
|
267
|
+
* (already redacted) response, so a failure's page can show the call that explains it.
|
|
268
|
+
*/
|
|
269
|
+
net: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
270
|
+
method: z.ZodString;
|
|
271
|
+
url: z.ZodString;
|
|
272
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
body: z.ZodOptional<z.ZodString>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
method: string;
|
|
276
|
+
url: string;
|
|
277
|
+
status?: number | undefined;
|
|
278
|
+
body?: string | undefined;
|
|
279
|
+
}, {
|
|
280
|
+
method: string;
|
|
281
|
+
url: string;
|
|
282
|
+
status?: number | undefined;
|
|
283
|
+
body?: string | undefined;
|
|
284
|
+
}>, "many">>;
|
|
201
285
|
/**
|
|
202
286
|
* What kind of evidence bought the answer -- the grade the verdict actually proved.
|
|
203
287
|
*
|
|
@@ -225,22 +309,38 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
|
|
|
225
309
|
*/
|
|
226
310
|
reason: z.ZodOptional<z.ZodString>;
|
|
227
311
|
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
claim: string;
|
|
229
312
|
verified: "yes" | "no" | "unknown" | "no-fault";
|
|
313
|
+
claim: string;
|
|
314
|
+
net?: {
|
|
315
|
+
method: string;
|
|
316
|
+
url: string;
|
|
317
|
+
status?: number | undefined;
|
|
318
|
+
body?: string | undefined;
|
|
319
|
+
}[] | undefined;
|
|
230
320
|
kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
|
|
321
|
+
expected?: string | undefined;
|
|
322
|
+
source?: string | undefined;
|
|
231
323
|
declaredBeforeActing?: boolean | undefined;
|
|
324
|
+
observed?: string | undefined;
|
|
232
325
|
grade?: string | undefined;
|
|
233
326
|
couldNotSee?: string[] | undefined;
|
|
234
327
|
reason?: string | undefined;
|
|
235
|
-
source?: string | undefined;
|
|
236
328
|
}, {
|
|
237
|
-
claim: string;
|
|
238
329
|
verified: "yes" | "no" | "unknown" | "no-fault";
|
|
330
|
+
claim: string;
|
|
331
|
+
net?: {
|
|
332
|
+
method: string;
|
|
333
|
+
url: string;
|
|
334
|
+
status?: number | undefined;
|
|
335
|
+
body?: string | undefined;
|
|
336
|
+
}[] | undefined;
|
|
239
337
|
kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
|
|
338
|
+
expected?: string | undefined;
|
|
339
|
+
source?: string | undefined;
|
|
240
340
|
declaredBeforeActing?: boolean | undefined;
|
|
341
|
+
observed?: string | undefined;
|
|
241
342
|
grade?: string | undefined;
|
|
242
343
|
couldNotSee?: string[] | undefined;
|
|
243
344
|
reason?: string | undefined;
|
|
244
|
-
source?: string | undefined;
|
|
245
345
|
}>;
|
|
246
346
|
export type JournalVerdictEffect = z.infer<typeof JournalVerdictEffectSchema>;
|
|
@@ -16,6 +16,19 @@ export const JOURNAL_FILE_VERSION = 1;
|
|
|
16
16
|
* to attribute events to this action (`attribution:"window"`); `effect` is a bounded summary of what
|
|
17
17
|
* the tool returned. Args are already edge-redacted by the browser before they reach here.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Who drove an action when it was not the agent on the other end of the connection: the Harness,
|
|
21
|
+
* dispatching through the same tools. A run folded from the journal splits on it, so a person can
|
|
22
|
+
* tell what their agent proved from what the Harness proved.
|
|
23
|
+
*/
|
|
24
|
+
export const DrivenBySchema = z.object({
|
|
25
|
+
/** One Harness drive; every action it took carries the same id. */
|
|
26
|
+
harness: z.string().min(1).max(TRANSPORT_LIMITS.MAX_REF_LENGTH),
|
|
27
|
+
/** Which model drove it: `server` is the platform's Harness. */
|
|
28
|
+
driver: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
|
|
29
|
+
/** The journey it was asked to complete, when one was named. */
|
|
30
|
+
persona: z.string().max(1000).optional(),
|
|
31
|
+
});
|
|
19
32
|
export const JournalActionSchema = z.object({
|
|
20
33
|
v: z.literal(JOURNAL_FILE_VERSION),
|
|
21
34
|
/** The command correlation id (`c<n>`) — the natural, cross-side-stable action identity. */
|
|
@@ -36,6 +49,14 @@ export const JournalActionSchema = z.object({
|
|
|
36
49
|
tRange: z.object({ from: z.number().int().min(0), to: z.number().int().min(0) }),
|
|
37
50
|
/** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
|
|
38
51
|
at: z.number().int().min(0),
|
|
52
|
+
/** Set only when the Harness drove this action; absent means the connected agent did. */
|
|
53
|
+
drivenBy: DrivenBySchema.optional(),
|
|
54
|
+
/**
|
|
55
|
+
* The MCP client that made this call, as its handshake named it (`claude-code`, `cursor`…). Read
|
|
56
|
+
* per call rather than at session end: by teardown the agent has often detached, and two agents on
|
|
57
|
+
* one daemon cannot be told apart from anything but the call itself.
|
|
58
|
+
*/
|
|
59
|
+
agent: z.string().min(1).max(TRANSPORT_LIMITS.MAX_REF_LENGTH).optional(),
|
|
39
60
|
});
|
|
40
61
|
/**
|
|
41
62
|
* The report written beside `events.jsonl` when its byte ceiling refuses a batch.
|
|
@@ -92,6 +113,13 @@ export const JournalVerdictEffectSchema = z.object({
|
|
|
92
113
|
verified: z.nativeEnum(Verified),
|
|
93
114
|
/** `file:line` for the element driven, when the page told us one. */
|
|
94
115
|
source: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH).optional(),
|
|
116
|
+
/**
|
|
117
|
+
* What the check saw, in the engine's words ("present, visible, disabled"), when it said. Kept so
|
|
118
|
+
* a failed check can say what it found rather than only that the claim did not hold.
|
|
119
|
+
*/
|
|
120
|
+
observed: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
|
|
121
|
+
/** What the check required, in the engine's words ("an element … in state 'enabled'"). */
|
|
122
|
+
expected: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
|
|
95
123
|
/**
|
|
96
124
|
* Which source of truth answering the claim required -- the predicate's own kind.
|
|
97
125
|
*
|
|
@@ -114,6 +142,19 @@ export const JournalVerdictEffectSchema = z.object({
|
|
|
114
142
|
* Absent is not `false`. `false` says the claim came afterwards; absent says nobody recorded which.
|
|
115
143
|
*/
|
|
116
144
|
declaredBeforeActing: z.boolean().optional(),
|
|
145
|
+
/**
|
|
146
|
+
* The requests seen in a failed check's window: method, url, status and a short excerpt of the
|
|
147
|
+
* (already redacted) response, so a failure's page can show the call that explains it.
|
|
148
|
+
*/
|
|
149
|
+
net: z
|
|
150
|
+
.array(z.object({
|
|
151
|
+
method: z.string().max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
|
|
152
|
+
url: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH),
|
|
153
|
+
status: z.number().optional(),
|
|
154
|
+
body: z.string().max(TRANSPORT_LIMITS.MAX_STRING_LENGTH).optional(),
|
|
155
|
+
}))
|
|
156
|
+
.max(5)
|
|
157
|
+
.optional(),
|
|
117
158
|
/**
|
|
118
159
|
* What kind of evidence bought the answer -- the grade the verdict actually proved.
|
|
119
160
|
*
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompt side of a verification: what the user asked for, relayed by the agent, and every
|
|
3
|
+
* statement in it and in the agent's declared intents, classified and attributed. Daemon-side only:
|
|
4
|
+
* a run carries it loosely (`context`), so it adds nothing to what a page downloads.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/** What a statement in the prompt context is, so a reader can tell a goal from a preference. */
|
|
8
|
+
export declare const StatementKind: {
|
|
9
|
+
/** What the product should do for its users: the reason the work exists. */
|
|
10
|
+
readonly BUSINESS_INTENT: "business-intent";
|
|
11
|
+
/** What to change in the code: implement, fix, refactor, rename, test. */
|
|
12
|
+
readonly CODING_INTENT: "coding-intent";
|
|
13
|
+
/** How it must look or feel: layout, spacing, mobile, accessibility. */
|
|
14
|
+
readonly UX_EXPECTATION: "ux-expectation";
|
|
15
|
+
/** Who may see or do what, and what must never leak. */
|
|
16
|
+
readonly SECURITY: "security-requirement";
|
|
17
|
+
readonly ACCEPTANCE: "acceptance-criterion";
|
|
18
|
+
readonly CONSTRAINT: "technical-constraint";
|
|
19
|
+
readonly PREFERENCE: "preference";
|
|
20
|
+
/** What not to touch, or not now. */
|
|
21
|
+
readonly OUT_OF_SCOPE: "out-of-scope";
|
|
22
|
+
};
|
|
23
|
+
export type StatementKind = (typeof StatementKind)[keyof typeof StatementKind];
|
|
24
|
+
/** Who said it. The user's words reach Reticle through the agent, so `user` means relayed verbatim. */
|
|
25
|
+
export declare const StatementSource: {
|
|
26
|
+
readonly USER: "user";
|
|
27
|
+
readonly AGENT: "agent";
|
|
28
|
+
};
|
|
29
|
+
export type StatementSource = (typeof StatementSource)[keyof typeof StatementSource];
|
|
30
|
+
/**
|
|
31
|
+
* A statement's kind, by the words in it.
|
|
32
|
+
*
|
|
33
|
+
* ponytail: keyword rules, not a model. Good enough to separate "the checkout must show the total"
|
|
34
|
+
* from "use the existing Button" from "I prefer it darker"; a model classifier can replace this
|
|
35
|
+
* function without changing what is stored.
|
|
36
|
+
*/
|
|
37
|
+
export declare function classifyStatement(text: string): StatementKind;
|
|
38
|
+
/** A request split into the sentences a reader would weigh one at a time. */
|
|
39
|
+
export declare function splitStatements(text: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* The prompt side of a verification: what the user asked for (relayed by the agent), and each
|
|
42
|
+
* statement in it and in the agent's declared intents, classified and attributed.
|
|
43
|
+
*
|
|
44
|
+
* `shared` decides whether it leaves this machine. A linked project shares it by default, so the
|
|
45
|
+
* platform can read what each run was for; `"shareRequests": false` in .reticle.json keeps it here,
|
|
46
|
+
* and an unlinked project has nowhere to send it. See `shareableRun`.
|
|
47
|
+
*/
|
|
48
|
+
export declare const PromptContextSchema: z.ZodObject<{
|
|
49
|
+
/** The whole prompt, redacted. Long prompts are the useful ones, so the cap is generous. */
|
|
50
|
+
request: z.ZodOptional<z.ZodString>;
|
|
51
|
+
statements: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
52
|
+
text: z.ZodString;
|
|
53
|
+
kind: z.ZodNativeEnum<{
|
|
54
|
+
/** What the product should do for its users: the reason the work exists. */
|
|
55
|
+
readonly BUSINESS_INTENT: "business-intent";
|
|
56
|
+
/** What to change in the code: implement, fix, refactor, rename, test. */
|
|
57
|
+
readonly CODING_INTENT: "coding-intent";
|
|
58
|
+
/** How it must look or feel: layout, spacing, mobile, accessibility. */
|
|
59
|
+
readonly UX_EXPECTATION: "ux-expectation";
|
|
60
|
+
/** Who may see or do what, and what must never leak. */
|
|
61
|
+
readonly SECURITY: "security-requirement";
|
|
62
|
+
readonly ACCEPTANCE: "acceptance-criterion";
|
|
63
|
+
readonly CONSTRAINT: "technical-constraint";
|
|
64
|
+
readonly PREFERENCE: "preference";
|
|
65
|
+
/** What not to touch, or not now. */
|
|
66
|
+
readonly OUT_OF_SCOPE: "out-of-scope";
|
|
67
|
+
}>;
|
|
68
|
+
source: z.ZodNativeEnum<{
|
|
69
|
+
readonly USER: "user";
|
|
70
|
+
readonly AGENT: "agent";
|
|
71
|
+
}>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
text: string;
|
|
74
|
+
kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
|
|
75
|
+
source: "agent" | "user";
|
|
76
|
+
}, {
|
|
77
|
+
text: string;
|
|
78
|
+
kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
|
|
79
|
+
source: "agent" | "user";
|
|
80
|
+
}>, "many">>;
|
|
81
|
+
/** When the request was given, epoch ms. A run long after it is not about it. */
|
|
82
|
+
at: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
statements: {
|
|
86
|
+
text: string;
|
|
87
|
+
kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
|
|
88
|
+
source: "agent" | "user";
|
|
89
|
+
}[];
|
|
90
|
+
at?: number | undefined;
|
|
91
|
+
request?: string | undefined;
|
|
92
|
+
shared?: boolean | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
at?: number | undefined;
|
|
95
|
+
request?: string | undefined;
|
|
96
|
+
statements?: {
|
|
97
|
+
text: string;
|
|
98
|
+
kind: "business-intent" | "coding-intent" | "ux-expectation" | "security-requirement" | "acceptance-criterion" | "technical-constraint" | "preference" | "out-of-scope";
|
|
99
|
+
source: "agent" | "user";
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
shared?: boolean | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
export type PromptContext = z.infer<typeof PromptContextSchema>;
|
|
104
|
+
/** A run as it may leave this machine: its prompt context only when the project shares it. */
|
|
105
|
+
export declare function shareableRun(run: unknown): unknown;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompt side of a verification: what the user asked for, relayed by the agent, and every
|
|
3
|
+
* statement in it and in the agent's declared intents, classified and attributed. Daemon-side only:
|
|
4
|
+
* a run carries it loosely (`context`), so it adds nothing to what a page downloads.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/** What a statement in the prompt context is, so a reader can tell a goal from a preference. */
|
|
8
|
+
export const StatementKind = {
|
|
9
|
+
/** What the product should do for its users: the reason the work exists. */
|
|
10
|
+
BUSINESS_INTENT: 'business-intent',
|
|
11
|
+
/** What to change in the code: implement, fix, refactor, rename, test. */
|
|
12
|
+
CODING_INTENT: 'coding-intent',
|
|
13
|
+
/** How it must look or feel: layout, spacing, mobile, accessibility. */
|
|
14
|
+
UX_EXPECTATION: 'ux-expectation',
|
|
15
|
+
/** Who may see or do what, and what must never leak. */
|
|
16
|
+
SECURITY: 'security-requirement',
|
|
17
|
+
ACCEPTANCE: 'acceptance-criterion',
|
|
18
|
+
CONSTRAINT: 'technical-constraint',
|
|
19
|
+
PREFERENCE: 'preference',
|
|
20
|
+
/** What not to touch, or not now. */
|
|
21
|
+
OUT_OF_SCOPE: 'out-of-scope',
|
|
22
|
+
};
|
|
23
|
+
/** Who said it. The user's words reach Reticle through the agent, so `user` means relayed verbatim. */
|
|
24
|
+
export const StatementSource = {
|
|
25
|
+
USER: 'user',
|
|
26
|
+
AGENT: 'agent',
|
|
27
|
+
};
|
|
28
|
+
/** The words that make a statement each kind. Checked in this order; the first that matches wins. */
|
|
29
|
+
const STATEMENT_RULES = [
|
|
30
|
+
{
|
|
31
|
+
kind: StatementKind.OUT_OF_SCOPE,
|
|
32
|
+
words: /\b(don't (?:touch|change|modify)|do not (?:touch|change|modify)|leave (?:it|that|the \w+) (?:alone|as is)|out of scope|not (?:now|yet|in this)|no need to)\b/i,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
kind: StatementKind.PREFERENCE,
|
|
36
|
+
words: /\b(i (?:prefer|like|want it|would rather)|ideally|nicer|taste|style)\b/i,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
kind: StatementKind.SECURITY,
|
|
40
|
+
words: /\b(secure|security|unauthori[sz]ed|authori[sz]ation|permissions?|admins? only|only admins?|roles?|leaks?|xss|csrf|password|secrets?|pii)\b/i,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
kind: StatementKind.CODING_INTENT,
|
|
44
|
+
words: /\b(refactor|implement|rename|migrate|extract|clean up|write (?:a |the )?tests?|add (?:a |an )?(?:test|function|component|hook|endpoint|route|migration)|fix (?:the |this |a )?(?:bug|error|crash|issue|test)|debug)\b/i,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
kind: StatementKind.UX_EXPECTATION,
|
|
48
|
+
words: /\b(layout|spacing|align(?:ed|ment)?|responsive|mobile|dark mode|colou?rs?|font|animation|accessib\w*|a11y|keyboard|screen reader|looks?|feels?)\b/i,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
kind: StatementKind.CONSTRAINT,
|
|
52
|
+
words: /\b(use|don't use|do not use|without|library|framework|api|endpoint|database|schema|typescript|react|must not import|performance|latency)\b/i,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
kind: StatementKind.ACCEPTANCE,
|
|
56
|
+
words: /\b(must|should|has to|needs to|shows?|displays?|returns?|when .* then|so that|until)\b/i,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
/**
|
|
60
|
+
* A statement's kind, by the words in it.
|
|
61
|
+
*
|
|
62
|
+
* ponytail: keyword rules, not a model. Good enough to separate "the checkout must show the total"
|
|
63
|
+
* from "use the existing Button" from "I prefer it darker"; a model classifier can replace this
|
|
64
|
+
* function without changing what is stored.
|
|
65
|
+
*/
|
|
66
|
+
export function classifyStatement(text) {
|
|
67
|
+
for (const rule of STATEMENT_RULES)
|
|
68
|
+
if (rule.words.test(text))
|
|
69
|
+
return rule.kind;
|
|
70
|
+
return StatementKind.BUSINESS_INTENT;
|
|
71
|
+
}
|
|
72
|
+
/** A request split into the sentences a reader would weigh one at a time. */
|
|
73
|
+
export function splitStatements(text) {
|
|
74
|
+
return text
|
|
75
|
+
.split(/(?<=[.!?])\s+|\n+/)
|
|
76
|
+
.map((s) => s.trim())
|
|
77
|
+
.filter((s) => 0 < s.length);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The prompt side of a verification: what the user asked for (relayed by the agent), and each
|
|
81
|
+
* statement in it and in the agent's declared intents, classified and attributed.
|
|
82
|
+
*
|
|
83
|
+
* `shared` decides whether it leaves this machine. A linked project shares it by default, so the
|
|
84
|
+
* platform can read what each run was for; `"shareRequests": false` in .reticle.json keeps it here,
|
|
85
|
+
* and an unlinked project has nowhere to send it. See `shareableRun`.
|
|
86
|
+
*/
|
|
87
|
+
export const PromptContextSchema = z.object({
|
|
88
|
+
/** The whole prompt, redacted. Long prompts are the useful ones, so the cap is generous. */
|
|
89
|
+
request: z.string().max(20_000).optional(),
|
|
90
|
+
statements: z
|
|
91
|
+
.array(z.object({
|
|
92
|
+
text: z.string().max(500),
|
|
93
|
+
kind: z.nativeEnum(StatementKind),
|
|
94
|
+
source: z.nativeEnum(StatementSource),
|
|
95
|
+
}))
|
|
96
|
+
.max(100)
|
|
97
|
+
.default([]),
|
|
98
|
+
/** When the request was given, epoch ms. A run long after it is not about it. */
|
|
99
|
+
at: z.number().optional(),
|
|
100
|
+
shared: z.boolean().optional(),
|
|
101
|
+
});
|
|
102
|
+
/** A run as it may leave this machine: its prompt context only when the project shares it. */
|
|
103
|
+
export function shareableRun(run) {
|
|
104
|
+
if ('object' !== typeof run || null === run || !('context' in run))
|
|
105
|
+
return run;
|
|
106
|
+
const { context, ...rest } = run;
|
|
107
|
+
return true === context?.shared ? run : rest;
|
|
108
|
+
}
|