kaloko 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/package.json +1 -1
- package/schemas/config.v1.json +33 -0
- package/schemas/run.v1.json +11 -0
- package/schemas/scenario.v1.json +9 -5
- package/skills/kaloko/SKILL.md +3 -1
- package/skills/kaloko/reference/acceptance.md +8 -2
- package/skills/kaloko/reference/evaluation.md +12 -0
- package/src/cli.mjs +29 -10
- package/src/lib/build.mjs +3 -1
- package/src/lib/capture.mjs +135 -56
- package/src/lib/evaluate.mjs +115 -12
- package/src/lib/htmlview.mjs +3 -1
- package/src/lib/keyboard.mjs +4 -2
- package/src/lib/mail.mjs +6 -4
- package/src/lib/manifest-core.mjs +17 -2
- package/src/lib/pii.mjs +924 -0
- package/src/lib/recording.mjs +12 -2
- package/src/lib/run.mjs +3 -1
- package/src/lib/secrets.mjs +5 -3
- package/src/lib/triage-core.mjs +167 -0
- package/src/lib/triage.mjs +135 -0
- package/templates/scenario.yml +1 -0
- package/viewer/fonts/OFL-IBMPlexMono.txt +93 -0
- package/viewer/fonts/OFL-InstrumentSans.txt +93 -0
- package/viewer/fonts/ibm-plex-mono-400-latin-ext.woff2 +0 -0
- package/viewer/fonts/ibm-plex-mono-400-latin.woff2 +0 -0
- package/viewer/fonts/ibm-plex-mono-500-latin-ext.woff2 +0 -0
- package/viewer/fonts/ibm-plex-mono-500-latin.woff2 +0 -0
- package/viewer/fonts/instrument-sans-latin-ext.woff2 +0 -0
- package/viewer/fonts/instrument-sans-latin.woff2 +0 -0
- package/viewer/index.html +132 -22
package/README.md
CHANGED
|
@@ -219,6 +219,10 @@ Every AI verdict comes with one sentence saying why. Criteria marked
|
|
|
219
219
|
`vision: true`, and answers the text evaluator is unsure about, get a second
|
|
220
220
|
look at the screenshot from a vision model (`ANTHROPIC_API_KEY`, or through
|
|
221
221
|
Kaloko); `kaloko build` lists what to act on with the score and the reason.
|
|
222
|
+
As an experiment you can switch on in Settings, Clef on Cloudflare also names
|
|
223
|
+
the kind of problem each screen and its recording show (overlap, cut-off text,
|
|
224
|
+
a raw translation key, an endless spinner); reviewers turn the right findings
|
|
225
|
+
into comments with one click, and findings never change a verdict.
|
|
222
226
|
The `a11y` pack walks the page with Tab (order, visible focus, traps, skip
|
|
223
227
|
link) and reads names from the accessibility tree. Pixel diffs skip the
|
|
224
228
|
regions a step ignores; `kaloko walk --stability 3` and `kaloko stability`
|
|
@@ -410,6 +414,18 @@ captured HTML, page text and console output.
|
|
|
410
414
|
`npx kaloko doctor` checks that every variable the config names is set and that
|
|
411
415
|
each environment lets you in.
|
|
412
416
|
|
|
417
|
+
**Personal data.** `capture.mask` (CSS selectors) hides personal data in
|
|
418
|
+
everything a step stores: a striped box on the screenshot, `[hidden]` of the
|
|
419
|
+
same length in the HTML and the page outline, and the same places in traces,
|
|
420
|
+
recordings and captured e-mails. `pii: redact` on a scenario finds e-mails,
|
|
421
|
+
phone numbers, birth numbers, IBANs and addresses by itself; `pii:
|
|
422
|
+
pseudonymize` puts consistent fake values in their place instead. An
|
|
423
|
+
environment with `pii: required` gets no run without it. When such a run still
|
|
424
|
+
holds an unmasked e-mail or phone number, `npx kaloko share` refuses it and
|
|
425
|
+
names the step and element (`--allow-pii` overrides); other runs are shared
|
|
426
|
+
with a warning. The site's own contacts (its domain, the footer, Organization
|
|
427
|
+
JSON-LD) do not count. Checks always read the real page.
|
|
428
|
+
|
|
413
429
|
Set `browser.channel: chrome` to use an installed Chrome, or run
|
|
414
430
|
`npx kaloko browser install` for the Chromium of kaloko's Playwright
|
|
415
431
|
(`KALOKO_BROWSER_CHANNEL=chromium` then uses it, which is how CI runs).
|
package/package.json
CHANGED
package/schemas/config.v1.json
CHANGED
|
@@ -78,6 +78,29 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
]
|
|
81
|
+
},
|
|
82
|
+
"triage": {
|
|
83
|
+
"description": "Triage (#65, experimental): Cloudflare's Clef names the kind of problem on each evaluated screen and in chosen frames of its recording (overlap, cut-off text, raw key, endless spinner…). Findings are advisory and never change a verdict. Runs through the organization's service once an admin switches the experiment on (Settings → Security → Experiments), or with CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID. false turns it off.",
|
|
84
|
+
"oneOf": [
|
|
85
|
+
{ "const": false },
|
|
86
|
+
{
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"properties": {
|
|
90
|
+
"model": { "enum": ["clef", "clef-flash"], "default": "clef", "description": "clef found more on the first bench; clef-flash answers about twice as fast." },
|
|
91
|
+
"keep": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.7, "description": "Findings at or above this probability show on the canvas; lower ones fold under Less likely." },
|
|
92
|
+
"maybe": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.5, "description": "Findings below this probability are dropped." },
|
|
93
|
+
"max_width": { "type": "integer", "minimum": 320, "maximum": 2048, "default": 896 },
|
|
94
|
+
"tile_height": { "type": "integer", "minimum": 400, "maximum": 4000, "default": 1024, "description": "Clef reads about one token per 40 pixels within 65,536 tokens: keep max_tiles × max_width × tile_height near 1.8 million." },
|
|
95
|
+
"max_tiles": { "type": "integer", "minimum": 1, "maximum": 4, "default": 2 },
|
|
96
|
+
"frame_width": { "type": "integer", "minimum": 240, "maximum": 1280, "default": 640, "description": "Width of recording frames sent to Clef (four per request)." },
|
|
97
|
+
"frames_per_step": { "type": "integer", "minimum": 0, "maximum": 12, "default": 6, "description": "Frames chosen from a step's recording (around taps, sharp changes and the end); 0 skips recordings." },
|
|
98
|
+
"frames_per_run": { "type": "integer", "minimum": 0, "default": 60 },
|
|
99
|
+
"max_calls": { "type": "integer", "minimum": 0, "default": 200, "description": "Uncached triage requests per evaluation." },
|
|
100
|
+
"cascade": { "type": "boolean", "default": false, "description": "Let Clef settle semantic criteria the text evaluator is unsure about when its answer is clear (#71); the vision evaluator is then asked only for the rest. Off: Clef's answer is recorded beside the verdict (clef_score) for comparison." }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
81
104
|
}
|
|
82
105
|
}
|
|
83
106
|
},
|
|
@@ -102,6 +125,15 @@
|
|
|
102
125
|
"trace": { "type": "boolean", "default": true, "description": "Keep a trace per walked step (actions, network requests, console) shown under Technical; false or walk --no-trace turns it off." }
|
|
103
126
|
}
|
|
104
127
|
},
|
|
128
|
+
"pii": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"description": "Personal data (#64).",
|
|
132
|
+
"properties": {
|
|
133
|
+
"allow": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Values that look like personal data but are not, such as the company's contact e-mail or phone number. * matches any text (*@acme.example). Neither masked nor stopped by kaloko share." },
|
|
134
|
+
"site_contacts": { "type": "boolean", "default": true, "description": "kaloko share takes the site's own contacts for not personal data: e-mails on the environment's domain, e-mails and phone numbers in the page footer, and those of an Organization or ContactPoint in JSON-LD. false checks them like any other value." }
|
|
135
|
+
}
|
|
136
|
+
},
|
|
105
137
|
"share": {
|
|
106
138
|
"type": "object",
|
|
107
139
|
"additionalProperties": false,
|
|
@@ -205,6 +237,7 @@
|
|
|
205
237
|
"description": "Base URL, or per-locale base URLs (key \"default\" is the fallback). ${VAR} is replaced from the environment, e.g. https://${REVIEW_HOST} for review apps."
|
|
206
238
|
},
|
|
207
239
|
"readonly": { "type": "boolean", "default": false },
|
|
240
|
+
"pii": { "enum": ["required", "redact", "pseudonymize", "off"], "description": "Personal data in runs of this environment. redact or pseudonymize: every run hides it (placeholders, or consistent fake values). required: a run is only created when the scenario or kaloko start --pii hides it, e.g. for production or a local copy of production data." },
|
|
208
241
|
"app": {
|
|
209
242
|
"type": "object",
|
|
210
243
|
"additionalProperties": false,
|
package/schemas/run.v1.json
CHANGED
|
@@ -358,6 +358,13 @@
|
|
|
358
358
|
"type": "object",
|
|
359
359
|
"description": "node|locale → revision, entry, status and author of a draft head."
|
|
360
360
|
},
|
|
361
|
+
"pii": {
|
|
362
|
+
"type": [
|
|
363
|
+
"object",
|
|
364
|
+
"null"
|
|
365
|
+
],
|
|
366
|
+
"description": "Personal data hidden in this run (#64): { hidden: true, mode: redact | pseudonymize, auto, captures }. The canvas says so, so a blank place is not read as a bug."
|
|
367
|
+
},
|
|
361
368
|
"app_version": {
|
|
362
369
|
"type": [
|
|
363
370
|
"string",
|
|
@@ -497,6 +504,10 @@
|
|
|
497
504
|
"quality": {
|
|
498
505
|
"type": "object",
|
|
499
506
|
"description": "Capture quality when not the canvas default: format, scale, masked (count), annotations [{n, criterion, x, y}]"
|
|
507
|
+
},
|
|
508
|
+
"pii": {
|
|
509
|
+
"type": "object",
|
|
510
|
+
"description": "Personal data hidden on this capture (#64): mode (redact, pseudonymize), auto (detection on), kinds {kind: count}, rects [{x, y, w, h, kind}] in CSS px of the page, marked on the canvas."
|
|
500
511
|
}
|
|
501
512
|
}
|
|
502
513
|
}
|
package/schemas/scenario.v1.json
CHANGED
|
@@ -186,6 +186,10 @@
|
|
|
186
186
|
},
|
|
187
187
|
"capture": {
|
|
188
188
|
"$ref": "#/$defs/capture"
|
|
189
|
+
},
|
|
190
|
+
"pii": {
|
|
191
|
+
"enum": ["redact", "pseudonymize"],
|
|
192
|
+
"description": "Personal data in every capture of the flow: redact hides it behind placeholders and boxes, pseudonymize replaces it with fake values that stay the same for one value throughout the run. Both detect e-mails, phone numbers, birth dates, birth numbers, IBANs, account numbers and addresses; capture.mask adds selectors."
|
|
189
193
|
}
|
|
190
194
|
},
|
|
191
195
|
"$defs": {
|
|
@@ -849,11 +853,11 @@
|
|
|
849
853
|
"description": "WebP quality"
|
|
850
854
|
},
|
|
851
855
|
"mask": {
|
|
852
|
-
"
|
|
853
|
-
|
|
854
|
-
"
|
|
855
|
-
|
|
856
|
-
"description": "CSS selectors
|
|
856
|
+
"oneOf": [
|
|
857
|
+
{ "type": "array", "items": { "type": "string", "minLength": 1 } },
|
|
858
|
+
{ "const": "auto" }
|
|
859
|
+
],
|
|
860
|
+
"description": "Personal data to hide in every output of the capture (screenshot, HTML, page outline, evaluators, trace, recording): CSS selectors, auto (detect e-mails, phone numbers, birth dates, birth numbers, IBANs, account numbers and addresses), or selectors with auto among them. The scenario's and the step's masks add up."
|
|
857
861
|
},
|
|
858
862
|
"annotate": {
|
|
859
863
|
"type": "boolean",
|
package/skills/kaloko/SKILL.md
CHANGED
|
@@ -102,7 +102,9 @@ step or accept a run on a person's behalf, and never hand out a signed
|
|
|
102
102
|
acceptance record (`kaloko signoff`) for a run a person has not accepted; report what waits for them
|
|
103
103
|
(`kaloko review`, MCP `get_review_queue`) instead. Ask the person
|
|
104
104
|
for secret values (passwords, tokens, gate credentials) and for sign-ins only
|
|
105
|
-
they can do; never write secrets into the config, a scenario or a script.
|
|
105
|
+
they can do; never write secrets into the config, a scenario or a script. When
|
|
106
|
+
`kaloko share` stops on personal data, mask it and capture again; `--allow-pii`
|
|
107
|
+
only when a person says that value may be uploaded.
|
|
106
108
|
|
|
107
109
|
## Where to look
|
|
108
110
|
|
|
@@ -153,7 +153,7 @@ documentation, manuals and training material set print quality on the scenario o
|
|
|
153
153
|
capture:
|
|
154
154
|
format: png # lossless
|
|
155
155
|
scale: 2 # 2× device pixels, crisp in a PDF
|
|
156
|
-
mask: ["[data-qa=email]", ".customer-name"] #
|
|
156
|
+
mask: ["[data-qa=email]", ".customer-name"] # personal data hidden in the image, HTML, outline, trace and video
|
|
157
157
|
annotate: true # numbered marks on the elements of criteria with `highlight`, in criteria order
|
|
158
158
|
```
|
|
159
159
|
|
|
@@ -161,7 +161,13 @@ A node's `capture:` overrides the scenario's. Crops for a manual take padding in
|
|
|
161
161
|
`await crop('#checkout-summary', 'Order summary', { padding: 16 })`. Print quality costs storage (a
|
|
162
162
|
2× PNG is several times a 1× WebP), so keep it for documentation scenarios, not for every run. The
|
|
163
163
|
canvas still loads a small WebP thumbnail; the lightbox and `latest.image` serve the full file.
|
|
164
|
-
Masks
|
|
164
|
+
Masks cover every output of the step: the screenshot gets a striped box, the HTML and the page outline get
|
|
165
|
+
`[hidden]` of the same length, traces, recordings and captured e-mails are covered too; checks still read the real
|
|
166
|
+
page. On data copied from production add `pii: redact` to the scenario (automatic detection of e-mails, phones,
|
|
167
|
+
birth numbers, IBANs, addresses) or `pii: pseudonymize` (consistent fake values, readable screens). An environment
|
|
168
|
+
with `pii: required` refuses a run without it, and in a run that hides personal data `kaloko share` stops on an
|
|
169
|
+
unmasked e-mail or phone number and names the step and element (other runs are shared with a warning): mask it and capture again, list a company contact under `pii.allow` in the config, and
|
|
170
|
+
use `--allow-pii` only when a person says the value may go up.
|
|
165
171
|
|
|
166
172
|
## Keeping plan and scenario aligned
|
|
167
173
|
|
|
@@ -68,6 +68,18 @@ evaluators:
|
|
|
68
68
|
Report the reason with each `needs_review` or failing criterion; when the
|
|
69
69
|
evaluator saw the screenshot, say so.
|
|
70
70
|
|
|
71
|
+
## Triage findings (experimental)
|
|
72
|
+
|
|
73
|
+
When the organization switched the experiment on, `kaloko evaluate` also asks
|
|
74
|
+
Clef, a model on Cloudflare, what kind of problem each screen and a few frames
|
|
75
|
+
of its recording show: overlap, cut-off text, raw keys, placeholders, errors,
|
|
76
|
+
endless loading, layout jumps and more. They land in the eval file and the run
|
|
77
|
+
as `findings` (kind, probability, severity, frame times) and never change a
|
|
78
|
+
verdict. Mention the shown ones (`shown: true`) as "possible problems", apart
|
|
79
|
+
from the verdicts, and fix the clear ones; `get_findings` lists them with the
|
|
80
|
+
answers reviewers gave. Do not answer findings on a reviewer's behalf unless
|
|
81
|
+
asked. `evaluators.triage: false` turns it off.
|
|
82
|
+
|
|
71
83
|
When a criterion comes back `needs_review`, read the reduced state the
|
|
72
84
|
evaluator saw (`steps/<node>/<locale>/<viewport>.capture.json`, key `state`)
|
|
73
85
|
and the screenshot. Either the page is genuinely unclear (report it), the
|
package/src/cli.mjs
CHANGED
|
@@ -62,6 +62,7 @@ import { passesOf, enginesOf, contextOptionsOf, launchEngine, pickKeys, variantF
|
|
|
62
62
|
import { startScope, scopeKeys, dimensionLine, baseViewports, engineKeys, appDeviceGroups } from './lib/walk-dimensions.mjs'
|
|
63
63
|
import { deviceConfig, prepareAndroid, readyAndroid, finishAndroid, prepareSimulator, applyAppAppearance } from './lib/apps/devices.mjs'
|
|
64
64
|
import { attachAndroidWebView } from './lib/apps/webview.mjs'
|
|
65
|
+
import { piiSettings, piiFindings, piiRequested, guardAllow, formatFindings } from './lib/pii.mjs'
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
const HELP = `kaloko — walk, assess and approve what your agents built, on one flow canvas
|
|
@@ -117,6 +118,8 @@ Run
|
|
|
117
118
|
[--states empty,error] Only these step states (states: on a step; keys like mobile.state-empty)
|
|
118
119
|
[--token-modes brand-a,brand-b | --token-modes none]
|
|
119
120
|
Design environments: the token modes to render (default every mode of the set)
|
|
121
|
+
[--pii redact|pseudonymize|off] Hide personal data in every capture (placeholders or consistent fake values);
|
|
122
|
+
default from the environment's or the scenario's pii
|
|
120
123
|
browser start|stop|status [--env e] [--headed] One shared browser per environment (port = browser.port + index)
|
|
121
124
|
Shared Chromium with CDP (agents, scripts and people drive it)
|
|
122
125
|
browser install [--with-deps] [--browsers chromium,webkit,firefox]
|
|
@@ -198,6 +201,9 @@ Results
|
|
|
198
201
|
hash, so unchanged captures are not sent again and a broken-off share resumes;
|
|
199
202
|
--pr adds or updates one comment on the branch's pull request via gh (KALOKO_PR in
|
|
200
203
|
CI), or a note on the GitLab merge request (KALOKO_GITLAB_TOKEN)
|
|
204
|
+
[--allow-pii] In a run that hides personal data, an unmasked e-mail, phone number, birth number or
|
|
205
|
+
IBAN stops the upload and names the step and element; --allow-pii uploads anyway
|
|
206
|
+
(other runs upload with a warning)
|
|
201
207
|
feedback [--run id] [--scenario id] [--json]
|
|
202
208
|
Open threads from reviewers (steps, the whole run, the whole flow) with ids and replies;
|
|
203
209
|
returned steps first, with their notes
|
|
@@ -518,7 +524,7 @@ async function designImport (args) {
|
|
|
518
524
|
await commands.start({ ...args, _: [], scenario: scenarioFile, env: env.name })
|
|
519
525
|
const current = await resolveRun({ root, output: config.output })
|
|
520
526
|
await commands.walk({ _: [], run: current.dir })
|
|
521
|
-
await commands.share({ _: [], run: current.dir, ...(typeof args.notes === 'string' ? { notes: args.notes } : {}), ...(typeof args.name === 'string' ? { name: args.name } : {}), ...(typeof args.branch === 'string' ? { branch: args.branch } : {}) })
|
|
527
|
+
await commands.share({ _: [], run: current.dir, ...(args['allow-pii'] ? { 'allow-pii': true } : {}), ...(typeof args.notes === 'string' ? { notes: args.notes } : {}), ...(typeof args.name === 'string' ? { name: args.name } : {}), ...(typeof args.branch === 'string' ? { branch: args.branch } : {}) })
|
|
522
528
|
return r
|
|
523
529
|
}
|
|
524
530
|
|
|
@@ -606,7 +612,7 @@ async function catalogFor (config, root) {
|
|
|
606
612
|
const expandRun = (value, short) => (value || '').replace('{run}', short)
|
|
607
613
|
|
|
608
614
|
// Finds the e-mail (or takes the one given) and captures it as the node's screens.
|
|
609
|
-
async function captureMail ({ config, root, run, env, node, locale, to, subject, timeoutMs = 60000, viewports, message = null, since, id = null }) {
|
|
615
|
+
async function captureMail ({ config, root, run, env, scenario = null, node, locale, to, subject, timeoutMs = 60000, viewports, message = null, since, id = null }) {
|
|
610
616
|
if (!message) {
|
|
611
617
|
const client = mailClient(env.mail, root, env)
|
|
612
618
|
// only messages that arrived during this run unless told otherwise (#52): stale e-mails are not captured silently
|
|
@@ -631,8 +637,9 @@ async function captureMail ({ config, root, run, env, node, locale, to, subject,
|
|
|
631
637
|
// Remote images are allowed for the screenshot but must not hold the capture hostage.
|
|
632
638
|
await page.setContent(html, { waitUntil: 'domcontentloaded', timeout: 20000 })
|
|
633
639
|
await page.waitForLoadState('load', { timeout: 15000 }).catch(() => {})
|
|
634
|
-
const mail = { id: message.id, subject: message.subject, from: message.from || '', to: (message.to || []).join(', '), date: message.date }
|
|
635
|
-
|
|
640
|
+
const mail = { id: message.id, subject: message.subject, from: message.from || '', to: (message.to || []).join(', '), ...(message.cc?.length ? { cc: message.cc.join(', ') } : {}), date: message.date }
|
|
641
|
+
// the scenario's masks apply to e-mails too (#64); recipients are masked whenever anything is
|
|
642
|
+
const results = await captureStep({ page, node, locale, viewports: scopeViewports(run, viewports), run, maxChars: config.evaluators?.jev?.max_state_chars, options: captureOptions(scenario, node), extra: { mail } })
|
|
636
643
|
return { subject: mail.subject, count: results.length }
|
|
637
644
|
} finally {
|
|
638
645
|
await browser.close()
|
|
@@ -803,7 +810,7 @@ async function walkApp ({ config, root, run, scenario, env, args }) {
|
|
|
803
810
|
if (node.kind === 'stack') { pending.push(`${node.id} (${locale}): stack steps list web pages; not walked on ${platform}`); continue }
|
|
804
811
|
if (node.kind === 'email' && group !== groups[0]) continue // one message, captured on the first device
|
|
805
812
|
if (node.kind === 'email' && node.mail?.to) {
|
|
806
|
-
try { const r = await captureMail({ config, root, run, env, node, locale, to: expandRun(node.mail.to, run.meta.short), subject: localized(node.mail?.subject, locale), timeoutMs: 45000 }); say(`✓ ${node.id} ${locale}: "${r.subject}"`) } catch (error) { failed.push(`${node.id} (${locale}): ${error.message.split('\n')[0]}`); say(`✗ ${node.id} ${locale}: ${error.message.split('\n')[0]}`) }
|
|
813
|
+
try { const r = await captureMail({ config, root, run, env, scenario, node, locale, to: expandRun(node.mail.to, run.meta.short), subject: localized(node.mail?.subject, locale), timeoutMs: 45000 }); say(`✓ ${node.id} ${locale}: "${r.subject}"`) } catch (error) { failed.push(`${node.id} (${locale}): ${error.message.split('\n')[0]}`); say(`✗ ${node.id} ${locale}: ${error.message.split('\n')[0]}`) }
|
|
807
814
|
continue
|
|
808
815
|
}
|
|
809
816
|
const scripted = ['playwright', 'script'].includes(node.execution?.strategy) && node.execution?.script
|
|
@@ -1077,6 +1084,8 @@ const commands = {
|
|
|
1077
1084
|
const env = environment(config, args.env)
|
|
1078
1085
|
if (scenario.environments && !scenario.environments.includes(env.name)) throw new UserError(`Scenario ${scenario.id} is not allowed on ${env.name} (allowed: ${scenario.environments.join(', ')}).`)
|
|
1079
1086
|
if (env.readonly && !scenario.readonly) throw new UserError(`Environment ${env.name} is readonly; the scenario must declare readonly: true.`)
|
|
1087
|
+
// personal data (#64): an environment with pii: required gets no run that would store it unmasked
|
|
1088
|
+
const pii = piiSettings({ config, env, scenario, args })
|
|
1080
1089
|
const locales = list(args.locales) || scenario.locales || ['default']
|
|
1081
1090
|
// design environments render every mode of their token set (#46): the modes come from the folder's set
|
|
1082
1091
|
const tokenModes = env.kind === 'design' ? await designTokenModesOf(config, root, env) : []
|
|
@@ -1089,8 +1098,9 @@ const commands = {
|
|
|
1089
1098
|
const appVer = typeof args['app-version'] === 'string' ? args['app-version'].slice(0, 80) : await appVersion(root)
|
|
1090
1099
|
// the product the flow documents (visual changelog): its tag, or the only product of the config
|
|
1091
1100
|
const product = scenario.product || (Object.keys(config.products || {}).length === 1 ? Object.keys(config.products)[0] : null)
|
|
1092
|
-
const { dir, meta } = await createRun({ output: config.output, scenario, scenarioFile, env, scope, git, executor, root, project, issue, appVersion: appVer, product })
|
|
1101
|
+
const { dir, meta } = await createRun({ output: config.output, scenario, scenarioFile, env, scope, git, executor, root, project, issue, appVersion: appVer, product, pii })
|
|
1093
1102
|
say(`Run ${meta.id}\n dir: ${relative(process.cwd(), dir)}\n env: ${env.name}${env.readonly ? ' (readonly)' : ''}\n locales: ${locales.join(', ')} viewports: ${vpNames.length > 12 ? `${vpNames.slice(0, 12).join(', ')} … (${vpNames.length})` : vpNames.join(', ')}${dimensionLine(scope)}\n project: ${project.slug}${issue ? ` issue: ${issue.repo ? issue.repo + '#' : '#'}${issue.number}` : ''}`)
|
|
1103
|
+
if (pii) say(` personal data: ${pii.mode === 'pseudonymize' ? 'replaced with fake values' : 'hidden'} in every capture`)
|
|
1094
1104
|
const addr = recipient(env.mail, meta.short)
|
|
1095
1105
|
if (addr) say(` test e-mail: ${addr}`)
|
|
1096
1106
|
say(` other agents may start runs here too: pin this one with --run ${meta.id} or KALOKO_RUN=${meta.id}`)
|
|
@@ -1189,7 +1199,7 @@ const commands = {
|
|
|
1189
1199
|
const target = args.url === true || (!conn && !args.url) ? urlFor(env, node, locale) : args.url
|
|
1190
1200
|
if (target) await page.goto(target, { waitUntil: 'domcontentloaded' })
|
|
1191
1201
|
if (args.crop) {
|
|
1192
|
-
const entry = await captureCrop({ page, node, locale, selector: args.crop, title: args.title, run })
|
|
1202
|
+
const entry = await captureCrop({ page, node, locale, selector: args.crop, title: args.title, run, options: captureOptions(scenario, node) })
|
|
1193
1203
|
say(`Attached ${entry.file} to ${node.id}`)
|
|
1194
1204
|
return
|
|
1195
1205
|
}
|
|
@@ -1222,7 +1232,7 @@ const commands = {
|
|
|
1222
1232
|
let since
|
|
1223
1233
|
if (args['any-time']) since = null
|
|
1224
1234
|
else if (typeof args.since === 'string') { const t = Date.parse(args.since); if (Number.isNaN(t)) throw new UserError(`--since ${args.since} is not a date (ISO 8601, e.g. 2026-09-27T10:00).`); since = new Date(t).toISOString() }
|
|
1225
|
-
const results = await captureMail({ config, root, run, env, node, locale, to, subject, timeoutMs: (Number(args.timeout) || 60) * 1000, viewports: list(args.viewports), message, since, id: typeof args.id === 'string' ? args.id : null })
|
|
1235
|
+
const results = await captureMail({ config, root, run, env, scenario, node, locale, to, subject, timeoutMs: (Number(args.timeout) || 60) * 1000, viewports: list(args.viewports), message, since, id: typeof args.id === 'string' ? args.id : null })
|
|
1226
1236
|
say(`✓ ${node.id} ${locale}: "${results.subject}" → ${results.count} viewport(s)`)
|
|
1227
1237
|
},
|
|
1228
1238
|
|
|
@@ -1382,7 +1392,7 @@ const commands = {
|
|
|
1382
1392
|
// an e-mail node with a recipient is walked like a step: wait for the message and capture it
|
|
1383
1393
|
try {
|
|
1384
1394
|
const to = expandRun(node.mail?.to || sessionInfo(node.session).mailbox, run.meta.short)
|
|
1385
|
-
const results = await captureMail({ config, root, run, env, node, locale, to, subject: localized(node.mail?.subject, locale), timeoutMs: 45000 })
|
|
1395
|
+
const results = await captureMail({ config, root, run, env, scenario, node, locale, to, subject: localized(node.mail?.subject, locale), timeoutMs: 45000 })
|
|
1386
1396
|
say(`✓ ${node.id} ${locale}${tag}: "${results.subject}"`)
|
|
1387
1397
|
} catch (error) {
|
|
1388
1398
|
failed.push(`${node.id} (${locale}${tag}): ${error.message.split('\n')[0]}`)
|
|
@@ -1406,7 +1416,7 @@ const commands = {
|
|
|
1406
1416
|
const records = []
|
|
1407
1417
|
const capture = (opts = {}) => { captured = true; rec?.beforeCapture(node); return captureStep({ page: sPage, node, locale, options: captureOptions(scenario, node), viewports: scopeKeys(run.meta.scope, stateKeys(run.meta.scope, Object.keys(scopeKeys(run.meta.scope, pass.keys, opts.viewports || null)), state)), run, htmlView: htmlViewAllowed(env, scenario) ? { scenarioId: scenario.id } : null, consoleFile, maxChars: config.evaluators?.jev?.max_state_chars, extra: node.session ? { session: node.session } : {}, stability: Number(args.stability) || 0 }).then((r) => { prefetch?.add(r, run.dir); records.push(...r); return r }) }
|
|
1408
1418
|
try {
|
|
1409
|
-
await mod.default({ page: sPage, context: sCtx, locale, state, node: { id: node.id, title: localized(node.title, locale), kind: node.kind, ...(node.states ? { states: nodeStates(run.meta.scope, node) } : {}) }, session: sessionInfo(node.session), url: (id = node.id) => urlFor(env, stepOf(scenario, id), locale), env, run: run.meta, capture, crop: (selector, title, o = {}) => captureCrop({ page: sPage, node, locale, selector, title, run, padding: Number(o.padding) || 0 }), acceptDialogs: () => acceptDialogs(sPage) })
|
|
1419
|
+
await mod.default({ page: sPage, context: sCtx, locale, state, node: { id: node.id, title: localized(node.title, locale), kind: node.kind, ...(node.states ? { states: nodeStates(run.meta.scope, node) } : {}) }, session: sessionInfo(node.session), url: (id = node.id) => urlFor(env, stepOf(scenario, id), locale), env, run: run.meta, capture, crop: (selector, title, o = {}) => captureCrop({ page: sPage, node, locale, selector, title, run, padding: Number(o.padding) || 0, options: captureOptions(scenario, node) }), acceptDialogs: () => acceptDialogs(sPage) })
|
|
1410
1420
|
if (!captured) await capture()
|
|
1411
1421
|
} catch (error) { await rec?.afterStep(node, { error }); throw error }
|
|
1412
1422
|
await rec?.afterStep(node, { records })
|
|
@@ -1735,6 +1745,7 @@ const commands = {
|
|
|
1735
1745
|
const via = report.via.qawalk ? ` via Kaloko${report.hosted?.limit != null ? ` (${report.hosted.questions} of ${report.hosted.limit} questions this month)` : ''}` : report.via['own-key'] ? ' with your key' : ''
|
|
1736
1746
|
say(`Evaluated ${report.evaluated} capture(s); semantic evaluator ${report.model}${via}: ${report.semantic_calls} call(s), ${report.semantic_cached} cached.`)
|
|
1737
1747
|
if (report.vision?.asked) say(`Vision evaluator ${report.vision.model}: ${report.vision.asked} capture(s) with flagged or uncertain criteria, ${report.vision.calls} call(s), ${report.vision.cached} cached${report.vision.skipped.length ? `; not asked: ${[...new Set(report.vision.skipped.map((x) => x.split(': ').slice(1).join(': ')))].slice(0, 2).join('; ')}` : ''}.`)
|
|
1748
|
+
if (report.triage) say(report.triage.screens ? `Triage (experimental, ${report.triage.model}): ${report.triage.screens} screen(s)${report.triage.frames ? ` and ${report.triage.frames} recording frame(s)` : ''}, ${report.triage.shown} finding(s) to look at${report.triage.findings > report.triage.shown ? ` and ${report.triage.findings - report.triage.shown} less likely` : ''}; they never change a verdict.${report.triage.skipped ? ` Not every request was answered: ${report.triage.skipped}` : ''}` : `Triage (experimental): not run${report.triage.skipped ? `: ${report.triage.skipped}` : ' (no screenshot to look at)'}`)
|
|
1738
1749
|
if (report.skipped.length) {
|
|
1739
1750
|
// one line per reason: "12 captures: TYPESAFE_API_KEY is not set …"
|
|
1740
1751
|
const byReason = new Map()
|
|
@@ -1800,6 +1811,14 @@ const commands = {
|
|
|
1800
1811
|
for (const it of idx.items) for (const byVp of Object.values(it.captures || {})) for (const c of Object.values(byVp)) [c.png, c.thumb, c.html, c.eval].filter(Boolean).forEach((p) => files.add(p))
|
|
1801
1812
|
}
|
|
1802
1813
|
}
|
|
1814
|
+
// personal data (#64): nothing goes up with an unmasked e-mail, phone number, birth number or IBAN in it
|
|
1815
|
+
const views = manifest.nodes.flatMap((n) => Object.values(n.captures || {}).flatMap((vps) => Object.values(vps).map((c) => c.view?.revision).filter(Boolean))).map((id) => `live/${id}/index.html`)
|
|
1816
|
+
// a run that asked for hiding personal data is refused; any other run is shared with a warning
|
|
1817
|
+
const findings = await piiFindings({ dir: run.dir, files: [...files, ...views], manifest, allow: guardAllow({ config, env, scenario, run }), site: { url: run.meta.environment?.base_url || env.base_url, contacts: config.pii?.site_contacts !== false } })
|
|
1818
|
+
const strict = piiRequested({ run, env, scenario })
|
|
1819
|
+
if (findings.length && strict && !args['allow-pii']) throw new UserError(`Not shared: the run holds ${findings.length} unmasked personal data value(s):\n${formatFindings(findings)}\nMask them (capture.mask in the scenario, or pii: redact for automatic detection) and capture the steps again. Values that are not personal data, such as a company contact, go under pii.allow in kaloko.config.yml. To share anyway: kaloko share --allow-pii.`)
|
|
1820
|
+
if (findings.length && strict) say(`Sharing ${findings.length} unmasked personal data value(s), as --allow-pii says:\n${formatFindings(findings, 5)}`)
|
|
1821
|
+
else if (findings.length) say(`This run shows ${findings.length} value(s) that look like personal data:\n${formatFindings(findings, 5)}\nShared anyway, because the run does not hide personal data. To hide it, add pii: redact to the scenario or the environment; values that are not personal data go under pii.allow in kaloko.config.yml.`)
|
|
1803
1822
|
const days = Number(args.expires) || config.share?.expires_days || 30
|
|
1804
1823
|
// by content hash (#28): files the organization already stores (earlier runs, an interrupted share) are not sent
|
|
1805
1824
|
let entries = await hashFiles(run.dir, [...files])
|
package/src/lib/build.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { readJson, writeJson } from './util.mjs'
|
|
|
6
6
|
import { readCaptures, runPaths, listRuns } from './run.mjs'
|
|
7
7
|
import { latestCaptures, evaluationSource, stepIdOf } from './evaluate.mjs'
|
|
8
8
|
import { layout } from './scenario.mjs'
|
|
9
|
-
import { assembleNode, assembleStack, summarize } from './manifest-core.mjs'
|
|
9
|
+
import { assembleNode, assembleStack, summarize, runPii } from './manifest-core.mjs'
|
|
10
10
|
import { packageRoot } from './schema.mjs'
|
|
11
11
|
import { variantOf } from './dimensions.mjs'
|
|
12
12
|
|
|
@@ -82,6 +82,8 @@ export async function buildManifest ({ run, scenario, config, root, catalog = []
|
|
|
82
82
|
nodes,
|
|
83
83
|
edges: scenario.edges.map((e) => ({ from: e.from, to: e.to, label: e.label || '', kind: e.kind || 'main' })),
|
|
84
84
|
summary,
|
|
85
|
+
// "personal data hidden" (#64): the canvas says so, so a blank is not taken for a bug
|
|
86
|
+
...(runPii(meta, nodes) ? { pii: runPii(meta, nodes) } : {}),
|
|
85
87
|
coverage: cov,
|
|
86
88
|
history,
|
|
87
89
|
catalog,
|