@tangle-network/agent-app 0.58.13 → 0.58.15
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/agent-profiles/d1.js +4 -1
- package/dist/agent-profiles/d1.js.map +1 -1
- package/dist/agent-profiles/index.d.ts +1 -1
- package/dist/agent-profiles/index.js +10 -1
- package/dist/agent-profiles/self-management.d.ts +77 -0
- package/dist/assistant/index.js +7 -7
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/index.js +3 -3
- package/dist/{chunk-W5VBZTNN.js → chunk-4ZMZDE24.js} +9 -9
- package/dist/{chunk-AUA75YFF.js → chunk-57TTYY6T.js} +2 -2
- package/dist/{chunk-WZLE5SPT.js → chunk-EXBAVMMK.js} +10 -10
- package/dist/chunk-EXBAVMMK.js.map +1 -0
- package/dist/{chunk-W3L2OUBH.js → chunk-GIBNG64C.js} +3 -3
- package/dist/{chunk-W3L2OUBH.js.map → chunk-GIBNG64C.js.map} +1 -1
- package/dist/{chunk-YEBSFADG.js → chunk-IBTM5SAZ.js} +121 -1
- package/dist/chunk-IBTM5SAZ.js.map +1 -0
- package/dist/{chunk-NDI6XDRZ.js → chunk-MLG7YSTS.js} +3 -3
- package/dist/{chunk-X374TCDT.js → chunk-POE5UUUT.js} +3 -3
- package/dist/{chunk-LVSKKDX2.js → chunk-T5U7LDQW.js} +4 -4
- package/dist/chunk-T5U7LDQW.js.map +1 -0
- package/dist/{chunk-2WELYICW.js → chunk-TUNRLEDH.js} +2 -2
- package/dist/{mention-editor-4EWHJ5G5.js → mention-editor-W2GG2NZ7.js} +2 -2
- package/dist/sandbox/index.js +3 -3
- package/dist/studio-react/index.js +3 -3
- package/dist/tools/index.js +3 -3
- package/dist/web-react/controls.d.ts +4 -4
- package/dist/web-react/index.js +7 -7
- package/dist/workspace-react/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-LVSKKDX2.js.map +0 -1
- package/dist/chunk-WZLE5SPT.js.map +0 -1
- package/dist/chunk-YEBSFADG.js.map +0 -1
- /package/dist/{chunk-W5VBZTNN.js.map → chunk-4ZMZDE24.js.map} +0 -0
- /package/dist/{chunk-AUA75YFF.js.map → chunk-57TTYY6T.js.map} +0 -0
- /package/dist/{chunk-NDI6XDRZ.js.map → chunk-MLG7YSTS.js.map} +0 -0
- /package/dist/{chunk-X374TCDT.js.map → chunk-POE5UUUT.js.map} +0 -0
- /package/dist/{chunk-2WELYICW.js.map → chunk-TUNRLEDH.js.map} +0 -0
- /package/dist/{mention-editor-4EWHJ5G5.js.map → mention-editor-W2GG2NZ7.js.map} +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineAppTool
|
|
3
|
+
} from "./chunk-4CBU7QIL.js";
|
|
4
|
+
import {
|
|
5
|
+
ToolInputError
|
|
6
|
+
} from "./chunk-NZNXHCVU.js";
|
|
7
|
+
|
|
1
8
|
// src/agent-profiles/index.ts
|
|
2
9
|
import {
|
|
3
10
|
canonicalAgentProfileDigest,
|
|
@@ -6,6 +13,116 @@ import {
|
|
|
6
13
|
sha256Utf8
|
|
7
14
|
} from "@tangle-network/agent-interface";
|
|
8
15
|
import { z } from "zod";
|
|
16
|
+
|
|
17
|
+
// src/agent-profiles/self-management.ts
|
|
18
|
+
var PERMITTED_SELF_MOUNT_DIMENSIONS = ["skills"];
|
|
19
|
+
function createInMemorySelfMountStorage() {
|
|
20
|
+
const state = /* @__PURE__ */ new Map();
|
|
21
|
+
return {
|
|
22
|
+
async get(scope) {
|
|
23
|
+
return state.get(scope) ?? [];
|
|
24
|
+
},
|
|
25
|
+
async set(scope, ids) {
|
|
26
|
+
state.set(scope, [...new Set(ids)].sort());
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function catalogLine(skills) {
|
|
31
|
+
return skills.map((s) => `${s.id} (${s.description})`).join("; ");
|
|
32
|
+
}
|
|
33
|
+
function createMountProfileChangeTool(deps) {
|
|
34
|
+
const { skills, storage, scopeKey } = deps;
|
|
35
|
+
const baseline = deps.baseline?.trim() || void 0;
|
|
36
|
+
const maxMounted = deps.maxMounted ?? 12;
|
|
37
|
+
const known = new Set(skills.map((s) => s.id));
|
|
38
|
+
if (known.size !== skills.length) throw new Error("createMountProfileChangeTool: duplicate skill ids in the catalog");
|
|
39
|
+
if (baseline && !known.has(baseline)) throw new Error(`createMountProfileChangeTool: baseline "${baseline}" is not in the catalog`);
|
|
40
|
+
return defineAppTool({
|
|
41
|
+
name: deps.name ?? "mount_profile_change",
|
|
42
|
+
description: `Apply a permitted, idempotent change to the mounted skills on this profile. Permitted dimension: skills ({ add: [ids], remove: [ids] }) \u2014 anything else is refused. Re-applying the same change is a no-op. Takes effect the next time the profile renders. Catalog: ${catalogLine(skills)}.`,
|
|
43
|
+
parameters: {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
changes: {
|
|
47
|
+
type: "object",
|
|
48
|
+
description: `The profile delta. Permitted dimensions: ${PERMITTED_SELF_MOUNT_DIMENSIONS.join(", ")}.`,
|
|
49
|
+
properties: {
|
|
50
|
+
skills: {
|
|
51
|
+
type: "object",
|
|
52
|
+
description: "Skill mounts: catalog ids to add or remove.",
|
|
53
|
+
properties: {
|
|
54
|
+
add: { type: "array", items: { type: "string" }, description: "Catalog skill ids to mount." },
|
|
55
|
+
remove: { type: "array", items: { type: "string" }, description: "Mounted skill ids to unmount." }
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
additionalProperties: false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
required: ["changes"],
|
|
64
|
+
additionalProperties: false
|
|
65
|
+
},
|
|
66
|
+
async execute(args, ctx) {
|
|
67
|
+
const changes = args.changes ?? {};
|
|
68
|
+
const unknownDimensions = Object.keys(changes).filter(
|
|
69
|
+
(d) => !PERMITTED_SELF_MOUNT_DIMENSIONS.includes(d)
|
|
70
|
+
);
|
|
71
|
+
if (unknownDimensions.length > 0) {
|
|
72
|
+
throw new ToolInputError(
|
|
73
|
+
"mount_profile_change",
|
|
74
|
+
`dimensions [${unknownDimensions.join(", ")}] are not agent-changeable. Permitted dimensions: ${PERMITTED_SELF_MOUNT_DIMENSIONS.join(", ")}.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
const delta = changes.skills ?? {};
|
|
78
|
+
const add = [...new Set((delta.add ?? []).map((s) => s.trim()).filter(Boolean))];
|
|
79
|
+
const remove = [...new Set((delta.remove ?? []).map((s) => s.trim()).filter(Boolean))];
|
|
80
|
+
if (add.length === 0 && remove.length === 0) {
|
|
81
|
+
throw new ToolInputError("mount_profile_change", "empty delta: provide skills.add and/or skills.remove");
|
|
82
|
+
}
|
|
83
|
+
const invalid = [...add, ...remove].filter((id) => !known.has(id));
|
|
84
|
+
if (invalid.length > 0) {
|
|
85
|
+
throw new ToolInputError(
|
|
86
|
+
"mount_profile_change",
|
|
87
|
+
`unknown skill ids: ${invalid.join(", ")}. Catalog: ${[...known].sort().join(", ")}.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if (baseline && remove.includes(baseline)) {
|
|
91
|
+
throw new ToolInputError(
|
|
92
|
+
"mount_profile_change",
|
|
93
|
+
`refused: "${baseline}" is the always-on baseline and cannot be removed`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
const scope = scopeKey(ctx);
|
|
97
|
+
const stored = await storage.get(scope);
|
|
98
|
+
const before = [.../* @__PURE__ */ new Set([...stored, ...baseline ? [baseline] : []])].sort();
|
|
99
|
+
const mounted = new Set(before);
|
|
100
|
+
for (const id of add) mounted.add(id);
|
|
101
|
+
for (const id of remove) mounted.delete(id);
|
|
102
|
+
if (baseline) mounted.add(baseline);
|
|
103
|
+
const effective = [...mounted].sort();
|
|
104
|
+
if (effective.length > maxMounted) {
|
|
105
|
+
throw new ToolInputError(
|
|
106
|
+
"mount_profile_change",
|
|
107
|
+
`refused: ${effective.length} skills exceeds the ${maxMounted}-skill mount limit`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (JSON.stringify(before) === JSON.stringify(effective)) {
|
|
111
|
+
return { ok: true, mounted: [], removed: [], effective, note: "no change (already in that state) \u2014 idempotent no-op" };
|
|
112
|
+
}
|
|
113
|
+
await storage.set(scope, effective);
|
|
114
|
+
return {
|
|
115
|
+
ok: true,
|
|
116
|
+
mounted: effective.filter((id) => !before.includes(id)),
|
|
117
|
+
removed: before.filter((id) => !effective.includes(id)),
|
|
118
|
+
effective,
|
|
119
|
+
note: "applied \u2014 takes effect the next time the profile renders"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/agent-profiles/index.ts
|
|
9
126
|
var PROFILE_CHANGE_POLICY = {
|
|
10
127
|
textEdit: { admission: "automatic", conversation: "same", destructive: false },
|
|
11
128
|
sameAuthoritySwitch: { admission: "prepare-then-flip", conversation: "same", destructive: false },
|
|
@@ -460,6 +577,9 @@ function profileTools(context) {
|
|
|
460
577
|
}
|
|
461
578
|
|
|
462
579
|
export {
|
|
580
|
+
PERMITTED_SELF_MOUNT_DIMENSIONS,
|
|
581
|
+
createInMemorySelfMountStorage,
|
|
582
|
+
createMountProfileChangeTool,
|
|
463
583
|
PROFILE_CHANGE_POLICY,
|
|
464
584
|
ProfileConflictError,
|
|
465
585
|
ProfileAccessError,
|
|
@@ -485,4 +605,4 @@ export {
|
|
|
485
605
|
profileTextChange,
|
|
486
606
|
profileTools
|
|
487
607
|
};
|
|
488
|
-
//# sourceMappingURL=chunk-
|
|
608
|
+
//# sourceMappingURL=chunk-IBTM5SAZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agent-profiles/index.ts","../src/agent-profiles/self-management.ts"],"sourcesContent":["/** Chat-owned profile revisions and member/channel bindings. Execution stays in the substrate. */\nimport {\n canonicalAgentProfileDigest,\n diffAgentProfiles,\n snapshotAgentProfile,\n sha256Utf8,\n type AgentProfile,\n type AgentProfileDiff,\n} from '@tangle-network/agent-interface'\nimport { z } from 'zod'\nimport type { McpToolDefinition } from '../tools'\n\nexport type ProfileAuthorKind = 'person' | 'agent' | 'optimizer'\nexport type ProfileRevisionState = 'active' | 'candidate' | 'pending-consent'\n\n/** The decision table used by every write path; products may narrow access, never widen it. */\nexport const PROFILE_CHANGE_POLICY = {\n textEdit: { admission: 'automatic', conversation: 'same', destructive: false },\n sameAuthoritySwitch: { admission: 'prepare-then-flip', conversation: 'same', destructive: false },\n differentAuthoritySwitch: { admission: 'prepare-then-flip', conversation: 'same', destructive: false },\n authorityEdit: { admission: 'editor-consent', conversation: 'same', destructive: false },\n optimizerRevision: { admission: 'eval-promotion', conversation: 'same', destructive: false },\n destructiveAction: { admission: 'reaper-only', conversation: 'none', destructive: true },\n} as const\n\nexport interface ProfileRevision {\n id: string\n workspaceId: string\n profileId: string\n parentId: string | null\n profile: AgentProfile\n knowledgeText: string\n author: { kind: ProfileAuthorKind; id: string }\n reason: string\n /** `null` means an older stored revision did not record the knowledge delta. */\n knowledgeTextChanged?: boolean | null\n diff: AgentProfileDiff[]\n authorityDigest: string\n /** ADC hash of the public profile plan, without per-turn product attachments. */\n planDigest: string\n state: ProfileRevisionState\n createdAt: number\n}\n\nexport interface ProfileBindingKey {\n workspaceId: string\n memberId: string\n /** `chat`, or a product-scoped phone line and sender key. */\n channel: string\n}\n\nexport interface ProfileBinding extends ProfileBindingKey {\n profileId: string\n pinnedRevisionId: string | null\n authorityDigest: string\n planDigest: string\n version: number\n}\n\nexport interface ProfileTurnPin {\n workspaceId: string\n memberId: string\n channel: string\n messageId: string\n inputHash: string\n profileId: string\n revisionId: string\n authorityDigest: string\n /** Effective ADC plan selected by the executor, including allowed turn attachments. */\n planDigest: string\n}\n\n/** Remove events name only adds they observed; a concurrent add survives. */\nexport interface ProfileKnowledgeEvent {\n id: string\n workspaceId: string\n profileId: string\n documentId: string\n kind: 'add' | 'remove'\n content: string | null\n observedAddIds: string[]\n createdAt: number\n}\n\nexport interface ProfileKnowledgeDocument {\n documentId: string\n content: string\n addEventId: string\n}\n\nexport interface ProfileSwitchReceipt {\n key: ProfileBindingKey\n messageId: string\n inputHash: string\n /** Visible conversation that should render this switch marker on reload. */\n conversationId?: string | null\n createdAt?: number\n profileId: string | null\n revisionId: string | null\n /** A rollback binds the previous immutable revision, not the current head. */\n pinnedRevisionId: string | null\n authorityDigest: string | null\n planDigest: string | null\n outcome: 'switched' | 'refused'\n message: string\n /** Workspace resource collisions retain the original and place the profile copy beside it. */\n conflicts: string[]\n}\n\nexport interface ProfileRevisionStore {\n getActiveRevision(workspaceId: string, profileId: string): Promise<ProfileRevision | null>\n getRevision(workspaceId: string, profileId: string, revisionId: string): Promise<ProfileRevision | null>\n /** Append the immutable row and optionally an activation event in one guarded transaction. */\n appendRevision(revision: ProfileRevision, expectedActiveId: string | null, activate: boolean): Promise<boolean>\n /** Promotion appends an activation event; the historical revision remains immutable. */\n promoteRevision(workspaceId: string, profileId: string, revisionId: string, expectedActiveId: string | null): Promise<boolean>\n getBinding(key: ProfileBindingKey): Promise<ProfileBinding | null>\n getSwitchReceipt(key: ProfileBindingKey, messageId: string, inputHash: string): Promise<ProfileSwitchReceipt | null>\n /** Receipt and binding event append atomically; a refusal leaves the binding untouched. */\n recordSwitch(receipt: ProfileSwitchReceipt, expectedVersion: number): Promise<ProfileSwitchReceipt>\n /** Persist one immutable pin under a message id; retries must return the same pin. */\n pinTurn(pin: ProfileTurnPin, expectedBindingVersion: number): Promise<ProfileTurnPin>\n getTurnPin(key: ProfileBindingKey, messageId: string, inputHash: string): Promise<ProfileTurnPin | null>\n listKnowledgeEvents(workspaceId: string, profileId: string): Promise<ProfileKnowledgeEvent[]>\n appendKnowledgeEvent(event: ProfileKnowledgeEvent): Promise<void>\n}\n\nexport class ProfileConflictError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'ProfileConflictError'\n }\n}\n\nexport class ProfileAccessError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'ProfileAccessError'\n }\n}\n\n/** Keep the existing diff column readable while adding the separate knowledge text axis. */\nexport function parseProfileRevisionDiff(value: string): {\n diff: AgentProfileDiff[]; knowledgeTextChanged: boolean | null\n} {\n const parsed: unknown = JSON.parse(value)\n if (Array.isArray(parsed)) return { diff: parsed as AgentProfileDiff[], knowledgeTextChanged: null }\n if (!parsed || typeof parsed !== 'object' || !('profile' in parsed) ||\n !Array.isArray(parsed.profile) || !('knowledgeTextChanged' in parsed) ||\n (parsed.knowledgeTextChanged !== null && typeof parsed.knowledgeTextChanged !== 'boolean')) {\n throw new TypeError('Stored profile revision diff is invalid')\n }\n return { diff: parsed.profile as AgentProfileDiff[],\n knowledgeTextChanged: parsed.knowledgeTextChanged }\n}\n\nexport function serializeProfileRevisionDiff(revision: Pick<ProfileRevision, 'diff' | 'knowledgeTextChanged'>): string {\n return JSON.stringify({ profile: revision.diff, knowledgeTextChanged: revision.knowledgeTextChanged ?? null })\n}\n\n/** Remove exactly the declared text axes. Unknown future fields remain authority. */\nexport function profileAuthority(profile: AgentProfile): AgentProfile {\n const { name: _name, description: _description, prompt, ...authority } = profile\n const { systemPrompt: _systemPrompt, instructions: _instructions, ...promptAuthority } = prompt ?? {}\n return { ...authority, ...(Object.keys(promptAuthority).length ? { prompt: promptAuthority } : {}) }\n}\n\nexport function profileAuthorityDigest(profile: AgentProfile): string {\n return canonicalAgentProfileDigest(profileAuthority(snapshotAgentProfile(profile)))\n}\n\nexport function projectKnowledgeDocuments(events: readonly ProfileKnowledgeEvent[]): ProfileKnowledgeDocument[] {\n const removed = new Set(events.filter(event => event.kind === 'remove').flatMap(event => event.observedAddIds))\n const visible = events.filter(event => event.kind === 'add' && !removed.has(event.id))\n const latest = new Map<string, ProfileKnowledgeEvent>()\n for (const event of visible) {\n const prior = latest.get(event.documentId)\n if (!prior || event.createdAt > prior.createdAt ||\n (event.createdAt === prior.createdAt && event.id > prior.id)) latest.set(event.documentId, event)\n }\n return [...latest.values()].sort((a, b) => a.documentId.localeCompare(b.documentId))\n .map(event => ({ documentId: event.documentId, content: event.content!, addEventId: event.id }))\n}\n\nexport async function addProfileKnowledgeDocument(input: {\n store: ProfileRevisionStore\n workspaceId: string\n profileId: string\n documentId: string\n content: string\n actorRole: 'owner' | 'manager' | 'member' | 'viewer'\n id?: string\n now?: number\n}): Promise<ProfileKnowledgeEvent> {\n if (input.actorRole !== 'owner' && input.actorRole !== 'manager') {\n throw new ProfileAccessError('Profile management is required')\n }\n if (!input.documentId || !input.content) throw new TypeError('A knowledge document needs an id and content')\n const event: ProfileKnowledgeEvent = { id: input.id ?? crypto.randomUUID(),\n workspaceId: input.workspaceId, profileId: input.profileId, documentId: input.documentId,\n kind: 'add', content: input.content, observedAddIds: [], createdAt: input.now ?? Date.now() }\n await input.store.appendKnowledgeEvent(event)\n return event\n}\n\nexport async function removeProfileKnowledgeDocument(input: {\n store: ProfileRevisionStore\n workspaceId: string\n profileId: string\n documentId: string\n actorRole: 'owner' | 'manager' | 'member' | 'viewer'\n id?: string\n now?: number\n}): Promise<ProfileKnowledgeEvent> {\n if (input.actorRole !== 'owner' && input.actorRole !== 'manager') {\n throw new ProfileAccessError('Profile management is required')\n }\n const events = await input.store.listKnowledgeEvents(input.workspaceId, input.profileId)\n const removed = new Set(events.filter(event => event.kind === 'remove').flatMap(event => event.observedAddIds))\n const observedAddIds = events.filter(event => event.kind === 'add' &&\n event.documentId === input.documentId && !removed.has(event.id)).map(event => event.id)\n const event: ProfileKnowledgeEvent = { id: input.id ?? crypto.randomUUID(),\n workspaceId: input.workspaceId, profileId: input.profileId, documentId: input.documentId,\n kind: 'remove', content: null, observedAddIds, createdAt: input.now ?? Date.now() }\n await input.store.appendKnowledgeEvent(event)\n return event\n}\n\n/** The per-turn text overlay is validated without admitting tools, model, MCP or resources. */\nexport function bindProfileText(consentedBaseline: AgentProfile, selected: AgentProfile): AgentProfile {\n if (profileAuthorityDigest(consentedBaseline) !== profileAuthorityDigest(selected)) {\n throw new ProfileAccessError('Profile authority differs; prepare its managed plan before the next turn')\n }\n // Profiles are digested as RFC 8785 JSON, which has no `undefined`: an\n // absent selected field removes the baseline's value instead of storing it.\n const result: AgentProfile = { ...consentedBaseline, name: selected.name }\n if (selected.description === undefined) delete result.description\n else result.description = selected.description\n const prompt: NonNullable<AgentProfile['prompt']> = { ...consentedBaseline.prompt }\n const { systemPrompt, instructions } = selected.prompt ?? {}\n if (systemPrompt === undefined) delete prompt.systemPrompt\n else prompt.systemPrompt = systemPrompt\n if (instructions === undefined) delete prompt.instructions\n else prompt.instructions = instructions\n if (Object.values(prompt).some(value => value !== undefined)) result.prompt = prompt\n else delete result.prompt\n return snapshotAgentProfile(result)\n}\n\nexport interface ProposeRevisionInput {\n store: ProfileRevisionStore\n workspaceId: string\n profileId: string\n expectedRevisionId: string | null\n profile: AgentProfile\n knowledgeText: string\n /** The exact ADC `hashWorkspacePlan` for this authored snapshot. */\n planDigest: string\n author: ProfileRevision['author']\n /** Trusted role from the authenticated session, never model arguments. */\n actorRole: 'owner' | 'manager' | 'member' | 'viewer'\n reason: string\n id?: string\n now?: number\n}\n\n/** All authors use one immutable write path. Optimizer and authority edits cannot self-activate. */\nexport async function proposeRevision(input: ProposeRevisionInput): Promise<ProfileRevision> {\n if (input.author.kind !== 'optimizer' && input.actorRole !== 'owner' && input.actorRole !== 'manager') {\n throw new ProfileAccessError('Only an owner or manager can change a profile')\n }\n if (!input.workspaceId || !input.profileId || !input.author.id || !input.reason.trim() ||\n !/^sha256:[a-f0-9]{64}$/.test(input.planDigest)) {\n throw new TypeError('A profile revision needs workspace, profile, author, reason and plan digest')\n }\n const previous = await input.store.getActiveRevision(input.workspaceId, input.profileId)\n if ((previous?.id ?? null) !== input.expectedRevisionId) {\n throw new ProfileConflictError('The profile changed; read its latest revision before saving')\n }\n const profile = snapshotAgentProfile(input.profile)\n const diff = previous ? diffAgentProfiles(previous.profile, profile) : []\n const authorityDigest = profileAuthorityDigest(profile)\n const authorityChanged = !!previous && previous.authorityDigest !== authorityDigest\n const admission = input.author.kind === 'optimizer'\n ? PROFILE_CHANGE_POLICY.optimizerRevision.admission\n : authorityChanged\n ? PROFILE_CHANGE_POLICY.authorityEdit.admission\n : PROFILE_CHANGE_POLICY.textEdit.admission\n const state: ProfileRevisionState = admission === 'eval-promotion' ? 'candidate'\n : admission === 'editor-consent' ? 'pending-consent' : 'active'\n const revision: ProfileRevision = {\n id: input.id ?? crypto.randomUUID(), workspaceId: input.workspaceId, profileId: input.profileId,\n parentId: previous?.id ?? null, profile, knowledgeText: input.knowledgeText,\n author: input.author, reason: input.reason.trim(), diff,\n knowledgeTextChanged: previous ? previous.knowledgeText !== input.knowledgeText : input.knowledgeText.length > 0,\n authorityDigest,\n planDigest: input.planDigest, state, createdAt: input.now ?? Date.now(),\n }\n if (!await input.store.appendRevision(revision, input.expectedRevisionId, state === 'active')) {\n throw new ProfileConflictError('The profile changed while saving')\n }\n return revision\n}\n\nexport interface CreateTextProfileInput {\n store: ProfileRevisionStore\n workspaceId: string\n /** An active profile whose authority the new profile inherits exactly. */\n baselineProfileId: string\n /** Include builtins and user profiles from the authenticated workspace catalog. */\n existingProfiles: readonly { name: string }[]\n name: string\n instructions: string\n authorId: string\n actorRole: 'owner' | 'manager' | 'member' | 'viewer'\n /** Product computes ADC's hashWorkspacePlan for the complete authored snapshot. */\n planDigest: (profile: AgentProfile) => string | Promise<string>\n now?: number\n}\n\n/** Create a distinct text persona without granting new model, tool, MCP or secret authority. */\nexport async function createTextProfile(input: CreateTextProfileInput): Promise<ProfileRevision> {\n if (input.actorRole !== 'owner' && input.actorRole !== 'manager') {\n throw new ProfileAccessError('Only an owner or manager can create a profile')\n }\n const name = input.name.trim().replace(/\\s+/g, ' ')\n const normalizedName = normalizeProfileName(name)\n if (!normalizedName) throw new TypeError('A profile needs a name')\n if (input.existingProfiles.some(profile => normalizeProfileName(profile.name) === normalizedName)) {\n throw new ProfileConflictError('A profile with that name already exists')\n }\n const baseline = await input.store.getActiveRevision(input.workspaceId, input.baselineProfileId)\n if (!baseline) throw new ProfileConflictError('The baseline profile is not active')\n // Equal names map to one id, so two concurrent creates cannot create an\n // ambiguous text command even when both read the catalog before either writes.\n const profileId = `custom-${sha256Utf8(`${input.workspaceId}\\0${normalizedName}`).slice(7, 39)}`\n const addedInstruction = input.instructions.trim()\n const profile = bindProfileText(baseline.profile, {\n ...baseline.profile, name,\n prompt: {\n ...baseline.profile.prompt,\n instructions: [...(baseline.profile.prompt?.instructions ?? []),\n ...(addedInstruction ? [addedInstruction] : [])],\n },\n })\n return proposeRevision({\n store: input.store, workspaceId: input.workspaceId, profileId,\n expectedRevisionId: null, profile, knowledgeText: '',\n planDigest: await input.planDigest(profile),\n author: { kind: 'person', id: input.authorId }, actorRole: input.actorRole,\n reason: 'Created a text profile from an approved baseline', now: input.now,\n })\n}\n\nexport async function promoteRevision(input: {\n store: ProfileRevisionStore\n workspaceId: string\n profileId: string\n revisionId: string\n actorRole: 'owner' | 'manager' | 'member' | 'viewer'\n /** Verified by the product's consent route; required when authority changes. */\n verifyConsent?: (revision: ProfileRevision) => Promise<boolean>\n}): Promise<ProfileRevision> {\n if (input.actorRole !== 'owner' && input.actorRole !== 'manager') {\n throw new ProfileAccessError('Only an owner or manager can promote a profile')\n }\n const [revision, head] = await Promise.all([\n input.store.getRevision(input.workspaceId, input.profileId, input.revisionId),\n input.store.getActiveRevision(input.workspaceId, input.profileId),\n ])\n if (!revision || revision.parentId !== (head?.id ?? null)) throw new ProfileConflictError('Profile parent changed')\n if (revision.authorityDigest !== head?.authorityDigest &&\n (input.actorRole !== 'owner' || !input.verifyConsent || !await input.verifyConsent(revision))) {\n throw new ProfileAccessError('Authority changes require owner consent')\n }\n if (!await input.store.promoteRevision(input.workspaceId, input.profileId, revision.id, head?.id ?? null)) {\n throw new ProfileConflictError('The profile changed while promoting')\n }\n return revision\n}\n\nexport function parseProfileSwitch(text: string): { name: string } | { invalid: true } | null {\n const trimmed = text.trim()\n if (!/^switch\\s+to\\b/i.test(trimmed)) return null\n const match = /^switch[ \\t]+to[ \\t]+([^\\r\\n]+)$/i.exec(trimmed)\n return match?.[1]?.trim() ? { name: match[1].trim() } : { invalid: true }\n}\n\nexport function normalizeProfileName(name: string): string {\n return name.trim().replace(/\\s+/g, ' ').toLowerCase()\n}\n\n/** A source identity joins the command hash without entering the receipt row. */\nexport function profileSwitchInputHashFromContentHash(contentHash: string,\n identityContext?: string): string {\n return identityContext === undefined ? contentHash\n : sha256Utf8(JSON.stringify([identityContext, contentHash]))\n}\n\nexport function profileSwitchInputHash(content: string, identityContext?: string): string {\n return profileSwitchInputHashFromContentHash(sha256Utf8(content), identityContext)\n}\n\nexport interface SwitchableProfile {\n id: string\n name: string\n status: 'active' | 'draft' | 'paused'\n}\n\nexport interface SwitchProfileInput {\n store: ProfileRevisionStore\n key: ProfileBindingKey\n messageId: string\n content: string\n /** Trusted source identity, such as a phone sender; replay must preserve it. */\n identityContext?: string\n conversationId?: string\n choice: { name: string } | { profileId: string }\n profiles: readonly SwitchableProfile[]\n /** Product's role/phone allowlist decision for the authenticated member. */\n canSelect: (profileId: string) => Promise<boolean>\n /** Stage a complete managed plan for the same conversation; never mutate live workspace files. */\n prepareAuthority: (revision: ProfileRevision, key: ProfileBindingKey) => Promise<{\n planDigest: string; healthy: true; conflicts: string[]\n }>\n}\n\n/** The picker and deterministic text command converge here. Models cannot call it. */\nexport async function switchProfile(input: SwitchProfileInput): Promise<ProfileSwitchReceipt> {\n const inputHash = profileSwitchInputHash(input.content, input.identityContext)\n const previousReceipt = await input.store.getSwitchReceipt(input.key, input.messageId, inputHash)\n if (previousReceipt) return previousReceipt\n const binding = await input.store.getBinding(input.key)\n const choice = input.choice\n const matches = 'name' in choice\n ? input.profiles.filter(profile => normalizeProfileName(profile.name) === normalizeProfileName(choice.name))\n : input.profiles.filter(profile => profile.id === choice.profileId)\n const target = matches.length === 1 ? matches[0] : undefined\n let revision: ProfileRevision | null = null\n if (target?.status === 'active' && await input.canSelect(target.id)) {\n revision = await input.store.getActiveRevision(input.key.workspaceId, target.id)\n if (revision && 'name' in choice &&\n normalizeProfileName(revision.profile.name ?? '') !== normalizeProfileName(choice.name)) {\n revision = null\n }\n }\n let outcome: ProfileSwitchReceipt['outcome'] = 'refused'\n let message = matches.length > 1 ? 'That profile name is ambiguous.'\n : target?.status !== 'active' && target ? `${target.name} is not active.`\n : 'That profile is not available for this member.'\n let planDigest: string | null = null\n let conflicts: string[] = []\n if (revision && target) {\n try {\n const prepared = await input.prepareAuthority(revision, input.key)\n if (!prepared.healthy || prepared.planDigest !== revision.planDigest) {\n throw new ProfileConflictError('The managed plan was not prepared for this revision')\n }\n planDigest = prepared.planDigest\n conflicts = prepared.conflicts\n } catch {\n revision = null\n message = `Could not prepare ${target.name}; your current agent is unchanged.`\n }\n if (revision && planDigest) {\n outcome = 'switched'\n message = `Now talking to ${target.name}`\n }\n }\n return input.store.recordSwitch({ key: input.key, messageId: input.messageId, inputHash,\n conversationId: input.conversationId,\n profileId: revision?.profileId ?? null, revisionId: revision?.id ?? null,\n pinnedRevisionId: null, authorityDigest: revision?.authorityDigest ?? null,\n planDigest, outcome, message, conflicts }, binding?.version ?? 0)\n}\n\n/** Call before dispatching a chat message; a recognized command is never sent to the model. */\nexport async function handleProfileSwitchText(\n input: Omit<SwitchProfileInput, 'choice'>,\n): Promise<ProfileSwitchReceipt | null> {\n const parsed = parseProfileSwitch(input.content)\n if (!parsed) return null\n if ('name' in parsed) return switchProfile({ ...input, choice: parsed })\n const inputHash = profileSwitchInputHash(input.content, input.identityContext)\n const previous = await input.store.getSwitchReceipt(input.key, input.messageId, inputHash)\n if (previous) return previous\n const binding = await input.store.getBinding(input.key)\n return input.store.recordSwitch({ key: input.key, messageId: input.messageId, inputHash,\n conversationId: input.conversationId,\n profileId: null, revisionId: null, pinnedRevisionId: null, outcome: 'refused',\n authorityDigest: null, planDigest: null, conflicts: [],\n message: 'Send only “Switch to [agent name]” to change agents.' },\n binding?.version ?? 0)\n}\n\n/** One-step rollback moves this member/channel to its previous immutable revision. */\nexport async function rollbackProfileBinding(input: {\n store: ProfileRevisionStore\n key: ProfileBindingKey\n messageId: string\n conversationId?: string\n actorRole: 'owner' | 'manager' | 'member' | 'viewer'\n canSelect: (profileId: string) => Promise<boolean>\n prepareAuthority: SwitchProfileInput['prepareAuthority']\n}): Promise<ProfileSwitchReceipt> {\n if (input.actorRole !== 'owner' && input.actorRole !== 'manager') {\n throw new ProfileAccessError('Only an owner or manager can roll back a profile')\n }\n const inputHash = sha256Utf8(`rollback:${input.messageId}`)\n const prior = await input.store.getSwitchReceipt(input.key, input.messageId, inputHash)\n if (prior) return prior\n const binding = await input.store.getBinding(input.key)\n if (!binding || !await input.canSelect(binding.profileId)) throw new ProfileAccessError('Profile is unavailable')\n const current = binding.pinnedRevisionId\n ? await input.store.getRevision(input.key.workspaceId, binding.profileId, binding.pinnedRevisionId)\n : await input.store.getActiveRevision(input.key.workspaceId, binding.profileId)\n if (!current?.parentId) throw new ProfileConflictError('The bound profile has no previous revision')\n const parent = await input.store.getRevision(input.key.workspaceId, binding.profileId, current.parentId)\n if (!parent) throw new ProfileConflictError('The previous revision is unavailable')\n let planDigest = binding.planDigest\n let conflicts: string[] = []\n if (binding.authorityDigest !== parent.authorityDigest || binding.planDigest !== parent.planDigest) {\n try {\n const prepared = await input.prepareAuthority(parent, input.key)\n if (!prepared.healthy || prepared.planDigest !== parent.planDigest) {\n throw new ProfileConflictError('The prior managed plan was not prepared')\n }\n planDigest = prepared.planDigest\n conflicts = prepared.conflicts\n } catch {\n return input.store.recordSwitch({ key: input.key, messageId: input.messageId, inputHash,\n conversationId: input.conversationId,\n profileId: null, revisionId: null, pinnedRevisionId: null, outcome: 'refused',\n authorityDigest: null, planDigest: null, conflicts: [],\n message: 'Could not prepare the previous profile; your current agent is unchanged.' },\n binding.version)\n }\n }\n return input.store.recordSwitch({ key: input.key, messageId: input.messageId, inputHash,\n conversationId: input.conversationId,\n profileId: parent.profileId, revisionId: parent.id, pinnedRevisionId: parent.id,\n authorityDigest: parent.authorityDigest, planDigest, outcome: 'switched', conflicts,\n message: `Now talking to ${parent.profile.name ?? 'this profile'}` }, binding.version)\n}\n\nexport async function admitProfileTurn(input: {\n store: ProfileRevisionStore\n key: ProfileBindingKey\n messageId: string\n content: string\n /** Effective ADC plan digest selected by the executor for this revision and turn. */\n observedManagedPlanDigest: string\n /** Required if trusted per-turn attachments change the public profile plan. */\n verifyEffectivePlan?: (revision: ProfileRevision, effectivePlanDigest: string,\n key: ProfileBindingKey) => Promise<boolean>\n}): Promise<ProfileTurnPin> {\n const inputHash = sha256Utf8(input.content)\n const prior = await input.store.getTurnPin(input.key, input.messageId, inputHash)\n if (prior) return prior\n const binding = await input.store.getBinding(input.key)\n if (!binding) throw new ProfileAccessError('Choose a profile before sending a message')\n const revision = binding.pinnedRevisionId\n ? await input.store.getRevision(input.key.workspaceId, binding.profileId, binding.pinnedRevisionId)\n : await input.store.getActiveRevision(input.key.workspaceId, binding.profileId)\n if (!revision) throw new ProfileConflictError('The bound profile revision is unavailable')\n if (revision.authorityDigest !== binding.authorityDigest ||\n !/^sha256:[a-f0-9]{64}$/.test(input.observedManagedPlanDigest)) {\n throw new ProfileAccessError('The selected managed plan is not active for this turn')\n }\n const planMatches = revision.planDigest === input.observedManagedPlanDigest ||\n (input.verifyEffectivePlan !== undefined &&\n await input.verifyEffectivePlan(revision, input.observedManagedPlanDigest, input.key))\n if (!planMatches) {\n throw new ProfileAccessError('The selected managed plan is not active for this turn')\n }\n return input.store.pinTurn({ ...input.key, messageId: input.messageId, inputHash,\n profileId: revision.profileId, revisionId: revision.id,\n authorityDigest: revision.authorityDigest, planDigest: input.observedManagedPlanDigest }, binding.version)\n}\n\nconst textChangeSchema = z.object({\n name: z.string().trim().min(1).max(160).optional(),\n description: z.string().max(2000).nullable().optional(),\n systemPrompt: z.string().max(32000).nullable().optional(),\n instructions: z.array(z.string().max(32000)).max(40).optional(),\n knowledgeText: z.string().max(32000).optional(),\n}).strict().refine(changes => Object.keys(changes).length > 0)\nconst updateToolSchema = z.object({ expectedRevisionId: z.string().min(1), changes: textChangeSchema }).strict()\n\nexport function profileTextChange(revision: ProfileRevision, changes: z.infer<typeof textChangeSchema>): {\n profile: AgentProfile; knowledgeText: string\n} {\n const profile = structuredClone(revision.profile)\n if (changes.name !== undefined) profile.name = changes.name\n if (changes.description !== undefined) profile.description = changes.description ?? undefined\n if (changes.systemPrompt !== undefined || changes.instructions !== undefined) {\n profile.prompt = { ...profile.prompt,\n ...(changes.systemPrompt !== undefined ? { systemPrompt: changes.systemPrompt ?? undefined } : {}),\n ...(changes.instructions !== undefined ? { instructions: changes.instructions } : {}) }\n }\n return { profile: snapshotAgentProfile(profile), knowledgeText: changes.knowledgeText ?? revision.knowledgeText }\n}\n\nexport interface ProfileToolTurn {\n workspaceId: string; profileId: string; revisionId: string\n memberId: string; role: 'owner' | 'manager' | 'member' | 'viewer'\n}\n\nexport interface ProfileToolContext<TTurn extends ProfileToolTurn = ProfileToolTurn> {\n /** Resolve the running turn from the trusted server session; never from tool arguments. */\n activeTurn(): Promise<TTurn>\n /** Product computes the plan with ADC, returning `hashWorkspacePlan(plan)`. */\n planDigest(profile: AgentProfile, knowledgeText: string): Promise<string>\n store: ProfileRevisionStore\n /** Return a store whose revision append atomically rechecks product turn authority. */\n storeForTurn?(turn: TTurn): ProfileRevisionStore\n}\n\n/** Shared self-edit tools; only the authenticated active turn can name the profile. */\nexport function profileTools<TTurn extends ProfileToolTurn>(\n context: ProfileToolContext<TTurn>): McpToolDefinition<Record<string, never>>[] {\n return [{\n name: 'profile.read',\n description: 'Read the active agent profile text and revision. Saved text applies on the next message.',\n inputSchema: z.toJSONSchema(z.object({}).strict(), { io: 'input' }) as Record<string, unknown>,\n async run(args) {\n z.object({}).strict().parse(args)\n const turn = await context.activeTurn()\n if (turn.role !== 'owner' && turn.role !== 'manager') throw new ProfileAccessError('Profile management is required')\n const revision = await context.store.getActiveRevision(turn.workspaceId, turn.profileId)\n if (!revision) throw new ProfileConflictError('Profile revision is unavailable')\n return { profileId: turn.profileId, revisionId: revision.id, currentTurnRevisionId: turn.revisionId,\n name: revision.profile.name, description: revision.profile.description ?? null,\n systemPrompt: revision.profile.prompt?.systemPrompt ?? null,\n instructions: revision.profile.prompt?.instructions ?? [], knowledgeText: revision.knowledgeText }\n },\n }, {\n name: 'profile.update',\n description: 'Save a requested owner or manager text change with the revision from profile.read. Applies on the next message.',\n inputSchema: z.toJSONSchema(updateToolSchema, { io: 'input' }) as Record<string, unknown>,\n async run(args) {\n const { expectedRevisionId, changes } = updateToolSchema.parse(args)\n const turn = await context.activeTurn()\n if (turn.role !== 'owner' && turn.role !== 'manager') throw new ProfileAccessError('Profile management is required')\n const current = await context.store.getActiveRevision(turn.workspaceId, turn.profileId)\n if (!current || current.id !== expectedRevisionId) throw new ProfileConflictError('The profile changed; read it again')\n const next = profileTextChange(current, changes)\n const revision = await proposeRevision({ store: context.storeForTurn?.(turn) ?? context.store,\n workspaceId: turn.workspaceId,\n profileId: turn.profileId, expectedRevisionId, ...next,\n planDigest: await context.planDigest(next.profile, next.knowledgeText),\n author: { kind: 'agent', id: turn.memberId }, actorRole: turn.role,\n reason: 'Owner or manager requested a text change during chat' })\n return { profileId: turn.profileId, revisionId: revision.id, state: revision.state,\n canonicalSaved: revision.state === 'active', appliesTo: 'next_message', currentTurn: 'unchanged' }\n },\n }]\n}\n\nexport * from './self-management'\n","/**\n * Live profile self-mounting — the safe, immediate subset of agent\n * self-improvement.\n *\n * The revision system ({@link ProfileRevision}, `PROFILE_CHANGE_POLICY`) owns\n * durable profile evolution: authority edits need editor consent, optimizer\n * revisions promote through eval. Self-mounting is the complementary\n * LIVE dimension — the sandboxed agent adjusts its own mounted context\n * (skills today) within a permitted, idempotent, catalog-validated delta.\n * Nothing here touches authority: model, permissions, tools denials and\n * billing identity are not agent-changeable dimensions, and every refusal\n * names the permitted set.\n *\n * One audited verb, not a family: `mount_profile_change` applies a validated\n * delta against a permitted-dimensions allowlist; re-applying the same delta\n * is a no-op; the baseline skill cannot be removed; the mount count is capped\n * because context is a budget.\n *\n * Products wire their own catalog and persistence:\n *\n * ```ts\n * import { createMountProfileChangeTool, createInMemorySelfMountStorage } from '@tangle-network/agent-app/agent-profiles'\n *\n * const mountProfileChange = createMountProfileChangeTool({\n * skills: mySkillRegistry, // { id, description }[]\n * storage: createD1SelfMountStorage(env.DB), // or any { get, set }\n * scopeKey: (ctx) => ctx.threadId ?? ctx.userId, // product's persistence scope\n * baseline: 'cad',\n * })\n * ```\n */\nimport { defineAppTool, type AppToolDefinition } from '../tools/registry'\nimport { ToolInputError } from '../tools/errors'\nimport type { AppToolContext } from '../tools/types'\n\n/** The only profile dimensions an agent may change on its own mounted state.\n * Anything else in a delta is refused with this list — the boundary is the\n * schema, not the verb count. */\nexport const PERMITTED_SELF_MOUNT_DIMENSIONS = ['skills'] as const\n\nexport interface SelfMountSkillEntry {\n /** Registry-unique skill id. */\n id: string\n /** One-line description, surfaced in the tool's catalog. */\n description: string\n}\n\n/** Durable mounted-skill state, keyed by the product's scope. */\nexport interface SelfMountStorage {\n get(scope: string): Promise<readonly string[]>\n set(scope: string, ids: readonly string[]): Promise<void>\n}\n\n/** Non-durable default for tests and single-instance products. */\nexport function createInMemorySelfMountStorage(): SelfMountStorage {\n const state = new Map<string, string[]>()\n return {\n async get(scope) {\n return state.get(scope) ?? []\n },\n async set(scope, ids) {\n state.set(scope, [...new Set(ids)].sort())\n },\n }\n}\n\nexport interface MountProfileChangeDeps {\n /** The product's skill catalog — the only mountable ids. */\n skills: readonly SelfMountSkillEntry[]\n /** Where mounted ids persist, keyed by the product's scope. */\n storage: SelfMountStorage\n /** The persistence scope for a call (project id, thread id, …). */\n scopeKey: (ctx: AppToolContext) => string\n /** Always-mounted skill id that cannot be removed. Default: none. */\n baseline?: string\n /** Upper bound on total mounted skills. Default 12; context is a budget. */\n maxMounted?: number\n /** Tool name override when a product needs a distinct verb. */\n name?: string\n}\n\ninterface SkillsDelta {\n add?: string[]\n remove?: string[]\n}\n\nexport interface MountProfileChangeResult {\n ok: true\n mounted: string[]\n removed: string[]\n effective: string[]\n note: string\n}\n\nfunction catalogLine(skills: readonly SelfMountSkillEntry[]): string {\n return skills.map((s) => `${s.id} (${s.description})`).join('; ')\n}\n\n/**\n * The permitted, idempotent self-mount verb as an app tool. Register it with\n * the product's tool set; the sandboxed agent calls it through the per-turn\n * MCP surface like any other app tool.\n */\nexport function createMountProfileChangeTool(deps: MountProfileChangeDeps): AppToolDefinition<Record<string, unknown>> {\n const { skills, storage, scopeKey } = deps\n const baseline = deps.baseline?.trim() || undefined\n const maxMounted = deps.maxMounted ?? 12\n const known = new Set(skills.map((s) => s.id))\n if (known.size !== skills.length) throw new Error('createMountProfileChangeTool: duplicate skill ids in the catalog')\n if (baseline && !known.has(baseline)) throw new Error(`createMountProfileChangeTool: baseline \"${baseline}\" is not in the catalog`)\n\n return defineAppTool({\n name: deps.name ?? 'mount_profile_change',\n description:\n `Apply a permitted, idempotent change to the mounted skills on this profile. ` +\n `Permitted dimension: skills ({ add: [ids], remove: [ids] }) — anything else is refused. ` +\n `Re-applying the same change is a no-op. Takes effect the next time the profile renders. ` +\n `Catalog: ${catalogLine(skills)}.`,\n parameters: {\n type: 'object',\n properties: {\n changes: {\n type: 'object',\n description: `The profile delta. Permitted dimensions: ${PERMITTED_SELF_MOUNT_DIMENSIONS.join(', ')}.`,\n properties: {\n skills: {\n type: 'object',\n description: 'Skill mounts: catalog ids to add or remove.',\n properties: {\n add: { type: 'array', items: { type: 'string' }, description: 'Catalog skill ids to mount.' },\n remove: { type: 'array', items: { type: 'string' }, description: 'Mounted skill ids to unmount.' },\n },\n additionalProperties: false,\n },\n },\n additionalProperties: false,\n },\n },\n required: ['changes'],\n additionalProperties: false,\n },\n async execute(args: unknown, ctx: AppToolContext): Promise<MountProfileChangeResult | { ok: false; error: string }> {\n const changes = (args as { changes?: Record<string, unknown> }).changes ?? {}\n const unknownDimensions = Object.keys(changes).filter(\n (d) => !(PERMITTED_SELF_MOUNT_DIMENSIONS as readonly string[]).includes(d),\n )\n if (unknownDimensions.length > 0) {\n throw new ToolInputError(\n 'mount_profile_change',\n `dimensions [${unknownDimensions.join(', ')}] are not agent-changeable. Permitted dimensions: ${PERMITTED_SELF_MOUNT_DIMENSIONS.join(', ')}.`,\n )\n }\n const delta = (changes.skills ?? {}) as SkillsDelta\n const add = [...new Set((delta.add ?? []).map((s) => s.trim()).filter(Boolean))]\n const remove = [...new Set((delta.remove ?? []).map((s) => s.trim()).filter(Boolean))]\n if (add.length === 0 && remove.length === 0) {\n throw new ToolInputError('mount_profile_change', 'empty delta: provide skills.add and/or skills.remove')\n }\n const invalid = [...add, ...remove].filter((id) => !known.has(id))\n if (invalid.length > 0) {\n throw new ToolInputError(\n 'mount_profile_change',\n `unknown skill ids: ${invalid.join(', ')}. Catalog: ${[...known].sort().join(', ')}.`)\n }\n if (baseline && remove.includes(baseline)) {\n throw new ToolInputError(\n 'mount_profile_change',\n `refused: \"${baseline}\" is the always-on baseline and cannot be removed`)\n }\n\n const scope = scopeKey(ctx)\n const stored = await storage.get(scope)\n const before = [...new Set([...stored, ...(baseline ? [baseline] : [])])].sort()\n const mounted = new Set(before)\n for (const id of add) mounted.add(id)\n for (const id of remove) mounted.delete(id)\n if (baseline) mounted.add(baseline)\n const effective = [...mounted].sort()\n if (effective.length > maxMounted) {\n throw new ToolInputError(\n 'mount_profile_change',\n `refused: ${effective.length} skills exceeds the ${maxMounted}-skill mount limit`)\n }\n if (JSON.stringify(before) === JSON.stringify(effective)) {\n return { ok: true, mounted: [], removed: [], effective, note: 'no change (already in that state) — idempotent no-op' }\n }\n await storage.set(scope, effective)\n return {\n ok: true,\n mounted: effective.filter((id) => !before.includes(id)),\n removed: before.filter((id) => !effective.includes(id)),\n effective,\n note: 'applied — takes effect the next time the profile renders',\n }\n },\n })\n}\n"],"mappings":";;;;;;;;AACA;AAAA,EACE;AAAA,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W;AAAA,QAAoB,GAAG;AAAA,QAClD,YAAY,MAAM,QAAQ,WAAW,KAAK,SAAS,KAAK,aAAa;AAAA,QACrE,QAAQ,EAAE,MAAM,SAAS,IAAI,KAAK,SAAS;AAAA,QAAG,WAAW,KAAK;AAAA,QAC9D,QAAQ;AAAA,MAAuD,CAAC;AAClE,aAAO;AAAA,QAAE,WAAW,KAAK;AAAA,QAAW,YAAY,SAAS;AAAA,QAAI,OAAO,SAAS;AAAA,QAC3E,gBAAgB,SAAS,UAAU;AAAA,QAAU,WAAW;AAAA,QAAgB,aAAa;AAAA,MAAY;AAAA,IACrG;AAAA,EACF,CAAC;AACH;","names":["event","profile"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePopoverDialog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-57TTYY6T.js";
|
|
4
4
|
import {
|
|
5
5
|
CheckGlyph,
|
|
6
6
|
OVERLAY_SHADOW,
|
|
7
7
|
PopoverSurface
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-T5U7LDQW.js";
|
|
9
9
|
|
|
10
10
|
// src/web-react/workspace-switcher.tsx
|
|
11
11
|
import { useCallback, useState } from "react";
|
|
@@ -116,4 +116,4 @@ export {
|
|
|
116
116
|
WorkspaceSwitcher,
|
|
117
117
|
WorkspaceInitial
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-MLG7YSTS.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionDialog,
|
|
3
3
|
ActionDialogButton
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TUNRLEDH.js";
|
|
5
5
|
import {
|
|
6
6
|
OVERLAY_SHADOW,
|
|
7
7
|
PopoverSurface,
|
|
8
8
|
usePopover
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T5U7LDQW.js";
|
|
10
10
|
import {
|
|
11
11
|
UNTITLED_SESSION_LABEL,
|
|
12
12
|
mergeSessionPages,
|
|
@@ -751,4 +751,4 @@ export {
|
|
|
751
751
|
formatSessionTimestamp,
|
|
752
752
|
SessionHistoryPanel
|
|
753
753
|
};
|
|
754
|
-
//# sourceMappingURL=chunk-
|
|
754
|
+
//# sourceMappingURL=chunk-POE5UUUT.js.map
|
|
@@ -185,7 +185,7 @@ var OVERLAY_SHADOW = "shadow-[var(--shadow-overlay)]";
|
|
|
185
185
|
function pickerRootClass(fullWidth) {
|
|
186
186
|
return `relative ${fullWidth ? "flex w-full" : "inline-flex"}`;
|
|
187
187
|
}
|
|
188
|
-
var QUIET_PICKER_TRIGGER_BASE = "inline-flex h-
|
|
188
|
+
var QUIET_PICKER_TRIGGER_BASE = "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-normal text-muted-foreground transition focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
189
189
|
var QUIET_PICKER_TRIGGER_INTERACTIVE = "hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground";
|
|
190
190
|
function quietPickerTriggerClass({ interactive = true } = {}) {
|
|
191
191
|
return interactive ? `${QUIET_PICKER_TRIGGER_BASE} ${QUIET_PICKER_TRIGGER_INTERACTIVE}` : `${QUIET_PICKER_TRIGGER_BASE} cursor-default`;
|
|
@@ -401,7 +401,7 @@ function ModelPicker({
|
|
|
401
401
|
},
|
|
402
402
|
title: selectedLabel || "Select model",
|
|
403
403
|
"data-state": expanded ? "open" : "closed",
|
|
404
|
-
className: `${variant === "quiet" ? quietPickerTriggerClass({ interactive: !disabled }) : `inline-flex min-h-[
|
|
404
|
+
className: `${variant === "quiet" ? quietPickerTriggerClass({ interactive: !disabled }) : `inline-flex min-h-[var(--control-height-sm,2rem)] items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition ${disabled ? "" : "hover:bg-accent"}`} max-w-full disabled:cursor-not-allowed disabled:opacity-50`,
|
|
405
405
|
children: [
|
|
406
406
|
triggerContent ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
407
407
|
/* @__PURE__ */ jsx("span", { className: "shrink-0", "aria-hidden": true, children: selected ? renderProviderBadge ? renderProviderBadge(selected.provider) : /* @__PURE__ */ jsx(ProviderLogo, { provider: selected.provider, size: 16 }) : /* @__PURE__ */ jsx(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }) }),
|
|
@@ -569,7 +569,7 @@ function EffortPicker({ value, onChange, levels = DEFAULT_EFFORT_LEVELS, label =
|
|
|
569
569
|
onClick: () => setOpen(!open),
|
|
570
570
|
title: label ? `${label} \u2014 how hard the agent reasons before answering` : "Reasoning effort",
|
|
571
571
|
"data-state": open ? "open" : "closed",
|
|
572
|
-
className: `${variant === "quiet" ? quietPickerTriggerClass() : "inline-flex min-h-[
|
|
572
|
+
className: `${variant === "quiet" ? quietPickerTriggerClass() : "inline-flex min-h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent"} ${fullWidth ? "w-full" : ""}`,
|
|
573
573
|
children: [
|
|
574
574
|
/* @__PURE__ */ jsx(BrainGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
575
575
|
/* @__PURE__ */ jsxs("span", { className: fullWidth ? "flex-1 truncate text-left" : void 0, children: [
|
|
@@ -647,4 +647,4 @@ export {
|
|
|
647
647
|
EffortMeter,
|
|
648
648
|
EffortPicker
|
|
649
649
|
};
|
|
650
|
-
//# sourceMappingURL=chunk-
|
|
650
|
+
//# sourceMappingURL=chunk-T5U7LDQW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/web-react/controls.tsx"],"sourcesContent":["/**\n * Shared chat-shell control primitives — the LEAF that both the web-react barrel\n * (`./index`) and the composer children (`./agent-session-controls`,\n * `./seat-paywall`) import directly, so neither child has to reach back through\n * the barrel (which would re-create an import cycle). The barrel re-exports the\n * public names (`usePopover`, `usePending`, `ModelPicker`, `EffortPicker`, …)\n * unchanged, so the published export surface is identical.\n *\n * Styling contract matches the rest of `web-react`: Tailwind classes against the\n * shared design tokens; the glyphs are inline SVGs, no icon-library dependency.\n */\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { ProviderLogo } from './provider-logo'\nimport {\n MAX_RECOMMENDED_MODELS,\n sortModelsByFreshness,\n type CatalogModel,\n} from '../runtime/model-catalog'\n\n// ── shared glyphs (no icon-library dependency) ────────────────────────────\n\nexport function ChevronDown({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n )\n}\n\nfunction SearchGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n )\n}\n\nfunction SparkleGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M12 3v3m0 12v3M3 12h3m12 0h3M5.6 5.6l2.1 2.1m8.6 8.6 2.1 2.1m0-12.8-2.1 2.1M7.7 16.3l-2.1 2.1\" />\n </svg>\n )\n}\n\n/** lucide `brain` (v1.27) inlined — `/web-react` ships no icon-library\n * dependency, so the thinking glyph follows the same pattern as the rest of\n * this set. */\nexport function BrainGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M12 18V5\" />\n <path d=\"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4\" />\n <path d=\"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5\" />\n <path d=\"M17.997 5.125a4 4 0 0 1 2.526 5.77\" />\n <path d=\"M18 18a4 4 0 0 0 2-7.464\" />\n <path d=\"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517\" />\n <path d=\"M6 18a4 4 0 0 1-2-7.464\" />\n <path d=\"M6.003 5.125a4 4 0 0 0-2.526 5.77\" />\n </svg>\n )\n}\n\n/** lucide `check` — the selected-row mark in the picker menus. */\nexport function CheckGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n )\n}\n\n/**\n * Keyboard + pointer model for a trigger-and-popover pair, dependency-free.\n * Outside-mousedown and Escape both close; Escape also returns focus to the\n * trigger so keyboard users aren't dropped at the top of the document. The\n * returned `triggerProps` carry the ARIA contract (`aria-haspopup`/\n * `aria-expanded`); spread them onto the trigger button.\n *\n * `panelRef` belongs to the popover panel and MUST be wired when the panel is\n * rendered through {@link PopoverSurface}: a portaled panel is not inside\n * `containerRef`, so a container-only outside test reads every click on the\n * menu's own rows as an outside click and closes before the row's handler runs.\n */\nexport function usePopover(open: boolean, setOpen: (open: boolean) => void) {\n const containerRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!open) return\n function onMouseDown(e: MouseEvent) {\n const target = e.target as Node\n if (containerRef.current?.contains(target)) return\n const panel = panelRef.current\n if (panel?.contains(target)) return\n // A popover opened FROM this one portals as a SIBLING at body level, so\n // `contains` cannot see it and a click on its rows would read as outside.\n // Surfaces stamp their ancestor chain, so descendancy survives the portal.\n const ownPath = panel?.getAttribute(POPOVER_SURFACE_ATTR)\n const hitPath =\n target instanceof Element\n ? target.closest(`[${POPOVER_SURFACE_ATTR}]`)?.getAttribute(POPOVER_SURFACE_ATTR)\n : null\n if (ownPath && hitPath && (hitPath === ownPath || hitPath.startsWith(`${ownPath}${POPOVER_PATH_SEPARATOR}`))) return\n setOpen(false)\n }\n function onKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape' && !e.defaultPrevented) {\n const ownPath = panelRef.current?.getAttribute(POPOVER_SURFACE_ATTR)\n const focusedPath = document.activeElement?.closest(`[${POPOVER_SURFACE_ATTR}]`)?.getAttribute(POPOVER_SURFACE_ATTR)\n if (ownPath && focusedPath?.startsWith(`${ownPath}${POPOVER_PATH_SEPARATOR}`)) return\n e.preventDefault()\n setOpen(false)\n triggerRef.current?.focus()\n }\n }\n document.addEventListener('mousedown', onMouseDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('mousedown', onMouseDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [open, setOpen])\n\n return {\n containerRef,\n triggerRef,\n panelRef,\n triggerProps: {\n ref: triggerRef,\n 'aria-haspopup': true as const,\n 'aria-expanded': open,\n },\n }\n}\n\n// ── PopoverSurface ────────────────────────────────────────────────────────\n\n/** Distance between the trigger and the panel it opens. */\nconst POPOVER_GAP = 8\n/** Minimum distance the panel keeps from every viewport edge. */\nconst POPOVER_VIEWPORT_MARGIN = 16\n/** Floor for the computed max-height, so a cramped side still shows rows\n * rather than collapsing to a sliver the user cannot read. */\nconst POPOVER_MIN_HEIGHT = 120\n\n/**\n * Marks the portaled panel in the DOM. Products and audits (see\n * `playground/scripts/popover-hit-test.mjs`) select on this rather than on a\n * Tailwind class, which is presentation and free to change.\n *\n * Its VALUE is the surface's ancestor path (`outer/inner`), which is what\n * restores \"is this click inside my popover\" after the portal flattens two\n * nested panels into two siblings of `<body>`.\n */\nexport const POPOVER_SURFACE_ATTR = 'data-agent-app-popover'\nconst POPOVER_PATH_SEPARATOR = '/'\n\n/**\n * `PopoverSurface` is now mounted (closed) inside every server-rendered\n * composer, so its hooks run on the server once per composer per request.\n * React 18 logs \"useLayoutEffect does nothing on the server\" for that; React 19\n * does not (measured silent on react-dom 19.2.8). The peer floor is `react >=18`,\n * so bind the synchronous hook only where there is a DOM and the effect hook\n * elsewhere — placement never runs on the server either way.\n */\nconst useBrowserLayoutEffect = typeof document !== 'undefined' ? useLayoutEffect : useEffect\n\nexport interface PopoverSurfaceProps {\n open: boolean\n /** The trigger the panel anchors to — `usePopover`'s `triggerRef`. */\n triggerRef: RefObject<HTMLElement | null>\n /** `usePopover`'s `panelRef`; also what the outside-click test consults. */\n panelRef: RefObject<HTMLDivElement | null>\n /** Presentation classes. Placement and elevation are owned here — a caller\n * must not pass `absolute`/`fixed`/`top-*`/`bottom-*`/`z-*`. */\n className?: string\n role?: string\n id?: string\n 'aria-label'?: string\n /** Make the panel at least as wide as its trigger. A portaled panel has no\n * `w-full` to inherit — the trigger is no longer its offset parent — so a\n * menu that used to stretch to a full-width trigger declares it here. */\n matchTriggerWidth?: boolean\n /** Preferred side. `above` suits controls docked at the bottom of a composer;\n * `below` suits headers, rows, and rails. Either flips when the other side has more room. */\n side?: 'above' | 'below'\n /** Which trigger edge the panel lines up with. `end` keeps a row's trailing menu over the row. */\n align?: 'start' | 'end'\n /** Opt in to remeasurement when asynchronous or filtered content changes. */\n contentKey?: unknown\n children: ReactNode\n}\n\n/**\n * The floating panel every canonical picker opens.\n *\n * It renders through a PORTAL to `document.body` and anchors itself to the\n * trigger in viewport coordinates, because an in-place `absolute` panel's\n * visibility is decided by markup this package does not own. Measured in\n * production: the shipped chat composer docks these controls inside a\n * horizontally scrolling rail (`overflow-x-auto`), and a scroll container\n * clips every positioned descendant whose containing block sits inside it —\n * so a correct 420x457 menu with correct coordinates painted zero pixels and\n * could not be clicked. An ancestor `transform`/`filter`/`contain` would trap\n * it the same way through the stacking context instead of the clip. Leaving\n * the DOM subtree is the only placement a host cannot re-break.\n *\n * Placement prefers ABOVE the trigger (these controls dock at the bottom of a\n * composer), flips below when there is more room there, clamps horizontally\n * into the viewport, and caps its own height to the space on the chosen side.\n * The panel is `visibility: hidden` for the measure pass so it never paints at\n * the pre-placement origin.\n */\nexport function PopoverSurface({\n open,\n triggerRef,\n panelRef,\n className,\n role,\n id,\n 'aria-label': ariaLabel,\n matchTriggerWidth,\n side = 'above',\n align = 'start',\n contentKey,\n children,\n}: PopoverSurfaceProps) {\n const surfaceId = useId()\n const [style, setStyle] = useState<CSSProperties>(() => ({\n position: 'fixed',\n top: 0,\n left: 0,\n visibility: 'hidden',\n }))\n\n const place = useCallback(() => {\n const trigger = triggerRef.current\n const panel = panelRef.current\n if (!trigger || !panel) return\n const anchor = trigger.getBoundingClientRect()\n const viewportWidth = window.innerWidth\n const viewportHeight = window.innerHeight\n\n // `scrollHeight` is the panel's CONTENT height, so it does not feed back\n // on the `maxHeight` this function just applied — reading `offsetHeight`\n // here would measure the previous pass's clamp and ratchet the panel\n // smaller on every scroll event.\n const contentHeight = panel.scrollHeight\n const panelWidth = panel.offsetWidth\n\n const roomAbove = anchor.top - POPOVER_GAP - POPOVER_VIEWPORT_MARGIN\n const roomBelow = viewportHeight - anchor.bottom - POPOVER_GAP - POPOVER_VIEWPORT_MARGIN\n const above = side === 'above'\n ? contentHeight <= roomAbove || roomAbove >= roomBelow\n : !(contentHeight <= roomBelow || roomBelow >= roomAbove)\n const maxHeight = Math.max(POPOVER_MIN_HEIGHT, above ? roomAbove : roomBelow)\n const height = Math.min(contentHeight, maxHeight)\n\n const top = above ? Math.max(POPOVER_VIEWPORT_MARGIN, anchor.top - POPOVER_GAP - height) : anchor.bottom + POPOVER_GAP\n const rightBound = Math.max(POPOVER_VIEWPORT_MARGIN, viewportWidth - panelWidth - POPOVER_VIEWPORT_MARGIN)\n const preferredLeft = align === 'end' ? anchor.right - panelWidth : anchor.left\n const left = Math.min(Math.max(POPOVER_VIEWPORT_MARGIN, preferredLeft), rightBound)\n\n setStyle({\n position: 'fixed',\n top,\n left,\n maxHeight,\n visibility: 'visible',\n ...(matchTriggerWidth ? { minWidth: anchor.width } : {}),\n })\n }, [align, matchTriggerWidth, panelRef, side, triggerRef])\n\n // Layout effect: placement is resolved before the browser paints, so the\n // panel is never seen at the origin it mounts at.\n useBrowserLayoutEffect(() => {\n if (!open) {\n setStyle({ position: 'fixed', top: 0, left: 0, visibility: 'hidden' })\n return\n }\n place()\n }, [open, place, contentKey])\n\n useEffect(() => {\n if (!open) return\n const onViewportChange = () => place()\n // `capture` so the rail's OWN scroll re-anchors the panel — a scroll inside\n // an ancestor does not bubble to window.\n window.addEventListener('scroll', onViewportChange, true)\n window.addEventListener('resize', onViewportChange)\n return () => {\n window.removeEventListener('scroll', onViewportChange, true)\n window.removeEventListener('resize', onViewportChange)\n }\n }, [open, place])\n\n if (!open || typeof document === 'undefined') return null\n\n const ownerPath = triggerRef.current?.closest?.(`[${POPOVER_SURFACE_ATTR}]`)?.getAttribute(POPOVER_SURFACE_ATTR)\n const path = ownerPath ? `${ownerPath}${POPOVER_PATH_SEPARATOR}${surfaceId}` : surfaceId\n\n return createPortal(\n <div\n ref={panelRef}\n id={id}\n role={role}\n aria-label={ariaLabel}\n style={style}\n {...{ [POPOVER_SURFACE_ATTR]: path }}\n className={`z-[1000] ${className ?? ''}`}\n >\n {children}\n </div>,\n document.body,\n )\n}\n\n/**\n * Focus treatment for a row inside a popover panel.\n *\n * The ring itself now comes from the `:focus-visible` floor in tokens.css, so\n * this no longer restates a width or a colour. What it still has to say is\n * WHERE the ring is drawn: a popover option is a full-width row inside a panel\n * that clips its own corners (`overflow-hidden rounded-xl`), and an outward\n * ring on the first or last row is clipped away by that panel. Pulling the\n * offset negative draws the same ring just inside the row instead.\n */\nexport const POPOVER_OPTION_FOCUS = 'focus-visible:[outline-offset:-2px]'\n\n/**\n * The one overlay elevation for floating surfaces — picker menus, popovers,\n * drawers, modals. Reads the theme's `--shadow-overlay` token, so every overlay\n * lifts with the same shadow and re-themes from one source. The floating\n * composer uses the quieter `shadow-raised` rung instead.\n *\n * Written as an arbitrary value rather than the preset's `shadow-overlay`\n * utility, because that utility only exists where the preset is part of the\n * Tailwind build. A host that gets its tokens through a precompiled bundle —\n * `@tangle-network/sandbox-ui` ships brand's tokens inlined, with no `@theme`\n * block surviving the compile — receives `--shadow-overlay` as a plain custom\n * property, from which no `shadow-overlay` utility can be generated, and these\n * surfaces render flat. The arbitrary form emits from the class alone and works\n * either way.\n */\nexport const OVERLAY_SHADOW = 'shadow-[var(--shadow-overlay)]'\n\n/**\n * Root geometry for a picker — the box that holds the trigger — in one place\n * because every picker in this family has to agree on it.\n *\n * Shrink-wrapping (`inline-flex`) is the default: these controls dock on a\n * composer row where an expanding pill shoves its neighbours around. A STACKED\n * panel wants the opposite — the compact `AgentSessionControls` gear popover\n * lays its controls out in a column, and a shrink-wrapped root there makes a\n * trigger's own `w-full` a no-op, since it fills a box the trigger itself\n * sized. That is what left Agent backend short of the panel edge and Thinking\n * narrower still.\n *\n * The panel is portaled ({@link PopoverSurface}), so widening the root widens\n * the TRIGGER only. A menu that should follow it declares `matchTriggerWidth`.\n */\nexport function pickerRootClass(fullWidth: boolean): string {\n return `relative ${fullWidth ? 'flex w-full' : 'inline-flex'}`\n}\n\n/**\n * How a picker's TRIGGER is drawn. The menu it opens is the same either way.\n *\n * - `chip` (default): the 32px bordered pill — `rounded-full border\n * border-border bg-card font-medium`, on the composer row's height.\n * - `quiet`: a 32px borderless text button (the control scale's sm, the\n * composer row's one height) — muted label, small glyph, a\n * surface fill on hover and while the menu is open, nothing else. For a\n * composer whose card already draws the border: three pills docked under\n * the input there read as three more cards, not as the input's controls.\n */\nexport type PickerVariant = 'chip' | 'quiet'\n\n/** The quiet trigger at rest: geometry, type, and keyboard focus. */\nconst QUIET_PICKER_TRIGGER_BASE =\n 'inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-normal text-muted-foreground transition focus:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n\n/** The fills a quiet trigger shows on hover and while its menu is open — the\n * only two states it draws. Reads `data-state`, which every picker trigger\n * in this family stamps. */\nconst QUIET_PICKER_TRIGGER_INTERACTIVE =\n 'hover:bg-accent hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground'\n\n/**\n * Trigger classes for a `quiet` picker. Height, padding, radius, and type are\n * fixed here so the triggers on one composer row agree; a caller adds only\n * width (`w-full`) and alignment (`justify-between`).\n *\n * The focus ring is drawn on the element rather than left to the tokens.css\n * `:focus-visible` floor: a quiet trigger sits beside the composer's own action\n * buttons (attach, dictate, send), which draw `focus-visible:ring-2\n * focus-visible:ring-ring`, and a row whose controls answer keyboard focus two\n * different ways reads as two families.\n *\n * `interactive: false` is for a PINNED control (see `HarnessPicker`'s\n * `lockReason`): it keeps the resting treatment and draws no hover or open\n * fill, because a fill promises a menu the control will not open.\n */\nexport function quietPickerTriggerClass({ interactive = true }: { interactive?: boolean } = {}): string {\n return interactive\n ? `${QUIET_PICKER_TRIGGER_BASE} ${QUIET_PICKER_TRIGGER_INTERACTIVE}`\n : `${QUIET_PICKER_TRIGGER_BASE} cursor-default`\n}\n\n/**\n * Guard an async action against double-submit. `run` ignores re-entrant calls\n * while a promise is in flight and flips `pending` so the caller can disable\n * the control — the fix for double-charge / double-approve on a slow network.\n * Settles (success or throw) before clearing, and no-ops state updates after\n * unmount.\n */\nexport function usePending(): { pending: boolean; run: (action: () => void | Promise<void>) => void } {\n const [pending, setPending] = useState(false)\n const inFlight = useRef(false)\n const mounted = useRef(true)\n useEffect(() => {\n mounted.current = true\n return () => {\n mounted.current = false\n }\n }, [])\n const run = (action: () => void | Promise<void>) => {\n if (inFlight.current) return\n let result: void | Promise<void>\n try {\n result = action()\n } catch {\n return\n }\n if (!(result instanceof Promise)) return\n inFlight.current = true\n setPending(true)\n void result.finally(() => {\n inFlight.current = false\n if (mounted.current) setPending(false)\n })\n }\n return { pending, run }\n}\n\n// ── ModelPicker ───────────────────────────────────────────────────────────\n\nexport interface ModelPickerProps {\n /** Controlled, opaque saved id. Never replaced merely because the catalogue omits it. */\n value: string\n onChange: (id: string) => void\n /** Catalogue models — from `GET`ing the app's catalogue route (see\n * `runtime/model-catalog`), plus any product-specific entries appended. */\n models: CatalogModel[]\n /** Host-owned request state. Loading takes precedence over error and results. */\n loading?: boolean\n /** Host-safe failure message. null/undefined means no failure; even '' is an error. */\n error?: string | null\n /** Ask the host to retry. The host owns fetching, loading, errors and cancellation. */\n onRetry?: () => void\n /** Disable the trigger and close an open picker; does not change the saved value. */\n disabled?: boolean\n /** Associations belong to the trigger button, not its surrounding div. */\n id?: string\n 'aria-label'?: string\n 'aria-labelledby'?: string\n 'aria-describedby'?: string\n /** Render a provider logo/badge; default is ProviderLogo. */\n renderProviderBadge?: (provider: string) => ReactNode\n /** Section label for `featured` models. */\n recommendedLabel?: string\n /** Pin a labeled section to the TOP of the list (above Recommended) for the\n * models a product wants surfaced first — e.g. a tuner app's own fine-tuned\n * models (`{ label: 'Your Fine-Tuned Models', match: (m) => m.provider === 'tuner' }`).\n * Matching models are shown only in this section, not duplicated below. */\n priorityGroup?: {\n label: string\n match: (model: CatalogModel) => boolean\n }\n /** Trigger treatment — see {@link PickerVariant}. Default `chip`. */\n variant?: PickerVariant\n /** Optional accessible trigger content for a picker docked beside an editable model field. */\n triggerContent?: ReactNode\n}\n\nfunction formatPrice(p?: string): string | undefined {\n if (!p) return undefined\n const n = Number(p)\n if (isNaN(n) || n === 0) return undefined\n const perM = n * 1_000_000\n const amount = Number.isInteger(perM) ? perM.toFixed(0) : perM.toFixed(2)\n return `$${amount}/M`\n}\n\nfunction formatContext(len?: number): string | undefined {\n if (!len) return undefined\n if (len >= 1_000_000) return `${(len / 1_000_000).toFixed(1)}M ctx`\n if (len >= 1_000) return `${Math.round(len / 1_000)}K ctx`\n return `${len} ctx`\n}\n\nfunction SectionHeader({ children }: { children: ReactNode }) {\n return (\n <div className=\"px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground\">\n {children}\n </div>\n )\n}\n\nfunction ModelRow({\n model,\n selected,\n onSelect,\n renderProviderBadge,\n}: {\n model: CatalogModel\n selected: boolean\n onSelect: () => void\n renderProviderBadge?: (provider: string) => ReactNode\n}) {\n const price = formatPrice(model.pricing?.prompt)\n const ctx = formatContext(model.contextLength)\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n aria-pressed={selected}\n title={`${model.name} (${model.id})`}\n className={`flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${\n selected ? 'bg-primary/10 font-medium' : 'hover:bg-accent'\n }`}\n >\n <span className=\"shrink-0\" aria-hidden>\n {renderProviderBadge ? renderProviderBadge(model.provider) : <ProviderLogo provider={model.provider} size={16} />}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block break-words [overflow-wrap:anywhere]\">{model.name}</span>\n {(ctx || price || !model.supportsTools) && (\n <span className=\"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs font-normal text-muted-foreground\">\n {!model.supportsTools && <span className=\"rounded bg-secondary px-1.5 py-0.5\">no tools</span>}\n {ctx && <span>{ctx}</span>}\n {price && <span>{price}</span>}\n </span>\n )}\n </span>\n {selected && <CheckGlyph className=\"h-3.5 w-3.5 shrink-0 text-primary\" />}\n </button>\n )\n}\n\n/**\n * Searchable model picker pill + popover. A featured model is recommended\n * when the catalog marks it as a current choice. The first view stays short;\n * search and the browse action retain every routeable legacy model.\n *\n * This is the CANONICAL ecosystem model picker (see docs/ui-picker-canon.md).\n * Catalogue requests, retry outcomes and persisted selections belong to the host.\n * The non-modal dialog uses native buttons, not a partial combobox/listbox:\n * Tab and Enter/Space work normally; arrow keys also move through its controls.\n */\nexport function ModelPicker({\n value, onChange, models, loading = false, error, onRetry, disabled = false,\n id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy,\n renderProviderBadge, recommendedLabel = 'Recommended', priorityGroup,\n variant = 'chip', triggerContent,\n}: ModelPickerProps) {\n const [open, setOpen] = useState(false)\n const [query, setQuery] = useState('')\n const [showAll, setShowAll] = useState(false)\n const changeOpen = useCallback((next: boolean) => {\n setOpen(next && !disabled)\n if (!next) {\n setQuery('')\n setShowAll(false)\n }\n }, [disabled])\n const expanded = open && !disabled\n const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(expanded, changeOpen)\n const inputRef = useRef<HTMLInputElement>(null)\n const panelId = useId()\n const valueId = useId()\n const unavailable = error != null\n const sortedModels = useMemo(() => sortModelsByFreshness(models), [models])\n const contentKey = useMemo(() => ({ query, showAll, loading, error, models, value, priorityGroup }),\n [query, showAll, loading, error, models, value, priorityGroup])\n\n useEffect(() => {\n if (disabled) changeOpen(false)\n }, [disabled, changeOpen])\n\n useEffect(() => {\n if (!expanded) return\n // The portal's placement may commit a second render. Focus after that too.\n const focus = () => inputRef.current?.focus()\n focus()\n if (typeof requestAnimationFrame !== 'function') return\n const frame = requestAnimationFrame(focus)\n return () => cancelAnimationFrame(frame)\n }, [expanded])\n\n useEffect(() => {\n const panel = panelRef.current\n if (!expanded || !panel) return\n function onKeyDown(event: KeyboardEvent) {\n if (event.defaultPrevented || event.isComposing || event.altKey || event.ctrlKey || event.metaKey) return\n const input = inputRef.current\n if (!input || !panel) return\n const controls: HTMLElement[] = [input, ...panel.querySelectorAll<HTMLButtonElement>('button:not(:disabled)')]\n const index = controls.indexOf(document.activeElement as HTMLElement)\n if (index < 0) return\n if (event.key === 'Tab') {\n // Portals are last in DOM order. Exit beside the trigger, not at the\n // top of the page; Shift+Tab from search returns to the trigger itself.\n if ((event.shiftKey && index === 0) || (!event.shiftKey && index === controls.length - 1)) {\n changeOpen(false)\n triggerRef.current?.focus()\n if (event.shiftKey) event.preventDefault()\n }\n return\n }\n let next: number\n if (event.key === 'ArrowDown') next = (index + 1) % controls.length\n else if (event.key === 'ArrowUp') next = (index - 1 + controls.length) % controls.length\n else if (event.key === 'Home' && index > 0) next = 1\n else if (event.key === 'End' && index > 0) next = controls.length - 1\n else return // Home/End in search remain text-editing keys.\n event.preventDefault()\n controls[next]?.focus()\n }\n panel.addEventListener('keydown', onKeyDown)\n return () => panel.removeEventListener('keydown', onKeyDown)\n }, [expanded, changeOpen, panelRef, triggerRef])\n\n const selected = sortedModels.find((m) => m.id === value)\n const selectedLabel = selected?.name ?? value\n const describeValue = triggerContent != null || Boolean(id || ariaLabel || ariaLabelledBy)\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase()\n if (!q) return null\n return sortedModels.filter(\n (m) =>\n m.id.toLowerCase().includes(q) ||\n m.name.toLowerCase().includes(q) ||\n (m.description?.toLowerCase() ?? '').includes(q) ||\n m.provider.toLowerCase().includes(q),\n )\n }, [sortedModels, query])\n\n const sections = useMemo(() => {\n const isPriority = priorityGroup ? (m: CatalogModel) => priorityGroup.match(m) : () => false\n const priority = priorityGroup ? sortedModels.filter(isPriority) : []\n const featured = sortedModels.filter((model) => model.featured && !isPriority(model))\n const recommended = featured.slice(0, MAX_RECOMMENDED_MODELS)\n const visibleIds = new Set([...priority, ...recommended].map((model) => model.id))\n const currentSelection = sortedModels.find((model) => model.id === value && !visibleIds.has(model.id))\n const byProvider: Array<{ provider: string; items: CatalogModel[] }> = []\n for (const model of sortedModels) {\n if (visibleIds.has(model.id)) continue\n const last = byProvider[byProvider.length - 1]\n if (last && last.provider === model.provider) last.items.push(model)\n else byProvider.push({ provider: model.provider, items: [model] })\n }\n return { priority, recommended, currentSelection, byProvider }\n }, [sortedModels, priorityGroup, value])\n\n const select = (modelId: string) => {\n if (disabled || loading || unavailable) return\n changeOpen(false)\n triggerRef.current?.focus()\n onChange(modelId)\n }\n const row = (model: CatalogModel) => (\n <ModelRow key={model.id} model={model} selected={model.id === value} onSelect={() => select(model.id)} renderProviderBadge={renderProviderBadge} />\n )\n\n return (\n <div ref={containerRef} className=\"relative inline-flex min-w-0 max-w-full\">\n <button\n type=\"button\"\n {...triggerProps}\n id={id}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={[ariaDescribedBy, describeValue && value ? valueId : undefined].filter(Boolean).join(' ') || undefined}\n aria-haspopup=\"dialog\"\n aria-controls={expanded ? panelId : undefined}\n onClick={() => changeOpen(!expanded)}\n onKeyDown={(event) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n changeOpen(true)\n }\n }}\n title={selectedLabel || 'Select model'}\n data-state={expanded ? 'open' : 'closed'}\n className={`${\n variant === 'quiet'\n ? quietPickerTriggerClass({ interactive: !disabled })\n : `inline-flex min-h-[var(--control-height-sm,2rem)] items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition ${disabled ? '' : 'hover:bg-accent'}`\n } max-w-full disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {triggerContent ?? <>\n <span className=\"shrink-0\" aria-hidden>\n {selected ? (renderProviderBadge ? renderProviderBadge(selected.provider) : <ProviderLogo provider={selected.provider} size={16} />) : <SparkleGlyph className=\"h-3.5 w-3.5 text-muted-foreground\" />}\n </span>\n <span className=\"max-w-[160px] truncate\">{selectedLabel || 'Select model'}</span>\n </>}\n <ChevronDown className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </button>\n {describeValue && value && <span id={valueId} className=\"sr-only\">Selected model: {selectedLabel}</span>}\n\n <PopoverSurface\n open={expanded}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a model\"\n contentKey={contentKey}\n triggerRef={triggerRef}\n panelRef={panelRef}\n className={`flex w-[420px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border border-card-edge bg-popover text-foreground ${OVERLAY_SHADOW}`}\n >\n <div className=\"shrink-0 border-b border-border px-3 py-2\">\n <div className=\"flex items-center gap-2 rounded-lg border border-strong bg-background px-3 py-2 focus-within:ring-2 focus-within:ring-ring\">\n <SearchGlyph className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <input\n ref={inputRef}\n type=\"text\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n placeholder=\"Search models...\"\n aria-label=\"Search all models\"\n className=\"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground\"\n />\n </div>\n </div>\n {/* min-h-0 lets results absorb the surface's viewport height limit. */}\n <div className=\"max-h-[520px] min-h-0 overflow-y-auto p-1 pb-2\">\n {value && !selected && (\n <div className=\"mx-2 mb-1 mt-2 rounded-lg bg-secondary px-3 py-2 text-sm\">\n <p className=\"text-xs font-medium text-muted-foreground\">Saved model</p>\n <p className=\"break-words [overflow-wrap:anywhere]\">{value}</p>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {loading || unavailable ? 'Your saved selection is unchanged.' : 'Not in this catalogue. Your saved selection is unchanged.'}\n </p>\n </div>\n )}\n {loading ? (\n <div role=\"status\" className=\"px-3 py-4 text-center text-sm text-muted-foreground\">Loading models...</div>\n ) : unavailable ? (\n <div className=\"px-3 py-4 text-sm\">\n <div role=\"alert\">\n <p className=\"font-medium\">Model catalogue unavailable</p>\n <p className=\"mt-1 break-words text-muted-foreground [overflow-wrap:anywhere]\">{error || 'The catalogue could not be loaded.'}</p>\n </div>\n {onRetry && <button type=\"button\" className={`mt-3 rounded-md border border-border bg-card px-3 py-2 font-medium hover:bg-accent ${POPOVER_OPTION_FOCUS}`}\n onClick={() => {\n // Retry may remove this button synchronously. Keep focus on\n // the stable search input while the host updates its state.\n inputRef.current?.focus()\n onRetry()\n }}>Retry</button>}\n </div>\n ) : models.length === 0 ? (\n <div role=\"status\" className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No models available</div>\n ) : filtered ? (\n <>\n {filtered.length === 0 && <div role=\"status\" className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No models match your search</div>}\n {filtered.map(row)}\n </>\n ) : (\n <>\n {priorityGroup && sections.priority.length > 0 && <>\n <SectionHeader>{priorityGroup.label}</SectionHeader>\n {sections.priority.map(row)}\n </>}\n {sections.currentSelection && !showAll && <>\n <SectionHeader>Selected model</SectionHeader>\n {row(sections.currentSelection)}\n </>}\n {sections.recommended.length > 0 && <>\n <SectionHeader>{recommendedLabel}</SectionHeader>\n {sections.recommended.map(row)}\n </>}\n {sections.recommended.length === 0 && sections.priority.length === 0 && !sections.currentSelection && (\n <div className=\"px-3 py-3 text-sm text-muted-foreground\">Search or browse all models</div>\n )}\n {sections.byProvider.length > 0 && <button\n type=\"button\"\n aria-expanded={showAll}\n onClick={() => setShowAll(!showAll)}\n className={`mt-2 w-full rounded-md px-3 py-2 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground ${POPOVER_OPTION_FOCUS}`}\n >{showAll ? 'Hide older models' : 'Browse all models'}</button>}\n {showAll && sections.byProvider.map((group) => (\n <div key={group.provider}>\n <SectionHeader>{group.provider}</SectionHeader>\n {group.items.map(row)}\n </div>\n ))}\n </>\n )}\n </div>\n </PopoverSurface>\n </div>\n )\n}\n\n// ── EffortPicker ──────────────────────────────────────────────────────────\n\n/** One reasoning-budget level: the engine `id` is unchanged (the value the\n * product sends to the loop); only the user-facing `label` is renamed to the\n * plainer \"how hard should it think\" vocabulary from docs/product-surfaces.md.\n * `low`→Quick, `medium`→Standard, `high`→Extended. The mapping is overridable\n * via `EffortPickerProps.levels`, so a product can relabel without losing the\n * ids the runtime expects. */\nexport interface EffortLevel {\n id: string\n label: string\n}\n\n/**\n * The engine ids this package NAMES, and the word each one reads as.\n *\n * Deliberately WIDER than {@link DEFAULT_EFFORT_LEVELS}: the default list is\n * what a picker OFFERS when a product declares nothing, while this is the\n * vocabulary — the labels a named id keeps wherever it appears. The two are\n * different questions, and folding them together is what made a real engine\n * rung read as its own id: `xhigh` and `ultracode` are rungs claude-code\n * applies above `high`, so a product declaring them got \"Xhigh\" while every\n * neighbouring rung had a plain English word. Naming them here is what stops\n * each product inventing its own — the drift `effortLevelsFromIds` exists to\n * prevent. They stay OUT of the offered default because most backends do not\n * apply them, and offering a rung the backend ignores is the defect\n * `effortLevels` was added to close.\n */\nconst KNOWN_EFFORT_LABELS = {\n off: 'Off',\n low: 'Quick',\n medium: 'Standard',\n high: 'Extended',\n xhigh: 'Extra',\n ultracode: 'Ultra',\n} as const\n\nexport const DEFAULT_EFFORT_LEVELS: readonly EffortLevel[] = [\n { id: 'off', label: KNOWN_EFFORT_LABELS.off },\n { id: 'low', label: KNOWN_EFFORT_LABELS.low },\n { id: 'medium', label: KNOWN_EFFORT_LABELS.medium },\n { id: 'high', label: KNOWN_EFFORT_LABELS.high },\n]\n\n/**\n * The user-facing label for an engine level id: the canonical vocabulary when\n * the id is one this package names, otherwise the id itself made readable\n * (`auto` -> \"Auto\", `ultra-code` -> \"Ultra code\"). Never invents a depth word,\n * so an id nobody declared a label for still reads as ITSELF and never as some\n * other level.\n */\nexport function effortLevelLabel(id: string): string {\n const known = (KNOWN_EFFORT_LABELS as Record<string, string | undefined>)[id]\n if (known) return known\n const words = id.replace(/[-_]+/g, ' ').trim()\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : id\n}\n\n/**\n * Build a levels list from the engine ids a backend applies — the shape the\n * removed `ComposerAgentControls` took as `reasoning.available`, so a product\n * migrating that list has one call to make instead of a hand-written label map\n * per product (which is how \"Quick\" and \"Low\" drift apart across surfaces).\n */\nexport function effortLevelsFromIds(ids: readonly string[]): readonly EffortLevel[] {\n return ids.map((id) => ({ id, label: effortLevelLabel(id) }))\n}\n\n/**\n * The list {@link EffortPicker} RENDERS for `value` — the declared levels, plus\n * `value` itself when the declaration omits it.\n *\n * A picker cannot honestly resolve a selected value it was not given, and the\n * failure it used to take instead — fall back to the middle entry — renders the\n * session's real depth as a DIFFERENT level's name. That is exactly the defect\n * `levels` was added to prevent: the legacy adapter's `available` list excluded\n * the `auto` sentinel because the old picker injected it, so a product mapping\n * that list straight across ships a session running on `auto` labelled\n * \"Extended\". Admitting the value is not offering a new choice — it is\n * reporting the state the session is already in, and it disappears from the\n * list as soon as the user picks a declared level.\n *\n * A blank value is not admitted (there is no honest label for it); the picker\n * renders no selection instead.\n */\nexport function reconcileEffortLevels(\n value: string,\n levels: readonly EffortLevel[] = DEFAULT_EFFORT_LEVELS,\n): readonly EffortLevel[] {\n if (!value || levels.some((l) => l.id === value)) return levels\n return [{ id: value, label: effortLevelLabel(value) }, ...levels]\n}\n\n// ── effort strength meter ─────────────────────────────────────────────────\n\n/** Segments the meter draws — fixed geometry so the ladder stays tabular\n * across levels (and across the trigger and its menu rows). */\nexport const EFFORT_METER_SEGMENTS = 4\n\n/** Filled-segment opacity ladder: translucent on the left, heavy on the\n * right — the ramp carries strength even at a glance, the count carries it\n * exactly. Unfilled segments sit at a fixed ghost opacity. */\nconst EFFORT_METER_FILL_OPACITY = [0.25, 0.5, 0.75, 1] as const\nconst EFFORT_METER_GHOST_OPACITY = 0.15\n\n/** Level ids that mean \"no reasoning\" — the meter renders all-ghost. */\nconst OFF_LEVEL_IDS: ReadonlySet<string> = new Set(['off', 'none'])\n\n/**\n * Ids that name a POLICY rather than a depth: `auto` means \"let the harness and\n * model decide\", so it has no position on a strength ladder.\n *\n * Without this it lands wherever the declaration puts it and draws a filled\n * meter — measured on a product that offers `auto` first: every harness read\n * `Auto` at a FULL four bars, including `cli-base`, which has no agent to think\n * at all. A meter is a claim about how hard the run will think, and a sentinel\n * cannot make that claim.\n */\nconst UNPLACEABLE_LEVEL_IDS: ReadonlySet<string> = new Set(['auto'])\n\n/**\n * Filled-segment count for a level: 0 for off/none (or an id the levels list\n * does not carry); otherwise the level's position among the non-off choices\n * scaled onto the meter, so the ladder reads low < medium < high and the top\n * level fills the whole scale. The canonical four levels land 0 / 1 / 2 / 4.\n */\nexport function effortMeterFill(\n levelId: string,\n levels: readonly EffortLevel[] = DEFAULT_EFFORT_LEVELS,\n): number {\n if (OFF_LEVEL_IDS.has(levelId) || UNPLACEABLE_LEVEL_IDS.has(levelId)) return 0\n const active = levels.filter((l) => !OFF_LEVEL_IDS.has(l.id) && !UNPLACEABLE_LEVEL_IDS.has(l.id))\n const index = active.findIndex((l) => l.id === levelId)\n if (index < 0 || active.length === 0) return 0\n return Math.max(1, Math.floor(((index + 1) * EFFORT_METER_SEGMENTS) / active.length))\n}\n\n/**\n * The thinking-strength meter: four 12px bars, filled count = level, filled\n * opacity ramping 25→100% left to right (unfilled at a faint ghost). Purely\n * decorative — the level name is always rendered as text beside it, so the\n * meter is `aria-hidden` and adds no second accessible name.\n */\nexport function EffortMeter({ fill, className }: { fill: number; className?: string }) {\n return (\n <span aria-hidden className={`inline-flex items-center gap-[2px] ${className ?? ''}`}>\n {Array.from({ length: EFFORT_METER_SEGMENTS }, (_, i) => (\n <span\n key={i}\n className=\"h-3 w-[3px] rounded-full bg-current\"\n style={{ opacity: i < fill ? EFFORT_METER_FILL_OPACITY[i] : EFFORT_METER_GHOST_OPACITY }}\n />\n ))}\n </span>\n )\n}\n\nexport interface EffortPickerProps {\n value: string\n onChange: (id: string) => void\n /** Selectable levels (engine id + user-facing label). Defaults to the plain\n * \"Thinking\" vocabulary; override to relabel without changing the ids the\n * runtime receives.\n *\n * A list that omits the current `value` is not a rendering error the picker\n * papers over: `value` is reconciled INTO the rendered list under its own\n * name (see {@link reconcileEffortLevels}), because a control must report\n * the depth the session is running at and never some other list entry. */\n levels?: readonly EffortLevel[]\n /** Prefix shown before the active level on the pill — the \"what is this\"\n * context the bare value lacked. Default \"Thinking\". Pass '' to hide it. */\n label?: string\n /** Fill the container instead of shrink-wrapping — opt-in, default `false`;\n * see {@link pickerRootClass} for when and why. */\n fullWidth?: boolean\n /** Trigger treatment — see {@link PickerVariant}. Default `chip`. */\n variant?: PickerVariant\n}\n\n/** Thinking-budget selector pill, styled to match {@link ModelPicker}. Show\n * it only when the selected model `supportsReasoning`. \"Thinking\" is the\n * plain-English name for what was internally called \"effort\".\n *\n * The CANONICAL ecosystem effort picker — sandbox-ui's reasoning menu (inside\n * its `chat/AgentSessionControls`) is legacy and frozen. */\nexport function EffortPicker({ value, onChange, levels = DEFAULT_EFFORT_LEVELS, label = 'Thinking', fullWidth = false, variant = 'chip' }: EffortPickerProps) {\n const [open, setOpen] = useState(false)\n const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen)\n const panelId = useId()\n const rendered = reconcileEffortLevels(value, levels)\n // The strength ladder is computed over the DECLARED levels only, so admitting\n // the selected value cannot shift where the declared ones sit on the meter.\n // A level the declaration does not carry has no position on that ladder, so\n // it renders with NO meter — an all-ghost meter is what `off` looks like, and\n // \"we cannot place this\" is not \"no thinking\".\n const isDeclared = (id: string) => levels.some((l) => l.id === id) && !UNPLACEABLE_LEVEL_IDS.has(id)\n const selected = rendered.find((l) => l.id === value)\n\n return (\n <div ref={containerRef} className={pickerRootClass(fullWidth)}>\n <button\n type=\"button\"\n {...triggerProps}\n aria-controls={open ? panelId : undefined}\n onClick={() => setOpen(!open)}\n title={label ? `${label} — how hard the agent reasons before answering` : 'Reasoning effort'}\n data-state={open ? 'open' : 'closed'}\n className={`${\n variant === 'quiet'\n ? quietPickerTriggerClass()\n : 'inline-flex min-h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent'\n } ${fullWidth ? 'w-full' : ''}`}\n >\n <BrainGlyph className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n {/* Full width gives the label the slack, so the meter and chevron park\n on the trailing edge and the glyph stays against the text. */}\n <span className={fullWidth ? 'flex-1 truncate text-left' : undefined}>\n {label ? <span className=\"text-muted-foreground\">{label}: </span> : null}\n {selected ? selected.label : '—'}\n </span>\n {/* Quiet inherits the trigger's tone, so the meter is muted at rest\n and lifts with the label on hover instead of staying at full foreground. */}\n {selected && isDeclared(selected.id) && (\n <EffortMeter\n fill={effortMeterFill(selected.id, levels)}\n className={variant === 'quiet' ? 'shrink-0' : 'shrink-0 text-foreground'}\n />\n )}\n <ChevronDown className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </button>\n <PopoverSurface\n open={open}\n id={panelId}\n role=\"menu\"\n triggerRef={triggerRef}\n panelRef={panelRef}\n // A portaled panel has no `w-full` to inherit, so a full-width trigger\n // hands its measured width to the panel instead.\n matchTriggerWidth={fullWidth}\n className={`w-44 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 ${OVERLAY_SHADOW}`}\n >\n {rendered.map((l) => (\n <button\n key={l.id}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={l.id === value}\n onClick={() => {\n onChange(l.id)\n setOpen(false)\n }}\n className={`flex min-h-[40px] w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${\n l.id === value ? 'bg-primary/10 font-medium' : 'hover:bg-accent'\n }`}\n >\n <BrainGlyph className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate\">{l.label}</span>\n {isDeclared(l.id) && (\n <EffortMeter fill={effortMeterFill(l.id, levels)} className=\"ml-auto text-foreground\" />\n )}\n {l.id === value && (\n <CheckGlyph className={`${isDeclared(l.id) ? '' : 'ml-auto '}h-3.5 w-3.5 shrink-0 text-primary`} />\n )}\n </button>\n ))}\n </PopoverSurface>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAYA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,oBAAoB;AAavB,SAyqBqB,UAzqBrB,KAOF,YAPE;AAH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,iGAAiG,oBAAoB,IAC9H,EAAE,OAAO,QAAQ,8BAA8B,iBACjD;AAAA,YAEA;AAAA,kCAAC,cAAW,WAAU,8CAA6C;AAAA,cACnE,oBAAC,UAAK,WAAU,YAAY,YAAE,OAAM;AAAA,cACnC,WAAW,EAAE,EAAE,KACd,oBAAC,eAAY,MAAM,gBAAgB,EAAE,IAAI,MAAM,GAAG,WAAU,2BAA0B;AAAA,cAEvF,EAAE,OAAO,SACR,oBAAC,cAAW,WAAW,GAAG,WAAW,EAAE,EAAE,IAAI,KAAK,UAAU,qCAAqC;AAAA;AAAA;AAAA,UAlB9F,EAAE;AAAA,QAoBT,CACD;AAAA;AAAA,IACL;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OVERLAY_SHADOW
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T5U7LDQW.js";
|
|
4
4
|
|
|
5
5
|
// src/web-react/action-dialog.tsx
|
|
6
6
|
import { useEffect } from "react";
|
|
@@ -75,4 +75,4 @@ export {
|
|
|
75
75
|
ActionDialogButton,
|
|
76
76
|
ActionDialog
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
78
|
+
//# sourceMappingURL=chunk-TUNRLEDH.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-L7MB2LLM.js";
|
|
11
11
|
import {
|
|
12
12
|
PopoverSurface
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-T5U7LDQW.js";
|
|
14
14
|
import "./chunk-MLG6XKPV.js";
|
|
15
15
|
import "./chunk-7YA4QNTU.js";
|
|
16
16
|
|
|
@@ -538,4 +538,4 @@ export {
|
|
|
538
538
|
loadMentionEditor,
|
|
539
539
|
loadTiptapModules
|
|
540
540
|
};
|
|
541
|
-
//# sourceMappingURL=mention-editor-
|
|
541
|
+
//# sourceMappingURL=mention-editor-W2GG2NZ7.js.map
|
package/dist/sandbox/index.js
CHANGED
|
@@ -103,13 +103,13 @@ import {
|
|
|
103
103
|
} from "../chunk-CJW24QMJ.js";
|
|
104
104
|
import "../chunk-MCYJON3F.js";
|
|
105
105
|
import "../chunk-LWSJK546.js";
|
|
106
|
-
import "../chunk-
|
|
106
|
+
import "../chunk-4ZMZDE24.js";
|
|
107
107
|
import "../chunk-6A7MYOUI.js";
|
|
108
|
+
import "../chunk-4YHE7PGO.js";
|
|
109
|
+
import "../chunk-S5SRJJQG.js";
|
|
108
110
|
import "../chunk-4CBU7QIL.js";
|
|
109
111
|
import "../chunk-UGWQLQDS.js";
|
|
110
|
-
import "../chunk-4YHE7PGO.js";
|
|
111
112
|
import "../chunk-NZNXHCVU.js";
|
|
112
|
-
import "../chunk-S5SRJJQG.js";
|
|
113
113
|
import "../chunk-D6UJEOZQ.js";
|
|
114
114
|
export {
|
|
115
115
|
DEFAULT_FOREGROUND_PROVISION_CLAIM_TTL_SECONDS,
|
|
@@ -39,8 +39,8 @@ import {
|
|
|
39
39
|
} from "../chunk-PT7H37YH.js";
|
|
40
40
|
import {
|
|
41
41
|
useInfiniteScroll
|
|
42
|
-
} from "../chunk-
|
|
43
|
-
import "../chunk-
|
|
42
|
+
} from "../chunk-POE5UUUT.js";
|
|
43
|
+
import "../chunk-TUNRLEDH.js";
|
|
44
44
|
import {
|
|
45
45
|
CheckGlyph,
|
|
46
46
|
ChevronDown,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
POPOVER_SURFACE_ATTR,
|
|
50
50
|
PopoverSurface,
|
|
51
51
|
usePopover
|
|
52
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-T5U7LDQW.js";
|
|
53
53
|
import "../chunk-SJWIZT7B.js";
|
|
54
54
|
import {
|
|
55
55
|
ProviderLogo
|
package/dist/tools/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
restrictTaxonomy,
|
|
10
10
|
verifyCapabilityToken,
|
|
11
11
|
verifyExpiringCapabilityToken
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-4ZMZDE24.js";
|
|
13
13
|
import {
|
|
14
14
|
DEFAULT_APP_TOOL_PATHS,
|
|
15
15
|
DEFAULT_HEADER_NAMES,
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
readToolArgs,
|
|
23
23
|
unresolvableSurfaceCredential
|
|
24
24
|
} from "../chunk-6A7MYOUI.js";
|
|
25
|
+
import "../chunk-4YHE7PGO.js";
|
|
26
|
+
import "../chunk-S5SRJJQG.js";
|
|
25
27
|
import {
|
|
26
28
|
APP_TOOL_NAMES,
|
|
27
29
|
buildAppToolOpenAITools,
|
|
@@ -31,11 +33,9 @@ import {
|
|
|
31
33
|
isAppToolName
|
|
32
34
|
} from "../chunk-4CBU7QIL.js";
|
|
33
35
|
import "../chunk-UGWQLQDS.js";
|
|
34
|
-
import "../chunk-4YHE7PGO.js";
|
|
35
36
|
import {
|
|
36
37
|
ToolInputError
|
|
37
38
|
} from "../chunk-NZNXHCVU.js";
|
|
38
|
-
import "../chunk-S5SRJJQG.js";
|
|
39
39
|
export {
|
|
40
40
|
APP_TOOL_NAMES,
|
|
41
41
|
DEFAULT_APP_TOOL_PATHS,
|