@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,35 +0,0 @@
1
- /**
2
- * The hook definitions an agent uses (ALPD §45): those it names in agent.json and the
3
- * JSON files in its own hooks/ directory. `project` marks a hook that comes from the
4
- * project's .alp/, which runs only once the user trusts the workspace.
5
- * @param {import('./types.js').ResolvedAgent} agent
6
- * @returns {Promise<Array<{ name: string, path: string, project: boolean, event: string, command: string, blocking?: boolean, timeoutSec?: number, match?: { agent?: string, label?: string }, description?: string }>>}
7
- */
8
- export function loadHooks(agent: import("./types.js").ResolvedAgent): Promise<Array<{
9
- name: string;
10
- path: string;
11
- project: boolean;
12
- event: string;
13
- command: string;
14
- blocking?: boolean;
15
- timeoutSec?: number;
16
- match?: {
17
- agent?: string;
18
- label?: string;
19
- };
20
- description?: string;
21
- }>>;
22
- /**
23
- * Whether a hook applies: to its agent, if it names one, and to tasks with its label, if it names one.
24
- * @param {{ match?: { agent?: string, label?: string } }} hook
25
- * @param {{ agent: string, labels?: string[] }} context
26
- */
27
- export function hookMatches(hook: {
28
- match?: {
29
- agent?: string;
30
- label?: string;
31
- };
32
- }, { agent, labels }: {
33
- agent: string;
34
- labels?: string[];
35
- }): boolean;
@@ -1,30 +0,0 @@
1
- // packages/core/src/hooks.js
2
- import { readFile } from "node:fs/promises";
3
- import path from "node:path";
4
- import { AlpError } from "./errors.js";
5
- import { validateHook } from "./validation.js";
6
- async function loadHooks(agent) {
7
- const project = path.join(agent.projectRoot, ".alp") + path.sep;
8
- const hooks = [];
9
- for (const { name, path: file } of agent.hooks) {
10
- if (!file.endsWith(".json")) throw new AlpError("INVALID_HOOK", `${file}: a hook is a JSON definition, hooks/<name>.json, with an event and a command`);
11
- let config;
12
- try {
13
- config = JSON.parse(await readFile(file, "utf8"));
14
- } catch (cause) {
15
- throw new AlpError("INVALID_HOOK", `${file}: ${cause.message}`, { cause });
16
- }
17
- validateHook(config, file);
18
- hooks.push({ ...config, name: name.replace(/\.json$/, ""), path: file, project: file.startsWith(project) });
19
- }
20
- return hooks;
21
- }
22
- function hookMatches(hook, { agent, labels = [] }) {
23
- if (hook.match?.agent && hook.match.agent !== agent) return false;
24
- if (hook.match?.label && !labels.includes(hook.match.label)) return false;
25
- return true;
26
- }
27
- export {
28
- hookMatches,
29
- loadHooks
30
- };
@@ -1,31 +0,0 @@
1
- export * as adapter from "./adapter.js";
2
- export * as atomic from "./atomic.js";
3
- export * as backup from "./backup.js";
4
- export * as beads from "./beads.js";
5
- export * as delegation from "./delegation.js";
6
- export * as errors from "./errors.js";
7
- export * as formulas from "./formulas.js";
8
- export * as hook_run from "./hook-run.js";
9
- export * as hooks from "./hooks.js";
10
- export * as init from "./init.js";
11
- export * as library_edit from "./library-edit.js";
12
- export * as library from "./library.js";
13
- export * as log from "./log.js";
14
- export * as migrations from "./migrations.js";
15
- export * as models from "./models.js";
16
- export * as permissions from "./permissions.js";
17
- export * as profiles from "./profiles.js";
18
- export * as promptsafe from "./promptsafe.js";
19
- export * as providers from "./providers.js";
20
- export * as resolver from "./resolver.js";
21
- export * as state_schema from "./state-schema.js";
22
- export * as task_rows from "./task-rows.js";
23
- export * as tasks from "./tasks.js";
24
- export * as teams from "./teams.js";
25
- export * as trust from "./trust.js";
26
- export * as upgrade from "./upgrade.js";
27
- export * as user_settings from "./user-settings.js";
28
- export * as validation from "./validation.js";
29
- export * as verify from "./verify.js";
30
- export * as workflow from "./workflow.js";
31
- export * as user_worktree from "./user-worktree.js";
@@ -1,65 +0,0 @@
1
- // packages/core/src/index.js
2
- import * as adapter from "./adapter.js";
3
- import * as atomic from "./atomic.js";
4
- import * as backup from "./backup.js";
5
- import * as beads from "./beads.js";
6
- import * as delegation from "./delegation.js";
7
- import * as errors from "./errors.js";
8
- import * as formulas from "./formulas.js";
9
- import * as hook_run from "./hook-run.js";
10
- import * as hooks from "./hooks.js";
11
- import * as init from "./init.js";
12
- import * as library_edit from "./library-edit.js";
13
- import * as library from "./library.js";
14
- import * as log from "./log.js";
15
- import * as migrations from "./migrations.js";
16
- import * as models from "./models.js";
17
- import * as permissions from "./permissions.js";
18
- import * as profiles from "./profiles.js";
19
- import * as promptsafe from "./promptsafe.js";
20
- import * as providers from "./providers.js";
21
- import * as resolver from "./resolver.js";
22
- import * as state_schema from "./state-schema.js";
23
- import * as task_rows from "./task-rows.js";
24
- import * as tasks from "./tasks.js";
25
- import * as teams from "./teams.js";
26
- import * as trust from "./trust.js";
27
- import * as upgrade from "./upgrade.js";
28
- import * as user_settings from "./user-settings.js";
29
- import * as validation from "./validation.js";
30
- import * as verify from "./verify.js";
31
- import * as workflow from "./workflow.js";
32
- import * as user_worktree from "./user-worktree.js";
33
- export {
34
- adapter,
35
- atomic,
36
- backup,
37
- beads,
38
- delegation,
39
- errors,
40
- formulas,
41
- hook_run,
42
- hooks,
43
- init,
44
- library,
45
- library_edit,
46
- log,
47
- migrations,
48
- models,
49
- permissions,
50
- profiles,
51
- promptsafe,
52
- providers,
53
- resolver,
54
- state_schema,
55
- task_rows,
56
- tasks,
57
- teams,
58
- trust,
59
- upgrade,
60
- user_settings,
61
- user_worktree,
62
- validation,
63
- verify,
64
- workflow
65
- };
@@ -1,30 +0,0 @@
1
- /**
2
- * Fill missing scaffold files without replacing existing user content: ALP.md and
3
- * .alp/settings.json. Agents, skills, MCP servers and hooks come from ALP's built-ins
4
- * and the user's library (ALPD §41); a project adds its own under .alp/ only to
5
- * override them.
6
- * @param {string} projectRoot
7
- * @param {{ templateRoot?: URL, templates?: Record<string, string>, library?: string, syncProfiles?: boolean, onlyManagedProfiles?: boolean, teamIds?: string[] }} [options]
8
- */
9
- export function initProject(projectRoot: string, { templateRoot, templates, library, syncProfiles, onlyManagedProfiles, teamIds }?: {
10
- templateRoot?: URL;
11
- templates?: Record<string, string>;
12
- library?: string;
13
- syncProfiles?: boolean;
14
- onlyManagedProfiles?: boolean;
15
- teamIds?: string[];
16
- }): Promise<{
17
- updated?: string[] | undefined;
18
- created: string[];
19
- preserved: string[];
20
- }>;
21
- /** Refresh an existing project's settings only; a template Save must not scaffold unrelated folders.
22
- * @param {string} projectRoot
23
- * @param {{ library?: string, templates?: Record<string, string>, teamIds?: string[], replaceModels?: boolean }} [options]
24
- */
25
- export function syncProjectSettings(projectRoot: string, { library, templates, teamIds, replaceModels }?: {
26
- library?: string;
27
- templates?: Record<string, string>;
28
- teamIds?: string[];
29
- replaceModels?: boolean;
30
- }): Promise<boolean>;
@@ -1,89 +0,0 @@
1
- // packages/core/src/init.js
2
- import { shippedTemplateRoot } from "./template-path.js";
3
- import { mkdir, writeFile, lstat, readFile, rename, rm } from "node:fs/promises";
4
- import path from "node:path";
5
- import { randomUUID } from "node:crypto";
6
- import { projectProfiles, profileDefaults, syncTemplateProfiles } from "./profiles.js";
7
- import { validateSettings } from "./validation.js";
8
- import { INIT_TEAM } from "./workflow.js";
9
- async function initProject(projectRoot, { templateRoot, templates, library, syncProfiles = true, onlyManagedProfiles = false, teamIds } = {}) {
10
- const root = path.resolve(projectRoot);
11
- const sourceRoot = () => templateRoot ?? shippedTemplateRoot();
12
- const template = (name) => templates ? Promise.resolve(templates[name]) : readFile(new URL(name, sourceRoot()), "utf8");
13
- const scaffold = path.join(root, ".alp");
14
- const existing = await lstat(scaffold).catch((error) => {
15
- if (error.code !== "ENOENT") throw error;
16
- });
17
- if (existing && !existing.isDirectory()) throw new Error(`Expected a directory: ${scaffold}`);
18
- const team = await projectProfiles({ root, templates, library, teamIds });
19
- const files = {
20
- "ALP.md": await template("ALP.md"),
21
- ".alp/settings.json": JSON.stringify({ defaultAgent: "main", workflow: { mode: INIT_TEAM }, team, templateDefaults: profileDefaults(team) }, null, 2) + "\n"
22
- };
23
- const directories = [".alp"];
24
- const created = [];
25
- const preserved = [];
26
- const updated = [];
27
- await mkdir(root, { recursive: true });
28
- for (const directory of directories) {
29
- const target = path.join(root, directory);
30
- try {
31
- await mkdir(target);
32
- } catch (error) {
33
- if (error.code !== "EEXIST") throw error;
34
- if (!(await lstat(target)).isDirectory()) throw new Error(`Expected a directory: ${target}`);
35
- }
36
- }
37
- for (const [name, content] of Object.entries(files)) {
38
- const target = path.join(root, name);
39
- try {
40
- await writeFile(target, content, { flag: "wx" });
41
- created.push(name);
42
- } catch (error) {
43
- if (error.code !== "EEXIST") throw error;
44
- if (!(await lstat(target)).isFile()) throw new Error(`Expected a regular file: ${target}`);
45
- preserved.push(name);
46
- if (name === ".alp/settings.json" && syncProfiles) {
47
- const before = await readFile(target, "utf8");
48
- const settings = JSON.parse(before);
49
- validateSettings(settings, target);
50
- const next = !onlyManagedProfiles || settings.team || settings.profile || settings.templateDefaults ? await syncTemplateProfiles(settings, { root, library, templates, teamIds }) : settings;
51
- validateSettings(next, target);
52
- if (JSON.stringify(next) !== JSON.stringify(settings)) {
53
- if (await readFile(target, "utf8") !== before) throw new Error(`File changed during initialization: ${target}`);
54
- await writeFile(target, JSON.stringify(next, null, 2) + "\n");
55
- updated.push(name);
56
- }
57
- }
58
- }
59
- }
60
- return { created, preserved, ...updated.length ? { updated } : {} };
61
- }
62
- async function syncProjectSettings(projectRoot, { library, templates, teamIds, replaceModels = false } = {}) {
63
- const root = path.resolve(projectRoot);
64
- const file = path.join(root, ".alp/settings.json");
65
- const info = await lstat(file).catch((error) => {
66
- if (error.code !== "ENOENT") throw error;
67
- });
68
- if (!info) return false;
69
- if (!info.isFile()) throw new Error(`Expected a regular file: ${file}`);
70
- const before = await readFile(file, "utf8");
71
- const settings = JSON.parse(before);
72
- validateSettings(settings, file);
73
- const next = await syncTemplateProfiles(settings, { root, library, templates, teamIds, replaceModels });
74
- validateSettings(next, file);
75
- if (JSON.stringify(settings) === JSON.stringify(next)) return false;
76
- const temporary = `${file}.${randomUUID()}.tmp`;
77
- try {
78
- await writeFile(temporary, JSON.stringify(next, null, 2) + "\n", { flag: "wx", mode: info.mode });
79
- if (await readFile(file, "utf8") !== before) throw new Error(`Settings changed while saving the template: ${file}`);
80
- await rename(temporary, file);
81
- } finally {
82
- await rm(temporary, { force: true });
83
- }
84
- return true;
85
- }
86
- export {
87
- initProject,
88
- syncProjectSettings
89
- };
@@ -1,93 +0,0 @@
1
- /** Strict payload contract for opt-in project-data writes. Instructions carry prompt authority;
2
- * executable configuration and references to it have no place in this policy. */
3
- export function assertProjectDataContent(kind: any, content: any): void;
4
- /**
5
- * One entry: the version that applies (the project's, else the library's, else the
6
- * built-in), or one scope's version with `scope`. `revision` goes back with a save.
7
- * @param {'agents' | 'skills' | 'mcp' | 'hooks' | 'teams' | 'providers'} kind
8
- * @param {string} name
9
- * @param {{ root?: string, library?: string, templates?: Record<string, string>, scope?: 'library' | 'project' }} [options]
10
- * @returns {Promise<{ kind: 'agents' | 'skills' | 'mcp' | 'hooks' | 'teams' | 'providers', name: string, source: 'builtin' | 'library' | 'project', overrides?: 'builtin' | 'library' | 'project', content: Record<string, unknown>, revision: string | null, usedBy: string[] }>}
11
- */
12
- export function getEntry(kind: "agents" | "skills" | "mcp" | "hooks" | "teams" | "providers", name: string, { root, library, templates, scope }?: {
13
- root?: string;
14
- library?: string;
15
- templates?: Record<string, string>;
16
- scope?: "library" | "project";
17
- }): Promise<{
18
- kind: "agents" | "skills" | "mcp" | "hooks" | "teams" | "providers";
19
- name: string;
20
- source: "builtin" | "library" | "project";
21
- overrides?: "builtin" | "library" | "project";
22
- content: Record<string, unknown>;
23
- revision: string | null;
24
- usedBy: string[];
25
- }>;
26
- /** The skills the library gives `agent`, as role-skills.json lists them. */
27
- export function givenSkills(library: any, agent: any): Promise<string[]>;
28
- /**
29
- * Sets the skills the library gives an agent (role-skills.json), so a built-in agent's
30
- * skills change without copying its instructions. Every skill must be in the library.
31
- * @returns {Promise<{ skills: string[] }>}
32
- */
33
- export function setGivenSkills(agent: any, skills: any, { library }?: {}): Promise<{
34
- skills: string[];
35
- }>;
36
- /** Every entry of a kind with its source and users, as `alp <kind>` lists them. */
37
- export function listEntries(kind: any, { root, library, templates }?: {}): Promise<{
38
- name: string;
39
- source: "builtin" | "library" | "project";
40
- path?: string;
41
- overrides?: "builtin" | "library";
42
- description?: string;
43
- usedBy?: string[];
44
- }[] | {
45
- usedBy: any[];
46
- path?: string | undefined;
47
- overrides?: "library" | "builtin" | undefined;
48
- name: string;
49
- source: "library" | "project" | "builtin";
50
- }[]>;
51
- /** Who refers to an entry: agents naming it, teams with it as a member, settings and role-skills.json. */
52
- export function usersOf(kind: any, name: any, { root, library, templates }?: {}): Promise<any[]>;
53
- /**
54
- * Creates or replaces an entry in a scope. `revision` is what getEntry returned for
55
- * that scope (null to create); a different current revision refuses the save.
56
- * @returns {Promise<{ revision: string | null }>}
57
- */
58
- export function saveEntry(kind: any, name: any, content: any, { scope, root, library, templates, revision, policy }?: {}): Promise<{
59
- revision: string | null;
60
- }>;
61
- /**
62
- * Removes an entry from a scope. When nothing else of that name is left below it, an
63
- * entry others refer to stays, and the error lists them.
64
- * @returns {Promise<{ removed: boolean, now?: 'builtin' | 'library' }>}
65
- */
66
- export function deleteEntry(kind: any, name: any, { scope, root, library, templates, revision, policy }?: {}): Promise<{
67
- removed: boolean;
68
- now?: "builtin" | "library";
69
- }>;
70
- /** Copies the entry that applies under `from` to a new entry `to` in a scope; built-ins are copied this way. */
71
- export function duplicateEntry(kind: any, from: any, to: any, { scope, root, library, templates, policy }?: {}): Promise<{
72
- revision: string | null;
73
- }>;
74
- /** Renames an entry within a scope; refused while others refer to it by its old name. */
75
- export function renameEntry(kind: any, from: any, to: any, { scope, root, library, templates, policy }?: {}): Promise<{
76
- revision: string | null;
77
- }>;
78
- /**
79
- * Editing the library (ALPD §43): agents, skills, MCP servers, hooks and teams, in the
80
- * user's library (ALP_HOME) or as a project's override (.alp/). Built-ins are never
81
- * written; duplicate one, or save an entry of its name, to change it. Every save is
82
- * checked first and written file by file through a temporary file and a rename; a
83
- * revision taken when the entry was read refuses a save over someone else's change.
84
- *
85
- * An entry's content, by kind:
86
- * agents { instructions, config? } AGENT.md and agent.json
87
- * skills { body } SKILL.md
88
- * mcp { server } mcp/<name>.json
89
- * hooks { hook } hooks/<name>.json
90
- * teams { team, houseRules? } team.json and HOUSE_RULES.md
91
- * providers { provider } providers/<name>.json, in the library only (ALPD §46)
92
- */
93
- export const EDIT_KINDS: string[];