agent-lyra 0.8.0 → 0.11.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 (128) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +320 -291
  3. package/bin/agent-lyra.js +51 -51
  4. package/bin/lyra-oss-preview.js +16 -16
  5. package/package.json +60 -60
  6. package/src/app-builder/export.js +109 -109
  7. package/src/app-builder/gateway.js +62 -62
  8. package/src/app-builder/init.js +115 -72
  9. package/src/app-builder/manifest-contract.js +46 -46
  10. package/src/app-builder/native-adapter.js +29 -29
  11. package/src/app-builder/preview.js +35 -31
  12. package/src/app-builder/publish.js +14 -14
  13. package/src/app-builder/saved-app.js +73 -70
  14. package/src/app-builder/saved-preview-browser.js +33 -33
  15. package/src/app-builder/saved-preview.html +24 -24
  16. package/src/app-builder/saved-preview.js +61 -61
  17. package/src/app-builder/support-manifest.js +50 -50
  18. package/src/app-builder/support-template/manifest.json +55 -55
  19. package/src/app-builder/support-template/support-preview.html +56 -56
  20. package/src/app-builder/support-template/support-preview.js +37 -37
  21. package/src/app-builder/support-template/support-preview.mjs +67 -67
  22. package/src/app-builder/support-template/support-workflow.mjs +36 -36
  23. package/src/app-builder/use.js +37 -37
  24. package/src/app-builder/validate.js +31 -21
  25. package/src/app-builder/value-schema.js +37 -37
  26. package/src/catalog.js +147 -147
  27. package/src/coding/catalog.js +56 -56
  28. package/src/coding/cloud-catalog.js +64 -64
  29. package/src/coding/detect-stack.mjs +110 -110
  30. package/src/coding/export.js +133 -133
  31. package/src/coding/setup.js +175 -175
  32. package/src/coding/skills/lyra-android/SKILL.md +37 -37
  33. package/src/coding/skills/lyra-angular/SKILL.md +37 -37
  34. package/src/coding/skills/lyra-cucumber/SKILL.md +37 -37
  35. package/src/coding/skills/lyra-dbt/SKILL.md +37 -37
  36. package/src/coding/skills/lyra-django/SKILL.md +37 -37
  37. package/src/coding/skills/lyra-docker/SKILL.md +37 -37
  38. package/src/coding/skills/lyra-dotnet/SKILL.md +37 -37
  39. package/src/coding/skills/lyra-express/SKILL.md +37 -37
  40. package/src/coding/skills/lyra-fastapi/SKILL.md +37 -37
  41. package/src/coding/skills/lyra-flutter/SKILL.md +37 -37
  42. package/src/coding/skills/lyra-github-actions/SKILL.md +37 -37
  43. package/src/coding/skills/lyra-gitlab-ci/SKILL.md +37 -37
  44. package/src/coding/skills/lyra-go/SKILL.md +37 -37
  45. package/src/coding/skills/lyra-ios/SKILL.md +37 -37
  46. package/src/coding/skills/lyra-kubernetes/SKILL.md +37 -37
  47. package/src/coding/skills/lyra-mongodb/SKILL.md +37 -37
  48. package/src/coding/skills/lyra-mysql/SKILL.md +37 -37
  49. package/src/coding/skills/lyra-nextjs/SKILL.md +37 -37
  50. package/src/coding/skills/lyra-node/SKILL.md +37 -37
  51. package/src/coding/skills/lyra-playwright/SKILL.md +37 -37
  52. package/src/coding/skills/lyra-postgresql/SKILL.md +37 -37
  53. package/src/coding/skills/lyra-python/SKILL.md +37 -37
  54. package/src/coding/skills/lyra-react/SKILL.md +37 -37
  55. package/src/coding/skills/lyra-react-native/SKILL.md +37 -37
  56. package/src/coding/skills/lyra-redis/SKILL.md +37 -37
  57. package/src/coding/skills/lyra-rust/SKILL.md +37 -37
  58. package/src/coding/skills/lyra-spark/SKILL.md +37 -37
  59. package/src/coding/skills/lyra-spring-boot/SKILL.md +37 -37
  60. package/src/coding/skills/lyra-svelte/SKILL.md +37 -37
  61. package/src/coding/skills/lyra-terraform/SKILL.md +37 -37
  62. package/src/coding/skills/lyra-typescript/SKILL.md +37 -37
  63. package/src/coding/skills/lyra-vue/SKILL.md +37 -37
  64. package/src/framework/agent.js +181 -181
  65. package/src/framework/mda.js +65 -65
  66. package/src/framework/run.py +111 -111
  67. package/src/gated/hostedAgents.js +56 -56
  68. package/src/gated/index.d.ts +25 -25
  69. package/src/gated/index.js +5 -5
  70. package/src/index.d.ts +2 -2
  71. package/src/index.js +2 -2
  72. package/src/init.js +963 -960
  73. package/src/intelligence/graphsnip-provider.d.ts +5 -5
  74. package/src/intelligence/graphsnip-provider.js +57 -57
  75. package/src/intelligence/lifecycle.js +25 -25
  76. package/src/memory/LICENSE +21 -21
  77. package/src/memory/README.md +5 -5
  78. package/src/memory/UPSTREAM.json +24 -24
  79. package/src/memory/bridge-cli.js +16 -16
  80. package/src/memory/bridge.js +18 -18
  81. package/src/memory/cli.js +21 -21
  82. package/src/memory/cloud-sync-actions.js +61 -61
  83. package/src/memory/contract.json +45 -45
  84. package/src/memory/index.d.ts +50 -50
  85. package/src/memory/index.js +7 -7
  86. package/src/memory/lifecycle.js +29 -29
  87. package/src/memory/local-cli.js +34 -34
  88. package/src/memory/local-store.js +209 -209
  89. package/src/memory/package.json +33 -33
  90. package/src/memory/proposals.js +90 -90
  91. package/src/memory/skills-cli.js +26 -26
  92. package/src/memory/standalone.d.ts +50 -50
  93. package/src/memory/standalone.js +1 -1
  94. package/src/memory/sync.js +89 -89
  95. package/src/memory/validation.js +25 -25
  96. package/src/onboardingAgents.js +532 -532
  97. package/src/promptTemplates.js +178 -178
  98. package/src/resource-files.js +18 -18
  99. package/src/runtime/contracts.d.ts +47 -47
  100. package/src/runtime/local-cli.js +161 -161
  101. package/src/runtime/mcp-stdio.js +111 -111
  102. package/src/runtime/orchestration.js +59 -59
  103. package/src/runtime/run-agent.js +54 -54
  104. package/src/standalone/index.d.ts +45 -45
  105. package/src/standalone/index.js +13 -13
  106. package/src/standalone/init.js +14 -12
  107. package/src/standalone/orchestration.js +6 -6
  108. package/src/standalone/rag.js +113 -113
  109. package/src/studio/agent-ui.css +43 -43
  110. package/src/studio/agent-ui.js +32 -32
  111. package/src/studio/browser.js +562 -345
  112. package/src/studio/cli-providers.js +40 -0
  113. package/src/studio/export.js +83 -86
  114. package/src/studio/index.html +74 -37
  115. package/src/studio/memory-actions.js +37 -37
  116. package/src/studio/memory-panel.js +200 -200
  117. package/src/studio/project.js +333 -240
  118. package/src/studio/pull-agent.js +72 -72
  119. package/src/studio/push.js +54 -54
  120. package/src/studio/python-agent.js +47 -47
  121. package/src/studio/python-agent.py +25 -25
  122. package/src/studio/server.js +164 -150
  123. package/src/studio/session.js +83 -83
  124. package/src/studio/studio.css +257 -10
  125. package/src/studio/sync.js +42 -42
  126. package/src/studio/workflow-editor.js +240 -0
  127. package/src/studio/workflow-sync.js +229 -157
  128. package/src/vscode/workspace.js +158 -0
