agent-lyra 0.6.1 → 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.
Files changed (108) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +435 -395
  3. package/bin/agent-lyra.js +49 -44
  4. package/bin/lyra-oss-preview.js +16 -0
  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 +52 -52
  9. package/src/app-builder/manifest-contract.js +46 -0
  10. package/src/app-builder/native-adapter.js +29 -29
  11. package/src/app-builder/preview.js +22 -22
  12. package/src/app-builder/publish.js +14 -14
  13. package/src/app-builder/saved-app.js +70 -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 +21 -64
  25. package/src/app-builder/value-schema.js +37 -37
  26. package/src/catalog.js +147 -147
  27. package/src/coding/catalog.js +56 -0
  28. package/src/coding/cloud-catalog.js +64 -0
  29. package/src/coding/detect-stack.mjs +110 -0
  30. package/src/coding/export.js +130 -0
  31. package/src/coding/setup.js +175 -0
  32. package/src/coding/skills/lyra-android/SKILL.md +37 -0
  33. package/src/coding/skills/lyra-angular/SKILL.md +37 -0
  34. package/src/coding/skills/lyra-cucumber/SKILL.md +37 -0
  35. package/src/coding/skills/lyra-dbt/SKILL.md +37 -0
  36. package/src/coding/skills/lyra-django/SKILL.md +37 -0
  37. package/src/coding/skills/lyra-docker/SKILL.md +37 -0
  38. package/src/coding/skills/lyra-dotnet/SKILL.md +37 -0
  39. package/src/coding/skills/lyra-express/SKILL.md +37 -0
  40. package/src/coding/skills/lyra-fastapi/SKILL.md +37 -0
  41. package/src/coding/skills/lyra-flutter/SKILL.md +37 -0
  42. package/src/coding/skills/lyra-github-actions/SKILL.md +37 -0
  43. package/src/coding/skills/lyra-gitlab-ci/SKILL.md +37 -0
  44. package/src/coding/skills/lyra-go/SKILL.md +37 -0
  45. package/src/coding/skills/lyra-ios/SKILL.md +37 -0
  46. package/src/coding/skills/lyra-kubernetes/SKILL.md +37 -0
  47. package/src/coding/skills/lyra-mongodb/SKILL.md +37 -0
  48. package/src/coding/skills/lyra-mysql/SKILL.md +37 -0
  49. package/src/coding/skills/lyra-nextjs/SKILL.md +37 -0
  50. package/src/coding/skills/lyra-node/SKILL.md +37 -0
  51. package/src/coding/skills/lyra-playwright/SKILL.md +37 -0
  52. package/src/coding/skills/lyra-postgresql/SKILL.md +37 -0
  53. package/src/coding/skills/lyra-python/SKILL.md +37 -0
  54. package/src/coding/skills/lyra-react/SKILL.md +37 -0
  55. package/src/coding/skills/lyra-react-native/SKILL.md +37 -0
  56. package/src/coding/skills/lyra-redis/SKILL.md +37 -0
  57. package/src/coding/skills/lyra-rust/SKILL.md +37 -0
  58. package/src/coding/skills/lyra-spark/SKILL.md +37 -0
  59. package/src/coding/skills/lyra-spring-boot/SKILL.md +37 -0
  60. package/src/coding/skills/lyra-svelte/SKILL.md +37 -0
  61. package/src/coding/skills/lyra-terraform/SKILL.md +37 -0
  62. package/src/coding/skills/lyra-typescript/SKILL.md +37 -0
  63. package/src/coding/skills/lyra-vue/SKILL.md +37 -0
  64. package/src/gated/hostedAgents.js +56 -56
  65. package/src/gated/index.d.ts +25 -25
  66. package/src/gated/index.js +5 -5
  67. package/src/index.d.ts +2 -2
  68. package/src/index.js +2 -2
  69. package/src/init.js +965 -937
  70. package/src/memory/cli.js +21 -49
  71. package/src/memory/contract.json +28 -28
  72. package/src/memory/index.d.ts +49 -49
  73. package/src/memory/index.js +259 -259
  74. package/src/memory/lifecycle.js +29 -29
  75. package/src/memory/local-cli.js +34 -0
  76. package/src/memory/proposals.js +84 -84
  77. package/src/memory/skills-cli.js +26 -26
  78. package/src/memory/sync.js +89 -85
  79. package/src/memory/validation.js +25 -25
  80. package/src/onboardingAgents.js +532 -532
  81. package/src/promptTemplates.js +178 -178
  82. package/src/runtime/contracts.d.ts +47 -47
  83. package/src/runtime/local-cli.js +160 -160
  84. package/src/runtime/mcp-stdio.js +111 -111
  85. package/src/runtime/orchestration.js +59 -59
  86. package/src/runtime/run-agent.js +43 -43
  87. package/src/standalone/index.d.ts +45 -45
  88. package/src/standalone/index.js +13 -13
  89. package/src/standalone/init.js +12 -0
  90. package/src/standalone/orchestration.js +6 -6
  91. package/src/standalone/rag.js +113 -113
  92. package/src/studio/agent-ui.css +43 -43
  93. package/src/studio/agent-ui.js +32 -32
  94. package/src/studio/browser.js +331 -331
  95. package/src/studio/export.js +80 -80
  96. package/src/studio/index.html +37 -37
  97. package/src/studio/memory-actions.js +37 -37
  98. package/src/studio/memory-panel.js +200 -200
  99. package/src/studio/project.js +216 -197
  100. package/src/studio/pull-agent.js +72 -72
  101. package/src/studio/push.js +54 -54
  102. package/src/studio/python-agent.js +47 -47
  103. package/src/studio/python-agent.py +25 -25
  104. package/src/studio/server.js +143 -143
  105. package/src/studio/session.js +83 -83
  106. package/src/studio/studio.css +10 -10
  107. package/src/studio/sync.js +42 -42
  108. package/src/studio/workflow-sync.js +157 -157
