agent-lyra 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +47 -35
  2. package/bin/agent-lyra.js +1 -1
  3. package/package.json +1 -1
  4. package/src/app-builder/init.js +3 -3
  5. package/src/app-builder/preview.js +8 -5
  6. package/src/framework/agent.js +19 -8
  7. package/src/framework/mda.js +5 -2
  8. package/src/framework/run.py +83 -11
  9. package/src/index.d.ts +1 -0
  10. package/src/index.js +1 -0
  11. package/src/init.js +1 -1
  12. package/src/intelligence/lifecycle.js +3 -2
  13. package/src/memory/LICENSE +1 -1
  14. package/src/memory/UPSTREAM.json +6 -3
  15. package/src/memory/external-engine.js +35 -0
  16. package/src/memory/index.js +19 -1
  17. package/src/memory/lifecycle.js +2 -1
  18. package/src/runtime/programmatic.d.ts +84 -0
  19. package/src/runtime/programmatic.js +155 -0
  20. package/src/runtime/run-agent.js +10 -2
  21. package/src/studio/browser.js +172 -30
  22. package/src/studio/export.js +7 -4
  23. package/src/studio/graphsnip-workbench.js +77 -0
  24. package/src/studio/history-panel.js +155 -0
  25. package/src/studio/ide-provider.js +65 -0
  26. package/src/studio/index.html +61 -9
  27. package/src/studio/intelligence.js +94 -0
  28. package/src/studio/local-provider.js +43 -0
  29. package/src/studio/memory-actions.js +28 -1
  30. package/src/studio/memory-panel.js +29 -5
  31. package/src/studio/mission-ui.css +52 -0
  32. package/src/studio/mission-ui.js +57 -0
  33. package/src/studio/programmatic-runner.mjs +21 -0
  34. package/src/studio/programmatic.js +58 -0
  35. package/src/studio/project.js +109 -26
  36. package/src/studio/python-agent.py +28 -4
  37. package/src/studio/run-history.js +119 -0
  38. package/src/studio/server.js +97 -9
  39. package/src/studio/session.js +1 -1
  40. package/src/studio/studio.css +192 -30
