@anhlp/alp 0.0.1-beta.4 → 0.0.1-beta.6

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 (199) hide show
  1. package/README.md +14 -412
  2. package/bin/alp.js +5 -0
  3. package/lib/launcher.js +136 -0
  4. package/package.json +18 -105
  5. package/dist/THIRD-PARTY-NOTICES.txt +0 -626
  6. package/dist/acp.js +0 -19936
  7. package/dist/alpd.js +0 -49562
  8. package/docs/modular-monorepo.md +0 -214
  9. package/packages/cli/README.md +0 -7
  10. package/packages/cli/dist/THIRD-PARTY-NOTICES.txt +0 -651
  11. package/packages/cli/dist/acp/agent.d.ts +0 -37
  12. package/packages/cli/dist/acp/agent.js +0 -489
  13. package/packages/cli/dist/acp/main.d.ts +0 -4
  14. package/packages/cli/dist/acp/main.js +0 -23
  15. package/packages/cli/dist/acp.js +0 -19936
  16. package/packages/cli/dist/alp-web/THIRD-PARTY-NOTICES.txt +0 -2590
  17. package/packages/cli/dist/alp-web/alp-boundary.json +0 -15
  18. package/packages/cli/dist/alp-web/apple-touch-icon.png +0 -0
  19. package/packages/cli/dist/alp-web/assets/TerminalPanel-DLuoa74B.css +0 -1
  20. package/packages/cli/dist/alp-web/assets/TerminalPanel-PrU2l3u5.js +0 -16
  21. package/packages/cli/dist/alp-web/assets/index-BJdBTDFX.css +0 -1
  22. package/packages/cli/dist/alp-web/assets/index-DpfiPv5s.js +0 -52
  23. package/packages/cli/dist/alp-web/favicon-attention.svg +0 -6
  24. package/packages/cli/dist/alp-web/favicon-running.svg +0 -6
  25. package/packages/cli/dist/alp-web/favicon.svg +0 -5
  26. package/packages/cli/dist/alp-web/index.html +0 -20
  27. package/packages/cli/dist/alp-web.js +0 -9640
  28. package/packages/cli/dist/alpd.js +0 -49562
  29. package/packages/cli/dist/backup.d.ts +0 -4
  30. package/packages/cli/dist/backup.js +0 -146
  31. package/packages/cli/dist/build-manifest.json +0 -240
  32. package/packages/cli/dist/cli.d.ts +0 -2
  33. package/packages/cli/dist/cli.js +0 -30
  34. package/packages/cli/dist/daemon.d.ts +0 -35
  35. package/packages/cli/dist/daemon.js +0 -126
  36. package/packages/cli/dist/index.d.ts +0 -1
  37. package/packages/cli/dist/index.js +0 -5
  38. package/packages/cli/dist/interfaces.d.ts +0 -24
  39. package/packages/cli/dist/interfaces.js +0 -156
  40. package/packages/cli/dist/library.d.ts +0 -140
  41. package/packages/cli/dist/library.js +0 -319
  42. package/packages/cli/dist/paths.d.ts +0 -3
  43. package/packages/cli/dist/paths.js +0 -18
  44. package/packages/cli/dist/projects.d.ts +0 -9
  45. package/packages/cli/dist/projects.js +0 -159
  46. package/packages/cli/dist/schedules.d.ts +0 -2
  47. package/packages/cli/dist/schedules.js +0 -45
  48. package/packages/cli/dist/sessions.d.ts +0 -43
  49. package/packages/cli/dist/sessions.js +0 -458
  50. package/packages/cli/dist/tasks.d.ts +0 -29
  51. package/packages/cli/dist/tasks.js +0 -345
  52. package/packages/cli/dist/terminal.d.ts +0 -8
  53. package/packages/cli/dist/terminal.js +0 -79
  54. package/packages/cli/dist/usage.d.ts +0 -3
  55. package/packages/cli/dist/usage.js +0 -78
  56. package/packages/cli/dist/web-service.d.ts +0 -38
  57. package/packages/cli/dist/web-service.js +0 -119
  58. package/packages/client/README.md +0 -29
  59. package/packages/client/dist/acp-probe.d.ts +0 -44
  60. package/packages/client/dist/acp-probe.js +0 -37
  61. package/packages/client/dist/antigravity-probe.d.ts +0 -34
  62. package/packages/client/dist/antigravity-probe.js +0 -95
  63. package/packages/client/dist/command.d.ts +0 -5
  64. package/packages/client/dist/command.js +0 -33
  65. package/packages/client/dist/doctor.d.ts +0 -13
  66. package/packages/client/dist/doctor.js +0 -587
  67. package/packages/client/dist/index.d.ts +0 -151
  68. package/packages/client/dist/index.js +0 -533
  69. package/packages/client/dist/integration-lock.d.ts +0 -35
  70. package/packages/client/dist/integration-lock.js +0 -179
  71. package/packages/client/dist/ipc.d.ts +0 -42
  72. package/packages/client/dist/ipc.js +0 -69
  73. package/packages/client/dist/library-test.d.ts +0 -94
  74. package/packages/client/dist/library-test.js +0 -37
  75. package/packages/client/dist/mcp-probe.d.ts +0 -24
  76. package/packages/client/dist/mcp-probe.js +0 -147
  77. package/packages/client/dist/portable.d.ts +0 -19
  78. package/packages/client/dist/portable.js +0 -33
  79. package/packages/client/dist/prompt.d.ts +0 -32
  80. package/packages/client/dist/prompt.js +0 -59
  81. package/packages/client/dist/render.d.ts +0 -6
  82. package/packages/client/dist/render.js +0 -120
  83. package/packages/client/dist/rpc/client.d.ts +0 -82
  84. package/packages/client/dist/rpc/client.js +0 -292
  85. package/packages/client/dist/rpc/errors.d.ts +0 -42
  86. package/packages/client/dist/rpc/errors.js +0 -34
  87. package/packages/client/dist/rpc/framing.d.ts +0 -21
  88. package/packages/client/dist/rpc/framing.js +0 -57
  89. package/packages/client/dist/rpc/handshake.d.ts +0 -19
  90. package/packages/client/dist/rpc/handshake.js +0 -8
  91. package/packages/client/dist/rpc/reconnect.d.ts +0 -97
  92. package/packages/client/dist/rpc/reconnect.js +0 -227
  93. package/packages/client/dist/rpc/registry.d.ts +0 -211
  94. package/packages/client/dist/rpc/registry.js +0 -145
  95. package/packages/client/dist/rpc/timers.d.ts +0 -11
  96. package/packages/client/dist/rpc/timers.js +0 -11
  97. package/packages/client/dist/service.d.ts +0 -50
  98. package/packages/client/dist/service.js +0 -143
  99. package/packages/client/dist/setup.d.ts +0 -2
  100. package/packages/client/dist/setup.js +0 -146
  101. package/packages/client/dist/supervise.d.ts +0 -14
  102. package/packages/client/dist/supervise.js +0 -87
  103. package/packages/client/dist/websocket.d.ts +0 -51
  104. package/packages/client/dist/websocket.js +0 -190
  105. package/packages/core/README.md +0 -7
  106. package/packages/core/dist/adapter.d.ts +0 -20
  107. package/packages/core/dist/adapter.js +0 -30
  108. package/packages/core/dist/atomic.d.ts +0 -2
  109. package/packages/core/dist/atomic.js +0 -28
  110. package/packages/core/dist/backup.d.ts +0 -27
  111. package/packages/core/dist/backup.js +0 -681
  112. package/packages/core/dist/beads.d.ts +0 -65
  113. package/packages/core/dist/beads.js +0 -213
  114. package/packages/core/dist/delegation.d.ts +0 -2
  115. package/packages/core/dist/delegation.js +0 -32
  116. package/packages/core/dist/errors.d.ts +0 -4
  117. package/packages/core/dist/errors.js +0 -11
  118. package/packages/core/dist/formulas.d.ts +0 -25
  119. package/packages/core/dist/formulas.js +0 -201
  120. package/packages/core/dist/hook-run.d.ts +0 -44
  121. package/packages/core/dist/hook-run.js +0 -60
  122. package/packages/core/dist/hooks.d.ts +0 -35
  123. package/packages/core/dist/hooks.js +0 -30
  124. package/packages/core/dist/index.d.ts +0 -31
  125. package/packages/core/dist/index.js +0 -65
  126. package/packages/core/dist/init.d.ts +0 -30
  127. package/packages/core/dist/init.js +0 -89
  128. package/packages/core/dist/library-edit.d.ts +0 -93
  129. package/packages/core/dist/library-edit.js +0 -368
  130. package/packages/core/dist/library.d.ts +0 -28
  131. package/packages/core/dist/library.js +0 -108
  132. package/packages/core/dist/log.d.ts +0 -37
  133. package/packages/core/dist/log.js +0 -156
  134. package/packages/core/dist/migrations.d.ts +0 -9
  135. package/packages/core/dist/migrations.js +0 -95
  136. package/packages/core/dist/models.d.ts +0 -11
  137. package/packages/core/dist/models.js +0 -44
  138. package/packages/core/dist/permissions.d.ts +0 -14
  139. package/packages/core/dist/permissions.js +0 -229
  140. package/packages/core/dist/profiles.d.ts +0 -27
  141. package/packages/core/dist/profiles.js +0 -122
  142. package/packages/core/dist/promptsafe.d.ts +0 -1
  143. package/packages/core/dist/promptsafe.js +0 -13
  144. package/packages/core/dist/providers.d.ts +0 -90
  145. package/packages/core/dist/providers.js +0 -101
  146. package/packages/core/dist/resolver.d.ts +0 -41
  147. package/packages/core/dist/resolver.js +0 -240
  148. package/packages/core/dist/safe-path.d.ts +0 -2
  149. package/packages/core/dist/safe-path.js +0 -24
  150. package/packages/core/dist/shell.d.ts +0 -16
  151. package/packages/core/dist/shell.js +0 -22
  152. package/packages/core/dist/state-schema.d.ts +0 -9
  153. package/packages/core/dist/state-schema.js +0 -54
  154. package/packages/core/dist/task-rows.d.ts +0 -47
  155. package/packages/core/dist/task-rows.js +0 -45
  156. package/packages/core/dist/tasks.d.ts +0 -128
  157. package/packages/core/dist/tasks.js +0 -835
  158. package/packages/core/dist/teams.d.ts +0 -80
  159. package/packages/core/dist/teams.js +0 -159
  160. package/packages/core/dist/template-path.d.ts +0 -2
  161. package/packages/core/dist/template-path.js +0 -10
  162. package/packages/core/dist/trust.d.ts +0 -8
  163. package/packages/core/dist/trust.js +0 -47
  164. package/packages/core/dist/types.d.ts +0 -51
  165. package/packages/core/dist/upgrade.d.ts +0 -10
  166. package/packages/core/dist/upgrade.js +0 -200
  167. package/packages/core/dist/user-settings.d.ts +0 -6
  168. package/packages/core/dist/user-settings.js +0 -72
  169. package/packages/core/dist/user-worktree.d.ts +0 -29
  170. package/packages/core/dist/user-worktree.js +0 -242
  171. package/packages/core/dist/validation.d.ts +0 -17
  172. package/packages/core/dist/validation.js +0 -296
  173. package/packages/core/dist/verify.d.ts +0 -15
  174. package/packages/core/dist/verify.js +0 -123
  175. package/packages/core/dist/workflow.d.ts +0 -45
  176. package/packages/core/dist/workflow.js +0 -33
  177. package/templates/ALP.md +0 -52
  178. package/templates/agents/lead/AGENT.md +0 -90
  179. package/templates/agents/main/AGENT.md +0 -150
  180. package/templates/agents/oracle/AGENT.md +0 -44
  181. package/templates/agents/peer/AGENT.md +0 -55
  182. package/templates/agents/reviewer/AGENT.md +0 -80
  183. package/templates/agents/supervisor/AGENT.md +0 -72
  184. package/templates/providers/antigravity.json +0 -6
  185. package/templates/providers/opencode.json +0 -7
  186. package/templates/role-skills.json +0 -8
  187. package/templates/skills/bug-loop/SKILL.md +0 -44
  188. package/templates/skills/bug-loop/references/test-proof.md +0 -25
  189. package/templates/skills/goal-griller/SKILL.md +0 -49
  190. package/templates/skills/prompt-leverage/SKILL.md +0 -37
  191. package/templates/skills/prompt-leverage/references/brief-template.md +0 -27
  192. package/templates/skills/sequence-execution-plan/SKILL.md +0 -42
  193. package/templates/skills/sequence-execution-plan/references/plan-template.md +0 -22
  194. package/templates/skills/smart-commits/SKILL.md +0 -40
  195. package/templates/skills/xia/SKILL.md +0 -42
  196. package/templates/teams/cafe/HOUSE_RULES.md +0 -1
  197. package/templates/teams/cafe/team.json +0 -15
  198. package/templates/teams/pho/HOUSE_RULES.md +0 -1
  199. package/templates/teams/pho/team.json +0 -14
