agent-lyra 0.6.2 → 0.6.3
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/LICENSE +21 -21
- package/README.md +435 -435
- package/bin/agent-lyra.js +49 -49
- package/bin/lyra-oss-preview.js +16 -14
- package/package.json +60 -60
- package/src/app-builder/export.js +109 -109
- package/src/app-builder/gateway.js +62 -62
- package/src/app-builder/init.js +52 -52
- package/src/app-builder/manifest-contract.js +46 -46
- package/src/app-builder/native-adapter.js +29 -29
- package/src/app-builder/preview.js +22 -22
- package/src/app-builder/publish.js +14 -14
- package/src/app-builder/saved-app.js +70 -70
- package/src/app-builder/saved-preview-browser.js +33 -33
- package/src/app-builder/saved-preview.html +24 -24
- package/src/app-builder/saved-preview.js +61 -61
- package/src/app-builder/support-manifest.js +50 -50
- package/src/app-builder/support-template/manifest.json +55 -55
- package/src/app-builder/support-template/support-preview.html +56 -56
- package/src/app-builder/support-template/support-preview.js +37 -37
- package/src/app-builder/support-template/support-preview.mjs +67 -67
- package/src/app-builder/support-template/support-workflow.mjs +36 -36
- package/src/app-builder/use.js +37 -37
- package/src/app-builder/validate.js +21 -21
- package/src/app-builder/value-schema.js +37 -37
- package/src/catalog.js +147 -147
- package/src/coding/catalog.js +56 -56
- package/src/coding/cloud-catalog.js +64 -44
- package/src/coding/detect-stack.mjs +110 -110
- package/src/coding/export.js +130 -130
- package/src/coding/setup.js +175 -174
- package/src/coding/skills/lyra-android/SKILL.md +37 -0
- package/src/coding/skills/lyra-angular/SKILL.md +37 -0
- package/src/coding/skills/lyra-cucumber/SKILL.md +37 -0
- package/src/coding/skills/lyra-dbt/SKILL.md +37 -0
- package/src/coding/skills/lyra-django/SKILL.md +37 -0
- package/src/coding/skills/lyra-docker/SKILL.md +37 -0
- package/src/coding/skills/lyra-dotnet/SKILL.md +37 -0
- package/src/coding/skills/lyra-express/SKILL.md +37 -0
- package/src/coding/skills/lyra-fastapi/SKILL.md +37 -0
- package/src/coding/skills/lyra-flutter/SKILL.md +37 -0
- package/src/coding/skills/lyra-github-actions/SKILL.md +37 -0
- package/src/coding/skills/lyra-gitlab-ci/SKILL.md +37 -0
- package/src/coding/skills/lyra-go/SKILL.md +37 -0
- package/src/coding/skills/lyra-ios/SKILL.md +37 -0
- package/src/coding/skills/lyra-kubernetes/SKILL.md +37 -0
- package/src/coding/skills/lyra-mongodb/SKILL.md +37 -0
- package/src/coding/skills/lyra-mysql/SKILL.md +37 -0
- package/src/coding/skills/lyra-nextjs/SKILL.md +37 -0
- package/src/coding/skills/lyra-node/SKILL.md +37 -0
- package/src/coding/skills/lyra-playwright/SKILL.md +37 -0
- package/src/coding/skills/lyra-postgresql/SKILL.md +37 -0
- package/src/coding/skills/lyra-python/SKILL.md +37 -0
- package/src/coding/skills/lyra-react/SKILL.md +37 -0
- package/src/coding/skills/lyra-react-native/SKILL.md +37 -0
- package/src/coding/skills/lyra-redis/SKILL.md +37 -0
- package/src/coding/skills/lyra-rust/SKILL.md +37 -0
- package/src/coding/skills/lyra-spark/SKILL.md +37 -0
- package/src/coding/skills/lyra-spring-boot/SKILL.md +37 -0
- package/src/coding/skills/lyra-svelte/SKILL.md +37 -0
- package/src/coding/skills/lyra-terraform/SKILL.md +37 -0
- package/src/coding/skills/lyra-typescript/SKILL.md +37 -0
- package/src/coding/skills/lyra-vue/SKILL.md +37 -0
- package/src/gated/hostedAgents.js +56 -56
- package/src/gated/index.d.ts +25 -25
- package/src/gated/index.js +5 -5
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -2
- package/src/init.js +965 -965
- package/src/memory/cli.js +21 -21
- package/src/memory/contract.json +28 -28
- package/src/memory/index.d.ts +49 -49
- package/src/memory/index.js +259 -259
- package/src/memory/lifecycle.js +29 -29
- package/src/memory/local-cli.js +34 -34
- package/src/memory/proposals.js +84 -84
- package/src/memory/skills-cli.js +26 -26
- package/src/memory/sync.js +89 -89
- package/src/memory/validation.js +25 -25
- package/src/onboardingAgents.js +532 -532
- package/src/promptTemplates.js +178 -178
- package/src/runtime/contracts.d.ts +47 -47
- package/src/runtime/local-cli.js +160 -160
- package/src/runtime/mcp-stdio.js +111 -111
- package/src/runtime/orchestration.js +59 -59
- package/src/runtime/run-agent.js +43 -43
- package/src/standalone/index.d.ts +45 -45
- package/src/standalone/index.js +13 -13
- package/src/standalone/init.js +12 -0
- package/src/standalone/orchestration.js +6 -6
- package/src/standalone/rag.js +113 -113
- package/src/studio/agent-ui.css +43 -43
- package/src/studio/agent-ui.js +32 -32
- package/src/studio/browser.js +331 -331
- package/src/studio/export.js +80 -80
- package/src/studio/index.html +37 -37
- package/src/studio/memory-actions.js +37 -37
- package/src/studio/memory-panel.js +200 -200
- package/src/studio/project.js +216 -216
- package/src/studio/pull-agent.js +72 -72
- package/src/studio/push.js +54 -54
- package/src/studio/python-agent.js +47 -47
- package/src/studio/python-agent.py +25 -25
- package/src/studio/server.js +143 -143
- package/src/studio/session.js +83 -83
- package/src/studio/studio.css +10 -10
- package/src/studio/sync.js +42 -42
- package/src/studio/workflow-sync.js +157 -157
|
@@ -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
|
+
});
|