@tangle-network/agent-app 0.60.132 → 0.60.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/app-auth/index.js +3 -3
  2. package/dist/assistant/index.js +10 -10
  3. package/dist/chat-react/index.js +2 -2
  4. package/dist/chat-routes/index.js +10 -10
  5. package/dist/chat-routes/turn-routes.d.ts +6 -2
  6. package/dist/chat-store/index.js +3 -3
  7. package/dist/{chunk-JZUSVGRJ.js → chunk-2GP6JOWE.js} +15 -2
  8. package/dist/chunk-2GP6JOWE.js.map +1 -0
  9. package/dist/chunk-4JUEOVQS.js +134 -0
  10. package/dist/chunk-4JUEOVQS.js.map +1 -0
  11. package/dist/{chunk-5S5ANZBS.js → chunk-HZGKPWVA.js} +6 -6
  12. package/dist/{chunk-NRG2YHGY.js → chunk-IMTU5LCF.js} +1 -1
  13. package/dist/{chunk-XPP653RG.js → chunk-JEM4BKR4.js} +10 -10
  14. package/dist/{chunk-4DEI6QC5.js → chunk-NNNAC3DV.js} +4 -4
  15. package/dist/{chunk-GU7OZFU7.js → chunk-VXWEJ7F2.js} +4 -4
  16. package/dist/{chunk-ZGUXI5SI.js → chunk-XNKLQG26.js} +5 -5
  17. package/dist/design-canvas-react/index.js +4 -4
  18. package/dist/design-canvas-react/lazy.js +1 -1
  19. package/dist/public-consultation/index.js +5 -5
  20. package/dist/rollout/cli.d.ts +25 -0
  21. package/dist/rollout/cli.js +121 -0
  22. package/dist/rollout/cli.js.map +1 -0
  23. package/dist/rollout/d1.d.ts +62 -0
  24. package/dist/rollout/d1.js +89 -0
  25. package/dist/rollout/d1.js.map +1 -0
  26. package/dist/rollout/index.d.ts +116 -0
  27. package/dist/rollout/index.js +19 -0
  28. package/dist/rollout/index.js.map +1 -0
  29. package/dist/skills-placement/index.d.ts +32 -0
  30. package/dist/skills-placement/index.js +43 -1
  31. package/dist/skills-placement/index.js.map +1 -1
  32. package/dist/stream/index.js +2 -2
  33. package/dist/studio-react/index.js +2 -2
  34. package/dist/web-react/index.js +16 -16
  35. package/dist/workspace-react/index.js +5 -5
  36. package/package.json +12 -1
  37. package/dist/chunk-JZUSVGRJ.js.map +0 -1
  38. /package/dist/{chunk-5S5ANZBS.js.map → chunk-HZGKPWVA.js.map} +0 -0
  39. /package/dist/{chunk-NRG2YHGY.js.map → chunk-IMTU5LCF.js.map} +0 -0
  40. /package/dist/{chunk-XPP653RG.js.map → chunk-JEM4BKR4.js.map} +0 -0
  41. /package/dist/{chunk-4DEI6QC5.js.map → chunk-NNNAC3DV.js.map} +0 -0
  42. /package/dist/{chunk-GU7OZFU7.js.map → chunk-VXWEJ7F2.js.map} +0 -0
  43. /package/dist/{chunk-ZGUXI5SI.js.map → chunk-XNKLQG26.js.map} +0 -0