@@ -1,4 +0,0 @@
1
- /** alp backup [create] | verify <file> | list */
2
- export function backupCommand(args: any): Promise<void>;
3
- /** alp restore <file> [--home-only] [--stop] [--dry-run] [--replace-newer] [--json] */
4
- export function restoreCommand(args: any): Promise<void>;
@@ -1,146 +0,0 @@
1
- // packages/cli/src/backup.js
2
- import { access, readdir, stat } from "node:fs/promises";
3
- import path from "node:path";
4
- import { parseArgs } from "node:util";
5
- import { BACKUP_EXTENSION, backupsDir, createBackup, knownProjects, restoreBackup, verifyBackup } from "@anhlp/alp-core/backup";
6
- import { acquireDaemonLock, alpHome, assertPrivateDirectory, daemonPaths, lockAlive, readLock, releaseDaemonLock, PROTOCOL_VERSION } from "@anhlp/alp-client/index";
7
- import { daemonHeld, holdDaemon, releaseHold } from "@anhlp/alp-client/supervise";
8
- import { start, stop } from "./daemon.js";
9
- import { UsageError } from "./usage.js";
10
- var VERSION = true ? "0.0.1-beta.4" : "dev";
11
- var BY = `alp ${VERSION}`;
12
- var size = (bytes) => bytes >= 1024 * 1024 ? `${(bytes / 1024 / 1024).toFixed(1)} MB` : bytes >= 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${bytes} B`;
13
- var stamp = () => (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
14
- async function withMaintenance(kind, { stopFirst }, work) {
15
- const home = alpHome();
16
- await assertPrivateDirectory(home, { create: true });
17
- const current = await readLock(home);
18
- const running = lockAlive(current);
19
- if (running && current.maintenance) throw new Error(`alp ${current.maintenance} already runs (pid ${current.pid})`);
20
- if (running && !stopFirst) throw new Error(`alpd is running (pid ${current.pid}); stop it first with alp daemon stop, or pass --stop: ALP then stops alpd for the ${kind} and starts it again after`);
21
- const wasHeld = await daemonHeld(home);
22
- await holdDaemon(home, `alp ${kind}`);
23
- let restart = false;
24
- try {
25
- if (running) restart = await stop();
26
- await acquireDaemonLock(home, { version: VERSION, protocolVersion: PROTOCOL_VERSION, socket: daemonPaths(home).socket, maintenance: kind });
27
- try {
28
- return await work(home);
29
- } finally {
30
- await releaseDaemonLock(home);
31
- }
32
- } finally {
33
- if (!wasHeld) await releaseHold(home);
34
- if (restart) {
35
- await start().then(() => console.log("alpd started again"), (error) => console.error(`alp: alpd did not start again (${error.message}); run alp daemon start`));
36
- }
37
- }
38
- }
39
- async function isProject(directory) {
40
- return access(path.join(directory, ".alp")).then(() => true, () => false);
41
- }
42
- async function backupCommand(args) {
43
- const [first, ...rest] = args;
44
- if (first === "verify") return verifyCommand(rest);
45
- if (first === "list") return listCommand(rest);
46
- const { values, positionals } = parseArgs({ args: first === "create" ? rest : args, allowPositionals: true, options: {
47
- output: { type: "string", short: "o" },
48
- project: { type: "string", multiple: true },
49
- "no-projects": { type: "boolean" },
50
- stop: { type: "boolean" },
51
- json: { type: "boolean" }
52
- } });
53
- if (positionals.length) throw new UsageError();
54
- const out = path.resolve(values.output ?? path.join(backupsDir(alpHome()), `backup-${stamp()}${BACKUP_EXTENSION}`));
55
- if (await stat(out).then(() => true, () => false)) throw new Error(`${out} exists; choose another file with -o`);
56
- const summary = await withMaintenance("backup", { stopFirst: values.stop }, async (home) => {
57
- let projects = [];
58
- if (!values["no-projects"]) {
59
- const named = (values.project ?? []).map((directory) => path.resolve(directory));
60
- for (const directory of named) if (!await isProject(directory)) throw new Error(`${directory} is not an ALP project (no .alp directory)`);
61
- const here = await isProject(process.cwd()) ? [path.resolve(process.cwd())] : [];
62
- projects = [.../* @__PURE__ */ new Set([...await knownProjects(home), ...named, ...here])].sort();
63
- }
64
- return createBackup({ home, out, projects, by: BY });
65
- });
66
- if (values.json) {
67
- console.log(JSON.stringify(summary));
68
- return;
69
- }
70
- console.log(`backup written to ${out} (${size((await stat(out)).size)})`);
71
- console.log(` ${summary.sessions} session record${summary.sessions === 1 ? "" : "s"}, state schema ${summary.stateSchema ?? "unknown"}; ${summary.tasks} task${summary.tasks === 1 ? "" : "s"} in ${summary.projects.length} project${summary.projects.length === 1 ? "" : "s"}${summary.projects.length ? `: ${summary.projects.join(", ")}` : ""}`);
72
- console.log(" it holds your settings and library too, and may hold credentials from them: keep it private. Codex and Claude keep their own threads; see docs/alp/data-recovery.md");
73
- }
74
- async function verifyCommand(args) {
75
- const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { json: { type: "boolean" } } });
76
- if (positionals.length !== 1) throw new UsageError();
77
- const contents = await verifyBackup(path.resolve(positionals[0]));
78
- if (values.json) {
79
- console.log(JSON.stringify(contents));
80
- return;
81
- }
82
- console.log(`${contents.file}: complete and intact`);
83
- console.log(` made ${contents.createdAt}${contents.by ? ` by ${contents.by}` : ""} (${contents.kind}) from ${contents.home}; state schema ${contents.stateSchema ?? "unknown"}`);
84
- console.log(` ${contents.sessions} session records, ${contents.tasks} tasks, ${contents.files} files, ${size(contents.bytes)}`);
85
- if (contents.projects.length) console.log(` projects: ${contents.projects.join(", ")}`);
86
- }
87
- async function listCommand(args) {
88
- const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { json: { type: "boolean" } } });
89
- if (positionals.length) throw new UsageError();
90
- const directory = backupsDir(alpHome());
91
- const names = (await readdir(directory).catch(() => [])).filter((name) => name.endsWith(BACKUP_EXTENSION)).sort();
92
- const files = await Promise.all(names.map(async (name) => {
93
- const info = await stat(path.join(directory, name));
94
- return { file: path.join(directory, name), bytes: info.size, at: info.mtime.toISOString() };
95
- }));
96
- if (values.json) {
97
- console.log(JSON.stringify(files));
98
- return;
99
- }
100
- if (!files.length) {
101
- console.log(`no backups in ${directory}`);
102
- return;
103
- }
104
- for (const file of files) console.log(`${file.at} ${size(file.bytes).padStart(9)} ${file.file}`);
105
- }
106
- async function restoreCommand(args) {
107
- const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
108
- "home-only": { type: "boolean" },
109
- stop: { type: "boolean" },
110
- "dry-run": { type: "boolean" },
111
- "replace-newer": { type: "boolean" },
112
- json: { type: "boolean" }
113
- } });
114
- if (positionals.length !== 1) throw new UsageError();
115
- const file = path.resolve(positionals[0]);
116
- if (values["dry-run"]) {
117
- const contents = await verifyBackup(file);
118
- const missing = [];
119
- for (const root of contents.projects) if (!await stat(root).then((info) => info.isDirectory(), () => false)) missing.push(root);
120
- if (values.json) {
121
- console.log(JSON.stringify({ ...contents, missing }));
122
- return;
123
- }
124
- console.log(`${file} is intact; a restore would replace, in ${alpHome()}: ${contents.units.join(", ") || "nothing"}`);
125
- if (!values["home-only"]) for (const root of contents.projects) console.log(` and in ${root}: its ALP files and tasks${missing.includes(root) ? " (skipped: the directory does not exist)" : ""}`);
126
- console.log("nothing was changed");
127
- return;
128
- }
129
- const result = await withMaintenance("restore", { stopFirst: values.stop }, (home) => restoreBackup({ home, file, projects: !values["home-only"], replaceNewer: values["replace-newer"], by: BY }));
130
- if (values.json) {
131
- console.log(JSON.stringify(result));
132
- return;
133
- }
134
- if (result.interrupted) console.log(`an earlier restore was cut short and has been ${result.interrupted.outcome}`);
135
- console.log(`restored ${file}`);
136
- console.log(` ${alpHome()}: ${result.units.filter((unit) => unit.area === "home" && unit.present).map((unit) => unit.unit).join(", ") || "nothing"}`);
137
- for (const root of result.projects) console.log(` ${root}: ${result.units.filter((unit) => unit.area === root && unit.present).map((unit) => unit.unit).join(", ") || "nothing"}`);
138
- for (const { root, reason } of result.skipped) console.log(` skipped ${root}: ${reason}`);
139
- for (const warning of result.warnings) console.log(` note: ${warning}`);
140
- if (result.stateSchema !== null && result.stateSchema !== void 0) console.log(" sessions that were working when the backup was made wait for you; alpd continues none by itself");
141
- if (result.safety) console.log(`the data it replaced is in ${result.safety}; alp restore ${result.safety} restores that data with the same workspace authority checks`);
142
- }
143
- export {
144
- backupCommand,
145
- restoreCommand
146
- };
@@ -1,240 +0,0 @@
1
- {
2
- "version": "0.0.1-beta.4",
3
- "entries": {
4
- "packages/cli/dist/alpd.js": {
5
- "inputs": [
6
- "packages/client/src/index.js",
7
- "packages/client/src/ipc.js",
8
- "packages/client/src/portable.js",
9
- "packages/client/src/rpc/client.js",
10
- "packages/client/src/rpc/errors.js",
11
- "packages/client/src/rpc/framing.js",
12
- "packages/client/src/rpc/handshake.js",
13
- "packages/client/src/rpc/reconnect.js",
14
- "packages/client/src/rpc/registry.js",
15
- "packages/client/src/rpc/timers.js",
16
- "packages/client/src/websocket.js",
17
- "packages/core/src/adapter.js",
18
- "packages/core/src/atomic.js",
19
- "packages/core/src/backup.js",
20
- "packages/core/src/beads.js",
21
- "packages/core/src/delegation.js",
22
- "packages/core/src/errors.js",
23
- "packages/core/src/formulas.js",
24
- "packages/core/src/hook-run.js",
25
- "packages/core/src/hooks.js",
26
- "packages/core/src/index.js",
27
- "packages/core/src/init.js",
28
- "packages/core/src/library-edit.js",
29
- "packages/core/src/library.js",
30
- "packages/core/src/log.js",
31
- "packages/core/src/migrations.js",
32
- "packages/core/src/models.js",
33
- "packages/core/src/permissions.js",
34
- "packages/core/src/profiles.js",
35
- "packages/core/src/promptsafe.js",
36
- "packages/core/src/providers.js",
37
- "packages/core/src/resolver.js",
38
- "packages/core/src/safe-path.js",
39
- "packages/core/src/shell.js",
40
- "packages/core/src/state-schema.js",
41
- "packages/core/src/task-rows.js",
42
- "packages/core/src/tasks.js",
43
- "packages/core/src/teams.js",
44
- "packages/core/src/template-path.js",
45
- "packages/core/src/trust.js",
46
- "packages/core/src/upgrade.js",
47
- "packages/core/src/user-settings.js",
48
- "packages/core/src/user-worktree.js",
49
- "packages/core/src/validation.js",
50
- "packages/core/src/verify.js",
51
- "packages/core/src/workflow.js",
52
- "packages/daemon/src/attachments.ts",
53
- "packages/daemon/src/conversation.ts",
54
- "packages/daemon/src/files.ts",
55
- "packages/daemon/src/git.ts",
56
- "packages/daemon/src/gitignore.ts",
57
- "packages/daemon/src/history.ts",
58
- "packages/daemon/src/lifecycle.ts",
59
- "packages/daemon/src/lock.ts",
60
- "packages/daemon/src/main.ts",
61
- "packages/daemon/src/operations.ts",
62
- "packages/daemon/src/registry.ts",
63
- "packages/daemon/src/rpc-error.ts",
64
- "packages/daemon/src/scheduler.ts",
65
- "packages/daemon/src/schedules.ts",
66
- "packages/daemon/src/server.ts",
67
- "packages/daemon/src/store.ts",
68
- "packages/daemon/src/terminals.ts",
69
- "packages/daemon/src/worktrees.ts",
70
- "packages/protocol/src/contract-v1.js",
71
- "packages/protocol/src/contract.js",
72
- "packages/protocol/src/index.ts",
73
- "packages/protocol/src/validate.js",
74
- "packages/protocol/src/wire.js",
75
- "packages/runtime/src/acp-transport.ts",
76
- "packages/runtime/src/antigravity-transport.ts",
77
- "packages/runtime/src/assignment-results.ts",
78
- "packages/runtime/src/attachments.ts",
79
- "packages/runtime/src/board-domain.ts",
80
- "packages/runtime/src/board.ts",
81
- "packages/runtime/src/catalog.ts",
82
- "packages/runtime/src/claude-transport.ts",
83
- "packages/runtime/src/configure.ts",
84
- "packages/runtime/src/contracts.ts",
85
- "packages/runtime/src/conversation.ts",
86
- "packages/runtime/src/github.ts",
87
- "packages/runtime/src/handoff.ts",
88
- "packages/runtime/src/index.ts",
89
- "packages/runtime/src/language.ts",
90
- "packages/runtime/src/live.ts",
91
- "packages/runtime/src/mailbox.ts",
92
- "packages/runtime/src/mcp-tools.ts",
93
- "packages/runtime/src/permission-path.ts",
94
- "packages/runtime/src/process-info.ts",
95
- "packages/runtime/src/providers.ts",
96
- "packages/runtime/src/recall.ts",
97
- "packages/runtime/src/resolve.ts",
98
- "packages/runtime/src/runtime-context.ts",
99
- "packages/runtime/src/runtime.ts",
100
- "packages/runtime/src/session-config.ts",
101
- "packages/runtime/src/tool-detail.ts",
102
- "packages/runtime/src/tool-results.ts",
103
- "packages/runtime/src/tools.ts",
104
- "packages/runtime/src/transport.ts",
105
- "packages/runtime/src/usage.ts",
106
- "packages/runtime/src/workspace.ts",
107
- "packages/runtime/src/worktree-domain.ts"
108
- ],
109
- "external": [
110
- "child_process",
111
- "fs",
112
- "node:child_process",
113
- "node:crypto",
114
- "node:fs",
115
- "node:fs/promises",
116
- "node:module",
117
- "node:net",
118
- "node:os",
119
- "node:path",
120
- "node:process",
121
- "node:readline",
122
- "node:stream",
123
- "node:stream/promises",
124
- "node:string_decoder",
125
- "node:url",
126
- "node:zlib",
127
- "path"
128
- ]
129
- },
130
- "packages/cli/dist/acp.js": {
131
- "inputs": [
132
- "packages/cli/src/acp/agent.ts",
133
- "packages/cli/src/acp/main.ts",
134
- "packages/client/src/command.js",
135
- "packages/client/src/index.js",
136
- "packages/client/src/ipc.js",
137
- "packages/client/src/portable.js",
138
- "packages/client/src/rpc/client.js",
139
- "packages/client/src/rpc/errors.js",
140
- "packages/client/src/rpc/framing.js",
141
- "packages/client/src/rpc/handshake.js",
142
- "packages/client/src/rpc/reconnect.js",
143
- "packages/client/src/rpc/registry.js",
144
- "packages/client/src/rpc/timers.js",
145
- "packages/client/src/service.js",
146
- "packages/client/src/supervise.js",
147
- "packages/client/src/websocket.js",
148
- "packages/core/src/log.js",
149
- "packages/protocol/src/index.ts",
150
- "packages/protocol/src/wire.js"
151
- ],
152
- "external": [
153
- "node:child_process",
154
- "node:crypto",
155
- "node:fs/promises",
156
- "node:net",
157
- "node:os",
158
- "node:path",
159
- "node:stream"
160
- ]
161
- },
162
- "packages/cli/dist/alp-web.js": {
163
- "inputs": [
164
- "apps/gateway/src/config.js",
165
- "apps/gateway/src/connection.js",
166
- "apps/gateway/src/credentials.js",
167
- "apps/gateway/src/index.js",
168
- "apps/gateway/src/log.js",
169
- "apps/gateway/src/policy.js",
170
- "apps/gateway/src/server.js",
171
- "apps/gateway/src/tickets.js",
172
- "apps/gateway/src/upstream.js",
173
- "packages/cli/src/web/grant.js",
174
- "packages/cli/src/web/main.js",
175
- "packages/cli/src/web/serve.js",
176
- "packages/client/src/command.js",
177
- "packages/client/src/index.js",
178
- "packages/client/src/integration-lock.js",
179
- "packages/client/src/ipc.js",
180
- "packages/client/src/portable.js",
181
- "packages/client/src/rpc/client.js",
182
- "packages/client/src/rpc/errors.js",
183
- "packages/client/src/rpc/framing.js",
184
- "packages/client/src/rpc/handshake.js",
185
- "packages/client/src/rpc/reconnect.js",
186
- "packages/client/src/rpc/registry.js",
187
- "packages/client/src/rpc/timers.js",
188
- "packages/client/src/service.js",
189
- "packages/client/src/supervise.js",
190
- "packages/client/src/websocket.js",
191
- "packages/core/src/atomic.js",
192
- "packages/core/src/errors.js",
193
- "packages/core/src/library-edit.js",
194
- "packages/core/src/library.js",
195
- "packages/core/src/log.js",
196
- "packages/core/src/models.js",
197
- "packages/core/src/permissions.js",
198
- "packages/core/src/providers.js",
199
- "packages/core/src/resolver.js",
200
- "packages/core/src/safe-path.js",
201
- "packages/core/src/shell.js",
202
- "packages/core/src/teams.js",
203
- "packages/core/src/template-path.js",
204
- "packages/core/src/validation.js",
205
- "packages/core/src/verify.js",
206
- "packages/protocol/src/contract-v1.js",
207
- "packages/protocol/src/contract.js",
208
- "packages/protocol/src/index.ts",
209
- "packages/protocol/src/validate.js",
210
- "packages/protocol/src/wire.js"
211
- ],
212
- "external": [
213
- "buffer",
214
- "bufferutil",
215
- "crypto",
216
- "events",
217
- "http",
218
- "https",
219
- "net",
220
- "node:child_process",
221
- "node:crypto",
222
- "node:fs",
223
- "node:fs/promises",
224
- "node:http",
225
- "node:https",
226
- "node:net",
227
- "node:os",
228
- "node:path",
229
- "node:url",
230
- "node:util",
231
- "stream",
232
- "tls",
233
- "url",
234
- "utf-8-validate",
235
- "util",
236
- "zlib"
237
- ]
238
- }
239
- }
240
- }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // packages/cli/src/cli.js
4
- import { setup } from "@anhlp/alp-client/setup";
5
- import { alpHome } from "@anhlp/alp-client/index";
6
- import { scrubText } from "@anhlp/alp-core/log";
7
- import { USAGE, UsageError } from "./usage.js";
8
- import { project, permissionsCommand, trustCommand, language, verify, doctor } from "./projects.js";
9
- import { daemon } from "./daemon.js";
10
- import { run, ps, attach, send, questions, answer, top, log, board, pause, resume, recall, interrupt } from "./sessions.js";
11
- import { libraryCommand, editCommand, teamsCommand } from "./library.js";
12
- import { scheduleCommand } from "./schedules.js";
13
- import { tasksCommand, formulaCommand, taskCommand } from "./tasks.js";
14
- import { webCommand, acpCommand } from "./interfaces.js";
15
- import { backupCommand, restoreCommand } from "./backup.js";
16
- import { terminalCommand } from "./terminal.js";
17
- var commands = { schedule: scheduleCommand, setup: (args2) => setup(args2, alpHome()), init: (args2) => project("init", args2), upgrade: (args2) => project("upgrade", args2), update: (args2) => project("upgrade", args2), daemon, doctor, run, ps, top, attach, send, questions, answer, log, board, tasks: tasksCommand, task: taskCommand, formula: formulaCommand, permissions: permissionsCommand, agents: (args2) => libraryCommand("agents", args2), skills: (args2) => libraryCommand("skills", args2), mcp: (args2) => ["add", "rm", "mv", "cp", "test", "show", "edit"].includes(args2[0]) ? editCommand("mcp", args2) : libraryCommand("mcp", args2), hooks: (args2) => libraryCommand("hooks", args2), providers: (args2) => libraryCommand("providers", args2), provider: (args2) => editCommand("providers", args2), teams: teamsCommand, trust: trustCommand, agent: (args2) => editCommand("agents", args2), team: (args2) => editCommand("teams", args2), skill: (args2) => editCommand("skills", args2), hook: (args2) => editCommand("hooks", args2), verify, recall, pause, resume, language, interrupt, acp: acpCommand, web: webCommand, backup: backupCommand, restore: restoreCommand, terminal: terminalCommand };
18
- var [command, ...args] = process.argv.slice(2);
19
- try {
20
- if (command === "--version") {
21
- console.log(true ? "0.0.1-beta.4" : JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version);
22
- } else {
23
- if (!Object.hasOwn(commands, command)) throw new UsageError();
24
- await commands[command](args);
25
- }
26
- } catch (error) {
27
- if (error instanceof UsageError || error?.code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") console.error(USAGE);
28
- else console.error(`alp: ${scrubText(error?.message ?? error)}`);
29
- process.exitCode = 1;
30
- }
@@ -1,35 +0,0 @@
1
- export function built(): Promise<void>;
2
- /** Waits until an alpd for this home is ready; returns its socket. */
3
- export function ready(timeoutMs?: number): Promise<any>;
4
- /** The installed service for this ALP_HOME, if any. */
5
- export function installed(): Promise<{
6
- kind: string;
7
- name: string;
8
- file: string;
9
- install: (string | string[] | {
10
- ignore: boolean;
11
- })[][];
12
- start: (string | string[])[][];
13
- uninstall: (string | string[] | {
14
- ignore: boolean;
15
- })[][];
16
- afterUninstall?: undefined;
17
- } | {
18
- kind: string;
19
- name: string;
20
- file: string;
21
- install: (string | string[])[][];
22
- start: (string | string[])[][];
23
- uninstall: (string | string[] | {
24
- ignore: boolean;
25
- })[][];
26
- afterUninstall: (string | string[] | {
27
- ignore: boolean;
28
- })[][];
29
- } | undefined>;
30
- /** Starts alpd: through its service when installed, so the service keeps it running; else detached. */
31
- export function start(): Promise<string>;
32
- /** Connects to a running daemon without starting one. */
33
- export function running(): Promise<import("@anhlp/alp-client/index").AlpClient>;
34
- export function stop(): Promise<boolean>;
35
- export function daemon([action, ...rest]: [any, ...any[]]): Promise<void>;
@@ -1,126 +0,0 @@
1
- // packages/cli/src/daemon.js
2
- import { access } from "node:fs/promises";
3
- import path from "node:path";
4
- import { installedProgram, installService, serviceFor, uninstallService } from "@anhlp/alp-client/service";
5
- import { holdDaemon, startDaemon } from "@anhlp/alp-client/supervise";
6
- import { alpHome, connect, lockAlive, readLock, withDaemonLifecycle } from "@anhlp/alp-client/index";
7
- import { scrubText } from "@anhlp/alp-core/log";
8
- import { UsageError } from "./usage.js";
9
- import { DAEMON_ENTRY } from "./paths.js";
10
- async function built() {
11
- try {
12
- await access(DAEMON_ENTRY);
13
- } catch {
14
- throw new Error(`alpd is not built (${DAEMON_ENTRY}); run npm run build`);
15
- }
16
- }
17
- async function ready(timeoutMs = 15e3) {
18
- const deadline = Date.now() + timeoutMs;
19
- while (Date.now() < deadline) {
20
- const lock = await readLock(alpHome());
21
- if (lockAlive(lock) && lock.ready) return lock.socket;
22
- await new Promise((resolve) => setTimeout(resolve, 100));
23
- }
24
- throw new Error(`alpd did not become ready within ${timeoutMs / 1e3} s; see ${path.join(alpHome(), "logs")}`);
25
- }
26
- async function installed() {
27
- const service = serviceFor({ home: alpHome() });
28
- return service && await installedProgram(service) ? service : void 0;
29
- }
30
- async function start() {
31
- await built();
32
- return startDaemon({ home: alpHome(), entry: DAEMON_ENTRY });
33
- }
34
- async function running() {
35
- const lock = await readLock(alpHome());
36
- if (!lockAlive(lock) || !lock.ready) throw new Error("alpd is not running; start it with: alp daemon start");
37
- return connect(lock.socket, { name: "alp-cli", version: "1" });
38
- }
39
- async function stop() {
40
- const home = alpHome();
41
- const lock = await readLock(home);
42
- if (!lockAlive(lock)) return false;
43
- const client = await connect(lock.socket, { name: "alp-cli", version: "1" });
44
- await client.request("daemon.shutdown").finally(() => client.close());
45
- for (let i = 0; i < 150 && lockAlive(await readLock(home)); i++) await new Promise((resolve) => setTimeout(resolve, 100));
46
- return true;
47
- }
48
- async function daemon([action, ...rest]) {
49
- if (rest.length && !(action === "status" && rest.length === 1 && rest[0] === "--json")) throw new UsageError();
50
- if (action === "start") {
51
- const socket = await start();
52
- const lock = await readLock(alpHome());
53
- console.log(`alpd ${lock.version} running (pid ${lock.pid}) on ${socket}`);
54
- } else if (action === "stop") {
55
- await holdDaemon(alpHome());
56
- const stopped = await withDaemonLifecycle(alpHome(), "stop", async () => {
57
- const stopped2 = await stop();
58
- await holdDaemon(alpHome());
59
- return stopped2;
60
- });
61
- console.log(stopped ? `alpd stopped; it stays stopped until alp daemon start, a prompt in Paseo, or ${await installed() ? "the next login" : "Paseo starting again"}` : "alpd is not running");
62
- } else if (action === "restart") {
63
- const client = await running().catch(() => void 0);
64
- const status = client && await client.request("daemon.status").finally(() => client.close());
65
- await stop();
66
- await daemon(["start"]);
67
- if (status?.sessions) console.log(`${status.sessions} live sessions were open; alpd reopens what was still working`);
68
- } else if (action === "install") {
69
- await built();
70
- const service = serviceFor({ home: alpHome() });
71
- if (!service) throw new Error(`alp daemon install supports macOS (launchd) and Linux (systemd), not ${process.platform}`);
72
- const replaced = await stop();
73
- await installService(service, { home: alpHome(), entry: DAEMON_ENTRY });
74
- await ready();
75
- const lock = await readLock(alpHome());
76
- console.log(`alpd installed as ${service.kind === "launchd" ? "a LaunchAgent" : "a systemd user service"} (${service.name}, ${service.file})`);
77
- console.log(`alpd ${lock.version} running (pid ${lock.pid}); it starts at login and again after a crash${replaced ? "; the alpd that ran before handed its work over" : ""}`);
78
- } else if (action === "uninstall") {
79
- const service = serviceFor({ home: alpHome() });
80
- if (!service || !await uninstallService(service)) {
81
- console.log("alpd is not installed as a service");
82
- return;
83
- }
84
- for (let i = 0; i < 150 && lockAlive(await readLock(alpHome())); i++) await new Promise((resolve) => setTimeout(resolve, 100));
85
- console.log(`alpd service ${service.name} removed and alpd stopped; alp daemon start runs it without a service`);
86
- } else if (action === "status") {
87
- const json = rest[0] === "--json";
88
- const lock = await readLock(alpHome());
89
- if (!lockAlive(lock) || lock.maintenance) {
90
- const busy = lockAlive(lock) ? { maintenance: lock.maintenance, pid: lock.pid } : {};
91
- if (json) console.log(JSON.stringify({ running: false, live: false, ready: false, ...busy }));
92
- else console.log(busy.maintenance ? `alpd is not running: alp ${busy.maintenance} runs (pid ${busy.pid})` : "alpd is not running");
93
- process.exitCode = 3;
94
- return;
95
- }
96
- const client = await connect(lock.socket, { name: "alp-cli", version: "1" }).catch((error) => {
97
- if (json) console.log(JSON.stringify({ running: true, live: true, ready: false, pid: lock.pid, checks: [{ id: "ipc", ok: false, code: "ALP_IPC_FAILED", message: scrubText(error.message) }] }));
98
- else console.log(`alpd (pid ${lock.pid}) is running but not answering on ${lock.socket}: ${scrubText(error.message)}; alp doctor says more`);
99
- process.exitCode = 4;
100
- });
101
- if (!client) return;
102
- const status = await client.request("daemon.status").finally(() => client.close());
103
- const health = status.health ?? { live: true, ready: lock.ready === true, checks: [] };
104
- if (json) {
105
- console.log(JSON.stringify({ running: true, ...status, health }));
106
- } else {
107
- console.log(`alpd ${status.version} running (pid ${status.pid}) since ${status.startedAt}; ${status.sessions} live sessions; socket ${lock.socket}`);
108
- console.log(health.ready ? "ready" : `not ready: ${health.checks.filter((check) => !check.ok).map((check) => `${check.code ?? check.id} (${scrubText(check.message ?? "failed")})`).join(", ") || "starting"}`);
109
- if (status.previousExit?.kind === "crash") console.log(`the alpd before it stopped unexpectedly${status.previousExit.at ? ` around ${status.previousExit.at}` : ""}`);
110
- const service = await installed();
111
- if (service) console.log(`managed by ${service.kind} as ${service.name}`);
112
- }
113
- if (!health.ready) process.exitCode = 4;
114
- } else {
115
- throw new UsageError();
116
- }
117
- }
118
- export {
119
- built,
120
- daemon,
121
- installed,
122
- ready,
123
- running,
124
- start,
125
- stop
126
- };
@@ -1 +0,0 @@
1
- export const CLI_PACKAGE: "@anhlp/alp-cli";
@@ -1,5 +0,0 @@
1
- // packages/cli/src/index.js
2
- var CLI_PACKAGE = "@anhlp/alp-cli";
3
- export {
4
- CLI_PACKAGE
5
- };
@@ -1,24 +0,0 @@
1
- /**
2
- * Starts the Paseo integration. For one release, a home that still has only the descriptor
3
- * registered before the rename (`integrations/web.json`) keeps working, with a hint to re-register.
4
- * Exported for tests.
5
- * @param {string} home
6
- */
7
- export function startPaseoIntegration(home: string): Promise<any>;
8
- /**
9
- * alp web pair: the link that pairs Paseo's app on another device with alpd through Paseo's relay
10
- * (ALPD §64). The device then signs in with the password this command prints (the token kept in
11
- * ~/.alp/paseo.json).
12
- */
13
- /**
14
- * `web.pairing` is an extension the integration registers on its alpd connection. Right after an
15
- * alpd restart the old registration is gone and the new one may still be in flight, so an
16
- * unknown-method reply means "not yet", not "never": wait for the fresh registration.
17
- *
18
- * Exported so the wait can be pinned by a regression test without a live daemon restart.
19
- */
20
- export function requestPairing(client: any, params: any, attempts?: number): Promise<any>;
21
- export function webCommand(args: any): Promise<void>;
22
- export function pairCommand(args: any): Promise<void>;
23
- /** alp acp: ALP as an ACP agent for editors; stdout carries only the protocol (ALPD §60). */
24
- export function acpCommand(args: any): Promise<void>;