@@ -0,0 +1,119 @@
1
+ import { DatabaseSync } from "node:sqlite";
2
+ import { lstat, mkdir, writeFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+
5
+ const defaultRetentionDays = 30;
6
+ const maxEvents = 128;
7
+
8
+ function retentionDays() {
9
+ const value = Number(process.env.LYRA_RUN_HISTORY_DAYS ?? defaultRetentionDays);
10
+ return Number.isInteger(value) && value >= 1 && value <= 365 ? value : defaultRetentionDays;
11
+ }
12
+
13
+ export async function openRunHistory(root) {
14
+ const state = join(root, ".lyra", "state");
15
+ await mkdir(state, { recursive: true, mode: 0o700 });
16
+ for (const path of [join(root, ".lyra"), state]) {
17
+ if (!(await lstat(path)).isDirectory()) throw new Error("Run history requires regular project directories.");
18
+ }
19
+ await writeFile(join(state, ".gitignore"), "*\n", { flag: "wx" }).catch(error => {
20
+ if (error.code !== "EEXIST") throw error;
21
+ });
22
+ const path = join(state, "runs.sqlite");
23
+ const stat = await lstat(path).catch(error => {
24
+ if (error.code === "ENOENT") return undefined;
25
+ throw error;
26
+ });
27
+ if (stat && !stat.isFile()) throw new Error("Run history requires a regular SQLite file.");
28
+ const db = new DatabaseSync(path);
29
+ try {
30
+ db.exec(`
31
+ PRAGMA busy_timeout = 5000;
32
+ PRAGMA foreign_keys = ON;
33
+ CREATE TABLE IF NOT EXISTS studio_runs (
34
+ id TEXT PRIMARY KEY, started_at TEXT NOT NULL, status TEXT NOT NULL, ended_at TEXT
35
+ );
36
+ CREATE INDEX IF NOT EXISTS studio_runs_started ON studio_runs(started_at DESC);
37
+ CREATE TABLE IF NOT EXISTS studio_run_learnings (
38
+ run_id TEXT NOT NULL REFERENCES studio_runs(id) ON DELETE CASCADE,
39
+ position INTEGER NOT NULL, body TEXT NOT NULL, PRIMARY KEY(run_id, position)
40
+ );
41
+ CREATE TABLE IF NOT EXISTS studio_run_events (
42
+ run_id TEXT NOT NULL REFERENCES studio_runs(id) ON DELETE CASCADE,
43
+ sequence INTEGER NOT NULL, body TEXT NOT NULL, PRIMARY KEY(run_id, sequence)
44
+ );
45
+ `);
46
+ } catch (error) {
47
+ db.close();
48
+ throw error;
49
+ }
50
+ const insertRun = db.prepare("INSERT INTO studio_runs (id, started_at, status) VALUES (?, ?, 'running')");
51
+ const insertEvent = db.prepare("INSERT INTO studio_run_events (run_id, sequence, body) VALUES (?, ?, ?)");
52
+ const finishRun = db.prepare("UPDATE studio_runs SET status = ?, ended_at = ? WHERE id = ? AND status = 'running'");
53
+ const prune = db.prepare("DELETE FROM studio_runs WHERE started_at < ?");
54
+ const list = db.prepare("SELECT id, started_at AS startedAt, status, ended_at AS endedAt FROM studio_runs ORDER BY started_at DESC, id LIMIT 100");
55
+ const detail = db.prepare("SELECT id, started_at AS startedAt, status, ended_at AS endedAt FROM studio_runs WHERE id = ?");
56
+ const insertLearning = db.prepare("INSERT INTO studio_run_learnings (run_id, position, body) VALUES (?, ?, ?)");
57
+ const readLearnings = db.prepare("SELECT body FROM studio_run_learnings WHERE run_id = ? ORDER BY position");
58
+ const events = db.prepare("SELECT body FROM studio_run_events WHERE run_id = ? ORDER BY sequence LIMIT ?");
59
+ function transaction(work) {
60
+ db.exec("BEGIN IMMEDIATE");
61
+ try {
62
+ const result = work();
63
+ db.exec("COMMIT");
64
+ return result;
65
+ } catch (error) {
66
+ db.exec("ROLLBACK");
67
+ throw error;
68
+ }
69
+ }
70
+ return {
71
+ append(event, suggestions = []) {
72
+ transaction(() => {
73
+ if (event.type === "run.started") {
74
+ const cutoff = new Date(Date.now() - retentionDays() * 86_400_000).toISOString();
75
+ prune.run(cutoff);
76
+ insertRun.run(event.runId, event.timestamp);
77
+ } else if (event.type.startsWith("run.")) {
78
+ finishRun.run(event.type.slice(4), event.timestamp, event.runId);
79
+ }
80
+ if (event.sequence >= maxEvents) throw new Error("Studio run event limit exceeded.");
81
+ insertEvent.run(event.runId, event.sequence, JSON.stringify(event));
82
+ if (event.type === "run.completed") {
83
+ for (const [index, suggestion] of suggestions.entries()) {
84
+ insertLearning.run(event.runId, index, JSON.stringify(suggestion));
85
+ }
86
+ }
87
+ });
88
+ },
89
+ list: () => list.all(),
90
+ suggestions(id) {
91
+ if (detail.get(id)?.status !== "completed") return [];
92
+ return readLearnings.all(id).map(row => JSON.parse(row.body));
93
+ },
94
+ withCompletedRun(id, action) {
95
+ return transaction(() => {
96
+ if (detail.get(id)?.status !== "completed") throw new Error("Choose a completed run in this project.");
97
+ return action();
98
+ });
99
+ },
100
+ get(id) {
101
+ const run = detail.get(id);
102
+ return run && { schemaVersion: 1, run, events: events.all(id, maxEvents).map(row => JSON.parse(row.body)) };
103
+ },
104
+ close: () => db.close(),
105
+ };
106
+ }
107
+
108
+ const short = value => typeof value === "string" ? value.slice(0, 160) : undefined;
109
+ export function stepEventFields(agentId, step) {
110
+ const usage = Object.fromEntries(Object.entries(step.usage ?? {}).filter(([key, value]) =>
111
+ ["inputTokens", "outputTokens"].includes(key) && Number.isSafeInteger(value) && value >= 0));
112
+ return {
113
+ agentId: short(agentId), source: short(step.source), stepId: short(step.traceId),
114
+ runtimeRunId: short(step.runId), index: step.index,
115
+ provider: short(step.provider), model: short(step.model),
116
+ durationMs: step.durationMs,
117
+ ...(Object.keys(usage).length ? { usage } : {}),
118
+ };
119
+ }
@@ -1,5 +1,7 @@
1
1
  import { discoverFrameworkAgents, syncFrameworkAgent } from "../framework/agent.js";
2
2
  import { memoryActions } from "./memory-actions.js";
3
+ import { buildKnowledgeGraph, graphTokenLedger, knowledgeGraph } from "./graphsnip-workbench.js";
4
+ import { openRunHistory } from "./run-history.js";
3
5
  import { createServer } from "node:http";
4
6
  import { readFile } from "node:fs/promises";
5
7
  import { describeRun, readCatalog, readLayout, runSelection, saveLayout, studioModels, validateRunBindings } from "./project.js";
@@ -13,6 +15,9 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
13
15
  const assets = new Map();
14
16
  for (const [route, name, mime] of [
15
17
  ["/lyra-icon.png", "lyra-icon.png", "image/png"],
18
+ ["/mission-ui.js", "mission-ui.js", "text/javascript"], ["/mission-ui.css", "mission-ui.css", "text/css"],
19
+ ["/intelligence.js", "intelligence.js", "text/javascript"],
20
+ ["/history-panel.js", "history-panel.js", "text/javascript"],
16
21
  ["/memory-panel.js", "memory-panel.js", "text/javascript"],
17
22
  ["/agent-ui.js", "agent-ui.js", "text/javascript"], ["/agent-ui.css", "agent-ui.css", "text/css"],
18
23
  ["/", "index.html", "text/html"], ["/studio.js", "browser.js", "text/javascript"], ["/workflow-editor.js", "workflow-editor.js", "text/javascript"], ["/studio.css", "studio.css", "text/css"],
@@ -30,12 +35,27 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
30
35
  await saveOpenAIKey(key);
31
36
  return { configured: true };
32
37
  }],
38
+ ["/api/graphsnip/build", () => buildKnowledgeGraph(root)],
39
+ ["/api/work-locally", async () => {
40
+ await switchMode(root, "standalone", [], { output: { write() {} } });
41
+ return { connected: false };
42
+ }],
33
43
  ["/api/connect-cloud", async ({ key }) => {
34
44
  await switchMode(root, "gated", key ? ["--replace-key"] : [], {
35
45
  output: { write() {} }, prompt: async () => key,
36
46
  });
37
47
  return { connected: true };
38
48
  }],
49
+ ["/api/open-skill", async ({ id }) => {
50
+ if (typeof id !== "string") throw new Error("Choose a skill from the library.");
51
+ const { skills } = await readCatalog(root, { includeSkillInstructions: true });
52
+ const skill = skills.find(item => item.id === id);
53
+ if (!skill) throw new Error("This skill is no longer in the project. Reload the library.");
54
+ return {
55
+ description: typeof skill.description === "string" ? skill.description.slice(0, 1024) : "",
56
+ instructions: typeof skill.body === "string" ? skill.body.slice(0, 64_000) : "",
57
+ };
58
+ }],
39
59
  ["/api/save", ({ layout, revision }) => saveLayout(root, layout, revision)],
40
60
  ["/api/pull", () => pull(root)],
41
61
  ["/api/push", ({ id }) => pushStudioAgent(root, id)],
@@ -60,12 +80,14 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
60
80
  }