@@ -0,0 +1,89 @@
1
+ import {
2
+ rolloutAdmits
3
+ } from "../chunk-4JUEOVQS.js";
4
+
5
+ // src/rollout/d1.ts
6
+ var ROLLOUT_TURN_TIMING_SCHEMA_SQL = `
7
+ CREATE TABLE IF NOT EXISTS rollout_turn_timing (
8
+ turn_id TEXT PRIMARY KEY,
9
+ rollout TEXT NOT NULL,
10
+ workspace_id TEXT NOT NULL,
11
+ lane TEXT NOT NULL,
12
+ first_text_ms INTEGER,
13
+ settled_ms INTEGER NOT NULL,
14
+ failed INTEGER NOT NULL CHECK (failed IN (0, 1)),
15
+ failure_code TEXT,
16
+ at INTEGER NOT NULL
17
+ );
18
+ CREATE INDEX IF NOT EXISTS rollout_turn_timing_by_lane ON rollout_turn_timing (rollout, lane, at);
19
+ `;
20
+ var MEASURE_ROW_LIMIT = 2e4;
21
+ function percentile(sorted, p) {
22
+ if (!sorted.length) return null;
23
+ return sorted[Math.min(sorted.length - 1, Math.ceil(p / 100 * sorted.length) - 1)];
24
+ }
25
+ function stageMetrics(rows) {
26
+ const firstWords = rows.flatMap((row) => row.firstTextMs === void 0 || row.firstTextMs === null ? [] : [row.firstTextMs]).sort((a, b) => a - b);
27
+ const settled = rows.filter((row) => !row.failed).map((row) => row.settledMs).sort((a, b) => a - b);
28
+ return {
29
+ first_words_p50_ms: percentile(firstWords, 50),
30
+ first_words_p90_ms: percentile(firstWords, 90),
31
+ settled_p50_ms: percentile(settled, 50),
32
+ settled_p90_ms: percentile(settled, 90),
33
+ // A turn that streamed no word failed the user whatever its envelope said.
34
+ failure_rate: rows.length ? rows.filter((row) => row.failed || row.firstTextMs === void 0 || row.firstTextMs === null).length / rows.length : null
35
+ };
36
+ }
37
+ function createD1TurnTimingStore(options) {
38
+ const now = options.now ?? Date.now;
39
+ return {
40
+ /** Record one settled turn. Idempotent on `turnId`. Never throws: telemetry must not fail a turn. */
41
+ async record(row) {
42
+ try {
43
+ await options.db.prepare(
44
+ `INSERT OR IGNORE INTO rollout_turn_timing
45
+ (turn_id, rollout, workspace_id, lane, first_text_ms, settled_ms, failed, failure_code, at)
46
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
47
+ ).bind(
48
+ row.turnId,
49
+ row.rollout,
50
+ row.workspaceId,
51
+ row.lane,
52
+ row.firstTextMs === void 0 ? null : Math.round(row.firstTextMs),
53
+ Math.round(row.settledMs),
54
+ row.failed ? 1 : 0,
55
+ row.failureCode ?? null,
56
+ row.at ?? now()
57
+ ).run();
58
+ } catch (error) {
59
+ console.error(JSON.stringify({
60
+ event: "rollout_turn_timing_record_failed",
61
+ turnId: row.turnId,
62
+ error: error instanceof Error ? error.message.slice(0, 200) : String(error).slice(0, 200)
63
+ }));
64
+ }
65
+ },
66
+ /** The stage's numbers: its admitted workspaces' turns in `lane` since `since` (epoch ms). A row carries no
67
+ * workspace creation time, so a workspace admitted only by a `new-since:` entry is not counted. */
68
+ async measureStage(input) {
69
+ const { results = [] } = await options.db.prepare(
70
+ `SELECT workspace_id, first_text_ms, settled_ms, failed FROM rollout_turn_timing
71
+ WHERE rollout = ? AND lane = ? AND at >= ? ORDER BY at DESC LIMIT ?`
72
+ ).bind(input.rollout, input.lane, input.since, MEASURE_ROW_LIMIT).all();
73
+ const rows = results.filter((row) => rolloutAdmits(input.stage.value, { id: row.workspace_id })).map((row) => ({ firstTextMs: row.first_text_ms ?? void 0, settledMs: row.settled_ms, failed: row.failed === 1 }));
74
+ return {
75
+ stage: input.stage.name,
76
+ samples: rows.length,
77
+ metrics: stageMetrics(rows),
78
+ source: `rollout_turn_timing lane=${input.lane}`,
79
+ window: { from: new Date(input.since).toISOString(), to: new Date(now()).toISOString() }
80
+ };
81
+ }
82
+ };
83
+ }
84
+ export {
85
+ ROLLOUT_TURN_TIMING_SCHEMA_SQL,
86
+ createD1TurnTimingStore,
87
+ stageMetrics
88
+ };
89
+ //# sourceMappingURL=d1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rollout/d1.ts"],"sourcesContent":["/**\n * The measurement a rollout guard reads: one row per turn with its lane, its\n * first visible word and whether it failed, and the stage numbers computed\n * from those rows.\n *\n * Record from the chat route's lifecycle (`onTurnComplete` / `onTurnError`\n * carry `firstTextMs` and `durationMs`), then serve `measureStage` behind an\n * operator endpoint that the deploy's `rollout.config.mjs` calls. A stage is\n * measured on the turns of the workspaces it admits, in the lane being rolled\n * out, since the time it went live.\n */\nimport { rolloutAdmits, type RolloutStage, type StageMeasurement } from './index'\n\n/** Minimal D1 surface (Cloudflare's `D1Database` satisfies it). */\nexport interface D1LikeForRollout {\n prepare(sql: string): {\n bind(...values: unknown[]): {\n run(): Promise<unknown>\n all<T = Record<string, unknown>>(): Promise<{ results?: T[] }>\n }\n }\n}\n\nexport const ROLLOUT_TURN_TIMING_SCHEMA_SQL = `\nCREATE TABLE IF NOT EXISTS rollout_turn_timing (\n turn_id TEXT PRIMARY KEY,\n rollout TEXT NOT NULL,\n workspace_id TEXT NOT NULL,\n lane TEXT NOT NULL,\n first_text_ms INTEGER,\n settled_ms INTEGER NOT NULL,\n failed INTEGER NOT NULL CHECK (failed IN (0, 1)),\n failure_code TEXT,\n at INTEGER NOT NULL\n);\nCREATE INDEX IF NOT EXISTS rollout_turn_timing_by_lane ON rollout_turn_timing (rollout, lane, at);\n`\n\nexport interface TurnTimingRow {\n turnId: string\n /** The plan this turn counts toward, e.g. `hospitality-routed-chat`. */\n rollout: string\n workspaceId: string\n /** The lane that served the turn, e.g. `routed` or `sandbox`. Only the rolled-out lane is measured. */\n lane: string\n /** From the lifecycle's `firstTextMs`; absent when no word streamed. */\n firstTextMs?: number\n settledMs: number\n failed: boolean\n failureCode?: string\n /** Epoch ms; defaults to now. */\n at?: number\n}\n\n/** Rows read for one measurement; a stage needing more than this would be measured on its newest rows. */\nconst MEASURE_ROW_LIMIT = 20_000\n\nfunction percentile(sorted: readonly number[], p: number): number | null {\n if (!sorted.length) return null\n return sorted[Math.min(sorted.length - 1, Math.ceil((p / 100) * sorted.length) - 1)]!\n}\n\n/** Stage metrics from turn rows: first-words and settled percentiles in ms, and the failure rate. */\nexport function stageMetrics(rows: ReadonlyArray<Pick<TurnTimingRow, 'firstTextMs' | 'settledMs' | 'failed'>>) {\n const firstWords = rows.flatMap(row => row.firstTextMs === undefined || row.firstTextMs === null ? [] : [row.firstTextMs]).sort((a, b) => a - b)\n const settled = rows.filter(row => !row.failed).map(row => row.settledMs).sort((a, b) => a - b)\n return {\n first_words_p50_ms: percentile(firstWords, 50),\n first_words_p90_ms: percentile(firstWords, 90),\n settled_p50_ms: percentile(settled, 50),\n settled_p90_ms: percentile(settled, 90),\n // A turn that streamed no word failed the user whatever its envelope said.\n failure_rate: rows.length ? rows.filter(row => row.failed || row.firstTextMs === undefined || row.firstTextMs === null).length / rows.length : null,\n }\n}\n\nexport function createD1TurnTimingStore(options: { db: D1LikeForRollout; now?: () => number }) {\n const now = options.now ?? Date.now\n return {\n /** Record one settled turn. Idempotent on `turnId`. Never throws: telemetry must not fail a turn. */\n async record(row: TurnTimingRow): Promise<void> {\n try {\n await options.db.prepare(\n `INSERT OR IGNORE INTO rollout_turn_timing\n (turn_id, rollout, workspace_id, lane, first_text_ms, settled_ms, failed, failure_code, at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n ).bind(row.turnId, row.rollout, row.workspaceId, row.lane,\n row.firstTextMs === undefined ? null : Math.round(row.firstTextMs), Math.round(row.settledMs),\n row.failed ? 1 : 0, row.failureCode ?? null, row.at ?? now()).run()\n } catch (error) {\n console.error(JSON.stringify({ event: 'rollout_turn_timing_record_failed', turnId: row.turnId,\n error: error instanceof Error ? error.message.slice(0, 200) : String(error).slice(0, 200) }))\n }\n },\n\n /** The stage's numbers: its admitted workspaces' turns in `lane` since `since` (epoch ms). A row carries no\n * workspace creation time, so a workspace admitted only by a `new-since:` entry is not counted. */\n async measureStage(input: { rollout: string; stage: RolloutStage; lane: string; since: number }): Promise<StageMeasurement> {\n const { results = [] } = await options.db.prepare(\n `SELECT workspace_id, first_text_ms, settled_ms, failed FROM rollout_turn_timing\n WHERE rollout = ? AND lane = ? AND at >= ? ORDER BY at DESC LIMIT ?`,\n ).bind(input.rollout, input.lane, input.since, MEASURE_ROW_LIMIT).all<{\n workspace_id: string; first_text_ms: number | null; settled_ms: number; failed: number\n }>()\n const rows = results\n .filter(row => rolloutAdmits(input.stage.value, { id: row.workspace_id }))\n .map(row => ({ firstTextMs: row.first_text_ms ?? undefined, settledMs: row.settled_ms, failed: row.failed === 1 }))\n return {\n stage: input.stage.name,\n samples: rows.length,\n metrics: stageMetrics(rows),\n source: `rollout_turn_timing lane=${input.lane}`,\n window: { from: new Date(input.since).toISOString(), to: new Date(now()).toISOString() },\n }\n },\n }\n}\n"],"mappings":";;;;;AAuBO,IAAM,iCAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgC9C,IAAM,oBAAoB;AAE1B,SAAS,WAAW,QAA2B,GAA0B;AACvE,MAAI,CAAC,OAAO,OAAQ,QAAO;AAC3B,SAAO,OAAO,KAAK,IAAI,OAAO,SAAS,GAAG,KAAK,KAAM,IAAI,MAAO,OAAO,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I;AAAA,UACrF,OAAO,iBAAiB,QAAQ,MAAM,QAAQ,MAAM,GAAG,GAAG,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG,GAAG;AAAA,QAAE,CAAC,CAAC;AAAA,MAChG;AAAA,IACF;AAAA;AAAA;AAAA,IAIA,MAAM,aAAa,OAAyG;AAC1H,YAAM,EAAE,UAAU,CAAC,EAAE,IAAI,MAAM,QAAQ,GAAG;AAAA,QACxC;AAAA;AAAA,MAEF,EAAE,KAAK,MAAM,SAAS,MAAM,MAAM,MAAM,OAAO,iBAAiB,EAAE,IAE/D;AACH,YAAM,OAAO,QACV,OAAO,SAAO,cAAc,MAAM,MAAM,OAAO,EAAE,IAAI,IAAI,aAAa,CAAC,CAAC,EACxE,IAAI,UAAQ,EAAE,aAAa,IAAI,iBAAiB,QAAW,WAAW,IAAI,YAAY,QAAQ,IAAI,WAAW,EAAE,EAAE;AACpH,aAAO;AAAA,QACL,OAAO,MAAM,MAAM;AAAA,QACnB,SAAS,KAAK;AAAA,QACd,SAAS,aAAa,IAAI;AAAA,QAC1B,QAAQ,4BAA4B,MAAM,IAAI;AAAA,QAC9C,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,KAAK,EAAE,YAAY,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,YAAY,EAAE;AAAA,MACzF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Rollout guard: a staged rollout widens only when the stage it leaves met
3
+ * that stage's kill lines on measured production numbers.
4
+ *
5
+ * WHY. Hospitality's routed lane widened from two QA workspaces to `*` at a
6
+ * first-words p50 of 3.54 s, past kill lines of 2.5 s and 3.0 s
7
+ * (hospitality-agent #382, 2026-10-11). The numbers existed; nothing read them
8
+ * before the list changed. This module is the one place that reads them.
9
+ *
10
+ * THE LIST. A rollout is one comma-separated value, usually a deploy variable
11
+ * such as `HOSPITALITY_ROUTED_BUSINESS_IDS`: workspace ids, `*` for every
12
+ * workspace, `!<id>` to keep one out whatever else matches, and
13
+ * `new-since:<ISO time>` for workspaces created at or after that time.
14
+ * {@link rolloutAdmits} is the reference reading of that grammar.
15
+ *
16
+ * THE RULE ({@link decideRollout}).
17
+ * - A change that admits no workspace the current value did not (a narrowing,
18
+ * a rollback, the same stage) is always allowed: a guard that can block a
19
+ * rollback is worse than none.
20
+ * - A widening must land on a declared stage, the next one after the current
21
+ * value's stage, never past it.
22
+ * - The stage being left must have at least `minSamples` measured turns and
23
+ * every kill line met. A metric that was not measured fails its line.
24
+ * - A refusal names each reason (`first_words_p50_ms 3540 over kill line 2500`).
25
+ *
26
+ * Every decision, allowed or refused, is returned as one record the caller
27
+ * persists (the CLI appends it to a JSONL ledger and hands it to the
28
+ * config's `record`).
29
+ */
30
+ /** A kill line: the measured value must stay at or under `max` and at or over `min`. */
31
+ export interface RolloutKillLine {
32
+ max?: number;
33
+ min?: number;
34
+ }
35
+ export interface RolloutStage {
36
+ /** Short name used in refusals and records, e.g. `qa`, `all-but-recenter`. */
37
+ name: string;
38
+ /** The exact list value that defines this stage. */
39
+ value: string;
40
+ /** Turns the stage must have served, measured, before the rollout may leave it. */
41
+ minSamples: number;
42
+ /** Metric name → line. Metric names are the product's, e.g. `first_words_p50_ms`, `failure_rate`. */
43
+ kill: Record<string, RolloutKillLine>;
44
+ }
45
+ export interface RolloutPlan {
46
+ /** e.g. `hospitality-routed-chat`. */
47
+ name: string;
48
+ /** The deploy variable that carries the list, e.g. `HOSPITALITY_ROUTED_BUSINESS_IDS`. */
49
+ variable: string;
50
+ /** In widening order. */
51
+ stages: RolloutStage[];
52
+ }
53
+ /** Production numbers for one stage, from the product's own instrument. */
54
+ export interface StageMeasurement {
55
+ stage: string;
56
+ samples: number;
57
+ metrics: Record<string, number | null | undefined>;
58
+ /** Where the numbers came from (ledger, query, soak), for the record. */
59
+ source?: string;
60
+ window?: {
61
+ from: string;
62
+ to: string;
63
+ };
64
+ }
65
+ export interface RolloutDecision {
66
+ rollout: string;
67
+ variable: string;
68
+ from: {
69
+ value: string;
70
+ stage: string | null;
71
+ };
72
+ to: {
73
+ value: string;
74
+ stage: string | null;
75
+ };
76
+ widens: boolean;
77
+ decision: 'allowed' | 'refused';
78
+ /** Empty when allowed; each refusal reason otherwise. */
79
+ reasons: string[];
80
+ measured: StageMeasurement | null;
81
+ at: string;
82
+ }
83
+ export interface ParsedRolloutList {
84
+ all: boolean;
85
+ ids: ReadonlySet<string>;
86
+ excluded: ReadonlySet<string>;
87
+ /** Epoch ms of each `new-since:` entry. */
88
+ newSince: readonly number[];
89
+ }
90
+ export declare function parseRolloutList(value: string | null | undefined): ParsedRolloutList;
91
+ /** Whether a list admits one workspace. `createdAt` (epoch ms) is needed only for `new-since:` entries. */
92
+ export declare function rolloutAdmits(value: string | ParsedRolloutList, workspace: {
93
+ id: string;
94
+ createdAt?: number;
95
+ }): boolean;
96
+ /**
97
+ * Whether `to` may admit a workspace `from` does not. Conservative: a change it
98
+ * cannot prove narrower counts as a widening.
99
+ */
100
+ export declare function rolloutWidens(fromValue: string, toValue: string): boolean;
101
+ /** Canonical form for matching a value to a stage: entries trimmed and sorted. */
102
+ export declare function normalizeRolloutValue(value: string): string;
103
+ /** Each kill line the measurement misses, as a reason. Empty when every line holds. */
104
+ export declare function killLineBreaches(stage: RolloutStage, measured: StageMeasurement | null): string[];
105
+ export declare function validateRolloutPlan(plan: RolloutPlan): void;
106
+ /**
107
+ * Decide one change of the list. `measure` is called only for a widening, and
108
+ * only for the stage being left.
109
+ */
110
+ export declare function decideRollout(input: {
111
+ plan: RolloutPlan;
112
+ fromValue: string;
113
+ toValue: string;
114
+ measure(stage: RolloutStage): Promise<StageMeasurement | null>;
115
+ now?: () => Date;
116
+ }): Promise<RolloutDecision>;
@@ -0,0 +1,19 @@
1
+ import {
2
+ decideRollout,
3
+ killLineBreaches,
4
+ normalizeRolloutValue,
5
+ parseRolloutList,
6
+ rolloutAdmits,
7
+ rolloutWidens,
8
+ validateRolloutPlan
9
+ } from "../chunk-4JUEOVQS.js";
10
+ export {
11
+ decideRollout,
12
+ killLineBreaches,
13
+ normalizeRolloutValue,
14
+ parseRolloutList,
15
+ rolloutAdmits,
16
+ rolloutWidens,
17
+ validateRolloutPlan
18
+ };
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -17,6 +17,7 @@
17
17
  * other agent-app skills surface (`../skills`, `ProfileChannels.skillRefs`)
18
18
  * works without it, falling back to `inline` delivery.
19
19
  */
20
+ import { type AgentProfile, type AgentProfileFileMount } from '@tangle-network/agent-interface';
20
21
  import { type Harness } from '../harness/index';
21
22
  import { type ComposedSkills, type SkillEntry } from '../skills/index';
22
23
  /** Resolve the cwd-relative skill dir `resources.skills` refs materialize
@@ -75,3 +76,34 @@ export interface ComposeSkillsForHarnessInput {
75
76
  */
76
77
  export declare function composeSkillsForHarness(input: ComposeSkillsForHarnessInput): ComposedSkills;
77
78
  export type { ComposedSkills, SkillEntry } from '../skills/index';
79
+ /** A file that rides BESIDE a skill entry (kit sources, references, pinned
80
+ * requirements — anything the SKILL.md tells the agent to read or run).
81
+ * `path` is skill-dir-relative (`kit/iso-kit.mjs`, `references/x.md`). */
82
+ export interface SkillSupportFile {
83
+ path: string;
84
+ content: string;
85
+ }
86
+ /** Inline file mounts placing a skill's support files beside its entry on
87
+ * `harness`: `<skillDir>/<skillId>/<path>`. Empty when the harness has no
88
+ * cwd skill dir — the same posture as `resources.skills` itself (the
89
+ * platform skips skills there too), so nothing orphan lands in a workspace
90
+ * a harness will never read.
91
+ *
92
+ * This is the placement primitive for kit-carrying skills (vendored
93
+ * executable kits, reference trees). A growing program belongs in THESE
94
+ * mounts — never in an env var: runtimeSecrets values are capped (8192
95
+ * chars on the sandbox SDK) and a skill tree outgrew that cap in production
96
+ * once, taking every isolated turn down with a secret-provider refusal. */
97
+ export declare function skillSupportFileMounts(harness: Harness, skillId: string, files: readonly SkillSupportFile[]): AgentProfileFileMount[];
98
+ /** Attach a skill's support files to `profile` for `harness`, idempotently.
99
+ *
100
+ * Replacement is by EXACT CONTENT under the skill's own subtree (any path
101
+ * ending `/<skillId>/<path>` whose bytes match a support file of THIS call):
102
+ * re-deriving the same profile for another harness replaces this skill's
103
+ * own mounts wherever they previously pointed, while pack-declared files
104
+ * with similar paths stay untouched. With no skill dir the skill's own
105
+ * mounts are dropped (and nothing added) — mirroring how the platform
106
+ * treats the skill entry itself on that harness. */
107
+ export declare function withSkillSupportFiles<P extends {
108
+ resources?: AgentProfile['resources'];
109
+ }>(profile: P, harness: Harness, skillId: string, files: readonly SkillSupportFile[]): P;
@@ -8,6 +8,9 @@ import {
8
8
  import "../chunk-PV33JZKV.js";
9
9
 
10
10
  // src/skills-placement/index.ts
11
+ import {
12
+ defineInlineResource
13
+ } from "@tangle-network/agent-interface";
11
14
  import { skillDirForHarness } from "@tangle-network/agent-profile-materialize";
12
15
  var HARNESS_BRIDGE = {
13
16
  opencode: "opencode",
@@ -52,9 +55,48 @@ function composeSkillsForHarness(input) {
52
55
  `composeSkillsForHarness: "${harness}" has no native skill-mount directory. Inlining ${relevant.length} skill(s) (${bytes} bytes) into its system prompt would silently convert mounted skills into prompt text \u2014 a 151,882-byte prompt shipped this way once, and oversized prompts degrade toward empty answers. Mount the skills instead: pick a harness with native skill support (${mountable.join(", ")}), or pass onNoSkillDir: 'inline' to opt in explicitly and accept the inlined bytes.`
53
56
  );
54
57
  }
58
+ function skillSupportFileMounts(harness, skillId, files) {
59
+ const skillDir = resolveSkillDir(harness);
60
+ if (!skillDir || files.length === 0) return [];
61
+ return files.map((file) => ({
62
+ path: `${skillDir}/${skillId}/${file.path}`,
63
+ resource: defineInlineResource(`${skillId}/${file.path}`, file.content)
64
+ }));
65
+ }
66
+ function withSkillSupportFiles(profile, harness, skillId, files) {
67
+ const hasSkillDir = resolveSkillDir(harness) !== null;
68
+ const desired = skillSupportFileMounts(harness, skillId, files);
69
+ const desiredByPath = new Map(
70
+ desired.map((mount) => [mount.path, mount.resource])
71
+ );
72
+ const byRelPath = new Map(files.map((file) => [file.path, file.content]));
73
+ const suffix = `/${skillId}/`;
74
+ const relUnderSkill = (path) => {
75
+ const at = path.lastIndexOf(suffix);
76
+ return at < 0 ? null : path.slice(at + suffix.length);
77
+ };
78
+ const isStaleOurs = (mount) => {
79
+ if (mount.resource.kind !== "inline") return false;
80
+ const rel = relUnderSkill(mount.path);
81
+ if (rel === null || byRelPath.get(rel) !== mount.resource.content) return false;
82
+ const desiredHere = desiredByPath.get(mount.path);
83
+ return !hasSkillDir || desiredHere === void 0 || desiredHere.kind !== "inline" || desiredHere.content !== mount.resource.content;
84
+ };
85
+ const existing = profile.resources?.files ?? [];
86
+ const retained = existing.filter((mount) => !isStaleOurs(mount));
87
+ const taken = new Set(retained.map((mount) => mount.path));
88
+ const additions = desired.filter((mount) => !taken.has(mount.path));
89
+ if (retained.length === existing.length && additions.length === 0) return profile;
90
+ return {
91
+ ...profile,
92
+ resources: { ...profile.resources ?? {}, files: [...retained, ...additions] }
93
+ };
94
+ }
55
95
  export {
56
96
  composeSkillsForHarness,
57
97
  resolveSkillDir,
58
- unsupportedSkillHarnesses
98
+ skillSupportFileMounts,
99
+ unsupportedSkillHarnesses,
100
+ withSkillSupportFiles
59
101
  };
60
102
  //# sourceMappingURL=index.js.map
@@ -1 +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 { 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`, `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"],"mappings":";;;;;;;;;;AAqBA,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,0BAA0B,WAAyC;AACjF,QAAM,OAAO,oBAAI,IAAa;AAC9B,QAAM,MAAiB,CAAC;AACxB,aAAW,WAAW,WAAW;AAC/B,QAAI,gBAAgB,OAAO,MAAM,KAAM;AACvC,QAAI,KAAK,IAAI,OAAO,EAAG;AACvB,SAAK,IAAI,OAAO;AAChB,QAAI,KAAK,OAAO;AAAA,EAClB;AACA,SAAO;AACT;AAyBA,SAAS,4BAAuC;AAC9C,SAAO,gBAAgB,OAAO,CAAC,YAAY,gBAAgB,OAAO,MAAM,IAAI;AAC9E;AA+BO,SAAS,wBAAwB,OAAqD;AAC3F,QAAM,EAAE,QAAQ,SAAS,MAAM,SAAS,eAAe,QAAQ,IAAI;AACnE,QAAM,WAAW,gBAAgB,OAAO;AACxC,MAAI,SAAU,QAAO,cAAc,EAAE,QAAQ,MAAM,WAAW,UAAU,MAAM,QAAQ,CAAC;AACvF,MAAI,iBAAiB,SAAU,QAAO,cAAc,EAAE,QAAQ,MAAM,UAAU,MAAM,QAAQ,CAAC;AAE7F,QAAM,WAAW,OAAO,OAAO,OAAO,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI;AAChE,QAAM,gBAAgB,mBAAmB,EAAE,QAAQ,MAAM,QAAQ,CAAC;AAClE,QAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,aAAa,EAAE;AACtD,QAAM,YAAY,0BAA0B;AAC5C,QAAM,IAAI;AAAA,IACR,6BAA6B,OAAO,mDACtB,SAAS,MAAM,cAAc,KAAK,qQAGrB,UAAU,KAAK,IAAI,CAAC;AAAA,EAEjD;AACF;","names":[]}
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 {\n defineInlineResource,\n type AgentProfile,\n type AgentProfileFileMount,\n} from '@tangle-network/agent-interface'\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`, `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/** 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): 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(`${skillId}/${file.path}`, file.content),\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. */\nexport function withSkillSupportFiles<\n P extends { resources?: AgentProfile['resources'] },\n>(profile: P, harness: Harness, skillId: string, files: readonly SkillSupportFile[]): P {\n const hasSkillDir = resolveSkillDir(harness) !== null\n const desired = skillSupportFileMounts(harness, skillId, files)\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), and a mount already identical to\n // what we would add is kept as-is, so re-deriving for the SAME harness\n // returns the profile unchanged.\n const isStaleOurs = (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 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) => !isStaleOurs(mount))\n const taken = new Set(retained.map((mount) => mount.path))\n const additions = desired.filter((mount) => !taken.has(mount.path))\n if (retained.length === existing.length && additions.length === 0) return profile\n return {\n ...profile,\n resources: { ...(profile.resources ?? {}), files: [...retained, ...additions] },\n }\n}\n"],"mappings":";;;;;;;;;;AAoBA;AAAA,EACE;AAAA,OAGK;AAEP,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,0BAA0B,WAAyC;AACjF,QAAM,OAAO,oBAAI,IAAa;AAC9B,QAAM,MAAiB,CAAC;AACxB,aAAW,WAAW,WAAW;AAC/B,QAAI,gBAAgB,OAAO,M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F;AACF;","names":[]}
@@ -50,9 +50,9 @@ import {
50
50
  terminalizeDanglingAssistantToolUpdates,
51
51
  terminalizeDanglingToolPart,
52
52
  terminalizeDanglingToolParts
53
- } from "../chunk-ZGUXI5SI.js";
54
- import "../chunk-6VQCFJWP.js";
53
+ } from "../chunk-XNKLQG26.js";
55
54
  import "../chunk-LQYIBL3G.js";
55
+ import "../chunk-6VQCFJWP.js";
56
56
  export {
57
57
  DEFAULT_RUNNING_TURN_LEASE_MS,
58
58
  DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS,
@@ -39,8 +39,9 @@ import {
39
39
  } from "../chunk-6PRQ45QE.js";
40
40
  import {
41
41
  useInfiniteScroll
42
- } from "../chunk-5S5ANZBS.js";
42
+ } from "../chunk-HZGKPWVA.js";
43
43
  import "../chunk-NTSZGBHZ.js";
44
+ import "../chunk-SJWIZT7B.js";
44
45
  import {
45
46
  CheckGlyph,
46
47
  ChevronDown,
@@ -51,7 +52,6 @@ import {
51
52
  PopoverSurface,
52
53
  usePopover
53
54
  } from "../chunk-GE7Y7ODP.js";
54
- import "../chunk-SJWIZT7B.js";
55
55
  import {
56
56
  ProviderLogo
57
57
  } from "../chunk-MLG6XKPV.js";
@@ -138,18 +138,27 @@ import {
138
138
  withoutRecordGridCreated,
139
139
  withoutRecordGridRemoved,
140
140
  withoutRecordGridUpdate
141
- } from "../chunk-XPP653RG.js";
141
+ } from "../chunk-JEM4BKR4.js";
142
142
  import {
143
143
  SessionHistoryPanel,
144
144
  formatSessionTimestamp,
145
145
  useInfiniteScroll,
146
146
  useSessionActions,
147
147
  useSessionHistory
148
- } from "../chunk-5S5ANZBS.js";
148
+ } from "../chunk-HZGKPWVA.js";
149
149
  import {
150
150
  MENTION_PILL_CLASS
151
151
  } from "../chunk-3HUFJ5LO.js";
152
152
  import "../chunk-FBVLEGEG.js";
153
+ import {
154
+ WorkspaceInitial,
155
+ WorkspaceSwitcher
156
+ } from "../chunk-GHOXLL2T.js";
157
+ import "../chunk-NTSZGBHZ.js";
158
+ import {
159
+ tabTerminalConnectionId,
160
+ useSandboxTerminalConnection
161
+ } from "../chunk-E4AY62T2.js";
153
162
  import {
154
163
  AGENT_PROFILE_EDITOR_SECTIONS,
155
164
  AgentProfileEditor,
@@ -183,8 +192,9 @@ import {
183
192
  preloadWhenIdle,
184
193
  useComposerAttachments,
185
194
  useDictation
186
- } from "../chunk-4DEI6QC5.js";
195
+ } from "../chunk-NNNAC3DV.js";
187
196
  import "../chunk-L7MB2LLM.js";
197
+ import "../chunk-SJWIZT7B.js";
188
198
  import {
189
199
  AgentSessionControls,
190
200
  AgentSettingsPopover,
@@ -195,11 +205,6 @@ import {
195
205
  isAcceptedFileType,
196
206
  renamePastedImages
197
207
  } from "../chunk-T6BAHD5S.js";
198
- import {
199
- WorkspaceInitial,
200
- WorkspaceSwitcher
201
- } from "../chunk-GHOXLL2T.js";
202
- import "../chunk-NTSZGBHZ.js";
203
208
  import "../chunk-WTHMHOU2.js";
204
209
  import {
205
210
  DEFAULT_EFFORT_LEVELS,
@@ -219,11 +224,6 @@ import {
219
224
  usePending,
220
225
  usePopover
221
226
  } from "../chunk-GE7Y7ODP.js";
222
- import {
223
- tabTerminalConnectionId,
224
- useSandboxTerminalConnection
225
- } from "../chunk-E4AY62T2.js";
226
- import "../chunk-SJWIZT7B.js";
227
227
  import {
228
228
  ProviderLogo
229
229
  } from "../chunk-MLG6XKPV.js";
@@ -243,7 +243,7 @@ import {
243
243
  isChatAttachmentPart,
244
244
  mentionInputToPart,
245
245
  mentionPartsFromMessageParts
246
- } from "../chunk-GU7OZFU7.js";
246
+ } from "../chunk-VXWEJ7F2.js";
247
247
  import "../chunk-ZVEEWGDK.js";
248
248
  import {
249
249
  DISPATCH_MAX_MEDIA_PARTS,
@@ -271,7 +271,8 @@ import {
271
271
  import "../chunk-TXD5HXLE.js";
272
272
  import {
273
273
  attachmentPartKey
274
- } from "../chunk-ZGUXI5SI.js";
274
+ } from "../chunk-XNKLQG26.js";
275
+ import "../chunk-LQYIBL3G.js";
275
276
  import {
276
277
  INTERACTION_CANCEL_EVENT,
277
278
  INTERACTION_EVENT,
@@ -297,7 +298,6 @@ import {
297
298
  questionInteractionContentSignature,
298
299
  stampInteractionAnswers
299
300
  } from "../chunk-6VQCFJWP.js";
300
- import "../chunk-LQYIBL3G.js";
301
301
  export {
302
302
  AGENT_PROFILE_EDITOR_SECTIONS,
303
303
  ATTACHMENT_ACCEPT,
@@ -6,6 +6,11 @@ import {
6
6
  ActionDialog,
7
7
  ActionDialogButton
8
8
  } from "../chunk-NTSZGBHZ.js";
9
+ import {
10
+ buildSessionNavItem,
11
+ composeSidebarSessions,
12
+ resolveActiveNavId
13
+ } from "../chunk-SJWIZT7B.js";
9
14
  import {
10
15
  usePopoverDialog
11
16
  } from "../chunk-WTHMHOU2.js";
@@ -15,11 +20,6 @@ import {
15
20
  PopoverSurface,
16
21
  usePopover
17
22
  } from "../chunk-GE7Y7ODP.js";
18
- import {
19
- buildSessionNavItem,
20
- composeSidebarSessions,
21
- resolveActiveNavId
22
- } from "../chunk-SJWIZT7B.js";
23
23
  import "../chunk-MLG6XKPV.js";
24
24
  import "../chunk-AMUXRAUO.js";
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.60.132",
3
+ "version": "0.60.134",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [
@@ -44,6 +44,7 @@
44
44
  "agent-app-verify-proof": "./dist/signoff/proof-cli.js",
45
45
  "tangle-agent": "bin/tangle-agent.mjs",
46
46
  "agent-app-invariants": "./dist/launch-invariants/cli.js",
47
+ "agent-app-rollout-check": "./dist/rollout/cli.js",
47
48
  "agent-app-journeys": "./dist/journeys/cli.js"
48
49
  },
49
50
  "exports": {
@@ -278,6 +279,16 @@
278
279
  "import": "./dist/launch-invariants/index.js",
279
280
  "default": "./dist/launch-invariants/index.js"
280
281
  },
282
+ "./rollout": {
283
+ "types": "./dist/rollout/index.d.ts",
284
+ "import": "./dist/rollout/index.js",
285
+ "default": "./dist/rollout/index.js"
286
+ },
287
+ "./rollout/d1": {
288
+ "types": "./dist/rollout/d1.d.ts",
289
+ "import": "./dist/rollout/d1.js",
290
+ "default": "./dist/rollout/d1.js"
291
+ },
281
292
  "./launch-invariants/testing": {
282
293
  "types": "./dist/launch-invariants/testing.d.ts",
283
294
  "import": "./dist/launch-invariants/testing.js",