@@ -1,33 +1,33 @@
1
- const form = document.querySelector("form");
2
- const button = form.querySelector("button");
3
- const status = document.querySelector("#status");
4
- const result = document.querySelector("#result");
5
-
6
- fetch("/api/app").then(response => response.json()).then(({ name }) => {
7
- document.title = name;
8
- document.querySelector("h1").textContent = name;
9
- }).catch(() => { status.textContent = "Could not load application details."; });
10
-
11
- form.addEventListener("submit", async event => {
12
- event.preventDefault();
13
- button.disabled = true;
14
- result.hidden = true;
15
- status.textContent = "Running both agents…";
16
- try {
17
- const response = await fetch("/api/run", {
18
- method: "POST",
19
- headers: { "Content-Type": "application/json" },
20
- body: JSON.stringify({ input: document.querySelector("#input").value }),
21
- });
22
- const data = await response.json();
23
- if (!response.ok) throw new Error(data.error);
24
- document.querySelector("#output").textContent = data.output;
25
- document.querySelector("#first").textContent = data.firstOutput;
26
- result.hidden = false;
27
- status.textContent = "Workflow completed.";
28
- } catch (error) {
29
- status.textContent = error.message;
30
- } finally {
31
- button.disabled = false;
32
- }
33
- });
1
+ const form = document.querySelector("form");
2
+ const button = form.querySelector("button");
3
+ const status = document.querySelector("#status");
4
+ const result = document.querySelector("#result");
5
+
6
+ fetch("/api/app").then(response => response.json()).then(({ name }) => {
7
+ document.title = name;
8
+ document.querySelector("h1").textContent = name;
9
+ }).catch(() => { status.textContent = "Could not load application details."; });
10
+
11
+ form.addEventListener("submit", async event => {
12
+ event.preventDefault();
13
+ button.disabled = true;
14
+ result.hidden = true;
15
+ status.textContent = "Running both agents…";
16
+ try {
17
+ const response = await fetch("/api/run", {
18
+ method: "POST",
19
+ headers: { "Content-Type": "application/json" },
20
+ body: JSON.stringify({ input: document.querySelector("#input").value }),
21
+ });
22
+ const data = await response.json();
23
+ if (!response.ok) throw new Error(data.error);
24
+ document.querySelector("#output").textContent = data.output;
25
+ document.querySelector("#first").textContent = data.firstOutput;
26
+ result.hidden = false;
27
+ status.textContent = "Workflow completed.";
28
+ } catch (error) {
29
+ status.textContent = error.message;
30
+ } finally {
31
+ button.disabled = false;
32
+ }
33
+ });
@@ -1,24 +1,24 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Lyra application</title>
7
- <style>
8
- body { background:#f6f9f7;color:#152c23;font:1rem/1.6 system-ui,sans-serif;margin:0 }
9
- main { max-width:50rem;margin:4rem auto;padding:0 1.25rem }
10
- label,textarea,button { display:block;font:inherit }
11
- textarea { box-sizing:border-box;width:100%;min-height:8rem;margin:.45rem 0 1rem;padding:.75rem;border:1px solid #8ea99c;border-radius:.5rem }
12
- button { background:#174b38;color:white;border:0;border-radius:.5rem;padding:.6rem 1rem;cursor:pointer }
13
- button:disabled { opacity:.65;cursor:wait }
14
- pre { white-space:pre-wrap;overflow-wrap:anywhere;background:white;padding:1rem;border:1px solid #cfddd5;border-radius:.5rem;font:inherit }
15
- </style>
16
- <script src="/preview.js" defer></script>
17
- </head>
18
- <body><main>
19
- <h1>Lyra application</h1>
20
- <form><label for="input">Workflow input</label><textarea id="input" required maxlength="4000"></textarea><button>Run workflow</button></form>
21
- <p role="status" id="status"></p>
22
- <section hidden id="result"><h2>Final result</h2><pre id="output"></pre><details><summary>First agent output</summary><pre id="first"></pre></details></section>
23
- </main></body>
24
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Lyra application</title>
7
+ <style>
8
+ body { background:#f6f9f7;color:#152c23;font:1rem/1.6 system-ui,sans-serif;margin:0 }
9
+ main { max-width:50rem;margin:4rem auto;padding:0 1.25rem }
10
+ label,textarea,button { display:block;font:inherit }
11
+ textarea { box-sizing:border-box;width:100%;min-height:8rem;margin:.45rem 0 1rem;padding:.75rem;border:1px solid #8ea99c;border-radius:.5rem }
12
+ button { background:#174b38;color:white;border:0;border-radius:.5rem;padding:.6rem 1rem;cursor:pointer }
13
+ button:disabled { opacity:.65;cursor:wait }
14
+ pre { white-space:pre-wrap;overflow-wrap:anywhere;background:white;padding:1rem;border:1px solid #cfddd5;border-radius:.5rem;font:inherit }
15
+ </style>
16
+ <script src="/preview.js" defer></script>
17
+ </head>
18
+ <body><main>
19
+ <h1>Lyra application</h1>
20
+ <form><label for="input">Workflow input</label><textarea id="input" required maxlength="4000"></textarea><button>Run workflow</button></form>
21
+ <p role="status" id="status"></p>
22
+ <section hidden id="result"><h2>Final result</h2><pre id="output"></pre><details><summary>First agent output</summary><pre id="first"></pre></details></section>
23
+ </main></body>
24
+ </html>
@@ -1,61 +1,61 @@
1
- import { createServer } from "node:http";
2
- import { readFile } from "node:fs/promises";
3
- import { createSavedAgentClient, runSavedApp, validateSavedApp } from "./saved-app.js";
4
-
5
- export async function startSavedPreview(manifest, { port = Number(process.env.LYRA_PREVIEW_PORT ?? 4173), client } = {}) {
6
- validateSavedApp(manifest);
7
- client ??= createSavedAgentClient();
8
- if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error("Invalid preview port.");
9
- const [html, script] = await Promise.all(["saved-preview.html", "saved-preview-browser.js"].map(
10
- name => readFile(new URL("./" + name, import.meta.url)),
11
- ));
12
- const server = createServer(async (req, res) => {
13
- const send = (status, body, type = "application/json; charset=utf-8") => {
14
- res.writeHead(status, {
15
- "Content-Type": type, "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff",
16
- "Content-Security-Policy": "default-src 'none'; script-src 'self'; style-src 'unsafe-inline'; connect-src 'self'; frame-ancestors 'none'",
17
- });
18
- res.end(type.startsWith("application/json") ? JSON.stringify(body) : body);
19
- };
20
- const authority = "127.0.0.1:" + server.address().port;
21
- if (req.headers.host !== authority) return send(403, { error: "Use the loopback address." });
22
- if (req.method === "GET" && req.url === "/") return send(200, html, "text/html; charset=utf-8");
23
- if (req.method === "GET" && req.url === "/preview.js") return send(200, script, "text/javascript; charset=utf-8");
24
- if (req.method === "GET" && req.url === "/api/app") return send(200, { name: manifest.application.name });
25
- if (req.method !== "POST" || req.url !== "/api/run") return send(404, { error: "Not found." });
26
- if (req.headers.origin !== "http://" + authority) return send(403, { error: "Use the application page to run agents." });
27
- if (req.headers["content-type"]?.split(";")[0] !== "application/json") return send(415, { error: "Use application/json." });
28
-
29
- const chunks = [];
30
- let size = 0;
31
- let input;
32
- try {
33
- for await (const chunk of req) {
34
- size += chunk.length;
35
- if (size > 24_576) return send(413, { error: "Input is too large." });
36
- chunks.push(chunk);
37
- }
38
- input = JSON.parse(Buffer.concat(chunks).toString("utf8"))?.input;
39
- } catch {
40
- return send(400, { error: "Invalid request." });
41
- }
42
- if (typeof input !== "string" || !input.trim() || input.length > 4000) {
43
- return send(400, { error: "Enter between 1 and 4,000 characters." });
44
- }
45
- try {
46
- send(200, await runSavedApp(manifest, input, client));
47
- } catch (error) {
48
- send(502, { error: error.message });
49
- }
50
- });
51
-
52
- server.requestTimeout = 10_000;
53
- await new Promise((resolve, reject) => {
54
- server.once("error", reject);
55
- server.listen(port, "127.0.0.1", resolve);
56
- }).catch(error => {
57
- if (error.code === "EADDRINUSE") throw new Error("Preview port is busy. Set LYRA_PREVIEW_PORT=0 to pick a free port.");
58
- throw error;
59
- });
60
- return { server, url: "http://127.0.0.1:" + server.address().port + "/" };
61
- }
1
+ import { createServer } from "node:http";
2
+ import { readFile } from "node:fs/promises";
3
+ import { createSavedAgentClient, runSavedApp, validateSavedApp } from "./saved-app.js";
4
+
5
+ export async function startSavedPreview(manifest, { port = Number(process.env.LYRA_PREVIEW_PORT ?? 4173), client } = {}) {
6
+ validateSavedApp(manifest);
7
+ client ??= createSavedAgentClient();
8
+ if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error("Invalid preview port.");
9
+ const [html, script] = await Promise.all(["saved-preview.html", "saved-preview-browser.js"].map(
10
+ name => readFile(new URL("./" + name, import.meta.url)),
11
+ ));
12
+ const server = createServer(async (req, res) => {
13
+ const send = (status, body, type = "application/json; charset=utf-8") => {
14
+ res.writeHead(status, {
15
+ "Content-Type": type, "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff",
16
+ "Content-Security-Policy": "default-src 'none'; script-src 'self'; style-src 'unsafe-inline'; connect-src 'self'; frame-ancestors 'none'",
17
+ });
18
+ res.end(type.startsWith("application/json") ? JSON.stringify(body) : body);
19
+ };
20
+ const authority = "127.0.0.1:" + server.address().port;
21
+ if (req.headers.host !== authority) return send(403, { error: "Use the loopback address." });
22
+ if (req.method === "GET" && req.url === "/") return send(200, html, "text/html; charset=utf-8");
23
+ if (req.method === "GET" && req.url === "/preview.js") return send(200, script, "text/javascript; charset=utf-8");
24
+ if (req.method === "GET" && req.url === "/api/app") return send(200, { name: manifest.application.name });
25
+ if (req.method !== "POST" || req.url !== "/api/run") return send(404, { error: "Not found." });
26
+ if (req.headers.origin !== "http://" + authority) return send(403, { error: "Use the application page to run agents." });
27
+ if (req.headers["content-type"]?.split(";")[0] !== "application/json") return send(415, { error: "Use application/json." });
28
+
29
+ const chunks = [];
30
+ let size = 0;
31
+ let input;
32
+ try {
33
+ for await (const chunk of req) {
34
+ size += chunk.length;
35
+ if (size > 24_576) return send(413, { error: "Input is too large." });
36
+ chunks.push(chunk);
37
+ }
38
+ input = JSON.parse(Buffer.concat(chunks).toString("utf8"))?.input;
39
+ } catch {
40
+ return send(400, { error: "Invalid request." });
41
+ }
42
+ if (typeof input !== "string" || !input.trim() || input.length > 4000) {
43
+ return send(400, { error: "Enter between 1 and 4,000 characters." });
44
+ }
45
+ try {
46
+ send(200, await runSavedApp(manifest, input, client));
47
+ } catch (error) {
48
+ send(502, { error: error.message });
49
+ }
50
+ });
51
+
52
+ server.requestTimeout = 10_000;
53
+ await new Promise((resolve, reject) => {
54
+ server.once("error", reject);
55
+ server.listen(port, "127.0.0.1", resolve);
56
+ }).catch(error => {
57
+ if (error.code === "EADDRINUSE") throw new Error("Preview port is busy. Set LYRA_PREVIEW_PORT=0 to pick a free port.");
58
+ throw error;
59
+ });
60
+ return { server, url: "http://127.0.0.1:" + server.address().port + "/" };
61
+ }
@@ -1,50 +1,50 @@
1
- import { readFile } from "node:fs/promises";
2
- import { validateAppManifest } from "./validate.js";
3
- import { matchesValueSchema } from "./value-schema.js";
4
-
5
- export function projectSupportManifest(manifest) {
6
- validateAppManifest(manifest);
7
- const { preview } = manifest;
8
- if (preview?.template !== "support" || preview.classifyAction === preview.draftAction) {
9
- throw new Error("Choose the support preview template with two distinct actions.");
10
- }
11
- const bind = (id, adapterId) => {
12
- const action = manifest.actions.find((entry) => entry.id === id);
13
- const capability = manifest.capabilities.find((entry) => entry.id === action?.capabilityId);
14
- if (capability?.adapterId !== adapterId || capability.executionMode !== "in-process") {
15
- throw new Error(`The support template requires an in-process ${adapterId} action.`);
16
- }
17
- const { id: capabilityId, executionMode, inputSchema, outputSchema } = capability;
18
- return { action: { id, capabilityId }, capability: { id: capabilityId, adapterId, executionMode, inputSchema, outputSchema } };
19
- };
20
- const classify = bind(preview.classifyAction, "mock");
21
- const draft = bind(preview.draftAction, "native");
22
- for (const [binding, sampleInput, sampleOutput] of [
23
- [classify, "Invoice question", { category: "billing" }],
24
- [draft, "billing", "Draft reply"],
25
- ]) {
26
- const { inputSchema, outputSchema } = binding.capability;
27
- if ((inputSchema && !matchesValueSchema(sampleInput, inputSchema)) ||
28
- (outputSchema && !matchesValueSchema(sampleOutput, outputSchema))) {
29
- throw new Error(`Action ${binding.action.id} has an incompatible schema for the support template.`);
30
- }
31
- }
32
- return {
33
- version: manifest.version,
34
- application: { id: manifest.application.id, name: manifest.application.name },
35
- preview: { template: "support", classifyAction: classify.action.id, draftAction: draft.action.id },
36
- capabilities: [classify.capability, draft.capability],
37
- actions: [classify.action, draft.action],
38
- };
39
- }
40
-
41
- export async function readSupportManifest(path) {
42
- const source = await readFile(path, "utf8");
43
- let raw;
44
- try {
45
- raw = JSON.parse(source.replace(/^\uFEFF/, ""));
46
- } catch {
47
- throw new Error("Application manifest is not valid JSON.");
48
- }
49
- return projectSupportManifest(raw);
50
- }
1
+ import { readFile } from "node:fs/promises";
2
+ import { validateAppManifest } from "./validate.js";
3
+ import { matchesValueSchema } from "./value-schema.js";
4
+
5
+ export function projectSupportManifest(manifest) {
6
+ validateAppManifest(manifest);
7
+ const { preview } = manifest;
8
+ if (preview?.template !== "support" || preview.classifyAction === preview.draftAction) {
9
+ throw new Error("Choose the support preview template with two distinct actions.");
10
+ }
11
+ const bind = (id, adapterId) => {
12
+ const action = manifest.actions.find((entry) => entry.id === id);
13
+ const capability = manifest.capabilities.find((entry) => entry.id === action?.capabilityId);
14
+ if (capability?.adapterId !== adapterId || capability.executionMode !== "in-process") {
15
+ throw new Error(`The support template requires an in-process ${adapterId} action.`);
16
+ }
17
+ const { id: capabilityId, executionMode, inputSchema, outputSchema } = capability;
18
+ return { action: { id, capabilityId }, capability: { id: capabilityId, adapterId, executionMode, inputSchema, outputSchema } };
19
+ };
20
+ const classify = bind(preview.classifyAction, "mock");
21
+ const draft = bind(preview.draftAction, "native");
22
+ for (const [binding, sampleInput, sampleOutput] of [
23
+ [classify, "Invoice question", { category: "billing" }],
24
+ [draft, "billing", "Draft reply"],
25
+ ]) {
26
+ const { inputSchema, outputSchema } = binding.capability;
27
+ if ((inputSchema && !matchesValueSchema(sampleInput, inputSchema)) ||
28
+ (outputSchema && !matchesValueSchema(sampleOutput, outputSchema))) {
29
+ throw new Error(`Action ${binding.action.id} has an incompatible schema for the support template.`);
30
+ }
31
+ }
32
+ return {
33
+ version: manifest.version,
34
+ application: { id: manifest.application.id, name: manifest.application.name },
35
+ preview: { template: "support", classifyAction: classify.action.id, draftAction: draft.action.id },
36
+ capabilities: [classify.capability, draft.capability],
37
+ actions: [classify.action, draft.action],
38
+ };
39
+ }
40
+
41
+ export async function readSupportManifest(path) {
42
+ const source = await readFile(path, "utf8");
43
+ let raw;
44
+ try {
45
+ raw = JSON.parse(source.replace(/^\uFEFF/, ""));
46
+ } catch {
47
+ throw new Error("Application manifest is not valid JSON.");
48
+ }
49
+ return projectSupportManifest(raw);
50
+ }
@@ -1,55 +1,55 @@
1
- {
2
- "version": "1.0",
3
- "application": {
4
- "id": "support-iq",
5
- "name": "Support IQ"
6
- },
7
- "capabilities": [
8
- {
9
- "id": "classify-ticket",
10
- "adapterId": "mock",
11
- "executionMode": "in-process",
12
- "inputSchema": {
13
- "type": "string"
14
- },
15
- "outputSchema": {
16
- "type": "object",
17
- "properties": {
18
- "category": {
19
- "type": "string"
20
- }
21
- },
22
- "required": [
23
- "category"
24
- ],
25
- "additionalProperties": false
26
- }
27
- },
28
- {
29
- "id": "draft-reply",
30
- "adapterId": "native",
31
- "executionMode": "in-process",
32
- "inputSchema": {
33
- "type": "string"
34
- },
35
- "outputSchema": {
36
- "type": "string"
37
- }
38
- }
39
- ],
40
- "actions": [
41
- {
42
- "id": "classify",
43
- "capabilityId": "classify-ticket"
44
- },
45
- {
46
- "id": "draft",
47
- "capabilityId": "draft-reply"
48
- }
49
- ],
50
- "preview": {
51
- "template": "support",
52
- "classifyAction": "classify",
53
- "draftAction": "draft"
54
- }
55
- }
1
+ {
2
+ "version": "1.0",
3
+ "application": {
4
+ "id": "support-iq",
5
+ "name": "Support IQ"
6
+ },
7
+ "capabilities": [
8
+ {
9
+ "id": "classify-ticket",
10
+ "adapterId": "mock",
11
+ "executionMode": "in-process",
12
+ "inputSchema": {
13
+ "type": "string"
14
+ },
15
+ "outputSchema": {
16
+ "type": "object",
17
+ "properties": {
18
+ "category": {
19
+ "type": "string"
20
+ }
21
+ },
22
+ "required": [
23
+ "category"
24
+ ],
25
+ "additionalProperties": false
26
+ }
27
+ },
28
+ {
29
+ "id": "draft-reply",
30
+ "adapterId": "native",
31
+ "executionMode": "in-process",
32
+ "inputSchema": {
33
+ "type": "string"
34
+ },
35
+ "outputSchema": {
36
+ "type": "string"
37
+ }
38
+ }
39
+ ],
40
+ "actions": [
41
+ {
42
+ "id": "classify",
43
+ "capabilityId": "classify-ticket"
44
+ },
45
+ {
46
+ "id": "draft",
47
+ "capabilityId": "draft-reply"
48
+ }
49
+ ],
50
+ "preview": {
51
+ "template": "support",
52
+ "classifyAction": "classify",
53
+ "draftAction": "draft"
54
+ }
55
+ }
@@ -1,56 +1,56 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>__LYRA_APP_TITLE__ | AgentLyra</title>
7
- <style>
8
- :root { color-scheme: light; font-family: system-ui, sans-serif; color: #16302a; background: #f3f6f4; }
9
- body { margin: 0; }
10
- main { width: min(100% - 2rem, 64rem); margin: 3rem auto; }
11
- h1 { margin: .25rem 0 1.5rem; font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -.055em; }
12
- h2 { margin: 0 0 1rem; font-size: 1.15rem; }
13
- .label { color: #436459; font-weight: 650; }
14
- .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
15
- section { padding: 1.25rem; background: #fff; border: 1px solid #cedcd4; border-radius: .8rem; min-width: 0; }
16
- textarea { box-sizing: border-box; display: block; margin: .5rem 0 1rem; padding: .8rem; width: 100%; min-height: 11rem; resize: vertical; border: 1px solid #859d91; border-radius: .4rem; font: inherit; color: inherit; }
17
- button { background: #245745; color: white; font: inherit; font-weight: 650; padding: .65rem 1rem; border: 0; border-radius: .4rem; cursor: pointer; }
18
- button:disabled { opacity: .65; cursor: wait; }
19
- dd { margin: .3rem 0 1rem; overflow-wrap: anywhere; }
20
- dt { font-weight: 650; }
21
- #draft { white-space: pre-wrap; }
22
- #status { min-height: 1.5em; margin-bottom: 0; }
23
- #status[data-error] { color: #a52430; }
24
- @media (max-width: 650px) { .grid { grid-template-columns: 1fr; } }
25
- </style>
26
- <script type="module" src="/preview.js"></script>
27
- </head>
28
- <body>
29
- <main>
30
- <div class="label">AgentLyra · Local preview</div>
31
- <h1>__LYRA_APP_TITLE__</h1>
32
- <div class="grid">
33
- <section aria-labelledby="ticket-heading">
34
- <h2 id="ticket-heading">Support ticket</h2>
35
- <form id="ticket-form">
36
- <label for="ticket">Customer message</label>
37
- <textarea id="ticket" required maxlength="2000">I was charged twice for an invoice.</textarea>
38
- <button type="submit">Draft reply</button>
39
- </form>
40
- <p id="status" role="status">Demo logic runs locally. Drafts stay on this screen.</p>
41
- </section>
42
- <section aria-labelledby="result-heading">
43
- <h2 id="result-heading">Draft and trace</h2>
44
- <p id="empty">Submit a ticket to see its category, draft reply, and run trace.</p>
45
- <dl id="result" hidden>
46
- <dt>Category</dt><dd id="category"></dd>
47
- <dt>Draft reply</dt><dd id="draft"></dd>
48
- <dt>Correlation ID</dt><dd id="correlation"></dd>
49
- <dt>Native run ID</dt><dd id="run"></dd>
50
- <dt>Events</dt><dd id="events"></dd>
51
- </dl>
52
- </section>
53
- </div>
54
- </main>
55
- </body>
56
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>__LYRA_APP_TITLE__ | AgentLyra</title>
7
+ <style>
8
+ :root { color-scheme: light; font-family: system-ui, sans-serif; color: #16302a; background: #f3f6f4; }
9
+ body { margin: 0; }
10
+ main { width: min(100% - 2rem, 64rem); margin: 3rem auto; }
11
+ h1 { margin: .25rem 0 1.5rem; font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -.055em; }
12
+ h2 { margin: 0 0 1rem; font-size: 1.15rem; }
13
+ .label { color: #436459; font-weight: 650; }
14
+ .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
15
+ section { padding: 1.25rem; background: #fff; border: 1px solid #cedcd4; border-radius: .8rem; min-width: 0; }
16
+ textarea { box-sizing: border-box; display: block; margin: .5rem 0 1rem; padding: .8rem; width: 100%; min-height: 11rem; resize: vertical; border: 1px solid #859d91; border-radius: .4rem; font: inherit; color: inherit; }
17
+ button { background: #245745; color: white; font: inherit; font-weight: 650; padding: .65rem 1rem; border: 0; border-radius: .4rem; cursor: pointer; }
18
+ button:disabled { opacity: .65; cursor: wait; }
19
+ dd { margin: .3rem 0 1rem; overflow-wrap: anywhere; }
20
+ dt { font-weight: 650; }
21
+ #draft { white-space: pre-wrap; }
22
+ #status { min-height: 1.5em; margin-bottom: 0; }
23
+ #status[data-error] { color: #a52430; }
24
+ @media (max-width: 650px) { .grid { grid-template-columns: 1fr; } }
25
+ </style>
26
+ <script type="module" src="/preview.js"></script>
27
+ </head>
28
+ <body>
29
+ <main>
30
+ <div class="label">AgentLyra · Local preview</div>
31
+ <h1>__LYRA_APP_TITLE__</h1>
32
+ <div class="grid">
33
+ <section aria-labelledby="ticket-heading">
34
+ <h2 id="ticket-heading">Support ticket</h2>
35
+ <form id="ticket-form">
36
+ <label for="ticket">Customer message</label>
37
+ <textarea id="ticket" required maxlength="2000">I was charged twice for an invoice.</textarea>
38
+ <button type="submit">Draft reply</button>
39
+ </form>
40
+ <p id="status" role="status">Demo logic runs locally. Drafts stay on this screen.</p>
41
+ </section>
42
+ <section aria-labelledby="result-heading">
43
+ <h2 id="result-heading">Draft and trace</h2>
44
+ <p id="empty">Submit a ticket to see its category, draft reply, and run trace.</p>
45
+ <dl id="result" hidden>
46
+ <dt>Category</dt><dd id="category"></dd>
47
+ <dt>Draft reply</dt><dd id="draft"></dd>
48
+ <dt>Correlation ID</dt><dd id="correlation"></dd>
49
+ <dt>Native run ID</dt><dd id="run"></dd>
50
+ <dt>Events</dt><dd id="events"></dd>
51
+ </dl>
52
+ </section>
53
+ </div>
54
+ </main>
55
+ </body>
56
+ </html>
@@ -1,37 +1,37 @@
1
- const form = document.getElementById("ticket-form");
2
- const button = form.querySelector("button");
3
- const status = document.getElementById("status");
4
- const result = document.getElementById("result");
5
- const empty = document.getElementById("empty");
6
-
7
- form.addEventListener("submit", async (event) => {
8
- event.preventDefault();
9
- button.disabled = true;
10
- result.hidden = true;
11
- empty.hidden = true;
12
- delete status.dataset.error;
13
- status.textContent = "Running the support workflow…";
14
- try {
15
- const response = await fetch("/api/ticket", {
16
- method: "POST",
17
- headers: { "Content-Type": "application/json" },
18
- body: JSON.stringify({ ticket: document.getElementById("ticket").value }),
19
- });
20
- const data = await response.json();
21
- if (!response.ok) throw new Error(data.error);
22
- for (const [id, value] of Object.entries({
23
- category: data.category, draft: data.draft, correlation: data.correlationId,
24
- run: data.nativeExecutionId, events: data.events.join(" → "),
25
- })) {
26
- document.getElementById(id).textContent = value;
27
- }
28
- result.hidden = false;
29
- status.textContent = "Draft ready for review.";
30
- } catch (error) {
31
- status.dataset.error = "";
32
- status.textContent = error.message || "Could not run the workflow.";
33
- empty.hidden = false;
34
- } finally {
35
- button.disabled = false;
36
- }
37
- });
1
+ const form = document.getElementById("ticket-form");
2
+ const button = form.querySelector("button");
3
+ const status = document.getElementById("status");
4
+ const result = document.getElementById("result");
5
+ const empty = document.getElementById("empty");
6
+
7
+ form.addEventListener("submit", async (event) => {
8
+ event.preventDefault();
9
+ button.disabled = true;
10
+ result.hidden = true;
11
+ empty.hidden = true;
12
+ delete status.dataset.error;
13
+ status.textContent = "Running the support workflow…";
14
+ try {
15
+ const response = await fetch("/api/ticket", {
16
+ method: "POST",
17
+ headers: { "Content-Type": "application/json" },
18
+ body: JSON.stringify({ ticket: document.getElementById("ticket").value }),
19
+ });
20
+ const data = await response.json();
21
+ if (!response.ok) throw new Error(data.error);
22
+ for (const [id, value] of Object.entries({
23
+ category: data.category, draft: data.draft, correlation: data.correlationId,
24
+ run: data.nativeExecutionId, events: data.events.join(" → "),
25
+ })) {
26
+ document.getElementById(id).textContent = value;
27
+ }
28
+ result.hidden = false;
29
+ status.textContent = "Draft ready for review.";
30
+ } catch (error) {
31
+ status.dataset.error = "";
32
+ status.textContent = error.message || "Could not run the workflow.";
33
+ empty.hidden = false;
34
+ } finally {
35
+ button.disabled = false;
36
+ }
37
+ });