61
81
 
62
82
  let running = false;
83
+ let activeStream;
63
84
  let writing = false;
64
85
  const server = createServer(async (req, res) => {
65
- const send = (status, data, type = "application/json") => {
86
+ const send = (status, data, type = "application/json", headers = {}) => {
66
87
  res.writeHead(status, {
67
88
  "Content-Type": type.startsWith("image/") ? type : type + "; charset=utf-8", "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff",
68
89
  "Content-Security-Policy": "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'self'; frame-ancestors 'none'",
90
+ ...headers,
69
91
  });
70
92
  res.end(type === "application/json" ? JSON.stringify(data) : data);
71
93
  };
@@ -96,8 +118,26 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
96
118
  models: studioModels(),
97
119
  });
98
120
  }
121
+ if (!readOnly && req.method === "GET") {
122
+ if (req.url === "/api/graphsnip/graph") return send(200, await knowledgeGraph(root));
123
+ if (req.url === "/api/graphsnip/tokens") return send(200, await graphTokenLedger(root));
124
+ }
125
+ const historyRoute = /^\/api\/history\/([a-f0-9-]{36})(\/report)?$/i.exec(req.url);
126
+ const historyId = historyRoute?.[1];
127
+ if (!appCatalog && req.method === "GET" && (req.url === "/api/history" || historyId)) {
128
+ const history = await openRunHistory(root);
129
+ try {
130
+ if (!historyId) return send(200, { schemaVersion: 1, runs: history.list() });
131
+ const detail = history.get(historyId);
132
+ if (!detail) return send(404, { error: "Run not found in this project." });
133
+ return send(200, detail, "application/json", historyRoute[2]
134
+ ? { "Content-Disposition": 'attachment; filename="lyra-run-' + historyId + '.json"' }
135
+ : {});
136
+ } finally { history.close(); }
137
+ }
99
138
  const runRequest = req.url === "/api/run" || req.url === "/api/run-plan";
