@tangle-network/agent-app 3.0.18 → 3.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant/index.js +4 -4
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/index.js +3 -3
- package/dist/{chunk-FBZR6634.js → chunk-3FKIGI3I.js} +2 -2
- package/dist/{chunk-PMLSY4KI.js → chunk-76Y5VOHE.js} +2 -2
- package/dist/{chunk-ZG3MVB2X.js → chunk-A2M75YRP.js} +2 -2
- package/dist/chunk-A2M75YRP.js.map +1 -0
- package/dist/{chunk-FFY4JDFQ.js → chunk-C5OTKXHP.js} +3 -3
- package/dist/{chunk-SLE4YM62.js → chunk-E633CJFH.js} +2 -2
- package/dist/{chunk-SUWAECFT.js → chunk-JP6QSEF5.js} +3 -1
- package/dist/chunk-JP6QSEF5.js.map +1 -0
- package/dist/{chunk-GLZMHETS.js → chunk-NQQZVQPR.js} +2 -2
- package/dist/chunk-NQQZVQPR.js.map +1 -0
- package/dist/{chunk-XB6ZY367.js → chunk-NWZIC2ER.js} +2 -2
- package/dist/harness/index.js +1 -1
- package/dist/journeys/cli.js +1 -1
- package/dist/journeys/index.js +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +3 -3
- package/dist/sandbox/index.js +2 -2
- package/dist/skills-placement/box.js +2 -2
- package/dist/skills-placement/index.js +2 -2
- package/dist/web-react/agent-profile-editor.js +3 -3
- package/dist/web-react/index.js +4 -4
- package/package.json +6 -6
- package/dist/chunk-GLZMHETS.js.map +0 -1
- package/dist/chunk-SUWAECFT.js.map +0 -1
- package/dist/chunk-ZG3MVB2X.js.map +0 -1
- /package/dist/{chunk-FBZR6634.js.map → chunk-3FKIGI3I.js.map} +0 -0
- /package/dist/{chunk-PMLSY4KI.js.map → chunk-76Y5VOHE.js.map} +0 -0
- /package/dist/{chunk-FFY4JDFQ.js.map → chunk-C5OTKXHP.js.map} +0 -0
- /package/dist/{chunk-SLE4YM62.js.map → chunk-E633CJFH.js.map} +0 -0
- /package/dist/{chunk-XB6ZY367.js.map → chunk-NWZIC2ER.js.map} +0 -0
package/dist/assistant/index.js
CHANGED
|
@@ -9,14 +9,14 @@ import "../chunk-3HUFJ5LO.js";
|
|
|
9
9
|
import "../chunk-7PULOECS.js";
|
|
10
10
|
import "../chunk-E4AY62T2.js";
|
|
11
11
|
import "../chunk-ELPNBEXJ.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-C5OTKXHP.js";
|
|
13
13
|
import "../chunk-Y6PRDUFJ.js";
|
|
14
14
|
import "../chunk-GEYACSFW.js";
|
|
15
15
|
import {
|
|
16
16
|
ChatComposer
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-E633CJFH.js";
|
|
18
18
|
import "../chunk-L7MB2LLM.js";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-76Y5VOHE.js";
|
|
20
20
|
import "../chunk-WYULRKMG.js";
|
|
21
21
|
import "../chunk-2HQP2CTA.js";
|
|
22
22
|
import "../chunk-XR2YIVYZ.js";
|
|
@@ -41,7 +41,7 @@ import "../chunk-TB6KNPFI.js";
|
|
|
41
41
|
import "../chunk-K2JPSXKI.js";
|
|
42
42
|
import "../chunk-KSLTD4FI.js";
|
|
43
43
|
import "../chunk-PV33JZKV.js";
|
|
44
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-JP6QSEF5.js";
|
|
45
45
|
import "../chunk-T3C2BX7N.js";
|
|
46
46
|
import "../chunk-TXD5HXLE.js";
|
|
47
47
|
|
package/dist/chat-react/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComposerModeControls,
|
|
3
3
|
EntryComposer
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-E633CJFH.js";
|
|
5
5
|
import "../chunk-L7MB2LLM.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-76Y5VOHE.js";
|
|
7
7
|
import "../chunk-2HQP2CTA.js";
|
|
8
8
|
import "../chunk-XR2YIVYZ.js";
|
|
9
9
|
import "../chunk-BDWSUKUN.js";
|
|
@@ -13,7 +13,7 @@ import "../chunk-RASGKEAL.js";
|
|
|
13
13
|
import "../chunk-IAK227OO.js";
|
|
14
14
|
import "../chunk-K2JPSXKI.js";
|
|
15
15
|
import "../chunk-KSLTD4FI.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-JP6QSEF5.js";
|
|
17
17
|
import "../chunk-TXD5HXLE.js";
|
|
18
18
|
export {
|
|
19
19
|
ComposerModeControls,
|
|
@@ -82,13 +82,13 @@ import {
|
|
|
82
82
|
turnCarriesFiles,
|
|
83
83
|
turnPromptText,
|
|
84
84
|
withProducerStream
|
|
85
|
-
} from "../chunk-
|
|
85
|
+
} from "../chunk-NWZIC2ER.js";
|
|
86
86
|
import "../chunk-SBHFMDR7.js";
|
|
87
87
|
import "../chunk-H6BRJU5M.js";
|
|
88
88
|
import "../chunk-4DBHC63F.js";
|
|
89
89
|
import "../chunk-RN4WPTBH.js";
|
|
90
90
|
import "../chunk-MM6RLOXF.js";
|
|
91
|
-
import "../chunk-
|
|
91
|
+
import "../chunk-3FKIGI3I.js";
|
|
92
92
|
import "../chunk-F4TUZYMX.js";
|
|
93
93
|
import {
|
|
94
94
|
redactErrorMessage
|
|
@@ -184,7 +184,7 @@ import {
|
|
|
184
184
|
sniffMimeFromName
|
|
185
185
|
} from "../chunk-5VE4IDSU.js";
|
|
186
186
|
import "../chunk-67CSI5PU.js";
|
|
187
|
-
import "../chunk-
|
|
187
|
+
import "../chunk-JP6QSEF5.js";
|
|
188
188
|
import {
|
|
189
189
|
readSandboxBinaryBytes,
|
|
190
190
|
statSandboxFileSize
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
DEFAULT_HARNESS,
|
|
56
56
|
assertHarnessModelCompatible,
|
|
57
57
|
isHarness
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-JP6QSEF5.js";
|
|
59
59
|
import {
|
|
60
60
|
isWorkspaceFileExportable
|
|
61
61
|
} from "./chunk-TXD5HXLE.js";
|
|
@@ -4334,4 +4334,4 @@ export {
|
|
|
4334
4334
|
deleteSecret,
|
|
4335
4335
|
mintSandboxScopedToken
|
|
4336
4336
|
};
|
|
4337
|
-
//# sourceMappingURL=chunk-
|
|
4337
|
+
//# sourceMappingURL=chunk-3FKIGI3I.js.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isModelCompatibleWithHarness,
|
|
18
18
|
snapHarnessToModel,
|
|
19
19
|
snapModelToHarness
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-JP6QSEF5.js";
|
|
21
21
|
|
|
22
22
|
// src/web-react/composer-file-accept.ts
|
|
23
23
|
function isAcceptedFileType(file, accept) {
|
|
@@ -572,4 +572,4 @@ export {
|
|
|
572
572
|
HarnessPicker,
|
|
573
573
|
AgentSessionControls
|
|
574
574
|
};
|
|
575
|
-
//# sourceMappingURL=chunk-
|
|
575
|
+
//# sourceMappingURL=chunk-76Y5VOHE.js.map
|
|
@@ -664,7 +664,7 @@ async function sessionUser(config, state) {
|
|
|
664
664
|
const r = await ctx.get(config.auth.session, { maxRedirects: 0, timeout: 2e4 });
|
|
665
665
|
if (!r.ok()) return null;
|
|
666
666
|
const body = await r.json().catch(() => null);
|
|
667
|
-
const user = body?.user;
|
|
667
|
+
const user = body?.user ?? body;
|
|
668
668
|
if (!user?.id) return null;
|
|
669
669
|
return { id: user.id, name: user.name ?? null, emailVerified: user.emailVerified === true };
|
|
670
670
|
} finally {
|
|
@@ -1234,4 +1234,4 @@ export {
|
|
|
1234
1234
|
scoreboardMetaId,
|
|
1235
1235
|
scoreboardRows
|
|
1236
1236
|
};
|
|
1237
|
-
//# sourceMappingURL=chunk-
|
|
1237
|
+
//# sourceMappingURL=chunk-A2M75YRP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/journeys/score.ts","../src/journeys/config.ts","../src/journeys/scrub.ts","../src/journeys/trace-zip.ts","../src/journeys/session.ts","../src/journeys/video.ts","../src/journeys/report.ts","../src/journeys/scoreboard.ts"],"sourcesContent":["/**\n * Whether a recorded chat turn worked, decided from what the person saw.\n *\n * The GTM journey harness scored 6 of 6 failed turns \"completed\":\n * it read failure only from `role=\"alert\"` and from the tail of the assistant's\n * markdown, and the red failure card a person saw carried neither. One caption\n * read \"Turn complete after 159.6 s\" over \"The agent stopped before finishing\".\n * This module is the replacement rule, pure so every case is a unit test:\n *\n * - failure evidence is read from the transcript region (failure-marked\n * elements, failure lines in plain text, and a Retry control that appeared),\n * not from the reply alone, and from after the turn's own prompt when the\n * page shows it (see page-reading.ts);\n * - only evidence that appeared during the turn counts, so an earlier failure in\n * the same thread cannot fail a later turn, even one the page re-renders after\n * Send, and a card that Retry replaced with a new failure still counts;\n * - a turn that ends with no new reply text is `empty`, never `completed`;\n * - a turn the person stopped is `stopped`, not a success and not a crash.\n */\n\n/** What one poll of the page returns. Collected in the page, judged here. */\nexport interface TranscriptSnapshot {\n /** Visible lines of the transcript region, trimmed, empty lines dropped. */\n readonly lines: readonly string[]\n /** Text of every failure-marked element (including hidden details). */\n readonly failureNodes: readonly string[]\n /** Retry controls inside the transcript region. */\n readonly retryButtons: number\n /**\n * The fields above hold only what follows the turn's own prompt. Everything\n * after the prompt is the turn's, so no earlier floor applies to it.\n */\n readonly anchored?: boolean\n}\n\nexport interface FailurePatterns {\n /** A line matching one of these is failure evidence. */\n readonly failure: readonly RegExp[]\n /** A line matching one of these means the person stopped the turn. */\n readonly stopped: readonly RegExp[]\n}\n\n/**\n * Failure text any agent app can show: typed failure codes, provider errors and\n * this package's own sandbox-stream copy. An app adds its own card copy through\n * `chat.failureText` in its journeys config.\n *\n * Matched as substrings of whole lines. A reply that QUOTES one of these fails\n * the turn too; that direction is deliberate, because missing a failure passes a\n * broken product while over-matching only costs a rerun.\n */\nexport const DEFAULT_FAILURE_TEXT: readonly RegExp[] = [\n /\\b[a-z]+(?:_[a-z]+)*\\.[a-z]+(?:_[a-z]+)*_(?:failed|unavailable|timeout)\\b/,\n /\\bAPIError \\d{3}\\b/,\n /stopped before a clean completion/i,\n /Failed to connect to Sandbox API/i,\n /\\bbilling\\.balance_required\\b|Add balance or upgrade your plan/i,\n /Internal Server Error/,\n /\\bECONNREFUSED\\b/,\n /Something went wrong/i,\n // agent-app's own sandbox failure copy (`formatSandboxProvisioningUserMessage`),\n // which every app on the shared runtime can render as a reply. Tests drive the\n // formatter's every branch through these, so the copy and the scorer cannot drift.\n /unable to (?:re)?connect to the sandbox/i,\n /sandbox service didn.t answer/i,\n /Sandbox recovery is required before chat can continue/i,\n /couldn.t (?:finish copying|copy) your Vault into the sandbox/i,\n /too large (?:for the sandbox to accept|to copy into the sandbox)/i,\n /attachment data is staged in the sandbox/i,\n]\n\n/** Runtime wording for a turn the person stopped. Apps add their own copy. */\nexport const DEFAULT_STOPPED_TEXT: readonly RegExp[] = [\n /interrupted by the user/i,\n /cancell?ed by (?:the )?user/i,\n /stopped by (?:the )?user/i,\n]\n\nfunction normalize(line: string): string {\n return line.replace(/\\s+/g, ' ').trim()\n}\n\n/** Every keyed item of a snapshot that can count as failure evidence. */\nfunction evidenceKeys(snapshot: TranscriptSnapshot, patterns: FailurePatterns, ignore: ReadonlySet<string>): Map<string, number> {\n const counts = new Map<string, number>()\n const add = (key: string) => counts.set(key, (counts.get(key) ?? 0) + 1)\n for (const raw of snapshot.lines) {\n const line = normalize(raw)\n if (!line || ignore.has(line)) continue\n if (patterns.stopped.some((p) => p.test(line))) add(`stopped:${line}`)\n else if (patterns.failure.some((p) => p.test(line))) add(`text:${line}`)\n }\n for (const raw of snapshot.failureNodes) {\n const text = normalize(raw)\n if (text && !ignore.has(text)) add(`node:${text.slice(0, 300)}`)\n }\n for (let i = 0; i < snapshot.retryButtons; i += 1) add('retry')\n return counts\n}\n\n/**\n * Failure evidence that appeared after the turn was sent.\n *\n * `begin` takes the snapshot from just before Send. Every later `observe`\n * lowers each item's floor to the fewest copies seen so far: when Retry removes\n * the old card and a new failure renders the same words, the count dips to zero\n * and climbs back to one, and that one is new. Anything that rose above its\n * floor at any point counts, even if the page later replaced it: on 2026-10-11\n * GTM showed \"The sandbox model stream stopped before a clean completion …\n * Hub credential source is revoked or expired\" five minutes into a turn, then\n * swapped it for a different card six minutes later.\n */\nexport class TurnEvidence {\n private floor = new Map<string, number>()\n private peak = new Map<string, number>()\n private anchored = false\n private readonly ignore: Set<string>\n\n constructor(private readonly patterns: FailurePatterns, prompt: string) {\n // The person's own prompt is on the page too; a prompt that mentions an\n // error must not fail its own turn.\n this.ignore = new Set(prompt.split('\\n').map(normalize).filter(Boolean))\n this.ignore.add(normalize(prompt))\n }\n\n begin(snapshot: TranscriptSnapshot): void {\n this.floor = evidenceKeys(snapshot, this.patterns, this.ignore)\n this.peak = new Map()\n this.anchored = snapshot.anchored === true\n }\n\n /** Read one snapshot. Returns the evidence that appeared for the first time, as display text. */\n observe(snapshot: TranscriptSnapshot): string[] {\n if (snapshot.anchored && !this.anchored) {\n // The first read that shows this turn's prompt: a floor taken from the whole transcript no longer applies.\n this.floor = new Map()\n this.anchored = true\n }\n const now = evidenceKeys(snapshot, this.patterns, this.ignore)\n for (const [key, floor] of this.floor) {\n const count = now.get(key) ?? 0\n if (count < floor) this.floor.set(key, count)\n }\n const fresh: string[] = []\n for (const [key, count] of now) {\n const extra = count - (this.floor.get(key) ?? 0)\n if (extra <= (this.peak.get(key) ?? 0)) continue\n if (!this.peak.has(key)) fresh.push(display(key))\n this.peak.set(key, extra)\n }\n return fresh\n }\n\n /** Everything that rose above its floor during the turn, in the order it appeared. */\n added(): { failures: string[]; stopped: string[]; retryAppeared: boolean } {\n const failures: string[] = []\n const stopped: string[] = []\n let retryAppeared = false\n for (const key of this.peak.keys()) {\n if (key === 'retry') retryAppeared = true\n else if (key.startsWith('stopped:')) stopped.push(key.slice('stopped:'.length))\n else failures.push(key.slice(key.indexOf(':') + 1))\n }\n return { failures, stopped, retryAppeared }\n }\n}\n\nfunction display(key: string): string {\n return key === 'retry' ? 'a Retry control appeared in the transcript' : key.slice(key.indexOf(':') + 1)\n}\n\n/**\n * Whether a turn is still going, from what the page shows. A status line is\n * progress while it changes; one left unchanged for {@link STATUS_STALE_MS}\n * with no Stop control is a notice left behind (GTM's \"Request was\n * interrupted by the user. Send a new message to continue.\" is a lasting\n * `role=\"status\"`), and treating it as progress held a stopped turn open until\n * its 15-minute timeout.\n */\nexport const STATUS_STALE_MS = 20_000\n\nexport function turnLooksActive(page: { stopVisible: boolean; statusLines: number; msSinceStatusChanged: number }): boolean {\n return page.stopVisible || (page.statusLines > 0 && page.msSinceStatusChanged < STATUS_STALE_MS)\n}\n\nexport type TurnOutcome = 'completed' | 'failed' | 'stopped' | 'empty' | 'timeout' | 'not-sent'\n\nexport interface TurnVerdict {\n outcome: TurnOutcome\n /** Plain words for a caption: the first failure line, or why the turn is not a pass. */\n error: string | null\n /** Every piece of failure evidence the turn added, for the report. */\n failures: string[]\n}\n\nexport interface TurnFacts {\n /** The send never reached the app. */\n readonly notSent?: string\n /** The app still listed the turn as running when the wait ran out. */\n readonly timedOut: boolean\n readonly evidence: ReturnType<TurnEvidence['added']>\n /** New reply characters this turn added. */\n readonly replyChars: number\n /** The journey pressed Stop during this turn. */\n readonly stopPressed: boolean\n}\n\n/** The one place a turn's outcome is decided. Order matters: evidence first. */\nexport function scoreTurn(facts: TurnFacts): TurnVerdict {\n if (facts.notSent) return { outcome: 'not-sent', error: facts.notSent, failures: [] }\n const { failures, stopped, retryAppeared } = facts.evidence\n const all = [...stopped, ...failures, ...(retryAppeared ? ['a Retry control appeared in the transcript'] : [])]\n // A Stop that took effect. One that did not (still running at the deadline)\n // falls through to `timeout`, because Stop failing is itself the defect.\n if (stopped.length || (facts.stopPressed && !facts.timedOut)) {\n return { outcome: 'stopped', error: stopped[0] ?? failures[0] ?? 'stopped by the journey', failures: all }\n }\n if (failures.length || retryAppeared) {\n return { outcome: 'failed', error: failures[0] ?? 'a Retry control appeared in the transcript', failures: all }\n }\n if (facts.timedOut) return { outcome: 'timeout', error: 'the turn was still running when the wait ended', failures: all }\n if (facts.replyChars === 0) return { outcome: 'empty', error: 'the turn ended without any reply text', failures: all }\n return { outcome: 'completed', error: null, failures: [] }\n}\n","/**\n * What an app tells the journeys kit about itself: where it is served, which\n * test identities may sign in, and the chat DOM a turn is measured on.\n *\n * It lives at the app root as `journeys.config.mjs`, beside\n * `launch-invariants.config.mjs`:\n *\n * import { defineJourneys } from '@tangle-network/agent-app/journeys'\n * export default defineJourneys({\n * app: 'gtm',\n * baseUrl: 'https://gtm.tangle.tools',\n * identities: {\n * member: { emailEnv: 'SMOKE_EMAIL', passwordEnv: 'SMOKE_PASSWORD', signIn: 'tangle' },\n * },\n * chat: { assistant: '.gtm-assistant-markdown', failureText: [/stopped before finishing/i] },\n * })\n *\n * Credentials are named, never stored: the config holds environment variable\n * names, and the values reach the process from the host's vault.\n */\nimport { existsSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { join, resolve } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { DEFAULT_FAILURE_TEXT, DEFAULT_STOPPED_TEXT } from './score.js'\n\nexport type SignInMethod = 'password' | 'tangle'\n\nexport interface JourneyIdentity {\n /** Environment variable that holds the account's email. */\n readonly emailEnv: string\n /** Environment variable that holds the account's password. */\n readonly passwordEnv: string\n /**\n * `password`: the app's own email sign-in (better-auth `sign-in/email`).\n * `tangle`: \"Log in with Tangle\": the app's SSO start, the Platform's email\n * sign-in, then the app's callback.\n */\n readonly signIn: SignInMethod\n}\n\n/** The ids a thread URL carries. */\nexport interface ThreadRoute {\n readonly threadId: string\n readonly workspaceId?: string\n}\n\n/**\n * The chat DOM a turn is read from. Defaults are agent-app's own components:\n * `ChatComposer` (the composer card, \"Message input\", \"Send\", \"Stop response\")\n * and the transcript's failure rows (`role=\"alert\"`, `data-notice-tone=\"error\"`).\n */\nexport interface ChatContract {\n /** Region whose text decides a turn's outcome. */\n readonly transcript: string\n /** Assistant reply blocks. `null` measures reply text as transcript growth beyond the prompt. */\n readonly assistant: string | null\n /** Progress lines inside the transcript (\"Sending…\", \"Searching the web\"). */\n readonly status: string\n /** Elements that mark a failed turn. */\n readonly failureNodes: string\n /** Failure lines this app shows in plain text, added to the package defaults. */\n readonly failureText: readonly RegExp[]\n /** Lines meaning the person stopped the turn, added to the package defaults. */\n readonly stoppedText: readonly RegExp[]\n /** The card holding the composer's input and action row. */\n readonly composer: string\n /** Accessible names inside the composer card. */\n readonly inputName: string\n readonly sendName: string\n readonly stopName: string\n /** Accessible name of a failed turn's retry control. */\n readonly retryName: RegExp\n /** A created thread's path. Named groups `threadId` (required) and `workspaceId`. */\n readonly threadPath: RegExp | null\n /** Path that lists a thread's running turns as JSON `{ running: string[] }`; the server's word on completion. */\n readonly runningTurns: ((route: ThreadRoute) => string) | null\n /** POST paths that mean the composer submitted, besides the page's own route. */\n readonly sendPaths: readonly RegExp[]\n}\n\nexport interface AuthPaths {\n readonly session: string\n readonly passwordSignIn: string\n readonly tangleStart: string\n}\n\nexport interface JourneysConfig {\n /** Short name, used for state and output folders. */\n readonly app: string\n /** Origin the journeys drive. `JOURNEYS_BASE_URL` overrides it, for a local stack. */\n readonly baseUrl: string\n readonly identities: Readonly<Record<string, JourneyIdentity>>\n readonly chat?: Partial<ChatContract>\n readonly auth?: Partial<AuthPaths>\n /** Chat turns one journey may send. Default 6. */\n readonly maxTurns?: number\n /** Sessions and raw recordings. Default `~/.local/state/agent-app-journeys/<app>`. */\n readonly stateDir?: string\n /** Files safe to copy off the host. Default `<stateDir>/out`. */\n readonly outDir?: string\n}\n\nexport interface ResolvedJourneysConfig {\n /** Marks a config whose defaults are filled; resolving it again returns it unchanged. */\n readonly resolved: true\n readonly app: string\n readonly baseUrl: string\n readonly identities: Readonly<Record<string, JourneyIdentity>>\n readonly chat: ChatContract\n readonly auth: AuthPaths\n readonly maxTurns: number\n readonly stateDir: string\n readonly outDir: string\n}\n\nexport const DEFAULT_CHAT_CONTRACT: ChatContract = {\n transcript: 'main',\n assistant: null,\n status: '[role=\"status\"]',\n failureNodes: '[role=\"alert\"], [data-notice-tone=\"error\"]',\n failureText: [],\n stoppedText: [],\n composer: '[data-testid=\"composer-card\"]',\n inputName: 'Message input',\n sendName: 'Send',\n stopName: 'Stop response',\n retryName: /^Retry$/,\n threadPath: null,\n runningTurns: null,\n sendPaths: [/^\\/api\\/(?:[^/]+\\/)*chat$/],\n}\n\nexport const DEFAULT_AUTH_PATHS: AuthPaths = {\n session: '/api/auth/get-session',\n passwordSignIn: '/api/auth/sign-in/email',\n tangleStart: '/auth/tangle/start',\n}\n\nexport const CONFIG_FILE_NAMES = ['journeys.config.mjs', 'journeys.config.js'] as const\n\n/** Identity for a typed config; also validates it. */\nexport function defineJourneys(config: JourneysConfig): JourneysConfig {\n resolveJourneysConfig(config)\n return config\n}\n\nconst ENV_NAME = /^[A-Z_][A-Z0-9_]*$/\n\n/** Fill defaults and refuse a config that cannot drive a journey. */\nexport function resolveJourneysConfig(config: JourneysConfig | ResolvedJourneysConfig, env: Record<string, string | undefined> = process.env): ResolvedJourneysConfig {\n if ('resolved' in config && config.resolved === true) return config\n const problems: string[] = []\n if (!/^[a-z0-9][a-z0-9-]{0,40}$/.test(config.app ?? '')) problems.push('app must be a short lowercase name such as \"gtm\"')\n const base = (env.JOURNEYS_BASE_URL ?? config.baseUrl ?? '').replace(/\\/$/, '')\n if (!/^https?:\\/\\/[^/]+$/.test(base)) problems.push(`baseUrl must be an origin such as https://app.example.com, got \"${base}\"`)\n const identities = config.identities ?? {}\n if (Object.keys(identities).length === 0) problems.push('identities must name at least one test identity')\n for (const [name, identity] of Object.entries(identities)) {\n if (name === 'anon') problems.push('\"anon\" is reserved for a signed-out context')\n if (!/^[a-z][a-z0-9-]*$/.test(name)) problems.push(`identity \"${name}\": use a lowercase name`)\n for (const key of ['emailEnv', 'passwordEnv'] as const) {\n if (!ENV_NAME.test(identity[key] ?? '')) problems.push(`identity \"${name}\": ${key} must be an environment variable NAME, not a value`)\n }\n if (identity.signIn !== 'password' && identity.signIn !== 'tangle') problems.push(`identity \"${name}\": signIn must be \"password\" or \"tangle\"`)\n }\n const chat: ChatContract = {\n ...DEFAULT_CHAT_CONTRACT,\n ...config.chat,\n failureText: [...DEFAULT_FAILURE_TEXT, ...(config.chat?.failureText ?? [])],\n stoppedText: [...DEFAULT_STOPPED_TEXT, ...(config.chat?.stoppedText ?? [])],\n }\n if (chat.threadPath && !/\\(\\?<threadId>/.test(chat.threadPath.source)) problems.push('chat.threadPath needs a named group (?<threadId>…)')\n const maxTurns = config.maxTurns ?? 6\n if (!Number.isInteger(maxTurns) || maxTurns < 0) problems.push('maxTurns must be a whole number')\n if (problems.length) throw new Error(`journeys config: ${problems.join('; ')}`)\n const stateDir = resolve(env.JOURNEYS_STATE_DIR ?? config.stateDir ?? join(homedir(), '.local/state/agent-app-journeys', config.app))\n return {\n resolved: true,\n app: config.app,\n baseUrl: base,\n identities,\n chat,\n auth: { ...DEFAULT_AUTH_PATHS, ...config.auth },\n maxTurns,\n stateDir,\n outDir: resolve(env.JOURNEYS_OUT ?? config.outDir ?? join(stateDir, 'out')),\n }\n}\n\n/** The ids in a thread URL, or null when the URL is not a thread on this origin. */\nexport function threadRouteIn(url: string, config: Pick<ResolvedJourneysConfig, 'baseUrl' | 'chat'>): ThreadRoute | null {\n if (!config.chat.threadPath) return null\n let parsed: URL\n try {\n parsed = new URL(url)\n } catch {\n return null\n }\n if (parsed.origin !== new URL(config.baseUrl).origin) return null\n const match = config.chat.threadPath.exec(parsed.pathname)\n const threadId = match?.groups?.threadId\n if (!threadId) return null\n const workspaceId = match?.groups?.workspaceId\n return workspaceId ? { threadId, workspaceId } : { threadId }\n}\n\n/** Environment variable names the config needs, for a vault loader. */\nexport function credentialNames(config: Pick<JourneysConfig, 'identities'>): string[] {\n return [...new Set(Object.values(config.identities).flatMap((identity) => [identity.emailEnv, identity.passwordEnv]))]\n}\n\n/** `JOURNEYS_CONFIG`, else the first config file in `dir`. */\nexport async function loadJourneysConfig(dir = process.cwd(), env: Record<string, string | undefined> = process.env): Promise<ResolvedJourneysConfig> {\n const file = env.JOURNEYS_CONFIG\n ? resolve(dir, env.JOURNEYS_CONFIG)\n : CONFIG_FILE_NAMES.map((name) => join(dir, name)).find((path) => existsSync(path))\n if (!file || !existsSync(file)) {\n throw new Error(`no ${CONFIG_FILE_NAMES[0]} in ${dir}; add one at the app root or set JOURNEYS_CONFIG`)\n }\n const loaded = (await import(pathToFileURL(file).href)) as { default?: JourneysConfig }\n if (!loaded.default) throw new Error(`${file} must export default defineJourneys({ … })`)\n return resolveJourneysConfig(loaded.default, env)\n}\n","/**\n * Making a journey's files safe to copy off the host.\n *\n * `scrubTrace` rewrites a Playwright trace.zip: it blanks cookie and\n * authorization headers and HAR cookie lists, blanks token-like query values,\n * drops the bodies of auth, token, session and collaboration calls, and then\n * replaces every needle (passwords, cookie values, the identities' emails)\n * anywhere in any entry. `assertNoSecrets` re-reads every output file, inside\n * the zips too, and refuses the whole folder if a password or cookie value\n * survived anywhere.\n */\nimport { readdirSync, readFileSync, statSync, openSync, closeSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { createZipWriter, inflateEntry, readCentralDirectory, readRaw } from './trace-zip.js'\n\nconst SENSITIVE_HEADERS = new Set([\n 'cookie', 'set-cookie', 'authorization', 'proxy-authorization', 'x-api-key',\n 'x-auth-token', 'x-stream-token', 'cf-access-token', 'x-csrf-token',\n])\nconst SENSITIVE_PATH = /\\/api\\/auth\\/|\\/auth\\/tangle\\/|token|session|\\/api\\/collaboration\\/|oauth|\\/consent|\\/api-access|api-key/i\nconst QUERY_NAMES = 'token|access_token|refresh_token|id_token|code|state|key|api_key|apikey|signature|sig|jwt|ticket|secret'\nconst QUERY = new RegExp(`([?&](?:${QUERY_NAMES})=)[^&\"'\\\\s\\\\\\\\]+`, 'gi')\nconst QUERY_NAME = new RegExp(`^(?:${QUERY_NAMES})$`, 'i')\nconst REDACTED = 'REDACTED'\n\ntype Json = null | boolean | number | string | Json[] | { [key: string]: Json }\ntype JsonObject = { [key: string]: Json }\n\nconst isObject = (v: Json | undefined): v is JsonObject => typeof v === 'object' && v !== null && !Array.isArray(v)\n\nfunction scrubHeaders(headers: Json | undefined): void {\n if (Array.isArray(headers)) {\n for (const h of headers) {\n if (isObject(h) && SENSITIVE_HEADERS.has(String(h.name ?? '').toLowerCase())) h.value = REDACTED\n }\n } else if (isObject(headers)) {\n for (const key of Object.keys(headers)) if (SENSITIVE_HEADERS.has(key.toLowerCase())) headers[key] = REDACTED\n }\n}\n\n/** Drop an inline or stored body; Playwright points at stored ones with `_file` or `_sha1`. */\nfunction forgetBody(holder: JsonObject, drop: Set<string>): void {\n for (const key of ['_file', '_sha1']) {\n const ref = holder[key]\n if (ref) {\n drop.add(String(ref).split('/').pop() ?? '')\n holder[key] = null\n }\n }\n if ('text' in holder) holder.text = REDACTED\n}\n\n/** Scrub any HAR-like request/response anywhere in one trace event. */\nfunction walk(node: Json | undefined, drop: Set<string>): void {\n if (Array.isArray(node)) {\n for (const v of node) walk(v, drop)\n return\n }\n if (!isObject(node)) return\n const req = node.request\n const res = node.response\n if (isObject(req) && 'url' in req) {\n const sensitive = SENSITIVE_PATH.test(String(req.url ?? '').split('?')[0] ?? '')\n scrubHeaders(req.headers)\n if ('cookies' in req) req.cookies = []\n const query = req.queryString\n if (Array.isArray(query)) {\n for (const q of query) if (isObject(q) && QUERY_NAME.test(String(q.name ?? ''))) q.value = REDACTED\n }\n if (sensitive && isObject(req.postData)) forgetBody(req.postData, drop)\n if (isObject(res)) {\n scrubHeaders(res.headers)\n if ('cookies' in res) res.cookies = []\n if (sensitive && isObject(res.content)) forgetBody(res.content, drop)\n }\n }\n for (const [key, value] of Object.entries(node)) {\n if (key.toLowerCase() === 'cookies' && Array.isArray(value)) node[key] = []\n else if (key === 'storageState') node[key] = null\n else if (SENSITIVE_HEADERS.has(key.toLowerCase()) && typeof value === 'string') node[key] = REDACTED\n else walk(value, drop)\n }\n}\n\n/** One `.trace` or `.network` JSONL entry, scrubbed. Bodies it dropped are added to `drop`. */\nexport function scrubJsonl(text: string, drop: Set<string>): string {\n const out: string[] = []\n for (const line of text.split('\\n')) {\n if (!line.trim()) continue\n let event: Json\n try {\n event = JSON.parse(line) as Json\n } catch {\n out.push(line.replace(QUERY, `$1${REDACTED}`))\n continue\n }\n walk(event, drop)\n out.push(JSON.stringify(event).replace(QUERY, `$1${REDACTED}`))\n }\n return out.join('\\n') + '\\n'\n}\n\n/** Every occurrence of every needle replaced. */\nexport function replaceNeedles(data: Buffer, needles: readonly string[]): Buffer {\n let out = data\n for (const needle of needles) {\n if (!needle) continue\n const n = Buffer.from(needle, 'utf8')\n if (out.indexOf(n) < 0) continue\n const parts: Buffer[] = []\n let from = 0\n for (let at = out.indexOf(n); at >= 0; at = out.indexOf(n, from)) {\n parts.push(out.subarray(from, at), Buffer.from(REDACTED))\n from = at + n.length\n }\n parts.push(out.subarray(from))\n out = Buffer.concat(parts)\n }\n return out\n}\n\nconst isEvents = (name: string) => name.endsWith('.trace') || name.endsWith('.network')\n\n/** Write a scrubbed copy of `src` to `dst`. Entries keep their order; dropped bodies are left out. */\nexport function scrubTrace(src: string, dst: string, needles: readonly string[]): { entries: number; dropped: number; rewritten: number } {\n const fd = openSync(src, 'r')\n try {\n const entries = readCentralDirectory(fd)\n const drop = new Set<string>()\n // Events first, so the bodies they point at are known before resources are copied.\n const events = new Map<string, Buffer>()\n for (const entry of entries) {\n if (!isEvents(entry.name)) continue\n events.set(entry.name, Buffer.from(scrubJsonl(inflateEntry(entry, readRaw(fd, entry)).toString('utf8'), drop), 'utf8'))\n }\n const writer = createZipWriter(dst)\n let dropped = 0\n let rewritten = 0\n for (const entry of entries) {\n const base = entry.name.split('/').pop() ?? ''\n if (entry.name.startsWith('resources/') && drop.has(base)) {\n dropped += 1\n continue\n }\n const raw = readRaw(fd, entry)\n const content = events.get(entry.name) ?? inflateEntry(entry, raw)\n const clean = replaceNeedles(content, needles)\n if (!events.has(entry.name) && clean === content) {\n writer.copy(entry, raw)\n } else {\n writer.add(entry.name, clean, entry)\n rewritten += 1\n }\n }\n writer.close()\n return { entries: entries.length, dropped, rewritten }\n } finally {\n closeSync(fd)\n }\n}\n\n/** Entries of a zip that still hold a hard needle, and how many mention a soft one. */\nfunction scanZip(path: string, hard: readonly string[], soft: readonly string[]): { hard: string[]; soft: number } {\n const fd = openSync(path, 'r')\n try {\n const hits: string[] = []\n let softHits = 0\n const hardBytes = hard.filter(Boolean).map((n) => Buffer.from(n, 'utf8'))\n const softBytes = soft.filter(Boolean).map((n) => Buffer.from(n, 'utf8'))\n for (const entry of readCentralDirectory(fd)) {\n const content = inflateEntry(entry, readRaw(fd, entry))\n if (hardBytes.some((n) => content.includes(n))) hits.push(entry.name)\n if (softBytes.some((n) => content.includes(n))) softHits += 1\n }\n return { hard: hits, soft: softHits }\n } finally {\n closeSync(fd)\n }\n}\n\n/**\n * Refuse to hand over a folder whose files hold a password or cookie value.\n * An identity's email only warns: it is a company test address, not a secret,\n * but it should be blurred before footage is shown outside the company.\n */\nexport function assertNoSecrets(dir: string, needles: { hard: readonly string[]; soft: readonly string[] }): { softHits: string[] } {\n const hits: string[] = []\n const softHits: string[] = []\n const hard = needles.hard.filter(Boolean).map((n) => Buffer.from(n, 'utf8'))\n const soft = needles.soft.filter(Boolean).map((n) => Buffer.from(n, 'utf8'))\n const visit = (d: string) => {\n for (const name of readdirSync(d)) {\n const path = join(d, name)\n if (statSync(path).isDirectory()) {\n visit(path)\n continue\n }\n if (path.endsWith('.zip')) {\n const found = scanZip(path, needles.hard, needles.soft)\n if (found.hard.length) hits.push(`${path} (${found.hard.slice(0, 5).join(', ')})`)\n if (found.soft) softHits.push(`${path} (${found.soft} entries)`)\n continue\n }\n const buf = readFileSync(path)\n if (hard.some((n) => buf.includes(n))) hits.push(path)\n if (soft.some((n) => buf.includes(n))) softHits.push(path)\n }\n }\n visit(dir)\n if (softHits.length) console.warn(`note: a test identity's email appears in ${softHits.join(', ')}; blur it before sharing outside the company`)\n if (hits.length) throw new Error(`REFUSING: secret material found in ${hits.join(', ')}; do not copy ${dir}`)\n return { softHits }\n}\n","/**\n * The slice of PKZIP a Playwright trace needs: read every entry of an archive\n * on disk one at a time, and write a new archive entry by entry.\n *\n * Why not `documents/zip`: that reader holds the archive in memory and refuses\n * zip64, and a recorded hour-long journey's trace is 6.6 GB with 49,117\n * entries, so offsets pass 4 GiB. This reader keeps\n * one entry in memory at a time and reads the zip64 records; the writer emits\n * zip64 fields only when a size, an offset or the entry count needs them.\n */\nimport { closeSync, fstatSync, openSync, readSync, writeSync } from 'node:fs'\nimport { deflateRawSync, inflateRawSync } from 'node:zlib'\nimport { crc32Update } from '../workspace-export/checksum.js'\n\nconst EOCD = 0x06054b50\nconst ZIP64_EOCD = 0x06064b50\nconst ZIP64_LOCATOR = 0x07064b50\nconst CENTRAL = 0x02014b50\nconst LOCAL = 0x04034b50\nconst U16 = 0xffff\nconst U32 = 0xffffffff\n\ninterface ZipEntryInfo {\n readonly name: string\n readonly method: number\n readonly crc32: number\n readonly compressedSize: number\n readonly uncompressedSize: number\n readonly localOffset: number\n readonly dosTime: number\n readonly dosDate: number\n}\n\nfunction readAt(fd: number, position: number, length: number): Buffer {\n const out = Buffer.alloc(length)\n let done = 0\n while (done < length) {\n const n = readSync(fd, out, done, length - done, position + done)\n if (n === 0) throw new Error(`zip: unexpected end of file at ${position + done}`)\n done += n\n }\n return out\n}\n\nconst u64 = (b: Buffer, at: number) => Number(b.readBigUInt64LE(at))\n\n/** Every entry in the central directory, sizes and offsets resolved through zip64 extras. */\nexport function readCentralDirectory(fd: number): ZipEntryInfo[] {\n const size = fstatSync(fd).size\n const tailLength = Math.min(size, 22 + U16 + 20)\n const tail = readAt(fd, size - tailLength, tailLength)\n let eocd = -1\n for (let i = tail.length - 22; i >= 0; i -= 1) {\n if (tail.readUInt32LE(i) === EOCD && i + 22 + tail.readUInt16LE(i + 20) === tail.length) {\n eocd = i\n break\n }\n }\n if (eocd < 0) throw new Error('zip: no end-of-central-directory record')\n let count = tail.readUInt16LE(eocd + 10)\n let cdSize = tail.readUInt32LE(eocd + 12)\n let cdOffset = tail.readUInt32LE(eocd + 16)\n if (eocd >= 20 && tail.readUInt32LE(eocd - 20) === ZIP64_LOCATOR) {\n const record = readAt(fd, u64(tail, eocd - 20 + 8), 56)\n if (record.readUInt32LE(0) !== ZIP64_EOCD) throw new Error('zip: zip64 locator points at no zip64 record')\n count = u64(record, 32)\n cdSize = u64(record, 40)\n cdOffset = u64(record, 48)\n }\n const cd = readAt(fd, cdOffset, cdSize)\n const entries: ZipEntryInfo[] = []\n let at = 0\n for (let i = 0; i < count; i += 1) {\n if (cd.readUInt32LE(at) !== CENTRAL) throw new Error(`zip: central directory is broken at entry ${i + 1} of ${count}`)\n const nameLength = cd.readUInt16LE(at + 28)\n const extraLength = cd.readUInt16LE(at + 30)\n const commentLength = cd.readUInt16LE(at + 32)\n let compressedSize = cd.readUInt32LE(at + 20)\n let uncompressedSize = cd.readUInt32LE(at + 24)\n let localOffset = cd.readUInt32LE(at + 42)\n const extra = cd.subarray(at + 46 + nameLength, at + 46 + nameLength + extraLength)\n for (let e = 0; e + 4 <= extra.length; ) {\n const id = extra.readUInt16LE(e)\n const len = extra.readUInt16LE(e + 2)\n if (id === 0x0001) {\n // Present in this order, and only for the fields set to 0xffffffff.\n let p = e + 4\n if (uncompressedSize === U32) { uncompressedSize = u64(extra, p); p += 8 }\n if (compressedSize === U32) { compressedSize = u64(extra, p); p += 8 }\n if (localOffset === U32) { localOffset = u64(extra, p); p += 8 }\n }\n e += 4 + len\n }\n entries.push({\n name: cd.toString('utf8', at + 46, at + 46 + nameLength),\n method: cd.readUInt16LE(at + 10),\n crc32: cd.readUInt32LE(at + 16),\n compressedSize,\n uncompressedSize,\n localOffset,\n dosTime: cd.readUInt16LE(at + 12),\n dosDate: cd.readUInt16LE(at + 14),\n })\n at += 46 + nameLength + extraLength + commentLength\n }\n return entries\n}\n\n/** One entry's stored bytes, still compressed. */\nexport function readRaw(fd: number, entry: ZipEntryInfo): Buffer {\n const local = readAt(fd, entry.localOffset, 30)\n if (local.readUInt32LE(0) !== LOCAL) throw new Error(`zip: '${entry.name}' has no local header`)\n const start = entry.localOffset + 30 + local.readUInt16LE(26) + local.readUInt16LE(28)\n return readAt(fd, start, entry.compressedSize)\n}\n\n/** One entry's content. */\nexport function inflateEntry(entry: ZipEntryInfo, raw: Buffer): Buffer {\n if (entry.method === 0) return raw\n if (entry.method === 8) return inflateRawSync(raw)\n throw new Error(`zip: '${entry.name}' uses unsupported compression method ${entry.method}`)\n}\n\ninterface ZipWriter {\n /** Add an entry from its content (deflated here). */\n add(name: string, content: Buffer, from?: Pick<ZipEntryInfo, 'dosTime' | 'dosDate'>): void\n /** Add an entry exactly as another archive stored it. */\n copy(entry: ZipEntryInfo, raw: Buffer): void\n close(): void\n}\n\ninterface Written {\n name: Buffer\n method: number\n crc32: number\n compressedSize: number\n uncompressedSize: number\n offset: number\n dosTime: number\n dosDate: number\n}\n\n/** Write a zip to `path`, entries in the order added. `forceZip64` exercises the large-archive records in tests. */\nexport function createZipWriter(path: string, opts: { forceZip64?: boolean } = {}): ZipWriter {\n const fd = openSync(path, 'w', 0o600)\n let position = 0\n const written: Written[] = []\n const put = (b: Buffer) => {\n let done = 0\n while (done < b.length) done += writeSync(fd, b, done, b.length - done)\n position += b.length\n }\n const big = (n: number) => opts.forceZip64 === true || n >= U32\n const writeEntry = (w: Omit<Written, 'offset'>, data: Buffer) => {\n const zip64 = big(w.compressedSize) || big(w.uncompressedSize)\n const header = Buffer.alloc(30 + w.name.length + (zip64 ? 20 : 0))\n header.writeUInt32LE(LOCAL, 0)\n header.writeUInt16LE(zip64 ? 45 : 20, 4)\n header.writeUInt16LE(0x0800, 6)\n header.writeUInt16LE(w.method, 8)\n header.writeUInt16LE(w.dosTime, 10)\n header.writeUInt16LE(w.dosDate, 12)\n header.writeUInt32LE(w.crc32, 14)\n header.writeUInt32LE(zip64 ? U32 : w.compressedSize, 18)\n header.writeUInt32LE(zip64 ? U32 : w.uncompressedSize, 22)\n header.writeUInt16LE(w.name.length, 26)\n header.writeUInt16LE(zip64 ? 20 : 0, 28)\n w.name.copy(header, 30)\n if (zip64) {\n const e = 30 + w.name.length\n header.writeUInt16LE(0x0001, e)\n header.writeUInt16LE(16, e + 2)\n header.writeBigUInt64LE(BigInt(w.uncompressedSize), e + 4)\n header.writeBigUInt64LE(BigInt(w.compressedSize), e + 12)\n }\n const offset = position\n put(header)\n put(data)\n written.push({ ...w, offset })\n }\n return {\n add(name, content, from) {\n const data = deflateRawSync(content)\n writeEntry({\n name: Buffer.from(name, 'utf8'),\n method: 8,\n crc32: crc32Update(0, content),\n compressedSize: data.length,\n uncompressedSize: content.length,\n dosTime: from?.dosTime ?? 0,\n dosDate: from?.dosDate ?? 0x21,\n }, data)\n },\n copy(entry, raw) {\n writeEntry({\n name: Buffer.from(entry.name, 'utf8'),\n method: entry.method,\n crc32: entry.crc32,\n compressedSize: entry.compressedSize,\n uncompressedSize: entry.uncompressedSize,\n dosTime: entry.dosTime,\n dosDate: entry.dosDate,\n }, raw)\n },\n close() {\n const cdOffset = position\n for (const w of written) {\n const fields: bigint[] = []\n if (big(w.uncompressedSize)) fields.push(BigInt(w.uncompressedSize))\n if (big(w.compressedSize)) fields.push(BigInt(w.compressedSize))\n if (big(w.offset)) fields.push(BigInt(w.offset))\n const extraLength = fields.length ? 4 + 8 * fields.length : 0\n const h = Buffer.alloc(46 + w.name.length + extraLength)\n h.writeUInt32LE(CENTRAL, 0)\n h.writeUInt16LE(45, 4)\n h.writeUInt16LE(fields.length ? 45 : 20, 6)\n h.writeUInt16LE(0x0800, 8)\n h.writeUInt16LE(w.method, 10)\n h.writeUInt16LE(w.dosTime, 12)\n h.writeUInt16LE(w.dosDate, 14)\n h.writeUInt32LE(w.crc32, 16)\n h.writeUInt32LE(big(w.compressedSize) ? U32 : w.compressedSize, 20)\n h.writeUInt32LE(big(w.uncompressedSize) ? U32 : w.uncompressedSize, 24)\n h.writeUInt16LE(w.name.length, 28)\n h.writeUInt16LE(extraLength, 30)\n h.writeUInt32LE(big(w.offset) ? U32 : w.offset, 42)\n w.name.copy(h, 46)\n if (fields.length) {\n const e = 46 + w.name.length\n h.writeUInt16LE(0x0001, e)\n h.writeUInt16LE(8 * fields.length, e + 2)\n fields.forEach((v, i) => h.writeBigUInt64LE(v, e + 4 + 8 * i))\n }\n put(h)\n }\n const cdSize = position - cdOffset\n const count = written.length\n const zip64 = opts.forceZip64 === true || count >= U16 || cdOffset >= U32 || cdSize >= U32\n if (zip64) {\n const recordOffset = position\n const r = Buffer.alloc(56)\n r.writeUInt32LE(ZIP64_EOCD, 0)\n r.writeBigUInt64LE(44n, 4)\n r.writeUInt16LE(45, 12)\n r.writeUInt16LE(45, 14)\n r.writeBigUInt64LE(BigInt(count), 24)\n r.writeBigUInt64LE(BigInt(count), 32)\n r.writeBigUInt64LE(BigInt(cdSize), 40)\n r.writeBigUInt64LE(BigInt(cdOffset), 48)\n put(r)\n const l = Buffer.alloc(20)\n l.writeUInt32LE(ZIP64_LOCATOR, 0)\n l.writeBigUInt64LE(BigInt(recordOffset), 8)\n l.writeUInt32LE(1, 16)\n put(l)\n }\n const end = Buffer.alloc(22)\n end.writeUInt32LE(EOCD, 0)\n end.writeUInt16LE(zip64 ? U16 : count, 8)\n end.writeUInt16LE(zip64 ? U16 : count, 10)\n end.writeUInt32LE(zip64 ? U32 : cdSize, 12)\n end.writeUInt32LE(zip64 ? U32 : cdOffset, 16)\n put(end)\n closeSync(fd)\n },\n }\n}\n","/**\n * Signed-in browser state for test identities. Sign-in is HTTP only, so a\n * recording starts already signed in. Storage state is cached per origin and\n * identity (mode 0600) and reused while the session endpoint returns a user.\n * Parallel journeys share it. A sign-out journey passes `{ fresh: true }`.\n */\nimport { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync } from 'node:fs'\nimport { join } from 'node:path'\nimport type { APIRequestContext } from 'playwright'\nimport type { JourneyIdentity, ResolvedJourneysConfig } from './config.js'\n\nexport interface SessionUser {\n id: string\n name: string | null\n emailVerified: boolean\n}\n\nclass SignInError extends Error {\n constructor(readonly status: number, message: string) {\n super(message)\n }\n}\n\nconst sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms))\n\nasync function playwrightRequest() {\n try {\n return (await import('playwright')).request\n } catch {\n throw new Error('journeys need the optional `playwright` peer: install playwright in the app that runs them')\n }\n}\n\nfunction sessionDir(config: ResolvedJourneysConfig): string {\n return join(config.stateDir, 'sessions', new URL(config.baseUrl).host)\n}\n\nfunction storageStatePath(config: ResolvedJourneysConfig, identity: string): string {\n return join(sessionDir(config), `${identity}.storage.json`)\n}\n\nfunction need(name: string): string {\n const value = process.env[name]?.trim()\n if (!value) throw new Error(`${name} is unset: load it from the host's vault into this process (the value is never printed)`)\n return value\n}\n\n/** The signed-in user behind a storage state, or null when it no longer signs in. */\nexport async function sessionUser(config: ResolvedJourneysConfig, state: string): Promise<SessionUser | null> {\n if (!existsSync(state)) return null\n const request = await playwrightRequest()\n const ctx = await request.newContext({ baseURL: config.baseUrl, storageState: state })\n try {\n const r = await ctx.get(config.auth.session, { maxRedirects: 0, timeout: 20_000 })\n if (!r.ok()) return null\n type User = { id?: string; name?: string; emailVerified?: boolean }\n const body = (await r.json().catch(() => null)) as (User & { user?: User }) | null\n // better-auth answers `{ user }`; an app's own endpoint may answer with the user itself.\n const user = body?.user ?? body\n if (!user?.id) return null\n return { id: user.id, name: user.name ?? null, emailVerified: user.emailVerified === true }\n } finally {\n await ctx.dispose()\n }\n}\n\nasync function signInWithPassword(ctx: APIRequestContext, config: ResolvedJourneysConfig, email: string, password: string): Promise<void> {\n const r = await ctx.post(`${config.baseUrl}${config.auth.passwordSignIn}`, {\n headers: { 'content-type': 'application/json', origin: config.baseUrl },\n data: { email, password },\n maxRedirects: 0,\n })\n if (r.status() !== 200) throw new SignInError(r.status(), `email sign-in returned ${r.status()}`)\n}\n\n/** \"Log in with Tangle\": the app's start route, Platform sign-in, authorize, then GET the app callback. */\nasync function signInWithTangle(ctx: APIRequestContext, config: ResolvedJourneysConfig, email: string, password: string): Promise<void> {\n const base = config.baseUrl\n const start = await ctx.get(`${base}${config.auth.tangleStart}`, { maxRedirects: 0 })\n const first = start.headers()['location']\n if (!first) throw new SignInError(start.status(), `SSO start returned ${start.status()} without a redirect`)\n const authorize = new URL(first, base).toString()\n const platform = new URL(authorize).origin\n const signIn = await ctx.post(`${platform}/api/auth/sign-in/email`, {\n headers: { 'content-type': 'application/json', origin: platform },\n data: { email, password },\n maxRedirects: 0,\n })\n if (signIn.status() !== 200) throw new SignInError(signIn.status(), `Platform sign-in returned ${signIn.status()}`)\n // A Location on the app is not success; GET it. /auth/callback stores the source key.\n const startPrefix = config.auth.tangleStart.replace(/\\/start$/, '/')\n const appOrigin = new URL(base).origin\n let next = authorize\n for (let hop = 0; hop < 8; hop += 1) {\n const response = await ctx.get(next, { maxRedirects: 0 })\n const location = response.headers()['location']\n if (!location) {\n const path = new URL(next).pathname\n if (new URL(next).origin === appOrigin && !path.startsWith(startPrefix) && response.status() < 400) return\n throw new SignInError(response.status(), `SSO stopped at ${path} with ${response.status()}`)\n }\n const url = new URL(location, next)\n if (url.origin === appOrigin && url.pathname.startsWith('/login')) {\n throw new SignInError(401, 'the app callback refused the sign-in')\n }\n next = url.toString()\n }\n throw new SignInError(0, 'SSO did not return to the app within 8 redirects')\n}\n\n/** A cross-process lock: mkdir is atomic. A lock older than two minutes is stale. */\nasync function withLock<T>(dir: string, work: () => Promise<T>): Promise<T> {\n const deadline = Date.now() + 180_000\n for (;;) {\n try {\n mkdirSync(dir)\n break\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error\n const age = Date.now() - (statSync(dir, { throwIfNoEntry: false })?.mtimeMs ?? Date.now())\n if (age > 120_000) rmSync(dir, { recursive: true, force: true })\n if (Date.now() > deadline) throw new Error(`timed out waiting for ${dir}`)\n await sleep(500)\n }\n }\n try {\n return await work()\n } finally {\n rmSync(dir, { recursive: true, force: true })\n }\n}\n\nfunction identityOf(config: ResolvedJourneysConfig, name: string): JourneyIdentity {\n const identity = config.identities[name]\n if (!identity) throw new Error(`\"${name}\" is not an identity in the ${config.app} journeys config (${Object.keys(config.identities).join(', ')})`)\n return identity\n}\n\n/**\n * Path to a storage state signed in as `identity`. Reused while valid;\n * `fresh` signs in a session of its own (for a journey that signs out).\n */\nexport async function storageStateFor(\n config: ResolvedJourneysConfig,\n name: string,\n opts: { fresh?: boolean } = {},\n): Promise<{ path: string; user: SessionUser }> {\n const identity = identityOf(config, name)\n const dir = sessionDir(config)\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const file = opts.fresh ? join(dir, `${name}.${process.pid}.${Date.now()}.storage.json`) : storageStatePath(config, name)\n const request = await playwrightRequest()\n return withLock(join(dir, `signin-${name}.lock`), async () => {\n if (!opts.fresh) {\n const cached = await sessionUser(config, file)\n if (cached) return { path: file, user: cached }\n }\n const email = need(identity.emailEnv)\n const password = need(identity.passwordEnv)\n for (let attempt = 1; ; attempt += 1) {\n const ctx = await request.newContext({ baseURL: config.baseUrl })\n try {\n if (identity.signIn === 'password') await signInWithPassword(ctx, config, email, password)\n else await signInWithTangle(ctx, config, email, password)\n const tmp = `${file}.tmp`\n await ctx.storageState({ path: tmp })\n chmodSync(tmp, 0o600)\n renameSync(tmp, file)\n break\n } catch (error) {\n const status = error instanceof SignInError ? error.status : 0\n if (status !== 429 || attempt >= 4) throw error\n await sleep(15_000 * attempt)\n } finally {\n await ctx.dispose()\n }\n }\n const user = await sessionUser(config, file)\n if (!user) throw new Error(`${name} signed in but ${config.auth.session} has no user`)\n // A read-only journey can still run; one that chats will be refused, so say so before it tries.\n if (!user.emailVerified) console.warn(`${name} signed in but is not email-verified; an app that requires verification will refuse its chat`)\n return { path: file, user }\n })\n}\n\n/**\n * Every value that must never leave the host. `hard`: passwords and each cookie\n * value (whole, URL-decoded, and its token half). `soft`: the identities'\n * emails, which are warned about but not refused.\n */\nexport function secretNeedles(config: ResolvedJourneysConfig): { hard: string[]; soft: string[] } {\n const hard = new Set<string>()\n const soft = new Set<string>()\n for (const identity of Object.values(config.identities)) {\n const password = process.env[identity.passwordEnv]?.trim()\n if (password) hard.add(password)\n const email = process.env[identity.emailEnv]?.trim()\n if (email) soft.add(email)\n }\n const root = join(config.stateDir, 'sessions')\n const stack = existsSync(root) ? [root] : []\n while (stack.length) {\n const dir = stack.pop()!\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n const path = join(dir, entry.name)\n if (entry.isDirectory()) stack.push(path)\n else if (entry.name.endsWith('.storage.json')) addCookieNeedles(path, hard)\n }\n }\n return { hard: [...hard], soft: [...soft] }\n}\n\nfunction addCookieNeedles(file: string, hard: Set<string>): void {\n try {\n const state = JSON.parse(readFileSync(file, 'utf8')) as { cookies?: { value: string }[] }\n for (const { value } of state.cookies ?? []) {\n if (!value || value.length < 16) continue\n hard.add(value)\n let decoded = value\n try {\n decoded = decodeURIComponent(value)\n } catch {\n // A value that is not URI-encoded is already its own decoded form.\n }\n hard.add(decoded)\n const token = decoded.split('.')[0] ?? ''\n if (token.length >= 16) hard.add(token)\n }\n } catch {\n // A half-written state file holds nothing a finished run used.\n }\n}\n","/**\n * A recording turned into files a person can watch.\n *\n * <label>-full.mp4 H.264, the whole session at real speed, with an 84 px\n * caption bar under the UI: the chapter line and an elapsed clock\n * <label>.srt the same chapters as a sidecar caption file\n * <label>-highlights.mp4 at most 178 s: waits and idle stretches sped up, and the caption\n * says by how much (\"[01:09] First text after 23 s » 4.2x, 21 s real (whole wait 41 s)\")\n * <label>-x2.mp4 optional: the full video at 2x\n *\n * Captions sit in their own bar so they never cover the composer or a toast.\n * Needs `ffmpeg` and `ffprobe` on PATH; work runs at nice 10 on 2 threads.\n */\nimport { execFileSync } from 'node:child_process'\nimport { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { basename, join } from 'node:path'\n\nexport interface Chapter {\n /** Epoch ms. */\n at: number\n caption: string\n /** Context label, or null for every context. */\n label: string | null\n kind: 'step' | 'wait'\n /** Epoch ms a wait ended. */\n until?: number\n}\n\nexport interface Cue {\n start: number\n end: number\n text: string\n}\n\nexport interface HighlightSegment {\n /** Source range, seconds. */\n a: number\n b: number\n /** Speed-up factor. */\n k: number\n text: string\n}\n\n/** The frame a recording made before sizes were saved used. */\nconst DESKTOP_FRAME = { width: 1440, height: 900 }\ntype Frame = { width: number; height: number }\nconst BAR = 84\nexport const MAX_HIGHLIGHTS_S = 178\n\nconst FONT_CANDIDATES = [\n '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf',\n '/usr/share/fonts/dejavu/DejaVuSansMono.ttf',\n '/System/Library/Fonts/Menlo.ttc',\n]\n\nfunction monoFont(): string | null {\n const configured = process.env.JOURNEYS_FONT_MONO\n if (configured && existsSync(configured)) return configured\n return FONT_CANDIDATES.find((path) => existsSync(path)) ?? null\n}\n\nfunction ff(args: string[]): void {\n execFileSync('nice', ['-n', '10', 'ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', ...args], { stdio: ['ignore', 'inherit', 'inherit'] })\n}\n\nexport function probeSeconds(file: string): number {\n const out = execFileSync('ffprobe', ['-v', 'error', '-show_entries', 'format=duration', '-of', 'default=nw=1:nk=1', file], { encoding: 'utf8' }).trim()\n const n = Number(out)\n if (!Number.isFinite(n) || n <= 0) throw new Error(`ffprobe could not read the duration of ${file}: ${out}`)\n return n\n}\n\nconst pad2 = (n: number) => String(Math.floor(n)).padStart(2, '0')\nconst mmss = (s: number) => `${pad2(s / 60)}:${pad2(s % 60)}`\nconst srtTime = (s: number) => {\n const ms = Math.max(0, Math.round(s * 1000))\n return `${pad2(ms / 3_600_000)}:${pad2((ms / 60_000) % 60)}:${pad2((ms / 1000) % 60)},${String(ms % 1000).padStart(3, '0')}`\n}\nconst assTime = (s: number) => {\n const cs = Math.max(0, Math.round(s * 100))\n return `${Math.floor(cs / 360_000)}:${pad2((cs / 6000) % 60)}:${pad2((cs / 100) % 60)}.${String(cs % 100).padStart(2, '0')}`\n}\nconst humanSeconds = (s: number) => (s >= 90 ? `${Math.floor(s / 60)} min ${Math.round(s % 60)} s` : `${Math.round(s)} s`)\n\n/** Chapters on the video's own clock; each caption holds until the next. */\nexport function chapterCues(chapters: readonly Chapter[], t0: number, duration: number): Cue[] {\n const points = chapters\n .map((c) => ({ ...c, s: (c.at - t0) / 1000, e: c.until ? (c.until - t0) / 1000 : undefined }))\n .filter((c) => c.s < duration)\n .sort((a, b) => a.s - b.s)\n const cues: Cue[] = []\n for (let i = 0; i < points.length; i += 1) {\n const c = points[i]!\n const start = Math.max(0, c.s)\n const end = Math.min(duration, points[i + 1]?.s ?? duration)\n if (end - start < 0.05) continue\n const text = c.kind === 'wait' && c.e !== undefined ? `${c.caption} (real wait ${humanSeconds(c.e - c.s)})` : c.caption\n cues.push({ start, end, text })\n }\n return cues\n}\n\nfunction srtText(cues: readonly Cue[]): string {\n return cues.map((c, i) => `${i + 1}\\n${srtTime(c.start)} --> ${srtTime(c.end)}\\n${c.text}\\n`).join('\\n')\n}\n\nfunction assText(cues: readonly Cue[], { width: W, height: H }: Frame): string {\n const esc = (t: string) => t.replace(/\\\\/g, '\\\\\\\\').replace(/[{}]/g, '').replace(/\\n/g, '\\\\N')\n const head = `[Script Info]\\nScriptType: v4.00+\\nPlayResX: ${W}\\nPlayResY: ${H + BAR}\\nWrapStyle: 0\\n\\n[V4+ Styles]\\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\\nStyle: Bar,DejaVu Sans,26,&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,1,28,200,14,1\\n\\n[Events]\\nFormat: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\\n`\n return head + cues.map((c) => `Dialogue: 0,${assTime(c.start)},${assTime(c.end)},Bar,,0,0,0,,${esc(c.text)}`).join('\\n') + '\\n'\n}\n\n/**\n * The highlights cut: which source ranges, at what speed, under which caption.\n * A wait longer than 6 s plays in about 5 s; an idle stretch longer than 15 s\n * plays in about 10 s; then everything scales to fit {@link MAX_HIGHLIGHTS_S}.\n */\nexport function highlightPlan(chapters: readonly Chapter[], t0: number, duration: number): HighlightSegment[] {\n const pts = chapters\n .map((c) => ({ ...c, s: Math.max(0, (c.at - t0) / 1000), e: c.until ? (c.until - t0) / 1000 : undefined }))\n .sort((x, y) => x.s - y.s)\n const cuts = new Set<number>([0, duration])\n for (const p of pts) {\n if (p.s < duration) cuts.add(Math.round(p.s * 10) / 10)\n if (p.e !== undefined && p.e < duration) cuts.add(Math.round(p.e * 10) / 10)\n }\n const bounds = [...cuts].sort((x, y) => x - y)\n const segs: { a: number; b: number; k: number; text: string; wait: boolean; whole: number }[] = []\n for (let i = 0; i + 1 < bounds.length; i += 1) {\n const a = bounds[i]!\n const b = bounds[i + 1]!\n if (b - a < 0.15) continue\n const wait = [...pts].reverse().find((p) => p.kind === 'wait' && p.e !== undefined && p.s <= a + 0.05 && a < p.e - 0.05)\n // The latest step caption wins (e.g. \"First text after 31 s\" inside a wait); the wait adds its total.\n const step = [...pts].reverse().find((p) => p.kind === 'step' && p.s <= a + 0.05 && (!wait || p.s >= wait.s - 0.05))\n const len = b - a\n const k = wait ? (len > 6 ? len / 5 : 1) : len > 15 ? len / 10 : 1\n segs.push({ a, b, k, text: step?.caption ?? wait?.caption ?? '', wait: Boolean(wait), whole: wait?.e !== undefined ? wait.e - wait.s : 0 })\n }\n const shown = segs.reduce((n, s) => n + (s.b - s.a) / s.k, 0)\n const f = shown > MAX_HIGHLIGHTS_S ? shown / MAX_HIGHLIGHTS_S : 1\n return segs.map((s) => {\n const k = s.k * f\n const len = s.b - s.a\n const x = k >= 10 ? Math.round(k) : Math.round(k * 10) / 10\n const speed = k > 1.05 ? ` » ${x}x, ${humanSeconds(len)} real${s.wait ? ` (whole wait ${humanSeconds(s.whole)})` : ''}` : ''\n return { a: s.a, b: s.b, k, text: `[${mmss(s.a)}] ${s.text}${speed}` }\n })\n}\n\ninterface PostProcessInput {\n webm: string\n /** Raw working folder on the host; keeps the webm and chapters for a rebuild. */\n workDir: string\n videoDir: string\n label: string\n /** Epoch ms the recorded page was created. */\n t0: number\n wallSeconds: number\n chapters: readonly Chapter[]\n speedup2x: boolean\n /** The recorded frame; desktop when absent. */\n size?: Frame\n}\n\nexport function postProcessVideo(o: PostProcessInput): string[] {\n mkdirSync(o.videoDir, { recursive: true })\n const keep = join(o.workDir, `${o.label}.webm`)\n if (o.webm !== keep) copyFileSync(o.webm, keep)\n const size = o.size ?? DESKTOP_FRAME\n writeFileSync(join(o.workDir, `${o.label}.chapters.json`), JSON.stringify({ t0: o.t0, wallSeconds: o.wallSeconds, chapters: o.chapters, size }))\n return renderAll(keep, o.workDir, o.videoDir, o.label, o.t0, o.chapters, o.speedup2x, o.wallSeconds, size)\n}\n\n/** Re-render from a raw folder after editing `<label>.chapters.json` by hand. */\nexport function rebuildVideo(rawLabelDir: string, videoDir: string, label: string, speedup2x: boolean): string[] {\n const meta = JSON.parse(readFileSync(join(rawLabelDir, `${label}.chapters.json`), 'utf8')) as { t0: number; wallSeconds: number; chapters: Chapter[]; size?: Frame }\n return renderAll(join(rawLabelDir, `${label}.webm`), rawLabelDir, videoDir, label, meta.t0, meta.chapters, speedup2x, meta.wallSeconds, meta.size ?? DESKTOP_FRAME)\n}\n\nfunction renderAll(webm: string, work: string, videoDir: string, label: string, t0: number, chapters: readonly Chapter[], speedup2x: boolean, wallSeconds: number, size: Frame): string[] {\n const { width: W, height: H } = size\n const clean = join(work, `${label}.clean.mp4`)\n ff(['-i', webm, '-vf', `fps=25,scale=${W}:${H}:flags=lanczos,format=yuv420p`, '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '22', '-threads', '2', '-an', clean])\n const duration = probeSeconds(clean)\n // Measured 2026-10-11 against a clock burned into the page: video time tracks\n // wall clock from page creation to within 0.2 s.\n if (duration < wallSeconds - 3) console.warn(`video is ${duration.toFixed(1)} s but ${wallSeconds.toFixed(1)} s passed before recording stopped; late captions may be early`)\n\n const cues = chapterCues(chapters, t0, duration)\n const srt = join(videoDir, `${label}.srt`)\n writeFileSync(srt, srtText(cues))\n const ass = join(work, `${label}.full.ass`)\n writeFileSync(ass, assText(cues, size))\n const full = join(videoDir, `${label}-full.mp4`)\n const font = monoFont()\n const clock = `drawtext=${font ? `fontfile=${font}` : 'font=monospace'}:text='%{pts\\\\:hms}':x=w-tw-28:y=h-${BAR / 2}-th/2:fontsize=26:fontcolor=white@0.8`\n ff(['-i', clean, '-vf', `pad=${W}:${H + BAR}:0:0:color=0x111111,ass=${ass},${clock}`, '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '23', '-threads', '2', '-pix_fmt', 'yuv420p', '-movflags', '+faststart', full])\n\n const plan = highlightPlan(chapters, t0, duration)\n const segDir = join(work, `${label}.segments`)\n mkdirSync(segDir, { recursive: true })\n const list: string[] = []\n const hcues: Cue[] = []\n let at = 0\n plan.forEach((s, i) => {\n const seg = join(segDir, `${String(i).padStart(3, '0')}.mp4`)\n ff(['-ss', s.a.toFixed(3), '-t', (s.b - s.a).toFixed(3), '-i', clean, '-vf', `setpts=PTS/${s.k.toFixed(4)},fps=25`, '-an', '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '23', '-threads', '2', '-pix_fmt', 'yuv420p', seg])\n const len = probeSeconds(seg)\n list.push(`file '${seg}'`)\n hcues.push({ start: at, end: at + len, text: s.text })\n at += len\n })\n const listFile = join(segDir, 'list.txt')\n writeFileSync(listFile, list.join('\\n') + '\\n')\n const joined = join(work, `${label}.highlights.raw.mp4`)\n ff(['-f', 'concat', '-safe', '0', '-i', listFile, '-c', 'copy', joined])\n const hass = join(work, `${label}.highlights.ass`)\n writeFileSync(hass, assText(hcues, size))\n const highlights = join(videoDir, `${label}-highlights.mp4`)\n ff(['-i', joined, '-vf', `pad=${W}:${H + BAR}:0:0:color=0x111111,ass=${hass}`, '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '23', '-threads', '2', '-pix_fmt', 'yuv420p', '-movflags', '+faststart', highlights])\n const out = [full, srt, highlights]\n if (speedup2x) {\n const x2 = join(videoDir, `${label}-x2.mp4`)\n ff(['-i', full, '-vf', 'setpts=PTS/2,fps=25', '-an', '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '23', '-threads', '2', '-pix_fmt', 'yuv420p', '-movflags', '+faststart', x2])\n out.push(x2)\n }\n console.log(`video ${label}: full ${duration.toFixed(1)} s, highlights ${at.toFixed(1)} s from ${plan.length} segments`)\n return out\n}\n\n/** Seconds at which to grab frames: one per caption (1.5 s in), at most `max`, evenly spread. */\nexport function frameTimes(srt: string | null, times: readonly number[], max = 10): number[] {\n let ts = [...times]\n if (!ts.length && srt) {\n ts = srt.split('\\n').filter((l) => l.includes('-->')).map((l) => {\n const [h = '0', m = '0', rest = '0'] = l.split(' --> ')[0]!.split(':')\n return Number(h) * 3600 + Number(m) * 60 + Number(rest.replace(',', '.')) + 1.5\n })\n }\n if (ts.length > max) {\n const step = ts.length / max\n ts = Array.from({ length: max }, (_, i) => ts[Math.floor(i * step)]!)\n }\n return ts\n}\n\n/** PNG frames of a video, named by label and timestamp, into `outDir`. */\nexport function extractFrames(video: string, srtFile: string | null, outDir: string, times: readonly number[], max = 10): string[] {\n const srt = srtFile && existsSync(srtFile) ? readFileSync(srtFile, 'utf8') : null\n return frameTimes(srt, times, max).map((t, i) => {\n const f = join(outDir, `frame-${basename(video).replace(/-full\\.mp4$/, '')}-${String(i + 1).padStart(2, '0')}-${mmss(t).replace(':', 'm')}s.png`)\n ff(['-ss', t.toFixed(2), '-i', video, '-frames:v', '1', f])\n return f\n })\n}\n","/**\n * The one file a reviewer opens: INDEX.md for a folder of recorded journeys.\n *\n * It lists the highlight cuts first, the critic's scorecard, the ranked fix\n * list (verified failures by rank, each with its evidence, fix, number to beat\n * and proving test), every recorded turn with its scored outcome, every video,\n * and what stayed unproven. The renderer is pure; `collectJourneyFiles` reads\n * the folder.\n */\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { join, relative } from 'node:path'\nimport type { TurnRecord } from './journey.js'\n\n/** What the skeptical critic returns; the same shape the prove-journeys workflow asks for. */\nexport interface CriticResult {\n headline: string\n scorecard?: { journey: string; verifiedVerdict: string; keyTiming?: string; qualityGrade?: string; topIssue: string; video?: string }[]\n verifiedFailures?: {\n rank: number\n severity: string\n what: string\n journeys?: string[]\n evidence: string\n likelyCause?: string\n fix: string\n numberToBeat: string\n test: string\n }[]\n refutedOrUnproven?: string[]\n coverageGaps?: string[]\n}\n\nexport interface JourneyFiles {\n /** Folder relative to the index root, e.g. `j1-new-customer` or `j1-new-customer/r2`. */\n dir: string\n videos: { file: string; seconds: number | null }[]\n turns: Pick<TurnRecord, 'label' | 'outcome' | 'firstTextS' | 'completeS' | 'replyChars' | 'error' | 'sentAt'>[]\n}\n\nexport interface IndexInput {\n title: string\n critic?: CriticResult\n journeys: JourneyFiles[]\n}\n\nconst seconds = (s: number | null) => (s === null ? '?' : `${Math.round(s).toLocaleString('en-US')} s`)\nconst cell = (text: string | number | null | undefined) => String(text ?? '').replace(/\\|/g, '\\\\|').replace(/\\s*\\n\\s*/g, ' ')\nconst firstLine = (text: string) => text.split('\\n')[0]!.trim()\n\nfunction videoLabel(file: string): { base: string; kind: string } {\n const name = file.split('/').pop() ?? file\n const m = /^(.*)-(highlights|full|x2)\\.mp4$/.exec(name)\n return m ? { base: m[1]!, kind: m[2]! } : { base: name.replace(/\\.mp4$/, ''), kind: 'other' }\n}\n\n/** Every recorded turn's outcome, counted. The denominator is every turn in the folder's timings.json files. */\nexport function tallyTurns(journeys: readonly JourneyFiles[]): { total: number; byOutcome: Record<string, number> } {\n const byOutcome: Record<string, number> = {}\n let total = 0\n for (const j of journeys) {\n for (const t of j.turns) {\n total += 1\n byOutcome[t.outcome] = (byOutcome[t.outcome] ?? 0) + 1\n }\n }\n return { total, byOutcome }\n}\n\nexport function renderIndex(input: IndexInput): string {\n const out: string[] = [`# ${input.title}`, '']\n const { critic } = input\n const tally = tallyTurns(input.journeys)\n if (critic?.headline) out.push(`**Result.** ${critic.headline}`, '')\n if (tally.total) {\n const parts = Object.entries(tally.byOutcome).sort((a, b) => b[1] - a[1]).map(([k, n]) => `${n} ${k}`)\n out.push(`**Turns, as scored by the recorder:** ${parts.join(', ')}, of ${tally.total} recorded turns (source: each journey's timings.json).`, '')\n }\n\n const all = input.journeys.flatMap((j) => j.videos.map((v) => ({ ...v, dir: j.dir, path: j.dir ? `${j.dir}/${v.file}` : v.file })))\n const highlights = all.filter((v) => videoLabel(v.file).kind === 'highlights')\n const scoreVideos = (critic?.scorecard ?? []).map((s) => s.video ?? '').filter(Boolean)\n const rankOf = (path: string) => {\n const i = scoreVideos.findIndex((v) => v.endsWith(path))\n return i < 0 ? Number.MAX_SAFE_INTEGER : i\n }\n highlights.sort((a, b) => rankOf(a.path) - rankOf(b.path) || a.path.localeCompare(b.path))\n if (highlights.length) {\n out.push('## Start here: highlights, at most 3 minutes each', '')\n highlights.forEach((v, i) => {\n const card = critic?.scorecard?.find((s) => s.video?.endsWith(v.path))\n out.push(`${i + 1}. \\`${v.path}\\` (${seconds(v.seconds)})${card ? `. ${card.journey}: ${firstLine(card.topIssue)}` : ''}`)\n })\n out.push('')\n }\n\n if (critic?.scorecard?.length) {\n out.push('## Scorecard', '', '| Journey | Verdict | Key timing | Output | Top issue |', '|---|---|---|---|---|')\n for (const s of critic.scorecard) out.push(`| ${cell(s.journey)} | ${cell(s.verifiedVerdict)} | ${cell(s.keyTiming)} | ${cell(s.qualityGrade)} | ${cell(s.topIssue)} |`)\n out.push('')\n }\n\n const fixes = [...(critic?.verifiedFailures ?? [])].sort((a, b) => a.rank - b.rank)\n if (fixes.length) {\n out.push('## Ranked fixes (verified failures, customer impact first)', '')\n for (const f of fixes) {\n out.push(`${f.rank}. **${firstLine(f.what)}** (${f.severity}${f.journeys?.length ? `; ${f.journeys.join(', ')}` : ''})`)\n // Later lines keep their breaks, so a list inside `what` nests under its rank.\n for (const line of f.what.split('\\n').slice(1)) if (line.trim()) out.push(` ${line.trim()}`)\n out.push(` - Evidence: ${cell(f.evidence)}`)\n if (f.likelyCause) out.push(` - Likely cause: ${cell(f.likelyCause)}`)\n out.push(` - Fix: ${cell(f.fix)}`, ` - Number to beat: ${cell(f.numberToBeat)}`, ` - Proving test: ${cell(f.test)}`)\n }\n out.push('')\n }\n\n const turns = input.journeys.flatMap((j) => j.turns.map((t) => ({ ...t, dir: j.dir })))\n if (turns.length) {\n out.push('## Every recorded turn', '', '| Journey | Context | Sent | Outcome | First text | End | Reply chars | What went wrong |', '|---|---|---|---|---|---|---|---|')\n for (const t of turns) {\n out.push(`| ${cell(t.dir || '.')} | ${cell(t.label)} | ${cell(t.sentAt.slice(11, 19))}Z | ${cell(t.outcome)} | ${seconds(t.firstTextS)} | ${seconds(t.completeS)} | ${t.replyChars.toLocaleString('en-US')} | ${cell(t.error ?? '')} |`)\n }\n out.push('')\n }\n\n if (all.length) {\n out.push('## Every video', '')\n const dirs = [...new Set(all.map((v) => v.dir))]\n for (const dir of dirs) {\n out.push(`### \\`${dir || '.'}\\``, '')\n const byBase = new Map<string, typeof all>()\n for (const v of all.filter((x) => x.dir === dir)) {\n const { base } = videoLabel(v.file)\n byBase.set(base, [...(byBase.get(base) ?? []), v])\n }\n for (const [base, vids] of byBase) {\n const order = ['highlights', 'full', 'x2', 'other']\n vids.sort((a, b) => order.indexOf(videoLabel(a.file).kind) - order.indexOf(videoLabel(b.file).kind))\n out.push(`- ${base}: ${vids.map((v) => `\\`${v.file}\\` (${seconds(v.seconds)})`).join(', ')}`)\n }\n out.push('')\n }\n }\n\n const unproven = [...(critic?.refutedOrUnproven ?? []), ...(critic?.coverageGaps ?? [])]\n if (unproven.length) {\n out.push('## Refuted, unproven and not covered', '')\n for (const u of unproven) out.push(`- ${cell(u)}`)\n out.push('')\n }\n return out.join('\\n')\n}\n\n/**\n * Every journey folder under `root`: one that holds a `timings.json` or a\n * `video/` folder, at any depth. `probe` returns a video's duration in seconds.\n */\nexport function collectJourneyFiles(root: string, probe: (file: string) => number | null): JourneyFiles[] {\n const found: JourneyFiles[] = []\n const visit = (dir: string, depth: number) => {\n const timings = join(dir, 'timings.json')\n const videoDir = join(dir, 'video')\n const hasVideo = existsSync(videoDir) && statSync(videoDir).isDirectory()\n if (existsSync(timings) || hasVideo) {\n const videos = hasVideo\n ? readdirSync(videoDir).filter((f) => f.endsWith('.mp4')).sort().map((f) => ({ file: `video/${f}`, seconds: probe(join(videoDir, f)) }))\n : []\n let turns: JourneyFiles['turns'] = []\n if (existsSync(timings)) {\n try {\n turns = ((JSON.parse(readFileSync(timings, 'utf8')) as { turns?: JourneyFiles['turns'] }).turns ?? [])\n } catch {\n turns = []\n }\n }\n found.push({ dir: relative(root, dir), videos, turns })\n }\n if (depth >= 4) return\n for (const name of readdirSync(dir).sort()) {\n const path = join(dir, name)\n if (name === 'video' || name === 'turns' || name.startsWith('.')) continue\n if (statSync(path).isDirectory()) visit(path, depth + 1)\n }\n }\n visit(root, 0)\n return found\n}\n","/**\n * The readiness scoreboard writer: one run's journey summary as the writes\n * that put it on the shared board, so every app's rows land in one schema.\n *\n * The board is an artifact page whose shared store holds three collections:\n * `flows` (one row per flow), `prs` and `meta` (one document per app; Hardware's\n * is `board`, written before the board was shared). A row carries `app` and\n * `flowId`; a row without `app` belongs to Hardware. Hardware's rows predate the\n * shared board and live at their bare flow id and `meta/board`; its runner\n * passes `legacyIds` so those rows are updated in place, never duplicated.\n *\n * A document that already exists is merged (`update`) and pinned to the\n * version the caller read from the store (`versions`), so the text a person\n * wrote for a flow (what the customer does, its pass bar) survives every run,\n * and a field the run no longer has (an old blocker on a flow that now passes)\n * is deleted. A document with no known version is created with `set`; the\n * store refuses a `set` without a version on a document that already exists\n * (version_mismatch, nothing written; checked against the board's store), so a row a person wrote is never replaced.\n *\n * Pure: the same summary and options give the same writes, in the same order.\n */\n\nexport const SCOREBOARD_STATUSES = ['pass', 'fail', 'stall', 'blocked-host', 'blocked', 'skipped', 'unrecorded'] as const\nexport type ScoreboardStatus = (typeof SCOREBOARD_STATUSES)[number]\n\n/** Rows a store wrote before the board was shared, with no `app` field, belong to this app. */\nexport const LEGACY_SCOREBOARD_APP = 'hardware'\n\n/** One journey in a run's `summary.json`. */\nexport interface JourneySummaryEntry {\n /** Flow id, e.g. `c2` or `C2`; written upper-case. */\n id: string\n status: string\n /** Why it was blocked, skipped, stalled or failed. */\n reason?: string\n firstTextS?: number\n completeS?: number\n /** Links a reviewer can open. Only http(s) URLs are written; host paths are dropped. */\n videoUrl?: string\n traceUrl?: string\n evidenceUrl?: string\n}\n\n/** A run's summary, as an app's journey runner writes it. */\nexport interface JourneySummary {\n origin?: string\n /** Commit the run served. */\n sha?: string\n model?: string\n lane?: string\n /** ISO time of the run; required, so two runs are told apart. */\n updatedAt?: string\n journeys: JourneySummaryEntry[]\n}\n\nexport interface ScoreboardOptions {\n /** Short app name, e.g. `casework`. */\n app: string\n /** Current version of each document that exists, by `collection/docId`. */\n versions?: Readonly<Record<string, number>>\n /**\n * Write at the ids the board used before it was shared: the bare flow id and\n * `meta/board`. Only Hardware's runner sets this; every other app's rows are\n * `<app>-<flowId>` and `meta/<app>`.\n */\n legacyIds?: boolean\n}\n\n/** One entry of an artifact store batch, in the shape the batch write takes. */\nexport interface ScoreboardWrite {\n op: 'update' | 'set'\n collection: 'flows' | 'meta'\n doc_id: string\n data: Record<string, unknown>\n if_version?: number\n}\n\nexport interface ScoreboardResult {\n writes: ScoreboardWrite[]\n /** Entries the writer could not take as given, each with what it did instead. */\n warnings: string[]\n}\n\nconst DELETE = { __delete__: true } as const\nconst APP_NAME = /^[a-z][a-z0-9-]{0,40}$/\n\nconst isStatus = (value: string): value is ScoreboardStatus => (SCOREBOARD_STATUSES as readonly string[]).includes(value)\nconst url = (value: unknown): string | undefined => (typeof value === 'string' && /^https?:\\/\\//.test(value) ? value : undefined)\nconst seconds = (value: unknown): number | undefined => (typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : undefined)\n\n/** The document id a flow row lives at. */\nexport function scoreboardDocId(app: string, flowId: string, legacyIds = false): string {\n return legacyIds ? flowId : `${app}-${flowId}`\n}\n\n/** The `meta` document an app's run facts live at. */\nexport function scoreboardMetaId(app: string, legacyIds = false): string {\n return legacyIds ? 'board' : app\n}\n\n/** Keys in a fixed order, so the same input always serializes the same way. */\nfunction sorted(data: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(Object.keys(data).sort().map((key) => [key, data[key]]))\n}\n\n/**\n * A document with a known version is merged, pinned to that version. One with\n * none is created with `set`, which takes no delete markers; if it does exist\n * after all, the store refuses the unpinned write and names it, so nothing a\n * person wrote there is overwritten.\n */\nfunction pinned(write: Omit<ScoreboardWrite, 'if_version'>, versions: ScoreboardOptions['versions']): ScoreboardWrite {\n const version = versions?.[`${write.collection}/${write.doc_id}`]\n if (version !== undefined) return { ...write, op: 'update', if_version: version }\n const data = Object.fromEntries(Object.entries(write.data).filter(([, value]) => value !== DELETE))\n return { ...write, op: 'set', data }\n}\n\nexport function scoreboardRows(summary: JourneySummary, options: ScoreboardOptions): ScoreboardResult {\n const app = options.app\n if (!APP_NAME.test(app)) throw new Error(`scoreboard: app must be a short lowercase name such as \"casework\", got \"${app}\"`)\n if (!summary || !Array.isArray(summary.journeys)) throw new Error('scoreboard: the summary has no journeys array')\n if (!summary.updatedAt || Number.isNaN(Date.parse(summary.updatedAt))) throw new Error('scoreboard: the summary needs updatedAt, an ISO time')\n\n const warnings: string[] = []\n const flows = new Map<string, ScoreboardWrite>()\n for (const entry of summary.journeys) {\n const flowId = String(entry.id ?? '').trim().toUpperCase()\n if (!flowId) { warnings.push('a journey without an id was skipped'); continue }\n let status: ScoreboardStatus\n if (isStatus(entry.status)) status = entry.status\n else { status = 'unrecorded'; warnings.push(`${flowId}: status \"${entry.status}\" is not one of ${SCOREBOARD_STATUSES.join(', ')}; written as unrecorded`) }\n if (flows.has(flowId)) warnings.push(`${flowId}: listed twice; the last entry wins`)\n for (const key of ['videoUrl', 'traceUrl', 'evidenceUrl'] as const) {\n if (entry[key] !== undefined && !url(entry[key])) warnings.push(`${flowId}: ${key} is not an http(s) link and was dropped`)\n }\n const reason = typeof entry.reason === 'string' && entry.reason.trim() ? entry.reason.trim() : undefined\n const data: Record<string, unknown> = {\n app,\n flowId,\n status,\n // A pass carries no blocker; any other status names why, or clears a stale one.\n blocker: status !== 'pass' && reason ? reason : DELETE,\n firstTextS: seconds(entry.firstTextS) ?? DELETE,\n completeS: seconds(entry.completeS) ?? DELETE,\n videoUrl: url(entry.videoUrl) ?? DELETE,\n traceUrl: url(entry.traceUrl) ?? DELETE,\n evidenceUrl: url(entry.evidenceUrl) ?? DELETE,\n sha: summary.sha ?? DELETE,\n recordedAt: summary.updatedAt,\n }\n flows.set(flowId, { op: 'update', collection: 'flows', doc_id: scoreboardDocId(app, flowId, options.legacyIds), data: sorted(data) })\n }\n\n const writes = [...flows.values()]\n .sort((a, b) => a.doc_id.localeCompare(b.doc_id, undefined, { numeric: true }))\n .map((write) => pinned(write, options.versions))\n const meta: Record<string, unknown> = {\n origin: summary.origin ?? DELETE,\n sha: summary.sha ?? DELETE,\n model: summary.model ?? DELETE,\n lane: summary.lane ?? DELETE,\n updatedAt: summary.updatedAt,\n }\n writes.push(pinned({ op: 'update', collection: 'meta', doc_id: scoreboardMetaId(app, options.legacyIds), data: sorted(meta) }, options.versions))\n return { writes, warnings }\n}\n"],"mappings":";;;;;AAmDO,IAAM,uBAA0C;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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,QAAQ,EAAE,IAAI,UAAU,YAAY,SAAS,QAAQ,gBAAgB,KAAK,QAAQ,QAAQ,SAAS,GAAG,MAAM,OAAO,IAAI,EAAE,CAAC;AAAA,EACtI;AAEA,QAAM,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,EAC9B,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,cAAc,EAAE,QAAQ,QAAW,EAAE,SAAS,KAAK,CAAC,CAAC,EAC7E,IAAI,CAAC,UAAU,OAAO,OAAO,QAAQ,QAAQ,CAAC;AACjD,QAAM,OAAgC;AAAA,IACpC,QAAQ,QAAQ,UAAU;AAAA,IAC1B,KAAK,QAAQ,OAAO;AAAA,IACpB,OAAO,QAAQ,SAAS;AAAA,IACxB,MAAM,QAAQ,QAAQ;AAAA,IACtB,WAAW,QAAQ;AAAA,EACrB;AACA,SAAO,KAAK,OAAO,EAAE,IAAI,UAAU,YAAY,QAAQ,QAAQ,iBAAiB,KAAK,QAAQ,SAAS,GAAG,MAAM,OAAO,IAAI,EAAE,GAAG,QAAQ,QAAQ,CAAC;AAChJ,SAAO,EAAE,QAAQ,SAAS;AAC5B;","names":["url","openSync","closeSync","join","openSync","closeSync","join","existsSync","readdirSync","readFileSync","statSync","join","resolve","url","existsSync","mkdirSync","readFileSync","join","existsSync","readdirSync","readFileSync","statSync","join","seconds"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HarnessPicker,
|
|
3
3
|
filterAcceptedFiles
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-76Y5VOHE.js";
|
|
5
5
|
import {
|
|
6
6
|
EffortPicker,
|
|
7
7
|
ModelPicker,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
isModelCompatibleWithHarness,
|
|
21
21
|
snapModelToHarness
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JP6QSEF5.js";
|
|
23
23
|
|
|
24
24
|
// src/web-react/agent-profile-editor.tsx
|
|
25
25
|
import { useEffect as useEffect4, useId as useId5, useMemo as useMemo3, useState as useState7 } from "react";
|
|
@@ -2382,4 +2382,4 @@ export {
|
|
|
2382
2382
|
AGENT_PROFILE_EDITOR_SECTIONS,
|
|
2383
2383
|
AgentProfileEditor
|
|
2384
2384
|
};
|
|
2385
|
-
//# sourceMappingURL=chunk-
|
|
2385
|
+
//# sourceMappingURL=chunk-C5OTKXHP.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
filterAcceptedFiles,
|
|
8
8
|
isAcceptedFileType,
|
|
9
9
|
renamePastedImages
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-76Y5VOHE.js";
|
|
11
11
|
import {
|
|
12
12
|
useWorkspacePrewarmHandle
|
|
13
13
|
} from "./chunk-2HQP2CTA.js";
|
|
@@ -1853,4 +1853,4 @@ export {
|
|
|
1853
1853
|
ComposerModeControls,
|
|
1854
1854
|
EntryComposer
|
|
1855
1855
|
};
|
|
1856
|
-
//# sourceMappingURL=chunk-
|
|
1856
|
+
//# sourceMappingURL=chunk-E633CJFH.js.map
|
|
@@ -191,6 +191,8 @@ var HARNESS_CAPABILITIES = {
|
|
|
191
191
|
"factory-droids": { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null },
|
|
192
192
|
forge: { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null },
|
|
193
193
|
grok: { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null },
|
|
194
|
+
nanocode: { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null },
|
|
195
|
+
exo: { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null },
|
|
194
196
|
cursor: { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null },
|
|
195
197
|
"cli-base": { subagents: false, mcp: "native", toolControls: "runtime", skillsDir: null }
|
|
196
198
|
};
|
|
@@ -218,4 +220,4 @@ export {
|
|
|
218
220
|
assertHarnessModelCompatible,
|
|
219
221
|
harnessCapabilities
|
|
220
222
|
};
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-JP6QSEF5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/harness/index.ts","../src/harness/session-selection.ts","../src/harness/presets.ts"],"sourcesContent":["/**\n * Coding-agent harness selection, model compatibility, and the session lock.\n *\n * Known identities are not a deployment's available runners. Products supply\n * server-owned availability to resolveSessionHarness. Historical session IDs\n * remain intact when their runner is unavailable; a harness change requires an\n * explicit transfer, not a fallback or a rewritten session lock.\n *\n * Model compatibility is owned by @tangle-network/agent-interface. The shell\n * owns session selection; the consumer owns storage and deployment policy.\n */\n\nimport type { HarnessType } from '@tangle-network/agent-interface'\nimport { harnessTypeSchema } from '@tangle-network/agent-interface/harness'\nimport {\n harnessProviders,\n harnessSupportsModel,\n modelProvider,\n preferredHarnessForModel,\n snapHarnessToModel as aiSnapHarnessToModel,\n snapModelToHarness as aiSnapModelToHarness,\n} from '@tangle-network/agent-interface/harness-capabilities'\nimport {\n selectSessionHarness,\n type SelectionAvailability,\n type SessionHarnessSelection,\n type SessionHarnessSelectionInput,\n} from './session-selection'\n\nexport { HarnessSelectionError } from './session-selection'\n\n/** Canonical identities that have no direct Sandbox backend. */\nconst NON_BACKEND_HARNESSES = ['gemini'] as const satisfies readonly HarnessType[]\nconst nonBackendHarnesses = new Set<string>(NON_BACKEND_HARNESSES)\n\n/** A recognized coding-agent backend, not a promise that it is installed. */\nexport type Harness = Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]>\n\n/**\n * Recognized backend identities, including IDs needed by historical sessions.\n * Use deployment availability, not membership here, to offer or admit new runs.\n */\nexport const KNOWN_HARNESSES: readonly Harness[] = [\n ...harnessTypeSchema.options.filter(\n (harness): harness is Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]> =>\n !nonBackendHarnesses.has(harness),\n ),\n]\n\n/** Default for an absent choice; never a replacement for an invalid explicit ID. */\nexport const DEFAULT_HARNESS: Harness = 'opencode'\nconst HARNESS_SET: ReadonlySet<string> = new Set(KNOWN_HARNESSES)\n\n/** Determine whether a value is a recognized identity, independently of availability. */\nexport function isHarness(value: unknown): value is Harness {\n return typeof value === 'string' && HARNESS_SET.has(value)\n}\n\n/** Display/config convenience only. Never use coercion to admit an execution or restore a lock. */\nexport function coerceHarness(value: unknown, fallback: Harness = DEFAULT_HARNESS): Harness {\n return isHarness(value) ? value : fallback\n}\n\n/** Server-owned start and resume sets. Existing-only entries are draining. */\nexport type HarnessAvailability = SelectionAvailability<Harness>\n\n/** A saved lock, explicit choice, workspace default, and optional deployment availability. */\nexport type ResolveSessionHarnessInput = SessionHarnessSelectionInput<Harness>\n\n/** The selected identity and the existing session-lock/swap-attempt result. */\nexport type ResolvedSessionHarness = SessionHarnessSelection<Harness>\n\n/**\n * Resolve requested → workspaceDefault → fallback only for a genuinely new session.\n * A non-null saved identity always takes the lock path. Unknown/retired identities\n * and invalid explicit requests throw HarnessSelectionError instead of falling back.\n * A known different request still reports swapAttempted while preserving the lock.\n * The caller must reject that attempt before execution, as in the existing contract.\n */\nexport function resolveSessionHarness(input: ResolveSessionHarnessInput = {}): ResolvedSessionHarness {\n return selectSessionHarness(input, KNOWN_HARNESSES, DEFAULT_HARNESS)\n}\n\n/**\n * An app's harness configuration, read from its deploy configuration (for example the env vars\n * `AGENT_HARNESS` and `AGENT_HARNESS_WORKSPACES`), so no product hard-codes `backend.type`.\n */\nexport interface HarnessConfig {\n /** The app default for new sessions. Unset or blank means {@link DEFAULT_HARNESS}. */\n default?: string\n /** Per-workspace choices: a JSON object mapping a workspace id to a harness. */\n workspaces?: string\n}\n\nfunction configHarness(value: unknown, where: string): Harness {\n if (!isHarness(value)) throw new Error(`${where} names an unknown harness: ${String(value)}`)\n return value\n}\n\n/**\n * The harness a workspace's new sessions start on: its own choice, else the app default, else\n * {@link DEFAULT_HARNESS}. Pass the result to {@link resolveSessionHarness} as `workspaceDefault`\n * so a session that already ran keeps its harness. A value naming an unknown harness throws:\n * a configuration typo must fail loudly, never run a different harness than the one configured.\n */\nexport function configuredHarness(config: HarnessConfig, workspaceId?: string): Harness {\n const appDefault = config.default?.trim()\n ? configHarness(config.default.trim(), 'The harness default') : DEFAULT_HARNESS\n const raw = config.workspaces?.trim()\n if (!raw) return appDefault\n let choices: unknown\n try {\n choices = JSON.parse(raw)\n } catch {\n throw new Error('The per-workspace harness configuration is not JSON')\n }\n if (!choices || typeof choices !== 'object' || Array.isArray(choices)) {\n throw new Error('The per-workspace harness configuration must map workspace ids to harnesses')\n }\n // Every entry is checked, not only the caller's, so one bad entry fails every workspace's\n // first turn after the deploy instead of hiding until that workspace sends a message.\n const parsed = new Map(Object.entries(choices).map(([id, value]) =>\n [id, configHarness(value, `The harness for workspace ${id}`)]))\n return (workspaceId === undefined ? undefined : parsed.get(workspaceId)) ?? appDefault\n}\n\n/** Harness-model compatibility is delegated to the Interface owner. */\nexport { modelProvider }\n\n/** A resolved model and the transport provider that will execute it. */\nexport interface HarnessModelSelection {\n model: string\n provider?: string\n}\n\n/** Provider-less ids (sentinels like \"default\", or a session's own config) are\n * compatible everywhere — every harness honors its own configuration. */\nexport function isModelCompatibleWithHarness(harness: Harness, modelId: string): boolean {\n return harnessSupportsModel(harness, modelId)\n}\n\n/** Keep `modelId` when the harness can run it; else the harness's best compatible\n * catalog id (preferred patterns in order, highest version). When nothing in the\n * catalog fits, return the original so the caller sees the incompatibility. */\nexport function snapModelToHarness(harness: Harness, modelId: string, canonicalIds: readonly string[]): string {\n return aiSnapModelToHarness(harness, modelId, canonicalIds)\n}\n\n/** Keep the harness when it can run `modelId`; else the model's native harness\n * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to opencode. */\nexport function snapHarnessToModel(harness: Harness, modelId: string): Harness {\n const snapped = aiSnapHarnessToModel(harness, modelId)\n if (!isHarness(snapped)) {\n throw new Error(\n `Harness \"${harness}\" snapped to \"${snapped}\" for model \"${modelId}\", which this platform has no backend for.`,\n )\n }\n return snapped\n}\n\n/** Fail-loud server guard: throw when a harness is asked to run a model it can't.\n * A resolved model tuple supplies provider evidence when its id is unqualified.\n * Call before dispatching a sandbox turn so a bypassed UI cannot reach the\n * sidecar with an incompatible or unproven pair. */\nexport function assertHarnessModelCompatible(\n harness: Harness,\n selection: string | HarnessModelSelection,\n): void {\n const modelId = typeof selection === 'string' ? selection : selection.model\n const transportProvider = typeof selection === 'string' ? undefined : selection.provider\n const providers = harnessProviders(harness)\n const provider = modelProvider(modelId) ?? transportProvider ?? null\n // An omitted/default model is deliberately left to the harness. Once a\n // caller names a model, however, a vendor-locked harness must have provider\n // evidence. Interface owns which harnesses are locked: since 5.7 Claude Code\n // and Codex run any Router-served model, and kimi-code stays Moonshot-only.\n const isDefaultSentinel = modelId.trim() === '' || modelId.trim() === 'default'\n const compatible = isDefaultSentinel\n || providers === null\n || (provider !== null && providers.includes(provider))\n if (!compatible) {\n const native = preferredHarnessForModel(modelId)\n const providerDescription = provider ?? 'unqualified'\n throw new Error(\n `Harness \"${harness}\" cannot run model \"${modelId}\" (provider \"${providerDescription}\"). ` +\n `Use ${native ?? 'a router-backed harness (opencode)'} or an allowed model.`,\n )\n }\n}\n\n// Profile-support facts remain here until the materializer supplies its owned descriptor.\n// Do not confuse these facts with deployment availability.\n\n/** What a harness can express, for profile assembly. */\nexport interface HarnessCapabilities {\n /** Lower profile.subagents into native cwd files; false means materialization refuses them. */\n subagents: boolean\n /** How profile.mcp reaches the harness. */\n mcp: 'native' | 'config-file' | 'extension' | 'none'\n /** Whether tool controls are checked before MCP tools register. */\n toolControls: 'startup' | 'runtime'\n /** cwd-relative skill directory, or null when skills must be inlined. */\n skillsDir: string | null\n}\n\nconst HARNESS_CAPABILITIES: Record<Harness, HarnessCapabilities> = {\n 'claude-code': { subagents: true, mcp: 'native', toolControls: 'runtime', skillsDir: '.claude/skills' },\n nanoclaw: { subagents: true, mcp: 'native', toolControls: 'runtime', skillsDir: '.claude/skills' },\n opencode: { subagents: true, mcp: 'config-file', toolControls: 'runtime', skillsDir: '.opencode/skills' },\n codex: { subagents: true, mcp: 'config-file', toolControls: 'runtime', skillsDir: '.codex/skills' },\n 'kimi-code': { subagents: false, mcp: 'config-file', toolControls: 'runtime', skillsDir: '.kimi/skills' },\n pi: { subagents: false, mcp: 'extension', toolControls: 'startup', skillsDir: '.pi/skills' },\n prime: { subagents: true, mcp: 'native', toolControls: 'runtime', skillsDir: '.prime/agent/skills' },\n hermes: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n openclaw: { subagents: false, mcp: 'config-file', toolControls: 'runtime', skillsDir: 'skills' },\n acp: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n amp: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n 'factory-droids': { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n forge: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n grok: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n nanocode: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n exo: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n cursor: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n 'cli-base': { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n}\n\n/** Profile-support facts, independent of whether this deployment enables the harness. */\nexport function harnessCapabilities(harness: Harness): HarnessCapabilities {\n const caps = HARNESS_CAPABILITIES[harness]\n if (!caps) throw new Error(`harnessCapabilities: no capability facts for \"${harness}\"`)\n return caps\n}\n\n// ── Session presets ────────────────────────────────────────────────────────\n//\n// Named (model, harness, effort) pins applied with catalog coherence through\n// the snap helpers above. The contract is semantics; the visual surface stays\n// with the picker canon.\nexport {\n applySessionPreset,\n createInMemorySessionPresetStore,\n validateSessionPreset,\n type AppliedSessionPreset,\n type SessionPreset,\n type SessionPresetCatalogContext,\n type SessionPresetStore,\n} from './presets'\n","/** Pure session admission. Harness identity is not deployment availability. */\nexport interface SelectionAvailability<H extends string> {\n /** Server-owned selection for new sessions. An empty list disables all starts. */\n readonly newSessions: readonly H[]\n /** Includes draining harnesses. Omission uses newSessions, never all known IDs. */\n readonly existingSessions?: readonly H[]\n}\n\nexport interface SessionHarnessSelectionInput<H extends string> {\n sessionHarness?: unknown\n requested?: unknown\n workspaceDefault?: unknown\n fallback?: H\n /** Omit only when the caller deliberately admits every known harness. */\n availability?: SelectionAvailability<H>\n}\n\nexport interface SessionHarnessSelection<H extends string> {\n harness: H\n locked: boolean\n swapAttempted: boolean\n}\n\ntype SelectionSource = 'session' | 'requested' | 'workspace' | 'fallback'\n\n/** An admission failure, never permission to retry on another harness. */\nexport class HarnessSelectionError extends Error {\n readonly code: 'harness_unknown' | 'harness_unavailable'\n readonly harness: string | null\n readonly source: SelectionSource\n\n constructor(\n code: 'harness_unknown' | 'harness_unavailable',\n value: unknown,\n source: SelectionSource,\n ) {\n const harness = typeof value === 'string' ? value : null\n super(`${code}: ${source} harness ${harness === null ? '<invalid>' : JSON.stringify(harness)}`)\n this.name = 'HarnessSelectionError'\n this.code = code\n this.harness = harness\n this.source = source\n }\n}\n\n/**\n * Null/undefined mean no choice. Every other value is an explicit choice and must\n * validate. A retired or unrecognized saved identity must never become a new session.\n * Availability is supplied by the authenticated server, not by a request body.\n */\nexport function selectSessionHarness<H extends string>(\n input: SessionHarnessSelectionInput<H>,\n knownHarnesses: readonly H[],\n defaultHarness: H,\n): SessionHarnessSelection<H> {\n const known = new Set<string>(knownHarnesses)\n const resolve = (value: unknown, source: SelectionSource): H => {\n if (typeof value !== 'string' || !known.has(value)) {\n throw new HarnessSelectionError('harness_unknown', value, source)\n }\n return value as H\n }\n const admit = (harness: H, source: SelectionSource, existing: boolean): void => {\n if (input.availability === undefined) return\n const allowed = existing\n ? input.availability.existingSessions ?? input.availability.newSessions\n : input.availability.newSessions\n if (!allowed.includes(harness)) {\n throw new HarnessSelectionError('harness_unavailable', harness, source)\n }\n }\n\n if (input.sessionHarness !== undefined && input.sessionHarness !== null) {\n const harness = resolve(input.sessionHarness, 'session')\n admit(harness, 'session', true)\n // A known different request remains a swap attempt; it is not executed. An\n // invalid request is refused rather than being misreported as no swap.\n const requested = input.requested === undefined || input.requested === null\n ? undefined : resolve(input.requested, 'requested')\n return { harness, locked: true, swapAttempted: requested !== undefined && requested !== harness }\n }\n\n const source: SelectionSource = input.requested !== undefined && input.requested !== null\n ? 'requested'\n : input.workspaceDefault !== undefined && input.workspaceDefault !== null\n ? 'workspace' : 'fallback'\n const value = source === 'requested' ? input.requested\n : source === 'workspace' ? input.workspaceDefault : input.fallback ?? defaultHarness\n const harness = resolve(value, source)\n admit(harness, source, false)\n return { harness, locked: false, swapAttempted: false }\n}\n","/**\n * Session presets — named (model, harness, effort) combinations a user pins\n * and applies in one action, beside the canonical session controls\n * (`/web-react`'s `AgentSessionControls`).\n *\n * The CONTRACT is coherence, not storage: a preset stores exact catalog ids,\n * and APPLYING it resolves through the harness module's snap helpers so the\n * result is never an invalid combination — if the catalog moved under a\n * pinned preset (model renamed, harness retired), apply snaps to the\n * harness's best compatible catalog option (or the model's native harness)\n * exactly like a manual picker change would, and reports what changed.\n * A preset naming a model the catalog no longer carries is REFUSED at\n * apply time, never silently substituted: a different model is a different\n * decision-maker.\n *\n * Storage is a port: products persist presets wherever they keep workspace\n * state (D1, KV, localStorage). The default store is in-memory for tests\n * and single-instance products — the same shape the self-mount verb uses.\n */\nimport { snapHarnessToModel, snapModelToHarness, type Harness } from './index'\n\n/** A pinned session configuration. `id` is the product's stable key. */\nexport interface SessionPreset {\n readonly id: string\n /** User-facing label; trimmed, non-empty, ≤ 60 chars. */\n readonly name: string\n /** Canonical catalog model id (\"provider/model\"). */\n readonly model: string\n /** Optional pinned harness; omitted = follow the model's native harness. */\n readonly harness?: Harness\n /** Optional pinned reasoning effort (the picker canon's effort levels). */\n readonly effort?: string\n}\n\n/** What applying a preset actually set, with every snap named. */\nexport interface AppliedSessionPreset {\n readonly model: string\n readonly harness: Harness\n readonly effort?: string\n /** Non-empty when the catalog moved under the pinned preset. */\n readonly snapped: ReadonlyArray<'model' | 'harness'>\n}\n\nexport interface SessionPresetCatalogContext {\n /** The catalog's canonical model ids. */\n readonly canonicalIds: readonly string[]\n}\n\n/** Validate one preset at save time: label budget, canonical model id, no\n * unknown fields smuggled in. Throws with the preset's name in the message. */\nexport function validateSessionPreset(preset: SessionPreset): SessionPreset {\n const name = preset.name.trim()\n if (!name) throw new Error('a session preset needs a name')\n if (name.length > 60) {\n throw new Error(`session preset \"${name.slice(0, 30)}…\" exceeds the 60-character name budget`)\n }\n if (!preset.model.trim()) throw new Error(`session preset \"${name}\" pins no model`)\n const allowed = new Set(['id', 'name', 'model', 'harness', 'effort'])\n for (const key of Object.keys(preset)) {\n if (!allowed.has(key)) throw new Error(`session preset \"${name}\" carries an unknown field \"${key}\"`)\n }\n return { ...preset, name }\n}\n\n/** Apply a preset with catalog coherence. Refused (thrown) when the pinned\n * model is gone from the catalog — never silently another model. */\nexport function applySessionPreset(\n preset: SessionPreset,\n context: SessionPresetCatalogContext,\n): AppliedSessionPreset {\n if (!context.canonicalIds.includes(preset.model)) {\n throw new Error(\n `session preset \"${preset.name}\" pins model \"${preset.model}\", which the catalog no longer carries — `\n + `delete or re-pin the preset (a different model is a different decision-maker)`,\n )\n }\n const snapped: Array<'model' | 'harness'> = []\n const pinnedHarness = preset.harness ?? snapHarnessToModel('opencode', preset.model)\n let model = preset.model\n let harness = pinnedHarness\n // The same two-way coherence the manual pickers enforce, in the preset's\n // own order: the pinned harness snaps the model if incompatible, then the\n // (possibly snapped) model snaps the harness back if it moved families.\n const harnessCompatibleModel = snapModelToHarness(harness, model, context.canonicalIds)\n if (harnessCompatibleModel !== model) {\n model = harnessCompatibleModel\n snapped.push('model')\n }\n const modelNativeHarness = snapHarnessToModel(harness, model)\n if (modelNativeHarness !== harness) {\n harness = modelNativeHarness\n snapped.push('harness')\n }\n return {\n model,\n harness,\n ...(preset.effort !== undefined ? { effort: preset.effort } : {}),\n snapped,\n }\n}\n\n/** Durable preset storage port. Products own persistence; the default is\n * non-durable for tests and single-instance products. */\nexport interface SessionPresetStore {\n list(): Promise<readonly SessionPreset[]>\n save(preset: SessionPreset): Promise<void>\n remove(id: string): Promise<void>\n}\n\nexport function createInMemorySessionPresetStore(): SessionPresetStore {\n const state = new Map<string, SessionPreset>()\n return {\n async list() { return [...state.values()].sort((a, b) => a.name.localeCompare(b.name)) },\n async save(preset) { state.set(preset.id, validateSessionPreset(preset)) },\n async remove(id) { state.delete(id) },\n }\n}\n\n/**\n * The composer/controls integration seam: presets render beside the canonical\n * pickers (picker-canon geometry) and apply through {@link applySessionPreset};\n * saving captures the CURRENT picker selection verbatim. The visual surface is\n * deliberately not owned here — the picker canon and the product's design\n * tokens define it; this module guarantees the semantics underneath.\n */\n"],"mappings":";AAaA,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,OACjB;;;ACKA,IAAM,wBAAN,cAAoC,MAAM;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,MACA,OACA,QACA;AACA,UAAM,UAAU,OAAO,UAAU,WAAW,QAAQ;AACpD,UAAM,GAAG,IAAI,KAAK,MAAM,YAAY,YAAY,OAAO,cAAc,KAAK,UAAU,OAAO,CAAC,EAAE;AAC9F,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,SAAS;AAAA,EAChB;AACF;AAOO,SAAS,qBACd,OACA,gBACA,gBAC4B;AAC5B,QAAM,QAAQ,IAAI,IAAY,cAAc;AAC5C,QAAM,UAAU,CAACA,QAAgBC,YAA+B;AAC9D,QAAI,OAAOD,WAAU,YAAY,CAAC,MAAM,IAAIA,MAAK,GAAG;AAClD,YAAM,IAAI,sBAAsB,mBAAmBA,QAAOC,OAAM;AAAA,IAClE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S,oBAAoB,SAAuC;AACzE,QAAM,OAAO,qBAAqB,OAAO;AACzC,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,iDAAiD,OAAO,GAAG;AACtF,SAAO;AACT;","names":["value","source","harness"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-76MPX7JQ.js";
|
|
5
5
|
import {
|
|
6
6
|
KNOWN_HARNESSES
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JP6QSEF5.js";
|
|
8
8
|
|
|
9
9
|
// src/skills-placement/index.ts
|
|
10
10
|
import { defineInlineResource } from "@tangle-network/agent-interface/profile";
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
skillSupportFileMounts,
|
|
102
102
|
withSkillSupportFiles
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-NQQZVQPR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/skills-placement/index.ts"],"sourcesContent":["/**\n * Harness-native skill directory resolution — the one place agent-app binds\n * to the platform's authoritative per-harness skill-dir map.\n *\n * `../skills` renders skill CONTENT (parse, tier-filter, `inline`/`mounted`\n * delivery) but deliberately stops short of naming WHICH cwd path a `mounted`\n * skill lands at on a given harness — that mapping is owned by the platform\n * materializer (`@tangle-network/agent-profile-materialize`'s\n * `skillDirForHarness`), not by app-shell. This subpath exists so no product\n * — and no other agent-app module — ever writes a skill path literal\n * (`~/.claude/skills/...`, `.opencode/skills`, ...) of its own; it bridges\n * agent-app's `Harness` taxonomy onto the platform's `HarnessId` and asks the\n * platform for the answer.\n *\n * Requires the OPTIONAL peer `@tangle-network/agent-profile-materialize`.\n * Products that don't install it simply don't import this subpath — every\n * other agent-app skills surface (`../skills`, `ProfileChannels.skillRefs`)\n * works without it, falling back to `inline` delivery.\n */\n\nimport type { AgentProfile, AgentProfileFileMount } from '@tangle-network/agent-interface'\nimport { defineInlineResource } from '@tangle-network/agent-interface/profile'\nimport { KNOWN_HARNESSES, type Harness } from '../harness/index'\nimport { skillDirForHarness, type HarnessId } from '@tangle-network/agent-profile-materialize'\nimport { composeSkills, renderInlineSkills, type ComposedSkills, type SkillEntry } from '../skills/index'\n\n/** agent-app `Harness` -> platform `HarnessId`, identity-mapped for exactly\n * the harnesses the platform map covers. Harnesses absent here (`amp`,\n * `factory-droids`, `forge`, `grok`, `nanocode`, `exo`, `acp`, `cursor`, `cli-base`) resolve to `null` —\n * {@link composeSkillsForHarness} refuses by default rather than silently\n * delivering `inline`; a caller that genuinely needs `inline` on one of\n * these opts in explicitly (`onNoSkillDir: 'inline'`). `cursor`'s adapter\n * supports `resources.skills` bespokely but isn't in the platform map yet;\n * treating it as unbridged is the safe posture until the map covers it,\n * rather than guessing its cwd skill dir here. */\nconst HARNESS_BRIDGE: Partial<Record<Harness, HarnessId>> = {\n opencode: 'opencode',\n 'claude-code': 'claude-code',\n nanoclaw: 'nanoclaw',\n 'kimi-code': 'kimi-code',\n codex: 'codex',\n pi: 'pi',\n prime: 'prime',\n hermes: 'hermes',\n openclaw: 'openclaw',\n}\n\n/** Resolve the cwd-relative skill dir `resources.skills` refs materialize\n * into on `harness` — via the platform's `skillDirForHarness`. `null` when\n * `harness` isn't bridged (see {@link HARNESS_BRIDGE}) or when the platform\n * itself has no cwd skill primitive for it (e.g. `hermes`, user-dir-only). */\nexport function resolveSkillDir(harness: Harness): string | null {\n const bridged = HARNESS_BRIDGE[harness]\n if (!bridged) return null\n return skillDirForHarness(bridged)\n}\n\n/** Filter `harnesses` down to those with no mounted skill dir (deduped,\n * first-seen order preserved) — the set that must fall back to `inline`\n * delivery, or that a caller should warn about before offering \"mounted\"\n * install UX. */\nexport function unsupportedSkillHarnesses(harnesses: Iterable<Harness>): Harness[] {\n const seen = new Set<Harness>()\n const out: Harness[] = []\n for (const harness of harnesses) {\n if (resolveSkillDir(harness) !== null) continue\n if (seen.has(harness)) continue\n seen.add(harness)\n out.push(harness)\n }\n return out\n}\n\n/** Inputs to {@link composeSkillsForHarness}. */\nexport interface ComposeSkillsForHarnessInput {\n skills: SkillEntry[]\n harness: Harness\n tier?: string\n heading?: string\n /**\n * What to do when `harness` has no native skill-mount directory (see\n * {@link resolveSkillDir}). Default `'throw'`: refuse rather than silently\n * inlining every skill BODY into the system prompt. Pass `'inline'` only as\n * a deliberate, auditable opt-in — the caller has decided every skill must\n * reach this harness even though it will be concatenated into the prompt.\n */\n onNoSkillDir?: 'throw' | 'inline'\n}\n\n/** `KNOWN_HARNESSES` filtered to those the platform materializer can mount\n * skill files onto natively (a non-null {@link resolveSkillDir}). Computed\n * fresh rather than cached — the platform map can grow without a release\n * here. Used only to build the actionable error in\n * {@link composeSkillsForHarness}; not exported because it duplicates\n * {@link unsupportedSkillHarnesses}'s complement and callers should reach\n * for that instead when they need the harness list at runtime. */\nfunction nativeSkillMountHarnesses(): Harness[] {\n return KNOWN_HARNESSES.filter((harness) => resolveSkillDir(harness) !== null)\n}\n\n/**\n * Compose {@link ComposedSkills} for `harness`.\n *\n * `mounted` delivery is the standard path: whenever the platform names a cwd\n * skill dir for `harness`, skills ride the typed `resources.skills` channel\n * and the platform materializer writes each one to that directory as a real\n * file — the agent reads it on demand with its own file tools.\n *\n * `inline` delivery — every skill BODY rendered straight into the system\n * prompt — is a NARROW fallback for harnesses with no native skill dir, never\n * a co-equal mode. An `AgentProfile` is a RECIPE that materializes into a\n * sandbox, not a prompt template: skill bodies belong in a file mount, and\n * `prompt.systemPrompt` should carry only what the agent must obey without a\n * tool call (identity, tool-call contract, safety rules, output format) plus\n * a short index of what's mounted. Concatenating skill bodies into the prompt\n * degrades the model toward empty answers once it grows large enough — one\n * product reproduced a 151,882-byte prompt exactly this way, from an\n * unnoticed inline fallback.\n *\n * Because of that, `onNoSkillDir` defaults to `'throw'`: a harness with no\n * skill dir refuses instead of silently inlining. The thrown error names the\n * harness, the skill count, the byte size that would have been inlined, and\n * the harnesses that DO support native mounting. Pass `onNoSkillDir:\n * 'inline'` only as a deliberate, auditable opt-in when every skill genuinely\n * must reach this harness regardless of prompt cost.\n *\n * The one function a product calls instead of hand-checking `resolveSkillDir`\n * and branching between {@link composeSkills}'s two modes itself.\n */\nexport function composeSkillsForHarness(input: ComposeSkillsForHarnessInput): ComposedSkills {\n const { skills, harness, tier, heading, onNoSkillDir = 'throw' } = input\n const skillDir = resolveSkillDir(harness)\n if (skillDir) return composeSkills({ skills, mode: 'mounted', skillDir, tier, heading })\n if (onNoSkillDir === 'inline') return composeSkills({ skills, mode: 'inline', tier, heading })\n\n const relevant = tier ? skills.filter((s) => s.tier === tier) : skills\n const promptSection = renderInlineSkills({ skills, tier, heading })\n const bytes = new TextEncoder().encode(promptSection).byteLength\n const mountable = nativeSkillMountHarnesses()\n throw new Error(\n `composeSkillsForHarness: \"${harness}\" has no native skill-mount directory. ` +\n `Inlining ${relevant.length} skill(s) (${bytes} bytes) into its system prompt would silently ` +\n `convert mounted skills into prompt text — a 151,882-byte prompt shipped this way once, and ` +\n `oversized prompts degrade toward empty answers. Mount the skills instead: pick a harness with ` +\n `native skill support (${mountable.join(', ')}), or pass onNoSkillDir: 'inline' to opt in ` +\n `explicitly and accept the inlined bytes.`,\n )\n}\n\nexport type { ComposedSkills, SkillEntry } from '../skills/index'\n\n/** A file that rides BESIDE a skill entry (kit sources, references, pinned\n * requirements — anything the SKILL.md tells the agent to read or run).\n * `path` is skill-dir-relative (`kit/iso-kit.mjs`, `references/x.md`). */\nexport interface SkillSupportFile {\n path: string\n content: string\n}\n\n/** Optional naming and reconciliation policies for skill support files. */\nexport interface SkillSupportFileOptions {\n /** Resource name for newly created mounts. Defaults to `<skillId>/<path>`. */\n resourceName?: (file: SkillSupportFile) => string\n /**\n * `retain` (default) keeps identical mounts at their desired paths.\n * `replace` removes owned mounts and appends canonical mounts in file order.\n * Foreign mounts always keep their paths. On a supported harness, if they\n * occupy every desired path, `replace` leaves the original profile unchanged.\n */\n reconcileExisting?: 'retain' | 'replace'\n}\n\n/** Inline file mounts placing a skill's support files beside its entry on\n * `harness`: `<skillDir>/<skillId>/<path>`. Empty when the harness has no\n * cwd skill dir — the same posture as `resources.skills` itself (the\n * platform skips skills there too), so nothing orphan lands in a workspace\n * a harness will never read.\n *\n * This is the placement primitive for kit-carrying skills (vendored\n * executable kits, reference trees). A growing program belongs in THESE\n * mounts — never in an env var: runtimeSecrets values are capped (8192\n * chars on the sandbox SDK) and a skill tree outgrew that cap in production\n * once, taking every isolated turn down with a secret-provider refusal. */\nexport function skillSupportFileMounts(\n harness: Harness,\n skillId: string,\n files: readonly SkillSupportFile[],\n options: Pick<SkillSupportFileOptions, 'resourceName'> = {},\n): AgentProfileFileMount[] {\n const skillDir = resolveSkillDir(harness)\n if (!skillDir || files.length === 0) return []\n return files.map((file) => ({\n path: `${skillDir}/${skillId}/${file.path}`,\n resource: defineInlineResource(\n options.resourceName ? options.resourceName(file) : `${skillId}/${file.path}`,\n file.content,\n ),\n }))\n}\n\n/** Attach a skill's support files to `profile` for `harness`, idempotently.\n *\n * Replacement is by EXACT CONTENT under the skill's own subtree (any path\n * ending `/<skillId>/<path>` whose bytes match a support file of THIS call):\n * re-deriving the same profile for another harness replaces this skill's\n * own mounts wherever they previously pointed, while pack-declared files\n * with similar paths stay untouched. With no skill dir the skill's own\n * mounts are dropped (and nothing added) — mirroring how the platform\n * treats the skill entry itself on that harness. `options` can customize\n * new resource names and opt into replacing owned mounts in file order. */\nexport function withSkillSupportFiles<\n P extends { resources?: AgentProfile['resources'] },\n>(\n profile: P,\n harness: Harness,\n skillId: string,\n files: readonly SkillSupportFile[],\n options: SkillSupportFileOptions = {},\n): P {\n const hasSkillDir = resolveSkillDir(harness) !== null\n const desired = skillSupportFileMounts(harness, skillId, files, options)\n const desiredByPath = new Map(\n desired.map((mount) => [mount.path, mount.resource] as const),\n )\n const byRelPath = new Map(files.map((file) => [file.path, file.content] as const))\n const suffix = `/${skillId}/`\n const relUnderSkill = (path: string): string | null => {\n const at = path.lastIndexOf(suffix)\n return at < 0 ? null : path.slice(at + suffix.length)\n }\n // \"Ours\" = a mount under THIS skill's subtree whose bytes match a support\n // file of this call. It is STALE when the harness has no skill dir (there\n // is nowhere to place it — mirroring how the platform skips the skill\n // entry itself) or when this call would place it at a different path\n // (re-derivation for another harness). Exact-content identity only: a\n // foreign mount at one of our paths keeps the location (pack-declared\n // files win at their declared paths). By default an identical mount is\n // kept as-is; the replace policy regenerates owned mounts in file order.\n const shouldDropMount = (mount: AgentProfileFileMount): boolean => {\n if (mount.resource.kind !== 'inline') return false\n const rel = relUnderSkill(mount.path)\n if (rel === null || byRelPath.get(rel) !== mount.resource.content) return false\n if (options.reconcileExisting === 'replace') return true\n const desiredHere = desiredByPath.get(mount.path)\n return (\n !hasSkillDir ||\n desiredHere === undefined ||\n desiredHere.kind !== 'inline' ||\n desiredHere.content !== mount.resource.content\n )\n }\n const existing = profile.resources?.files ?? []\n const retained = existing.filter((mount) => !shouldDropMount(mount))\n const taken = new Set(retained.map((mount) => mount.path))\n const additions = desired.filter((mount) => !taken.has(mount.path))\n // Preserve the replace policy's no-op when foreign mounts occupy every\n // destination; without a skill dir, owned mounts are still removed.\n if (additions.length === 0 && (\n retained.length === existing.length ||\n (hasSkillDir && options.reconcileExisting === 'replace')\n )) return profile\n return {\n ...profile,\n resources: { ...(profile.resources ?? {}), files: [...retained, ...additions] },\n }\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAS,4BAA4B;AAErC,SAAS,0BAA0C;AAYnD,IAAM,iBAAsD;AAAA,EAC1D,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,aAAa;AAAA,EACb,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AACZ;AAMO,SAAS,gBAAgB,SAAiC;AAC/D,QAAM,UAAU,eAAe,OAAO;AACtC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,mBAAmB,OAAO;AACnC;AAMO,SAAS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