package/src/memory/cli.js CHANGED
@@ -1,49 +1,21 @@
1
- import { syncMemory } from "./sync.js";
2
- import { readFile } from "node:fs/promises";
3
- import { openMemoryStore } from "./index.js";
4
-
5
- export async function runMemory(args, output = process.stdout) {
6
- const [action, value, flag] = args;
7
- if (action === "cloud") return runCloudMemory(args.slice(1), output);
8
- if (!action || action === "--help") {
9
- output.write("Usage: agent-lyra memory init | record <json-file> | list | search <query> | inspect <id> | verify <id> <evidence.json> | archive <id> | consolidate <context> | stats | forget <id> --yes | cloud --help\n");
10
- return;
11
- }
12
- const bare = ["init", "list", "stats"].includes(action) && args.length === 1;
13
- const withValue = ["record", "search", "inspect", "archive", "consolidate"].includes(action) && args.length === 2 && value;
14
- if (!bare && !withValue && !(action === "verify" && args.length === 3 && value && flag) && !(action === "forget" && args.length === 3 && flag === "--yes" && value)) {
15
- throw new Error("See agent-lyra memory --help. Forget requires --yes.");
16
- }
17
- const store = await openMemoryStore();
18
- try {
19
- let result;
20
- switch (action) {
21
- case "init": result = { database: store.file, ...store.stats() }; break;
22
- case "record": result = store.record(JSON.parse((await readFile(value, "utf8")).replace(/^\uFEFF/, ""))); break;
23
- case "list": result = store.list(); break;
24
- case "search": result = store.search(value); break;
25
- case "inspect": result = store.get(value); break;
26
- case "verify": result = store.verify(value, JSON.parse((await readFile(flag, "utf8")).replace(/^\uFEFF/, ""))); break;
27
- case "consolidate": result = store.consolidate(value); break;
28
- case "archive": result = store.archive(value); break;
29
- case "stats": result = store.stats(); break;
30
- case "forget": result = store.forget(value) ? { deleted: value } : null; break;
31
- }
32
- if (result === null) throw new Error("Memory record was not found.");
33
- output.write(JSON.stringify(result, null, 2) + "\n");
34
- } finally { store.close(); }
35
- }
36
-
37
- async function runCloudMemory(args, output) {
38
- const [action, id, flag] = args;
39
- if (!action || action === "--help") {
40
- output.write("Usage: agent-lyra memory cloud list [cursor] | preview <id> | push <id> --yes | pull <id>\n");
41
- return;
42
- }
43
- const valid = (action === "list" && args.length <= 2) ||
44
- (["preview", "pull"].includes(action) && args.length === 2) ||
45
- (action === "push" && args.length === 3 && flag === "--yes");
46
- if (!valid) throw new Error("See agent-lyra memory cloud --help.");
47
- const result = await syncMemory(process.cwd(), action, id, { confirmed: flag === "--yes" });
48
- output.write(JSON.stringify(result, null, 2) + "\n");
49
- }
1
+ import { syncMemory } from "./sync.js";
2
+ import { runLocalMemory } from "./local-cli.js";
3
+ export async function runMemory(args, output = process.stdout) {
4
+ if (args[0] === "cloud") return runCloudMemory(args.slice(1), output);
5
+ if (!args[0] || args[0] === "--help") { await runLocalMemory(args, output); output.write("Cloud: agent-lyra memory cloud --help\n"); return; }
6
+ return runLocalMemory(args, output);
7
+ }
8
+
9
+ async function runCloudMemory(args, output) {
10
+ const [action, id, flag] = args;
11
+ if (!action || action === "--help") {
12
+ output.write("Usage: agent-lyra memory cloud list [cursor] | preview <id> | push <id> --yes | pull <id>\n");
13
+ return;
14
+ }
15
+ const valid = (action === "list" && args.length <= 2) ||
16
+ (["preview", "pull"].includes(action) && args.length === 2) ||
17
+ (action === "push" && args.length === 3 && flag === "--yes");
18
+ if (!valid) throw new Error("See agent-lyra memory cloud --help.");
19
+ const result = await syncMemory(process.cwd(), action, id, { confirmed: flag === "--yes" });
20
+ output.write(JSON.stringify(result, null, 2) + "\n");
21
+ }
@@ -1,28 +1,28 @@
1
- {
2
- "version": 4,
3
- "applicationId": 1279873601,
4
- "types": [
5
- "episodic",
6
- "semantic",
7
- "procedural",
8
- "corrective"
9
- ],
10
- "statuses": [
11
- "candidate",
12
- "verified",
13
- "archived"
14
- ],
15
- "limits": {
16
- "records": 5000,
17
- "results": 100,
18
- "title": 160,
19
- "learning": 4000,
20
- "evidence": 16,
21
- "id": 128
22
- },
23
- "adapters": {"coding":{"types":["corrective"],"prefix":"test:","check":"test","error":"Verification requires a linked passing coding test, a compatibility context, and explicit review."},"practice":{"types":["corrective","procedural"],"prefix":"exercise:","check":"exercise","error":"Verification requires a linked passing practice exercise, a compatibility context, and explicit review."}},
24
- "migration4": "CREATE TABLE memory_cloud_links (id TEXT PRIMARY KEY, cloud_revision INTEGER NOT NULL, local_revision INTEGER NOT NULL, cloud_account TEXT NOT NULL);",
25
- "migration3": "CREATE TABLE skill_proposals (id TEXT PRIMARY KEY, context TEXT NOT NULL, title TEXT NOT NULL, markdown TEXT NOT NULL, sources TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending','approved','rejected','withdrawn')), created_at TEXT NOT NULL, decided_at TEXT, receipt TEXT);",
26
- "migration2": "ALTER TABLE memories ADD COLUMN verification TEXT; CREATE INDEX memories_verified ON memories(status, updated_at);",
27
- "migration": "CREATE TABLE memories (\n id TEXT PRIMARY KEY,\n type TEXT NOT NULL,\n title TEXT NOT NULL,\n learning TEXT NOT NULL,\n evidence TEXT NOT NULL,\n scope TEXT NOT NULL DEFAULT 'project' CHECK (scope = 'project'),\n status TEXT NOT NULL DEFAULT 'candidate',\n revision INTEGER NOT NULL DEFAULT 1,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\nCREATE TABLE memory_tombstones (id TEXT PRIMARY KEY, revision INTEGER NOT NULL, deleted_at TEXT NOT NULL);\nCREATE TABLE memory_index_state (id INTEGER PRIMARY KEY CHECK (id = 1), revision INTEGER NOT NULL, indexed_revision INTEGER NOT NULL);\nINSERT INTO memory_index_state VALUES (1, 0, -1);\nCREATE INDEX memories_status_updated ON memories (status, updated_at DESC);"
28
- }
1
+ {
2
+ "version": 4,
3
+ "applicationId": 1279873601,
4
+ "types": [
5
+ "episodic",
6
+ "semantic",
7
+ "procedural",
8
+ "corrective"
9
+ ],
10
+ "statuses": [
11
+ "candidate",
12
+ "verified",
13
+ "archived"
14
+ ],
15
+ "limits": {
16
+ "records": 5000,
17
+ "results": 100,
18
+ "title": 160,
19
+ "learning": 4000,
20
+ "evidence": 16,
21
+ "id": 128
22
+ },
23
+ "adapters": {"coding":{"types":["corrective"],"prefix":"test:","check":"test","error":"Verification requires a linked passing coding test, a compatibility context, and explicit review."},"practice":{"types":["corrective","procedural"],"prefix":"exercise:","check":"exercise","error":"Verification requires a linked passing practice exercise, a compatibility context, and explicit review."}},
24
+ "migration4": "CREATE TABLE memory_cloud_links (id TEXT PRIMARY KEY, cloud_revision INTEGER NOT NULL, local_revision INTEGER NOT NULL, cloud_account TEXT NOT NULL);",
25
+ "migration3": "CREATE TABLE skill_proposals (id TEXT PRIMARY KEY, context TEXT NOT NULL, title TEXT NOT NULL, markdown TEXT NOT NULL, sources TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending','approved','rejected','withdrawn')), created_at TEXT NOT NULL, decided_at TEXT, receipt TEXT);",
26
+ "migration2": "ALTER TABLE memories ADD COLUMN verification TEXT; CREATE INDEX memories_verified ON memories(status, updated_at);",
27
+ "migration": "CREATE TABLE memories (\n id TEXT PRIMARY KEY,\n type TEXT NOT NULL,\n title TEXT NOT NULL,\n learning TEXT NOT NULL,\n evidence TEXT NOT NULL,\n scope TEXT NOT NULL DEFAULT 'project' CHECK (scope = 'project'),\n status TEXT NOT NULL DEFAULT 'candidate',\n revision INTEGER NOT NULL DEFAULT 1,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\nCREATE TABLE memory_tombstones (id TEXT PRIMARY KEY, revision INTEGER NOT NULL, deleted_at TEXT NOT NULL);\nCREATE TABLE memory_index_state (id INTEGER PRIMARY KEY CHECK (id = 1), revision INTEGER NOT NULL, indexed_revision INTEGER NOT NULL);\nINSERT INTO memory_index_state VALUES (1, 0, -1);\nCREATE INDEX memories_status_updated ON memories (status, updated_at DESC);"
28
+ }
@@ -1,49 +1,49 @@
1
- export type MemoryType = "episodic" | "semantic" | "procedural" | "corrective";
2
- export type MemoryStatus = "candidate" | "verified" | "archived";
3
- export interface MemoryInput { type: MemoryType; title: string; learning: string; evidence?: string[] }
4
- export type MemoryAdapter = "coding" | "practice";
5
- export type VerificationReceipt = { evidenceId: string; context: string } & (
6
- { adapter: "coding"; test: string } | { adapter: "practice"; exercise: string }
7
- );
8
- export interface MemoryRecord extends MemoryInput {
9
- id: string;
10
- evidence: string[];
11
- scope: "project";
12
- status: MemoryStatus;
13
- revision: number;
14
- createdAt: string;
15
- updatedAt: string;
16
- verification?: VerificationReceipt;
17
- }
18
- export interface SkillProposalSource { id: string; revision: number; evidenceId: string }
19
- export interface SkillProposalReceipt { evidenceId: string; context: string; result: "passed"; reviewed: true }
20
- export interface SkillProposal {
21
- id: string;
22
- context: string;
23
- title: string;
24
- markdown: string;
25
- sources: SkillProposalSource[];
26
- status: "pending" | "approved" | "rejected" | "withdrawn";
27
- createdAt: string;
28
- decidedAt: string | null;
29
- receipt: SkillProposalReceipt | null;
30
- }
31
- export interface MemoryStore {
32
- readonly file: string;
33
- consolidate(context: string): Array<{ title: string; learning: string; sources: SkillProposalSource[] }>;
34
- propose(context: string, memoryId: string): SkillProposal;
35
- proposal(id: string): SkillProposal | null;
36
- proposals(): SkillProposal[];
37
- decideProposal(id: string, decision: "approved" | "rejected" | "withdrawn", evidence?: SkillProposalReceipt): SkillProposal;
38
- close(): void;
39
- get(id: string): MemoryRecord | null;
40
- list(limit?: number): MemoryRecord[];
41
- record(value: MemoryInput): MemoryRecord;
42
- search(query: string, limit?: number): MemoryRecord[];
43
- stats(): { schemaVersion: number; search: "fts5" | "keyword" } & Record<MemoryStatus, number>;
44
- verify(id: string, evidence: VerificationReceipt & { result: "passed"; reviewed: true }): MemoryRecord;
45
- retrieve(query: string, context: string, adapter?: MemoryAdapter): MemoryRecord[];
46
- archive(id: string): MemoryRecord | null;
47
- forget(id: string): boolean;
48
- }
49
- export function openMemoryStore(root?: string, options?: { forceKeyword?: boolean }): Promise<MemoryStore>;
1
+ export type MemoryType = "episodic" | "semantic" | "procedural" | "corrective";
2
+ export type MemoryStatus = "candidate" | "verified" | "archived";
3
+ export interface MemoryInput { type: MemoryType; title: string; learning: string; evidence?: string[] }
4
+ export type MemoryAdapter = "coding" | "practice";
5
+ export type VerificationReceipt = { evidenceId: string; context: string } & (
6
+ { adapter: "coding"; test: string } | { adapter: "practice"; exercise: string }
7
+ );
8
+ export interface MemoryRecord extends MemoryInput {
9
+ id: string;
10
+ evidence: string[];
11
+ scope: "project";
12
+ status: MemoryStatus;
13
+ revision: number;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ verification?: VerificationReceipt;
17
+ }
18
+ export interface SkillProposalSource { id: string; revision: number; evidenceId: string }
19
+ export interface SkillProposalReceipt { evidenceId: string; context: string; result: "passed"; reviewed: true }
20
+ export interface SkillProposal {
21
+ id: string;
22
+ context: string;
23
+ title: string;
24
+ markdown: string;
25
+ sources: SkillProposalSource[];
26
+ status: "pending" | "approved" | "rejected" | "withdrawn";
27
+ createdAt: string;
28
+ decidedAt: string | null;
29
+ receipt: SkillProposalReceipt | null;
30
+ }
31
+ export interface MemoryStore {
32
+ readonly file: string;
33
+ consolidate(context: string): Array<{ title: string; learning: string; sources: SkillProposalSource[] }>;
34
+ propose(context: string, memoryId: string): SkillProposal;
35
+ proposal(id: string): SkillProposal | null;
36
+ proposals(): SkillProposal[];
37
+ decideProposal(id: string, decision: "approved" | "rejected" | "withdrawn", evidence?: SkillProposalReceipt): SkillProposal;
38
+ close(): void;
39
+ get(id: string): MemoryRecord | null;
40
+ list(limit?: number): MemoryRecord[];
41
+ record(value: MemoryInput): MemoryRecord;
42
+ search(query: string, limit?: number): MemoryRecord[];
43
+ stats(): { schemaVersion: number; search: "fts5" | "keyword" } & Record<MemoryStatus, number>;
44
+ verify(id: string, evidence: VerificationReceipt & { result: "passed"; reviewed: true }): MemoryRecord;
45
+ retrieve(query: string, context: string, adapter?: MemoryAdapter): MemoryRecord[];
46
+ archive(id: string): MemoryRecord | null;
47
+ forget(id: string): boolean;
48
+ }
49
+ export function openMemoryStore(root?: string, options?: { forceKeyword?: boolean }): Promise<MemoryStore>;