100
- if (req.method !== "POST" || (!runRequest && (readOnly || !updates.has(req.url)))) {
139
+ const cancelRequest = req.url === "/api/cancel-run";
140
+ if (req.method !== "POST" || (!runRequest && !cancelRequest && (readOnly || !updates.has(req.url)))) {
101
141
  return send(404, { error: "Not found." });
102
142
  }
103
143
  if (req.headers.origin !== "http://" + host) return send(403, { error: "Use the Studio page to submit requests." });
@@ -110,6 +150,11 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
110
150
  chunks.push(chunk);
111
151
  }
112
152
  const body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
153
+ if (cancelRequest) {
154
+ if (!activeStream || activeStream.id !== body.streamId) return send(404, { error: "The IDE run has already stopped." });
155
+ activeStream.controller.abort(new Error("Run cancelled."));
156
+ return send(200, { cancelled: true });
157
+ }
113
158
  if (runRequest && readOnly) {
114
159
  body.targets = await savedActionTargets(body);
115
160
  if (!body.targets) return send(409, { error: "The saved layout changed. Reload the preview before running." });
@@ -121,8 +166,42 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
121
166
  if (running) return send(409, { error: "A Studio run is already in progress." });
122
167
  running = true;
123
168
  try {
124
- return send(200, await run(root, body, appCatalog));
125
- } finally { running = false; }
169
+ if (typeof body.streamId !== "string" ||
170
+ !/^[a-f0-9-]{36}$/i.test(body.streamId)) {
171
+ return send(200, await run(root, body, appCatalog));
172
+ }
173
+ const controller = new AbortController();
174
+ const cancellable = body.provider === "vscode" ||
175
+ (await describeRun(root, body.targets, appCatalog, body.provider)).frameworkOnly;
176
+ if (cancellable) activeStream = { id: body.streamId, controller };
177
+ res.on("close", () => {
178
+ if (cancellable && !res.writableEnded) controller.abort(new Error("Run cancelled."));
179
+ });
180
+ res.writeHead(200, {
181
+ "Content-Type": "application/x-ndjson; charset=utf-8",
182
+ "Cache-Control": "no-store",
183
+ "X-Content-Type-Options": "nosniff",
184
+ });
185
+ res.flushHeaders();
186
+ const emit = event => {
187
+ if (!res.destroyed) res.write(JSON.stringify(event) + "\n");
188
+ };
189
+ try {
190
+ const result = await run(root, body, appCatalog, {
191
+ signal: cancellable ? controller.signal : undefined,
192
+ onDelta: text => emit({ type: "delta", text }),
193
+ onEvent: event => emit({ type: "event", event }),
194
+ });
195
+ emit({ type: "result", result });
196
+ } catch (error) {
197
+ emit({ type: "error", message: error.code ? "Studio could not read or write the project." : error.message,
198
+ progress: error.progress });
199
+ }
200
+ return res.end();
201
+ } finally {
202
+ activeStream = undefined;
203
+ running = false;
204
+ }
126
205
  }
