Merge origin/main into feat/screenshot-targets

This commit is contained in:
Guilhem Lemouel
2026-12-01 03:19:44 -08:00
781 changed files with 41584 additions and 7822 deletions
+132
View File
@@ -0,0 +1,132 @@
---
name: demo-video
description: Record a demo video of a feature, either a narrated browser walkthrough (mp4 with burned-in captions and text-to-speech audio) driven by Playwright, or a terminal session (a CLI or TUI such as Codex or Claude Code) recorded with vhs, optionally beside the browser it drives, with its idle waits cut. Use when the user asks for a demo video, a recorded walkthrough, a terminal or CLI recording, a video to check a feature, a video for a PR, or to cut the waiting out of a recording.
---
# Demo video
One scenario file in, one mp4 out. Do not snapshot or screenshot the page while writing the
scenario: write selectors from the code you just changed, run once, and fix only the step the
script reports as failed.
Every script lives in `.agents/skills/demo-video/`; the commands below are written from the repo
root. Scratch files (scenarios, tapes, recordings) go in the session scratchpad, never in the
repo: `record.mjs` writes only the mp4 you name, beside the scenario by default.
For a terminal session (vhs, optionally beside a browser), for cutting the waits out of any
silent recording, and for adding a voice-over to a cut, follow
`.agents/skills/demo-video/terminal.md`. A browser take whose waits depend on an AI (a chat
turn) goes the same way: record it silent with Playwright's `recordVideo`, cut, then narrate,
rather than through `record.mjs`, whose narration cannot survive a cut.
## What it needs
| Tool | Used by | Without it |
| --- | --- | --- |
| Playwright: `npm ci --prefix .agents/skills/demo-video`, once per worktree | every script | the script stops with that command |
| Playwright's Chromium: `npx --prefix .agents/skills/demo-video playwright install chromium`, once per machine | every script | the script stops with that command |
| `ffmpeg` and `ffprobe` (`brew install ffmpeg`) | every script | the script stops before recording |
| macOS `say` | narration in `record.mjs` and `narrate.mjs` | set `voice: false` in the scenario or pass `--voice=none`: captions only, no audio, each line on screen for its reading time |
| `vhs` (`brew install vhs`, brings `ttyd`) | terminal recordings | no terminal recordings; browser demos still work |
Homebrew's `ffmpeg` has no text filters, so captions and notes are drawn by the browser and
overlaid as images.
## Write the scenario
`<scratch>/demo.mjs`, against this worktree's frontend (its URL is in the session's
instructions, or `FRONTEND_PORT` in `.env.local`):
```js
export default {
baseURL: 'http://localhost:3000',
start: '/?workspace=admins', // first page shown in the video
// Runs unrecorded; its cookies carry into the recording. Log in here.
setup: async ({ page }) => {
const r = await page.request.post('/api/auth/login',
{ data: { email: 'admin@windmill.dev', password: 'changeme' } })
if (!r.ok()) throw new Error(`login: ${r.status()}`)
},
steps: [
{ say: 'One sentence about what the viewer sees.' },
{ say: 'Clicking the row opens it.', do: ({ click }) => click('text=Daily orders') },
{ say: 'Hover shows the menu.', do: async ({ page, hover }) => { await hover('[aria-label="Menu"]') } },
],
}
```
- `say`: narration, spoken and shown as the caption. It starts before the step's action, and
the step stays on screen until it is spoken. Keep each to one short sentence.
- `do`: gets `{ page, click, hover, wait }`. `click`/`hover` draw a ring on the target first, so
prefer them over `page.click`. Strings are Playwright selectors (the first match is used);
a locator is used as given, so a locator matching two elements fails the step. Assert the
outcome inside the step by waiting on what proves it worked, e.g.
`await page.getByText('Hello, Ada!').waitFor({ timeout: 30000 })`, so a broken feature fails
the run instead of recording a wrong screen. There is no `expect` in a scenario.
- Captions sit in a band of their own below the page (`captionAt: 'top'` puts it above), so
they never cover the UI. The mp4 is the viewport plus that band: 1280x816 by default.
- Optional: `hold` (extra ms after a step), `viewport` (default 1280x720), `voice` (macOS
`say -v '?'`, default Samantha; `false` for no speech), `settle` (ms after `start` loads),
`pad` (ms after each line, default 400), `captionHeight` (band height, default 96, two lines
of text; viewport height + band must be even for H.264).
- Text selectors (`text=…`) can match hidden copies; for menu items use a role locator,
`({ page, hover }) => hover(page.getByRole('menuitem', { name: /Shared sessions/ }))`.
- Aim for 5 to 10 steps, under a minute: the video is for checking a feature, not marketing.
## Test data must match the story
Plant the data the take needs before recording, and make it what the narration and the prompt
say it is. An AI agent in the take reads that data back and reacts to it: given a "Supabase"
connection string that pointed at `127.0.0.1`, Codex refused to call it a Supabase connection
and the take was unusable. Hosts, names, providers and values must fit the story; when the demo
needs the thing to really work, ask the user for a real instance of that kind rather than
planting a local stand-in. Never put a real secret on screen.
## Run
```bash
node .agents/skills/demo-video/record.mjs <scratch>/demo.mjs [<scratch>/demo.mp4]
```
It prints the mp4 path, or `step N failed: …` plus a screenshot path. Read that screenshot
only on failure.
## Deliver
The user may not be on this machine, so a local path is not a delivery.
- **Artifact page**: publish the mp4 through the Artifact `files` map (15 MB per file) and
reference it from a `<video controls>`. The captions are burned in, so nothing else is
needed. For a video made with `--no-band`, Artifacts do not serve `.vtt` files: write the
cues with `narrate.mjs --cues=cues.json` and add them from inline JS:
```js
const track = video.addTextTrack('captions', 'English', 'en')
for (const [start, end, text] of CUES) track.addCue(new VTTCue(start, end, text))
track.mode = 'showing'
```
- **PR body**: GitHub strips `<video>` from PR bodies and plays no mp4 from a raw URL (it
downloads), so embed a GIF and link the narrated mp4. Make the GIF (about 4 MB for 55 s):
```bash
ffmpeg -v error -y -i demo.mp4 -vf "fps=10,scale=960:-1:flags=lanczos,split[a][b];[a]palettegen=stats_mode=diff[p];[b][p]paletteuse=diff_mode=rectangle" demo.gif
```
Upload both to `windmill-labs/agent-screenshots-internal`, as the `pr` skill does for
screenshots. The repo is public and its history permanent: nothing secret may appear in the
video.
```bash
REPO=windmill-labs/agent-screenshots-internal
for F in demo.gif demo.mp4; do
DEST="shots/$(git branch --show-current)/$(date +%s)-$(basename "$F")"
base64 < "$F" | tr -d '\n' | jq -Rs --arg m "add $DEST" '{message:$m, content:.}' \
| gh api -X PUT "repos/$REPO/contents/$DEST" --input - >/dev/null
URL="https://raw.githubusercontent.com/$REPO/main/$DEST"
echo "$URL $(curl -sI "$URL" | grep -i '^content-length')"
done
```
Check that each `content-length` matches the local file, then put
`![demo](<gif url>)` and `[Narrated mp4](<mp4 url>)` in the body.
+44
View File
@@ -0,0 +1,44 @@
// Prints when each watched region of a recording changes, in seconds of the file itself, so
// `--cut=` ranges and narration `at` times come from the picture rather than from wall-clock
// logs (a vhs mp4 runs shorter than the session it recorded).
//
// usage: node activity.mjs <in.mp4> <regions.json> [from] [to] [--raw]
//
// Same sampling and regions.json as cut-waits.mjs (10 samples per second, `min`, `unlessLike`).
// Each region gets one line of runs of consecutive changes, `12.3-14.1(952)`: first and last
// changing sample, and the most pixels changed in one sample. --raw prints every sample in which
// anything changed, marked * when it counts (above `min`) and ~ when `unlessLike` suppressed it.
import { readFileSync } from 'node:fs'
import { die, need, sampleRegions, SAMPLES } from './lib.mjs'
const args = process.argv.slice(2)
const raw = args.includes('--raw')
const [input, regionsFile, from, to] = args.filter((a) => a !== '--raw')
if (!regionsFile) die('usage: node activity.mjs <in.mp4> <regions.json> [from] [to] [--raw]')
need('ffmpeg', 'ffprobe')
const regions = JSON.parse(readFileSync(regionsFile, 'utf8'))
const samples = await sampleRegions(input, regions, {
from: from === undefined ? 0 : Number(from),
to: to === undefined ? undefined : Number(to)
})
for (const [k, r] of regions.entries()) {
const hits = samples.filter((s) => !s.suppressed[k] && s.changed[k] > r.min)
if (raw) {
const all = samples.filter((s) => s.changed[k] > 0)
const mark = (s) => (s.suppressed[k] ? '~' : s.changed[k] > r.min ? '*' : '')
console.log(`${r.name}: ${all.map((s) => `${s.t.toFixed(1)}(${s.changed[k]})${mark(s)}`).join(' ')}`)
continue
}
const runs = []
for (const s of hits) {
const run = runs.at(-1)
if (run && s.t - run.to <= 1.5 / SAMPLES) {
run.to = s.t
run.max = Math.max(run.max, s.changed[k])
} else runs.push({ from: s.t, to: s.t, max: s.changed[k] })
}
const fmt = (run) =>
(run.to > run.from ? `${run.from.toFixed(1)}-${run.to.toFixed(1)}` : run.from.toFixed(1)) + `(${run.max})`
console.log(`${r.name}: ${runs.map(fmt).join(' ') || '-'}`)
}
+214
View File
@@ -0,0 +1,214 @@
// Shrinks the idle stretches of a silent screen recording (a terminal session, a browser take)
// to about a second each and marks every cut with a "N s later" note. It measures what changes,
// it does not guess: a stretch is idle when no watched region changes.
//
// usage: node cut-waits.mjs <in.mp4> <out.mp4> <regions.json> [options]
// --plan print the cuts and write the check sheets, render nothing
// --min-gap=3 cut only stretches at least this long (s)
// --head=0.7 keep this much of a stretch after the last change (s)
// --tail=0.3 and this much before the next change (s)
// --end-hold=5 keep this much after the last change, then end the video (s)
// --label-y=12 top of the "N s later" note, in pixels
// --cut=12.5-38 also remove this stretch, though the screen changes in it (repeatable)
//
// --cut is for a wait the measurement cannot see: an AI agent working, whose tool calls keep
// scrolling in while the viewer only waits for its answer. Take its bounds from activity.mjs,
// which prints when each region changes in seconds of <in.mp4>, never from wall-clock logs.
//
// regions.json lists the areas to watch, in pixels of <in.mp4>. A pixel changes when its gray
// level moves by more than 40 between two samples (10 per second); a region is active when more
// than `min` pixels change. Set `min` above what a blinking cursor changes (one cell, 170-210 px at
// font size 15) and below what typing changes (several cells per sample).
// `unlessLike` ignores a region's changes while a part of it still looks as it did at `at`
// seconds, e.g. a status line whose timer ticks while the app works but whose row also receives
// real output once the work is done.
// [{ "name": "status", "x": 0, "y": 670, "w": 820, "h": 35, "min": 30,
// "unlessLike": { "x": 40, "y": 675, "w": 72, "h": 22, "at": 40 } }]
//
// Writes <out>.regions.json, the regions with each unlessLike.at moved onto the output's timeline,
// for activity.mjs and narrate.mjs on the cut file.
// Writes <out>.cuts-<n>.png: for every cut, the last frame kept before it beside the first
// frame kept after it. Read them before trusting the cut: the two frames of a row must show the
// same content, apart from what ticks.
import { execFileSync } from 'node:child_process'
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { die, launchBrowser, need, probe, sampleRegions } from './lib.mjs'
const [input, output, regionsFile, ...rest] = process.argv.slice(2)
if (!regionsFile) die('usage: node cut-waits.mjs <in.mp4> <out.mp4> <regions.json> [--plan] [--min-gap=3] ...')
need('ffmpeg', 'ffprobe')
const forced = rest
.filter((a) => a.startsWith('--cut='))
.map((a) => {
const [from, to] = a.slice('--cut='.length).split('-').map(Number)
if (!(to > from)) die(`bad ${a}: expected --cut=<from>-<to> in seconds`)
return { from, to }
})
const opt = Object.fromEntries(
rest
.filter((a) => !a.startsWith('--cut='))
.map((a) => {
const [k, v] = a.replace(/^--/, '').split('=')
return [k, v === undefined ? true : Number(v)]
})
)
const minGap = opt['min-gap'] ?? 3
const head = opt.head ?? 0.7
const tail = opt.tail ?? 0.3
const endHold = opt['end-hold'] ?? 5
const labelY = opt['label-y'] ?? 12
if (minGap < head + tail) die(`--min-gap must be at least --head + --tail (${head + tail} s)`)
const regions = JSON.parse(readFileSync(regionsFile, 'utf8'))
const { fps, duration, hasAudio } = probe(input)
// 1. Measure: the samples where any watched region changes.
const active = (await sampleRegions(input, regions)).filter((s) => s.active).map((s) => s.t)
if (!active.length) {
console.error('nothing changes in the watched regions')
process.exit(1)
}
// 2. Plan: shrink every stretch of at least minGap between two changes, and the ending.
const measured = []
if (active[0] >= minGap) measured.push({ from: head, to: active[0] - tail })
for (let i = 1; i < active.length; i++) {
const [a, b] = [active[i - 1], active[i]]
if (b - a >= minGap) measured.push({ from: a + head, to: b - tail })
}
// Cuts less than half a second apart become one: the sliver between them would only flash.
const cuts = []
for (const c of [...measured, ...forced].sort((a, b) => a.from - b.from)) {
const prev = cuts.at(-1)
if (prev && c.from <= prev.to + 0.5) prev.to = Math.max(prev.to, c.to)
else cuts.push({ ...c })
}
const last = active.at(-1)
if (duration - last > endHold + 0.2) {
const from = last + endHold
const prev = cuts.at(-1)
if (prev && prev.to >= from - 0.5) Object.assign(prev, { to: duration, end: true })
else cuts.push({ from, to: duration, end: true })
}
// Cuts fall on frame times and the render keeps each segment half-open (select, below), so the
// output has exactly the planned frames and the times printed and mapped here are the rendered ones.
const snap = (t) => Math.round(t * fps) / fps
for (const c of cuts) Object.assign(c, { from: snap(c.from), to: c.end ? duration : snap(c.to) })
const kept = []
let cursor = 0
for (const c of cuts) {
kept.push([cursor, c.from])
cursor = c.to
}
if (cursor < duration) kept.push([cursor, duration])
let outAt = 0
cuts.forEach((c, k) => {
outAt += kept[k][1] - kept[k][0]
c.outAt = outAt
c.label = `${Math.round(c.to - c.from)} s later`
})
const outDuration = kept.reduce((s, [a, b]) => s + b - a, 0)
const clock = (s) => `${Math.floor(s / 60)}:${(s % 60).toFixed(1).padStart(4, '0')}`
for (const c of cuts)
console.log(
`${c.end ? 'end' : 'cut'} ${c.from.toFixed(1).padStart(6)} -> ${c.to.toFixed(1).padStart(6)} ` +
`${(c.to - c.from).toFixed(1).padStart(5)} s removed, at ${clock(c.outAt)} in the output` +
(c.end ? '' : ` "${c.label}"`)
)
console.log(`duration ${duration.toFixed(1)} s -> ${outDuration.toFixed(1)} s`)
// The regions for the cut file: an `unlessLike.at` is a time of the file it samples, so it moves
// with the cut. A time inside a cut moves to the cut's position in the output.
const toOutput = (t) => {
let base = 0
for (const [a, b] of kept) {
if (t < a) return base
if (t <= b) return base + t - a
base += b - a
}
return outDuration
}
const outRegions = output.replace(/\.mp4$/, '') + '.regions.json'
writeFileSync(
outRegions,
JSON.stringify(
regions.map((r) => (r.unlessLike ? { ...r, unlessLike: { ...r.unlessLike, at: +toOutput(r.unlessLike.at).toFixed(2) } } : r)),
null,
1
)
)
console.log(`regions of the output: ${outRegions}`)
// 3. Check sheets: the frames on both sides of every cut.
const work = mkdtempSync(join(tmpdir(), 'cut-waits-'))
const shot = (t, file) =>
execFileSync('ffmpeg', ['-v', 'error', '-y', '-ss', t.toFixed(3), '-i', input, '-frames:v', '1', '-vf', 'scale=640:-2', file])
const rows = cuts.filter((c) => !c.end)
for (let s = 0; s * 4 < rows.length; s++) {
const files = []
rows.slice(s * 4, s * 4 + 4).forEach((c, k) => {
const a = join(work, `s${s}r${k}a.png`)
const b = join(work, `s${s}r${k}b.png`)
shot(Math.max(0, c.from - 1 / fps), a)
shot(c.to, b)
files.push(a, b)
})
const n = files.length / 2
const graph =
files.map((_, i) => (i % 2 ? '' : `[${i}][${i + 1}]hstack[r${i / 2}];`)).join('') +
(n > 1 ? `${[...Array(n).keys()].map((i) => `[r${i}]`).join('')}vstack=inputs=${n}` : '[r0]null')
const sheet = output.replace(/\.mp4$/, '') + `.cuts-${s + 1}.png`
execFileSync('ffmpeg', ['-v', 'error', '-y', ...files.flatMap((f) => ['-i', f]), '-filter_complex', graph, sheet])
console.log(`check: ${sheet}`)
}
if (opt.plan) process.exit(0)
// 4. Notes, drawn by the browser: Homebrew's ffmpeg has no text filters.
const browser = await launchBrowser()
const page = await browser.newPage({ viewport: { width: 600, height: 120 } })
const notes = new Map()
for (const c of rows) {
if (notes.has(c.label)) continue
await page.setContent(
`<body style="margin:0;background:transparent"><div style="display:inline-block;padding:8px 16px;` +
`border-radius:999px;background:rgba(17,17,17,.85);border:1px solid rgba(255,255,255,.3);` +
`color:#fff;font:600 18px/1 system-ui,sans-serif"></div></body>`
)
await page.locator('div').evaluate((el, t) => (el.textContent = t), `⏩ ${c.label}`)
const file = join(work, `note${notes.size}.png`)
await page.locator('div').screenshot({ path: file, omitBackground: true })
notes.set(c.label, file)
}
await browser.close()
// 5. Render: keep the segments, retime them, show each note for a moment after its cut.
const noteFiles = [...notes.values()]
// Half a frame below each bound, so a frame exactly on a bound is kept once, by the later segment.
const half = 0.5 / fps
const keep = kept.map(([a, b]) => `gte(t,${(a - half).toFixed(4)})*lt(t,${(b - half).toFixed(4)})`).join('+')
// The second fps= restores the frame rate FFmpeg 7's setpts clears; without it the overlays
// below fall back to 25 fps.
const filters = [`[0:v]fps=${fps},select='${keep}',setpts=N/(${fps}*TB),fps=${fps}[v0]`]
rows.forEach((c, k) => {
const next = rows[k + 1]?.outAt ?? outDuration
const e = Math.min(c.outAt + 1.4, next)
const input = 1 + noteFiles.indexOf(notes.get(c.label))
filters.push(
`[v${k}][${input}:v]overlay=x=(W-w)/2:y=${labelY}:enable='between(t,${c.outAt.toFixed(3)},${e.toFixed(3)})'[v${k + 1}]`
)
})
execFileSync(
'ffmpeg',
[
'-v', 'error', '-y', '-i', input,
...noteFiles.flatMap((f) => ['-i', f]),
'-filter_complex', filters.join(';'),
'-map', `[v${rows.length}]`, '-an',
'-c:v', 'libx264', '-crf', '20', '-preset', 'medium', '-pix_fmt', 'yuv420p', '-movflags', '+faststart',
output
],
{ stdio: ['ignore', 'inherit', 'inherit'] }
)
if (hasAudio) console.log('note: the input had audio; the output has none')
console.log(output)
+210
View File
@@ -0,0 +1,210 @@
// Shared by the demo-video scripts, and imported by the browser scripts written for a terminal
// take: `import { launchBrowser, waitForOutput } from '<repo>/.agents/skills/demo-video/lib.mjs'`.
import { createRequire } from 'node:module'
import { execFileSync, spawn } from 'node:child_process'
import { readdirSync, readFileSync, realpathSync, statSync } from 'node:fs'
import { homedir } from 'node:os'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
export const CODEX_SESSIONS = join(homedir(), '.codex/sessions')
export const CLAUDE_PROJECTS = join(homedir(), '.claude/projects')
export function die(message) {
console.error(message)
process.exit(2)
}
const HINTS = {
ffmpeg: 'brew install ffmpeg',
ffprobe: 'brew install ffmpeg',
vhs: 'brew install vhs',
say: 'macOS only; use voice: false in a scenario or --voice=none for captions without speech'
}
export function need(...commands) {
for (const c of commands) {
try {
execFileSync('which', [c], { stdio: 'ignore' })
} catch {
die(`${c} not found: ${HINTS[c] ?? 'install it'}`)
}
}
}
// The skill pins its own Playwright rather than using frontend/'s, whose older pin may not
// install its browser on a current Node.
const SKILL = dirname(fileURLToPath(import.meta.url))
export function playwright() {
try {
return createRequire(import.meta.url)('playwright')
} catch {
die(`Playwright not found: run \`npm ci --prefix ${SKILL}\``)
}
}
export async function launchBrowser(options) {
try {
return await playwright().chromium.launch(options)
} catch (err) {
if (/Executable doesn't exist/.test(err.message))
die(`Playwright's Chromium is not installed: run \`npx --prefix ${SKILL} playwright install chromium\``)
throw err
}
}
export function probe(file) {
const info = JSON.parse(
execFileSync('ffprobe', ['-v', 'error', '-show_streams', '-show_format', '-of', 'json', file])
)
const vs = info.streams.find((s) => s.codec_type === 'video')
const [num, den] = (vs?.r_frame_rate ?? '0/1').split('/').map(Number)
return {
width: vs?.width,
height: vs?.height,
fps: num / den,
duration: Number(info.format.duration),
hasAudio: info.streams.some((s) => s.codec_type === 'audio')
}
}
// One narration line as speech. With voice 'none' nothing is spoken and the line lasts as long
// as it takes to read.
export function speak(text, file, { voice, rate = 0 }) {
if (voice === 'none') return { file: null, length: Math.max(1.5, text.split(/\s+/).length / 2.7) }
execFileSync('say', ['-v', voice, ...(rate ? ['-r', String(rate)] : []), '-o', file, text])
return { file, length: probe(file).duration }
}
// Caption band images, drawn by the browser: Homebrew's ffmpeg has no text filters.
export async function captionImages(browser, texts, { width, height, dir }) {
const page = await browser.newPage({ viewport: { width, height } })
const files = []
for (const [k, text] of texts.entries()) {
await page.setContent(
`<body style="margin:0;height:${height}px;display:flex;align-items:center;justify-content:center;background:#111;">` +
`<div style="max-width:88%;color:#fff;font:500 20px/1.35 system-ui,sans-serif;text-align:center;"></div></body>`
)
await page.locator('div').evaluate((el, t) => (el.textContent = t), text)
files.push(join(dir, `caption${k}.png`))
await page.screenshot({ path: files.at(-1) })
}
await page.close()
return files
}
// Samples <input> 10 times a second inside [from, to] and returns, for each sample, how many
// pixels of each region changed since the previous one. A pixel changes when its gray level
// moves by more than 40. `suppressed[k]` is true while region k's `unlessLike` part still looks
// as it did at `unlessLike.at`; `active` is whether any region changed by more than its `min`.
export const SAMPLES = 10
export async function sampleRegions(input, regions, { from = 0, to } = {}) {
const { width: W, height: H } = probe(input)
const grayFrame = (t) =>
execFileSync(
'ffmpeg',
['-v', 'error', '-ss', String(t), '-i', input, '-frames:v', '1', '-f', 'rawvideo', '-pix_fmt', 'gray', '-'],
{ maxBuffer: W * H * 2 }
)
const lit = (frame, a) => {
const bits = new Uint8Array(a.w * a.h)
for (let y = 0; y < a.h; y++)
for (let x = 0; x < a.w; x++) bits[y * a.w + x] = frame[(a.y + y) * W + a.x + x] > 70 ? 1 : 0
return bits
}
const refs = regions.map((r) => {
if (!r.unlessLike) return null
const ref = lit(grayFrame(r.unlessLike.at), r.unlessLike)
return { ref, lit: ref.reduce((s, b) => s + b, 0) }
})
const looksLike = (frame, k) => {
const bits = lit(frame, regions[k].unlessLike)
let diff = 0
for (let i = 0; i < bits.length; i++) diff += bits[i] !== refs[k].ref[i]
return diff < 0.25 * Math.max(refs[k].lit, 1)
}
const samples = []
await new Promise((done, fail) => {
const range = ['-ss', String(from), ...(to !== undefined ? ['-to', String(to)] : [])]
const ff = spawn('ffmpeg', ['-v', 'error', ...range, '-i', input, '-vf', `fps=${SAMPLES},format=gray`, '-f', 'rawvideo', '-'])
const size = W * H
let buf = Buffer.alloc(0)
let prev = null
let prevLike = []
let n = 0
ff.stdout.on('data', (chunk) => {
buf = Buffer.concat([buf, chunk])
while (buf.length >= size) {
const frame = Buffer.from(buf.subarray(0, size))
buf = buf.subarray(size)
const like = regions.map((r, k) => (r.unlessLike ? looksLike(frame, k) : false))
if (prev) {
const changed = regions.map((r) => {
let c = 0
for (let y = r.y; y < r.y + r.h; y++)
for (let x = r.x, i = y * W + r.x; x < r.x + r.w; x++, i++) {
const d = frame[i] - prev[i]
if (d > 40 || d < -40) c++
}
return c
})
const suppressed = like.map((l, k) => l && prevLike[k])
const active = regions.some((r, k) => !suppressed[k] && changed[k] > r.min)
samples.push({ t: from + n / SAMPLES, changed, suppressed, active })
}
prev = frame
prevLike = like
n++
}
})
ff.on('close', (code) => (code === 0 ? done() : fail(new Error(`ffmpeg exited ${code}`))))
})
return samples
}
// Waits until the agent session started in `cwd` writes `pattern` to its log, and returns the
// match. Only that folder's sessions count: other agents on the machine (a review running in
// the same worktree, the recording agent itself) write logs at the same time.
// - agent 'codex': files under ~/.codex/sessions whose session_meta names `cwd`. The per-day
// folder may not exist when the wait starts; it is looked for again on every poll.
// - agent 'claude': files under ~/.claude/projects/<cwd with every other character as ->.
// - dirs: any other folders, searched without a cwd check.
// Only files written after `since` are read. Logs are JSON: end the pattern before `"` and `\`;
// JSON-escaped ampersands (backslash u0026) are turned back into `&` before matching.
export async function waitForOutput(
pattern,
{ agent, cwd = process.cwd(), dirs, since = Date.now(), timeout = 300_000, every = 1000 } = {}
) {
const real = realpathSync(cwd)
const roots =
dirs ?? (agent === 'claude' ? [join(CLAUDE_PROJECTS, real.replace(/[^a-zA-Z0-9-]/g, '-'))] : [CODEX_SESSIONS])
const mark = agent === 'codex' || (!agent && !dirs) ? `"cwd":${JSON.stringify(real)}` : null
const walk = (dir, out) => {
try {
for (const e of readdirSync(dir, { withFileTypes: true })) {
const p = join(dir, e.name)
if (e.isDirectory()) walk(p, out)
else if (e.isFile()) out.push(p)
}
} catch {
// not created yet, or removed during the poll
}
return out
}
const deadline = Date.now() + timeout
while (Date.now() < deadline) {
for (const root of roots)
for (const file of walk(root, [])) {
try {
if (statSync(file).mtimeMs < since) continue
const text = readFileSync(file, 'utf8')
if (mark && !text.includes(mark)) continue
const m = text.replace(/\\u0026/g, '&').match(pattern)
if (m) return m
} catch {
// written or removed while being read: look again on the next poll
}
}
await new Promise((r) => setTimeout(r, every))
}
throw new Error(`no match for ${pattern} in ${roots.join(', ')} after ${Math.round(timeout / 1000)} s`)
}
+209
View File
@@ -0,0 +1,209 @@
// Lays a spoken voice-over on a silent video: one text-to-speech line (macOS `say`) per entry,
// started at the moment of the video it describes. When a line still runs at the next line's
// moment, the video holds the frame of that moment until the line ends, so picture and speech
// stay together.
//
// usage: node narrate.mjs <in.mp4> <lines.json> <out.mp4> [options]
// --plan speak the lines and print where they land, render nothing
// --regions=<file> regions.json of <in.mp4>: warn about a line whose `at` falls just after
// a change started, since its caption would then land after that change
// --voice=Samantha macOS voice (say -v '?'); --voice=none speaks nothing and gives each
// line its reading time, for a machine without `say`
// --rate=0 words per minute for say; 0 keeps the voice's own
// --gap=0.4 silence between two lines (s)
// --end-hold=1.5 keep the last frame this long after the last line (s)
// --vtt=<file> also write the lines as WebVTT captions, on the output's timeline
// --cues=<file> also write them as JSON [[start, end, text], ...], for a text track
// added from inline JS on a page that cannot serve .vtt files
// --caption-height=96 height of the caption band added below the video (two lines of text)
// --caption-at=top put the band above the video instead
// --no-band burn in no captions: the output keeps the input's size
//
// Each line shows in the band from its start until the next line starts, so captions never
// cover the recording.
//
// lines.json: [{ "at": 0.4, "text": "One sentence about what is on screen." }, ...], `at` in
// seconds of <in.mp4>, increasing. Anchor a line a little before the change it describes: a
// hold freezes the frame at `at`, so a line anchored after its change starts only once that
// change has already played.
import { execFileSync } from 'node:child_process'
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { captionImages, die, launchBrowser, need, probe, sampleRegions, speak } from './lib.mjs'
const [input, linesFile, output, ...rest] = process.argv.slice(2)
if (!output) die('usage: node narrate.mjs <in.mp4> <lines.json> <out.mp4> [--plan] [--voice=Samantha] [--gap=0.4] ...')
const opt = Object.fromEntries(
rest.map((a) => {
const [k, ...v] = a.replace(/^--/, '').split('=')
return [k, v.length ? v.join('=') : true]
})
)
const voice = opt.voice || 'Samantha'
need('ffmpeg', 'ffprobe', ...(voice === 'none' ? [] : ['say']))
const rate = Number(opt.rate || 0)
const gap = Number(opt.gap ?? 0.4)
const endHold = Number(opt['end-hold'] ?? 1.5)
const lines = JSON.parse(readFileSync(linesFile, 'utf8'))
lines.forEach((l, i) => {
if (i && l.at < lines[i - 1].at) die(`line ${i + 1} starts before line ${i}: sort them by "at"`)
})
const vs = probe(input)
const { fps, duration } = vs
// 1. Speak every line.
const work = mkdtempSync(join(tmpdir(), 'narrate-'))
const cues = lines.map((l, i) => ({ ...l, ...speak(l.text, join(work, `line${i}.aiff`), { voice, rate }) }))
// 2. Place them. A line that would start before the previous one ends holds the frame at its
// own moment for the difference, which delays everything after it.
const holds = new Map()
const hold = (at, d) => {
const near = [...holds.keys()].find((k) => Math.abs(k - at) < 1 / fps)
holds.set(near ?? at, (holds.get(near ?? at) ?? 0) + d)
}
let shift = 0
let prevEnd = -Infinity
for (const c of cues) {
c.start = c.at + shift
c.held = 0
// Under a frame of overlap only shortens the gap: a hold that short would show nothing.
if (c.start < prevEnd + gap - 1 / fps) {
c.held = prevEnd + gap - c.start
hold(c.at, c.held)
shift += c.held
c.start += c.held
}
c.end = c.start + c.length
prevEnd = c.end
}
let outDuration = duration + shift
if (prevEnd + endHold > outDuration) {
hold(duration, prevEnd + endHold - outDuration)
outDuration = prevEnd + endHold
}
// A change that starts in the 0.6 s before a line's `at` is one the line most likely describes.
const late = new Map()
if (opt.regions) {
const regions = JSON.parse(readFileSync(opt.regions, 'utf8'))
const samples = await sampleRegions(input, regions)
const starts = []
samples.forEach((s, i) => {
if (!s.active) return
const quietBefore = !samples.slice(Math.max(0, i - 5), i).some((p) => p.active)
if (quietBefore)
starts.push({ t: s.t, region: regions.find((r, k) => !s.suppressed[k] && s.changed[k] > r.min).name })
})
cues.forEach((c, i) => {
const s = starts.find((s) => s.t > c.at - 0.6 && s.t <= c.at)
if (s) late.set(i, s)
})
}
const clock = (s) => `${Math.floor(s / 60)}:${(s % 60).toFixed(1).padStart(4, '0')}`
for (const [i, c] of cues.entries()) {
console.log(
`${clock(c.start)}-${clock(c.end)} at ${c.at.toFixed(1).padStart(5)}` +
(c.held ? ` holds ${c.held.toFixed(1)} s` : '') +
` ${c.text}`
)
if (c.held > 1)
console.log(` ^ line ${i} runs ${c.held.toFixed(1)} s into this one's moment: shorten line ${i}`)
const s = late.get(i)
if (s)
console.log(` ^ ${s.region} starts changing at ${s.t.toFixed(1)}, before this line: anchor it at ${Math.max(0, s.t - 0.3).toFixed(1)}`)
}
console.log(`duration ${duration.toFixed(1)} s -> ${outDuration.toFixed(1)} s`)
// The band shows each caption until the next line starts.
const shown = cues.map((c, k) => [c.start, k + 1 < cues.length ? cues[k + 1].start : outDuration, c.text])
if (opt.vtt) {
const stamp = (s) => {
const ms = Math.round(s * 1000)
const p = (n, w = 2) => String(n).padStart(w, '0')
return `${p(Math.floor(ms / 3600000))}:${p(Math.floor(ms / 60000) % 60)}:${p(Math.floor(ms / 1000) % 60)}.${p(ms % 1000, 3)}`
}
writeFileSync(
opt.vtt,
'WEBVTT\n\n' + cues.map((c, k) => `${k + 1}\n${stamp(c.start)} --> ${stamp(c.end)}\n${c.text}\n`).join('\n')
)
console.log(`captions: ${opt.vtt}`)
}
if (opt.cues) {
writeFileSync(opt.cues, JSON.stringify(shown.map(([s, e, t]) => [+s.toFixed(2), +e.toFixed(2), t])))
console.log(`cues: ${opt.cues}`)
}
if (opt.plan) process.exit(0)
// 3. Caption band images.
const band = opt['no-band'] ? 0 : Number(opt['caption-height'] ?? 96)
if (band % 2 || vs.height % 2 || vs.width % 2) die('video width, height and --caption-height must all be even for H.264')
const top = opt['caption-at'] === 'top'
if (band) {
const browser = await launchBrowser()
try {
const images = await captionImages(
browser,
cues.map((c) => c.text),
{ width: vs.width, height: band, dir: work }
)
images.forEach((f, k) => (cues[k].image = f))
} finally {
await browser.close()
}
}
// 4. Render: the video cut at every hold, each piece padded with its last frame, then the
// lines delayed to their start and mixed.
const filters = []
const pieces = []
let from = 0
for (const p of [...holds.keys()].sort((a, b) => a - b)) {
// fps= restores the frame rate FFmpeg 7's setpts clears; without it tpad adds no frames.
filters.push(
`[0:v]trim=start=${from.toFixed(3)}:end=${p.toFixed(3)},setpts=PTS-STARTPTS,fps=${fps},` +
`tpad=stop_mode=clone:stop_duration=${holds.get(p).toFixed(3)}[p${pieces.length}]`
)
pieces.push(`[p${pieces.length}]`)
from = p
}
if (duration - from > 1 / fps) {
filters.push(`[0:v]trim=start=${from.toFixed(3)},setpts=PTS-STARTPTS[p${pieces.length}]`)
pieces.push(`[p${pieces.length}]`)
}
filters.push(
`${pieces.join('')}concat=n=${pieces.length}:v=1:a=0,fps=${fps}` +
(band ? `,pad=${vs.width}:${vs.height + band}:0:${top ? band : 0}:color=#111111[c0]` : `,format=yuv420p[v]`)
)
const spoken = cues.filter((c) => c.file)
if (band) {
const firstImage = spoken.length + 1
shown.forEach(([s, e], k) => {
filters.push(
`[c${k}][${firstImage + k}:v]overlay=0:${top ? 0 : vs.height}:` +
`enable='between(t,${s.toFixed(3)},${e.toFixed(3)})'[c${k + 1}]`
)
})
filters.push(`[c${cues.length}]format=yuv420p[v]`)
}
spoken.forEach((c, k) => filters.push(`[${k + 1}:a]adelay=${Math.round(c.start * 1000)}:all=1[a${k}]`))
if (spoken.length)
filters.push(`${spoken.map((_, k) => `[a${k}]`).join('')}amix=inputs=${spoken.length}:normalize=0,apad[a]`)
execFileSync(
'ffmpeg',
[
'-v', 'error', '-y', '-i', input,
...spoken.flatMap((c) => ['-i', c.file]),
...(band ? cues.flatMap((c) => ['-i', c.image]) : []),
'-filter_complex', filters.join(';'),
'-map', '[v]', ...(spoken.length ? ['-map', '[a]', '-c:a', 'aac', '-b:a', '128k'] : []),
'-t', outDuration.toFixed(3),
'-c:v', 'libx264', '-crf', '20', '-preset', 'medium', '-movflags', '+faststart',
output
],
{ stdio: ['ignore', 'inherit', 'inherit'] }
)
console.log(output)
+40
View File
@@ -0,0 +1,40 @@
{
"name": "demo-video",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "demo-video",
"dependencies": {
"playwright": "1.65.1"
}
},
"node_modules/playwright": {
"version": "1.65.1",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz",
"integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==",
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.65.1"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/playwright-core": {
"version": "1.65.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz",
"integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==",
"license": "Apache-2.0",
"bin": {
"playwright-core": "cli.js"
},
"engines": {
"node": ">=20"
}
}
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"name": "demo-video",
"private": true,
"type": "module",
"dependencies": {
"playwright": "1.65.1"
}
}
+154
View File
@@ -0,0 +1,154 @@
#!/usr/bin/env node
// Usage: node record.mjs <scenario.mjs> [out.mp4]
// Prints the mp4 path on success; on a failed step, the step and a screenshot path.
import { execFileSync } from 'node:child_process'
import { mkdtempSync, readdirSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, resolve, dirname, basename } from 'node:path'
import { pathToFileURL } from 'node:url'
import { captionImages, die, launchBrowser, need, speak } from './lib.mjs'
const [scenarioPath, outArg] = process.argv.slice(2)
if (!scenarioPath) die('usage: node record.mjs <scenario.mjs> [out.mp4]')
const sc = (await import(pathToFileURL(resolve(scenarioPath)).href)).default
const out = resolve(outArg ?? join(dirname(resolve(scenarioPath)), basename(scenarioPath, '.mjs') + '.mp4'))
const work = mkdtempSync(join(tmpdir(), 'demo-video-'))
const viewport = sc.viewport ?? { width: 1280, height: 720 }
const voice = sc.voice === false ? 'none' : (sc.voice ?? 'Samantha')
const BAND = sc.captionHeight ?? 96
if (viewport.width % 2 || (viewport.height + BAND) % 2) die('viewport width and height + captionHeight must be even for H.264')
need('ffmpeg', 'ffprobe', ...(voice === 'none' ? [] : ['say']))
// 1. Narration clips, before the browser starts, so recording time is not spent on TTS.
const clips = sc.steps.map((s, i) => {
if (!s.say) return null
const { file, length } = speak(s.say, join(work, `say${i}.aiff`), { voice })
return { file, ms: Math.round(length * 1000) }
})
const browser = await launchBrowser()
try {
// 2. Setup (login, seeding) runs unrecorded; its cookies carry into the recorded context.
let storageState
if (sc.setup) {
const ctx = await browser.newContext({ viewport, baseURL: sc.baseURL })
try {
await sc.setup({ context: ctx, page: await ctx.newPage(), baseURL: sc.baseURL })
} catch (err) {
die(`setup failed: ${err.message.split('\n')[0]}`)
}
storageState = await ctx.storageState()
await ctx.close()
}
const ctx = await browser.newContext({
viewport,
storageState,
baseURL: sc.baseURL,
recordVideo: { dir: work, size: viewport }
})
const page = await ctx.newPage()
const t0rec = Date.now()
// Helpers handed to each step: a visible ring on what is clicked, so the viewer can follow.
const ring = (loc) =>
loc
.evaluate((el) => {
const r = el.getBoundingClientRect()
const d = document.createElement('div')
d.style.cssText = `position:fixed;left:${r.left - 4}px;top:${r.top - 4}px;width:${r.width + 8}px;height:${r.height + 8}px;border:3px solid #f43f5e;border-radius:8px;z-index:2147483646;pointer-events:none`
document.body.appendChild(d)
setTimeout(() => d.remove(), 900)
})
.catch(() => {})
const loc = (t) => (typeof t === 'string' ? page.locator(t).first() : t)
const helpers = {
page,
click: async (t) => {
const l = loc(t)
await l.scrollIntoViewIfNeeded()
await ring(l)
await page.waitForTimeout(500)
await l.click()
},
hover: async (t) => {
const l = loc(t)
await l.scrollIntoViewIfNeeded()
await ring(l)
await l.hover()
},
wait: (ms) => page.waitForTimeout(ms)
}
if (sc.start) await page.goto(sc.start, { waitUntil: 'networkidle' })
await page.waitForTimeout(sc.settle ?? 800)
const trimStart = Date.now() - t0rec
const cues = []
// Each caption shows from its step's start to the next captioned step's start.
const captions = []
// 3. A step's narration starts before its action, and the step stays on screen until both
// are done, so a caption never lands after what it describes.
for (const [i, s] of sc.steps.entries()) {
const at = Date.now() - t0rec
if (s.say) {
if (captions.length) captions.at(-1).end = at - trimStart
captions.push({ text: s.say, start: at - trimStart })
}
try {
if (s.do) await s.do(helpers)
} catch (err) {
const shot = join(work, `failed-step${i}.png`)
await page.screenshot({ path: shot }).catch(() => {})
console.error(`step ${i} failed (${s.say ?? 'no narration'}): ${err.message.split('\n')[0]}`)
console.error(`screenshot: ${shot}`)
process.exitCode = 1
break
}
const left = (clips[i]?.ms ?? 0) + (sc.pad ?? 400) - (Date.now() - t0rec - at)
if (left > 0) await page.waitForTimeout(left)
if (s.hold) await page.waitForTimeout(s.hold)
if (clips[i]?.file) cues.push({ file: clips[i].file, delay: at - trimStart })
}
await page.waitForTimeout(600)
const total = (Date.now() - t0rec - trimStart) / 1000
if (captions.length) captions.at(-1).end = total * 1000
await ctx.close()
if (process.exitCode) process.exit()
// 4. Captions in a band of their own beside the page, so they never cover it.
const images = await captionImages(
browser,
captions.map((c) => c.text),
{ width: viewport.width, height: BAND, dir: work }
)
// 5. Mux: cut the pre-roll, add the caption band, show each caption during its step, lay
// each narration clip at its step's start, encode an mp4.
const video = join(work, readdirSync(work).find((f) => f.endsWith('.webm')))
const args = ['-y', '-loglevel', 'error', '-ss', String(trimStart / 1000), '-i', video]
images.forEach((f) => args.push('-i', f))
cues.forEach((c) => args.push('-i', c.file))
const top = sc.captionAt === 'top'
const filters = [
`[0:v]pad=${viewport.width}:${viewport.height + BAND}:0:${top ? BAND : 0}:color=#111111[v0]`
]
captions.forEach((c, k) => {
const s = (c.start / 1000).toFixed(2)
const e = (c.end / 1000).toFixed(2)
filters.push(
`[v${k}][${k + 1}:v]overlay=0:${top ? 0 : viewport.height}:enable='between(t,${s},${e})'[v${k + 1}]`
)
})
const audioBase = captions.length + 1
cues.forEach((c, k) => filters.push(`[${audioBase + k}:a]adelay=${c.delay}:all=1[a${k}]`))
if (cues.length) {
filters.push(`${cues.map((_, k) => `[a${k}]`).join('')}amix=inputs=${cues.length}:normalize=0[a]`)
}
args.push('-filter_complex', filters.join(';'), '-map', `[v${captions.length}]`)
if (cues.length) args.push('-map', '[a]', '-c:a', 'aac')
args.push('-t', total.toFixed(2), '-c:v', 'libx264', '-pix_fmt', 'yuv420p', '-movflags', '+faststart', out)
execFileSync('ffmpeg', args, { stdio: ['ignore', 'inherit', 'inherit'] })
console.log(out)
} finally {
await browser.close()
}
+274
View File
@@ -0,0 +1,274 @@
# Terminal recordings
A CLI or TUI session recorded with vhs, optionally beside a browser that reacts to it, then its
waits cut and a voice-over added. What each tool needs is in `SKILL.md` next to this file.
The take runs from a folder of the session scratchpad: the tape, the browser script, `vhs` and
the agent all start there, so the files they write (mp4, webm, markers, screenshots) never land
in a repo. The skill's scripts are called by their path,
`node <repo>/.agents/skills/demo-video/<script>.mjs`, from wherever you are.
Order of work: plant the test data (it must match the story, see `SKILL.md`), record, compose,
measure with `activity.mjs`, cut, measure the cut, narrate.
## Record the terminal (vhs)
`brew install vhs` (brings ttyd). Tape skeleton:
```
Output term.mp4
Set Shell zsh
Set FontSize 15
Set Width 820
Set Height 820
Set Padding 16
Set TypingSpeed 35ms
Hide
Type "export MY_TOKEN=$(cat <scratch>/token); clear"
Enter
Show
Type "mycli"
Enter
Wait+Screen@150s /text that stays once it is done/
Sleep 3s
```
- Run `vhs` from the tape's folder with a relative `Output`: an absolute path fails to parse
(`Expected file path after output`).
- Everything between `Hide` and `Show` runs off camera: logins, tokens, aliases. Never type a
secret after `Show`.
- `Wait+Screen@150s /regex/` waits until the regex matches anywhere on the screen, up to 150 s.
Plain `Wait /regex/` reads only the last line; without `@<time>` the timeout is
`Set WaitTimeout`. The typed command is on the screen too, so wait on text it does not
contain (`echo "build $(echo finished)"`, then wait on `/build finished/`). A timed-out wait
ends the run with only `recording failed` and no mp4.
- Once a plain shell's output scrolls, vhs 0.12's `Wait+Screen` no longer sees the bottom rows:
`wmill script run` printed its result below the first screenful and a wait on it timed out
while the text was on screen. Make the terminal tall enough that the take never scrolls
(`Set Height`), or `clear` off camera before the command. Codex renders in the normal
buffer and scrolls too: for a long agent turn, a generous `Sleep` is safer than a wait, and
the cut removes the idle time. To see what a failing wait missed, replace it with `Sleep` +
`Screenshot f.png`.
- A CLI that may open with a dialog (Codex's trust prompt, its "Background server has
incompatible feature set" prompt after another Codex run changed its settings) is started in
the `Hide` block and the dialog answered there (`Type "1"` picks "Run without daemon this
time"), so the take opens on the ready prompt.
- Wait on text that stays (a question, the final answer), not on a spinner or a status that
flips back. `Sleep` only for what the tape cannot see, such as another process acting; the
cut step removes idle time afterwards, so err long.
- Keep long command lines off camera: define a function in the `Hide` block
(`Type "mycli() { command mycli --flag … \"$@\"; }; clear"`) and type only `mycli` after
`Show`. 500 characters at 35 ms is 17 s of typing that the cut step keeps.
- A Type string holding both quote kinds goes in backticks: ``Type `cmd -c 'a="b"'` ``.
- `Screenshot f.png` takes a still. macOS `date` has no `%3N`: take ms timestamps with
`node -e 'console.log(Date.now())'`.
### The mp4 runs shorter than the session
vhs drops frames when the machine is busy, so its mp4 is shorter than the wall-clock session:
151.7 s of video for about 160 s of session in one Codex take, the gap growing over the take.
A wall-clock timestamp (an agent's log, a `Date.now()` marker) therefore points at the wrong
moment of the video, more so the later it is. Use wall clock only for a first guess at the
start of a take; place every cut, alignment and narration line from the picture, with
`activity.mjs` (below).
## Codex CLI, unattended
```
codex -a never -s read-only \
-c check_for_update_on_startup=false \
-c 'mcp_servers.<name>.url="https://<host>/<mcp path>"' \
-c 'mcp_servers.<name>.bearer_token_env_var="MY_TOKEN"' \
-c 'mcp_servers.<name>.default_tools_approval_mode="approve"'
```
- `-a never` never asks; without `default_tools_approval_mode="approve"` every MCP tool call is
refused instead of run.
- The folder trust prompt cannot be skipped from `-c` (a `projects."<folder>".trust_level`
override still shows it, in Codex 0.159). Accept it once for the take folder in a throwaway
tape: `Type "codex"`, `Enter`, `Wait+Screen@30s /Trust and continue/`, `Enter`, `Sleep 5s`,
`Ctrl+C`, `Ctrl+C`. The answer is saved in `~/.codex/config.toml` under the folder's real
path (on macOS, `/private/tmp/…` for the scratchpad).
- `check_for_update_on_startup=false` keeps the update banner out of the shot.
- The token stays in an env var exported in the `Hide` block. Windmill's own MCP server is
`<frontend URL>/api/mcp`, with a token that has the `mcp:all` scope.
- Codex writes each session to `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` as it goes.
## Claude Code, unattended
```
claude --strict-mcp-config --mcp-config <scratch>/mcp.json --allowedTools mcp__<name>
```
- `mcp.json` is `{"mcpServers": {"<name>": {"type": "http", "url": "…", "headers":
{"Authorization": "Bearer …"}}}}`. It holds the token, so keep it in the scratchpad and never
`cat` it on camera.
- `--allowedTools mcp__<name>` runs that server's tools without asking; anything else still
asks, which a demo usually wants to show.
- The folder trust prompt is saved per folder: accept it once in a throwaway tape
(`Type "claude"`, `Enter`, `Wait+Screen@30s /trust/`, `Enter`, `Sleep 5s`, `Ctrl+C`, `Ctrl+C`).
- Claude Code writes each session to `~/.claude/projects/<folder path, each non-alphanumeric character as ->/*.jsonl`.
- Its layout differs from Codex's: measure its regions from crops (below) rather than reusing
the Codex example.
## Drive a browser beside it
A Playwright script that records its own video and waits for the agent's output:
```js
import { writeFileSync, existsSync } from 'node:fs'
import { launchBrowser, waitForOutput } from '<repo>/.agents/skills/demo-video/lib.mjs'
const since = Date.now()
writeFileSync('browser.pid', String(process.pid))
writeFileSync('browser-start.txt', String(since))
const browser = await launchBrowser()
const ctx = await browser.newContext({
viewport: { width: 900, height: 820 },
recordVideo: { dir: 'bvideo', size: { width: 900, height: 820 } }
})
const page = await ctx.newPage()
await page.request.post(`${BASE}/api/auth/login`, { data: { email: 'admin@windmill.dev', password: 'changeme' } })
await page.goto(`${BASE}/some/page`)
const [link] = await waitForOutput(/https:\/\/[^\s"\\]+\/the-page\?[^\s"\\]+/, { agent: 'codex', since })
await page.goto(link)
try {
await page.getByText(/the success message/).waitFor({ timeout: 40000 })
} catch {
await page.screenshot({ path: 'browser-fail.png' })
console.log('end state not seen:', (await page.locator('body').innerText()).slice(0, 400))
}
while (!existsSync('done.txt')) await new Promise((r) => setTimeout(r, 1000))
await ctx.close()
await browser.close()
```
- `waitForOutput(pattern, { agent, cwd, since, timeout })` polls the logs of the `agent`
(`'codex'` or `'claude'`) sessions started in `cwd` (default: the folder `node` was started
from, so start the browser script from the folder vhs starts the agent in) and returns the
match. Other agents on the machine write logs during the take too, a review in the same
worktree or the recording agent itself, and only this folder's sessions count. It finds a log
folder created during the take (Codex's per-day folder), so never build a dated path yourself.
Logs are JSON: end the pattern before `"` and `\`. Take `since` when the script starts, before
the agent can answer.
- `since` skips log files last written before it, but a file written after it is searched from
the top. Start a new agent session for each take: a resumed session's log still holds the
links of earlier takes, and the first match wins.
- The log holds the prompt and every tool result too, and the first match wins. Make the
pattern match only the reply: tool results carry look-alike URLs (Windmill's deploy tool
returns the page under the instance's base URL, not the host the prompt asked for), and the
prompt must not contain the full link. Pin the host the prompt names and the path it leaves
for the agent to fill in.
- Log in with `page.request.post(...)` before the first navigation.
- Run both, then a marker: `node browser.mjs & vhs term.tape; touch done.txt`. The script closes
its context once `done.txt` exists, which finishes the webm.
- Before every take, stop the driver left by the previous one: `kill $(cat browser.pid)`. A
stray one matches the new session's output and acts on it first. Never `pkill -f browser.mjs`,
which also kills the takes of other worktrees.
- End the browser script on the state the page settles in (the success message), not a
transient one, and keep the try/catch so a failed take says why.
## Compose side by side
```bash
ffmpeg -i term.mp4 -ss <offset> -i browser.webm -filter_complex \
"[0:v]fps=25,scale=820:820,setsar=1[a];[1:v]fps=25,scale=900:820,setsar=1[b];[a][b]hstack=2,format=yuv420p[v]" \
-map "[v]" -t <terminal duration> -c:v libx264 -crf 12 -preset veryfast side.mp4
```
- `<offset>`: seconds the browser recording began before the terminal one, trimmed off the
browser input. Take a first guess from the start timestamps, then set it from frames: the
page must open right after the link prints. Check the last interaction between the two sides
as well; when the terminal has drifted (above) and the browser reacts visibly early, split
the composition at that interaction or retime the browser with `setpts=<factor>*PTS`.
- Same height on both sides. crf 12 keeps text sharp for the cut step, which encodes again.
## Watch regions
`regions.json` lists the areas to watch, in pixels of the input. Example: a Codex TUI, 820x820
at font size 15, left of a 900-wide browser:
```json
[
{ "name": "transcript", "x": 0, "y": 0, "w": 820, "h": 670, "min": 150 },
{ "name": "status", "x": 0, "y": 670, "w": 820, "h": 35, "min": 30,
"unlessLike": { "x": 40, "y": 675, "w": 72, "h": 22, "at": 40 } },
{ "name": "composer", "x": 0, "y": 705, "w": 820, "h": 65, "min": 300 },
{ "name": "browser", "x": 820, "y": 0, "w": 900, "h": 820, "min": 30 }
]
```
- Place the rows from two crops of the bottom of the terminal, one while the CLI works and one
after: `ffmpeg -ss <t> -i side.mp4 -frames:v 1 -vf crop=820:180:0:640 f.png`.
- Codex's `Working (12s • esc to interrupt)` row ticks and shimmers, so watch it only
`unlessLike` its look at a time (`at`) it shows "Working": when the work ends, the newest line
of the answer lands in that same row.
- Composer: a cursor blink changes ~170 to 210 px per sample and typing 460 or more, so
`min` 300. Leave the footer under it out.
- A region whose `min` is too low keeps the whole take "active" and nothing gets cut: run
`activity.mjs` first and look for a run of equal small counts every ~0.6 s (the blink).
## See when the screen changes
```bash
node <repo>/.agents/skills/demo-video/activity.mjs side.mp4 regions.json [from] [to]
```
prints, per region, the runs of change in seconds of that file: `48.0-48.5(4744)` is a change
from 48.0 s to 48.5 s, 4744 pixels at most in one sample (`--raw` lists every sample). It
samples exactly as `cut-waits.mjs` does. Use it for every time you write down: where an agent's
work starts and ends (for `--cut=`), when the link prints and the page opens (for the offset),
and, on the cut file, where each narration line goes.
## Cut the waits
```bash
node <repo>/.agents/skills/demo-video/cut-waits.mjs side.mp4 out.mp4 regions.json --plan # cuts + check sheets
node <repo>/.agents/skills/demo-video/cut-waits.mjs side.mp4 out.mp4 regions.json # render
```
- Read every `<out>.cuts-N.png` row before rendering: the two frames of a row must show the
same content, apart from timers and the cursor. Text appearing between them means a region
missed it: fix the region and rerun `--plan`.
- Defaults: stretches of 3 s or more shrink to 1 s (0.7 s kept before the cut, 0.3 s after), 5 s
kept after the last change, and a "⏩ N s later" note at the top centre for 1.4 s after each
cut. Override with `--min-gap`, `--head`, `--tail`, `--end-hold`, `--label-y`.
- What changes stays: typing, tool calls appearing, links, the page being filled, the final
answer. Time spent waiting on a tool is cut; the call and its result both stay on screen.
- An AI agent's own work is not idle to the measurement: its tool calls keep scrolling in while
the viewer only waits for the answer. Remove those stretches with `--cut=<from>-<to>`
(seconds of the input, repeatable), from just after the agent's first reply to just before the
output the viewer needs (its message, the link, the final answer). Take both bounds from
`activity.mjs` on `side.mp4`, never from the agent's log timestamps (the mp4 drifts from the
wall clock), and confirm them on the check sheet. A forced cut gets the same note.
- Silent inputs only: the output carries no audio. Add the voice-over after cutting.
## Add a voice-over
```bash
node <repo>/.agents/skills/demo-video/narrate.mjs out.mp4 lines.json narrated.mp4 --plan --regions=out.regions.json
node <repo>/.agents/skills/demo-video/narrate.mjs out.mp4 lines.json narrated.mp4
```
lines.json: `[{ "at": 0.3, "text": "One sentence." }, ...]`, `at` in seconds of the cut video.
Take each `at` from `activity.mjs out.mp4 out.regions.json`: 0.3 s before the change the line
describes. `out.regions.json` is written by `cut-waits.mjs`: the same regions, with each
`unlessLike.at` moved onto the cut's timeline. If that `at` fell inside a cut, it now points at
the first frame after it: check that frame still shows the look to ignore, or pick a new `at`.
- Each line is spoken by macOS `say` (`--voice`, default Samantha, ~3 words per second;
`--voice=none` for captions only). When a line still runs at the next line's `at`, the video
holds the frame at that `at` until it ends, so speech never runs over a later step.
- A hold only waits at the next line's `at`: whatever happens between the previous line's `at`
and that moment plays while the previous line is still speaking. A line anchored after its
change therefore starts once the change is already over. `--plan` with `--regions` flags each
line whose `at` falls just after a change started and prints the `at` to use instead.
- `--plan` also flags each hold longer than 1 s: the line before it is too long for its stretch.
Shorten that line rather than accept the freeze.
- Read the narrated frames at each hold before delivering.
- Each line is burned in as a caption in a band of its own below the video, from its start
until the next line starts, so captions never cover the recording: a 1280x720 cut comes out
1280x816. `--caption-at=top` puts the band above, `--caption-height` sets its height (default
96, two lines of text; keep it even for H.264), `--no-band` leaves the video its own size.
- `--vtt=<file>` writes the lines as WebVTT on the output's timeline; `--cues=<file>` writes
them as JSON for a text track added from inline JS (see Deliver in `SKILL.md`).
+26 -19
View File
@@ -123,21 +123,22 @@ accounts) are many per service. Each trigger acts through one connection, named
| Table | What's Stored |
|-------|---------------|
| `workspace_integrations` | `oauth_data` JSON with `base_url`, `client_id`, `client_secret`, `instance_shared` flag and the workspace app's registered `redirect_uri`. One row per (workspace, service); it must exist for every connection made by the connect flow, since token refresh reads the client from it |
| `workspace_integrations` | `oauth_data` JSON with the workspace's own app: `base_url`, `client_id`, `client_secret` and its registered `redirect_uri`. NULL when the workspace has none and the row only holds the shared `resource_path`. Rows with `instance_shared` are legacy, kept for accounts made before connections went through the resource connect |
| `variable` | Encrypted `access_token` at the connection path, linked to `account` via its `account` column |
| `account` | `refresh_token` and the requested `scopes`. The connect flow writes `client` = service name and `is_workspace_integration = true` |
| `account` | `refresh_token` and the requested `scopes`. A token issued by the workspace app has `client` = service name and `is_workspace_integration = true`; one issued by the instance connect client has `client` = resource type |
| `resource` | The connection's resource at the same path, of the service's resource type, `{ "token": "$var:<path>" }` |
Any resource of the service's resource type with a variable at the same path is a connection,
including one connected for runnables through the resource connect drawer. Its account
(`is_workspace_integration = false`) was issued by the instance connect client, so
`http_client_request` refreshes it through the variable store (`windmill_store`'s
`_refresh_token`), never with the workspace app. A connection whose account lacks some of
`ServiceName::oauth_scopes` reports them as `missing_scopes`; reconnecting asks for those plus the
account's own scopes. Only connections the connect flow made can be reconnected or disconnected
(`check_can_replace`, `delete_connection`): a connected resource's token may hold scopes its
runnables need that a trigger connect would not request (a GitHub resource has no account to
read them from), so its lifecycle stays in Resources.
A connection is any resource of the service's resource type with a variable at the same path, and
there is one way to make one: the resource connect drawer (`AppConnectInner.svelte`), opened from
Resources or the trigger picker with the service's `required_scopes` added. It connects through the
workspace's app when there is one (`generate_connect_url` and `callback` here, which only build the
authorize URL with a signed state and exchange the code), otherwise through the instance connect
client (`/oauth/connect/{client}`). Either way the drawer saves the token with `createAccount`.
`http_client_request` refreshes a workspace-app account with the workspace's client and any other
through the variable store (`windmill_store`'s `_refresh_token`). A connection whose account lacks
some of `ServiceName::oauth_scopes` reports them as `missing_scopes`. Reconnecting opens the drawer
on the existing path with those plus the account's own scopes, and `createAccount` with `replace`
swaps the token and account in place.
A user may use a connection when they can read its variable (checked with a user transaction,
so the variable's row-level security decides): `resolve_usable_connection` /
@@ -164,10 +165,6 @@ pub struct OAuthConfig {
A refreshed token is written back by connection path and account id, never by service: providers
like Nextcloud rotate refresh tokens, so writing one onto another account breaks its next refresh.
Instance-level sharing: when the workspace has no OAuth app of its own and the instance admin
shares one (`share_with_workspaces` in the `oauths` setting; not available for Nextcloud), the
connect flow uses it and records `{"instance_shared": true}` in `workspace_integrations`.
### URL Resolution
The `resolve_endpoint()` helper handles both absolute and relative OAuth URLs:
@@ -775,11 +772,21 @@ pub async fn prepare_native_trigger_args(service_name, db, w_id, headers, body)
}
```
### Instance-Level OAuth Credentials
### Instance and Workspace OAuth Clients
When `workspace_integrations.oauth_data.instance_shared == true`, `decrypt_oauth_data()` reads `client_id` and `client_secret` from instance-level global settings instead of workspace-level. This allows admins to share OAuth app credentials across workspaces.
Every workspace can connect through the instance's connect client for a service; there is no
per-workspace sharing switch. A workspace app, when configured, takes precedence in the resource
connect drawer. `workspace_integrations.oauth_data.instance_shared == true` only appears on rows
written before connections went through the resource connect: `decrypt_oauth_data()` then reads
`client_id` and `client_secret` from the instance settings to refresh those legacy accounts.
`generate_connect_url` picks the client (`resolve_oauth_client`): the workspace's own app when configured, the instance's otherwise. The server also picks the redirect URI (`redirect_uri_for`), identically when exchanging the code: `{BASE_URL}/oauth/callback/{resource_type}` for an instance client, which it already registers for resources; for a workspace app, the `redirect_uri` it was saved with, or `/workspace_settings?tab=native_triggers&service=<s>` for one saved before that was stored. Every page a provider can send the user back to (that callback, `/user/login_callback/{client}`, the workspace settings page, the legacy `/oauth/callback/github/native_trigger`) recognises the signed state and hands it to `NativeOAuthCallback`, so a provider with a single registered URI per client (Nextcloud) works whichever one the admin registered.
For a workspace app the server picks the redirect URI (`redirect_uri_for`), identically when
exchanging the code: the `redirect_uri` it was saved with, or
`/workspace_settings?tab=native_triggers&service=<s>` for one saved before that was stored. Every
page a provider can send the user back to (`/oauth/callback/{client}`,
`/user/login_callback/{client}`, the workspace settings page, the legacy
`/oauth/callback/github/native_trigger`) recognises the signed state and hands it to
`NativeOAuthCallback`, which exchanges the code and posts the token to the drawer that opened it.
---
+6 -1
View File
@@ -135,7 +135,7 @@ sufficient — see "Flip, or ask first" below. The one standing exception is an
leave that PR in draft (usually so it can be tested first) — honour it for that PR, and don't
carry it over to the next one.
1. **Trigger a round and wait for it**: launch the waiter as a background Bash task (a round takes 10–30 min; you are woken when it exits — do not stop the session or poll in the foreground while it runs):
1. **Trigger a round and wait for it**: launch the waiter as a background Bash task (a round takes about 10 min, 20 at most; you are woken when it exits — do not stop the session or poll in the foreground while it runs):
```bash
bash .agents/skills/pr/review-round.sh <PR_NUMBER>
@@ -143,6 +143,11 @@ carry it over to the next one.
It comments `/review` on the PR — which runs the Codex, Claude and Pi CI reviewers even on a draft — waits for the spawned `PR Review Commands` workflow run(s) to complete, then prints one verdict line per reviewer and saves the full review comments to files.
Waiting rules — a session that breaks one sits idle on results the user can already see:
- **Use the waiter, not a loop of your own.** It always exits: as soon as the Codex, Claude and Pi verdicts are posted, once the round's run completes (failed jobs included), at a 20-minute deadline with whatever was posted, or non-zero when no run appeared or GitHub kept erroring — treat a non-zero exit as "look yourself", not "no reviews". A hand-written loop waiting for "a comment from each reviewer" never ends when one reviewer dies (capacity errors, cancelled jobs), since a dead job posts nothing.
- **If your harness does not wake you when a background command exits, run the waiter in the foreground** with a timeout of at least 25 minutes. Backgrounding it and ending your turn then means nobody ever reads the result.
- **Act on a missing reviewer immediately.** Reviewers that never start or hang are common. The waiter names each reviewer with no review and the jobs that did not finish cleanly; re-trigger each missing one at once with a `/codex`, `/claude` or `/pi` PR comment and run the waiter again, rather than waiting longer.
`/review` (and `/codex`) are **idempotent per head SHA**: if a running or successful review already covers the current head, they skip that agent and post nothing new — the waiter reads the existing verdict for that head, so a skipped agent is *not* a missing one. A cancelled/failed head run is re-run in place; a fresh run is launched only when nothing covers the head. So an unchanged-head re-review is a near no-op, not a new round — push a commit to get genuinely fresh reviews.
2. **Judge the round.** Codex is mandatory; Claude, Pi and cubic count whenever they posted. Every review starts with one of the three `REVIEW.md` verdicts:
+56 -17
View File
@@ -7,19 +7,20 @@
# Comments `/review` on the PR (works on drafts), waits for the spawned
# "PR Review Commands" workflow run(s) to complete, then prints one verdict
# line per reviewer and saves each full review comment to a file. A round
# takes 10-30 minutes: run this in the background and act on its output when
# takes about 10 minutes, 20 at most: run this in the background and act on its output when
# it exits, per the pr skill ("Review rounds").
set -euo pipefail
REPO=${REPO:-$(gh repo view --json nameWithOwner --jq .nameWithOwner)}
PR=${1:-$(gh pr view --json number --jq .number)}
PR_TITLE=$(gh pr view "$PR" --repo "$REPO" --json title --jq .title)
# Timestamp of the trigger comment, straight from GitHub, so local clock skew
# can't make the run/comment filters below miss part of the round.
TRIGGER_TIME=$(gh api "repos/$REPO/issues/$PR/comments" -f body='/review' --jq .created_at)
echo "Review round triggered on $REPO#$PR at $TRIGGER_TIME"
# Retry wrapper for one-off gh/API hiccups: a 45-minute wait must not die on
# Retry wrapper for one-off gh/API hiccups: a 20-minute wait must not die on
# a single transient failure.
retry() {
local attempt
@@ -31,21 +32,39 @@ retry() {
}
# The /review comment spawns one "PR Review Commands" run holding the
# claude/codex/pi jobs. Runs aren't linked to a PR, so wait on every run of
# that workflow created after the trigger: a concurrent round on another PR
# can only delay the answer, never truncate it. Every issue comment on any PR
# spawns a fast-completing parse run of the same workflow, so the round's own
# run may briefly lag the listing while unrelated runs already show completed:
# require the all-completed state to hold past a floor and across two
# consecutive polls before trusting it.
DEADLINE=$(( $(date +%s) + 45 * 60 ))
# claude/codex/pi jobs. Runs aren't linked to a PR, but an issue_comment run's
# display title is the PR's title: match on it, since waiting on every run
# after the trigger means a stuck reviewer on any other PR holds this round
# to the deadline. Every comment on this PR (the reviewers' own
# included) spawns a fast-completing parse run, so the round's own run may
# briefly lag the listing while those already show completed: require the
# all-completed state to hold past a floor and across two consecutive polls.
#
# Reviews land 6-10 minutes in. A reviewer that never starts or hangs is common
# and only a human re-trigger fixes it, so stop early: as soon as all three
# verdicts are posted, else at 20 minutes, naming the jobs still unfinished.
VERDICT_RE='(Good to merge|Mergeable, but should ideally address nits|Should address issues before merging)'
# Claude edits a placeholder comment in place, hence updated_at.
all_verdicts_in() {
gh api "repos/$REPO/issues/$PR/comments?per_page=100" --paginate 2>/dev/null \
| jq -s -e --arg t "$TRIGGER_TIME" --arg re "$VERDICT_RE" '
[.[][] | select(.updated_at > $t) | select(.body // "" | test($re))] as $c
| ($c | any(.user.login == "github-actions[bot]" and (.body | startswith("## Codex Review"))))
and ($c | any(.user.login == "github-actions[bot]" and (.body | startswith("## Pi Review"))))
and ($c | any(.user.login == "claude[bot]"))' >/dev/null
}
DEADLINE=$(( $(date +%s) + 20 * 60 ))
NO_RUN_DEADLINE=$(( $(date +%s) + 5 * 60 ))
MIN_WAIT_UNTIL=$(( $(date +%s) + 3 * 60 ))
STABLE=0
SEEN=0
ALL_IN=0
ROUND_RUNS='[]'
FAILURES=0
while :; do
if RUNS=$(gh run list --repo "$REPO" --workflow=pr-review-commands.yml \
--created ">=$TRIGGER_TIME" --limit 100 --json status); then
--created ">=$TRIGGER_TIME" --limit 500 --json databaseId,status,displayTitle \
--jq "[.[] | select(.displayTitle == $(jq -Rn --arg t "$PR_TITLE" '$t'))]"); then
FAILURES=0
else
FAILURES=$(( FAILURES + 1 ))
@@ -58,6 +77,13 @@ while :; do
continue
fi
TOTAL=$(jq length <<<"$RUNS")
# The limit applies before the title filter, so on a busy repo this PR's run
# can age out of the listing: once seen, never report it as missing.
if [ "$TOTAL" -gt 0 ]; then SEEN=1; ROUND_RUNS=$RUNS; fi
if all_verdicts_in; then
ALL_IN=1
break
fi
PENDING=$(jq '[.[] | select(.status != "completed")] | length' <<<"$RUNS")
NOW=$(date +%s)
if [ "$TOTAL" -gt 0 ] && [ "$PENDING" -eq 0 ] && [ "$NOW" -gt "$MIN_WAIT_UNTIL" ]; then
@@ -68,12 +94,12 @@ while :; do
else
STABLE=0
fi
if [ "$TOTAL" -eq 0 ] && [ "$NOW" -gt "$NO_RUN_DEADLINE" ]; then
if [ "$SEEN" -eq 0 ] && [ "$NOW" -gt "$NO_RUN_DEADLINE" ]; then
echo "ERROR: no 'PR Review Commands' run appeared within 5 minutes of the /review comment; check that the comment author has write access and the workflow is enabled." >&2
exit 1
fi
if [ "$NOW" -gt "$DEADLINE" ]; then
echo "WARNING: review round still pending after 45 minutes; reporting whatever has been posted so far." >&2
echo "WARNING: review round still pending after 20 minutes; reporting whatever has been posted so far." >&2
break
fi
sleep 60
@@ -100,7 +126,7 @@ head_run_state() {
# A re-run-in-place review lands on a head-tied run that finishes after the fast
# pr-review-commands run, so let those settle before reading verdicts.
for wf in codex-pr-review.yml pi-pr-review.yml pr-ready-review.yml; do
while :; do
while [ "$ALL_IN" -eq 0 ]; do
case "$(head_run_state "$wf")" in
""|"completed "*) break ;;
*) if [ "$(date +%s)" -gt "$DEADLINE" ]; then break; fi; sleep 30 ;;
@@ -121,8 +147,6 @@ REVIEWS_RAW=$(retry gh api "repos/$REPO/pulls/$PR/reviews?per_page=100" --pagina
jq -s --arg t "$TRIGGER_TIME" '[.[][] | select((.submitted_at // "") > $t)]' \
<<<"$REVIEWS_RAW" > "$OUT_DIR/pr-reviews.json"
VERDICT_RE='(Good to merge|Mergeable, but should ideally address nits|Should address issues before merging)'
body_by_header() { # <file> <header-substring>
jq -r --arg h "$2" '[.[] | select(.body // "" | contains($h))] | last | .body // empty' "$1"
}
@@ -144,7 +168,11 @@ verdict_body() { # <header|login> <value> <workflow>
report() { # <reviewer-name> <comment-body>
local name=$1 body=$2 verdict
if [ -z "$body" ]; then
echo "$name: (no review posted for this head)"
if [ "$name" = cubic ]; then
echo "$name: (no review posted for this head)"
else
echo "$name: (no review posted for this head; re-trigger now with a '/$name' PR comment)"
fi
return
fi
printf '%s\n' "$body" > "$OUT_DIR/$name.md"
@@ -167,6 +195,17 @@ fi
report cubic "$CUBIC_BODY"
echo
echo "Full round output: $OUT_DIR (comments.json, pr-reviews.json, one .md per reviewer)"
if [ "$ALL_IN" -eq 0 ]; then
UNFINISHED=$(for id in $(jq -r '.[].databaseId' <<<"$ROUND_RUNS"); do
gh run view "$id" --repo "$REPO" --json jobs --jq '.jobs[]
| select(.status != "completed" or (.conclusion | IN("success", "skipped") | not))
| " \(.name): \(.status) \(.conclusion // "") since \(.startedAt // "-")"' 2>/dev/null || true
done)
if [ -n "$UNFINISHED" ]; then
echo "Review jobs that did not finish cleanly:"
printf '%s\n' "$UNFINISHED"
fi
fi
if [ -z "$CODEX_BODY" ]; then
echo "WARNING: no Codex verdict for $HEAD_SHA - its head run is not green (cancelled/failed/absent, not merely skipped-because-already-reviewed). Re-trigger with a '/codex' PR comment (re-runs the interrupted run in place, or launches one) and wait again." >&2
fi
+1
View File
@@ -0,0 +1 @@
../../../.agents/skills/demo-video/SKILL.md
+10
View File
@@ -44,6 +44,16 @@ jobs:
--health-cmd "mysqladmin ping -h localhost" --health-interval 10s
--health-timeout 5s --health-retries 5
steps:
# Linking one full-graph binary per tests/*.rs file fills the runner disk
# ("No space left on device" in cargo test (build)). Drop preinstalled
# toolchains no test uses before anything is installed or restored.
- name: Free disk space
working-directory: /
run: |
df -h /
sudo rm -rf /usr/local/lib/android /opt/ghc /usr/local/.ghcup /usr/share/swift \
/usr/local/share/boost /opt/hostedtoolcache/CodeQL || true
df -h /
- uses: actions/checkout@v4.4.0
- uses: actions/setup-dotnet@v4.3.1
with:
+2
View File
@@ -11,6 +11,8 @@ on:
- "frontend/**"
# The flow chat compiles the chat SDK's source in (svelte.config.js alias).
- "chat-sdk/src/**"
# Also compiled in through an alias.
- "cli/windmill-utils-internal/src/**"
- ".github/workflows/frontend-check.yml"
jobs:
+23
View File
@@ -51,3 +51,26 @@ jobs:
with:
bun-version: latest
- run: cd cli && ./build.sh && cd npm && npm publish --access public
publish_utils_internal:
runs-on: ubuntu-latest
environment: npm
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: cli/windmill-utils-internal
steps:
- uses: actions/checkout@v4.4.0
- uses: actions/setup-node@v7.1.0
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"
# Versioned on its own, so most releases have nothing new to publish.
- run: |
pkg=$(node -p 'const p = require("./package.json"); p.name + "@" + p.version')
if [ -n "$(npm view "$pkg" version 2>/dev/null)" ]; then
echo "$pkg is already published"
else
npm ci && npm publish
fi
+1 -1
View File
@@ -1,3 +1,3 @@
{
".": "1.882.0"
".": "1.894.1"
}
+2 -1
View File
File diff suppressed because one or more lines are too long
+263
View File
@@ -1,5 +1,268 @@
# Changelog
## [1.894.1](https://github.com/windmill-labs/windmill/compare/v1.894.0...v1.894.1) (2026-12-01)
### Bug Fixes
* run squashed loop iterations as regular jobs ([#12772](https://github.com/windmill-labs/windmill/issues/12772)) ([b4ca673](https://github.com/windmill-labs/windmill/commit/b4ca673a2920f20b283e59dd3afc9786ee741ff2))
## [1.894.0](https://github.com/windmill-labs/windmill/compare/v1.893.0...v1.894.0) (2026-11-30)
### Features
* load a large result on request, ten render_all elements at a time ([#12664](https://github.com/windmill-labs/windmill/issues/12664)) ([d1abc75](https://github.com/windmill-labs/windmill/commit/d1abc75fa6afcf60ed1948830fb90d0a3c6ece94))
* show s3 csv and parquet results in the db table with filters ([#12712](https://github.com/windmill-labs/windmill/issues/12712)) ([8064fa8](https://github.com/windmill-labs/windmill/commit/8064fa8fb62fc30ce88777395bf69ca828374e23))
### Bug Fixes
* copy labels into forks and detect label changes in compare ([#12738](https://github.com/windmill-labs/windmill/issues/12738)) ([f79e4b6](https://github.com/windmill-labs/windmill/commit/f79e4b618dee54f25396e5b70eef9cca05781cef))
* forward ai proxy decisions requests on output-limited models ([#12770](https://github.com/windmill-labs/windmill/issues/12770)) ([39fb7f3](https://github.com/windmill-labs/windmill/commit/39fb7f34cb206a8087d2ca05c5e6a5c108302f44))
* give AI agent tools run locally a job span and log fields ([#12684](https://github.com/windmill-labs/windmill/issues/12684)) ([d482968](https://github.com/windmill-labs/windmill/commit/d48296808effa9cb259adc891e9a6f8f4ee3b0ca))
* resolve $var: references in custom ai resource headers ([#12764](https://github.com/windmill-labs/windmill/issues/12764)) ([a57f2df](https://github.com/windmill-labs/windmill/commit/a57f2df2c8b2e87d4ea329ab48ad2a0943b3d53c))
* S3 table preview and DB table search bar bugs ([#12768](https://github.com/windmill-labs/windmill/issues/12768)) ([876fbb1](https://github.com/windmill-labs/windmill/commit/876fbb1e09c9723f80603abb4c759f4e4dbefe16))
* show a running job with a fading play ring on home and the runs page ([#12671](https://github.com/windmill-labs/windmill/issues/12671)) ([e3d5b04](https://github.com/windmill-labs/windmill/commit/e3d5b043504e6292967bcac479703d54a7d6a0ee))
## [1.893.0](https://github.com/windmill-labs/windmill/compare/v1.892.0...v1.893.0) (2026-11-30)
### Features
* configurable CRAN repository url for R scripts ([#12759](https://github.com/windmill-labs/windmill/issues/12759)) ([5b6ee10](https://github.com/windmill-labs/windmill/commit/5b6ee1001c0092576bd1e4de5c8bfdca9698aeca))
### Bug Fixes
* keep the cli login form reachable under a long admin reliance notice ([#12761](https://github.com/windmill-labs/windmill/issues/12761)) ([0a4583b](https://github.com/windmill-labs/windmill/commit/0a4583b661cf36a30c1059c36adaf45b5b6e6765))
## [1.892.0](https://github.com/windmill-labs/windmill/compare/v1.891.0...v1.892.0) (2026-11-30)
### Features
* instance-wide IP allowlist on the Client IP settings page ([#12756](https://github.com/windmill-labs/windmill/issues/12756)) ([d62b195](https://github.com/windmill-labs/windmill/commit/d62b195f481c149dd20facaead07a92feda29d9f))
* make client IP trust settable from the instance settings ([#12755](https://github.com/windmill-labs/windmill/issues/12755)) ([de14e74](https://github.com/windmill-labs/windmill/commit/de14e74ec0e0d461072e4c3ee21083abdec7705d))
## [1.891.0](https://github.com/windmill-labs/windmill/compare/v1.890.0...v1.891.0) (2026-11-29)
### Features
* record the real client IP behind proxies with no configuration ([#12752](https://github.com/windmill-labs/windmill/issues/12752)) ([9039e1a](https://github.com/windmill-labs/windmill/commit/9039e1a8246f120beb353cca824bdefcefe31882))
### Bug Fixes
* **audit:** record what a global users.update changed (super_admin, devops, disabled, name) ([#12742](https://github.com/windmill-labs/windmill/issues/12742)) ([ca1cb13](https://github.com/windmill-labs/windmill/commit/ca1cb13ad9c349413bd8cff26ebe694595f1f0cf))
## [1.890.0](https://github.com/windmill-labs/windmill/compare/v1.889.1...v1.890.0) (2026-11-29)
### Features
* show what a token loses without its owner's admin rights ([#12749](https://github.com/windmill-labs/windmill/issues/12749)) ([3ee1d6a](https://github.com/windmill-labs/windmill/commit/3ee1d6a4b8ce56209f0617d1cbd67951ea6df0c5))
### Bug Fixes
* clearer refusal messages and an install-scripts opt-in for app bundling ([#12750](https://github.com/windmill-labs/windmill/issues/12750)) ([6ca1820](https://github.com/windmill-labs/windmill/commit/6ca1820c518bcf684d3b31231a3f4109e9b390d7))
* **cli:** accept the cwd's spelling of the checkout in wmill dev path checks ([#12736](https://github.com/windmill-labs/windmill/issues/12736)) ([76ac275](https://github.com/windmill-labs/windmill/commit/76ac275686d348a6ad61b470cc909e72305a80a7))
* consistent argument reference handling across captures, re-runs, approvals and evals ([#12745](https://github.com/windmill-labs/windmill/issues/12745)) ([86612a0](https://github.com/windmill-labs/windmill/commit/86612a0ff609013027e69f6f3839cbba56675a05))
* consistent writes for linked resource/variable pairs and instance database resolution ([#12746](https://github.com/windmill-labs/windmill/issues/12746)) ([09202d4](https://github.com/windmill-labs/windmill/commit/09202d40948d59fc3e519a103c55ce8a7b04669b))
* copy data tables whose database uses extensions ([#12716](https://github.com/windmill-labs/windmill/issues/12716)) ([2a53334](https://github.com/windmill-labs/windmill/commit/2a53334b3ffe7de5a22d57e951a9eb7487d47f8f))
* leave draining workers out of the autoscaling count ([#12739](https://github.com/windmill-labs/windmill/issues/12739)) ([dd206df](https://github.com/windmill-labs/windmill/commit/dd206df8e33aa7ba6adc4e04c4dd56696f16338c))
* resolve runnables and run-as identities consistently across tasks, deploys and triggers ([#12744](https://github.com/windmill-labs/windmill/issues/12744)) ([8fac722](https://github.com/windmill-labs/windmill/commit/8fac722b8edfce2ae29fc9a8723d8d0e4faf9ff5))
* tighten generated SQL names, flow input lookup and app install steps ([#12748](https://github.com/windmill-labs/windmill/issues/12748)) ([65d567f](https://github.com/windmill-labs/windmill/commit/65d567fec6468dcbb2d52528b4594fe4a0c26b59))
* tighten token scope consistency across MCP, job import and capture paths ([#12743](https://github.com/windmill-labs/windmill/issues/12743)) ([3ee0d88](https://github.com/windmill-labs/windmill/commit/3ee0d889ef7d1453666c3c451be9259da3c8825b))
* workspace and fork lifecycle consistency ([#12747](https://github.com/windmill-labs/windmill/issues/12747)) ([0f2f8aa](https://github.com/windmill-labs/windmill/commit/0f2f8aaaa325b93a42c78753a9b4184f3670763e))
## [1.889.1](https://github.com/windmill-labs/windmill/compare/v1.889.0...v1.889.1) (2026-11-28)
### Bug Fixes
* **frontend:** keep url helpers in their own chunk ([dde36c1](https://github.com/windmill-labs/windmill/commit/dde36c16826ce534ff3d4e0c403e373394693149))
* read scope for listing mcp tools ([8ccb60c](https://github.com/windmill-labs/windmill/commit/8ccb60c711ada9abdb46e9afa24760bb899bdd89))
## [1.889.0](https://github.com/windmill-labs/windmill/compare/v1.888.0...v1.889.0) (2026-11-28)
### Features
* **mcp:** show client details on the oauth consent page ([1a43ff8](https://github.com/windmill-labs/windmill/commit/1a43ff85005fb972404323decab3bbbf61f8cb2b))
### Bug Fixes
* app rendering mode for visitors ([24b15a7](https://github.com/windmill-labs/windmill/commit/24b15a72e846a648ce52f50f9d7141a1aff8ad52))
* **cli:** dev server and sync path handling improvements ([46a64b1](https://github.com/windmill-labs/windmill/commit/46a64b1b467b9596e698456abf38369744dd8843))
* **frontend:** dev page and raw app editor message handling ([c883b82](https://github.com/windmill-labs/windmill/commit/c883b82fa73a4a6556cebe4b0ef72d2923d8046b))
* **frontend:** input handling cleanups ([90c1361](https://github.com/windmill-labs/windmill/commit/90c1361b73f8897a4dce78f1b59163df4027a3ea))
* **frontend:** use the shared markdown renderer in more views ([767d2d6](https://github.com/windmill-labs/windmill/commit/767d2d6f915db277a3e712e3a0075924a17aadbb))
* recordings and mcp tools loading tweaks ([b9e0e06](https://github.com/windmill-labs/windmill/commit/b9e0e068788681a24748f28b4af2df9a3c7e7998))
* serve s3 previews with an explicit content type ([#12715](https://github.com/windmill-labs/windmill/issues/12715)) ([4f309ec](https://github.com/windmill-labs/windmill/commit/4f309ec5fb01d13636a4bcef7fd1fe427a307823))
* tidy redirect handling after login and logout ([561c5a1](https://github.com/windmill-labs/windmill/commit/561c5a1ad30b3c34c8c7d42008f57645078e9854))
* token scope matching cleanups ([7365bfd](https://github.com/windmill-labs/windmill/commit/7365bfdf68a3cdb42c25f6a0b7053eec22f64752))
* **typescript-client:** read task parameter names past a default value ([#12718](https://github.com/windmill-labs/windmill/issues/12718)) ([a7ee99c](https://github.com/windmill-labs/windmill/commit/a7ee99ce63671efde8860e89b3ead8cf794c1c9f))
* **typescript-client:** skip regex literals when reading task parameter names ([00acb80](https://github.com/windmill-labs/windmill/commit/00acb80e0dfe803c7741f63b380bf95f33605f8f))
## [1.888.0](https://github.com/windmill-labs/windmill/compare/v1.887.0...v1.888.0) (2026-11-28)
### Features
* open images in the session preview panel ([#12602](https://github.com/windmill-labs/windmill/issues/12602)) ([0c63dfe](https://github.com/windmill-labs/windmill/commit/0c63dfe18cdcd86cd34cc51907ceef2118e80e2f))
* require two-factor authentication for password logins ([#12704](https://github.com/windmill-labs/windmill/issues/12704)) ([8ec6bee](https://github.com/windmill-labs/windmill/commit/8ec6beed3a4ef550ecd86991122b8a8757ef7021))
### Bug Fixes
* give mcp show tools a text fallback for clients without cards ([#12707](https://github.com/windmill-labs/windmill/issues/12707)) ([84e9038](https://github.com/windmill-labs/windmill/commit/84e903848af65ca049d8059c9627a859220052b2))
* **mcp:** hold each MCP call to its own token, workspace and route ([#12709](https://github.com/windmill-labs/windmill/issues/12709)) ([cb5d6a9](https://github.com/windmill-labs/windmill/commit/cb5d6a92c22bdb606c23266a7370d726ef9eb16e))
* opt the audit probe token into superadmin ([#12710](https://github.com/windmill-labs/windmill/issues/12710)) ([3ad867e](https://github.com/windmill-labs/windmill/commit/3ad867ee658a9bf9aa7c587d4e61724915841683))
* tidy the mcp show tool text fallbacks ([#12713](https://github.com/windmill-labs/windmill/issues/12713)) ([a32ae57](https://github.com/windmill-labs/windmill/commit/a32ae571ca3bdae708f8018abd193d45de69241d))
* validate return addresses on the webhook and cli sign-in pages ([#12719](https://github.com/windmill-labs/windmill/issues/12719)) ([dce05fd](https://github.com/windmill-labs/windmill/commit/dce05fdc3b775d9930b17fdfc3eeb8c93fb389a4))
## [1.887.0](https://github.com/windmill-labs/windmill/compare/v1.886.0...v1.887.0) (2026-11-27)
### Features
* add native totp two-factor authentication for password login ([#12620](https://github.com/windmill-labs/windmill/issues/12620)) ([f52c117](https://github.com/windmill-labs/windmill/commit/f52c117e76c4b39265e4d5b3f8304934dce3f0c0))
* add token introspection endpoint and token test UI ([#12702](https://github.com/windmill-labs/windmill/issues/12702)) ([55aec82](https://github.com/windmill-labs/windmill/commit/55aec82102bca445fa91a2d6b926a8a68f953527))
* connect native trigger accounts through the resource connect flow ([#12352](https://github.com/windmill-labs/windmill/issues/12352)) ([9643ba0](https://github.com/windmill-labs/windmill/commit/9643ba09a4c2a10172e2b4227f9c00f8c46662f5))
* edit token expiration and allowed IPs, widen only as far as mintable ([#12703](https://github.com/windmill-labs/windmill/issues/12703)) ([b2f3986](https://github.com/windmill-labs/windmill/commit/b2f3986f9430147eab8fb36d47c091124824de0e))
* edit token scopes from the CLI and show token access in token lists ([#12694](https://github.com/windmill-labs/windmill/issues/12694)) ([7e79229](https://github.com/windmill-labs/windmill/commit/7e79229aa4731cf0fbf108ab946fa6b7b651d5d5))
* flag risky tokens and add a superadmin token review ([#12693](https://github.com/windmill-labs/windmill/issues/12693)) ([51e9017](https://github.com/windmill-labs/windmill/commit/51e9017c67481e334c529387db442be2002a287c))
* make new tokens workspace-bound and rights-free unless opted in ([#12695](https://github.com/windmill-labs/windmill/issues/12695)) ([f5644d7](https://github.com/windmill-labs/windmill/commit/f5644d7f431f7c566302645fd2e0e94970ea3376))
* split account settings into profile, tokens, AI and MCP drawers ([#12691](https://github.com/windmill-labs/windmill/issues/12691)) ([46cf750](https://github.com/windmill-labs/windmill/commit/46cf7509fabb8464a75d5651b2ef6c0be83d81a4))
* stop a loop once a failure threshold of iterations has failed ([#12686](https://github.com/windmill-labs/windmill/issues/12686)) ([0496abb](https://github.com/windmill-labs/windmill/commit/0496abbad8e494b6ae2eff0d72661c6b9534b179))
### Bug Fixes
* apply token read-only flag to HTTP route calls ([#12690](https://github.com/windmill-labs/windmill/issues/12690)) ([f1edefa](https://github.com/windmill-labs/windmill/commit/f1edefa132b6b5a7e6ba9475749027aa315895d3))
* **cli:** accept Windows separators in strict-folder-boundaries test ([#12689](https://github.com/windmill-labs/windmill/issues/12689)) ([443ea15](https://github.com/windmill-labs/windmill/commit/443ea155a155dd2e76d7583b0ba48e6cd15d788c))
* copy the shown error from AI chat tool cards ([#12698](https://github.com/windmill-labs/windmill/issues/12698)) ([5b3a40b](https://github.com/windmill-labs/windmill/commit/5b3a40b1a428a508b3472b1756a37cea33e869ef))
* demote a token's superadmin when its owner loses it ([#12692](https://github.com/windmill-labs/windmill/issues/12692)) ([3ec14c7](https://github.com/windmill-labs/windmill/commit/3ec14c7ed2b1ff1283c69197522a5b79e3970a77))
* **frontend:** open non-raster images in a new tab as PNG ([#12697](https://github.com/windmill-labs/windmill/issues/12697)) ([de2cd55](https://github.com/windmill-labs/windmill/commit/de2cd55b338d48de055f134e304dfbe10c3ca29e))
* rerun recovered iterations in failed-only restarts ([#12657](https://github.com/windmill-labs/windmill/issues/12657)) ([57ad72b](https://github.com/windmill-labs/windmill/commit/57ad72b28aaf9386eb552443379addb7d3b00777))
## [1.886.0](https://github.com/windmill-labs/windmill/compare/v1.885.0...v1.886.0) (2026-11-26)
### Features
* a second OTel logs exporter for audit logs ([#12675](https://github.com/windmill-labs/windmill/issues/12675)) ([f28bdff](https://github.com/windmill-labs/windmill/commit/f28bdff94f82d18c2d75d179c6f35f524f5b220c))
* add a Require SSO workspace protection rule ([#12681](https://github.com/windmill-labs/windmill/issues/12681)) ([71f22fc](https://github.com/windmill-labs/windmill/commit/71f22fc6e93f43b2ee4d1eec5c1b5c9ece5e941e))
* overwrite or discard each path conflict when reassigning user items ([#12683](https://github.com/windmill-labs/windmill/issues/12683)) ([b3ab8e2](https://github.com/windmill-labs/windmill/commit/b3ab8e22b37a666d4ffdbead4a80c406502254b2))
* own model and effort for script generation and AI review ([#12678](https://github.com/windmill-labs/windmill/issues/12678)) ([51cd51c](https://github.com/windmill-labs/windmill/commit/51cd51cd52cabed72b6516e83b1542d0225543cd))
* record client IP and user agent on audit entries ([#12673](https://github.com/windmill-labs/windmill/issues/12673)) ([c689d74](https://github.com/windmill-labs/windmill/commit/c689d74505a007d87dfc558fd69ee22ccba22653))
### Bug Fixes
* derive the client ip from trusted proxies only ([#12677](https://github.com/windmill-labs/windmill/issues/12677)) ([f452090](https://github.com/windmill-labs/windmill/commit/f45209064ac3a030e0c31f5ac54c09f8c54a32c1))
* redact secrets in instance settings reads unless explicitly revealed ([#12682](https://github.com/windmill-labs/windmill/issues/12682)) ([cc855e6](https://github.com/windmill-labs/windmill/commit/cc855e6fd94268c19bf05658736e15b83310f283))
* resolve the client ip in one place and trust private ranges only on cloud ([#12685](https://github.com/windmill-labs/windmill/issues/12685)) ([0b11d3e](https://github.com/windmill-labs/windmill/commit/0b11d3e9a691450997d902015f680a54fd2f2cc6))
## [1.885.0](https://github.com/windmill-labs/windmill/compare/v1.884.1...v1.885.0) (2026-11-25)
### Features
* hand the code selected with ⌘K and Ctrl+L to an AI session ([#12661](https://github.com/windmill-labs/windmill/issues/12661)) ([5d4820d](https://github.com/windmill-labs/windmill/commit/5d4820d3736fa6f307fb4838e525e32c4dc24838))
* pass MCP image results to the AI chat model as images ([#12660](https://github.com/windmill-labs/windmill/issues/12660)) ([772c0c3](https://github.com/windmill-labs/windmill/commit/772c0c30f1f47a84b2fd7ec6456882482c0759c5))
* show who approved a flow run, and list opted-in approvals on home ([#12604](https://github.com/windmill-labs/windmill/issues/12604)) ([3efe1e9](https://github.com/windmill-labs/windmill/commit/3efe1e97a7d54be674b78dbfdb48e6f8f8591527))
* show why a step waits: sleep, concurrency limit, approval ([#12607](https://github.com/windmill-labs/windmill/issues/12607)) ([182356e](https://github.com/windmill-labs/windmill/commit/182356ec358cf9fa759983d39ffff128468c85cb))
### Bug Fixes
* bound sqlx's return-to-pool step so a failover can't wedge the pool ([#12655](https://github.com/windmill-labs/windmill/issues/12655)) ([8e3f117](https://github.com/windmill-labs/windmill/commit/8e3f11705f8705e2c1adb50a139b4a501795e5ec))
* check run scope on what a schedule or trigger save names ([#12618](https://github.com/windmill-labs/windmill/issues/12618)) ([4b715c4](https://github.com/windmill-labs/windmill/commit/4b715c422a75e93ac9a6aa9b9c74a31ba786734c))
* **cli:** keep generate-metadata inside the named folder ([#12668](https://github.com/windmill-labs/windmill/issues/12668)) ([2c2273c](https://github.com/windmill-labs/windmill/commit/2c2273cffb26c55e883bad6ee96653935e0412ab))
* hold a volume's lease through sync-back and pull it in parallel ([#12667](https://github.com/windmill-labs/windmill/issues/12667)) ([5953595](https://github.com/windmill-labs/windmill/commit/5953595d50a20fc08449bf1d0c7aa6b0c0a12b81))
* let the attached flow step panel scroll ([#12652](https://github.com/windmill-labs/windmill/issues/12652)) ([29383dd](https://github.com/windmill-labs/windmill/commit/29383dd814677465f98a02038b2fd2d83e117edd))
* log in on the live session when the browser sends two token cookies ([#12663](https://github.com/windmill-labs/windmill/issues/12663)) ([8f637d5](https://github.com/windmill-labs/windmill/commit/8f637d58d6654740bca41f32a3462e5951ff8f4c))
* match flow step pickers to the role and keep picked settings ([#12654](https://github.com/windmill-labs/windmill/issues/12654)) ([00e354d](https://github.com/windmill-labs/windmill/commit/00e354dade598ed9f434576ef616b53e0cf6b543))
* **mcp:** require a session on the MCP OAuth client routes and audit registrations ([#12647](https://github.com/windmill-labs/windmill/issues/12647)) ([2b7c7e9](https://github.com/windmill-labs/windmill/commit/2b7c7e98acfc96dc10931948252a02d39325e798))
* **python:** treat tomllib and newer stdlib modules as stdlib in import inference ([#12670](https://github.com/windmill-labs/windmill/issues/12670)) ([655562e](https://github.com/windmill-labs/windmill/commit/655562e805a9b74adbb1e3faa85d97bc567dd99a))
* show minutes instead of seconds after the first minute in relative times ([#12631](https://github.com/windmill-labs/windmill/issues/12631)) ([b59d27b](https://github.com/windmill-labs/windmill/commit/b59d27bdb1daaa0e3fbacc3cfb692b01fe7254d3))
* skip the session backup in preview frames and keep draft handles stable ([#12598](https://github.com/windmill-labs/windmill/issues/12598)) ([53ebb94](https://github.com/windmill-labs/windmill/commit/53ebb94ddb167ae4bebd06fcdbed77df1391bc68))
* stop state_snapshot_uncloneable warnings from chart options ([#12653](https://github.com/windmill-labs/windmill/issues/12653)) ([2bdad42](https://github.com/windmill-labs/windmill/commit/2bdad42ad060e5678df22e5df3d90d598c2586c5))
## [1.884.1](https://github.com/windmill-labs/windmill/compare/v1.884.0...v1.884.1) (2026-11-25)
### Bug Fixes
* unblock backend CI and deno jobs with a script path ([#12648](https://github.com/windmill-labs/windmill/issues/12648)) ([783d89a](https://github.com/windmill-labs/windmill/commit/783d89a92c6a854d76b24c4a54e23c1a84172502))
## [1.884.0](https://github.com/windmill-labs/windmill/compare/v1.883.0...v1.884.0) (2026-11-24)
### Features
* add SAP icon for the sap_hana resource type ([#12633](https://github.com/windmill-labs/windmill/issues/12633)) ([a888954](https://github.com/windmill-labs/windmill/commit/a8889548144110cd2d92a2687d3042365dbe9f3b))
* ask for secrets and connect services in the AI chat through a secure card ([#12575](https://github.com/windmill-labs/windmill/issues/12575)) ([9536cfd](https://github.com/windmill-labs/windmill/commit/9536cfdab198dbe189b5181e87934a8ac5f9956a))
* full-screen image viewer with zoom, pan, copy and download ([#12634](https://github.com/windmill-labs/windmill/issues/12634)) ([3908150](https://github.com/windmill-labs/windmill/commit/39081509dd9158c5858a616ff8039d243bef8b2b))
* give each AI session its own model and effort ([#12632](https://github.com/windmill-labs/windmill/issues/12632)) ([564fdf7](https://github.com/windmill-labs/windmill/commit/564fdf7d2ded8d84fab9172ea6f820954ce1310b))
* group consecutive draft writes in the AI chat transcript ([#12597](https://github.com/windmill-labs/windmill/issues/12597)) ([f399a22](https://github.com/windmill-labs/windmill/commit/f399a22c1034ffeb1634fd3a704d5ee44f60f076))
* rerun only the failed iterations of a parallel for-loop or branch-all ([#12590](https://github.com/windmill-labs/windmill/issues/12590)) ([6a0283a](https://github.com/windmill-labs/windmill/commit/6a0283a9506b5328466a3983e3b0ec949f88464e))
### Bug Fixes
* bind datatable() args as literals and read _FLOW_PATH on previews ([#12638](https://github.com/windmill-labs/windmill/issues/12638)) ([a8b2228](https://github.com/windmill-labs/windmill/commit/a8b22287533ca72c3c09d59d5c0facadd2973703))
* give jailed uv lock its own cache and copy no symlinked deps ([#12641](https://github.com/windmill-labs/windmill/issues/12641)) ([a2de197](https://github.com/windmill-labs/windmill/commit/a2de1979bb895b928693b23b312802dd026e8887))
* pass ai agent tools only the inputs in their schema ([#12642](https://github.com/windmill-labs/windmill/issues/12642)) ([b23037e](https://github.com/windmill-labs/windmill/commit/b23037e3e1b6d4b154c3d51a6bf4721eade3bddc))
* pin definer function search_path and check sql contextual vars ([#12640](https://github.com/windmill-labs/windmill/issues/12640)) ([2df2c83](https://github.com/windmill-labs/windmill/commit/2df2c83313c871567de448e33acecffda4ad459a))
* read request bodies as plain json and keep cancel reasons literal ([#12646](https://github.com/windmill-labs/windmill/issues/12646)) ([114d684](https://github.com/windmill-labs/windmill/commit/114d68456e19b71b3f5d635829b568e6e1edbca9))
* scope app dependency relock to the job's workspace ([#12644](https://github.com/windmill-labs/windmill/issues/12644)) ([1683b80](https://github.com/windmill-labs/windmill/commit/1683b801859a15884e139e91f3366d57ab8f8157))
* suggest filter values by their label and in any case ([#12582](https://github.com/windmill-labs/windmill/issues/12582)) ([cf8a1c3](https://github.com/windmill-labs/windmill/commit/cf8a1c38500e64567e5e8fd496feee5bf2e3b0b7))
## [1.883.0](https://github.com/windmill-labs/windmill/compare/v1.882.0...v1.883.0) (2026-11-24)
### Features
* alert on same-tag wait deadlocks and fail the waiting parent ([#12613](https://github.com/windmill-labs/windmill/issues/12613)) ([304f912](https://github.com/windmill-labs/windmill/commit/304f9121835655c35091b3a98ddcb6b579548115))
* **cli:** 30-day CLI login tokens with expiry picker and token roll ([#12621](https://github.com/windmill-labs/windmill/issues/12621)) ([e810cbb](https://github.com/windmill-labs/windmill/commit/e810cbb93a1847ba823cc5088bc3f88ed7552090))
* fold consecutive test runs of one item in the ai chat ([#12599](https://github.com/windmill-labs/windmill/issues/12599)) ([924d9b7](https://github.com/windmill-labs/windmill/commit/924d9b7755485d59379f1ff745a051ad5da3b820))
* keep mcp consent page open with a copyable callback for localhost clients ([#12619](https://github.com/windmill-labs/windmill/issues/12619)) ([3194184](https://github.com/windmill-labs/windmill/commit/3194184c521c2ad4a99529f6c7422c14af3ebb84))
* let the workspace error handler skip jobs started from the UI ([#12624](https://github.com/windmill-labs/windmill/issues/12624)) ([ade2a55](https://github.com/windmill-labs/windmill/commit/ade2a55e862caa78dfca09646aac74670cbfd901))
* **nsjail:** make rlimit_fsize configurable per worker (NSJAIL_RLIMIT_FSIZE_MB) ([#12609](https://github.com/windmill-labs/windmill/issues/12609)) ([e6d9ff8](https://github.com/windmill-labs/windmill/commit/e6d9ff8f9596f7529c899f9f8fd1d34a91698792))
* pick how to connect a resource in a wizard, one row per provider ([#12418](https://github.com/windmill-labs/windmill/issues/12418)) ([2ca87ef](https://github.com/windmill-labs/windmill/commit/2ca87efdb8527d591865125db42d9f6f3b42bee3))
* redesign the token scope picker and add a scope search ([#12595](https://github.com/windmill-labs/windmill/issues/12595)) ([344694a](https://github.com/windmill-labs/windmill/commit/344694ada73c857724cb8244e7e7f8188efa2611))
* restore working in a new fork from the Home session composer ([#12559](https://github.com/windmill-labs/windmill/issues/12559)) ([1fb70c4](https://github.com/windmill-labs/windmill/commit/1fb70c4fab5379874c42d349120ed2e2db9a0806))
* show who deployed each version in script and flow history ([#12587](https://github.com/windmill-labs/windmill/issues/12587)) ([ba0ef82](https://github.com/windmill-labs/windmill/commit/ba0ef82eedf97ce310967134b9200c4f93e7c3db))
* store refreshed installation JWT for managed GitHub app git sync ([#12592](https://github.com/windmill-labs/windmill/issues/12592)) ([c3cb814](https://github.com/windmill-labs/windmill/commit/c3cb814e9e99c414a56fac9e1874f4eed5c1f42c))
### Bug Fixes
* apply a changed default value to the Time and Date Select app components ([#12581](https://github.com/windmill-labs/windmill/issues/12581)) ([17fe165](https://github.com/windmill-labs/windmill/commit/17fe165d605c6043afd53cdd83a88b63deae3d59))
* **cli:** require the dot in .fetch.ts/.bun.ts/.deno.ts language suffixes ([#12583](https://github.com/windmill-labs/windmill/issues/12583)) ([ff8f2e0](https://github.com/windmill-labs/windmill/commit/ff8f2e05fb20cf4f5e931f7169856217c8088312))
* derive chat lookup grouping from tool definitions ([#12596](https://github.com/windmill-labs/windmill/issues/12596)) ([3a720da](https://github.com/windmill-labs/windmill/commit/3a720da989416caabed08e9659b81f04cf510ac1))
* generate branch predicates from the branch node ([#12623](https://github.com/windmill-labs/windmill/issues/12623)) ([f9ade48](https://github.com/windmill-labs/windmill/commit/f9ade481dae05bdbb0ef876939bcd3e5b7d02da4))
* harden telemetry submission ([#12606](https://github.com/windmill-labs/windmill/issues/12606)) ([1d3fcb4](https://github.com/windmill-labs/windmill/commit/1d3fcb4a06c26f0007a95fbe40cc55761d4988f5))
* let a Date & Time input become valid again once a later day is picked ([#12584](https://github.com/windmill-labs/windmill/issues/12584)) ([508b9f8](https://github.com/windmill-labs/windmill/commit/508b9f84f3a9ab80eb37db48c9a1e6c480d0ec55))
* make schedule and trigger lists usable on small screens ([#12594](https://github.com/windmill-labs/windmill/issues/12594)) ([1fe3704](https://github.com/windmill-labs/windmill/commit/1fe370451576689215678e4da9098b4b342d1220))
* raise windmill-worker macro recursion limit so main builds again ([#12612](https://github.com/windmill-labs/windmill/issues/12612)) ([db218c0](https://github.com/windmill-labs/windmill/commit/db218c0d3aff6476643fbf98188cf743a5c285ea))
* serialize BigInt and non-finite elements of sql template arrays ([#12616](https://github.com/windmill-labs/windmill/issues/12616)) ([5044d02](https://github.com/windmill-labs/windmill/commit/5044d02325ff788bb5316e115fc52b377ef3c237))
* steps inside expanded subflows on the flow detail and run pages ([#12591](https://github.com/windmill-labs/windmill/issues/12591)) ([a5c7dd4](https://github.com/windmill-labs/windmill/commit/a5c7dd4f699c85190eca5cc88717d85fcc28cfae))
* stop AI sessions rewriting the tab's copy of the AI settings ([#12615](https://github.com/windmill-labs/windmill/issues/12615)) ([a87ab5d](https://github.com/windmill-labs/windmill/commit/a87ab5d6acfac1f175e4abac90e931de91ae4d50))
* use the session's AI config in session editor tabs ([#12593](https://github.com/windmill-labs/windmill/issues/12593)) ([3ceff81](https://github.com/windmill-labs/windmill/commit/3ceff81e72541d63a29029fd8b296c318cd64b77))
* **worker:** fall back to host RAM when cgroup v2 memory.max is max ([#12588](https://github.com/windmill-labs/windmill/issues/12588)) ([7d5a09a](https://github.com/windmill-labs/windmill/commit/7d5a09af83d611b06bff881d5c9d6dc57204b567))
### Performance Improvements
* **worker:** read cgroup and proc files directly instead of spawning cat ([#12614](https://github.com/windmill-labs/windmill/issues/12614)) ([3495d42](https://github.com/windmill-labs/windmill/commit/3495d42f78250572b913d15c0209cb9598f89646))
## [1.882.0](https://github.com/windmill-labs/windmill/compare/v1.881.1...v1.882.0) (2026-11-22)
+7
View File
@@ -1,4 +1,11 @@
{
# Caddy replaces X-Forwarded-For with its own peer unless that peer is trusted. With a load
# balancer or Cloudflare in front of Caddy, list its ranges so the client address reaches
# Windmill. On windmill_server, add a balancer to TRUSTED_PROXIES, but for Cloudflare set
# TRUST_CLOUDFLARE=true rather than listing its ranges, which any Cloudflare Worker sends from:
# servers {
# trusted_proxies static private_ranges
# }
layer4 {
:25 {
route {
+2
View File
@@ -83,6 +83,8 @@ COPY /backend/windmill-api/build_openapi.sh /backend/windmill-api/build_openapi.
COPY /system_prompts/auto-generated /system_prompts/auto-generated
# The flow chat imports the chat SDK's source (svelte.config.js alias `windmill-chat`).
COPY /chat-sdk/src /chat-sdk/src
# Shared with the CLI (svelte.config.js alias `windmill-utils-internal`).
COPY /cli/windmill-utils-internal/src /cli/windmill-utils-internal/src
RUN cd /backend/windmill-api && . ./build_openapi.sh
COPY /backend/parsers/windmill-parser-wasm/pkg/ /backend/parsers/windmill-parser-wasm/pkg/
+12
View File
@@ -30,6 +30,18 @@ If the prompt context provides a `PR AUTHOR` (GitHub login) and the verdict is N
- Read additional files only when the diff is not enough to validate a finding.
- Do not modify any files.
## Accepted risks
Some security trade-offs are decided on purpose and recorded where the code they concern is
documented. Do not report them as findings; do report a change that widens one beyond what its
record describes.
- **Client IP default proxy trust** (`backend/windmill-common/src/client_ip.rs`,
`docs/auth-surface.md` → "The client IP"): with `TRUSTED_PROXIES` unset, the private ranges are
trusted as proxies, token IP allowlists included, so a host on the private network can name its
own client address. Setting `TRUSTED_PROXIES` to the actual proxies' addresses (not `private`)
closes it.
## Severity triage
Tag each finding with a severity. Always report P0 and P1. Report P2 only when the diff invites it (a new `pub fn`, a new module, a new exported component, a meaningful refactor).
+30
View File
@@ -240,6 +240,36 @@ dismissed, so `userAnswers: []` dismisses every question. Without it the tool re
it cannot ask, and the model usually carries on with its own guess, which makes "asks
before creating anything" impossible to assert.
`runtime.secretRequests` does the same for the `request_secret` card, one answer per card in
the order they open, and a card past the last answer is dismissed:
```yaml
secretRequests:
- action: save # or dismiss
fields: { host: db.example.com } # non-secret fields the user fills on the card
check: { ok: false, error: password authentication failed } # the card's connection test
```
`save` goes through the card's own save, so the secret variables (with placeholder values)
and the resource are created in the workspace, deployed, and the model reads the result the
chat would give it. `check` is reported as is; no connection test runs.
`runtime.codeSelections` attaches code to the prompt of a global case, as the chips of code
selected in an editor do. `source` names the item (`script`, `flow`, `raw_app` or `agent`) and
optionally its `part` (a flow step, app runnable, agent tool or script module file), and
`content` is the code from `startLine` to `endLine`:
```yaml
codeSelections:
- source: { kind: flow, path: f/evals/global/process_refund, part: calculate_total }
lang: bun
startLine: 1
endLine: 2
content: |-
export async function main(subtotal: number) {
return { subtotal, total: subtotal }
```
`runtime.profile` runs a session-chat case (`sessionChat: true`) as a non-admin role
instead of full access: the prompt, toolset and tool schemas are cut as production's
`capabilitiesForRole` cuts them, and the workspace's `operator_settings` are seeded for the
@@ -4,6 +4,7 @@ import {
globalToolsFor,
prepareGlobalUserMessage,
} from "../../../../../frontend/src/lib/components/copilot/chat/global/core";
import { createCodeSelection } from "../../../../../frontend/src/lib/components/copilot/chat/context";
import { assembleGlobalSystemMessage } from "../../../../../frontend/src/lib/components/copilot/chat/global/globalAssembly";
import {
canBuild,
@@ -23,7 +24,14 @@ import { filterSessionTools } from "../../../../../frontend/src/lib/components/c
import { usersWorkspaceStore } from "../../../../../frontend/src/lib/stores";
import { resolveResourceTypeSync } from "../../../../../frontend/src/lib/components/copilot/chat/script/core";
import { appendPlanModeInstructions } from "../../../../../frontend/src/lib/components/copilot/chat/planMode";
import type { Tool as ProductionTool } from "../../../../../frontend/src/lib/components/copilot/chat/shared";
import type {
Tool as ProductionTool,
ToolCallbacks,
} from "../../../../../frontend/src/lib/components/copilot/chat/shared";
import {
saveSecretRequest,
secretFieldsOf,
} from "../../../../../frontend/src/lib/components/copilot/chat/secretRequest";
import { createEvalPlanTools } from "./planModeTools";
import { createEvalPipelineEditors } from "./evalPipelineEditors";
import { pipelineTools } from "../../../../../frontend/src/lib/components/copilot/chat/pipeline/core";
@@ -39,7 +47,9 @@ import {
type EvalPreviewTabFixture,
} from "./evalPreviewTabs";
import type {
EvalCaseCodeSelection,
EvalCaseProfile,
EvalSecretRequestAnswer,
ModeRunContext,
PipelineRunSpec,
} from "../../../../core/types";
@@ -137,6 +147,7 @@ export interface GlobalEvalOptions {
// Start in plan mode: the gate refuses every tool without `planModeSafe`, and the two plan
// tools are offered. Needs sessionChat, which is what plan mode is gated on in production.
planMode?: boolean;
codeSelections?: EvalCaseCodeSelection[];
// The user's rights, resolved as a session resolves them; unset keeps full access.
profile?: EvalCaseProfile;
// Run the pipeline the chat drafted once it is over (`validate.pipelineRun`).
@@ -144,6 +155,7 @@ export interface GlobalEvalOptions {
model?: string;
maxIterations?: number;
userAnswers?: string[];
secretRequests?: EvalSecretRequestAnswer[];
provider?: AIProvider;
backend: WindmillBackendSettings;
// Artifacts the session already holds when the run starts.
@@ -153,6 +165,37 @@ export interface GlobalEvalOptions {
runContext?: ModeRunContext;
}
/** The user's side of the secret card: an answer saves through the card's own save, with a
* placeholder for each secret, or dismisses it; a card past the last answer is dismissed. */
function scriptedSecretCard(
answers: EvalSecretRequestAnswer[],
): NonNullable<ToolCallbacks["requestSecret"]> {
const pending = [...answers];
return async (_toolId, request) => {
const answer = pending.shift();
if (!answer || answer.action === "dismiss") return undefined;
const outcome = await saveSecretRequest(
request,
{
path: request.path,
replace: request.replace ?? false,
secrets: Object.fromEntries(
secretFieldsOf(request).map((f) => [
f.field,
`eval-secret-${f.field || "value"}`,
]),
),
fields: request.resource && {
...request.resource.value,
...answer.fields,
},
},
new Set(),
);
return answer.check ? { ...outcome, check: answer.check } : outcome;
};
}
export async function runGlobalEval(
userPrompt: string,
apiKey: string,
@@ -246,6 +289,9 @@ export async function runGlobalEval(
pipelineFolders: pipelineEditors?.folders(),
});
const baseSystemMessage = assembleSystemMessage();
const codeSelections = (options.codeSelections ?? []).map(({ source, ...selection }) =>
createCodeSelection(source, selection),
);
const helpers = {
...evalArtifacts.helpers,
// A standalone chat has no session: the tools that behave differently in one (a pipeline
@@ -272,10 +318,12 @@ export async function runGlobalEval(
}
: undefined,
isPlanModeActive: planMode?.isPlanModeActive,
requestSecret:
options.secretRequests && scriptedSecretCard(options.secretRequests),
isToolAvailable: (name) =>
(!pipelineToolNames.has(name) || (pipelineEditors?.folders().length ?? 0) > 0) &&
(planMode?.isToolAvailable?.(name) ?? true),
userMessage: prepareGlobalUserMessage(userPrompt, [], {
userMessage: prepareGlobalUserMessage(userPrompt, codeSelections, {
...(injectActiveEditorContext ? { workspace: workspaceRoot } : {}),
activePreview: panel?.activePreview(),
resourceTypeSync: await resolveResourceTypeSync(workspaceRoot, []),
@@ -52,6 +52,8 @@ export interface RunEvalParams<THelpers, TOutput> {
* tool changes what the prompt should say — plan mode's instructions have to come back
* out once the plan is approved. Falls back to the fixed `systemMessage`. */
getSystemMessage?: () => ChatCompletionSystemMessageParam;
/** Stands in for the secret card. Absent, `request_secret` reports that it cannot show one. */
requestSecret?: ToolCallbacks["requestSecret"];
onAssistantMessageStart?: () => void;
onAssistantToken?: (token: string) => void;
onAssistantMessageEnd?: () => void;
@@ -80,6 +82,7 @@ export async function runEval<THelpers, TOutput>(
isPlanModeActive,
isToolAvailable,
getSystemMessage,
requestSecret,
} = params;
let shouldEmitMessageStart = true;
@@ -145,6 +148,7 @@ export async function runEval<THelpers, TOutput>(
return answer === undefined ? undefined : [answer];
},
}),
...(requestSecret && { requestSecret }),
onNewToken: (token: string) => {
if (shouldEmitMessageStart) {
onAssistantMessageStart?.();
+290 -6
View File
@@ -406,6 +406,8 @@
- write_resource
- deploy_workspace_item
- delete_workspace_item
# The user gave the token, so the secret card would only make them type it again.
- request_secret
toolCallArgs:
- tool: write_variable
field: value
@@ -517,6 +519,45 @@
- returns subtotal, tax, and total from the updated flow logic
- leaves the result as a draft only
- id: global-code-selection-names-its-item
prompt: |-
Throw an error here when the subtotal is negative.
Keep the change as a draft.
initial: ai_evals/fixtures/frontend/global/initial/current_invoice_live_flow.json
runtime:
maxTurns: 10
codeSelections:
- source:
kind: flow
path: f/evals/global/process_refund
part: calculate_total
lang: bun
startLine: 1
endLine: 2
content: |-
export async function main(subtotal: number) {
return { subtotal, total: subtotal }
validate:
# The open flow's own draft, which must stay as it was, and the edited one.
draftCountExactly: 2
requiredDrafts:
- type: flow
path: f/evals/global/process_refund
valueIncludes:
- calculate_total
- throw
forbiddenDrafts:
- type: flow
path: f/evals/global/process_invoice
toolExpect:
forbiddenToolsUsed:
- deploy_workspace_item
- delete_workspace_item
judgeChecklist:
- edits the calculate_total step of the process_refund flow, which the selected code belongs to, not the flow open in the editor
- throws when the subtotal is negative and keeps the rest of the step as it was
- leaves the result as a draft only
- id: global-test14-current-without-live-editor-asks-question
prompt: |-
Please update this script so it returns `ok`.
@@ -584,6 +625,8 @@
- write_trigger
- deploy_workspace_item
- delete_workspace_item
# The user gave the password, so the secret card would only make them type it again.
- request_secret
toolCallArgs:
- tool: write_variable
field: value
@@ -3790,22 +3833,32 @@
sessionChat: true
userAnswers:
- It is for the Stripe API; I will paste the value myself
secretRequests:
- action: save
validate:
requiredDrafts:
- type: variable
valueIncludes:
- '"is_secret": true'
draftCountExactly: 1
toolExpect:
requiredToolsUsed:
- request_secret
forbiddenToolsUsed:
- write_variable
- deploy_workspace_item
# The card saved the draft: what is left is a deploy the AI offers, not a page to open.
- open_page
toolCallArgs:
- tool: request_secret
field: resource_type
fieldMustBeAbsent: true
assistantExpect:
requiredMentionsAnyOf:
- - getVariable
- get_variable
- "$var:"
- - deploy
skipJudge: true
judgeChecklist:
- stages a secret variable with a placeholder value instead of inventing the key
- any example script reads the variable rather than embedding the key; an example given only in the chat is checked separately, so do not score its absence here
- asks for the key through one secure card for a secret variable, without asking for it in the chat or staging a placeholder
- any example script reads the variable rather than embedding the key
# Pills that name what an established workspace holds, read from composer_connected_workspace.
- id: global-composer-explore-datatable
@@ -4239,3 +4292,234 @@
- creates a script draft at f/evals/global/open_tasks_per_user
- the script fetches the todos and counts the open ones per user
- the script returns the per-user counts rather than the raw todo list
# Connecting a service whose secrets the user has not given goes through one request_secret
# card: no question about a field the card takes, and no write of the resource or its secret
# variable, since the card saves both as drafts; the AI then offers to deploy them.
# `runtime.secretRequests` plays the user on the card and saves through its own save.
- id: global-secret-card-supabase-postgres
prompt: |-
Connect our Supabase Postgres database so my scripts can query it. Save it as f/evals/global/supabase_db.
initial: ai_evals/fixtures/frontend/global/initial/user_admin_evals_folder.json
runtime:
maxTurns: 8
userAnswers:
- With a connection string
secretRequests:
- action: save
fields:
host: aws-0-eu-west-1.pooler.supabase.com
port: 5432
user: postgres.abcdefgh
dbname: postgres
sslmode: require
check:
ok: true
validate:
draftCountExactly: 2
toolExpect:
requiredToolsUsed:
- request_secret
forbiddenToolsUsed:
- write_resource
- write_variable
- deploy_workspace_item
# The card saved the drafts: what is left is a deploy the AI offers, not a page to open.
- open_page
toolCallArgs:
- tool: request_secret
field: resource_type
stringEqualsAnyOf:
- postgresql
- tool: request_secret
field: path
stringEqualsAnyOf:
- f/evals/global/supabase_db
assistantExpect:
# The card leaves drafts, which nothing can run until deployed.
requiredMentionsAnyOf:
- - deploy
skipJudge: true
judgeChecklist:
- asks in the chat for no connection detail the card takes (host, user, database, password, connection string)
- connects the database through one secure card at f/evals/global/supabase_db
- refers to it as $res:f/evals/global/supabase_db once it is saved
- id: global-secret-card-openai
prompt: |-
I want my scripts to call OpenAI. Can you add my OpenAI API key to the workspace?
initial: ai_evals/fixtures/frontend/global/initial/user_admin_evals_folder.json
runtime:
maxTurns: 8
secretRequests:
- action: save
check:
ok: true
validate:
draftCountExactly: 2
toolExpect:
requiredToolsUsed:
- request_secret
forbiddenToolsUsed:
- write_resource
- write_variable
- deploy_workspace_item
toolCallArgs:
- tool: request_secret
field: resource_type
stringEqualsAnyOf:
- openai
assistantExpect:
# The card leaves drafts, which nothing can run until deployed.
requiredMentionsAnyOf:
- - deploy
skipJudge: true
judgeChecklist:
- connects OpenAI as an openai resource through one secure card, without asking for the key in the chat
# A secret that goes into no resource is a request_secret without a resource type.
- id: global-secret-card-variable
prompt: |-
Store our Mailgun API key as a secret variable at f/evals/global/mailgun_api_key. A script will take it as an argument later.
initial: ai_evals/fixtures/frontend/global/initial/user_admin_evals_folder.json
runtime:
maxTurns: 8
secretRequests:
- action: save
validate:
draftCountExactly: 1
toolExpect:
requiredToolsUsed:
- request_secret
forbiddenToolsUsed:
- write_resource
- write_variable
- deploy_workspace_item
toolCallArgs:
- tool: request_secret
field: resource_type
fieldMustBeAbsent: true
- tool: request_secret
field: path
stringEqualsAnyOf:
- f/evals/global/mailgun_api_key
assistantExpect:
# The card leaves drafts, which nothing can run until deployed.
requiredMentionsAnyOf:
- - deploy
skipJudge: true
judgeChecklist:
- asks for the Mailgun key through one secure card for a secret variable at f/evals/global/mailgun_api_key, without asking for it in the chat
- refers to it as $var:f/evals/global/mailgun_api_key once it is saved
# A rotated password replaces the secret the existing resource references. Asking for the
# bare variable at that path and replacing the resource with its fields carried over both
# keep the host, user and database.
- id: global-secret-card-replace-password
prompt: |-
The password of our reporting database changed. Can you update it in Windmill?
initial: ai_evals/fixtures/frontend/global/initial/reporting_db_resource.json
runtime:
maxTurns: 8
secretRequests:
- action: save
check:
ok: true
validate:
draftCountAtLeast: 1
toolExpect:
requiredToolsUsed:
- request_secret
forbiddenToolsUsed:
- write_resource
- write_variable
- deploy_workspace_item
- delete_workspace_item
toolCallArgs:
- tool: request_secret
field: path
stringEqualsAnyOf:
- f/evals/global/reporting_db
assistantExpect:
# The card leaves drafts, which nothing can run until deployed.
requiredMentionsAnyOf:
- - deploy
skipJudge: true
judgeChecklist:
- asks for the new password through one secure card on the existing f/evals/global/reporting_db resource, not in the chat
- keeps the resource's host, port, user and database as they are
- id: global-secret-card-s3
prompt: |-
Connect our S3 bucket acme-exports in eu-west-1 so flows can write files there. Save it as f/evals/global/exports_s3.
initial: ai_evals/fixtures/frontend/global/initial/user_admin_evals_folder.json
runtime:
maxTurns: 8
secretRequests:
- action: save
check:
ok: true
validate:
draftCountAtLeast: 2
toolExpect:
requiredToolsUsed:
- request_secret
forbiddenToolsUsed:
- write_resource
- write_variable
- deploy_workspace_item
toolCallArgs:
- tool: request_secret
field: resource_type
stringEqualsAnyOf:
- s3
- tool: request_secret
field: resource_value.bucket
stringIncludesAnyOf:
- acme-exports
assistantExpect:
# The card leaves drafts, which nothing can run until deployed.
requiredMentionsAnyOf:
- - deploy
skipJudge: true
judgeChecklist:
- connects the acme-exports bucket as an s3 resource through one secure card that asks for its access keys
- prepares the bucket and region on the card rather than asking for them in the chat
# A session held in Use has no write tools, but the card is the user's own save, so connecting
# a service still leaves its drafts there.
- id: global-secret-card-read-only-session
prompt: |-
Can you add my OpenAI API key to the workspace?
initial: ai_evals/fixtures/frontend/global/initial/user_admin_evals_folder.json
runtime:
maxTurns: 8
sessionChat: true
profile:
operator: true
operatorSettings:
builder_flows: false
builder_apps: false
manage_schedules: false
manage_triggers: false
secretRequests:
- action: save
check:
ok: true
validate:
draftCountExactly: 2
toolExpect:
requiredToolsUsed:
- request_secret
toolCallArgs:
- tool: request_secret
field: resource_type
stringEqualsAnyOf:
- openai
assistantExpect:
# The card leaves drafts, which nothing can run until deployed.
requiredMentionsAnyOf:
- - deploy
skipJudge: true
judgeChecklist:
- connects OpenAI through the secure card even though the session itself cannot write drafts
+24
View File
@@ -33,8 +33,13 @@ export interface EvalCaseRuntimeSpec {
// past the last one is dismissed, so `[]` dismisses them all. Unset, the question tool
// reports that it cannot ask.
userAnswers?: string[];
// Global mode: the user's side of each request_secret card, in the order the cards open; a
// card past the last one is dismissed. Unset, the tool reports that it cannot show the card.
secretRequests?: EvalSecretRequestAnswer[];
backendPreview?: EvalCaseRuntimeBackendPreview;
appContext?: EvalCaseRuntimeAppContextSpec;
// Global mode: code the user selected in an editor and attached to the prompt.
codeSelections?: EvalCaseCodeSelection[];
// Global mode: run as a session chat (preview tools + session prompt) vs the standalone chat.
sessionChat?: boolean;
// Global session chats: start the case in plan mode, so the workspace-changing tools are
@@ -46,6 +51,25 @@ export interface EvalCaseRuntimeSpec {
profile?: EvalCaseProfile;
}
/** What the user does on a request_secret card. `save` goes through the card's own save, so
* the secret variables and the resource land in the workspace as production writes them, with
* placeholder secret values. */
export interface EvalSecretRequestAnswer {
action: "save" | "dismiss";
/** Non-secret fields the user fills or corrects on the card, over what the model prepared. */
fields?: Record<string, unknown>;
/** The saved resource's connection test as the card reports it; unset for a type with none. */
check?: { ok: true } | { ok: false; error: string };
}
export interface EvalCaseCodeSelection {
source: { kind: "script" | "flow" | "raw_app" | "agent"; path: string; part?: string };
lang: "bun" | "python3" | "bash" | "postgresql";
startLine: number;
endLine: number;
content: string;
}
export interface EvalCaseProfile {
operator: boolean;
operatorSettings?: {
@@ -0,0 +1,33 @@
{
"user": {
"username": "admin",
"is_admin": true,
"folders": ["evals"],
"folders_read": ["evals"]
},
"workspace": {
"variables": [
{
"path": "f/evals/global/reporting_db",
"value": "previous-reporting-password",
"is_secret": true,
"description": "Password for f/evals/global/reporting_db"
}
],
"resources": [
{
"path": "f/evals/global/reporting_db",
"resource_type": "postgresql",
"description": "Eval reporting database",
"value": {
"host": "reports-db.internal",
"port": 5432,
"user": "report_reader",
"dbname": "evals_reporting",
"sslmode": "require",
"password": "$var:f/evals/global/reporting_db"
}
}
]
}
}
+2
View File
@@ -55,12 +55,14 @@ export function createGlobalModeRunner(
previewTabs: initial?.previewTabs,
sessionChat: context.evalCase?.runtime?.sessionChat,
planMode: context.evalCase?.runtime?.planMode,
codeSelections: context.evalCase?.runtime?.codeSelections,
profile: context.evalCase?.runtime?.profile,
pipelineRun: context.executionOnly
? undefined
: (context.evalCase?.validate as GlobalValidationSpec | undefined)?.pipelineRun,
maxIterations: context.evalCase?.runtime?.maxTurns,
userAnswers: context.evalCase?.runtime?.userAnswers,
secretRequests: context.evalCase?.runtime?.secretRequests,
provider: modelConfig.provider,
model: modelConfig.model,
backend: backendSettings,
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT app_id, value, raw_app FROM app_version WHERE id = $1",
"query": "SELECT av.app_id, av.value, av.raw_app FROM app_version av JOIN app a ON a.id = av.app_id\n WHERE av.id = $1 AND a.workspace_id = $2",
"describe": {
"columns": [
{
@@ -21,7 +21,8 @@
],
"parameters": {
"Left": [
"Int8"
"Int8",
"Text"
]
},
"nullable": [
@@ -30,5 +31,5 @@
false
]
},
"hash": "19cca1d42f37e860dc54470fea8dd9a35c412d82d27ce369ccb0ba38b9791669"
"hash": "0031ec1db8de7a249d2471122d16664e9edd61e34e7265cc8a66f330d71176c5"
}
@@ -0,0 +1,80 @@
{
"db_name": "PostgreSQL",
"query": "SELECT email, label, token_prefix AS \"token_prefix!\", expiration,\n created_at AS \"created_at!\", last_used_at AS \"last_used_at!\", scopes, workspace_id,\n read_only AS \"read_only!\", risks AS \"risks!\"\n FROM token_risk\n WHERE NOT self_managed\n AND CASE WHEN $1::text IS NULL THEN cardinality(risks) > 0\n WHEN $1 = 'all' THEN true\n ELSE $1 = ANY(risks) END\n AND ($2::text IS NULL OR strpos(lower(email), $2) > 0\n OR strpos(lower(COALESCE(label, '')), $2) > 0)\n AND ($3::timestamptz IS NULL OR (last_used_at, token_prefix) > ($3, $4::text))\n ORDER BY last_used_at, token_prefix\n LIMIT $5",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "label",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "token_prefix!",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "expiration",
"type_info": "Timestamptz"
},
{
"ordinal": 4,
"name": "created_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 5,
"name": "last_used_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 6,
"name": "scopes",
"type_info": "TextArray"
},
{
"ordinal": 7,
"name": "workspace_id",
"type_info": "Varchar"
},
{
"ordinal": 8,
"name": "read_only!",
"type_info": "Bool"
},
{
"ordinal": 9,
"name": "risks!",
"type_info": "TextArray"
}
],
"parameters": {
"Left": [
"Text",
"Text",
"Timestamptz",
"Text",
"Int8"
]
},
"nullable": [
true,
true,
true,
true,
true,
true,
true,
true,
true,
true
]
},
"hash": "027dbff1397b96a6fb1cfe9aaaffe226bf276cac01b052dac82a6e21b00ac833"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT key, original_scheduled_for IS NOT NULL AND released_at IS NULL AS \"held!\"\n FROM concurrency_key WHERE job_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "key",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "held!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Uuid"
]
},
"nullable": [
false,
null
]
},
"hash": "0361abb4ab7e9a9cf28f0e0551892334eda482fea471e77b6febcd061feba08f"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE password SET totp_recovery_codes = $2 WHERE email = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"TextArray"
]
},
"nullable": []
},
"hash": "05d2b07dd15d14a9c36bdb3dac87d1deb52b91ac98fdadc0c355955a1d90d26a"
}
@@ -0,0 +1,47 @@
{
"db_name": "PostgreSQL",
"query": "SELECT totp_secret, totp_pending_secret, totp_last_step, totp_recovery_codes,\n (totp_failed_attempts >= $2 AND totp_failed_since > now() - interval '1 minute')\n AS \"locked!\"\n FROM password WHERE email = $1 FOR UPDATE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "totp_secret",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "totp_pending_secret",
"type_info": "Text"
},
{
"ordinal": 2,
"name": "totp_last_step",
"type_info": "Int8"
},
{
"ordinal": 3,
"name": "totp_recovery_codes",
"type_info": "TextArray"
},
{
"ordinal": 4,
"name": "locked!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text",
"Int4"
]
},
"nullable": [
true,
true,
true,
true,
null
]
},
"hash": "08cc5c57fb76a392fc32c9122e32d8c33945f8e20daf9242e1de8f4f4ef5546e"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE password SET totp_secret = totp_pending_secret, totp_pending_secret = NULL,\n totp_recovery_codes = $2\n WHERE email = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"TextArray"
]
},
"nullable": []
},
"hash": "0cdcf2f56b35f2c4929071933c2c7f3e4e2dda9f0663fb8b814ce78c3c99a63d"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT COALESCE((error_handler->>'muted_on_ui_runs')::boolean, false) AS \"muted!\"\n FROM workspace_settings WHERE workspace_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "muted!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null
]
},
"hash": "0fc3318da2c8dd5304a0ba7a83f25cb2b7728ac069dcc29f9c7e76d915ea3076"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE volume\n SET size_bytes = $3, file_count = $4,\n updated_at = now(), last_used_at = now(),\n lease_until = NULL, leased_by = NULL,\n generation = generation + generation % 2\n WHERE workspace_id = $1 AND name = $2 AND leased_by = $5",
"query": "UPDATE volume\n SET size_bytes = $3, file_count = $4,\n updated_at = now(), last_used_at = now(),\n generation = generation + generation % 2\n WHERE workspace_id = $1 AND name = $2 AND leased_by = $5",
"describe": {
"columns": [],
"parameters": {
@@ -14,5 +14,5 @@
},
"nullable": []
},
"hash": "f5946a3968df859f668d6197562c10024ffc24f108ca48d5b3fa98e489d931ea"
"hash": "123015f4012169763ac8b16c2e4e0775b6da84dd53aeca8fb9b556f969aee29a"
}
@@ -0,0 +1,29 @@
{
"db_name": "PostgreSQL",
"query": "SELECT id, args->'iter'->'value' AS \"value: sqlx::types::Json<Box<RawValue>>\"\n FROM v2_job WHERE workspace_id = $1 AND id = ANY($2)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Uuid"
},
{
"ordinal": 1,
"name": "value: sqlx::types::Json<Box<RawValue>>",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Text",
"UuidArray"
]
},
"nullable": [
false,
null
]
},
"hash": "1308b30b6ad40783d9d49922cbd861ecfacc02eae817bfbd0c8bc923e90e344d"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE password SET totp_pending_secret = $2\n WHERE email = $1 AND login_type = 'password' AND totp_secret IS NULL",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": []
},
"hash": "134c3b21135ff0558fd234490b7ef56ccb86c2ba94d318c5fb341aa9114b8268"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO app (workspace_id, path, summary, policy, versions, extra_perms, custom_path)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id",
"query": "INSERT INTO app (workspace_id, path, summary, policy, versions, extra_perms, custom_path, labels)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n RETURNING id",
"describe": {
"columns": [
{
@@ -17,12 +17,13 @@
"Jsonb",
"Int8Array",
"Jsonb",
"Text"
"Text",
"TextArray"
]
},
"nullable": [
false
]
},
"hash": "c61977907414d2336030fbab114ea03e4a1d1edb4470812cd7dd57c657fa287a"
"hash": "138fda3e2e7f83f5f60b7990efed2cedbaec80b4a54e4396b40ee5f3d15abcd2"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT value, description, resource_type\n FROM resource\n WHERE workspace_id = $1 AND path = $2",
"query": "SELECT value, description, resource_type, labels\n FROM resource\n WHERE workspace_id = $1 AND path = $2",
"describe": {
"columns": [
{
@@ -17,6 +17,11 @@
"ordinal": 2,
"name": "resource_type",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "labels",
"type_info": "TextArray"
}
],
"parameters": {
@@ -28,8 +33,9 @@
"nullable": [
true,
true,
false
false,
true
]
},
"hash": "819c233915383e89af1bcf1a56c5f67c4e1fc217f216f609e36a9944a7807b33"
"hash": "1473ebd933fbda4550c63c81bddc3486fac4f9c2d0643e8eb15b169c1a900a3a"
}
@@ -0,0 +1,24 @@
{
"db_name": "PostgreSQL",
"query": "SELECT ($2 AND EXISTS(SELECT 1 FROM usr WHERE email = $1 AND is_admin))\n OR ($3 AND COALESCE((SELECT super_admin FROM password WHERE email = $1), false))",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text",
"Bool",
"Bool"
]
},
"nullable": [
null
]
},
"hash": "14bc6e1320127fe40be6f057785a88e50ab1c8c355502d7dbbe52b0e66899897"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO notify_event (channel, payload) VALUES ('notify_token_invalidation', $1)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text"
]
},
"nullable": []
},
"hash": "16003c729b74440f86fe511461f6c091cf865d1a6e877fe69104d59db0e13c61"
}
@@ -0,0 +1,34 @@
{
"db_name": "PostgreSQL",
"query": "SELECT u.username, u.email,\n COALESCE(array_agg(g.group_) FILTER (WHERE g.group_ IS NOT NULL), '{}') AS \"groups!\"\n FROM usr u\n JOIN password p ON p.email = u.email AND p.login_type = 'password'\n LEFT JOIN usr_to_group g ON g.workspace_id = u.workspace_id AND g.usr = u.username\n WHERE u.workspace_id = $1 AND NOT u.is_service_account\n GROUP BY u.username, u.email\n ORDER BY u.username",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "username",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "groups!",
"type_info": "VarcharArray"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false,
null
]
},
"hash": "1816ab8f23338f3e01d01bf4e1ba67e1c180bd4c81b17db1ae2619e2e73fef28"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT login_type, username FROM password WHERE email = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "login_type",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "username",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
true
]
},
"hash": "22b6a5e8d05d47c86713ff804857e037112aac008865934fa3419581034e69d3"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT super_admin, login_type = 'password' AND totp_secret IS NULL AS \"lacks_totp!\"\n FROM password WHERE email = $1 AND disabled = false",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "super_admin",
"type_info": "Bool"
},
{
"ordinal": 1,
"name": "lacks_totp!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
null
]
},
"hash": "235d480efa2a0d8ea0a530454a52aa1fa5a76623cf2e7b75774435cdac9720d0"
}
@@ -0,0 +1,97 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT j.id AS \"id!\",\n COALESCE(j.root_job, j.parent_job, j.id) AS \"root_job_id!\",\n j.runnable_path,\n j.permissioned_as_email AS \"email!\",\n j.created_by AS \"created_by!\",\n j.created_at AS \"created_at!\",\n COALESCE(rj.runnable_path, j.runnable_path) AS flow_path,\n NULLIF(f.summary, '') AS flow_summary,\n s.flow_status->'approval_conditions' AS approval_conditions,\n NULLIF(w.m->'home'->>'step_summary', '') AS step_summary,\n COALESCE((w.m->>'count')::bigint, 1) AS \"required_approvals!\",\n -- Counted as the worker counts them: those sent to the approval step's job,\n -- plus those sent to the flow itself.\n (SELECT count(*) FROM resume_job r WHERE r.job IN (j.id, (w.m->>'job')::uuid))\n AS \"approvals!\",\n EXISTS(SELECT 1 FROM resume_job r\n WHERE r.job IN (j.id, (w.m->>'job')::uuid) AND r.approver = $2)\n AS \"approved_by_me!\"\n FROM v2_job_queue q\n JOIN v2_job j ON j.id = q.id\n JOIN v2_job_status s ON s.id = q.id\n LEFT JOIN v2_job rj ON rj.id = COALESCE(j.root_job, j.parent_job)\n LEFT JOIN flow f\n ON f.workspace_id = j.workspace_id\n AND f.path = COALESCE(rj.runnable_path, j.runnable_path)\n -- The step waiting on the approval, which the worker marks `home` when the approval\n -- step has `show_on_home`: only those are listed, since many approvals are announced\n -- elsewhere (a resume link sent to a chat) and every admin and owner could give them.\n CROSS JOIN LATERAL (\n SELECT s.flow_status->'modules'->((s.flow_status->>'step')::int) AS m\n ) w\n WHERE q.workspace_id = $1\n AND q.suspend > 0\n AND w.m->>'type' = 'WaitingForEvents'\n AND w.m->'home' IS NOT NULL\n AND ($4::text[] IS NULL OR j.tag = ANY($4))\n ORDER BY j.created_at DESC\n LIMIT $3\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id!",
"type_info": "Uuid"
},
{
"ordinal": 1,
"name": "root_job_id!",
"type_info": "Uuid"
},
{
"ordinal": 2,
"name": "runnable_path",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "email!",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "created_by!",
"type_info": "Varchar"
},
{
"ordinal": 5,
"name": "created_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 6,
"name": "flow_path",
"type_info": "Varchar"
},
{
"ordinal": 7,
"name": "flow_summary",
"type_info": "Text"
},
{
"ordinal": 8,
"name": "approval_conditions",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "step_summary",
"type_info": "Text"
},
{
"ordinal": 10,
"name": "required_approvals!",
"type_info": "Int8"
},
{
"ordinal": 11,
"name": "approvals!",
"type_info": "Int8"
},
{
"ordinal": 12,
"name": "approved_by_me!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text",
"Text",
"Int8",
"TextArray"
]
},
"nullable": [
false,
null,
true,
false,
false,
false,
null,
null,
null,
null,
null,
null,
null
]
},
"hash": "25a603879c2324cf4390a4d8ff3ce820f1f96d2c22e645a17b1125a949f8dd88"
}
@@ -0,0 +1,44 @@
{
"db_name": "PostgreSQL",
"query": "SELECT to_char(timestamp AT TIME ZONE 'UTC', 'YYYY-MM-DD') AS \"day!\",\n id AS \"id!\",\n timestamp AS \"ts!\",\n row_to_json(r)::text AS \"line!\"\n FROM (\n SELECT workspace_id, id, timestamp, username, operation,\n action_kind::text AS action_kind, resource, parameters, email, span,\n client_ip, user_agent, peer_ip, forwarded_for\n FROM audit_partitioned\n WHERE timestamp >= $1 AND timestamp < $2\n AND (timestamp, id) > ($3, $4)\n ORDER BY timestamp, id\n LIMIT $5\n ) r\n ORDER BY timestamp, id",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "day!",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "id!",
"type_info": "Int8"
},
{
"ordinal": 2,
"name": "ts!",
"type_info": "Timestamptz"
},
{
"ordinal": 3,
"name": "line!",
"type_info": "Text"
}
],
"parameters": {
"Left": [
"Timestamptz",
"Timestamptz",
"Timestamptz",
"Int8",
"Int8"
]
},
"nullable": [
null,
false,
false,
null
]
},
"hash": "25ddcc281bb8a5f046176bc57749f3e17e9346c3822336c7b001e04a711449a8"
}
@@ -0,0 +1,24 @@
{
"db_name": "PostgreSQL",
"query": "SELECT path FROM resource\n WHERE workspace_id = $1 AND path = ANY($2) AND extra_perms ?| $3",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "path",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text",
"TextArray",
"TextArray"
]
},
"nullable": [
false
]
},
"hash": "269ef755d901662606ce1a4dbcf333331b8500e25ee4196bd5261a953ef876da"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE token SET super_admin = $1 WHERE email = $2 AND label != 'session'\n AND (NOT $1 OR NOT EXISTS (SELECT 1 FROM unnest(scopes) s WHERE s LIKE 'mcp:%'))",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Bool",
"Text"
]
},
"nullable": []
},
"hash": "2aaac7db9463db32f8fb24418aad9aa1e775741631cef8da46d922a0ac63d9b3"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO token\n (token_hash, token_prefix, token, label, super_admin, email)\n VALUES ($1, $2, $3, $4, $5, $6)",
"query": "INSERT INTO token\n (token_hash, token_prefix, token, label, super_admin, email, admin)\n VALUES ($1, $2, $3, $4, $5, $6, true)",
"describe": {
"columns": [],
"parameters": {
@@ -15,5 +15,5 @@
},
"nullable": []
},
"hash": "fd4c5391107af34a3bf9b83b0c3f7d5ee9490240a627b20a1037444845e39c5f"
"hash": "2c70b10578338d5722e5fa4f43b92ab3384f62ae44824b3ba15a4d7921435ca7"
}
@@ -0,0 +1,21 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO token\n (token_hash, token_prefix, token, email, label, expiration, super_admin, owner, allowed_ips, admin)\n VALUES ($1, $2, $3, $4, $5, $6, false, $7, $8::text[]::cidr[], true)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Timestamptz",
"Varchar",
"TextArray"
]
},
"nullable": []
},
"hash": "305f8db93baaa55c2b46192eea353f84ba03bf0c9a8a409386c6c1ef5305dc8d"
}
@@ -0,0 +1,20 @@
{
"db_name": "PostgreSQL",
"query": "SELECT email FROM password WHERE totp_secret IS NOT NULL",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "email",
"type_info": "Varchar"
}
],
"parameters": {
"Left": []
},
"nullable": [
false
]
},
"hash": "31c9a45b4db0ceca15338aa9e95a4a4eb82c330c9838c8358d1067e6a6dc05dd"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE volume\n SET size_bytes = $3, file_count = $4,\n updated_at = now(), updated_by = $5, last_used_at = now(),\n lease_until = NULL, leased_by = NULL, generation = generation + generation % 2\n WHERE workspace_id = $1 AND name = $2",
"query": "UPDATE volume\n SET size_bytes = $3, file_count = $4,\n updated_at = now(), updated_by = $5, last_used_at = now(),\n lease_until = NULL, leased_by = NULL, generation = generation + generation % 2\n WHERE workspace_id = $1 AND name = $2 AND leased_by = $5",
"describe": {
"columns": [],
"parameters": {
@@ -14,5 +14,5 @@
},
"nullable": []
},
"hash": "19c481a0d6ecd4c0dfab6973e4732c2146953253ba6062ab05b34b6b35e41f66"
"hash": "3339c1d01792ff181f9506b57c7e6771c3a1a2a5a67dd467ed263b3501c5d279"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT r AS risk, count(*) AS n FROM token_risk, unnest(risks) r WHERE email = $1 GROUP BY r",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "risk",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "n",
"type_info": "Int8"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null,
null
]
},
"hash": "34854f8d651562512ac522db1dc0c43946b7440bd427d045b8d8b83ba7a3ab26"
}
@@ -0,0 +1,20 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE v2_job_queue\n SET canceled_by = $3, canceled_reason = $4, scheduled_for = now(), suspend = 0\n WHERE id = ANY($2) AND workspace_id = $5 AND canceled_by IS NULL\n AND (suspend > 0 OR NOT running)\n AND NOT EXISTS (SELECT 1 FROM v2_job c WHERE c.parent_job = v2_job_queue.id)\n AND (SELECT count(*) FROM v2_job_status s,\n jsonb_array_elements(s.flow_status->'modules'->$6::int->'flow_jobs_success') e\n WHERE s.id = $1 AND e = 'false'::jsonb) >= $7",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid",
"UuidArray",
"Varchar",
"Text",
"Text",
"Int4",
"Int8"
]
},
"nullable": []
},
"hash": "36270d5bc57411ee110b5299ceb04e0c39747ff8f2aebfed1e3478c4baa2b748"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT hash, created_at, content, summary, description, lock, schema\n FROM script\n WHERE workspace_id = $1 AND path = $2 AND archived = false\n ORDER BY created_at DESC\n LIMIT 1",
"query": "SELECT hash, created_at, content, summary, description, lock, schema, labels\n FROM script\n WHERE workspace_id = $1 AND path = $2 AND archived = false\n ORDER BY created_at DESC\n LIMIT 1",
"describe": {
"columns": [
{
@@ -37,6 +37,11 @@
"ordinal": 6,
"name": "schema",
"type_info": "Json"
},
{
"ordinal": 7,
"name": "labels",
"type_info": "TextArray"
}
],
"parameters": {
@@ -52,8 +57,9 @@
false,
false,
true,
true,
true
]
},
"hash": "a6fe41e36e06c88e1387abaea17107ceab2c5b17258958bde03b3e492bb2790e"
"hash": "398b309a86c3abe0b8daf2ec256dd4eac403ea69d09d7b13d6f5a0b21e2b034a"
}
@@ -0,0 +1,65 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE token SET last_used_at = now() WHERE\n token_hash = $1\n AND (expiration > NOW() OR expiration IS NULL)\n AND (workspace_id IS NULL OR workspace_id = $2)\n RETURNING owner, email, super_admin, scopes, label, read_only,\n allowed_ips::text[] AS allowed_ips, admin",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "owner",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "super_admin",
"type_info": "Bool"
},
{
"ordinal": 3,
"name": "scopes",
"type_info": "TextArray"
},
{
"ordinal": 4,
"name": "label",
"type_info": "Varchar"
},
{
"ordinal": 5,
"name": "read_only",
"type_info": "Bool"
},
{
"ordinal": 6,
"name": "allowed_ips",
"type_info": "TextArray"
},
{
"ordinal": 7,
"name": "admin",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
true,
true,
false,
true,
true,
false,
null,
false
]
},
"hash": "3c2031a385e80273a15d45d45ede51c89c6fdadfcce19f23c518040e82d1df69"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "SELECT id FROM v2_job_completed\n WHERE workspace_id = $1 AND id = ANY($2) AND (status = 'success' OR status = 'skipped')",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Uuid"
}
],
"parameters": {
"Left": [
"Text",
"UuidArray"
]
},
"nullable": [
false
]
},
"hash": "401997343219c77965aa4b700147a42395f4ed5f89e02dcaa2ce60baa5d66949"
}
@@ -0,0 +1,41 @@
{
"db_name": "PostgreSQL",
"query": "SELECT resume_id, approver, created_at, approved FROM resume_job\n WHERE flow = $1 AND ($2::uuid IS NULL OR job IN ($1, $2))",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "resume_id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "approver",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "created_at",
"type_info": "Timestamptz"
},
{
"ordinal": 3,
"name": "approved",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Uuid",
"Uuid"
]
},
"nullable": [
false,
true,
false,
false
]
},
"hash": "456f07b39a39791ea4c0764adc235374571db2fa45b6e97db42e8309ecb02c05"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT account FROM variable WHERE workspace_id = 'test-workspace' AND path = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "account",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
true
]
},
"hash": "483d07c7ad9cf0cb402a5800445cd3f22d75213ebb950af902c4a3fc078f5017"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO flow (\n workspace_id, path, summary, description, value, edited_by, edited_at,\n archived, schema, extra_perms, dependency_job, tag,\n ws_error_handler_muted, dedicated_worker, timeout, visible_to_runner_only,\n concurrency_key, versions, on_behalf_of, on_behalf_of_email, lock_error_logs,\n job_token_scopes, labels\n )\n SELECT $2, path, summary, description, value, edited_by, edited_at,\n archived, schema, extra_perms, NULL, tag,\n ws_error_handler_muted, dedicated_worker, timeout, visible_to_runner_only,\n concurrency_key, ARRAY[]::bigint[],\n -- Same predicate as clone_scripts.\n CASE WHEN on_behalf_of LIKE 'u/%' THEN\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM usr u WHERE u.workspace_id = $2::varchar\n AND u.username = substring(on_behalf_of from 3)\n UNION ALL\n SELECT 1 FROM password p WHERE p.super_admin\n AND (p.username = substring(on_behalf_of from 3)\n OR p.email = substring(on_behalf_of from 3))))\n WHEN on_behalf_of LIKE 'g/%' THEN\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM group_ g WHERE g.workspace_id = $2::varchar\n AND g.name = substring(on_behalf_of from 3)))\n ELSE\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM usr u WHERE u.workspace_id = $2::varchar\n AND u.username = on_behalf_of\n UNION ALL\n SELECT 1 FROM password p WHERE p.email = on_behalf_of\n AND p.super_admin))\n END, on_behalf_of_email, lock_error_logs, job_token_scopes, labels\n FROM flow\n WHERE workspace_id = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Varchar"
]
},
"nullable": []
},
"hash": "4a5679413cd1f5b1b2822a4804a54b2a5a008d7c3313c90fb80d431057223b34"
}
@@ -0,0 +1,20 @@
{
"db_name": "PostgreSQL",
"query": "SELECT 1 AS \"one!\" FROM workspace_key\n WHERE workspace_id = 'admins' AND kind = 'cloud' FOR UPDATE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "one!",
"type_info": "Int4"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "4b8fe0471867cbf4bbb571eae4fc097b36b70a46748fa0c2eedae610173bde86"
}
@@ -0,0 +1,38 @@
{
"db_name": "PostgreSQL",
"query": "DELETE FROM password RETURNING email, totp_secret, totp_last_step, totp_recovery_codes",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "totp_secret",
"type_info": "Text"
},
{
"ordinal": 2,
"name": "totp_last_step",
"type_info": "Int8"
},
{
"ordinal": 3,
"name": "totp_recovery_codes",
"type_info": "TextArray"
}
],
"parameters": {
"Left": []
},
"nullable": [
false,
true,
true,
true
]
},
"hash": "4c100853478519e794d05fe6070acfe8ddb246ceaed99e9e25f6bd34b105c6de"
}
@@ -0,0 +1,30 @@
{
"db_name": "PostgreSQL",
"query": "SELECT q.tag, j.parent_job AS \"parent!\"\n FROM v2_job_queue q JOIN v2_job j ON j.id = q.id\n WHERE q.id = $1 AND j.parent_job = COALESCE($2, j.parent_job)\n AND NOT q.running AND q.suspend = 0\n AND q.scheduled_for <= now() - make_interval(secs => $3::bigint::double precision)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "tag",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "parent!",
"type_info": "Uuid"
}
],
"parameters": {
"Left": [
"Uuid",
"Uuid",
"Int8"
]
},
"nullable": [
false,
true
]
},
"hash": "4c7e47928b56f337a937013e512f24a1c2a22987d0dbd598ddc0560a140e0bef"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT password_hash FROM password WHERE email = $1 AND login_type = 'password'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "password_hash",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
true
]
},
"hash": "4d6646a2bccd6599cdd0d603a2e64f621449524162ef02ff52825af519f576e9"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE password SET\n totp_failed_attempts = CASE WHEN totp_failed_since > now() - interval '1 minute'\n THEN totp_failed_attempts + 1 ELSE 1 END,\n totp_failed_since = CASE WHEN totp_failed_since > now() - interval '1 minute'\n THEN totp_failed_since ELSE now() END\n WHERE email = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text"
]
},
"nullable": []
},
"hash": "4e57eb6c62eb8a04088e91cae5cf955af22d885b24908c3beb949be24378797f"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT id, workspace_id, path, summary, policy, versions, extra_perms, custom_path\n FROM app\n WHERE workspace_id = $1",
"query": "SELECT id, workspace_id, path, summary, policy, versions, extra_perms, custom_path, labels\n FROM app\n WHERE workspace_id = $1",
"describe": {
"columns": [
{
@@ -42,6 +42,11 @@
"ordinal": 7,
"name": "custom_path",
"type_info": "Text"
},
{
"ordinal": 8,
"name": "labels",
"type_info": "TextArray"
}
],
"parameters": {
@@ -57,8 +62,9 @@
false,
false,
false,
true,
true
]
},
"hash": "26fb727ef7d50c93c1c8ce33356ef6feafc448e70c30ba7e7c835f5e3167f3a5"
"hash": "4fff0ec1067f69aa3b67f73e3a7c84177a1050456baa43d348e8b467c5db3b75"
}
@@ -0,0 +1,32 @@
{
"db_name": "PostgreSQL",
"query": "SELECT email, totp_secret, totp_pending_secret FROM password\n WHERE totp_secret IS NOT NULL OR totp_pending_secret IS NOT NULL FOR UPDATE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "totp_secret",
"type_info": "Text"
},
{
"ordinal": 2,
"name": "totp_pending_secret",
"type_info": "Text"
}
],
"parameters": {
"Left": []
},
"nullable": [
false,
true,
true
]
},
"hash": "536bda805dc3d1a5e66185787749b02dbefe608a83564cf165157230a4887639"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE password SET totp_secret = NULL, totp_pending_secret = NULL, totp_last_step = NULL,\n totp_recovery_codes = NULL, totp_failed_attempts = 0, totp_failed_since = NULL\n WHERE email = $1 AND (totp_secret IS NOT NULL OR totp_pending_secret IS NOT NULL)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text"
]
},
"nullable": []
},
"hash": "547f245179c2f91275a0b8e00e5dc327f3a6fe55fb9020c922603e4e7946b49c"
}
@@ -0,0 +1,25 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO token (token_hash, token_prefix, token, email, label, super_admin, scopes, workspace_id, owner, expiration, allowed_ips, admin)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11::text[]::cidr[], $12)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Bool",
"TextArray",
"Varchar",
"Varchar",
"Timestamptz",
"TextArray",
"Bool"
]
},
"nullable": []
},
"hash": "562275b5ac29438796d01d8cfb885f4b31f6b4834687e0c06d1274b5c84b3a0d"
}
@@ -0,0 +1,26 @@
{
"db_name": "PostgreSQL",
"query": "SELECT r AS risk, count(*) AS n FROM token_risk, unnest(risks) r GROUP BY r",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "risk",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "n",
"type_info": "Int8"
}
],
"parameters": {
"Left": []
},
"nullable": [
null,
null
]
},
"hash": "58bb4c7646404beae1f2183b13aef01f3c1737a1ff5f86c37211ff4aa3290b66"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT display_name, owners, extra_perms, summary\n FROM folder\n WHERE workspace_id = $1 AND name = $2",
"query": "SELECT display_name, owners, extra_perms, summary, labels\n FROM folder\n WHERE workspace_id = $1 AND name = $2",
"describe": {
"columns": [
{
@@ -22,6 +22,11 @@
"ordinal": 3,
"name": "summary",
"type_info": "Text"
},
{
"ordinal": 4,
"name": "labels",
"type_info": "TextArray"
}
],
"parameters": {
@@ -34,8 +39,9 @@
false,
false,
false,
true,
true
]
},
"hash": "8039b459914ceefe0c0a31b97473a5522e47b4b2fd3ddeff8f221560bc9c6f57"
"hash": "5bd796933edd56a80add193599714e763d17f9514b0746e9e389699c95f6bb7d"
}
@@ -0,0 +1,30 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE token t SET label = $1\n FROM token old\n WHERE old.token_hash = t.token_hash\n AND t.email = $2 AND t.token_prefix = $3\n AND (t.label IS NULL OR (\n t.label <> 'session'\n AND t.label <> 'guest_session'\n AND lower(t.label) NOT LIKE 'ephemeral%'\n AND t.label <> 'debugger-token'\n AND t.label NOT LIKE 'mcp-oauth-%'\n AND NOT starts_with(t.label, 'embed_app:')\n AND NOT starts_with(t.label, 'sdk_app:')\n AND NOT starts_with(t.label, 'impersonation:')\n AND NOT starts_with(t.label, 'cli-login:')\n AND NOT starts_with(t.label, 'remote-deploy:')\n ))\n RETURNING t.token_prefix, old.label AS previous_label",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token_prefix",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "previous_label",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Varchar",
"Text",
"Text"
]
},
"nullable": [
false,
true
]
},
"hash": "6141c832d916e87dfb353ac73ae4d06088cbdbac4f1a8e7859adfed4c6f64dac"
}
@@ -0,0 +1,47 @@
{
"db_name": "PostgreSQL",
"query": "SELECT v.path, r.created_by AS \"owner?\", false AS \"workspace!\", a.scopes AS \"scopes?\",\n NULL::text[] AS \"missing_scopes?\"\n FROM variable v\n JOIN resource r ON r.workspace_id = v.workspace_id AND r.path = v.path\n LEFT JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account\n WHERE v.workspace_id = $1 AND r.resource_type = $2\n ORDER BY v.path",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "path",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "owner?",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "workspace!",
"type_info": "Bool"
},
{
"ordinal": 3,
"name": "scopes?",
"type_info": "TextArray"
},
{
"ordinal": 4,
"name": "missing_scopes?",
"type_info": "TextArray"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
false,
true,
null,
true,
null
]
},
"hash": "62e8902d2e50191325524827b8ed7e8f4bf2a2b54b8522b52c47f8249ba624b0"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE v2_job_queue SET extras = extras - 'waiting_on' WHERE id = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid"
]
},
"nullable": []
},
"hash": "636af7f63043d20752ef1ef0968efff600fcc5d453edcff05810220daa306bd1"
}
@@ -0,0 +1,29 @@
{
"db_name": "PostgreSQL",
"query": "SELECT favorite_kind::text AS \"kind!\", path FROM favorite\n WHERE usr = $1 AND workspace_id = $2 AND favorite_kind IN ('script', 'flow')",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "kind!",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "path",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
null,
false
]
},
"hash": "6550c0a58ae0b258d9b101683f5a14c9edc522a2895925263286fd41d13ff9c7"
}
@@ -0,0 +1,52 @@
{
"db_name": "PostgreSQL",
"query": "SELECT email, workspace_id, super_admin, owner, allowed_ips::text[] AS allowed_ips, admin\n FROM token WHERE token_hash = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "workspace_id",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "super_admin",
"type_info": "Bool"
},
{
"ordinal": 3,
"name": "owner",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "allowed_ips",
"type_info": "TextArray"
},
{
"ordinal": 5,
"name": "admin",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
true,
true,
false,
true,
null,
false
]
},
"hash": "6bbf56bbc7b647daaba8dc5a4d49bffa976b5da8e8052638b8ee3e3c834dac27"
}
@@ -0,0 +1,16 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO resource (workspace_id, path, value, description, resource_type, extra_perms, edited_at, created_by, labels)\n SELECT $2, path,\n CASE WHEN $3::text IS NOT NULL AND resource_type = 'ai_agent'\n AND jsonb_typeof(value) = 'object' AND value ? 'on_behalf_of'\n THEN jsonb_set(value, '{on_behalf_of}', to_jsonb($3::text))\n ELSE value END,\n description, resource_type, extra_perms, edited_at, created_by, labels\n FROM resource\n WHERE workspace_id = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Varchar",
"Text"
]
},
"nullable": []
},
"hash": "6c1798b9a60634e908852e65e7583a9bc7d8e6f97559b1f6a2a069a073b7e48c"
}
@@ -0,0 +1,47 @@
{
"db_name": "PostgreSQL",
"query": "SELECT j.id, j.tag, j.kind = 'flownode' AS \"is_node!\",\n COALESCE(s.flow_status, c.flow_status) AS flow_status,\n COALESCE(j.raw_flow, fv.value, fn.flow) AS flow\n FROM v2_job j\n LEFT JOIN v2_job_status s ON s.id = j.id\n LEFT JOIN v2_job_completed c ON c.id = j.id\n LEFT JOIN flow_version fv\n ON j.raw_flow IS NULL AND j.kind = 'flow' AND fv.id = j.runnable_id\n LEFT JOIN flow_node fn\n ON j.raw_flow IS NULL AND j.kind = 'flownode' AND fn.id = j.runnable_id\n WHERE j.id = ANY($1) AND j.workspace_id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Uuid"
},
{
"ordinal": 1,
"name": "tag",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "is_node!",
"type_info": "Bool"
},
{
"ordinal": 3,
"name": "flow_status",
"type_info": "Jsonb"
},
{
"ordinal": 4,
"name": "flow",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"UuidArray",
"Text"
]
},
"nullable": [
false,
false,
null,
null,
null
]
},
"hash": "6f9c95e209ad7161ec02b70c156a31e640ed9e8c7fcdc5bd2da94bc5728f0455"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO script (\n workspace_id, hash, path, parent_hashes, summary, description, content,\n created_by, created_at, archived, schema, deleted, is_template,\n extra_perms, lock, lock_error_logs, language, kind, tag,\n envs, concurrent_limit, concurrency_time_window_s, cache_ttl,\n dedicated_worker, ws_error_handler_muted, priority, timeout,\n delete_after_use, delete_after_secs, restart_unless_cancelled, concurrency_key,\n visible_to_runner_only, auto_kind, codebase, has_preprocessor,\n on_behalf_of, on_behalf_of_email, assets, modules, job_token_scopes\n )\n SELECT\n $1, hash, path, parent_hashes, summary, description, content,\n created_by, created_at, archived, schema, deleted, is_template,\n extra_perms, lock, lock_error_logs, language, kind, tag,\n envs, concurrent_limit, concurrency_time_window_s, cache_ttl,\n dedicated_worker, ws_error_handler_muted, priority, timeout,\n delete_after_use, delete_after_secs, restart_unless_cancelled, concurrency_key,\n visible_to_runner_only, auto_kind, codebase, has_preprocessor,\n -- Same three forms and the same prefix-first rule as permissioned_as_exists,\n -- superadmin fallback included: one acting outside their workspaces has no usr\n -- row but still authenticates.\n CASE WHEN on_behalf_of LIKE 'u/%' THEN\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM usr u WHERE u.workspace_id = $1::varchar\n AND u.username = substring(on_behalf_of from 3)\n UNION ALL\n SELECT 1 FROM password p WHERE p.super_admin\n AND (p.username = substring(on_behalf_of from 3)\n OR p.email = substring(on_behalf_of from 3))))\n WHEN on_behalf_of LIKE 'g/%' THEN\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM group_ g WHERE g.workspace_id = $1::varchar\n AND g.name = substring(on_behalf_of from 3)))\n ELSE\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM usr u WHERE u.workspace_id = $1::varchar\n AND u.username = on_behalf_of\n UNION ALL\n SELECT 1 FROM password p WHERE p.email = on_behalf_of\n AND p.super_admin))\n END, on_behalf_of_email, assets, modules, job_token_scopes\n FROM script\n WHERE workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Text"
]
},
"nullable": []
},
"hash": "706f2227e34971d22a577b33f6aaa7f5755da9997419c4a9d07b30d4da318bea"
}
@@ -0,0 +1,25 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO token\n (token_hash, token_prefix, token, email, label, expiration, super_admin, scopes, workspace_id, read_only, allowed_ips, admin)\n SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11::text[]::cidr[], $12\n WHERE $9::varchar IS NULL OR NOT EXISTS(\n SELECT 1 FROM workspace WHERE id = $9 AND deleted = true\n )",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Timestamptz",
"Bool",
"TextArray",
"Varchar",
"Bool",
"TextArray",
"Bool"
]
},
"nullable": []
},
"hash": "7209d20f905f1dd81479e91c5748fcd59ddabaa0ad68e1ac74313948ce1457d1"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "SELECT flow_status AS \"flow_status: Json<FlowStatus>\"\n FROM v2_job_completed WHERE id = $1 AND workspace_id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "flow_status: Json<FlowStatus>",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Uuid",
"Text"
]
},
"nullable": [
true
]
},
"hash": "7255360f4b5c4fd9e1b4f1fd08d3e242854c715fc2f393b84e31ac36ce9fa997"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "SELECT 1 FROM variable WHERE path = $1 AND workspace_id = $2 FOR UPDATE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
null
]
},
"hash": "756524a33cf4923bb0b2a037930faf2f63e8b74389fd543d3b1fbea114706bbd"
}
@@ -1,25 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT EXISTS (\n SELECT 1 FROM v2_job_completed c JOIN v2_job j USING (id)\n WHERE j.workspace_id = $2\n AND c.started_at > now() - interval '3 hours'\n AND c.result @> ('{\"s3\":\"' || $1 || '\"}')::jsonb\n AND j.trigger_kind = 'app'\n AND j.trigger = $3\n AND j.created_by = $4\n )",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "exists",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text",
"Text",
"Text",
"Text"
]
},
"nullable": [
null
]
},
"hash": "75d1618e12c4dfe5e9632ba8dc45b5aeb572e51ebd0732e6ebf80197acb3e577"
}
@@ -0,0 +1,32 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO account (workspace_id, client, expires_at, refresh_token, grant_type, cc_client_id, cc_client_secret, cc_token_url, mcp_server_url, scopes, is_workspace_integration) VALUES ($1, $2, now() + ($3 || ' seconds')::interval, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING id",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Text",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Text",
"TextArray",
"Bool"
]
},
"nullable": [
false
]
},
"hash": "7856dbf515932a2aa31e2124f5cc845a8d8da9e32e2a5b666a220398c76d1266"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO script (\n workspace_id, hash, path, parent_hashes, summary, description, content,\n created_by, created_at, archived, schema, deleted, is_template,\n extra_perms, lock, lock_error_logs, language, kind, tag,\n envs, concurrent_limit, concurrency_time_window_s, cache_ttl,\n dedicated_worker, ws_error_handler_muted, priority, timeout,\n delete_after_use, delete_after_secs, restart_unless_cancelled, concurrency_key,\n visible_to_runner_only, auto_kind, codebase, has_preprocessor,\n on_behalf_of, on_behalf_of_email, assets, modules, job_token_scopes, labels\n )\n SELECT\n $1, hash, path, parent_hashes, summary, description, content,\n created_by, created_at, archived, schema, deleted, is_template,\n extra_perms, lock, lock_error_logs, language, kind, tag,\n envs, concurrent_limit, concurrency_time_window_s, cache_ttl,\n dedicated_worker, ws_error_handler_muted, priority, timeout,\n delete_after_use, delete_after_secs, restart_unless_cancelled, concurrency_key,\n visible_to_runner_only, auto_kind, codebase, has_preprocessor,\n -- Same three forms and the same prefix-first rule as permissioned_as_exists,\n -- superadmin fallback included: one acting outside their workspaces has no usr\n -- row but still authenticates.\n CASE WHEN on_behalf_of LIKE 'u/%' THEN\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM usr u WHERE u.workspace_id = $1::varchar\n AND u.username = substring(on_behalf_of from 3)\n UNION ALL\n SELECT 1 FROM password p WHERE p.super_admin\n AND (p.username = substring(on_behalf_of from 3)\n OR p.email = substring(on_behalf_of from 3))))\n WHEN on_behalf_of LIKE 'g/%' THEN\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM group_ g WHERE g.workspace_id = $1::varchar\n AND g.name = substring(on_behalf_of from 3)))\n ELSE\n (SELECT on_behalf_of WHERE EXISTS (\n SELECT 1 FROM usr u WHERE u.workspace_id = $1::varchar\n AND u.username = on_behalf_of\n UNION ALL\n SELECT 1 FROM password p WHERE p.email = on_behalf_of\n AND p.super_admin))\n END, on_behalf_of_email, assets, modules, job_token_scopes, labels\n FROM script\n WHERE workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Text"
]
},
"nullable": []
},
"hash": "78d53c53d22bdd8948a3375a19a2b3a87eb50150eb7b6888bc32a9d48a5ad21f"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE concurrency_key SET released_at = $2 WHERE job_id = $1 AND released_at IS NULL",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid",
"Timestamptz"
]
},
"nullable": []
},
"hash": "79ad082adcef4e3dd4745bff5f498889cdd0f5365bd43442ac745997f1a4173c"
}
@@ -0,0 +1,149 @@
{
"db_name": "PostgreSQL",
"query": "SELECT resource.workspace_id, resource.path, resource.value, resource.description,\n resource.resource_type, resource.extra_perms, resource.created_by, resource.edited_at,\n resource.labels,\n folder_labels(resource.workspace_id, resource.path) as \"inherited_labels?\",\n (now() > account.expires_at) as is_expired, account.refresh_token != '' as is_refreshed,\n account.refresh_error, account.scopes as \"scopes?\", account.client as \"client?\",\n account.is_workspace_integration as \"is_workspace_integration?\",\n variable.path IS NOT NULL as is_linked,\n variable.is_oauth as \"is_oauth?\",\n variable.account,\n ws_specific.path IS NOT NULL as ws_specific,\n null::bool as draft_only,\n null::bool as is_draft\n FROM resource\n LEFT JOIN variable ON variable.path = resource.path AND variable.workspace_id = $2\n LEFT JOIN account ON variable.account = account.id AND account.workspace_id = $2\n LEFT JOIN ws_specific ON ws_specific.path = resource.path AND ws_specific.workspace_id = $2 AND ws_specific.item_kind = 'resource'\n WHERE resource.path = $1 AND resource.workspace_id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "workspace_id",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "path",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "value",
"type_info": "Jsonb"
},
{
"ordinal": 3,
"name": "description",
"type_info": "Text"
},
{
"ordinal": 4,
"name": "resource_type",
"type_info": "Varchar"
},
{
"ordinal": 5,
"name": "extra_perms",
"type_info": "Jsonb"
},
{
"ordinal": 6,
"name": "created_by",
"type_info": "Varchar"
},
{
"ordinal": 7,
"name": "edited_at",
"type_info": "Timestamptz"
},
{
"ordinal": 8,
"name": "labels",
"type_info": "TextArray"
},
{
"ordinal": 9,
"name": "inherited_labels?",
"type_info": "TextArray"
},
{
"ordinal": 10,
"name": "is_expired",
"type_info": "Bool"
},
{
"ordinal": 11,
"name": "is_refreshed",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "refresh_error",
"type_info": "Text"
},
{
"ordinal": 13,
"name": "scopes?",
"type_info": "TextArray"
},
{
"ordinal": 14,
"name": "client?",
"type_info": "Varchar"
},
{
"ordinal": 15,
"name": "is_workspace_integration?",
"type_info": "Bool"
},
{
"ordinal": 16,
"name": "is_linked",
"type_info": "Bool"
},
{
"ordinal": 17,
"name": "is_oauth?",
"type_info": "Bool"
},
{
"ordinal": 18,
"name": "account",
"type_info": "Int4"
},
{
"ordinal": 19,
"name": "ws_specific",
"type_info": "Bool"
},
{
"ordinal": 20,
"name": "draft_only",
"type_info": "Bool"
},
{
"ordinal": 21,
"name": "is_draft",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
false,
false,
true,
true,
false,
false,
true,
true,
true,
null,
null,
null,
true,
true,
false,
false,
null,
false,
true,
null,
null,
null
]
},
"hash": "79eed97c7119a64f00b85679c491a5001d75fa977a6f57d806d0d1fb28564a23"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "\n WITH j AS (\n SELECT \n raw_flow->>'concurrency_key' as concurrency_key, \n raw_flow->>'concurrency_time_window_s' as concurrency_time_window_s,\n raw_flow->>'concurrency_limit' as concurrent_limit,\n runnable_path, \n runnable_id as version FROM v2_job\n WHERE id = $1\n )\n SELECT tag, j.concurrency_key, j.concurrency_time_window_s::int, j.concurrent_limit::int, j.version\n FROM flow, j\n WHERE path = j.runnable_path\n ",
"query": "\n WITH j AS (\n SELECT \n raw_flow->>'concurrency_key' as concurrency_key, \n raw_flow->>'concurrency_time_window_s' as concurrency_time_window_s,\n raw_flow->>'concurrency_limit' as concurrent_limit,\n runnable_path, \n workspace_id,\n runnable_id as version FROM v2_job\n WHERE id = $1\n )\n SELECT tag, j.concurrency_key, j.concurrency_time_window_s::int, j.concurrent_limit::int, j.version\n FROM flow, j\n WHERE path = j.runnable_path AND flow.workspace_id = j.workspace_id\n ",
"describe": {
"columns": [
{
@@ -42,5 +42,5 @@
true
]
},
"hash": "b7335ac24702c86fbb4ab95916a6aa1648082287b09122755df2462dc71ce831"
"hash": "7af495acd76616fcb91b058b12e852363a314b39a7aa0ee2beaeab549378e7c0"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO token\n (token_hash, token_prefix, token, email, label, expiration, super_admin, allowed_ips,\n workspace_id, admin)\n SELECT $1, $2, $3, $4, $5, $6, $7, $8::text[]::cidr[], $9, $10\n WHERE $9::varchar IS NULL OR NOT EXISTS(\n SELECT 1 FROM workspace WHERE id = $9 AND deleted = true\n )",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Timestamptz",
"Bool",
"TextArray",
"Varchar",
"Bool"
]
},
"nullable": []
},
"hash": "7c420846f546d4307cc503e3a6eafdad0b565360247a644ef7777eecd3e99e1a"
}
@@ -0,0 +1,90 @@
{
"db_name": "PostgreSQL",
"query": "SELECT label, token_prefix AS \"token_prefix!\", expiration,\n created_at AS \"created_at!\", last_used_at AS \"last_used_at!\", scopes, workspace_id,\n read_only AS \"read_only!\", allowed_ips::text[] AS allowed_ips,\n admin AS \"admin!\", super_admin AS \"super_admin!\", risks AS \"risks!\"\n FROM token_risk WHERE email = $1 AND (label != 'ephemeral-script' OR label IS NULL)\n ORDER BY created_at DESC LIMIT $2 OFFSET $3",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "label",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "token_prefix!",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "expiration",
"type_info": "Timestamptz"
},
{
"ordinal": 3,
"name": "created_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 4,
"name": "last_used_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 5,
"name": "scopes",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "workspace_id",
"type_info": "Varchar"
},
{
"ordinal": 7,
"name": "read_only!",
"type_info": "Bool"
},
{
"ordinal": 8,
"name": "allowed_ips",
"type_info": "TextArray"
},
{
"ordinal": 9,
"name": "admin!",
"type_info": "Bool"
},
{
"ordinal": 10,
"name": "super_admin!",
"type_info": "Bool"
},
{
"ordinal": 11,
"name": "risks!",
"type_info": "TextArray"
}
],
"parameters": {
"Left": [
"Text",
"Int8",
"Int8"
]
},
"nullable": [
true,
true,
true,
true,
true,
true,
true,
true,
null,
true,
true,
true
]
},
"hash": "7c70080e4d6248c9593ebfe8c3c3a09252f353124ddad863100f3598f6241fb1"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE password SET totp_failed_attempts = 0, totp_failed_since = NULL WHERE email = $1",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text"
]
},
"nullable": []
},
"hash": "80a33efd3fd3e9bb447568f7e51aecdedadcbf2aaf65820b91793accbd695032"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT totp_secret IS NOT NULL AS \"enrolled!\" FROM password\n WHERE email = $1 AND login_type = 'password'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "enrolled!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null
]
},
"hash": "8449b974fcedf52f9746ae6fd6a052977a44f8b068285949cef8b6ac3ecd6dce"
}
@@ -0,0 +1,18 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE variable SET value = $3, account = $4, edited_by = $5, edited_at = now()\n WHERE workspace_id = $1 AND path = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Text",
"Varchar",
"Int4",
"Varchar"
]
},
"nullable": []
},
"hash": "850fa2b74ada0abebf3905a8596c13dcaae05ce1e15146c77c864c2ad6abbcf5"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT key FROM workspace_key WHERE workspace_id = $1 AND kind = 'cloud' FOR SHARE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "key",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false
]
},
"hash": "8728e856ad6ba82495890e466f5226b401927d6ada71f91e0a035f9945dbf036"
}
@@ -0,0 +1,57 @@
{
"db_name": "PostgreSQL",
"query": "WITH v AS (\n SELECT c.result #> $3 AS r, created_by\n FROM v2_job_completed c JOIN v2_job USING (id)\n WHERE c.id = $1 AND c.workspace_id = $2 AND ($4::text[] IS NULL OR tag = ANY($4))\n )\n SELECT\n created_by AS \"created_by!\",\n jsonb_typeof(r) AS \"type\",\n length(r::text) AS \"length\",\n CASE WHEN jsonb_typeof(r) = 'object' THEN\n ARRAY(SELECT jsonb_object_keys(r) LIMIT $6)\n END AS \"keys\",\n CASE WHEN jsonb_typeof(r) = 'array' THEN jsonb_array_length(r) END AS \"item_count\",\n CASE WHEN jsonb_typeof(r) = 'array' THEN (\n SELECT jsonb_agg(jsonb_build_object(\n 'length', length(e::text),\n 'keys', CASE WHEN jsonb_typeof(e) = 'object' THEN\n to_jsonb(ARRAY(SELECT jsonb_object_keys(e) LIMIT $6))\n END\n ) ORDER BY i)\n FROM jsonb_array_elements(r) WITH ORDINALITY AS t(e, i)\n WHERE i <= $5\n ) END AS \"items: sqlx::types::Json<Vec<ResultShapeItem>>\"\n FROM v",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "created_by!",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "type",
"type_info": "Text"
},
{
"ordinal": 2,
"name": "length",
"type_info": "Int4"
},
{
"ordinal": 3,
"name": "keys",
"type_info": "TextArray"
},
{
"ordinal": 4,
"name": "item_count",
"type_info": "Int4"
},
{
"ordinal": 5,
"name": "items: sqlx::types::Json<Vec<ResultShapeItem>>",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Uuid",
"Text",
"TextArray",
"TextArray",
"Int8",
"Int8"
]
},
"nullable": [
false,
null,
null,
null,
null,
null
]
},
"hash": "8b088d35a98d695c35d0ffe3ee3d104d2e4275bd1e9562927d591650382d510d"
}
@@ -0,0 +1,35 @@
{
"db_name": "PostgreSQL",
"query": "SELECT name, bypass_users, bypass_groups FROM workspace_protection_rule\n WHERE workspace_id = $1 AND (rules & $2) <> 0 ORDER BY name",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "name",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "bypass_users",
"type_info": "TextArray"
},
{
"ordinal": 2,
"name": "bypass_groups",
"type_info": "TextArray"
}
],
"parameters": {
"Left": [
"Text",
"Int4"
]
},
"nullable": [
false,
false,
false
]
},
"hash": "8c8ab1f498ca1460d2b58d95c09af1e3230e8f7cfd7a49b4fec87110e31470fa"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE v2_job_queue q SET suspend = 0\n FROM v2_job j, v2_job_status f\n WHERE q.workspace_id = $1 AND q.suspend = $3 AND j.parent_job = $2\n AND f.id = j.id AND q.id = j.id\n AND (f.flow_status->'step')::int = 0",
"query": "UPDATE v2_job_queue q SET suspend = 0\n FROM v2_job j, v2_job_status f\n WHERE q.workspace_id = $1 AND q.suspend = $3 AND j.parent_job = $2\n AND f.id = j.id AND q.id = j.id\n AND ((f.flow_status->'step')::int = 0\n OR f.flow_status->'modules'->((f.flow_status->'step')::int)->>'id'\n = f.flow_status->'restarted_from'->>'step_id')",
"describe": {
"columns": [],
"parameters": {
@@ -12,5 +12,5 @@
},
"nullable": []
},
"hash": "f1dbcb6e6d82d17c19eb88c0e67dc1cb8baf5bd40b75a2a9cd3ebac440fda632"
"hash": "8e7ab89afc10b5552cc25c00385b3b58f6b28edcfcb8b382580282acea0e9e4d"
}
@@ -0,0 +1,65 @@
{
"db_name": "PostgreSQL",
"query": "SELECT token_hash, label, scopes, super_admin, admin,\n allowed_ips::text[] AS allowed_ips, expiration, workspace_id\n FROM token\n WHERE email = $1 AND token_prefix = $2\n AND (expiration IS NULL OR expiration > now())\n FOR UPDATE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token_hash",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "label",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "scopes",
"type_info": "TextArray"
},
{
"ordinal": 3,
"name": "super_admin",
"type_info": "Bool"
},
{
"ordinal": 4,
"name": "admin",
"type_info": "Bool"
},
{
"ordinal": 5,
"name": "allowed_ips",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "expiration",
"type_info": "Timestamptz"
},
{
"ordinal": 7,
"name": "workspace_id",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
false,
true,
true,
false,
false,
null,
true,
true
]
},
"hash": "8f7b47cc91a6d520cf40787382f5d511eb8c9f096a7ef0fd9c13db8a88be0cf9"
}

Some files were not shown because too many files have changed in this diff Show More