127
206
  if (writing) return send(409, { error: "Studio is already saving or pulling files." });
128
207
  writing = true;
@@ -143,9 +222,9 @@ export async function startStudio(root, { port = 0, run = runSelection, pull = p
143
222
  return { server, url: "http://127.0.0.1:" + server.address().port + "/" };
144
223
  }
145
224
 
146
- export async function runStudio(args, output = process.stdout) {
225
+ export async function runStudio(args, output = process.stdout, { legacy = false } = {}) {
147
226
  if (args[0] === "--help") {
148
- output.write("Usage: agent-lyra studio | agent-lyra studio pull | agent-lyra studio push <local-agent-id> | agent-lyra studio pull-agent <local-agent-id> | agent-lyra studio push-workflow <workflow-id> | agent-lyra studio pull-workflow <workflow-id> | agent-lyra studio push-team <team-id> | agent-lyra studio pull-team <team-id> | agent-lyra studio push-skill <skill-id> | agent-lyra studio pull-skill <skill-id>\n");
227
+ output.write("Usage: agent-lyra workbench | agent-lyra workbench pull | agent-lyra workbench push <local-agent-id> | agent-lyra workbench pull-agent <local-agent-id> | agent-lyra workbench push-workflow <workflow-id> | agent-lyra workbench pull-workflow <workflow-id> | agent-lyra workbench push-team <team-id> | agent-lyra workbench pull-team <team-id> | agent-lyra workbench push-skill <skill-id> | agent-lyra workbench pull-skill <skill-id>\nWorkbench listens on 127.0.0.1:4174. The studio command is a compatibility alias. Set LYRA_STUDIO_PORT to override it, or use 0 to pick a free port.\n");
149
228
  return;
150
229
  }
151
230
  if (args.length === 1 && args[0] === "pull") {
@@ -174,7 +253,16 @@ export async function runStudio(args, output = process.stdout) {
174
253
  : result.updated ? "Updated " + result.name + " from Cloud.\n" : "No Cloud edits to pull.\n");
175
254
  return;
176
255
  }
177
- if (args.length) throw new Error("See agent-lyra studio --help.");
178
- const { url } = await startStudio(process.cwd());
179
- output.write("AgentLyra Studio: " + url + "\n");
256
+ if (args.length) throw new Error("See agent-lyra workbench --help.");
257
+ const port = Number(process.env.LYRA_STUDIO_PORT?.trim() || 4174);
258
+ if (!Number.isInteger(port) || port < 0 || port > 65535) {
259
+ throw new Error("LYRA_STUDIO_PORT must be an integer from 0 to 65535.");
260
+ }
261
+ const { url } = await startStudio(process.cwd(), { port }).catch(error => {
262
+ if (error.code === "EADDRINUSE") {
263
+ throw new Error("Studio port " + port + " is busy. Close the other server, choose another LYRA_STUDIO_PORT, or set it to 0 to pick a free port.");
264
+ }
265
+ throw error;
266
+ });
267
+ output.write((legacy ? "AgentLyra Studio: " : "AgentLyra Workbench: ") + url + "\n");
180
268
  }
@@ -98,7 +98,7 @@ export async function switchMode(root, mode, args, { output = process.stdout, pr
98
98
  }
99
99
  await saveJson(workspace(root), "session.json", { mode });
100
100
  output.write(mode === "gated"
101
- ? "Connected to Cloud. Open Studio and choose Pull from Cloud.\n"
101
+ ? "Connected to Cloud. Open Workbench and choose Pull from Cloud.\n"
102
102
  : "Working locally. Studio Cloud actions are paused.\n");
103
103
  }
104
104
 
@@ -24,15 +24,27 @@ main:has(#inspector-panel:not([hidden])) {
24
24
  #library-tabs {
25
25
  display: flex;
26
26
  flex-wrap: wrap;
27
- gap: .35rem;
28
- margin-bottom: .75rem;
27
+ gap: .15rem .7rem;
28
+ margin: 0 0 .85rem;
29
+ padding: 0 0 .25rem;
30
+ border-bottom: 1px solid var(--studio-line);
29
31
  }
30
32
  #library-tabs button {
33
+ min-height: 34px;
34
+ padding: .28rem .08rem;
35
+ border: 0;
36
+ border-bottom: 2px solid transparent;
37
+ border-radius: 0;
38
+ background: transparent;
39
+ color: var(--studio-muted);
31
40
  font-size: .8rem;
32
41
  }
42
+ #library-tabs button:hover,
33
43
  #library-tabs button[aria-pressed="true"] {
34
- background: #e6f0e9;
35
- border-color: #478367;
44
+ color: var(--studio-green);
45
+ }
46
+ #library-tabs button[aria-pressed="true"] {
47
+ border-bottom-color: var(--studio-green);
36
48
  }
37
49
  #library-search-label {
38
50
  font-size: .8rem;
@@ -46,26 +58,6 @@ main:has(#inspector-panel:not([hidden])) {
46
58
  #library-content #palette {
47
59
  margin: 0;
48
60
  }
49
- .library-entry {
50
- border-bottom: 1px solid #d9e4dd;
51
- }
52
- .library-entry summary {
53
- cursor: pointer;
54
- padding: .55rem .25rem;
55
- overflow-wrap: anywhere;
56
- }
57
- .library-entry summary span {
58
- display: block;
59
- padding-left: 1.15rem;
60
- color: #47675a;
61
- font-size: .8rem;
62
- }
63
- .library-entry .actions {
64
- padding: 0 .25rem .6rem;
65
- }
66
- .library-entry .actions button {
67
- font-size: .8rem;
68
- }
69
61
  .inspector-heading {
70
62
  display: flex;
71
63
  justify-content: space-between;
@@ -314,7 +306,6 @@ main { padding-inline: clamp(.9rem, 2.5vw, 2rem); }
314
306
  main > aside, main > section { border-color: var(--studio-line); border-radius: 12px; padding: 1.1rem; box-shadow: 0 2px 5px #192b2408; }
315
307
  #library { top: 5.15rem; }
316
308
  #library-content { padding-right: .25rem; }
317
- #library-tabs button[aria-pressed="true"] { background: var(--studio-tint); border-color: #86ac97; }
318
309
  #status { color: var(--studio-muted); font-size: .83rem; padding-inline: clamp(.9rem, 2.5vw, 2rem); }
319
310
  #status:empty { min-height: .65rem; }
320
311
  #canvas {
@@ -325,11 +316,64 @@ main > aside, main > section { border-color: var(--studio-line); border-radius:
325
316
  background-size: 16px 16px;
326
317
  padding: .9rem;
327
318
  }
328
- .library-entry { margin-bottom: .35rem; padding: .1rem .2rem; border: 1px solid var(--studio-line); border-radius: 7px; }
329
- .library-entry[open] { border-color: #a1bbaa; }
330
- .library-entry summary:hover { color: #286b51; }
331
- .library-entry .agent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; }
332
- .library-entry .agent-meta span { padding-left: 0; }
319
+ .library-entry {
320
+ display: grid;
321
+ grid-template-columns: minmax(0, 1fr) auto;
322
+ align-items: start;
323
+ border-bottom: 1px solid var(--studio-line);
324
+ }
325
+ .agent-row {
326
+ display: flex;
327
+ align-items: center;
328
+ justify-content: space-between;
329
+ gap: .25rem;
330
+ min-width: 0;
331
+ padding: .38rem 0 .38rem .25rem;
332
+ }
333
+ .library-entry:hover { background: #f8faf8; }
334
+ .agent-label { min-width: 0; }
335
+ .agent-label > strong {
336
+ display: block;
337
+ overflow: hidden;
338
+ text-overflow: ellipsis;
339
+ white-space: nowrap;
340
+ font-size: .82rem;
341
+ }
342
+ .agent-meta {
343
+ display: flex;
344
+ align-items: center;
345
+ flex-wrap: wrap;
346
+ gap: .15rem .35rem;
347
+ color: var(--studio-muted);
348
+ font-size: .72rem;
349
+ }
350
+ .agent-icon {
351
+ display: grid;
352
+ place-items: center;
353
+ width: 32px;
354
+ min-height: 32px;
355
+ padding: 0;
356
+ border: 0;
357
+ border-radius: 6px;
358
+ background: transparent;
359
+ color: var(--studio-green);
360
+ cursor: pointer;
361
+ }
362
+ .agent-icon:hover, .agent-options[open] > summary { background: var(--studio-tint); }
363
+ .agent-run { flex: 0 0 auto; background: #edf4ef; }
364
+ .play-icon {
365
+ width: 0;
366
+ height: 0;
367
+ margin-left: 2px;
368
+ border-block: 5px solid transparent;
369
+ border-left: 8px solid currentColor;
370
+ }
371
+ .agent-options { display: contents; }
372
+ .agent-options[open]::details-content { display: contents; }
373
+ .agent-options > summary { list-style: none; margin: .38rem 0; font-size: 1.1rem; }
374
+ .agent-options > summary::-webkit-details-marker { display: none; }
375
+ .agent-options .actions { grid-column: 1 / -1; padding: 0 .25rem .45rem; }
376
+ .agent-options .actions button { font-size: .76rem; }
333
377
  .pill, .library-entry .agent-meta .pill {
334
378
  display: inline-block;
335
379
  padding: .1rem .45rem;
@@ -372,3 +416,121 @@ main > aside, main > section { border-color: var(--studio-line); border-radius:
372
416
  .canvas-empty p { margin: .2rem 0 0; color: var(--studio-muted); }
373
417
  .exported #canvas { background-image: none; min-height: 0; }
374
418
  .exported .canvas-empty { display: none; }
419
+
420
+ /* Component tiles in the project library */
421
+ #library-content #palette {
422
+ padding: .2rem .15rem .45rem;
423
+ gap: .5rem;
424
+ }
425
+ .component-tile {
426
+ display: grid;
427
+ justify-items: start;
428
+ align-content: start;
429
+ gap: .42rem;
430
+ min-width: 0;
431
+ min-height: 66px;
432
+ padding: .45rem .55rem;
433
+ border-color: var(--studio-line);
434
+ border-radius: 8px;
435
+ background: #f8faf8;
436
+ color: var(--studio-ink);
437
+ cursor: grab;
438
+ font-size: .8rem;
439
+ text-align: left;
440
+ }
441
+ .component-tile:hover {
442
+ border-color: #86ac97;
443
+ background: var(--studio-tint);
444
+ }
445
+ .component-tile:active { cursor: grabbing; }
446
+ .component-mark {
447
+ display: grid;
448
+ place-items: center;
449
+ width: 23px;
450
+ height: 23px;
451
+ border-radius: 5px;
452
+ background: #e3eee7;
453
+ color: var(--studio-green);
454
+ font: 650 .87rem/1 system-ui, sans-serif;
455
+ }
456
+
457
+
458
+ #skills > p { color: var(--studio-muted); font-size: .8rem; }
459
+ #skills summary { margin-top: .45rem; color: var(--studio-green); cursor: pointer; font-weight: 600; }
460
+ .skill-instructions pre { max-height: 16rem; overflow: auto; font-size: .77rem; }
461
+
462
+
463
+ #history-panel { grid-column: 1 / -1; }
464
+ .history-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: .65rem; }
465
+ .history-heading p { color: var(--studio-muted); }
466
+ .history-content { max-width: 78rem; }
467
+ .history-content { display: grid; grid-template-columns: minmax(11rem, 1fr) minmax(0, 2fr); gap: 1rem; }
468
+ #history-list { max-height: 72dvh; overflow-y: auto; padding: .2rem; }
469
+ .history-row { display: grid; gap: .1rem; padding: .6rem; margin-bottom: .3rem; border: 1px solid var(--studio-line); border-radius: 8px; color: var(--studio-ink); text-decoration: none; }
470
+ .history-row:hover, .history-row[aria-current="true"] { background: var(--studio-tint); }
471
+ .history-row > span:not(.lyra-mission-status), .history-row code { font-size: .76rem; color: var(--studio-muted); }
472
+ #history-detail { min-width: 0; overflow-wrap: anywhere; }
473
+ #history-detail h3 { margin: .15rem 0; }
474
+ #history-detail > a { display: block; width: fit-content; margin-top: .55rem; color: var(--studio-green); font-weight: 600; }
475
+ @media (max-width: 580px) {
476
+ .history-content { grid-template-columns: 1fr; }
477
+ #history-list { max-height: 28dvh; }
478
+ }
479
+
480
+
481
+ #cloud-settings, #library.registry-view { grid-column: 1 / -1; }
482
+ #cloud-settings p { max-width: 54ch; color: var(--studio-muted); }
483
+ #library.registry-view { position: static; }
484
+ #library.registry-view input { max-width: 25rem; }
485
+ #library.registry-view .agent-label > strong { white-space: normal; overflow-wrap: anywhere; }
486
+ #library.registry-view #library-content { max-width: 60rem; }
487
+ #studio-views { flex-wrap: wrap; }
488
+
489
+
490
+ .studio-header {
491
+ display: grid;
492
+ grid-template-columns: minmax(0, 1fr) auto;
493
+ gap: .55rem 1rem;
494
+ }
495
+ #studio-views {
496
+ grid-column: 1 / -1;
497
+ gap: .45rem 1.2rem;
498
+ padding: .35rem 0 0;
499
+ border: 0;
500
+ border-top: 1px solid var(--studio-line);
501
+ border-radius: 0;
502
+ background: transparent;
503
+ }
504
+ #studio-views > div { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem; }
505
+ #studio-views > div > span { margin-right: .25rem; color: var(--studio-muted); font-size: .72rem; }
506
+ #studio-views button { min-height: 30px; font-size: .8rem; }
507
+ #studio-views button[aria-pressed="true"] { border-color: #c9dfd0; background: var(--studio-tint); box-shadow: none; }
508
+ #library { top: 7.4rem; }
509
+ .history-detail-tabs {
510
+ display: flex;
511
+ flex-wrap: wrap;
512
+ gap: .4rem;
513
+ padding: .45rem 0 0;
514
+ margin-top: .6rem;
515
+ border-top: 1px solid var(--studio-line);
516
+ }
517
+ .history-detail-tabs button { min-height: 32px; border-color: transparent; font-size: .8rem; }
518
+ .history-detail-tabs button[aria-pressed="true"] { border-color: #c9dfd0; background: var(--studio-tint); }
519
+ @media (max-width: 950px) {
520
+ #library { top: 1rem; }
521
+ #studio-views { gap: .3rem .7rem; }
522
+ }
523
+ @media (max-width: 520px) {
524
+ .studio-header { grid-template-columns: minmax(0, 1fr); }
525
+ }
526
+
527
+
528
+ .intelligence-panel { grid-column: 1 / -1; }
529
+ #graph-content select { max-width: 28rem; }
530
+ #graph-content ul { max-height: 28rem; overflow: auto; }
531
+ #token-content { display: flex; flex-wrap: wrap; gap: 1rem; }
532
+ #token-content section { flex: 1 1 14rem; background: #f8faf8; border: 1px solid var(--studio-line); border-radius: 8px; padding: .8rem; }
533
+
534
+
535
+ .learning-suggestions { margin: .7rem 0; padding: .65rem; background: var(--studio-tint); border-radius: 8px; }
536
+ .learning-suggestions button { margin: .3rem .35rem 0 0; }