@anhlp/alp-cli 0.0.1-beta.7 → 0.0.1-beta.9

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 (56) hide show
  1. package/dist/THIRD-PARTY-NOTICES.txt +1 -1
  2. package/dist/acp/main.js +1 -1
  3. package/dist/acp.js +7586 -2258
  4. package/dist/{alp-web → alp-dashboard}/THIRD-PARTY-NOTICES.txt +1 -1
  5. package/dist/{alp-web/assets/TerminalPanel-BeMws9CP.js → alp-dashboard/assets/TerminalPanel-BSjqIfNr.js} +1 -1
  6. package/dist/{alp-web/assets/index-Dl7motn1.js → alp-dashboard/assets/index-CZFfSOIE.js} +35 -35
  7. package/dist/{alp-web → alp-dashboard}/index.html +1 -1
  8. package/dist/{alp-web.js → alp-dashboard.js} +491 -323
  9. package/dist/alpd.js +11807 -5372
  10. package/dist/backup.js +1 -1
  11. package/dist/build-manifest.json +24 -6
  12. package/dist/cli.js +7 -4
  13. package/dist/daemon.d.ts +2 -2
  14. package/dist/daemon.js +8 -8
  15. package/dist/dashboard-migrate.d.ts +31 -0
  16. package/dist/dashboard-migrate.js +127 -0
  17. package/dist/dashboard-service.d.ts +69 -0
  18. package/dist/{web-service.js → dashboard-service.js} +30 -32
  19. package/dist/desktop.d.ts +56 -0
  20. package/dist/desktop.js +91 -0
  21. package/dist/interfaces.d.ts +2 -2
  22. package/dist/interfaces.js +134 -42
  23. package/dist/library.d.ts +16 -2
  24. package/dist/library.js +114 -7
  25. package/dist/paths.d.ts +6 -1
  26. package/dist/paths.js +4 -2
  27. package/dist/projects.js +2 -1
  28. package/dist/roles.d.ts +5 -5
  29. package/dist/self-update.d.ts +4 -2
  30. package/dist/self-update.js +29 -6
  31. package/dist/sessions.d.ts +0 -1
  32. package/dist/usage.d.ts +1 -1
  33. package/dist/usage.js +13 -6
  34. package/package.json +6 -6
  35. package/src/cli.js +8 -3
  36. package/src/daemon.js +10 -9
  37. package/src/dashboard-migrate.js +152 -0
  38. package/src/{web-service.js → dashboard-service.js} +54 -48
  39. package/src/desktop.js +122 -0
  40. package/src/interfaces.js +171 -58
  41. package/src/library.js +108 -9
  42. package/src/paths.js +9 -3
  43. package/src/projects.js +3 -1
  44. package/src/roles.js +4 -4
  45. package/src/self-update.js +45 -8
  46. package/src/sessions.js +0 -2
  47. package/src/usage.js +13 -6
  48. package/dist/web-service.d.ts +0 -56
  49. /package/dist/{alp-web → alp-dashboard}/alp-boundary.json +0 -0
  50. /package/dist/{alp-web → alp-dashboard}/apple-touch-icon.png +0 -0
  51. /package/dist/{alp-web → alp-dashboard}/assets/TerminalPanel-DLuoa74B.css +0 -0
  52. /package/dist/{alp-web → alp-dashboard}/assets/highlighter-BnicKQ_d.js +0 -0
  53. /package/dist/{alp-web → alp-dashboard}/assets/index-DwqDSiIi.css +0 -0
  54. /package/dist/{alp-web → alp-dashboard}/favicon-attention.svg +0 -0
  55. /package/dist/{alp-web → alp-dashboard}/favicon-running.svg +0 -0
  56. /package/dist/{alp-web → alp-dashboard}/favicon.svg +0 -0
@@ -3715,10 +3715,10 @@ var require_websocket_server = __commonJS({
3715
3715
  }
3716
3716
  });
3717
3717
 
3718
- // packages/cli/src/web/main.js
3718
+ // packages/cli/src/dashboard/main.js
3719
3719
  import { randomBytes as randomBytes5 } from "node:crypto";
3720
3720
  import { mkdirSync, openSync, watch, writeSync } from "node:fs";
3721
- import { chmod as chmod2, link as link2, mkdir as mkdir6, readFile as readFile5, rename as rename4, unlink as unlink6, writeFile as writeFile6 } from "node:fs/promises";
3721
+ import { chmod as chmod3, link as link2, mkdir as mkdir6, readFile as readFile5, rename as rename4, unlink as unlink6, writeFile as writeFile6 } from "node:fs/promises";
3722
3722
  import path10 from "node:path";
3723
3723
  import { fileURLToPath } from "node:url";
3724
3724
  import { parseArgs } from "node:util";
@@ -3727,8 +3727,8 @@ import { parseArgs } from "node:util";
3727
3727
  import { setTimeout as delay } from "node:timers/promises";
3728
3728
  import { execFileSync, spawn } from "node:child_process";
3729
3729
  import { createHash, randomUUID } from "node:crypto";
3730
- import { readFileSync as readFileSync2 } from "node:fs";
3731
- import { open, readFile, writeFile, realpath, stat, lstat, mkdir, readlink, unlink, readdir, rename, rmdir, link } from "node:fs/promises";
3730
+ import { fstatSync, readFileSync as readFileSync2 } from "node:fs";
3731
+ import { open, readFile, writeFile as writeFile2, realpath, stat, lstat, mkdir, readlink, unlink, readdir, chmod, rename as rename2, rmdir, link } from "node:fs/promises";
3732
3732
  import net from "node:net";
3733
3733
  import os from "node:os";
3734
3734
  import path2 from "node:path";
@@ -3761,14 +3761,14 @@ var PATTERNS = [
3761
3761
  // --token value, --api-key value
3762
3762
  [/(--[\w-]*(?:key|token|secret|passw(?:or)?d|credential)[\w-]*\s+)[^\s-][^\s]*/gi, `$1${REDACTED}`]
3763
3763
  ];
3764
- function secretValues(env) {
3764
+ function secretValues(env2) {
3765
3765
  const values = /* @__PURE__ */ new Set();
3766
- for (const [name2, value] of Object.entries(env ?? {})) if (typeof value === "string" && value.length >= 8 && SECRET_NAME.test(name2)) values.add(value);
3766
+ for (const [name2, value] of Object.entries(env2 ?? {})) if (typeof value === "string" && value.length >= 8 && SECRET_NAME.test(name2)) values.add(value);
3767
3767
  return [...values].sort((a, b) => b.length - a.length);
3768
3768
  }
3769
- function scrubText(text, { env = process.env, max = MAX_STRING } = {}) {
3769
+ function scrubText(text, { env: env2 = process.env, max = MAX_STRING } = {}) {
3770
3770
  let result = String(text);
3771
- for (const value of secretValues(env)) result = result.split(value).join(REDACTED);
3771
+ for (const value of secretValues(env2)) result = result.split(value).join(REDACTED);
3772
3772
  for (const [pattern, replacement] of PATTERNS) result = result.replace(pattern, replacement);
3773
3773
  return result.length > max ? `${result.slice(0, max)}... (${result.length - max} more characters)` : result;
3774
3774
  }
@@ -3810,9 +3810,9 @@ var stderrSink = (line) => {
3810
3810
  } catch {
3811
3811
  }
3812
3812
  };
3813
- function createLogger({ component, level, context = {}, write = stderrSink, now = () => /* @__PURE__ */ new Date(), env = process.env } = {}) {
3814
- const threshold = LEVELS[level ?? env.ALP_LOG_LEVEL] ?? LEVELS.info;
3815
- const options = { env };
3813
+ function createLogger({ component, level, context = {}, write = stderrSink, now = () => /* @__PURE__ */ new Date(), env: env2 = process.env } = {}) {
3814
+ const threshold = LEVELS[level ?? env2.ALP_LOG_LEVEL] ?? LEVELS.info;
3815
+ const options = { env: env2 };
3816
3816
  const emit = (name2, message, fields = {}) => {
3817
3817
  if (LEVELS[name2] < threshold) return;
3818
3818
  try {
@@ -3843,7 +3843,7 @@ function createLogger({ component, level, context = {}, write = stderrSink, now
3843
3843
  info: (message, fields) => emit("info", message, fields),
3844
3844
  warn: (message, fields) => emit("warn", message, fields),
3845
3845
  error: (message, fields) => emit("error", message, fields),
3846
- child: (extra = {}, name2 = component) => createLogger({ component: name2, level, context: { ...context, ...extra }, write, now, env })
3846
+ child: (extra = {}, name2 = component) => createLogger({ component: name2, level, context: { ...context, ...extra }, write, now, env: env2 })
3847
3847
  };
3848
3848
  }
3849
3849
  var TAIL_BYTES = 256 * 1024;
@@ -3851,9 +3851,19 @@ var TAIL_BYTES = 256 * 1024;
3851
3851
  // packages/core/src/packaged.js
3852
3852
  import { existsSync, readFileSync, realpathSync } from "node:fs";
3853
3853
  import path from "node:path";
3854
+ var NATIVE = Symbol.for("alp.nativeDaemon");
3855
+ function nativeDaemon() {
3856
+ return (
3857
+ /** @type {any} */
3858
+ globalThis[NATIVE]
3859
+ );
3860
+ }
3861
+ var NATIVE_DAEMON = process.platform === "win32" ? "alpd.exe" : "alpd";
3862
+ var isNativeDaemonName = (file) => /^alpd(\.exe)?$/i.test(file.split(/[\\/]/).pop() ?? "");
3863
+ var isBundleDaemon = (file) => isNativeDaemonName(file) && path.basename(path.dirname(file)) === "bin" && existsSync(path.join(path.dirname(path.dirname(file)), "alp-bundle.json"));
3854
3864
  var ROLE_ARGS = Object.freeze({
3855
3865
  daemon: Object.freeze(["daemon", "run"]),
3856
- web: Object.freeze(["web", "serve"]),
3866
+ dashboard: Object.freeze(["dashboard", "serve"]),
3857
3867
  "bridge-acp": Object.freeze(["bridge", "acp"]),
3858
3868
  "bridge-antigravity": Object.freeze(["bridge", "antigravity"])
3859
3869
  });
@@ -3879,9 +3889,10 @@ function bundleInfo(execPath = process.execPath) {
3879
3889
  let info;
3880
3890
  try {
3881
3891
  const real = realpathSync(execPath);
3892
+ const native = isNativeDaemonName(real) && path.basename(path.dirname(real)) === "bin";
3882
3893
  const nodeDir = path.basename(path.dirname(real)) === "bin" ? path.dirname(path.dirname(real)) : path.dirname(real);
3883
- const root = path.dirname(nodeDir);
3884
- if (path.basename(nodeDir) === "node") {
3894
+ const root = native ? nodeDir : path.dirname(nodeDir);
3895
+ if (native || path.basename(nodeDir) === "node") {
3885
3896
  const manifest = JSON.parse(readFileSync(path.join(root, "alp-bundle.json"), "utf8"));
3886
3897
  if (manifest?.name === "alp" && typeof manifest.version === "string") {
3887
3898
  const app = path.dirname(root);
@@ -3894,6 +3905,13 @@ function bundleInfo(execPath = process.execPath) {
3894
3905
  bundles.set(execPath, info);
3895
3906
  return info;
3896
3907
  }
3908
+ var bundleNode = (bundle) => path.join(bundle.root, "node", process.platform === "win32" ? "node.exe" : "bin/node");
3909
+ var bundleDaemon = (bundle) => path.join(bundle.root, "bin", NATIVE_DAEMON);
3910
+ function nodeExecutable() {
3911
+ if (!nativeDaemon()) return process.execPath;
3912
+ const bundle = bundleInfo();
3913
+ return bundle ? bundleNode(bundle) : "node";
3914
+ }
3897
3915
  function stablePath(file, { bundle = bundleInfo() } = {}) {
3898
3916
  if (!bundle?.current) return file;
3899
3917
  let real;
@@ -3907,14 +3925,232 @@ function stablePath(file, { bundle = bundleInfo() } = {}) {
3907
3925
  return path.join(bundle.current, relative);
3908
3926
  }
3909
3927
  function entryCommand(entry, role, args = [], execPath = process.execPath, { scriptOnly = false } = {}) {
3928
+ if (!scriptOnly && role === "daemon" && isBundleDaemon(entry)) return { command: entry, args: [...args] };
3910
3929
  if (scriptOnly || isScript(entry) || !isExecutableName(entry)) return { command: execPath, args: [entry, ...args] };
3911
3930
  return { command: entry, args: [...roleArgs(role), ...args] };
3912
3931
  }
3913
3932
  function scriptCommand(script, args = []) {
3914
- return { command: process.execPath, args: [script, ...args] };
3933
+ return { command: nodeExecutable(), args: [script, ...args] };
3934
+ }
3935
+ function daemonEntry(script, { bundle = bundleInfo(), env: env2 = process.env } = {}) {
3936
+ const native = bundle && env2.ALP_NATIVE_DAEMON !== "0" ? bundleDaemon(bundle) : void 0;
3937
+ return stablePath(native && existsSync(native) ? native : script, { bundle });
3938
+ }
3939
+
3940
+ // packages/core/src/atomic.js
3941
+ import { rename, rm, writeFile } from "node:fs/promises";
3942
+ async function moveFile(from, to) {
3943
+ for (let attempt = 0; ; attempt++) {
3944
+ try {
3945
+ return await rename(from, to);
3946
+ } catch (error) {
3947
+ if (process.platform !== "win32" || attempt >= 20 || !["EPERM", "EACCES", "EBUSY"].includes(error?.code)) throw error;
3948
+ await new Promise((resolve2) => setTimeout(resolve2, 10 + attempt * 10));
3949
+ }
3950
+ }
3951
+ }
3952
+
3953
+ // packages/core/src/errors.js
3954
+ var AlpError = class extends Error {
3955
+ constructor(code, message, options) {
3956
+ super(message, options);
3957
+ this.name = "AlpError";
3958
+ this.code = code;
3959
+ }
3960
+ };
3961
+
3962
+ // packages/core/src/models.js
3963
+ var codexFull = ["low", "medium", "high", "xhigh", "max", "ultra"];
3964
+ var codexStandard = ["low", "medium", "high", "xhigh", "max"];
3965
+ var claudeFull = ["low", "medium", "high", "xhigh", "max", "ultracode"];
3966
+ var claudeLegacy = ["off", "low", "medium", "high", "xhigh", "max", "ultracode"];
3967
+ var claude46 = ["off", "low", "medium", "high", "max"];
3968
+ var MODELS = [
3969
+ ["codex", "gpt-6.1-sol", "GPT-6.1-Sol", "Latest workhorse model for coding and everyday work.", codexFull, "low"],
3970
+ // ALP runs GPT-6 Astra at low effort only.
3971
+ ["codex", "gpt-6-astra", "GPT-6-Astra", "Frontier intelligence for the most demanding work.", ["low"], "low"],
3972
+ ["codex", "gpt-6-sol", "GPT-6-Sol", "Previous generation workhorse model.", codexFull, "low"],
3973
+ ["codex", "gpt-6-luna", "GPT-6-Luna", "Fast and affordable model for easier tasks.", codexStandard, "low"],
3974
+ ["codex", "gpt-5.6-sol", "GPT-5.6-Sol", "Older generation workhorse model.", codexFull, "low"],
3975
+ ["codex", "gpt-5.6-terra", "GPT-5.6-Terra", "Older balanced model for straightforward work.", codexFull, "low"],
3976
+ ["codex", "gpt-5.6-luna", "GPT-5.6-Luna", "Older fast and efficient model.", codexStandard, "low"],
3977
+ ["claude", "claude-opus-5-5", "Opus 5.5", "Latest release.", claudeFull, "medium"],
3978
+ ["claude", "claude-opus-5", "Opus 5", "Previous release.", claudeLegacy, "high"],
3979
+ ["claude", "claude-fable-5-1", "Fable 5.1", "Most powerful model.", claudeFull, "high"],
3980
+ ["claude", "claude-fable-5", "Fable 5", "Previous release.", claudeFull, "high"],
3981
+ ["claude", "claude-opus-4-8[1m]", "Opus 4.8 1M", "Opus 4.8 with 1M context window.", claudeLegacy, "high"],
3982
+ ["claude", "claude-opus-4-8", "Opus 4.8", "Previous release.", claudeLegacy, "high"],
3983
+ ["claude", "claude-sonnet-5-5", "Sonnet 5.5", "Best for everyday tasks.", claudeFull, "medium"],
3984
+ ["claude", "claude-sonnet-5", "Sonnet 5", "Previous release.", claudeLegacy, "high"],
3985
+ ["claude", "claude-sonnet-5[1m]", "Sonnet 5 1M", "Sonnet 5 with 1M context window.", claudeLegacy, "high"],
3986
+ ["claude", "claude-opus-4-7[1m]", "Opus 4.7 1M", "Opus 4.7 with 1M context window.", claudeLegacy, "high"],
3987
+ ["claude", "claude-opus-4-7", "Opus 4.7", "Previous release.", claudeLegacy, "high"],
3988
+ ["claude", "claude-opus-4-6[1m]", "Opus 4.6 1M", "Opus 4.6 with 1M context window.", claude46, "high"],
3989
+ ["claude", "claude-opus-4-6", "Opus 4.6", "Most capable for complex work.", claude46, "high"],
3990
+ ["claude", "claude-sonnet-4-6[1m]", "Sonnet 4.6 1M", "Sonnet 4.6 with 1M context window.", claude46, "high"],
3991
+ ["claude", "claude-sonnet-4-6", "Sonnet 4.6", "Best for everyday tasks.", claude46, "high"],
3992
+ ["claude", "claude-haiku-4-5", "Haiku 4.5", "Fastest for quick answers.", [], void 0],
3993
+ ["claude", "sonnet", "sonnet", "From Claude settings.json model.", [], void 0],
3994
+ ["antigravity", "gemini-3.8-flash-high", "Gemini 3.8 Flash (High)", "High reasoning effort workhorse for complex tasks.", [], void 0],
3995
+ ["antigravity", "gemini-3.8-flash-medium", "Gemini 3.8 Flash (Medium)", "Balanced speed and reasoning.", [], void 0],
3996
+ ["antigravity", "gemini-3.8-flash-low", "Gemini 3.8 Flash (Low)", "Fast and efficient for straightforward work.", [], void 0],
3997
+ ["antigravity", "gemini-2.5-pro", "Gemini 2.5 Pro", "Deep reasoning for coding and analysis.", [], void 0],
3998
+ ["antigravity", "gemini-2.5-flash", "Gemini 2.5 Flash", "Fast and versatile everyday model.", [], void 0],
3999
+ ["antigravity", "claude-sonnet-4-6", "Claude Sonnet 4.6", "Sonnet 4.6 via Antigravity.", [], void 0],
4000
+ ["antigravity", "claude-opus-4-6-thinking", "Claude Opus 4.6 Thinking", "Opus 4.6 with thinking via Antigravity.", [], void 0],
4001
+ ["antigravity", "gpt-oss-120b-medium", "GPT-OSS 120B (Medium)", "Open weights model via Antigravity.", [], void 0]
4002
+ ].map(([runtime, id, label, description, efforts, effort]) => ({ runtime, id, label, description, efforts, ...effort ? { effort } : {} }));
4003
+
4004
+ // packages/core/src/permissions.js
4005
+ var BASES = ["read-only", "workspace-write", "full-access"];
4006
+ var MAX_RULES = 200;
4007
+ var NAME = /^[\w.-]{1,64}$/;
4008
+ var RULE = /^([A-Za-z][\w-]*)(?:\((.*)\))?$/s;
4009
+ var TOOLS = ["Bash", "Read", "Edit", "Write", "MultiEdit", "NotebookEdit", "Glob", "Grep", "WebFetch", "WebSearch", "Skill"];
4010
+ var setOwn = (value, key2, entry) => Object.defineProperty(value, key2, { value: entry, enumerable: true, writable: true, configurable: true });
4011
+ var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
4012
+ var fail = (source, message) => {
4013
+ throw new AlpError("INVALID_SETTINGS", `${source}: ${message}`);
4014
+ };
4015
+ function parseRule(rule, source = "rule") {
4016
+ if (typeof rule !== "string" || rule.length > 500) fail(source, "a rule is text of at most 500 characters");
4017
+ const match = RULE.exec(rule.trim());
4018
+ if (!match) fail(source, `${JSON.stringify(rule)} is not Tool or Tool(specifier)`);
4019
+ const [, tool, specifier] = match;
4020
+ if (!TOOLS.includes(tool) && !/^mcp__[\w-]+(__[\w-]+)?$/.test(tool)) fail(source, `${JSON.stringify(rule)} names unknown tool ${tool}; use ${TOOLS.join(", ")} or mcp__<server>__<tool>`);
4021
+ if (specifier !== void 0 && !specifier.trim()) fail(source, `${JSON.stringify(rule)} has an empty specifier`);
4022
+ return { tool, ...specifier !== void 0 && specifier.trim() !== "*" ? { specifier: specifier.trim() } : {} };
4023
+ }
4024
+ function validatePermissions(value, source) {
4025
+ if (value === void 0) return { profiles: {}, agents: {} };
4026
+ if (!object(value)) fail(source, "permissions must be an object");
4027
+ for (const key2 of Object.keys(value)) if (!["profiles", "agents"].includes(key2)) fail(source, `unsupported permissions field '${key2}'`);
4028
+ const profiles = {};
4029
+ if (value.profiles !== void 0) {
4030
+ if (!object(value.profiles)) fail(source, "permissions.profiles must be an object");
4031
+ for (const [name2, profile] of Object.entries(value.profiles)) {
4032
+ const where = `permissions.profiles.${name2}`;
4033
+ if (!NAME.test(name2)) fail(source, `${where}: a profile name has letters, digits, dots, dashes and underscores`);
4034
+ if (!object(profile)) fail(source, `${where} must be an object`);
4035
+ for (const key2 of Object.keys(profile)) if (!["base", "allow", "ask", "deny", "beyondMode", "workdir"].includes(key2)) fail(source, `${where}: unsupported field '${key2}'`);
4036
+ if (profile.workdir !== void 0 && profile.workdir !== "copy") fail(source, `${where}.workdir must be copy`);
4037
+ if (profile.workdir === "copy" && profile.base !== void 0 && profile.base !== "read-only") fail(source, `${where}: workdir copy is for read-only profiles; writers use worktree isolation`);
4038
+ if (profile.base !== void 0 && !BASES.includes(profile.base)) fail(source, `${where}.base must be ${BASES.join(", ")}`);
4039
+ if (profile.beyondMode !== void 0 && !["refuse", "ask"].includes(profile.beyondMode)) fail(source, `${where}.beyondMode must be refuse or ask`);
4040
+ const rules = {};
4041
+ for (const kind of ["allow", "ask", "deny"]) {
4042
+ const list = profile[kind] ?? [];
4043
+ if (!Array.isArray(list) || list.length > MAX_RULES) fail(source, `${where}.${kind} must list at most ${MAX_RULES} rules`);
4044
+ for (const rule of list) parseRule(rule, `${source}: ${where}.${kind}`);
4045
+ rules[kind] = list.map((rule) => rule.trim());
4046
+ }
4047
+ setOwn(profiles, name2, { ...profile.base ? { base: profile.base } : {}, ...profile.beyondMode ? { beyondMode: profile.beyondMode } : {}, ...profile.workdir ? { workdir: profile.workdir } : {}, ...rules });
4048
+ }
4049
+ }
4050
+ const agents = {};
4051
+ if (value.agents !== void 0) {
4052
+ if (!object(value.agents)) fail(source, "permissions.agents must be an object");
4053
+ for (const [agent, profile] of Object.entries(value.agents)) {
4054
+ if (typeof profile !== "string" || !NAME.test(profile)) fail(source, `permissions.agents.${agent} must name a profile`);
4055
+ setOwn(agents, agent, profile);
4056
+ }
4057
+ }
4058
+ return { profiles, agents };
3915
4059
  }
3916
- function selfEntry(script) {
3917
- return stablePath(script);
4060
+
4061
+ // packages/core/src/validation.js
4062
+ var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
4063
+ var nonempty = (value) => typeof value === "string" && value.trim().length > 0;
4064
+ function requireValue(condition, code, source, message) {
4065
+ if (!condition) throw new AlpError(code, `${source}: ${message}`);
4066
+ }
4067
+ var USER_SETTINGS = ["$schema", "language", "permissions", "limits", "recovery", "dashboard", "web", "curate"];
4068
+ var DASHBOARD_SETTINGS = Object.freeze(["enabled", "port", "permissions"]);
4069
+ var RETIRED_SETTINGS = { project: {}, user: {} };
4070
+ function distance(a, b) {
4071
+ const row = Array.from({ length: b.length + 1 }, (_, index) => index);
4072
+ for (let i = 1; i <= a.length; i++) {
4073
+ let previous = row[0];
4074
+ row[0] = i;
4075
+ for (let j = 1; j <= b.length; j++) {
4076
+ const kept = row[j];
4077
+ row[j] = Math.min(row[j] + 1, row[j - 1] + 1, previous + (a[i - 1].toLowerCase() === b[j - 1].toLowerCase() ? 0 : 1));
4078
+ previous = kept;
4079
+ }
4080
+ }
4081
+ return row[b.length];
4082
+ }
4083
+ function settingsKeys(settings, known, retired = {}) {
4084
+ const unknown = [];
4085
+ const old = [];
4086
+ for (const key2 of Object.keys(object2(settings) ? settings : {})) {
4087
+ if (known.includes(key2)) continue;
4088
+ if (Object.hasOwn(retired, key2)) {
4089
+ old.push({ key: key2, instead: retired[key2] });
4090
+ continue;
4091
+ }
4092
+ const near = known.filter((candidate) => !candidate.startsWith("$")).map((candidate) => ({ candidate, d: distance(key2, candidate) })).sort((a, b) => a.d - b.d)[0];
4093
+ unknown.push({ key: key2, ...near && near.d <= 2 ? { suggestion: near.candidate } : {} });
4094
+ }
4095
+ return { unknown, retired: old };
4096
+ }
4097
+ var unknownMessage = (unknown, known) => `unknown setting '${unknown.key}'${unknown.suggestion ? `; did you mean '${unknown.suggestion}'?` : `; known settings are ${known.filter((key2) => !key2.startsWith("$")).join(", ")}`}`;
4098
+ function checkCurate(settings, check2) {
4099
+ if (settings.curate === void 0) return;
4100
+ check2(object2(settings.curate), "curate must be an object");
4101
+ check2(Object.keys(settings.curate).every((key2) => key2 === "monthly"), "unsupported curate field; use monthly");
4102
+ if (settings.curate.monthly !== void 0) check2(typeof settings.curate.monthly === "boolean", "curate.monthly must be true or false");
4103
+ }
4104
+ function validateUserSettings(settings, source) {
4105
+ const check2 = (ok, message) => requireValue(ok, "INVALID_SETTINGS", source, message);
4106
+ check2(object2(settings), "expected an object");
4107
+ const { unknown } = settingsKeys(settings, USER_SETTINGS, RETIRED_SETTINGS.user);
4108
+ check2(!unknown.length, unknown.length ? unknownMessage(unknown[0], USER_SETTINGS) : "");
4109
+ checkCurate(settings, check2);
4110
+ for (const key2 of ["limits", "recovery"]) {
4111
+ if (settings[key2] === void 0) continue;
4112
+ check2(object2(settings[key2]), `${key2} must be an object`);
4113
+ const extra = Object.keys(settings[key2]).find((field) => field !== "autoResume");
4114
+ check2(!extra, `unsupported ${key2} field '${extra}'; use autoResume`);
4115
+ if (settings[key2].autoResume !== void 0) check2(typeof settings[key2].autoResume === "boolean", `${key2}.autoResume must be true or false`);
4116
+ }
4117
+ for (const key2 of ["dashboard", "web"]) {
4118
+ const section = settings[key2];
4119
+ if (section === void 0) continue;
4120
+ check2(object2(section), `${key2} must be an object`);
4121
+ const allowed = key2 === "web" ? [...DASHBOARD_SETTINGS, "relay"] : DASHBOARD_SETTINGS;
4122
+ const extra = Object.keys(section).find((field) => !allowed.includes(field));
4123
+ check2(!extra, `unsupported ${key2} field '${extra}'; use ${allowed.slice(0, -1).join(", ")} or ${allowed.at(-1)}`);
4124
+ if (section.permissions !== void 0) check2(Array.isArray(section.permissions) && section.permissions.every((entry) => typeof entry === "string" && /^[a-z][a-z.]*$/.test(entry)), `${key2}.permissions must be a list of permission names, such as files.read`);
4125
+ if (section.enabled !== void 0) check2(typeof section.enabled === "boolean", `${key2}.enabled must be true or false`);
4126
+ if (section.port !== void 0) check2(Number.isInteger(section.port) && section.port >= 1024 && section.port <= 65535, `${key2}.port must be a port from 1024 to 65535`);
4127
+ }
4128
+ if (settings.web !== void 0) {
4129
+ const relay = settings.web.relay;
4130
+ if (relay !== void 0) {
4131
+ check2(object2(relay), "web.relay must be an object");
4132
+ const unsupported = Object.keys(relay).find((field) => !["enabled", "endpoint", "useTls"].includes(field));
4133
+ check2(!unsupported, `unsupported web.relay field '${unsupported}'; use enabled, endpoint or useTls`);
4134
+ if (relay.enabled !== void 0) check2(typeof relay.enabled === "boolean", "web.relay.enabled must be true or false");
4135
+ if (relay.endpoint !== void 0) check2(typeof relay.endpoint === "string" && /^[a-z0-9.-]+:\d{1,5}$/i.test(relay.endpoint), "web.relay.endpoint must be host:port, such as relay.paseo.sh:443");
4136
+ if (relay.useTls !== void 0) check2(typeof relay.useTls === "boolean", "web.relay.useTls must be true or false");
4137
+ }
4138
+ }
4139
+ if (settings.language !== void 0) check2(nonempty(settings.language) && settings.language.trim().length <= 40, "language must be a language name of at most 40 characters, such as Vietnamese or English");
4140
+ validatePermissions(settings.permissions, source);
4141
+ return settings;
4142
+ }
4143
+
4144
+ // packages/core/src/user-settings.js
4145
+ function dashboardSettings(settings) {
4146
+ const now = settings?.dashboard ?? {};
4147
+ const before = settings?.web ?? {};
4148
+ const result = {};
4149
+ for (const key2 of DASHBOARD_SETTINGS) {
4150
+ const value = now[key2] !== void 0 ? now[key2] : before[key2];
4151
+ if (value !== void 0) result[key2] = value;
4152
+ }
4153
+ return result;
3918
4154
  }
3919
4155
 
3920
4156
  // packages/protocol/src/wire.js
@@ -3963,6 +4199,7 @@ var TERMINAL = Object.freeze({
3963
4199
  maxRows: 200
3964
4200
  });
3965
4201
  var TERMINAL_LIMIT_KEYS = Object.freeze(["maxPerPrincipal", "maxPerDaemon", "maxInputBytes", "maxOutputFrameBytes", "replayBytes", "idleMs", "maxLifetimeMs", "reconnectMs"]);
4202
+ var AGENT_NAME = /^[a-z](?:[a-z0-9]|-(?=[a-z0-9])){0,63}$/;
3966
4203
  var isTerminalId = (id) => typeof id === "string" && /^term_[0-9a-f]{32}$/.test(id);
3967
4204
  var ATTACHMENT_CHUNK_OVERHEAD = 64 * 1024;
3968
4205
  function attachmentChunkBytes(maxFrame = MAX_FRAME, maxChunkBytes = ATTACHMENTS.maxChunkBytes) {
@@ -4693,8 +4930,8 @@ function createReconnectingClient({ connect: connect2, onConnect, onDisconnect,
4693
4930
  var CLOSE_CODE = Object.freeze({ unsupportedData: 4003, tooLarge: 4009 });
4694
4931
 
4695
4932
  // packages/client/src/index.js
4696
- function alpHome(env = process.env) {
4697
- return path2.resolve(env.ALP_HOME || path2.join(os.homedir(), ".alp"));
4933
+ function alpHome(env2 = process.env) {
4934
+ return path2.resolve(env2.ALP_HOME || path2.join(os.homedir(), ".alp"));
4698
4935
  }
4699
4936
  function daemonPaths(home) {
4700
4937
  const preferred = path2.join(home, "alpd.sock");
@@ -4740,11 +4977,21 @@ async function assertSafeAncestors(directory) {
4740
4977
  async function assertPrivateDirectory(directory, { create = false } = {}) {
4741
4978
  await assertSafeAncestors(directory);
4742
4979
  if (create) await mkdir(directory, { recursive: true, mode: 448 });
4743
- const info = await lstat(directory);
4980
+ let info = await lstat(directory);
4744
4981
  if (!info.isDirectory() || info.isSymbolicLink()) throw new Error("IPC requires a private directory, not a symlink");
4745
- if (process.platform !== "win32" && (info.uid !== process.getuid?.() || (info.mode & 63) !== 0)) {
4746
- throw new Error("IPC directory must be owned by the current user with private permissions (0700)");
4982
+ if (process.platform === "win32") return;
4983
+ const shown = JSON.stringify(directory);
4984
+ const mine = (entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.uid === process.getuid?.();
4985
+ if (info.uid !== process.getuid?.()) throw new Error(`IPC directory ${shown} must be owned by the current user (it belongs to uid ${info.uid}); use a directory of your own`);
4986
+ if ((info.mode & 63) === 0) return;
4987
+ if (create && (await readdir(directory)).length === 0) {
4988
+ await chmod(directory, 448).catch(() => {
4989
+ });
4747
4990
  }
4991
+ info = await lstat(directory);
4992
+ if (mine(info) && (info.mode & 63) === 0) return;
4993
+ const quoted = `'${directory.replaceAll("'", "'\\''")}'`;
4994
+ throw new Error(`IPC directory ${shown} must have private permissions (0700), not ${(info.mode & 511).toString(8).padStart(4, "0")}; fix it with: chmod 700 ${quoted}`);
4748
4995
  }
4749
4996
  async function assertPrivateSocket(socketPath) {
4750
4997
  if (process.platform === "win32") return;
@@ -4758,17 +5005,27 @@ async function assertPrivateSocket(socketPath) {
4758
5005
  var isFile = (file) => stat(file).then((info) => info.isFile(), () => false);
4759
5006
  var BIN_DIRECTORIES = [path2.join(os.homedir(), ".alp", "bin"), path2.join(os.homedir(), ".npm-global", "bin"), path2.join(os.homedir(), ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"];
4760
5007
  var CLI_PACKAGES = ["@anhlp/alp", "@anhlp/alp-cli"];
4761
- async function cliDaemonEntry(cli) {
5008
+ async function cliDaemonEntry(cli, depth = 0, env2 = process.env) {
4762
5009
  const base = path2.basename(cli).toLowerCase();
4763
5010
  const root = path2.resolve(path2.dirname(cli), "..");
4764
5011
  const alpd = (directory) => path2.join(directory, "dist", "alpd.js");
4765
5012
  const named = async (directory) => readFile(path2.join(directory, "package.json"), "utf8").then((text) => JSON.parse(text)?.name).catch(() => void 0);
4766
5013
  let candidates = [];
5014
+ if (base === "alp.cmd" && depth < 1 && !await isFile(path2.join(root, "alp-bundle.json"))) {
5015
+ const text = await stat(cli).then((info) => info.size <= 64 * 1024 ? readFile(cli, "utf8") : "", () => "");
5016
+ for (const [, quoted] of text.matchAll(/"([^"\r\n]+\.js)"/gi)) {
5017
+ const script = quoted.replace(/^%~?dp0%?[\\/]?/i, `${path2.dirname(cli)}${path2.sep}`);
5018
+ const entry = path2.isAbsolute(script) && await isFile(script) ? await cliDaemonEntry(script, depth + 1, env2) : void 0;
5019
+ if (entry) return entry;
5020
+ }
5021
+ return void 0;
5022
+ }
4767
5023
  if (base === "alp" || base === "alp.cmd") {
4768
5024
  if (!await isFile(path2.join(root, "alp-bundle.json"))) return void 0;
4769
5025
  const current = path2.join(path2.dirname(root), "current");
4770
5026
  const viaCurrent = await realpath(current).then((real) => real === root, () => false);
4771
- candidates = [alpd(path2.join(viaCurrent ? current : root, "lib", "node_modules", "@anhlp", "alp-cli"))];
5027
+ const bundle = viaCurrent ? current : root;
5028
+ candidates = [...env2.ALP_NATIVE_DAEMON === "0" ? [] : [path2.join(bundle, "bin", NATIVE_DAEMON)], alpd(path2.join(bundle, "lib", "node_modules", "@anhlp", "alp-cli"))];
4772
5029
  } else if (base === "cli.js" && CLI_PACKAGES.includes(await named(root))) {
4773
5030
  candidates = [alpd(root)];
4774
5031
  } else if (base === "alp.js" && await named(root) === "@anhlp/alp") {
@@ -4777,20 +5034,20 @@ async function cliDaemonEntry(cli) {
4777
5034
  for (const candidate of candidates) if (await isFile(candidate)) return candidate;
4778
5035
  return void 0;
4779
5036
  }
4780
- async function findDaemonEntry({ home = alpHome(), env = process.env, candidates = (
5037
+ async function findDaemonEntry({ home = alpHome(), env: env2 = process.env, candidates = (
4781
5038
  /** @type {Array<string | undefined>} */
4782
5039
  []
4783
- ) } = {}) {
5040
+ ), binDirectories = BIN_DIRECTORIES } = {}) {
4784
5041
  for (const candidate of candidates) if (candidate && await isFile(candidate)) return candidate;
4785
5042
  try {
4786
5043
  const { entry } = JSON.parse(await readFile(daemonPaths(home).install, "utf8"));
4787
5044
  if (typeof entry === "string" && await isFile(entry)) return entry;
4788
5045
  } catch {
4789
5046
  }
4790
- for (const directory of [...(env.PATH ?? "").split(path2.delimiter).filter(Boolean), ...BIN_DIRECTORIES]) {
5047
+ for (const directory of [...(env2.PATH ?? "").split(path2.delimiter).filter(Boolean), ...binDirectories]) {
4791
5048
  for (const name2 of process.platform === "win32" ? ["alp.cmd", "alp"] : ["alp"]) {
4792
5049
  const cli = await realpath(path2.join(directory, name2)).catch(() => void 0);
4793
- const entry = cli && await cliDaemonEntry(cli);
5050
+ const entry = cli && await cliDaemonEntry(cli, 0, env2);
4794
5051
  if (entry) return entry;
4795
5052
  }
4796
5053
  }
@@ -4960,7 +5217,7 @@ async function withDaemonLifecycle(home, action, run2, { joinStart = false, sign
4960
5217
  const token = `owner-${process.pid}-${bootTime()}-${action}-${randomUUID()}`;
4961
5218
  const candidate = path2.join(state, `alpd.starting-${token}`);
4962
5219
  await mkdir(candidate, { mode: 448 });
4963
- await writeFile(path2.join(candidate, token), JSON.stringify({
5220
+ await writeFile2(path2.join(candidate, token), JSON.stringify({
4964
5221
  pid: process.pid,
4965
5222
  bootTime: bootTime(),
4966
5223
  ...currentBootId ? { bootId: currentBootId } : {},
@@ -4983,7 +5240,7 @@ async function withDaemonLifecycle(home, action, run2, { joinStart = false, sign
4983
5240
  while (!joined) {
4984
5241
  signal?.throwIfAborted();
4985
5242
  try {
4986
- await rename(candidate, directory);
5243
+ await rename2(candidate, directory);
4987
5244
  break;
4988
5245
  } catch (error) {
4989
5246
  if (!["EEXIST", "ENOTEMPTY", "EPERM", "EACCES"].includes(error.code)) throw error;
@@ -5016,15 +5273,23 @@ async function withDaemonLifecycle(home, action, run2, { joinStart = false, sign
5016
5273
  });
5017
5274
  }
5018
5275
  }
5276
+ var DAEMON_START_TIMEOUT_MS = 6e4;
5277
+ var DAEMON_START_TIMEOUT_MAX_MS = 36e5;
5278
+ function daemonStartTimeoutMs(env2 = process.env) {
5279
+ const raw = env2.ALP_DAEMON_START_TIMEOUT_MS?.trim();
5280
+ if (!raw || !/^[0-9]+$/.test(raw)) return DAEMON_START_TIMEOUT_MS;
5281
+ const value = Number(raw);
5282
+ return value > 0 && value <= DAEMON_START_TIMEOUT_MAX_MS ? value : DAEMON_START_TIMEOUT_MS;
5283
+ }
5019
5284
  async function ensureDaemon({ home = alpHome(), entry = (
5020
5285
  /** @type {string | undefined} */
5021
5286
  void 0
5022
- ), env = process.env, execPath = process.execPath, timeoutMs = 15e3, lifecycleLocked = false, signal = (
5287
+ ), env: env2 = process.env, execPath = process.execPath, timeoutMs = daemonStartTimeoutMs(env2), lifecycleLocked = false, signal = (
5023
5288
  /** @type {AbortSignal | undefined} */
5024
5289
  void 0
5025
5290
  ) } = {}) {
5026
5291
  signal?.throwIfAborted();
5027
- if (!lifecycleLocked) return withDaemonLifecycle(home, "start", () => ensureDaemon({ home, entry, env, execPath, timeoutMs, lifecycleLocked: true, signal }), { signal });
5292
+ if (!lifecycleLocked) return withDaemonLifecycle(home, "start", () => ensureDaemon({ home, entry, env: env2, execPath, timeoutMs, lifecycleLocked: true, signal }), { signal });
5028
5293
  const ready = async () => {
5029
5294
  const lock = await readLock(home);
5030
5295
  return lockAlive(lock) && lock.ready ? lock.socket : void 0;
@@ -5034,13 +5299,15 @@ async function ensureDaemon({ home = alpHome(), entry = (
5034
5299
  const held = await readLock(home);
5035
5300
  if (lockAlive(held) && held.maintenance) throw new Error(`ALP is busy: alp ${held.maintenance} runs (pid ${held.pid}); alpd starts again when it finishes`);
5036
5301
  if (!lockAlive(held)) {
5037
- entry ??= await findDaemonEntry({ home, env });
5302
+ entry ??= await findDaemonEntry({ home, env: env2 });
5038
5303
  if (!entry) throw new Error("ALP daemon is not running and alpd.js was not found. Install the ALP CLI and run `alp daemon start`, or set ALP_DAEMON_ENTRY to alpd.js");
5039
5304
  signal?.throwIfAborted();
5040
5305
  await new Promise((resolve2, reject) => {
5041
5306
  const launch = entryCommand(entry, "daemon", ["--detach", `--startup-timeout=${timeoutMs}`], execPath);
5307
+ const launchEnv = { ...env2, ALP_HOME: home, ELECTRON_RUN_AS_NODE: "1" };
5308
+ if (isNativeDaemonName(launch.command)) delete launchEnv.BUN_BE_BUN;
5042
5309
  const launcher = spawn(launch.command, launch.args, {
5043
- env: { ...env, ALP_HOME: home, ELECTRON_RUN_AS_NODE: "1" },
5310
+ env: launchEnv,
5044
5311
  stdio: ["ignore", "ignore", "pipe"],
5045
5312
  windowsHide: true
5046
5313
  });
@@ -5069,21 +5336,6 @@ import { randomUUID as randomUUID2 } from "node:crypto";
5069
5336
  import { mkdir as mkdir2, open as open2, rmdir as rmdir2, unlink as unlink2 } from "node:fs/promises";
5070
5337
  import os2 from "node:os";
5071
5338
  import path3 from "node:path";
5072
-
5073
- // packages/core/src/atomic.js
5074
- import { rename as rename2, rm, writeFile as writeFile2 } from "node:fs/promises";
5075
- async function moveFile(from, to) {
5076
- for (let attempt = 0; ; attempt++) {
5077
- try {
5078
- return await rename2(from, to);
5079
- } catch (error) {
5080
- if (process.platform !== "win32" || attempt >= 20 || !["EPERM", "EACCES", "EBUSY"].includes(error?.code)) throw error;
5081
- await new Promise((resolve2) => setTimeout(resolve2, 10 + attempt * 10));
5082
- }
5083
- }
5084
- }
5085
-
5086
- // packages/client/src/integration-lock.js
5087
5339
  function createIntegrationLock(home, name2) {
5088
5340
  const file = path3.join(home, "integrations", `${assertIntegrationName(name2)}.lock`);
5089
5341
  const guard = `${file}.reclaim`;
@@ -5286,13 +5538,13 @@ import path4 from "node:path";
5286
5538
 
5287
5539
  // packages/client/src/command.js
5288
5540
  import { spawn as spawn2 } from "node:child_process";
5289
- function runCommand(command, args, { cwd, env = process.env, timeoutMs = 15e3 } = {}) {
5541
+ function runCommand(command, args, { cwd, env: env2 = process.env, timeoutMs = 15e3 } = {}) {
5290
5542
  return new Promise((resolve2) => {
5291
5543
  let child;
5292
5544
  const script = process.platform === "win32" && /\.[cm]?js$/i.test(command);
5293
5545
  const run2 = script ? scriptCommand(command, args) : { command, args };
5294
5546
  try {
5295
- child = spawn2(run2.command, run2.args, { cwd, env: run2.env ? { ...env, ...run2.env } : env, stdio: ["ignore", "pipe", "pipe"] });
5547
+ child = spawn2(run2.command, run2.args, { cwd, env: run2.env ? { ...env2, ...run2.env } : env2, stdio: ["ignore", "pipe", "pipe"] });
5296
5548
  } catch (error) {
5297
5549
  resolve2({ code: -1, stdout: "", stderr: error.message });
5298
5550
  return;
@@ -5317,13 +5569,13 @@ function runCommand(command, args, { cwd, env = process.env, timeoutMs = 15e3 }
5317
5569
  }
5318
5570
 
5319
5571
  // packages/client/src/service.js
5320
- function serviceFor({ home, env = process.env, platform = process.platform, uid = process.getuid?.() ?? 0 }) {
5572
+ function serviceFor({ home, env: env2 = process.env, platform = process.platform, uid = process.getuid?.() ?? 0 }) {
5321
5573
  const custom = path4.resolve(home) !== path4.join(os3.homedir(), ".alp");
5322
5574
  const suffix = custom ? createHash2("sha256").update(path4.resolve(home)).digest("hex").slice(0, 8) : "";
5323
5575
  if (platform === "darwin") {
5324
5576
  const label = `com.alp.alpd${suffix ? `.${suffix}` : ""}`;
5325
- const directory = env.ALP_SERVICE_DIR || path4.join(os3.homedir(), "Library", "LaunchAgents");
5326
- const launchctl = env.ALP_LAUNCHCTL || "launchctl";
5577
+ const directory = env2.ALP_SERVICE_DIR || path4.join(os3.homedir(), "Library", "LaunchAgents");
5578
+ const launchctl = env2.ALP_LAUNCHCTL || "launchctl";
5327
5579
  const target = `gui/${uid}/${label}`;
5328
5580
  const file = path4.join(directory, `${label}.plist`);
5329
5581
  return {
@@ -5337,8 +5589,8 @@ function serviceFor({ home, env = process.env, platform = process.platform, uid
5337
5589
  }
5338
5590
  if (platform === "linux") {
5339
5591
  const name2 = `alpd${suffix ? `-${suffix}` : ""}`;
5340
- const directory = env.ALP_SERVICE_DIR || path4.join(env.XDG_CONFIG_HOME || path4.join(os3.homedir(), ".config"), "systemd", "user");
5341
- const systemctl = env.ALP_SYSTEMCTL || "systemctl";
5592
+ const directory = env2.ALP_SERVICE_DIR || path4.join(env2.XDG_CONFIG_HOME || path4.join(os3.homedir(), ".config"), "systemd", "user");
5593
+ const systemctl = env2.ALP_SYSTEMCTL || "systemctl";
5342
5594
  return {
5343
5595
  kind: "systemd",
5344
5596
  name: name2,
@@ -5391,7 +5643,7 @@ async function whenReady(home, timeoutMs, signal) {
5391
5643
  }
5392
5644
  throw new Error(`alpd did not become ready within ${timeoutMs / 1e3} s; see ${path5.join(home, "logs")}`);
5393
5645
  }
5394
- async function startDaemon({ home, entry, env = process.env, timeoutMs = 15e3, automatic = false, signal }) {
5646
+ async function startDaemon({ home, entry, env: env2 = process.env, timeoutMs = daemonStartTimeoutMs(env2), automatic = false, signal }) {
5395
5647
  return withDaemonLifecycle(home, "start", async () => {
5396
5648
  signal?.throwIfAborted();
5397
5649
  if (automatic) {
@@ -5400,22 +5652,22 @@ async function startDaemon({ home, entry, env = process.env, timeoutMs = 15e3, a
5400
5652
  const lock = await readLock(home);
5401
5653
  signal?.throwIfAborted();
5402
5654
  if (lockAlive(lock)) return lock.ready ? lock.socket : whenReady(home, timeoutMs, signal);
5403
- const service = serviceFor({ home, env });
5655
+ const service = serviceFor({ home, env: env2 });
5404
5656
  if (service && await installedProgram(service)) {
5405
5657
  signal?.throwIfAborted();
5406
5658
  await startService(service);
5407
5659
  return whenReady(home, timeoutMs, signal);
5408
5660
  }
5409
- return ensureDaemon({ home, entry, env, timeoutMs, lifecycleLocked: true, signal });
5661
+ return ensureDaemon({ home, entry, env: env2, timeoutMs, lifecycleLocked: true, signal });
5410
5662
  }, { signal });
5411
5663
  }
5412
- function superviseDaemon({ home, entry, env = process.env, intervalMs = 5e3, misses = 2, log = () => {
5664
+ function superviseDaemon({ home, entry, env: env2 = process.env, intervalMs = 5e3, misses = 2, log = () => {
5413
5665
  }, by }) {
5414
5666
  let stopped = false;
5415
5667
  let missed = 0;
5416
5668
  let starting;
5417
5669
  const start = (reason, automatic = true) => {
5418
- starting ??= startDaemon({ home, entry: typeof entry === "function" ? entry() : entry, env, automatic }).then((socket) => {
5670
+ starting ??= startDaemon({ home, entry: typeof entry === "function" ? entry() : entry, env: env2, automatic }).then((socket) => {
5419
5671
  if (socket) log(`alpd ${reason}`);
5420
5672
  }, (error) => log(`could not start alpd: ${error?.message ?? error}`)).finally(() => {
5421
5673
  starting = void 0;
@@ -5449,191 +5701,6 @@ function superviseDaemon({ home, entry, env = process.env, intervalMs = 5e3, mis
5449
5701
  return stop;
5450
5702
  }
5451
5703
 
5452
- // packages/core/src/errors.js
5453
- var AlpError = class extends Error {
5454
- constructor(code, message, options) {
5455
- super(message, options);
5456
- this.name = "AlpError";
5457
- this.code = code;
5458
- }
5459
- };
5460
-
5461
- // packages/core/src/models.js
5462
- var codexFull = ["low", "medium", "high", "xhigh", "max", "ultra"];
5463
- var codexStandard = ["low", "medium", "high", "xhigh", "max"];
5464
- var claudeFull = ["low", "medium", "high", "xhigh", "max", "ultracode"];
5465
- var claudeLegacy = ["off", "low", "medium", "high", "xhigh", "max", "ultracode"];
5466
- var claude46 = ["off", "low", "medium", "high", "max"];
5467
- var MODELS = [
5468
- ["codex", "gpt-6.1-sol", "GPT-6.1-Sol", "Latest workhorse model for coding and everyday work.", codexFull, "low"],
5469
- // ALP runs GPT-6 Astra at low effort only.
5470
- ["codex", "gpt-6-astra", "GPT-6-Astra", "Frontier intelligence for the most demanding work.", ["low"], "low"],
5471
- ["codex", "gpt-6-sol", "GPT-6-Sol", "Previous generation workhorse model.", codexFull, "low"],
5472
- ["codex", "gpt-6-luna", "GPT-6-Luna", "Fast and affordable model for easier tasks.", codexStandard, "low"],
5473
- ["codex", "gpt-5.6-sol", "GPT-5.6-Sol", "Older generation workhorse model.", codexFull, "low"],
5474
- ["codex", "gpt-5.6-terra", "GPT-5.6-Terra", "Older balanced model for straightforward work.", codexFull, "low"],
5475
- ["codex", "gpt-5.6-luna", "GPT-5.6-Luna", "Older fast and efficient model.", codexStandard, "low"],
5476
- ["claude", "claude-opus-5-5", "Opus 5.5", "Latest release.", claudeFull, "medium"],
5477
- ["claude", "claude-opus-5", "Opus 5", "Previous release.", claudeLegacy, "high"],
5478
- ["claude", "claude-fable-5-1", "Fable 5.1", "Most powerful model.", claudeFull, "high"],
5479
- ["claude", "claude-fable-5", "Fable 5", "Previous release.", claudeFull, "high"],
5480
- ["claude", "claude-opus-4-8[1m]", "Opus 4.8 1M", "Opus 4.8 with 1M context window.", claudeLegacy, "high"],
5481
- ["claude", "claude-opus-4-8", "Opus 4.8", "Previous release.", claudeLegacy, "high"],
5482
- ["claude", "claude-sonnet-5-5", "Sonnet 5.5", "Best for everyday tasks.", claudeFull, "medium"],
5483
- ["claude", "claude-sonnet-5", "Sonnet 5", "Previous release.", claudeLegacy, "high"],
5484
- ["claude", "claude-sonnet-5[1m]", "Sonnet 5 1M", "Sonnet 5 with 1M context window.", claudeLegacy, "high"],
5485
- ["claude", "claude-opus-4-7[1m]", "Opus 4.7 1M", "Opus 4.7 with 1M context window.", claudeLegacy, "high"],
5486
- ["claude", "claude-opus-4-7", "Opus 4.7", "Previous release.", claudeLegacy, "high"],
5487
- ["claude", "claude-opus-4-6[1m]", "Opus 4.6 1M", "Opus 4.6 with 1M context window.", claude46, "high"],
5488
- ["claude", "claude-opus-4-6", "Opus 4.6", "Most capable for complex work.", claude46, "high"],
5489
- ["claude", "claude-sonnet-4-6[1m]", "Sonnet 4.6 1M", "Sonnet 4.6 with 1M context window.", claude46, "high"],
5490
- ["claude", "claude-sonnet-4-6", "Sonnet 4.6", "Best for everyday tasks.", claude46, "high"],
5491
- ["claude", "claude-haiku-4-5", "Haiku 4.5", "Fastest for quick answers.", [], void 0],
5492
- ["claude", "sonnet", "sonnet", "From Claude settings.json model.", [], void 0],
5493
- ["antigravity", "gemini-3.8-flash-high", "Gemini 3.8 Flash (High)", "High reasoning effort workhorse for complex tasks.", [], void 0],
5494
- ["antigravity", "gemini-3.8-flash-medium", "Gemini 3.8 Flash (Medium)", "Balanced speed and reasoning.", [], void 0],
5495
- ["antigravity", "gemini-3.8-flash-low", "Gemini 3.8 Flash (Low)", "Fast and efficient for straightforward work.", [], void 0],
5496
- ["antigravity", "gemini-2.5-pro", "Gemini 2.5 Pro", "Deep reasoning for coding and analysis.", [], void 0],
5497
- ["antigravity", "gemini-2.5-flash", "Gemini 2.5 Flash", "Fast and versatile everyday model.", [], void 0],
5498
- ["antigravity", "claude-sonnet-4-6", "Claude Sonnet 4.6", "Sonnet 4.6 via Antigravity.", [], void 0],
5499
- ["antigravity", "claude-opus-4-6-thinking", "Claude Opus 4.6 Thinking", "Opus 4.6 with thinking via Antigravity.", [], void 0],
5500
- ["antigravity", "gpt-oss-120b-medium", "GPT-OSS 120B (Medium)", "Open weights model via Antigravity.", [], void 0]
5501
- ].map(([runtime, id, label, description, efforts, effort]) => ({ runtime, id, label, description, efforts, ...effort ? { effort } : {} }));
5502
-
5503
- // packages/core/src/permissions.js
5504
- var BASES = ["read-only", "workspace-write", "full-access"];
5505
- var MAX_RULES = 200;
5506
- var NAME = /^[\w.-]{1,64}$/;
5507
- var RULE = /^([A-Za-z][\w-]*)(?:\((.*)\))?$/s;
5508
- var TOOLS = ["Bash", "Read", "Edit", "Write", "MultiEdit", "NotebookEdit", "Glob", "Grep", "WebFetch", "WebSearch", "Skill"];
5509
- var setOwn = (value, key2, entry) => Object.defineProperty(value, key2, { value: entry, enumerable: true, writable: true, configurable: true });
5510
- var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
5511
- var fail = (source, message) => {
5512
- throw new AlpError("INVALID_SETTINGS", `${source}: ${message}`);
5513
- };
5514
- function parseRule(rule, source = "rule") {
5515
- if (typeof rule !== "string" || rule.length > 500) fail(source, "a rule is text of at most 500 characters");
5516
- const match = RULE.exec(rule.trim());
5517
- if (!match) fail(source, `${JSON.stringify(rule)} is not Tool or Tool(specifier)`);
5518
- const [, tool, specifier] = match;
5519
- if (!TOOLS.includes(tool) && !/^mcp__[\w-]+(__[\w-]+)?$/.test(tool)) fail(source, `${JSON.stringify(rule)} names unknown tool ${tool}; use ${TOOLS.join(", ")} or mcp__<server>__<tool>`);
5520
- if (specifier !== void 0 && !specifier.trim()) fail(source, `${JSON.stringify(rule)} has an empty specifier`);
5521
- return { tool, ...specifier !== void 0 && specifier.trim() !== "*" ? { specifier: specifier.trim() } : {} };
5522
- }
5523
- function validatePermissions(value, source) {
5524
- if (value === void 0) return { profiles: {}, agents: {} };
5525
- if (!object(value)) fail(source, "permissions must be an object");
5526
- for (const key2 of Object.keys(value)) if (!["profiles", "agents"].includes(key2)) fail(source, `unsupported permissions field '${key2}'`);
5527
- const profiles = {};
5528
- if (value.profiles !== void 0) {
5529
- if (!object(value.profiles)) fail(source, "permissions.profiles must be an object");
5530
- for (const [name2, profile] of Object.entries(value.profiles)) {
5531
- const where = `permissions.profiles.${name2}`;
5532
- if (!NAME.test(name2)) fail(source, `${where}: a profile name has letters, digits, dots, dashes and underscores`);
5533
- if (!object(profile)) fail(source, `${where} must be an object`);
5534
- for (const key2 of Object.keys(profile)) if (!["base", "allow", "ask", "deny", "beyondMode", "workdir"].includes(key2)) fail(source, `${where}: unsupported field '${key2}'`);
5535
- if (profile.workdir !== void 0 && profile.workdir !== "copy") fail(source, `${where}.workdir must be copy`);
5536
- if (profile.workdir === "copy" && profile.base !== void 0 && profile.base !== "read-only") fail(source, `${where}: workdir copy is for read-only profiles; writers use worktree isolation`);
5537
- if (profile.base !== void 0 && !BASES.includes(profile.base)) fail(source, `${where}.base must be ${BASES.join(", ")}`);
5538
- if (profile.beyondMode !== void 0 && !["refuse", "ask"].includes(profile.beyondMode)) fail(source, `${where}.beyondMode must be refuse or ask`);
5539
- const rules = {};
5540
- for (const kind of ["allow", "ask", "deny"]) {
5541
- const list = profile[kind] ?? [];
5542
- if (!Array.isArray(list) || list.length > MAX_RULES) fail(source, `${where}.${kind} must list at most ${MAX_RULES} rules`);
5543
- for (const rule of list) parseRule(rule, `${source}: ${where}.${kind}`);
5544
- rules[kind] = list.map((rule) => rule.trim());
5545
- }
5546
- setOwn(profiles, name2, { ...profile.base ? { base: profile.base } : {}, ...profile.beyondMode ? { beyondMode: profile.beyondMode } : {}, ...profile.workdir ? { workdir: profile.workdir } : {}, ...rules });
5547
- }
5548
- }
5549
- const agents = {};
5550
- if (value.agents !== void 0) {
5551
- if (!object(value.agents)) fail(source, "permissions.agents must be an object");
5552
- for (const [agent, profile] of Object.entries(value.agents)) {
5553
- if (typeof profile !== "string" || !NAME.test(profile)) fail(source, `permissions.agents.${agent} must name a profile`);
5554
- setOwn(agents, agent, profile);
5555
- }
5556
- }
5557
- return { profiles, agents };
5558
- }
5559
-
5560
- // packages/core/src/validation.js
5561
- var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
5562
- var nonempty = (value) => typeof value === "string" && value.trim().length > 0;
5563
- function requireValue(condition, code, source, message) {
5564
- if (!condition) throw new AlpError(code, `${source}: ${message}`);
5565
- }
5566
- var USER_SETTINGS = ["$schema", "language", "permissions", "limits", "recovery", "web", "curate"];
5567
- var RETIRED_SETTINGS = { project: {}, user: {} };
5568
- function distance(a, b) {
5569
- const row = Array.from({ length: b.length + 1 }, (_, index) => index);
5570
- for (let i = 1; i <= a.length; i++) {
5571
- let previous = row[0];
5572
- row[0] = i;
5573
- for (let j = 1; j <= b.length; j++) {
5574
- const kept = row[j];
5575
- row[j] = Math.min(row[j] + 1, row[j - 1] + 1, previous + (a[i - 1].toLowerCase() === b[j - 1].toLowerCase() ? 0 : 1));
5576
- previous = kept;
5577
- }
5578
- }
5579
- return row[b.length];
5580
- }
5581
- function settingsKeys(settings, known, retired = {}) {
5582
- const unknown = [];
5583
- const old = [];
5584
- for (const key2 of Object.keys(object2(settings) ? settings : {})) {
5585
- if (known.includes(key2)) continue;
5586
- if (Object.hasOwn(retired, key2)) {
5587
- old.push({ key: key2, instead: retired[key2] });
5588
- continue;
5589
- }
5590
- const near = known.filter((candidate) => !candidate.startsWith("$")).map((candidate) => ({ candidate, d: distance(key2, candidate) })).sort((a, b) => a.d - b.d)[0];
5591
- unknown.push({ key: key2, ...near && near.d <= 2 ? { suggestion: near.candidate } : {} });
5592
- }
5593
- return { unknown, retired: old };
5594
- }
5595
- var unknownMessage = (unknown, known) => `unknown setting '${unknown.key}'${unknown.suggestion ? `; did you mean '${unknown.suggestion}'?` : `; known settings are ${known.filter((key2) => !key2.startsWith("$")).join(", ")}`}`;
5596
- function checkCurate(settings, check2) {
5597
- if (settings.curate === void 0) return;
5598
- check2(object2(settings.curate), "curate must be an object");
5599
- check2(Object.keys(settings.curate).every((key2) => key2 === "monthly"), "unsupported curate field; use monthly");
5600
- if (settings.curate.monthly !== void 0) check2(typeof settings.curate.monthly === "boolean", "curate.monthly must be true or false");
5601
- }
5602
- function validateUserSettings(settings, source) {
5603
- const check2 = (ok, message) => requireValue(ok, "INVALID_SETTINGS", source, message);
5604
- check2(object2(settings), "expected an object");
5605
- const { unknown } = settingsKeys(settings, USER_SETTINGS, RETIRED_SETTINGS.user);
5606
- check2(!unknown.length, unknown.length ? unknownMessage(unknown[0], USER_SETTINGS) : "");
5607
- checkCurate(settings, check2);
5608
- for (const key2 of ["limits", "recovery"]) {
5609
- if (settings[key2] === void 0) continue;
5610
- check2(object2(settings[key2]), `${key2} must be an object`);
5611
- const extra = Object.keys(settings[key2]).find((field) => field !== "autoResume");
5612
- check2(!extra, `unsupported ${key2} field '${extra}'; use autoResume`);
5613
- if (settings[key2].autoResume !== void 0) check2(typeof settings[key2].autoResume === "boolean", `${key2}.autoResume must be true or false`);
5614
- }
5615
- if (settings.web !== void 0) {
5616
- check2(object2(settings.web), "web must be an object");
5617
- const extra = Object.keys(settings.web).find((field) => !["enabled", "port", "relay", "permissions"].includes(field));
5618
- check2(!extra, `unsupported web field '${extra}'; use enabled, port, relay or permissions`);
5619
- if (settings.web.permissions !== void 0) check2(Array.isArray(settings.web.permissions) && settings.web.permissions.every((entry) => typeof entry === "string" && /^[a-z][a-z.]*$/.test(entry)), "web.permissions must be a list of permission names, such as files.read");
5620
- const relay = settings.web.relay;
5621
- if (relay !== void 0) {
5622
- check2(object2(relay), "web.relay must be an object");
5623
- const unsupported = Object.keys(relay).find((field) => !["enabled", "endpoint", "useTls"].includes(field));
5624
- check2(!unsupported, `unsupported web.relay field '${unsupported}'; use enabled, endpoint or useTls`);
5625
- if (relay.enabled !== void 0) check2(typeof relay.enabled === "boolean", "web.relay.enabled must be true or false");
5626
- if (relay.endpoint !== void 0) check2(typeof relay.endpoint === "string" && /^[a-z0-9.-]+:\d{1,5}$/i.test(relay.endpoint), "web.relay.endpoint must be host:port, such as relay.paseo.sh:443");
5627
- if (relay.useTls !== void 0) check2(typeof relay.useTls === "boolean", "web.relay.useTls must be true or false");
5628
- }
5629
- if (settings.web.enabled !== void 0) check2(typeof settings.web.enabled === "boolean", "web.enabled must be true or false");
5630
- if (settings.web.port !== void 0) check2(Number.isInteger(settings.web.port) && settings.web.port >= 1024 && settings.web.port <= 65535, "web.port must be a port from 1024 to 65535");
5631
- }
5632
- if (settings.language !== void 0) check2(nonempty(settings.language) && settings.language.trim().length <= 40, "language must be a language name of at most 40 characters, such as Vietnamese or English");
5633
- validatePermissions(settings.permissions, source);
5634
- return settings;
5635
- }
5636
-
5637
5704
  // apps/gateway/src/server.js
5638
5705
  import { randomBytes as randomBytes3 } from "node:crypto";
5639
5706
  import { readFile as readFile3 } from "node:fs/promises";
@@ -5656,7 +5723,7 @@ import { createCipheriv, createDecipheriv, randomBytes, createHash as createHash
5656
5723
  import { homedir } from "node:os";
5657
5724
 
5658
5725
  // packages/protocol/src/contract-v1.js
5659
- var METHODS_V1 = { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://alp.dev/schemas/methods-v1.json", "protocolVersion": 1, "errors": { "parseError": -32700, "invalidRequest": -32600, "methodNotFound": -32601, "invalidParams": -32602, "failed": 1e3, "notFound": 1001, "forbidden": 1003, "conflict": 1004, "unavailable": 1005, "protocol": 1006 }, "capabilities": { "attach.after": "session.attach accepts `after` and answers `cursor`/`reset`; envelopes kept in a tree timeline carry `cursor`.", "prompt.receipts": "session.prompt is answered at most once per (sessionId, clientMessageId) from a durable receipt; repeats answer the first outcome or outcome_unknown.", "extension.methods": "extension.register/unregister, and the daemon sends extension.invoke requests to the owning connection.", "team": "team.list: the teams a project can use, from the daemon host's built-ins, library and project.", "task": "task.list, task.create, task.update and task.gate.resolve on a project's .alp/tasks, written by the daemon under the task lock.", "library": "library.list/get/save/delete/duplicate/rename, library.skills.set and library.models on the daemon user's library and a project's .alp overrides; secrets are redacted on read.", "settings.language": "settings.language.get/set: the language the daemon user reads, in the daemon's ALP_HOME/settings.json.", "session.list.page": "session.list accepts `limit`, `cursor` and `query` and answers `nextCursor` while more sessions follow; without them it answers every session as before.", "question.watch": "question.watch: the connection is told of `question` and `question.resolved` in every tree (of a projectRoot when given), attached or not.", "question.watch.turns": "question.watch accepts `turns`: the connection is also told of `turn.ended` of every root in the trees it watches.", "session.attention": "question.watch accepts `attention`: its answer holds each watched root's finished or error attention, kept by alpd for every client, and the connection is told when one is set or cleared (an `attention` event); session.attention.clear acknowledges one.", "workspace.files": "workspace.files.search: files under a directory whose relative path matches a query; read-only, names only, links never followed.", "workspace.files.read": "workspace.files.list and workspace.files.read: the entries of a directory and the content of a UTF-8 text file (at most 1 MiB) under a directory; read-only, links never followed, .git, .env* and key or credential files refused, .gitignore'd paths hidden unless asked.", "workspace.files.browse": "workspace.files.find (every file and directory name under a directory, in pages of a snapshot, by its letters in order or by suffix), workspace.files.preview (a text, image or binary file of at most 50 MiB, its bytes in chunks of at most 8 MiB) and workspace.files.list's cursor and internalLinks (pages past 1000 entries; links whose real path is inside the directory, never outside); read-only, the block list and .gitignore as workspace.files.read. For the daemon host's own clients: the gateway exposes none of it.", "host.directories": "host.directories.search: directories of the daemon host whose path completes a typed path (absolute or under ~) or whose name matches a word under the home directory; names only, links never listed, bounded. For the daemon host's own clients: never remote.", "prompt.images": 'session.prompt takes inline image parts { type: "image", mimeType, data } (base64, no paths or URLs) within the image limits; a session snapshot says whether its runtime takes them in promptImages.', "library.project.write": "library save/delete/duplicate/rename accept policy project-data: only project-only pure-data agents and skills, no executable configuration, sidecars or library/built-in collisions.", "schedule": "schedule.create/list/get/cancel: one-shot continuations of a root session. alpd opens the turn by itself when the time comes; a job that comes due late says how late it is, and a job that cannot run says why.", "session.history": "Durable bounded backward envelope pages, persisted generation and numeric attach watermark.", "workspace.registry": "Daemon-owned project/workspace registry, durable pins, revision CAS and requestId replay.", "workspace.worktree": "Host-approved managed user worktrees; opt-in workspace.manage and named destination mappings.", "workspace.git": "workspace.git.status and workspace.git.diff: a registered workspace's read-only Git status and structured diff hunks by workspaceId; enumerated comparisons only, bounded (1 MiB per file, 2 MiB per page, 200 untracked files) with an opaque snapshot and next cursor; blocked secret paths withheld on both sides of a rename; no Git mutation.", "workspace.git.facts": "workspace.git.facts: the read-only Git checkout facts (repository root, branch, HEAD, remote, dirty) of an absolute host directory that need not be a registry workspace: a repository's top level (ok), a folder nested in one (not_repository_root, facts of the enclosing repository), no repository at or above it (unknown) or one alpd will not read (unsupported); owner only, never forwarded by a gateway; no Git mutation.", "attachments": 'attachment.begin/chunk/commit/abort/get/delete: daemon-owned immutable non-image attachments by opaque id, uploaded in bounded chunks, and session.prompt content parts `{ type: "attachment", attachmentId }`; daemon.hello carries `attachmentLimits`. Listed only with a home and a store, on macOS and Linux.', "session.fork": "session.fork: a new root whose conversation is a root's up to a completed turn (or a branch a rewind set aside), by native fork of Codex and Claude sessions; files are never copied or changed. Listed with a store and a runtime that forks native conversations, on macOS and Linux (not Windows).", "session.rewind": "session.rewind: a root's conversation from before a turn on, under the same session id; the later turns stay a recoverable branch, files are never changed, history generation advances (`history.reset` event). Same condition as session.fork.", "session.reload": "session.reload: restarts a live root's native process on its own conversation and configuration at the idle barrier (no turn, child, question, mail or parked work), keeping its session id, history and receipts; through the lifecycle journal. Listed with a store and a runtime that restarts a root on its own conversation, on macOS and Linux (not Windows).", "session.resumeCommand": "session.resumeCommand: the ALP CLI command (`alp attach <sessionId>`) that follows a session in a terminal, as argv and POSIX and Windows (cmd.exe) command lines built by alpd; for the clipboard only, never run, never a native runtime's command, credential, env or path.", "session.commands": `session.commands: the slash commands and skills a live session's composer offers after "/" (its runtime's, then its agent's ALP skills): names, descriptions and argument hints only, never a path.`, "session.configure.live": "session.configure takes model, thinking and team (with requestId and ifGeneration) besides mode, and session.configure.preview answers the configuration a change would run with: a live root's model, effort or team changes at the idle barrier (no turn, child, question, mail or parked work) through a controlled restart of its native process on the same conversation; the effective configuration is written only after the runtime took it, through the lifecycle journal (\xA712.9). Never another runtime and never more permissions. Listed with a store and a runtime that restarts a root with a new configuration, on macOS and Linux (not Windows).", "terminal": "terminal.create/list/attach/input/resize/close/revoke and terminal.event notifications: a real PTY shell on the daemon host as the daemon's account (a cwd is not a sandbox), served only when the host owner opted in (<ALP_HOME>/terminal.json allowRemoteTerminal) on macOS (full protection), Linux and Windows (best-effort).", "session.interrupt.turn": "session.interrupt accepts turnId and atomically cancels only that active turn, including its subtree. Conditional requests answer interrupted:true when canceled, false when the named turn is no longer active; false changes nothing. Without this capability clients must not send turnId or infer targeted cancellation from a legacy interrupt.", "terminal.capture": "terminal.capture: bounded daemon-owned rendered text, inclusive zero-based/negative line ranges; same terminal principal/host opt-in. Exceeding resource/result limits is an explicit refusal.", "terminal.watch": "terminal.watch/unwatch and terminal.changed: atomic scoped snapshot/subscription. Opaque per-subscription cursor, latest snapshot replaces invalidation history on reconnect/reset; older hosts use explicit polling fallback.", "catalog.live": "catalog.get answers the live model catalog (provider lists merged over ALP's static rows) with fetchedAt and per-provider status; catalog.refresh asks the providers again; alpd sends catalog.updated to every helloed connection when the catalog changes." }, "methods": { "assignment.recall": { "x-alp": { "effect": "mutation", "scope": { "kind": "project", "param": "projectRoot", "required": false, "alternatives": ["assignmentId", "taskId"] }, "idempotent": false, "risks": ["model call"] }, "params": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "taskId": { "type": "string" }, "projectRoot": { "type": "string" }, "question": { "type": "string" } }, "required": ["question"], "additionalProperties": true }, "result": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "agent": { "type": "string" }, "taskId": { "type": "string" }, "finishedAt": { "type": "string" }, "answer": { "type": "string" } }, "required": ["assignmentId", "agent", "finishedAt", "answer"], "additionalProperties": true } }, "board.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "pins": { "type": "array", "items": { "$ref": "#/$defs/pin" } } }, "required": ["pins"], "additionalProperties": true } }, "catalog.get": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object" } }, "modes": { "type": "array", "items": { "type": "object" } }, "thinkingOptions": {}, "defaultModel": { "type": "string" }, "fetchedAt": { "type": "string" }, "providers": { "type": "object" } }, "required": ["models", "modes", "defaultModel"], "additionalProperties": true } }, "catalog.refresh": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object" } }, "modes": { "type": "array", "items": { "type": "object" } }, "thinkingOptions": {}, "defaultModel": { "type": "string" }, "fetchedAt": { "type": "string" }, "providers": { "type": "object" } }, "required": ["models", "modes", "defaultModel"], "additionalProperties": true } }, "daemon.hello": { "x-alp": { "effect": "query", "scope": { "kind": "connection" }, "idempotent": true }, "params": { "type": "object", "properties": { "protocolVersion": { "const": 1 }, "client": { "type": "object", "properties": { "name": { "type": "string" }, "version": { "type": "string" } }, "required": ["name", "version"], "additionalProperties": true }, "capabilities": { "type": "array", "items": { "type": "string" } } }, "required": ["protocolVersion"], "additionalProperties": true }, "result": { "type": "object", "properties": { "protocolVersion": { "const": 1 }, "daemonVersion": { "type": "string" }, "pid": { "type": "integer" }, "hostname": { "type": "string" }, "capabilities": { "type": "array", "items": { "type": "string" } }, "promptImageLimits": { "type": "object", "description": "Optional effective inline image limits for this connection, when prompt.images is advertised. Missing on older peers. Byte limits count decoded bytes.", "properties": { "maxCount": { "type": "integer", "minimum": 0 }, "maxBytes": { "type": "integer", "minimum": 0 }, "maxTotalBytes": { "type": "integer", "minimum": 0 } }, "required": ["maxCount", "maxBytes", "maxTotalBytes"], "additionalProperties": false }, "attachmentLimits": { "type": "object", "description": "Effective attachment limits for this connection, when `attachments` is advertised. Byte limits count decoded bytes; times are milliseconds. An operator or a gateway may lower them, never raise them.", "properties": { "maxObjectBytes": { "type": "integer", "minimum": 0 }, "maxPerPrompt": { "type": "integer", "minimum": 0 }, "maxPromptBytes": { "type": "integer", "minimum": 0 }, "maxChunkBytes": { "type": "integer", "minimum": 0 }, "maxActiveUploads": { "type": "integer", "minimum": 0 }, "maxPrincipalBytes": { "type": "integer", "minimum": 0 }, "maxDaemonBytes": { "type": "integer", "minimum": 0 }, "uploadTimeoutMs": { "type": "integer", "minimum": 0 }, "unreferencedRetentionMs": { "type": "integer", "minimum": 0 }, "releasedGraceMs": { "type": "integer", "minimum": 0 } }, "required": ["maxObjectBytes", "maxPerPrompt", "maxPromptBytes", "maxChunkBytes", "maxActiveUploads", "maxPrincipalBytes", "maxDaemonBytes", "uploadTimeoutMs", "unreferencedRetentionMs", "releasedGraceMs"], "additionalProperties": false }, "terminalLimits": { "type": "object", "description": "Effective terminal limits for this connection, when `terminal` is advertised. Byte limits count UTF-8 bytes; times are milliseconds. An operator or a gateway may lower them, never raise them.", "properties": { "maxPerPrincipal": { "type": "integer", "minimum": 0 }, "maxPerDaemon": { "type": "integer", "minimum": 0 }, "maxInputBytes": { "type": "integer", "minimum": 0 }, "maxOutputFrameBytes": { "type": "integer", "minimum": 0 }, "replayBytes": { "type": "integer", "minimum": 0 }, "idleMs": { "type": "integer", "minimum": 0 }, "maxLifetimeMs": { "type": "integer", "minimum": 0 }, "reconnectMs": { "type": "integer", "minimum": 0 } }, "required": ["maxPerPrincipal", "maxPerDaemon", "maxInputBytes", "maxOutputFrameBytes", "replayBytes", "idleMs", "maxLifetimeMs", "reconnectMs"], "additionalProperties": false } }, "required": ["protocolVersion"], "additionalProperties": true } }, "daemon.pause": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": { "runtime": { "enum": ["codex", "claude", "acp", "antigravity"] }, "now": { "type": "boolean" }, "reason": { "type": "string" } }, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.pauses": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.resume": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": { "runtime": { "enum": ["codex", "claude", "acp", "antigravity"] } }, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.shutdown": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "daemon.status": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "pid": { "type": "integer" }, "startedAt": { "type": "string" }, "version": { "type": "string" }, "protocolVersion": { "type": "integer" }, "sessions": { "type": "integer" }, "questions": { "type": "integer" }, "previousExit": { "type": "object", "properties": { "kind": { "enum": ["clean", "crash"] }, "at": { "type": "string" } }, "required": ["kind"], "additionalProperties": true }, "persistence": { "type": "object" }, "health": { "$ref": "#/$defs/health" } }, "required": ["pid", "startedAt", "version", "protocolVersion", "sessions", "questions", "health"], "additionalProperties": true } }, "daemon.usage": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true, "risks": ["refresh asks every provider (spawns on the daemon host)"] }, "params": { "type": "object", "properties": { "refresh": { "type": "boolean" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "providers": { "type": "array", "items": { "type": "object" } } }, "required": ["providers"], "additionalProperties": true } }, "extension.register": { "x-alp": { "effect": "mutation", "scope": { "kind": "connection" }, "idempotent": false, "risks": ["admin"] }, "params": { "type": "object", "properties": { "method": { "type": "string" } }, "required": ["method"], "additionalProperties": true }, "result": { "type": "object", "properties": { "registered": { "type": "string" } }, "required": ["registered"], "additionalProperties": true } }, "extension.unregister": { "x-alp": { "effect": "mutation", "scope": { "kind": "connection" }, "idempotent": false, "risks": ["admin"] }, "params": { "type": "object", "properties": { "method": { "type": "string" } }, "required": ["method"], "additionalProperties": true }, "result": { "type": "object", "properties": { "unregistered": { "type": "string" } }, "required": ["unregistered"], "additionalProperties": true } }, "library.delete": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": false }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "revision": { "type": "string" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "name", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "removed": { "const": true }, "now": { "enum": ["builtin", "library"] } }, "required": ["removed"], "additionalProperties": true } }, "library.duplicate": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope", "reads": ["builtin", "library"] }, "idempotent": false, "risks": ["exec-config when kind is mcp, hooks or providers"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "from": { "$ref": "#/$defs/entryName" }, "to": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "from", "to", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" } }, "required": ["revision"], "additionalProperties": true } }, "library.get": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true, "redacts": ["mcp /server/env/*", "mcp /server/headers/*", "providers /provider/env/*"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "scope": { "$ref": "#/$defs/libraryScope" } }, "required": ["kind", "name"], "additionalProperties": true }, "result": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "content": { "type": "object" }, "revision": { "$ref": "#/$defs/libraryRevision" }, "usedBy": { "type": "array", "items": { "type": "string" } }, "librarySkills": { "type": "array", "items": { "type": "string" } }, "secrets": { "type": "array", "items": { "type": "string" } } }, "required": ["kind", "name", "source", "content", "revision", "usedBy"], "additionalProperties": true } }, "library.list": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["kind"], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": ["string", "null"] }, "entries": { "type": "array", "items": { "$ref": "#/$defs/libraryEntryRow" } } }, "required": ["projectRoot", "entries"], "additionalProperties": true } }, "library.models": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "efforts": { "type": "array", "items": { "type": "string" } }, "effort": { "type": "string" } }, "required": ["id", "label", "efforts"], "additionalProperties": true } } }, "required": ["models"], "additionalProperties": true } }, "library.rename": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": false, "risks": ["exec-config when kind is mcp, hooks or providers"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "from": { "$ref": "#/$defs/entryName" }, "to": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "from", "to", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" } }, "required": ["revision"], "additionalProperties": true } }, "library.save": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": "with revision (a repeat fails revision_conflict)", "risks": ["exec-config when kind is mcp, hooks or providers, or agents naming mcp/hooks/provider", "writes every known project's .alp/settings.json when kind is teams and sync is known-projects"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "content": { "type": "object" }, "revision": { "$ref": "#/$defs/libraryRevision" }, "sync": { "enum": ["none", "known-projects"] }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "name", "scope", "content"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" }, "syncedProjects": { "type": "integer", "minimum": 0 }, "syncErrors": { "type": "array", "items": { "type": "string" } } }, "required": ["revision"], "additionalProperties": true } }, "library.skills.set": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "host" }, "writes": ["ALP_HOME/role-skills.json"], "idempotent": true }, "params": { "type": "object", "properties": { "agent": { "$ref": "#/$defs/entryName" }, "skills": { "type": "array", "items": { "$ref": "#/$defs/entryName" }, "maxItems": 100 } }, "required": ["agent", "skills"], "additionalProperties": true }, "result": { "type": "object", "properties": { "skills": { "type": "array", "items": { "type": "string" } } }, "required": ["skills"], "additionalProperties": true } }, "question.answer": { "x-alp": { "effect": "mutation", "scope": { "kind": "question", "param": "questionId", "prefix": true }, "idempotent": false }, "params": { "type": "object", "properties": { "questionId": { "type": "string" }, "text": { "type": "string" }, "dismiss": { "type": "boolean" }, "reason": { "type": "string" } }, "required": ["questionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "questionId": { "type": "string" } }, "required": ["questionId"], "additionalProperties": true } }, "question.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } } }, "required": ["questions"], "additionalProperties": true } }, "question.watch": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true, "capability": "question.watch" }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "turns": { "type": "boolean" }, "attention": { "type": "boolean" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "attention": { "type": "array", "items": { "type": "object", "properties": { "sessionId": { "type": "string" }, "attention": { "$ref": "#/$defs/attention" } }, "required": ["sessionId", "attention"], "additionalProperties": true } } }, "required": ["questions"], "additionalProperties": true } }, "session.attention.clear": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true, "capability": "session.attention" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "at": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "cleared": { "type": "boolean" } }, "required": ["cleared"], "additionalProperties": true } }, "schedule.create": { "x-alp": { "effect": "mutation", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["ALP_HOME/schedules"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "dueAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?(Z|[+-]\\d{2}:\\d{2})$" }, "prompt": { "type": "string", "minLength": 1, "maxLength": 8e3, "pattern": "\\S" } }, "required": ["projectRoot", "sessionId", "dueAt", "prompt"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "schedule.list": { "x-alp": { "effect": "query", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "status": { "enum": ["pending", "delivered", "failed", "cancelled"] } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "jobs": { "type": "array", "items": { "$ref": "#/$defs/scheduleJob" } } }, "required": ["jobs"], "additionalProperties": true } }, "schedule.get": { "x-alp": { "effect": "query", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["id", "projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "schedule.cancel": { "x-alp": { "effect": "mutation", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["ALP_HOME/schedules"], "idempotent": true }, "params": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["id", "projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "session.archive": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "archived": { "type": "boolean" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.attach": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "replay": { "type": "boolean" }, "after": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "generation": { "type": "string", "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "cursor": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "reset": { "const": true } }, "required": ["session", "cursor"], "additionalProperties": true } }, "session.close": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": false }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "session.compact": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "risks": ["main writes a checkpoint in a turn of its own, then its context is compacted natively or replaced by a fresh conversation seeded with the checkpoint"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "status": { "enum": ["started", "deferred", "running"] } }, "required": ["status"], "additionalProperties": false } }, "session.commands": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.commands", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "commands": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\s\\u0000-\\u001f\\u007f]+$" }, "description": { "type": "string", "maxLength": 4096 }, "argumentHint": { "type": "string", "maxLength": 256 }, "kind": { "enum": ["command", "skill"] } }, "required": ["name", "description", "kind"], "additionalProperties": false } } }, "required": ["commands"], "additionalProperties": false } }, "session.configure": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": "mode alone: yes; with model, thinking or team: with requestId", "risks": ["with model, thinking or team: restarts the root's native process on its own conversation; never another runtime, never more permissions"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "mode": { "type": "string" }, "model": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Native model, or runtime-prefixed (codex:/claude:); the session's own runtime only (capability session.configure.live)." }, "thinking": { "type": "string", "minLength": 1, "maxLength": 200, "description": "An effort the model takes (capability session.configure.live)." }, "team": { "type": "string", "minLength": 1, "maxLength": 200, "description": "A team id the daemon host defines (capability session.configure.live); no path or configuration." }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["sessionId"], "anyOf": [{ "not": { "anyOf": [{ "required": ["model"] }, { "required": ["thinking"] }, { "required": ["team"] }] } }, { "required": ["requestId", "ifGeneration"] }], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/session" }, "configured": { "$ref": "#/$defs/configureOutcome" }, "duplicate": { "const": true } }, "required": ["session"], "additionalProperties": true } }, "session.configure.preview": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.configure.live", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "mode": { "type": "string" }, "model": { "type": "string", "minLength": 1, "maxLength": 200 }, "thinking": { "type": "string", "minLength": 1, "maxLength": 200 }, "team": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "preview": { "$ref": "#/$defs/configurePreview" } }, "required": ["preview"], "additionalProperties": true } }, "session.create": { "x-alp": { "effect": "mutation", "scope": { "kind": "project", "param": "spec.cwd" }, "idempotent": false, "risks": ["exec: spec.env and stdio spec.mcpServers run on the daemon host", "spec.workdir/writeRoot/copy*/restore/keepThread are internal"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" }, "spec": { "anyOf": [{ "$ref": "#/$defs/spec" }, { "type": "object", "properties": { "agent": { "type": "string" }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "persist": { "type": "boolean" }, "workflow": { "type": "string" } }, "required": [], "additionalProperties": false }] }, "history": { "enum": ["skip", "replay"] }, "delegation": { "type": "boolean" }, "resume": { "type": "boolean" }, "workspaceId": { "type": "string" } }, "required": ["spec"], "additionalProperties": true, "anyOf": [{ "required": ["workspaceId"] }, { "properties": { "spec": { "$ref": "#/$defs/spec" } } }] }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/session" }, "attached": { "type": "boolean" }, "resumed": { "const": true }, "durable": { "type": "boolean" } }, "required": ["session", "attached"], "additionalProperties": true } }, "session.get": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.interrupt": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "turnId": { "type": "string", "minLength": 1 } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "interrupted": { "type": "boolean" } }, "required": [], "additionalProperties": true } }, "session.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "rootsOnly": { "type": "boolean" }, "includeClosed": { "type": "boolean" }, "includeArchived": { "type": "boolean" }, "limit": { "type": "integer", "minimum": 1, "maximum": 1e3 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "query": { "type": "string", "maxLength": 200 }, "projectRoots": { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": 1024 } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "sessions": { "type": "array", "items": { "$ref": "#/$defs/sessionSummary" } }, "nextCursor": { "type": "string", "minLength": 1 } }, "required": ["sessions"], "additionalProperties": true } }, "session.log": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "rootId": { "type": "string" }, "entries": { "type": "array", "items": { "type": "object" } } }, "required": ["rootId", "entries"], "additionalProperties": true } }, "session.message": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": false }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "text": { "type": "string" } }, "required": ["sessionId", "text"], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "session.preview": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "spec.cwd" }, "idempotent": true }, "params": { "type": "object", "properties": { "spec": { "$ref": "#/$defs/spec" } }, "required": ["spec"], "additionalProperties": true }, "result": { "type": "object", "properties": { "preview": { "$ref": "#/$defs/preview" } }, "required": ["preview"], "additionalProperties": true } }, "session.prompt": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": "with prompt.receipts" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "clientMessageId": { "type": "string" }, "delivery": { "enum": ["auto", "steer"] }, "content": { "type": "array", "items": { "anyOf": [{ "type": "object", "properties": { "type": { "const": "text" }, "text": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "$ref": "#/$defs/promptImage" }, { "type": "object", "properties": { "type": { "const": "attachment" }, "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" } }, "required": ["type", "attachmentId"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["text", "image", "attachment"] } } }, "required": ["type"], "additionalProperties": true }] } }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "clientMessageId", "content"], "additionalProperties": true }, "result": { "type": "object", "properties": { "outcome": { "enum": ["accepted", "failed"] }, "error": { "$ref": "#/$defs/alpError" }, "duplicate": { "type": "boolean" }, "durable": { "type": "boolean" } }, "required": [], "additionalProperties": true } }, "session.release": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "closed": { "type": "boolean" } }, "required": ["closed"], "additionalProperties": true } }, "session.rename": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S" } }, "required": ["sessionId", "title"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.status": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "status": { "$ref": "#/$defs/treeStatus" } }, "required": ["status"], "additionalProperties": true } }, "settings.language.get": { "x-alp": { "effect": "query", "capability": "settings.language", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/languageSetting" } }, "settings.language.set": { "x-alp": { "effect": "mutation", "capability": "settings.language", "scope": { "kind": "host" }, "writes": ["ALP_HOME/settings.json"], "idempotent": true }, "params": { "type": "object", "properties": { "language": { "anyOf": [{ "type": "string", "minLength": 1, "maxLength": 40, "pattern": "\\S" }, { "type": "null" }] } }, "required": ["language"], "additionalProperties": true }, "result": { "$ref": "#/$defs/languageSetting" } }, "task.create": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": "per requestId within one alpd process (10 minutes)" }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "title": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S" }, "priority": { "type": "integer", "minimum": 0, "maximum": 4 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["projectRoot", "title"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "duplicate": { "const": true } }, "required": ["id"], "additionalProperties": true } }, "task.gate.resolve": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "id": { "$ref": "#/$defs/taskId" }, "gate": { "type": "string", "minLength": 1, "maxLength": 128 }, "note": { "type": "string", "maxLength": 2e3 }, "ifRev": { "type": "integer", "minimum": 0 }, "choice": { "type": "string", "minLength": 1, "maxLength": 200 }, "reject": { "type": "boolean" }, "channel": { "type": "string", "enum": ["paseo", "web"] } }, "required": ["projectRoot", "id", "gate"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "status": { "type": "string" }, "rev": { "type": "integer", "minimum": 0 } }, "required": ["id", "status", "rev"], "additionalProperties": true } }, "task.list": { "x-alp": { "effect": "query", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "tasks": { "type": "array", "items": { "$ref": "#/$defs/taskRow" } }, "unreadable": { "type": "array", "items": { "type": "object", "properties": { "file": { "type": "string" }, "error": { "type": "string" } }, "required": ["file", "error"], "additionalProperties": true } }, "revision": { "type": "string" } }, "required": ["projectRoot", "tasks", "unreadable", "revision"], "additionalProperties": true } }, "task.update": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "id": { "$ref": "#/$defs/taskId" }, "action": { "enum": ["close", "reopen"] }, "note": { "type": "string", "maxLength": 2e3 }, "ifRev": { "type": "integer", "minimum": 0 } }, "required": ["projectRoot", "id", "action"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "status": { "type": "string" }, "rev": { "type": "integer", "minimum": 0 }, "landed": { "type": "string" } }, "required": ["id", "status", "rev"], "additionalProperties": true } }, "team.list": { "x-alp": { "effect": "query", "capability": "team", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": ["string", "null"] }, "teams": { "type": "array", "items": { "$ref": "#/$defs/teamRow" } } }, "required": ["projectRoot", "teams"], "additionalProperties": true } }, "workspace.files.search": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files", "risks": ["lists file names of the directory (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "query": { "type": "string", "maxLength": 200 }, "limit": { "type": "integer", "minimum": 1, "maximum": 100 } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "files": { "type": "array", "maxItems": 100, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 } }, "required": ["path"], "additionalProperties": true } }, "truncated": { "type": "boolean" } }, "required": ["files"], "additionalProperties": true } }, "workspace.files.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.read", "risks": ["lists names, kinds, sizes and times of a directory's entries (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "internalLinks": { "type": "boolean" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "path": { "type": "string", "minLength": 1 }, "kind": { "enum": ["file", "directory"] }, "size": { "type": "integer", "minimum": 0 }, "modifiedAt": { "type": "string" }, "target": { "type": "string", "minLength": 1 } }, "required": ["name", "path", "kind"], "additionalProperties": true } }, "truncated": { "type": "boolean" }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "target": { "type": "string", "minLength": 1 } }, "required": ["entries"], "additionalProperties": true } }, "workspace.files.read": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.read", "risks": ["returns the content of a text file under the directory"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" } }, "required": ["projectRoot", "path"], "additionalProperties": true }, "result": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "content": { "type": "string" }, "size": { "type": "integer", "minimum": 0, "maximum": 1048576 }, "modifiedAt": { "type": "string" } }, "required": ["path", "content", "size"], "additionalProperties": true } }, "workspace.files.find": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.browse", "risks": ["lists every file and directory name of the directory (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "query": { "type": "string", "maxLength": 200 }, "kinds": { "type": "array", "items": { "enum": ["file", "directory"] }, "minItems": 1, "maxItems": 2, "uniqueItems": true }, "matchMode": { "enum": ["subsequence", "suffix"] }, "limit": { "type": "integer", "minimum": 1, "maximum": 1e3 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 256 } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "kind": { "enum": ["file", "directory"] } }, "required": ["path", "kind"], "additionalProperties": true } }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 256 }, "truncated": { "type": "boolean" } }, "required": ["entries"], "additionalProperties": true } }, "workspace.files.preview": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.browse", "risks": ["returns the bytes of a file under the directory, text, image or binary, up to 50 MiB in chunks"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" }, "internalLinks": { "type": "boolean" }, "maxBytes": { "type": "integer", "minimum": 1, "maximum": 52428800 }, "offset": { "type": "integer", "minimum": 0, "maximum": 52428800 }, "revision": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["projectRoot", "path"], "additionalProperties": true }, "result": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "target": { "type": "string", "minLength": 1 }, "kind": { "enum": ["text", "image", "binary"] }, "mimeType": { "type": "string", "minLength": 1, "maxLength": 255 }, "size": { "type": "integer", "minimum": 0, "maximum": 52428800 }, "modifiedAt": { "type": "string" }, "revision": { "type": "string", "minLength": 1, "maxLength": 64 }, "encoding": { "enum": ["base64", "none"] }, "content": { "type": "string", "maxLength": 11184812 }, "offset": { "type": "integer", "minimum": 0 }, "nextOffset": { "type": "integer", "minimum": 1 } }, "required": ["path", "kind", "mimeType", "size", "modifiedAt", "revision", "encoding"], "additionalProperties": true } }, "host.directories.search": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true, "capability": "host.directories", "risks": ["lists names of directories on the daemon host outside any workspace"] }, "params": { "type": "object", "properties": { "query": { "type": "string", "maxLength": 4096 }, "limit": { "type": "integer", "minimum": 1, "maximum": 100 } }, "required": ["query"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 100, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 } }, "required": ["path"], "additionalProperties": true } }, "truncated": { "type": "boolean" } }, "required": ["entries"], "additionalProperties": true } }, "session.history": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true, "capability": "session.history" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "before": { "type": "string", "maxLength": 4096 }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "maxBytes": { "type": "integer", "minimum": 2048, "maximum": 524288 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "generation": { "type": "string" }, "items": { "type": "array", "maxItems": 500, "items": { "oneOf": [{ "$ref": "#/$defs/envelope" }, { "type": "object", "properties": { "cursor": { "type": "integer", "minimum": 0 }, "oversized": { "type": "object", "properties": { "bytes": { "type": "integer", "minimum": 1 } }, "required": ["bytes"] } }, "required": ["cursor", "oversized"], "additionalProperties": false }] } }, "olderCursor": { "type": "string" }, "hasOlder": { "type": "boolean" }, "tipCursor": { "type": "integer", "minimum": 0 } }, "required": ["generation", "items", "hasOlder", "tipCursor"], "additionalProperties": true } }, "project.list": { "params": { "type": "object", "properties": { "cursor": { "type": "string", "pattern": "^[0-9]+$" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "projectRoots": { "type": "array", "items": { "type": "string" } }, "includeRemoved": { "type": "boolean" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "projects": { "type": "array", "items": { "$ref": "#/$defs/registryProject" } }, "revision": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": ["string", "null"] } }, "required": ["projects", "revision", "total", "nextCursor"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.list": { "params": { "type": "object", "properties": { "cursor": { "type": "string", "pattern": "^[0-9]+$" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "projectRoots": { "type": "array", "items": { "type": "string" } }, "includeArchived": { "type": "boolean" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspaces": { "type": "array", "items": { "$ref": "#/$defs/registryWorkspace" } }, "revision": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": ["string", "null"] } }, "required": ["workspaces", "revision", "total", "nextCursor"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.get": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "project.register": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "directory": { "type": "string" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["directory", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "project": { "$ref": "#/$defs/registryProject" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["project", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "project.remove": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "projectId": { "type": "string" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["projectId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "project": { "$ref": "#/$defs/registryProject" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["project", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.update": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "workspaceId": { "type": "string" }, "title": { "type": ["string", "null"] }, "pinned": { "type": "boolean" }, "archived": { "type": "boolean" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["workspaceId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "registry.owner": { "params": { "type": "object", "properties": { "operation": { "enum": ["project.add", "project.rename", "project.remove", "workspace.create", "workspace.update", "placement.prepare", "placement.assign", "label.assign", "label.update", "label.delete", "placement.remove"] }, "args": { "type": "object" }, "requestId": { "type": "string" }, "ifRevision": { "type": "integer", "minimum": 0 } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "registry": { "type": "object" } }, "required": ["registry"] }, "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "capability": "workspace.registry", "idempotent": false } }, "workspace.worktree.create": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "mappingId": { "type": "string", "maxLength": 64 }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId", "requestId", "ifRevision", "mappingId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 }, "filesRemoved": { "type": "boolean" }, "branchRetained": { "type": "boolean" } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "workspace.worktree.remove": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 }, "filesRemoved": { "type": "boolean" }, "branchRetained": { "type": "boolean" } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "workspace.worktree.options": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "mappingIds": { "type": "array", "items": { "type": "string" } } }, "required": ["mappingIds"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "registry.worktree": { "params": { "type": "object", "properties": { "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "principalEpoch": { "type": "string" } }, "additionalProperties": false }, "result": { "type": "object", "additionalProperties": true }, "x-alp": { "effect": "query", "scope": { "kind": "host" }, "capability": "workspace.worktree" } }, "workspace.git.status": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.git", "idempotent": true, "risks": ["lists the changed file paths, branch and remote of a workspace checkout"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1 } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "state": { "enum": ["repository", "not_repository", "unsupported"] }, "reason": { "type": "string" }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "upstream": { "type": ["object", "null"], "properties": { "ref": { "type": "string" }, "ahead": { "type": "integer", "minimum": 0 }, "behind": { "type": "integer", "minimum": 0 } }, "required": ["ref", "ahead", "behind"], "additionalProperties": false }, "baseRef": { "type": ["string", "null"] }, "aheadBehind": { "type": ["object", "null"], "properties": { "ahead": { "type": "integer", "minimum": 0 }, "behind": { "type": "integer", "minimum": 0 } }, "required": ["ahead", "behind"], "additionalProperties": false }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" }, "files": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "oldPath": { "type": "string", "minLength": 1, "maxLength": 4096 }, "change": { "enum": ["modified", "added", "deleted", "renamed", "copied", "typechange", "untracked", "conflicted"] }, "staged": { "type": "boolean" }, "unstaged": { "type": "boolean" } }, "required": ["path", "change", "staged", "unstaged"], "additionalProperties": false } }, "hiddenCount": { "type": "integer", "minimum": 0 }, "truncated": { "type": "boolean" }, "snapshot": { "type": "string", "maxLength": 1024 } }, "required": ["state", "branch", "detached", "head", "upstream", "baseRef", "aheadBehind", "hasRemote", "remoteUrl", "dirty", "files", "hiddenCount", "truncated", "snapshot"], "additionalProperties": false } }, "workspace.git.facts": { "x-alp": { "effect": "query", "scope": { "kind": "host", "param": "directory" }, "capability": "workspace.git.facts", "idempotent": true, "risks": ["names the host path, branch and remote of a directory's enclosing Git checkout (owner only, never remote)"] }, "params": { "type": "object", "properties": { "directory": { "type": "string", "minLength": 1, "maxLength": 4096 } }, "required": ["directory"], "additionalProperties": false }, "result": { "oneOf": [{ "type": "object", "properties": { "kind": { "const": "ok" }, "repoRoot": { "type": "string", "minLength": 1 }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" } }, "required": ["kind", "repoRoot", "branch", "detached", "head", "hasRemote", "remoteUrl", "dirty"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "not_repository_root" }, "repoRoot": { "type": "string", "minLength": 1 }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" } }, "required": ["kind", "repoRoot", "branch", "detached", "head", "hasRemote", "remoteUrl", "dirty"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "unknown" } }, "required": ["kind"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "unsupported" }, "reason": { "enum": ["worktree_elsewhere", "inside_git_dir"] } }, "required": ["kind", "reason"], "additionalProperties": false }] } }, "workspace.git.diff": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.git", "idempotent": true, "risks": ["returns changed file content of a workspace checkout as diff hunks, including deleted and historical lines"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1 }, "compare": { "type": "object", "properties": { "mode": { "enum": ["uncommitted", "staged", "unstaged", "base"] }, "baseRef": { "type": "string", "minLength": 1, "maxLength": 255 }, "ignoreWhitespace": { "type": "boolean" } }, "required": ["mode"], "additionalProperties": false }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": ["workspaceId", "compare"], "additionalProperties": false }, "result": { "type": "object", "properties": { "compare": { "type": "object", "properties": { "mode": { "enum": ["uncommitted", "staged", "unstaged", "base"] }, "baseRef": { "type": "string" }, "ignoreWhitespace": { "type": "boolean" } }, "required": ["mode", "ignoreWhitespace"], "additionalProperties": false }, "snapshot": { "type": "string", "maxLength": 1024 }, "files": { "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "oldPath": { "type": "string", "minLength": 1, "maxLength": 4096 }, "change": { "enum": ["modified", "added", "deleted", "renamed", "copied", "typechange", "untracked", "conflicted"] }, "kind": { "enum": ["text", "binary", "too_large", "withheld", "symlink", "submodule"] }, "additions": { "type": "integer", "minimum": 0 }, "deletions": { "type": "integer", "minimum": 0 }, "hunks": { "type": "array", "items": { "type": "object", "properties": { "oldStart": { "type": "integer", "minimum": 0 }, "oldCount": { "type": "integer", "minimum": 0 }, "newStart": { "type": "integer", "minimum": 0 }, "newCount": { "type": "integer", "minimum": 0 }, "context": { "type": "string" }, "lines": { "type": "array", "items": { "type": "object", "properties": { "type": { "enum": ["add", "remove", "context"] }, "content": { "type": "string" }, "noNewline": { "const": true } }, "required": ["type", "content"], "additionalProperties": false } } }, "required": ["oldStart", "oldCount", "newStart", "newCount", "lines"], "additionalProperties": false } } }, "required": ["path", "change", "kind", "additions", "deletions", "hunks"], "additionalProperties": false } }, "hiddenCount": { "type": "integer", "minimum": 0 }, "truncated": { "type": "boolean" }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": ["compare", "snapshot", "files", "hiddenCount", "truncated"], "additionalProperties": false } }, "attachment.begin": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "attachments", "idempotent": "with requestId", "risks": ["reserves stored bytes of the daemon host for a file the client uploads"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 1024 }, "size": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "name", "size", "mimeType", "requestId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "state": { "enum": ["uploading", "committed"] }, "received": { "type": "integer", "minimum": 0 }, "size": { "type": "integer", "minimum": 0 }, "maxChunkBytes": { "type": "integer", "minimum": 1 }, "expiresAt": { "type": "string" }, "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" } }, "required": ["uploadId", "state", "received", "size", "maxChunkBytes"], "additionalProperties": false } }, "attachment.chunk": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": "same offset and bytes", "risks": ["writes uploaded bytes to the daemon host"] }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "offset": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "data": { "type": "string", "minLength": 4, "maxLength": 349528, "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId", "offset", "data"], "additionalProperties": false }, "result": { "type": "object", "properties": { "received": { "type": "integer", "minimum": 0 }, "size": { "type": "integer", "minimum": 0 } }, "required": ["received", "size"], "additionalProperties": false } }, "attachment.commit": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": true }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId", "sha256"], "additionalProperties": false }, "result": { "type": "object", "properties": { "attachment": { "$ref": "#/$defs/attachment" } }, "required": ["attachment"], "additionalProperties": false } }, "attachment.abort": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": false }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "aborted": { "const": true } }, "required": ["aborted"], "additionalProperties": false } }, "attachment.get": { "x-alp": { "effect": "query", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": true }, "params": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["attachmentId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "attachment": { "$ref": "#/$defs/attachment" } }, "required": ["attachment"], "additionalProperties": false } }, "attachment.delete": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": false }, "params": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["attachmentId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "deleted": { "const": true } }, "required": ["deleted"], "additionalProperties": false } }, "session.fork": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.fork", "idempotent": "with requestId", "risks": ["creates a new root session in the source workspace or a granted destination workspace; files are never copied, restored or changed"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "boundary": { "oneOf": [{ "type": "object", "properties": { "throughTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["throughTurnId"], "additionalProperties": false }, { "type": "object", "properties": { "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["beforeTurnId"], "additionalProperties": false }] }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "newSessionId": { "type": "string", "pattern": "^[\\w.:-]{1,128}$" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "requestId", "ifGeneration"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "forkedFrom": { "$ref": "#/$defs/forkProvenance" }, "duplicate": { "const": true } }, "required": ["session", "forkedFrom"], "additionalProperties": true } }, "session.rewind": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.rewind", "idempotent": "with requestId", "risks": ["replaces the conversation the runtime continues from; the later turns stay recoverable and no file is changed"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["sessionId", "requestId", "ifGeneration", "beforeTurnId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "generation": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "branch": { "$ref": "#/$defs/conversationBranch" }, "duplicate": { "const": true } }, "required": ["session", "generation", "branch"], "additionalProperties": true } }, "session.reload": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.reload", "idempotent": "with requestId", "risks": ["restarts the root's native process; its conversation, configuration, history and receipts are kept"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["sessionId", "requestId", "ifGeneration"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "duplicate": { "const": true } }, "required": ["session"], "additionalProperties": true } }, "session.resumeCommand": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.resumeCommand", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "argv": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" } }, "posix": { "type": "string", "minLength": 1, "maxLength": 2048 }, "windows": { "type": "string", "minLength": 1, "maxLength": 2048 }, "display": { "type": "string", "minLength": 1, "maxLength": 2048 }, "platform": { "enum": ["posix", "windows"] } }, "required": ["argv", "posix", "windows", "display", "platform"], "additionalProperties": false } }, "terminal.create": { "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "terminal", "idempotent": false, "risks": ["starts a shell on the daemon host as the daemon's account: host-level execution, not confined to the workspace"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "protectionAcknowledgment": { "const": "linux-root-only-v1", "description": "Deprecated and ignored: accepted for compatibility with older clients. Reduced-protection terminals open without it; clients disclose the terminal's protection field instead." } }, "required": ["workspaceId", "cols", "rows", "requestId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminal": { "$ref": "#/$defs/terminal" } }, "required": ["terminal"], "additionalProperties": false } }, "terminal.list": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "terminal", "idempotent": true }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminals": { "type": "array", "items": { "$ref": "#/$defs/terminal" } } }, "required": ["terminals"], "additionalProperties": false } }, "terminal.attach": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": true, "risks": ["streams the terminal's output, which may show anything the shell printed"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "after": { "type": "integer", "minimum": 0 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "protectionAcknowledgment": { "const": "linux-root-only-v1", "description": "Deprecated and ignored: accepted for compatibility with older clients. Reduced-protection terminals open without it; clients disclose the terminal's protection field instead." } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminal": { "$ref": "#/$defs/terminal" }, "nextSeq": { "type": "integer", "minimum": 1 }, "gap": { "type": "object", "properties": { "fromSeq": { "type": "integer", "minimum": 1 }, "toSeq": { "type": "integer", "minimum": 1 } }, "required": ["fromSeq", "toSeq"], "additionalProperties": false } }, "required": ["terminal", "nextSeq"], "additionalProperties": false } }, "terminal.input": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": false, "risks": ["types into a host shell: runs any command as the daemon's account"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "data": { "type": "string", "minLength": 1, "maxLength": 65536 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId", "data"], "additionalProperties": false }, "result": { "type": "object", "properties": { "bytes": { "type": "integer", "minimum": 1 } }, "required": ["bytes"], "additionalProperties": false } }, "terminal.resize": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": true }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId", "cols", "rows"], "additionalProperties": false }, "result": { "type": "object", "properties": { "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 } }, "required": ["cols", "rows"], "additionalProperties": false } }, "terminal.close": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": false }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "const": true } }, "required": ["closed"], "additionalProperties": false } }, "terminal.revoke": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "capability": "terminal", "idempotent": true, "risks": ["kills every terminal of a principal; for a trusted gateway, never exposed"] }, "params": { "type": "object", "properties": { "principalId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["principalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "type": "integer", "minimum": 0 } }, "required": ["closed"], "additionalProperties": false } }, "terminal.capture": { "x-alp": { "effect": "query", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal.capture", "idempotent": true, "risks": ["Reads terminal screen text, which may contain secrets the shell printed"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "start": { "type": "integer" }, "end": { "type": "integer" }, "stripAnsi": { "type": "boolean" } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "lines": { "type": "array", "maxItems": 1200, "items": { "type": "string" } }, "totalLines": { "type": "integer", "minimum": 0 } }, "required": ["lines", "totalLines"], "additionalProperties": false } }, "terminal.watch": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "terminal.watch", "idempotent": true, "description": "Connection-local read subscription management, like question.watch/session.attach; no host or terminal mutation." }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "after": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminals": { "type": "array", "items": { "$ref": "#/$defs/terminal" } }, "watchId": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "cursor": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "reset": { "type": "boolean" } }, "required": ["terminals", "watchId", "cursor", "reset"], "additionalProperties": false } }, "terminal.unwatch": { "x-alp": { "effect": "query", "scope": { "kind": "connection" }, "capability": "terminal.watch", "idempotent": true, "description": "Connection-local read subscription management, like question.watch/session.attach; no host or terminal mutation." }, "params": { "type": "object", "properties": {}, "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "const": true } }, "required": ["closed"], "additionalProperties": false } } }, "$defs": { "error": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" }, "data": {} }, "required": ["code", "message"], "additionalProperties": true }, "session": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "promptImages": { "type": "boolean" }, "promptAttachments": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["file.path", "document.native", "text.extract"] } }, "usage": { "$ref": "#/$defs/usage" } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy"], "additionalProperties": true }, "usage": { "type": "object", "properties": { "contextWindowUsedTokens": { "type": "integer", "minimum": 0 }, "contextWindowMaxTokens": { "type": "integer", "minimum": 1 }, "inputTokens": { "type": "integer", "minimum": 0 }, "cachedInputTokens": { "type": "integer", "minimum": 0 }, "outputTokens": { "type": "integer", "minimum": 0 }, "totalCostUsd": { "type": "number", "minimum": 0 } }, "additionalProperties": true }, "assignment": { "type": "object", "properties": { "id": { "type": "string" }, "agent": { "type": "string" }, "mode": { "type": "string" }, "status": { "type": "string" }, "startedAt": { "type": "string" }, "worktree": { "type": "object", "properties": { "branch": { "type": "string" }, "path": { "type": "string" } }, "required": ["branch", "path"], "additionalProperties": true } }, "required": ["id", "agent", "mode", "status", "startedAt"], "additionalProperties": true }, "mail": { "type": "object", "properties": { "id": { "type": "string" }, "kind": { "enum": ["question", "answer", "note", "steer", "result", "stalled", "board", "checkin"] }, "from": { "type": "string" }, "assignment": { "type": "string" }, "body": { "type": "string" }, "replyTo": { "type": "string" }, "result": { "type": "object" }, "redelivered": { "type": "boolean" } }, "required": ["id", "kind", "from", "assignment"], "additionalProperties": true }, "pin": { "type": "object", "properties": { "id": { "type": "string" }, "project": { "type": "string" }, "kind": { "enum": ["claim", "decision", "finding"] }, "body": { "type": "string" }, "paths": { "type": "array", "items": { "type": "string" } }, "agent": { "type": "string" }, "sessionId": { "type": "string" }, "rootId": { "type": "string" }, "at": { "type": "string" }, "released": { "type": "string" }, "task": { "type": "string" } }, "required": ["id", "project", "kind", "body", "agent", "sessionId", "rootId", "at"], "additionalProperties": true }, "question": { "type": "object", "properties": { "id": { "type": "string" }, "sessionId": { "type": "string" }, "rootId": { "type": "string" }, "agent": { "type": "string" }, "body": { "type": "string" }, "options": { "type": "array", "items": { "type": "string" } }, "askedAt": { "type": "string" }, "gate": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "taskId": { "type": "string" }, "gateId": { "type": "string" } }, "required": ["projectRoot", "taskId", "gateId"], "additionalProperties": true } }, "required": ["id", "sessionId", "rootId", "agent", "body", "askedAt"], "additionalProperties": true }, "attention": { "type": "object", "properties": { "reason": { "enum": ["finished", "error"] }, "at": { "type": "string" }, "turnId": { "type": "string" }, "message": { "type": "string" } }, "required": ["reason", "at"], "additionalProperties": true }, "spec": { "type": "object", "properties": { "cwd": { "type": "string" }, "agent": { "type": "string" }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "persist": { "type": "boolean" }, "restore": { "type": "object" } }, "required": ["cwd"], "additionalProperties": true }, "item": { "anyOf": [{ "$ref": "#/$defs/knownItem" }, { "$ref": "#/$defs/unknownItem" }] }, "event": { "anyOf": [{ "$ref": "#/$defs/knownEvent" }, { "$ref": "#/$defs/unknownEvent" }] }, "envelope": { "type": "object", "properties": { "sessionId": { "type": "string" }, "epoch": { "type": "string" }, "seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "ts": { "type": "string" }, "event": { "$ref": "#/$defs/event" }, "cursor": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, "required": ["sessionId", "epoch", "seq", "ts", "event"], "additionalProperties": true }, "request": { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }] }, "method": { "type": "string" }, "params": { "type": "object" } }, "required": ["jsonrpc", "method", "id"], "additionalProperties": true }, "response": { "oneOf": [{ "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" }] }, "result": {} }, "required": ["jsonrpc", "id", "result"], "additionalProperties": true }, { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" }] }, "error": { "$ref": "#/$defs/error" } }, "required": ["jsonrpc", "id", "error"], "additionalProperties": true }] }, "notification": { "oneOf": [{ "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "event" }, "params": { "$ref": "#/$defs/envelope" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "description": "A terminal's output, exit or detach (capability terminal, \xA712.10).", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "terminal.event" }, "params": { "$ref": "#/$defs/terminalEvent" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "terminal.changed" }, "params": { "$ref": "#/$defs/terminalChanged" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "description": "The live model catalog changed (capability catalog.live): re-read catalog.get.", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "catalog.updated" }, "params": { "type": "object", "properties": { "fetchedAt": { "type": "string" } }, "additionalProperties": true } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }] }, "knownEvent": { "oneOf": [{ "type": "object", "properties": { "type": { "const": "session.opened" }, "session": { "$ref": "#/$defs/session" }, "cwd": { "type": "string" }, "effective": { "type": "object", "properties": { "model": { "type": "string" }, "thinking": { "type": "string" } }, "required": ["model", "thinking"], "additionalProperties": true } }, "required": ["type", "session", "cwd", "effective"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.ready" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.updated" }, "session": { "$ref": "#/$defs/session" } }, "required": ["type", "session"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.closed" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.failed" }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "error"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "prompt.accepted" }, "clientMessageId": { "type": "string" }, "result": { "enum": ["turn", "steer"] }, "turnId": { "type": "string" } }, "required": ["type", "clientMessageId", "result", "turnId"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "prompt.failed" }, "clientMessageId": { "type": "string" }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "clientMessageId", "error"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "turn.started" }, "turnId": { "type": "string" }, "origin": { "enum": ["user", "wake", "assignment", "runtime"] } }, "required": ["type", "turnId", "origin"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "turn.ended" }, "turnId": { "type": "string" }, "state": { "enum": ["completed", "failed", "canceled"] }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "turnId", "state"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "item" }, "item": { "$ref": "#/$defs/item" } }, "required": ["type", "item"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "usage" }, "usage": { "$ref": "#/$defs/usage" } }, "required": ["type", "usage"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "mail" }, "mail": { "$ref": "#/$defs/mail" } }, "required": ["type", "mail"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "assignment" }, "assignment": { "$ref": "#/$defs/assignment" } }, "required": ["type", "assignment"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "question" }, "question": { "$ref": "#/$defs/question" } }, "required": ["type", "question"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "question.resolved" }, "questionId": { "type": "string" }, "outcome": { "enum": ["answered", "dismissed", "timeout", "canceled"] }, "answer": { "type": "string" } }, "required": ["type", "questionId", "outcome"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "pin" }, "pin": { "$ref": "#/$defs/pin" } }, "required": ["type", "pin"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "unpin" }, "pinId": { "type": "string" }, "reason": { "enum": ["unpinned", "session_ended"] } }, "required": ["type", "pinId", "reason"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "attention" }, "attention": { "$ref": "#/$defs/attention" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "history.reset" }, "generation": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "reason": { "const": "rewind" }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" } }, "required": ["type", "generation", "reason", "branchId"], "additionalProperties": true }] }, "unknownEvent": { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["session.opened", "session.ready", "session.updated", "session.closed", "session.failed", "prompt.accepted", "prompt.failed", "turn.started", "turn.ended", "item", "usage", "mail", "assignment", "question", "question.resolved", "pin", "unpin", "attention", "history.reset"] } } }, "required": ["type"], "additionalProperties": true }, "knownItem": { "oneOf": [{ "type": "object", "properties": { "kind": { "const": "user_message" }, "id": { "type": "string" }, "text": { "type": "string" }, "clientMessageId": { "type": "string" }, "images": { "type": "integer", "minimum": 1 }, "attachments": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "name": { "type": "string" }, "mimeType": { "type": "string" }, "size": { "type": "integer", "minimum": 0 } }, "required": ["attachmentId", "name", "mimeType", "size"], "additionalProperties": false } }, "origin": { "enum": ["user", "wake", "assignment", "runtime"] } }, "required": ["kind", "id", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "assistant_message" }, "id": { "type": "string" }, "text": { "type": "string" } }, "required": ["kind", "id", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "notice" }, "id": { "type": "string" }, "level": { "enum": ["info", "warning", "error"] }, "text": { "type": "string" } }, "required": ["kind", "id", "level", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "compaction" }, "id": { "type": "string" }, "status": { "enum": ["running", "completed", "failed"] }, "trigger": { "type": "string" }, "preTokens": { "type": "integer" }, "postTokens": { "type": "integer" } }, "required": ["kind", "id", "status"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "todo" }, "id": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "text": { "type": "string" }, "status": { "enum": ["pending", "in_progress", "completed"] } }, "required": ["id", "text", "status"], "additionalProperties": true } } }, "required": ["kind", "id", "items"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "tool_call" }, "id": { "type": "string" }, "callId": { "type": "string" }, "name": { "type": "string" }, "status": { "enum": ["running", "completed", "failed"] }, "error": { "type": "string" }, "detail": { "$ref": "#/$defs/toolCallDetail" } }, "required": ["kind", "id", "callId", "name", "status", "detail"], "additionalProperties": true }] }, "unknownItem": { "type": "object", "properties": { "kind": { "type": "string", "not": { "enum": ["user_message", "assistant_message", "notice", "compaction", "todo", "tool_call"] } }, "id": { "type": "string" } }, "required": ["kind", "id"], "additionalProperties": true }, "toolCallDetail": { "oneOf": [{ "type": "object", "properties": { "type": { "const": "shell" }, "command": { "type": "string" }, "cwd": { "type": "string" }, "output": { "type": "string" }, "exitCode": { "type": ["integer", "null"] } }, "required": ["type", "command", "output"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "read" }, "filePath": { "type": "string" }, "content": { "type": "string" }, "offset": { "type": "integer" }, "limit": { "type": "integer" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "edit" }, "filePath": { "type": "string" }, "oldString": { "type": "string" }, "newString": { "type": "string" }, "unifiedDiff": { "type": "string" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "write" }, "filePath": { "type": "string" }, "content": { "type": "string" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "search" }, "query": { "type": "string" }, "toolName": { "enum": ["search", "grep", "glob", "web_search"] }, "content": { "type": "string" }, "filePaths": { "type": "array", "items": { "type": "string" } }, "webResults": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string" }, "url": { "type": "string" } }, "required": ["title", "url"], "additionalProperties": true } }, "numFiles": { "type": "integer" }, "numMatches": { "type": "integer" }, "truncated": { "type": "boolean" } }, "required": ["type", "query"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "fetch" }, "url": { "type": "string" }, "prompt": { "type": "string" }, "result": { "type": "string" }, "code": { "type": "integer" } }, "required": ["type", "url"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "sub_agent" }, "subAgentType": { "type": "string" }, "description": { "type": "string" }, "log": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "plan" }, "text": { "type": "string" } }, "required": ["type", "text"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "plain_text" }, "label": { "type": "string" }, "text": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "unknown" }, "input": {}, "output": {} }, "required": ["type", "input", "output"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["shell", "read", "edit", "write", "search", "fetch", "sub_agent", "plan", "plain_text", "unknown"] } } }, "required": ["type"], "additionalProperties": true }] }, "alpError": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "sessionSummary": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "status": { "enum": ["initializing", "idle", "running", "error", "closed"] }, "title": { "type": "string" }, "archived": { "type": "boolean" }, "attention": { "$ref": "#/$defs/attention" }, "lastError": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "conversation": { "type": "object", "properties": { "fork": { "type": "boolean" }, "rewind": { "type": "boolean" }, "reload": { "type": "boolean", "description": "Whether session.reload can restart this root's native process (\xA712.8); the root must also be open and idle." }, "reason": { "enum": ["runtime_unsupported", "not_persistent", "not_root"] }, "configure": { "type": "boolean", "description": "Whether session.configure can change this root's model, effort or team (\xA712.9); the root must also be open and idle." } }, "required": ["fork", "rewind"], "additionalProperties": true }, "forkedFrom": { "$ref": "#/$defs/forkProvenance" }, "branches": { "type": "array", "maxItems": 100, "items": { "$ref": "#/$defs/conversationBranch" } }, "promptAttachments": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["file.path", "document.native", "text.extract"] } } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy", "status"], "additionalProperties": true }, "pause": { "type": "object", "properties": { "since": { "type": "string" }, "by": { "type": "string" }, "reason": { "type": "string" }, "resetsAt": { "type": "string" }, "checkedAt": { "type": "string" } }, "required": ["since", "by", "reason"], "additionalProperties": true }, "pauseState": { "type": "object", "properties": { "all": { "$ref": "#/$defs/pause" }, "runtimes": { "type": "object", "additionalProperties": { "$ref": "#/$defs/pause" } }, "parked": { "type": "array", "items": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "type": "string" }, "rootId": { "type": "string" }, "reason": { "type": "string" }, "since": { "type": "string" } }, "required": ["assignmentId", "agent", "runtime", "rootId", "reason", "since"], "additionalProperties": true } } }, "required": ["runtimes", "parked"], "additionalProperties": true }, "preview": { "type": "object", "properties": { "teams": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" } }, "required": ["id", "label"], "additionalProperties": true } }, "team": { "type": "string" }, "teamLabel": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" } }, "required": ["teams", "team", "agent", "runtime", "model", "mode", "thinking"], "additionalProperties": true }, "treeStatus": { "type": "object", "properties": { "rootId": { "type": "string" }, "sessions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "state": { "enum": ["running", "waiting", "waiting_parent", "waiting_user", "idle"] }, "idleMs": { "type": "number" }, "workdir": { "type": "string" }, "unreadMail": { "type": "integer", "minimum": 0 } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy", "state", "idleMs", "workdir", "unreadMail"], "additionalProperties": true } }, "assignments": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "requester": { "type": "string" }, "isolation": { "enum": ["shared", "worktree"] }, "idleMs": { "type": "number" } }, "required": ["id", "requester", "isolation", "idleMs"], "additionalProperties": true } }, "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "worktrees": { "type": "array", "items": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "requester": { "type": "string" }, "agent": { "type": "string" }, "branch": { "type": "string" }, "files": { "type": "array", "items": { "type": "string" } }, "stat": { "type": "string" } }, "required": ["assignmentId", "requester", "agent", "branch", "files", "stat"], "additionalProperties": true } }, "leases": { "type": "array", "items": { "type": "object", "properties": { "checkout": { "type": "string" }, "assignmentId": { "type": "string" }, "agent": { "type": "string" } }, "required": ["checkout", "assignmentId", "agent"], "additionalProperties": true } }, "claims": { "type": "array", "items": { "$ref": "#/$defs/pin" } } }, "required": ["rootId", "sessions", "assignments", "questions", "worktrees", "leases", "claims"], "additionalProperties": true }, "health": { "type": "object", "properties": { "live": { "type": "boolean" }, "ready": { "type": "boolean" }, "checks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "ok": { "type": "boolean" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["id", "ok"], "additionalProperties": true } } }, "required": ["live", "ready", "checks"], "additionalProperties": true }, "projectRoot": { "type": "string", "minLength": 1, "maxLength": 4096, "description": "An absolute, normalized path on the daemon host to a directory holding .alp/. Compared as is: the daemon never walks up to a parent." }, "taskId": { "type": "string", "pattern": "^t-[0-9a-f]{4,12}(?:\\.\\d+)*$" }, "taskRow": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "title": { "type": "string" }, "type": { "type": "string" }, "priority": { "type": "integer" }, "status": { "enum": ["open", "in_progress", "review", "closed"] }, "rev": { "type": "integer", "minimum": 0 }, "parent": { "type": "string" }, "assignee": { "type": "string" }, "ready": { "type": "boolean" }, "blockedBy": { "type": "array", "items": { "type": "string" } }, "waits": { "type": "array", "items": { "type": "string" } }, "approvals": { "type": "array", "items": { "type": "object", "properties": { "gate": { "type": "string" }, "note": { "type": "string" } }, "required": ["gate", "note"], "additionalProperties": true } }, "handoff": { "type": "object", "properties": { "outcome": { "type": "string" }, "summary": { "type": "string" }, "agent": { "type": "string" } }, "required": ["outcome", "summary"], "additionalProperties": true }, "closed": { "type": "object", "properties": { "reason": { "type": "string" }, "summary": { "type": "string" }, "at": { "type": "string" } }, "required": ["reason", "at"], "additionalProperties": true }, "description": { "type": "string" }, "labels": { "type": "array", "items": { "type": "string" } }, "paths": { "type": "array", "items": { "type": "string" } }, "progress": { "type": "object", "properties": { "done": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 } }, "required": ["done", "total"], "additionalProperties": true }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": ["id", "title", "type", "priority", "status", "rev", "ready", "updatedAt"], "additionalProperties": true }, "libraryKind": { "enum": ["agents", "skills", "mcp", "hooks", "teams", "providers"] }, "libraryScope": { "enum": ["library", "project"] }, "librarySource": { "enum": ["builtin", "library", "project"] }, "entryName": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_.-]+$", "not": { "enum": [".", ".."] } }, "libraryRevision": { "type": ["string", "null"] }, "libraryEntryRow": { "type": "object", "properties": { "name": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "description": { "type": "string" }, "usedBy": { "type": "array", "items": { "type": "string" } } }, "required": ["name", "source"], "additionalProperties": true }, "secretMarker": { "type": "object", "properties": { "$secret": { "const": "keep" } }, "required": ["$secret"], "additionalProperties": false, "description": "Stands for a stored secret value: read results carry it in place of the value; a save that sends it back keeps the stored value." }, "languageSetting": { "type": "object", "properties": { "language": { "type": ["string", "null"] }, "applies": { "type": "string" }, "default": { "type": "string" } }, "required": ["language", "applies", "default"], "additionalProperties": true }, "teamRow": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "error": { "type": "string" } }, "required": ["id", "source"], "additionalProperties": true }, "promptImage": { "type": "object", "properties": { "type": { "const": "image" }, "mimeType": { "enum": ["image/png", "image/jpeg", "image/gif", "image/webp"] }, "data": { "type": "string", "minLength": 4, "maxLength": 6990508, "pattern": "^[A-Za-z0-9+/]+={0,2}$" }, "name": { "type": "string", "maxLength": 255 } }, "required": ["type", "mimeType", "data"], "additionalProperties": false }, "scheduleId": { "type": "string", "pattern": "^sch_[0-9a-f]{16}$" }, "scheduleError": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "scheduleJob": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "sessionId": { "type": "string" }, "prompt": { "type": "string" }, "dueAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?(Z|[+-]\\d{2}:\\d{2})$" }, "status": { "enum": ["pending", "delivered", "failed", "cancelled"] }, "attempts": { "type": "integer", "minimum": 0 }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "deliveredAt": { "type": "string" }, "failedAt": { "type": "string" }, "cancelledAt": { "type": "string" }, "attemptedAt": { "type": "string" }, "lateByMs": { "type": "integer", "minimum": 0 }, "lastError": { "$ref": "#/$defs/scheduleError" } }, "required": ["id", "projectRoot", "sessionId", "prompt", "dueAt", "status", "attempts", "createdAt", "updatedAt"], "additionalProperties": true }, "registryProject": { "type": "object", "properties": { "id": { "type": "string" }, "root": { "type": "string" }, "customName": { "type": ["string", "null"] }, "addedAt": { "type": "string" }, "removedAt": { "type": ["string", "null"] }, "revision": { "type": "integer", "minimum": 0 }, "canonical": { "type": "string" } }, "required": ["id", "root", "addedAt"], "additionalProperties": false }, "registryWorkspace": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "directory": { "type": "string" }, "title": { "type": ["string", "null"] }, "pinnedAt": { "type": ["string", "null"] }, "archivedAt": { "type": ["string", "null"] }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "revision": { "type": "integer", "minimum": 0 }, "canonical": { "type": "string" }, "idempotencyKey": { "type": "string" }, "branch": { "type": ["string", "null"] }, "managedWorktree": { "type": "boolean" } }, "required": ["id", "projectId", "directory", "labels", "createdAt"], "additionalProperties": false }, "attachment": { "type": "object", "description": "A committed attachment as clients see it: ids, display metadata and its digest, never a host path or URL.", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "mimeType": { "type": "string", "minLength": 3, "maxLength": 255 }, "detectedMimeType": { "type": "string", "minLength": 3, "maxLength": 255 }, "size": { "type": "integer", "minimum": 0 }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "createdAt": { "type": "string" }, "committedAt": { "type": "string" }, "referenced": { "type": "boolean" } }, "required": ["attachmentId", "sessionId", "name", "mimeType", "detectedMimeType", "size", "sha256", "createdAt", "committedAt", "referenced"], "additionalProperties": false }, "forkProvenance": { "type": "object", "description": "Where a fork came from (\xA712.7): the source root, and the turn its conversation was cut at.", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "turnId": { "type": "string", "minLength": 1, "maxLength": 200 }, "boundary": { "enum": ["through", "before", "whole"] }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "at": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["sessionId", "boundary", "at"], "additionalProperties": true }, "conversationBranch": { "type": "object", "description": "Later turns a rewind set aside (\xA712.7): kept, never deleted, recoverable as a new session with session.fork { branchId }.", "properties": { "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 }, "turns": { "type": "integer", "minimum": 0 }, "at": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["branchId", "beforeTurnId", "turns", "at"], "additionalProperties": true }, "effectiveConfig": { "type": "object", "description": "The configuration a root runs with, or would after a change, as alpd resolved it (\xA712.9).", "properties": { "team": { "type": "string" }, "teamLabel": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "thinking": { "type": "string" }, "mode": { "type": "string" }, "permissionProfile": { "type": "string", "description": "The permission profile capping the agent's mode, when one does." }, "supervisor": { "type": "boolean" }, "maxPeers": { "type": "integer" }, "delegates": { "type": "array", "items": { "type": "string" }, "description": "Agents the root may delegate to." }, "tools": { "type": "array", "items": { "type": "string" }, "description": "ALP tools the root's agent is given." }, "mcpServers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "kind": { "enum": ["stdio", "http"] } }, "required": ["name", "kind"], "additionalProperties": true } }, "hooks": { "type": "integer", "minimum": 0, "description": "How many hook commands the agent runs." }, "instructionsSha": { "type": "string" } }, "required": ["team", "agent", "runtime", "model", "thinking", "mode", "supervisor", "delegates", "tools", "mcpServers", "hooks"], "additionalProperties": true }, "configurePreview": { "type": "object", "properties": { "current": { "$ref": "#/$defs/effectiveConfig" }, "proposed": { "$ref": "#/$defs/effectiveConfig" }, "changes": { "type": "array", "items": { "enum": ["model", "thinking", "team", "mode"] } }, "restart": { "type": "boolean", "description": "Whether applying it restarts the root's native process (on its own conversation)." }, "allowed": { "type": "boolean", "description": "Whether session.configure would take it now; a busy tree may still refuse it later." }, "reason": { "enum": ["session_busy", "session_closed", "not_root", "runtime_unsupported", "runtime_mismatch", "agent_mismatch", "permission_escalation", "team_not_found", "invalid_params", "not_persistent"] }, "message": { "type": "string" }, "teams": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" } }, "required": ["id", "label"], "additionalProperties": true } } }, "required": ["current", "proposed", "changes", "restart", "allowed", "teams"], "additionalProperties": true }, "configureOutcome": { "type": "object", "properties": { "status": { "enum": ["applied", "unchanged"] }, "requested": { "type": "object", "properties": { "model": { "type": "string" }, "thinking": { "type": "string" }, "team": { "type": "string" }, "mode": { "type": "string" } }, "additionalProperties": false }, "effective": { "$ref": "#/$defs/effectiveConfig" }, "restarted": { "type": "boolean" } }, "required": ["status", "requested", "effective", "restarted"], "additionalProperties": true }, "terminal": { "type": "object", "description": "A terminal as clients see it: ids, size and state, never a process id, shell path or host path.", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "title": { "type": "string", "maxLength": 64 }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "state": { "enum": ["running", "exited"] }, "attached": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "lastActivityAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time" }, "exitCode": { "type": ["integer", "null"] }, "signal": { "type": ["integer", "null"] }, "endReason": { "enum": ["exited", "closed", "idle", "lifetime", "detached", "revoked", "disabled", "shutdown"] }, "protection": { "enum": ["root-only", "none"], "description": "Absent: full native process protection (macOS, supported Linux). root-only: best-effort Linux; closing ends the shell, but processes it started may keep running. none: Windows platform PTY (ConPTY); cleanup is best-effort and not guaranteed. Clients show a non-blocking notice." } }, "required": ["terminalId", "workspaceId", "title", "cols", "rows", "state", "attached", "createdAt", "lastActivityAt", "expiresAt"], "additionalProperties": false }, "terminalEvent": { "description": "params of a terminal.event notification (\xA712.10): sent only to the connection attached to the terminal.", "oneOf": [{ "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "output" }, "seq": { "type": "integer", "minimum": 1 }, "data": { "type": "string", "minLength": 1, "maxLength": 65536 } }, "required": ["terminalId", "type", "seq", "data"], "additionalProperties": false }, { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "exit" }, "seq": { "type": "integer", "minimum": 1 }, "exitCode": { "type": ["integer", "null"] }, "signal": { "type": ["integer", "null"] }, "reason": { "enum": ["exited", "closed", "idle", "lifetime", "detached", "revoked", "disabled", "shutdown"] } }, "required": ["terminalId", "type", "seq", "exitCode", "signal", "reason"], "additionalProperties": false }, { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "detached" }, "reason": { "enum": ["replaced", "slow_consumer"] } }, "required": ["terminalId", "type", "reason"], "additionalProperties": false }] }, "terminalChanged": { "type": "object", "properties": { "watchId": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "cursor": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["watchId", "cursor"], "additionalProperties": false } } };
5726
+ var METHODS_V1 = { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://alp.dev/schemas/methods-v1.json", "protocolVersion": 1, "errors": { "parseError": -32700, "invalidRequest": -32600, "methodNotFound": -32601, "invalidParams": -32602, "failed": 1e3, "notFound": 1001, "forbidden": 1003, "conflict": 1004, "unavailable": 1005, "protocol": 1006 }, "capabilities": { "attach.after": "session.attach accepts `after` and answers `cursor`/`reset`; envelopes kept in a tree timeline carry `cursor`.", "prompt.receipts": "session.prompt is answered at most once per (sessionId, clientMessageId) from a durable receipt; repeats answer the first outcome or outcome_unknown.", "extension.methods": "extension.register/unregister (refused to an agent-marked connection, user_only), and the daemon sends extension.invoke requests to the owning connection, with a `caller: { agent, agentName? }` the daemon sets itself from the calling connection, never from the caller's params.", "team": "team.list: the teams a project can use, from the daemon host's built-ins, library and project.", "task": "task.list, task.create, task.update and task.gate.resolve on a project's .alp/tasks, written by the daemon under the task lock.", "library": "library.list/get/save/delete/duplicate/rename, library.skills.set and library.models on the daemon user's library and a project's .alp overrides; secrets are redacted on read.", "settings.language": "settings.language.get/set: the language the daemon user reads, in the daemon's ALP_HOME/settings.json.", "session.list.page": "session.list accepts `limit`, `cursor` and `query` and answers `nextCursor` while more sessions follow; without them it answers every session as before.", "question.watch": "question.watch: the connection is told of `question` and `question.resolved` in every tree (of a projectRoot when given), attached or not.", "question.watch.turns": "question.watch accepts `turns`: the connection is also told of `turn.ended` of every root in the trees it watches.", "session.attention": "question.watch accepts `attention`: its answer holds each watched root's finished or error attention, kept by alpd for every client, and the connection is told when one is set or cleared (an `attention` event); session.attention.clear acknowledges one.", "workspace.files": "workspace.files.search: files under a directory whose relative path matches a query; read-only, names only, links never followed.", "workspace.files.read": "workspace.files.list and workspace.files.read: the entries of a directory and the content of a UTF-8 text file (at most 1 MiB) under a directory; read-only, links never followed, .git, .env* and key or credential files refused, .gitignore'd paths hidden unless asked.", "workspace.files.browse": "workspace.files.find (every file and directory name under a directory, in pages of a snapshot, by its letters in order or by suffix), workspace.files.preview (a text, image or binary file of at most 50 MiB, its bytes in chunks of at most 8 MiB) and workspace.files.list's cursor and internalLinks (pages past 1000 entries; links whose real path is inside the directory, never outside); read-only, the block list and .gitignore as workspace.files.read. For the daemon host's own clients: the gateway exposes none of it.", "host.directories": "host.directories.search: directories of the daemon host whose path completes a typed path (absolute or under ~) or whose name matches a word under the home directory; names only, links never listed, bounded. For the daemon host's own clients: never remote.", "prompt.images": 'session.prompt takes inline image parts { type: "image", mimeType, data } (base64, no paths or URLs) within the image limits; a session snapshot says whether its runtime takes them in promptImages.', "library.project.write": "library save/delete/duplicate/rename accept policy project-data: only project-only pure-data agents and skills, no executable configuration, sidecars or library/built-in collisions.", "schedule": "schedule.create/list/get/cancel: one-shot continuations of a root session. alpd opens the turn by itself when the time comes; a job that comes due late says how late it is, and a job that cannot run says why.", "session.history": "Durable bounded backward envelope pages, persisted generation and numeric attach watermark.", "workspace.registry": "Daemon-owned project/workspace registry, durable pins, revision CAS and requestId replay.", "workspace.worktree": "Host-approved managed user worktrees; opt-in workspace.manage and named destination mappings.", "workspace.git": "workspace.git.status and workspace.git.diff: a registered workspace's read-only Git status and structured diff hunks by workspaceId; enumerated comparisons only, bounded (1 MiB per file, 2 MiB per page, 200 untracked files) with an opaque snapshot and next cursor; blocked secret paths withheld on both sides of a rename; no Git mutation.", "workspace.git.facts": "workspace.git.facts: the read-only Git checkout facts (repository root, branch, HEAD, remote, dirty) of an absolute host directory that need not be a registry workspace: a repository's top level (ok), a folder nested in one (not_repository_root, facts of the enclosing repository), no repository at or above it (unknown) or one alpd will not read (unsupported); owner only, never forwarded by a gateway; no Git mutation.", "attachments": 'attachment.begin/chunk/commit/abort/get/delete: daemon-owned immutable non-image attachments by opaque id, uploaded in bounded chunks, and session.prompt content parts `{ type: "attachment", attachmentId }`; daemon.hello carries `attachmentLimits`. Listed only with a home and a store, on macOS and Linux.', "session.fork": "session.fork: a new root whose conversation is a root's up to a completed turn (or a branch a rewind set aside), by native fork of Codex and Claude sessions; files are never copied or changed. Listed with a store and a runtime that forks native conversations, on macOS and Linux (not Windows).", "session.rewind": "session.rewind: a root's conversation from before a turn on, under the same session id; the later turns stay a recoverable branch, files are never changed, history generation advances (`history.reset` event). Same condition as session.fork.", "session.reload": "session.reload: restarts a live root's native process on its own conversation and configuration at the idle barrier (no turn, child, question, mail or parked work), keeping its session id, history and receipts; through the lifecycle journal. Listed with a store and a runtime that restarts a root on its own conversation, on macOS and Linux (not Windows).", "session.resumeCommand": "session.resumeCommand: the ALP CLI command (`alp attach <sessionId>`) that follows a session in a terminal, as argv and POSIX and Windows (cmd.exe) command lines built by alpd; for the clipboard only, never run, never a native runtime's command, credential, env or path.", "session.commands": `session.commands: the slash commands and skills a live session's composer offers after "/" (its runtime's, then its agent's ALP skills): names, descriptions and argument hints only, never a path.`, "session.configure.live": "session.configure takes model, thinking and team (with requestId and ifGeneration) besides mode, and session.configure.preview answers the configuration a change would run with: a live root's model, effort or team changes at the idle barrier (no turn, child, question, mail or parked work) through a controlled restart of its native process on the same conversation; the effective configuration is written only after the runtime took it, through the lifecycle journal (\xA712.9). Never another runtime and never more permissions. Listed with a store and a runtime that restarts a root with a new configuration, on macOS and Linux (not Windows).", "terminal": "terminal.create/list/attach/input/resize/close/revoke and terminal.event notifications: a real PTY shell on the daemon host as the daemon's account (a cwd is not a sandbox), served only when the host owner opted in (<ALP_HOME>/terminal.json allowRemoteTerminal) on macOS (full protection), Linux and Windows (best-effort).", "session.interrupt.turn": "session.interrupt accepts turnId and atomically cancels only that active turn, including its subtree. Conditional requests answer interrupted:true when canceled, false when the named turn is no longer active; false changes nothing. Without this capability clients must not send turnId or infer targeted cancellation from a legacy interrupt.", "terminal.capture": "terminal.capture: bounded daemon-owned rendered text, inclusive zero-based/negative line ranges; same terminal principal/host opt-in. Exceeding resource/result limits is an explicit refusal.", "terminal.watch": "terminal.watch/unwatch and terminal.changed: atomic scoped snapshot/subscription. Opaque per-subscription cursor, latest snapshot replaces invalidation history on reconnect/reset; older hosts use explicit polling fallback.", "catalog.live": "catalog.get answers the live model catalog (provider lists merged over ALP's static rows) with fetchedAt and per-provider status; catalog.refresh asks the providers again and probes enabled ACP providers. ACP providers (library providers/<id>.json) add rows acp:<id> and acp:<id>/<model> with runtime, provider, source, enabled and status, and a providers key acp:<id> whose status is unprobed, ok or failed; alpd sends catalog.updated to every helloed connection when the catalog changes." }, "methods": { "assignment.recall": { "x-alp": { "effect": "mutation", "scope": { "kind": "project", "param": "projectRoot", "required": false, "alternatives": ["assignmentId", "taskId"] }, "idempotent": false, "risks": ["model call"] }, "params": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "taskId": { "type": "string" }, "projectRoot": { "type": "string" }, "question": { "type": "string" } }, "required": ["question"], "additionalProperties": true }, "result": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "agent": { "type": "string" }, "taskId": { "type": "string" }, "finishedAt": { "type": "string" }, "answer": { "type": "string" } }, "required": ["assignmentId", "agent", "finishedAt", "answer"], "additionalProperties": true } }, "board.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "pins": { "type": "array", "items": { "$ref": "#/$defs/pin" } } }, "required": ["pins"], "additionalProperties": true } }, "catalog.get": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object" } }, "modes": { "type": "array", "items": { "type": "object" } }, "thinkingOptions": {}, "defaultModel": { "type": "string" }, "fetchedAt": { "type": "string" }, "providers": { "type": "object" } }, "required": ["models", "modes", "defaultModel"], "additionalProperties": true } }, "catalog.refresh": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object" } }, "modes": { "type": "array", "items": { "type": "object" } }, "thinkingOptions": {}, "defaultModel": { "type": "string" }, "fetchedAt": { "type": "string" }, "providers": { "type": "object" } }, "required": ["models", "modes", "defaultModel"], "additionalProperties": true } }, "daemon.hello": { "x-alp": { "effect": "query", "scope": { "kind": "connection" }, "idempotent": true }, "params": { "type": "object", "properties": { "protocolVersion": { "const": 1 }, "client": { "type": "object", "properties": { "name": { "type": "string" }, "version": { "type": "string" } }, "required": ["name", "version"], "additionalProperties": true }, "capabilities": { "type": "array", "items": { "type": "string" } } }, "required": ["protocolVersion"], "additionalProperties": true }, "result": { "type": "object", "properties": { "protocolVersion": { "const": 1 }, "daemonVersion": { "type": "string" }, "pid": { "type": "integer" }, "hostname": { "type": "string" }, "capabilities": { "type": "array", "items": { "type": "string" } }, "promptImageLimits": { "type": "object", "description": "Optional effective inline image limits for this connection, when prompt.images is advertised. Missing on older peers. Byte limits count decoded bytes.", "properties": { "maxCount": { "type": "integer", "minimum": 0 }, "maxBytes": { "type": "integer", "minimum": 0 }, "maxTotalBytes": { "type": "integer", "minimum": 0 } }, "required": ["maxCount", "maxBytes", "maxTotalBytes"], "additionalProperties": false }, "attachmentLimits": { "type": "object", "description": "Effective attachment limits for this connection, when `attachments` is advertised. Byte limits count decoded bytes; times are milliseconds. An operator or a gateway may lower them, never raise them.", "properties": { "maxObjectBytes": { "type": "integer", "minimum": 0 }, "maxPerPrompt": { "type": "integer", "minimum": 0 }, "maxPromptBytes": { "type": "integer", "minimum": 0 }, "maxChunkBytes": { "type": "integer", "minimum": 0 }, "maxActiveUploads": { "type": "integer", "minimum": 0 }, "maxPrincipalBytes": { "type": "integer", "minimum": 0 }, "maxDaemonBytes": { "type": "integer", "minimum": 0 }, "uploadTimeoutMs": { "type": "integer", "minimum": 0 }, "unreferencedRetentionMs": { "type": "integer", "minimum": 0 }, "releasedGraceMs": { "type": "integer", "minimum": 0 } }, "required": ["maxObjectBytes", "maxPerPrompt", "maxPromptBytes", "maxChunkBytes", "maxActiveUploads", "maxPrincipalBytes", "maxDaemonBytes", "uploadTimeoutMs", "unreferencedRetentionMs", "releasedGraceMs"], "additionalProperties": false }, "terminalLimits": { "type": "object", "description": "Effective terminal limits for this connection, when `terminal` is advertised. Byte limits count UTF-8 bytes; times are milliseconds. An operator or a gateway may lower them, never raise them.", "properties": { "maxPerPrincipal": { "type": "integer", "minimum": 0 }, "maxPerDaemon": { "type": "integer", "minimum": 0 }, "maxInputBytes": { "type": "integer", "minimum": 0 }, "maxOutputFrameBytes": { "type": "integer", "minimum": 0 }, "replayBytes": { "type": "integer", "minimum": 0 }, "idleMs": { "type": "integer", "minimum": 0 }, "maxLifetimeMs": { "type": "integer", "minimum": 0 }, "reconnectMs": { "type": "integer", "minimum": 0 } }, "required": ["maxPerPrincipal", "maxPerDaemon", "maxInputBytes", "maxOutputFrameBytes", "replayBytes", "idleMs", "maxLifetimeMs", "reconnectMs"], "additionalProperties": false } }, "required": ["protocolVersion"], "additionalProperties": true } }, "daemon.pause": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": { "runtime": { "enum": ["codex", "claude", "acp", "antigravity"] }, "now": { "type": "boolean" }, "reason": { "type": "string" } }, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.pauses": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.resume": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": { "runtime": { "enum": ["codex", "claude", "acp", "antigravity"] } }, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.shutdown": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "daemon.status": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "pid": { "type": "integer" }, "startedAt": { "type": "string" }, "version": { "type": "string" }, "protocolVersion": { "type": "integer" }, "sessions": { "type": "integer" }, "questions": { "type": "integer" }, "previousExit": { "type": "object", "properties": { "kind": { "enum": ["clean", "crash"] }, "at": { "type": "string" } }, "required": ["kind"], "additionalProperties": true }, "persistence": { "type": "object" }, "health": { "$ref": "#/$defs/health" } }, "required": ["pid", "startedAt", "version", "protocolVersion", "sessions", "questions", "health"], "additionalProperties": true } }, "daemon.usage": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true, "risks": ["refresh asks every provider (spawns on the daemon host)"] }, "params": { "type": "object", "properties": { "refresh": { "type": "boolean" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "providers": { "type": "array", "items": { "type": "object" } } }, "required": ["providers"], "additionalProperties": true } }, "extension.register": { "x-alp": { "effect": "mutation", "scope": { "kind": "connection" }, "idempotent": false, "risks": ["admin"] }, "params": { "type": "object", "properties": { "method": { "type": "string" } }, "required": ["method"], "additionalProperties": true }, "result": { "type": "object", "properties": { "registered": { "type": "string" } }, "required": ["registered"], "additionalProperties": true } }, "extension.unregister": { "x-alp": { "effect": "mutation", "scope": { "kind": "connection" }, "idempotent": false, "risks": ["admin"] }, "params": { "type": "object", "properties": { "method": { "type": "string" } }, "required": ["method"], "additionalProperties": true }, "result": { "type": "object", "properties": { "unregistered": { "type": "string" } }, "required": ["unregistered"], "additionalProperties": true } }, "library.delete": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": false }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "revision": { "type": "string" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "name", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "removed": { "const": true }, "now": { "enum": ["builtin", "library"] } }, "required": ["removed"], "additionalProperties": true } }, "library.duplicate": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope", "reads": ["builtin", "library"] }, "idempotent": false, "risks": ["exec-config when kind is mcp, hooks or providers"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "from": { "$ref": "#/$defs/entryName" }, "to": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "from", "to", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" } }, "required": ["revision"], "additionalProperties": true } }, "library.get": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true, "redacts": ["mcp /server/env/*", "mcp /server/headers/*", "providers /provider/env/*"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "scope": { "$ref": "#/$defs/libraryScope" } }, "required": ["kind", "name"], "additionalProperties": true }, "result": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "content": { "type": "object" }, "revision": { "$ref": "#/$defs/libraryRevision" }, "usedBy": { "type": "array", "items": { "type": "string" } }, "librarySkills": { "type": "array", "items": { "type": "string" } }, "secrets": { "type": "array", "items": { "type": "string" } } }, "required": ["kind", "name", "source", "content", "revision", "usedBy"], "additionalProperties": true } }, "library.list": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["kind"], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": ["string", "null"] }, "entries": { "type": "array", "items": { "$ref": "#/$defs/libraryEntryRow" } } }, "required": ["projectRoot", "entries"], "additionalProperties": true } }, "library.models": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "efforts": { "type": "array", "items": { "type": "string" } }, "effort": { "type": "string" } }, "required": ["id", "label", "efforts"], "additionalProperties": true } } }, "required": ["models"], "additionalProperties": true } }, "library.rename": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": false, "risks": ["exec-config when kind is mcp, hooks or providers"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "from": { "$ref": "#/$defs/entryName" }, "to": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "from", "to", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" } }, "required": ["revision"], "additionalProperties": true } }, "library.save": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": "with revision (a repeat fails revision_conflict)", "risks": ["exec-config when kind is mcp, hooks or providers, or agents naming mcp/hooks/provider", "writes every known project's .alp/settings.json when kind is teams and sync is known-projects"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "content": { "type": "object" }, "revision": { "$ref": "#/$defs/libraryRevision" }, "sync": { "enum": ["none", "known-projects"] }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "name", "scope", "content"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" }, "syncedProjects": { "type": "integer", "minimum": 0 }, "syncErrors": { "type": "array", "items": { "type": "string" } } }, "required": ["revision"], "additionalProperties": true } }, "library.skills.set": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "host" }, "writes": ["ALP_HOME/role-skills.json"], "idempotent": true }, "params": { "type": "object", "properties": { "agent": { "$ref": "#/$defs/entryName" }, "skills": { "type": "array", "items": { "$ref": "#/$defs/entryName" }, "maxItems": 100 } }, "required": ["agent", "skills"], "additionalProperties": true }, "result": { "type": "object", "properties": { "skills": { "type": "array", "items": { "type": "string" } } }, "required": ["skills"], "additionalProperties": true } }, "question.answer": { "x-alp": { "effect": "mutation", "scope": { "kind": "question", "param": "questionId", "prefix": true }, "idempotent": false }, "params": { "type": "object", "properties": { "questionId": { "type": "string" }, "text": { "type": "string" }, "dismiss": { "type": "boolean" }, "reason": { "type": "string" } }, "required": ["questionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "questionId": { "type": "string" } }, "required": ["questionId"], "additionalProperties": true } }, "question.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } } }, "required": ["questions"], "additionalProperties": true } }, "question.watch": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true, "capability": "question.watch" }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "turns": { "type": "boolean" }, "attention": { "type": "boolean" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "attention": { "type": "array", "items": { "type": "object", "properties": { "sessionId": { "type": "string" }, "attention": { "$ref": "#/$defs/attention" } }, "required": ["sessionId", "attention"], "additionalProperties": true } } }, "required": ["questions"], "additionalProperties": true } }, "session.attention.clear": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true, "capability": "session.attention" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "at": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "cleared": { "type": "boolean" } }, "required": ["cleared"], "additionalProperties": true } }, "schedule.create": { "x-alp": { "effect": "mutation", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["ALP_HOME/schedules"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "dueAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?(Z|[+-]\\d{2}:\\d{2})$" }, "prompt": { "type": "string", "minLength": 1, "maxLength": 8e3, "pattern": "\\S" }, "keepsSession": { "type": "boolean" } }, "required": ["projectRoot", "sessionId", "dueAt", "prompt"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "schedule.list": { "x-alp": { "effect": "query", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "status": { "enum": ["pending", "delivered", "failed", "cancelled"] } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "jobs": { "type": "array", "items": { "$ref": "#/$defs/scheduleJob" } } }, "required": ["jobs"], "additionalProperties": true } }, "schedule.get": { "x-alp": { "effect": "query", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["id", "projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "schedule.cancel": { "x-alp": { "effect": "mutation", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["ALP_HOME/schedules"], "idempotent": true }, "params": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["id", "projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "session.archive": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "archived": { "type": "boolean" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.attach": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "replay": { "type": "boolean" }, "after": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "generation": { "type": "string", "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "cursor": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "reset": { "const": true } }, "required": ["session", "cursor"], "additionalProperties": true } }, "session.close": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": false }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "session.compact": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "risks": ["main writes a checkpoint in a turn of its own, then its context is compacted natively or replaced by a fresh conversation seeded with the checkpoint"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "status": { "enum": ["started", "deferred", "running"] } }, "required": ["status"], "additionalProperties": false } }, "session.commands": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.commands", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "commands": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\s\\u0000-\\u001f\\u007f]+$" }, "description": { "type": "string", "maxLength": 4096 }, "argumentHint": { "type": "string", "maxLength": 256 }, "kind": { "enum": ["command", "skill"] } }, "required": ["name", "description", "kind"], "additionalProperties": false } } }, "required": ["commands"], "additionalProperties": false } }, "session.configure": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": "mode alone: yes; with model, thinking or team: with requestId", "risks": ["with model, thinking or team: restarts the root's native process on its own conversation; never another runtime, never more permissions"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "mode": { "type": "string" }, "model": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Native model, or runtime-prefixed (codex:/claude:); the session's own runtime only (capability session.configure.live)." }, "thinking": { "type": "string", "minLength": 1, "maxLength": 200, "description": "An effort the model takes (capability session.configure.live)." }, "team": { "type": "string", "minLength": 1, "maxLength": 200, "description": "A team id the daemon host defines (capability session.configure.live); no path or configuration." }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["sessionId"], "anyOf": [{ "not": { "anyOf": [{ "required": ["model"] }, { "required": ["thinking"] }, { "required": ["team"] }] } }, { "required": ["requestId", "ifGeneration"] }], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/session" }, "configured": { "$ref": "#/$defs/configureOutcome" }, "duplicate": { "const": true } }, "required": ["session"], "additionalProperties": true } }, "session.configure.preview": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.configure.live", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "mode": { "type": "string" }, "model": { "type": "string", "minLength": 1, "maxLength": 200 }, "thinking": { "type": "string", "minLength": 1, "maxLength": 200 }, "team": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "preview": { "$ref": "#/$defs/configurePreview" } }, "required": ["preview"], "additionalProperties": true } }, "session.create": { "x-alp": { "effect": "mutation", "scope": { "kind": "project", "param": "spec.cwd" }, "idempotent": false, "risks": ["exec: spec.env and stdio spec.mcpServers run on the daemon host", "spec.workdir/writeRoot/copy*/restore/keepThread are internal"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" }, "spec": { "anyOf": [{ "$ref": "#/$defs/spec" }, { "type": "object", "properties": { "agent": { "type": "string" }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "persist": { "type": "boolean" }, "workflow": { "type": "string" } }, "required": [], "additionalProperties": false }] }, "history": { "enum": ["skip", "replay"] }, "delegation": { "type": "boolean" }, "resume": { "type": "boolean" }, "workspaceId": { "type": "string" } }, "required": ["spec"], "additionalProperties": true, "anyOf": [{ "required": ["workspaceId"] }, { "properties": { "spec": { "$ref": "#/$defs/spec" } } }] }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/session" }, "attached": { "type": "boolean" }, "resumed": { "const": true }, "durable": { "type": "boolean" } }, "required": ["session", "attached"], "additionalProperties": true } }, "session.get": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.interrupt": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "turnId": { "type": "string", "minLength": 1 } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "interrupted": { "type": "boolean" } }, "required": [], "additionalProperties": true } }, "session.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "rootsOnly": { "type": "boolean" }, "includeClosed": { "type": "boolean" }, "includeArchived": { "type": "boolean" }, "limit": { "type": "integer", "minimum": 1, "maximum": 1e3 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "query": { "type": "string", "maxLength": 200 }, "projectRoots": { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": 1024 } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "sessions": { "type": "array", "items": { "$ref": "#/$defs/sessionSummary" } }, "nextCursor": { "type": "string", "minLength": 1 } }, "required": ["sessions"], "additionalProperties": true } }, "session.log": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "rootId": { "type": "string" }, "entries": { "type": "array", "items": { "type": "object" } } }, "required": ["rootId", "entries"], "additionalProperties": true } }, "session.message": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": false }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "text": { "type": "string" } }, "required": ["sessionId", "text"], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "session.preview": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "spec.cwd" }, "idempotent": true }, "params": { "type": "object", "properties": { "spec": { "$ref": "#/$defs/spec" } }, "required": ["spec"], "additionalProperties": true }, "result": { "type": "object", "properties": { "preview": { "$ref": "#/$defs/preview" } }, "required": ["preview"], "additionalProperties": true } }, "session.prompt": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": "with prompt.receipts" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "clientMessageId": { "type": "string" }, "delivery": { "enum": ["auto", "steer"] }, "content": { "type": "array", "items": { "anyOf": [{ "type": "object", "properties": { "type": { "const": "text" }, "text": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "$ref": "#/$defs/promptImage" }, { "type": "object", "properties": { "type": { "const": "attachment" }, "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" } }, "required": ["type", "attachmentId"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["text", "image", "attachment"] } } }, "required": ["type"], "additionalProperties": true }] } }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "clientMessageId", "content"], "additionalProperties": true }, "result": { "type": "object", "properties": { "outcome": { "enum": ["accepted", "failed"] }, "error": { "$ref": "#/$defs/alpError" }, "duplicate": { "type": "boolean" }, "durable": { "type": "boolean" } }, "required": [], "additionalProperties": true } }, "session.release": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "closed": { "type": "boolean" } }, "required": ["closed"], "additionalProperties": true } }, "session.rename": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S" } }, "required": ["sessionId", "title"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.status": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "status": { "$ref": "#/$defs/treeStatus" } }, "required": ["status"], "additionalProperties": true } }, "settings.language.get": { "x-alp": { "effect": "query", "capability": "settings.language", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/languageSetting" } }, "settings.language.set": { "x-alp": { "effect": "mutation", "capability": "settings.language", "scope": { "kind": "host" }, "writes": ["ALP_HOME/settings.json"], "idempotent": true }, "params": { "type": "object", "properties": { "language": { "anyOf": [{ "type": "string", "minLength": 1, "maxLength": 40, "pattern": "\\S" }, { "type": "null" }] } }, "required": ["language"], "additionalProperties": true }, "result": { "$ref": "#/$defs/languageSetting" } }, "task.create": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": "per requestId within one alpd process (10 minutes)" }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "title": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S" }, "priority": { "type": "integer", "minimum": 0, "maximum": 4 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["projectRoot", "title"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "duplicate": { "const": true } }, "required": ["id"], "additionalProperties": true } }, "task.gate.resolve": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "id": { "$ref": "#/$defs/taskId" }, "gate": { "type": "string", "minLength": 1, "maxLength": 128 }, "note": { "type": "string", "maxLength": 2e3 }, "ifRev": { "type": "integer", "minimum": 0 }, "choice": { "type": "string", "minLength": 1, "maxLength": 200 }, "reject": { "type": "boolean" }, "channel": { "type": "string", "enum": ["paseo", "web"] } }, "required": ["projectRoot", "id", "gate"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "status": { "type": "string" }, "rev": { "type": "integer", "minimum": 0 } }, "required": ["id", "status", "rev"], "additionalProperties": true } }, "task.list": { "x-alp": { "effect": "query", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "tasks": { "type": "array", "items": { "$ref": "#/$defs/taskRow" } }, "unreadable": { "type": "array", "items": { "type": "object", "properties": { "file": { "type": "string" }, "error": { "type": "string" } }, "required": ["file", "error"], "additionalProperties": true } }, "revision": { "type": "string" } }, "required": ["projectRoot", "tasks", "unreadable", "revision"], "additionalProperties": true } }, "task.update": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "id": { "$ref": "#/$defs/taskId" }, "action": { "enum": ["close", "reopen"] }, "note": { "type": "string", "maxLength": 2e3 }, "ifRev": { "type": "integer", "minimum": 0 } }, "required": ["projectRoot", "id", "action"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "status": { "type": "string" }, "rev": { "type": "integer", "minimum": 0 }, "landed": { "type": "string" } }, "required": ["id", "status", "rev"], "additionalProperties": true } }, "team.list": { "x-alp": { "effect": "query", "capability": "team", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": ["string", "null"] }, "teams": { "type": "array", "items": { "$ref": "#/$defs/teamRow" } } }, "required": ["projectRoot", "teams"], "additionalProperties": true } }, "workspace.files.search": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files", "risks": ["lists file names of the directory (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "query": { "type": "string", "maxLength": 200 }, "limit": { "type": "integer", "minimum": 1, "maximum": 100 } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "files": { "type": "array", "maxItems": 100, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 } }, "required": ["path"], "additionalProperties": true } }, "truncated": { "type": "boolean" } }, "required": ["files"], "additionalProperties": true } }, "workspace.files.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.read", "risks": ["lists names, kinds, sizes and times of a directory's entries (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "internalLinks": { "type": "boolean" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "path": { "type": "string", "minLength": 1 }, "kind": { "enum": ["file", "directory"] }, "size": { "type": "integer", "minimum": 0 }, "modifiedAt": { "type": "string" }, "target": { "type": "string", "minLength": 1 } }, "required": ["name", "path", "kind"], "additionalProperties": true } }, "truncated": { "type": "boolean" }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "target": { "type": "string", "minLength": 1 } }, "required": ["entries"], "additionalProperties": true } }, "workspace.files.read": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.read", "risks": ["returns the content of a text file under the directory"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" } }, "required": ["projectRoot", "path"], "additionalProperties": true }, "result": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "content": { "type": "string" }, "size": { "type": "integer", "minimum": 0, "maximum": 1048576 }, "modifiedAt": { "type": "string" } }, "required": ["path", "content", "size"], "additionalProperties": true } }, "workspace.files.find": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.browse", "risks": ["lists every file and directory name of the directory (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "query": { "type": "string", "maxLength": 200 }, "kinds": { "type": "array", "items": { "enum": ["file", "directory"] }, "minItems": 1, "maxItems": 2, "uniqueItems": true }, "matchMode": { "enum": ["subsequence", "suffix"] }, "limit": { "type": "integer", "minimum": 1, "maximum": 1e3 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 256 } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "kind": { "enum": ["file", "directory"] } }, "required": ["path", "kind"], "additionalProperties": true } }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 256 }, "truncated": { "type": "boolean" } }, "required": ["entries"], "additionalProperties": true } }, "workspace.files.preview": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.browse", "risks": ["returns the bytes of a file under the directory, text, image or binary, up to 50 MiB in chunks"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" }, "internalLinks": { "type": "boolean" }, "maxBytes": { "type": "integer", "minimum": 1, "maximum": 52428800 }, "offset": { "type": "integer", "minimum": 0, "maximum": 52428800 }, "revision": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["projectRoot", "path"], "additionalProperties": true }, "result": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "target": { "type": "string", "minLength": 1 }, "kind": { "enum": ["text", "image", "binary"] }, "mimeType": { "type": "string", "minLength": 1, "maxLength": 255 }, "size": { "type": "integer", "minimum": 0, "maximum": 52428800 }, "modifiedAt": { "type": "string" }, "revision": { "type": "string", "minLength": 1, "maxLength": 64 }, "encoding": { "enum": ["base64", "none"] }, "content": { "type": "string", "maxLength": 11184812 }, "offset": { "type": "integer", "minimum": 0 }, "nextOffset": { "type": "integer", "minimum": 1 } }, "required": ["path", "kind", "mimeType", "size", "modifiedAt", "revision", "encoding"], "additionalProperties": true } }, "host.directories.search": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true, "capability": "host.directories", "risks": ["lists names of directories on the daemon host outside any workspace"] }, "params": { "type": "object", "properties": { "query": { "type": "string", "maxLength": 4096 }, "limit": { "type": "integer", "minimum": 1, "maximum": 100 } }, "required": ["query"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 100, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 } }, "required": ["path"], "additionalProperties": true } }, "truncated": { "type": "boolean" } }, "required": ["entries"], "additionalProperties": true } }, "session.history": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true, "capability": "session.history" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "before": { "type": "string", "maxLength": 4096 }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "maxBytes": { "type": "integer", "minimum": 2048, "maximum": 524288 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "generation": { "type": "string" }, "items": { "type": "array", "maxItems": 500, "items": { "oneOf": [{ "$ref": "#/$defs/envelope" }, { "type": "object", "properties": { "cursor": { "type": "integer", "minimum": 0 }, "oversized": { "type": "object", "properties": { "bytes": { "type": "integer", "minimum": 1 } }, "required": ["bytes"] } }, "required": ["cursor", "oversized"], "additionalProperties": false }] } }, "olderCursor": { "type": "string" }, "hasOlder": { "type": "boolean" }, "tipCursor": { "type": "integer", "minimum": 0 } }, "required": ["generation", "items", "hasOlder", "tipCursor"], "additionalProperties": true } }, "project.list": { "params": { "type": "object", "properties": { "cursor": { "type": "string", "pattern": "^[0-9]+$" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "projectRoots": { "type": "array", "items": { "type": "string" } }, "includeRemoved": { "type": "boolean" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "projects": { "type": "array", "items": { "$ref": "#/$defs/registryProject" } }, "revision": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": ["string", "null"] } }, "required": ["projects", "revision", "total", "nextCursor"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.list": { "params": { "type": "object", "properties": { "cursor": { "type": "string", "pattern": "^[0-9]+$" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "projectRoots": { "type": "array", "items": { "type": "string" } }, "includeArchived": { "type": "boolean" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspaces": { "type": "array", "items": { "$ref": "#/$defs/registryWorkspace" } }, "revision": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": ["string", "null"] } }, "required": ["workspaces", "revision", "total", "nextCursor"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.get": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "project.register": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "directory": { "type": "string" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["directory", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "project": { "$ref": "#/$defs/registryProject" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["project", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "project.remove": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "projectId": { "type": "string" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["projectId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "project": { "$ref": "#/$defs/registryProject" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["project", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.update": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "workspaceId": { "type": "string" }, "title": { "type": ["string", "null"] }, "pinned": { "type": "boolean" }, "archived": { "type": "boolean" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["workspaceId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "registry.owner": { "params": { "type": "object", "properties": { "operation": { "enum": ["project.add", "project.rename", "project.remove", "workspace.create", "workspace.update", "placement.prepare", "placement.assign", "label.assign", "label.update", "label.delete", "placement.remove"] }, "args": { "type": "object" }, "requestId": { "type": "string" }, "ifRevision": { "type": "integer", "minimum": 0 } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "registry": { "type": "object" } }, "required": ["registry"] }, "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "capability": "workspace.registry", "idempotent": false } }, "workspace.worktree.create": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "mappingId": { "type": "string", "maxLength": 64 }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId", "requestId", "ifRevision", "mappingId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 }, "filesRemoved": { "type": "boolean" }, "branchRetained": { "type": "boolean" } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "workspace.worktree.remove": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 }, "filesRemoved": { "type": "boolean" }, "branchRetained": { "type": "boolean" } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "workspace.worktree.options": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "mappingIds": { "type": "array", "items": { "type": "string" } } }, "required": ["mappingIds"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "registry.worktree": { "params": { "type": "object", "properties": { "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "principalEpoch": { "type": "string" } }, "additionalProperties": false }, "result": { "type": "object", "additionalProperties": true }, "x-alp": { "effect": "query", "scope": { "kind": "host" }, "capability": "workspace.worktree" } }, "workspace.git.status": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.git", "idempotent": true, "risks": ["lists the changed file paths, branch and remote of a workspace checkout"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1 } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "state": { "enum": ["repository", "not_repository", "unsupported"] }, "reason": { "type": "string" }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "upstream": { "type": ["object", "null"], "properties": { "ref": { "type": "string" }, "ahead": { "type": "integer", "minimum": 0 }, "behind": { "type": "integer", "minimum": 0 } }, "required": ["ref", "ahead", "behind"], "additionalProperties": false }, "baseRef": { "type": ["string", "null"] }, "aheadBehind": { "type": ["object", "null"], "properties": { "ahead": { "type": "integer", "minimum": 0 }, "behind": { "type": "integer", "minimum": 0 } }, "required": ["ahead", "behind"], "additionalProperties": false }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" }, "files": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "oldPath": { "type": "string", "minLength": 1, "maxLength": 4096 }, "change": { "enum": ["modified", "added", "deleted", "renamed", "copied", "typechange", "untracked", "conflicted"] }, "staged": { "type": "boolean" }, "unstaged": { "type": "boolean" } }, "required": ["path", "change", "staged", "unstaged"], "additionalProperties": false } }, "hiddenCount": { "type": "integer", "minimum": 0 }, "truncated": { "type": "boolean" }, "snapshot": { "type": "string", "maxLength": 1024 } }, "required": ["state", "branch", "detached", "head", "upstream", "baseRef", "aheadBehind", "hasRemote", "remoteUrl", "dirty", "files", "hiddenCount", "truncated", "snapshot"], "additionalProperties": false } }, "workspace.git.facts": { "x-alp": { "effect": "query", "scope": { "kind": "host", "param": "directory" }, "capability": "workspace.git.facts", "idempotent": true, "risks": ["names the host path, branch and remote of a directory's enclosing Git checkout (owner only, never remote)"] }, "params": { "type": "object", "properties": { "directory": { "type": "string", "minLength": 1, "maxLength": 4096 } }, "required": ["directory"], "additionalProperties": false }, "result": { "oneOf": [{ "type": "object", "properties": { "kind": { "const": "ok" }, "repoRoot": { "type": "string", "minLength": 1 }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" } }, "required": ["kind", "repoRoot", "branch", "detached", "head", "hasRemote", "remoteUrl", "dirty"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "not_repository_root" }, "repoRoot": { "type": "string", "minLength": 1 }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" } }, "required": ["kind", "repoRoot", "branch", "detached", "head", "hasRemote", "remoteUrl", "dirty"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "unknown" } }, "required": ["kind"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "const": "unsupported" }, "reason": { "enum": ["worktree_elsewhere", "inside_git_dir"] } }, "required": ["kind", "reason"], "additionalProperties": false }] } }, "workspace.git.diff": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.git", "idempotent": true, "risks": ["returns changed file content of a workspace checkout as diff hunks, including deleted and historical lines"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1 }, "compare": { "type": "object", "properties": { "mode": { "enum": ["uncommitted", "staged", "unstaged", "base"] }, "baseRef": { "type": "string", "minLength": 1, "maxLength": 255 }, "ignoreWhitespace": { "type": "boolean" } }, "required": ["mode"], "additionalProperties": false }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": ["workspaceId", "compare"], "additionalProperties": false }, "result": { "type": "object", "properties": { "compare": { "type": "object", "properties": { "mode": { "enum": ["uncommitted", "staged", "unstaged", "base"] }, "baseRef": { "type": "string" }, "ignoreWhitespace": { "type": "boolean" } }, "required": ["mode", "ignoreWhitespace"], "additionalProperties": false }, "snapshot": { "type": "string", "maxLength": 1024 }, "files": { "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "oldPath": { "type": "string", "minLength": 1, "maxLength": 4096 }, "change": { "enum": ["modified", "added", "deleted", "renamed", "copied", "typechange", "untracked", "conflicted"] }, "kind": { "enum": ["text", "binary", "too_large", "withheld", "symlink", "submodule"] }, "additions": { "type": "integer", "minimum": 0 }, "deletions": { "type": "integer", "minimum": 0 }, "hunks": { "type": "array", "items": { "type": "object", "properties": { "oldStart": { "type": "integer", "minimum": 0 }, "oldCount": { "type": "integer", "minimum": 0 }, "newStart": { "type": "integer", "minimum": 0 }, "newCount": { "type": "integer", "minimum": 0 }, "context": { "type": "string" }, "lines": { "type": "array", "items": { "type": "object", "properties": { "type": { "enum": ["add", "remove", "context"] }, "content": { "type": "string" }, "noNewline": { "const": true } }, "required": ["type", "content"], "additionalProperties": false } } }, "required": ["oldStart", "oldCount", "newStart", "newCount", "lines"], "additionalProperties": false } } }, "required": ["path", "change", "kind", "additions", "deletions", "hunks"], "additionalProperties": false } }, "hiddenCount": { "type": "integer", "minimum": 0 }, "truncated": { "type": "boolean" }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": ["compare", "snapshot", "files", "hiddenCount", "truncated"], "additionalProperties": false } }, "attachment.begin": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "attachments", "idempotent": "with requestId", "risks": ["reserves stored bytes of the daemon host for a file the client uploads"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 1024 }, "size": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "name", "size", "mimeType", "requestId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "state": { "enum": ["uploading", "committed"] }, "received": { "type": "integer", "minimum": 0 }, "size": { "type": "integer", "minimum": 0 }, "maxChunkBytes": { "type": "integer", "minimum": 1 }, "expiresAt": { "type": "string" }, "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" } }, "required": ["uploadId", "state", "received", "size", "maxChunkBytes"], "additionalProperties": false } }, "attachment.chunk": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": "same offset and bytes", "risks": ["writes uploaded bytes to the daemon host"] }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "offset": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "data": { "type": "string", "minLength": 4, "maxLength": 349528, "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId", "offset", "data"], "additionalProperties": false }, "result": { "type": "object", "properties": { "received": { "type": "integer", "minimum": 0 }, "size": { "type": "integer", "minimum": 0 } }, "required": ["received", "size"], "additionalProperties": false } }, "attachment.commit": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": true }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId", "sha256"], "additionalProperties": false }, "result": { "type": "object", "properties": { "attachment": { "$ref": "#/$defs/attachment" } }, "required": ["attachment"], "additionalProperties": false } }, "attachment.abort": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": false }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "aborted": { "const": true } }, "required": ["aborted"], "additionalProperties": false } }, "attachment.get": { "x-alp": { "effect": "query", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": true }, "params": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["attachmentId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "attachment": { "$ref": "#/$defs/attachment" } }, "required": ["attachment"], "additionalProperties": false } }, "attachment.delete": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": false }, "params": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["attachmentId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "deleted": { "const": true } }, "required": ["deleted"], "additionalProperties": false } }, "session.fork": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.fork", "idempotent": "with requestId", "risks": ["creates a new root session in the source workspace or a granted destination workspace; files are never copied, restored or changed"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "boundary": { "oneOf": [{ "type": "object", "properties": { "throughTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["throughTurnId"], "additionalProperties": false }, { "type": "object", "properties": { "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["beforeTurnId"], "additionalProperties": false }] }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "newSessionId": { "type": "string", "pattern": "^[\\w.:-]{1,128}$" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "requestId", "ifGeneration"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "forkedFrom": { "$ref": "#/$defs/forkProvenance" }, "duplicate": { "const": true } }, "required": ["session", "forkedFrom"], "additionalProperties": true } }, "session.rewind": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.rewind", "idempotent": "with requestId", "risks": ["replaces the conversation the runtime continues from; the later turns stay recoverable and no file is changed"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["sessionId", "requestId", "ifGeneration", "beforeTurnId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "generation": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "branch": { "$ref": "#/$defs/conversationBranch" }, "duplicate": { "const": true } }, "required": ["session", "generation", "branch"], "additionalProperties": true } }, "session.reload": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.reload", "idempotent": "with requestId", "risks": ["restarts the root's native process; its conversation, configuration, history and receipts are kept"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["sessionId", "requestId", "ifGeneration"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "duplicate": { "const": true } }, "required": ["session"], "additionalProperties": true } }, "session.resumeCommand": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.resumeCommand", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "argv": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" } }, "posix": { "type": "string", "minLength": 1, "maxLength": 2048 }, "windows": { "type": "string", "minLength": 1, "maxLength": 2048 }, "display": { "type": "string", "minLength": 1, "maxLength": 2048 }, "platform": { "enum": ["posix", "windows"] } }, "required": ["argv", "posix", "windows", "display", "platform"], "additionalProperties": false } }, "terminal.create": { "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "terminal", "idempotent": false, "risks": ["starts a shell on the daemon host as the daemon's account: host-level execution, not confined to the workspace"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "protectionAcknowledgment": { "const": "linux-root-only-v1", "description": "Deprecated and ignored: accepted for compatibility with older clients. Reduced-protection terminals open without it; clients disclose the terminal's protection field instead." } }, "required": ["workspaceId", "cols", "rows", "requestId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminal": { "$ref": "#/$defs/terminal" } }, "required": ["terminal"], "additionalProperties": false } }, "terminal.list": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "terminal", "idempotent": true }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminals": { "type": "array", "items": { "$ref": "#/$defs/terminal" } } }, "required": ["terminals"], "additionalProperties": false } }, "terminal.attach": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": true, "risks": ["streams the terminal's output, which may show anything the shell printed"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "after": { "type": "integer", "minimum": 0 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "protectionAcknowledgment": { "const": "linux-root-only-v1", "description": "Deprecated and ignored: accepted for compatibility with older clients. Reduced-protection terminals open without it; clients disclose the terminal's protection field instead." } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminal": { "$ref": "#/$defs/terminal" }, "nextSeq": { "type": "integer", "minimum": 1 }, "gap": { "type": "object", "properties": { "fromSeq": { "type": "integer", "minimum": 1 }, "toSeq": { "type": "integer", "minimum": 1 } }, "required": ["fromSeq", "toSeq"], "additionalProperties": false } }, "required": ["terminal", "nextSeq"], "additionalProperties": false } }, "terminal.input": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": false, "risks": ["types into a host shell: runs any command as the daemon's account"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "data": { "type": "string", "minLength": 1, "maxLength": 65536 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId", "data"], "additionalProperties": false }, "result": { "type": "object", "properties": { "bytes": { "type": "integer", "minimum": 1 } }, "required": ["bytes"], "additionalProperties": false } }, "terminal.resize": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": true }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId", "cols", "rows"], "additionalProperties": false }, "result": { "type": "object", "properties": { "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 } }, "required": ["cols", "rows"], "additionalProperties": false } }, "terminal.close": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": false }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "const": true } }, "required": ["closed"], "additionalProperties": false } }, "terminal.revoke": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "capability": "terminal", "idempotent": true, "risks": ["kills every terminal of a principal; for a trusted gateway, never exposed"] }, "params": { "type": "object", "properties": { "principalId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["principalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "type": "integer", "minimum": 0 } }, "required": ["closed"], "additionalProperties": false } }, "terminal.capture": { "x-alp": { "effect": "query", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal.capture", "idempotent": true, "risks": ["Reads terminal screen text, which may contain secrets the shell printed"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "start": { "type": "integer" }, "end": { "type": "integer" }, "stripAnsi": { "type": "boolean" } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "lines": { "type": "array", "maxItems": 1200, "items": { "type": "string" } }, "totalLines": { "type": "integer", "minimum": 0 } }, "required": ["lines", "totalLines"], "additionalProperties": false } }, "terminal.watch": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "terminal.watch", "idempotent": true, "description": "Connection-local read subscription management, like question.watch/session.attach; no host or terminal mutation." }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." }, "after": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminals": { "type": "array", "items": { "$ref": "#/$defs/terminal" } }, "watchId": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "cursor": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "reset": { "type": "boolean" } }, "required": ["terminals", "watchId", "cursor", "reset"], "additionalProperties": false } }, "terminal.unwatch": { "x-alp": { "effect": "query", "scope": { "kind": "connection" }, "capability": "terminal.watch", "idempotent": true, "description": "Connection-local read subscription management, like question.watch/session.attach; no host or terminal mutation." }, "params": { "type": "object", "properties": {}, "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "const": true } }, "required": ["closed"], "additionalProperties": false } } }, "$defs": { "error": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" }, "data": {} }, "required": ["code", "message"], "additionalProperties": true }, "session": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "promptImages": { "type": "boolean" }, "promptAttachments": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["file.path", "document.native", "text.extract"] } }, "usage": { "$ref": "#/$defs/usage" } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy"], "additionalProperties": true }, "usage": { "type": "object", "properties": { "contextWindowUsedTokens": { "type": "integer", "minimum": 0 }, "contextWindowMaxTokens": { "type": "integer", "minimum": 1 }, "inputTokens": { "type": "integer", "minimum": 0 }, "cachedInputTokens": { "type": "integer", "minimum": 0 }, "outputTokens": { "type": "integer", "minimum": 0 }, "totalCostUsd": { "type": "number", "minimum": 0 } }, "additionalProperties": true }, "assignment": { "type": "object", "properties": { "id": { "type": "string" }, "agent": { "type": "string" }, "mode": { "type": "string" }, "status": { "type": "string" }, "startedAt": { "type": "string" }, "worktree": { "type": "object", "properties": { "branch": { "type": "string" }, "path": { "type": "string" } }, "required": ["branch", "path"], "additionalProperties": true } }, "required": ["id", "agent", "mode", "status", "startedAt"], "additionalProperties": true }, "mail": { "type": "object", "properties": { "id": { "type": "string" }, "kind": { "enum": ["question", "answer", "note", "steer", "result", "stalled", "board", "checkin"] }, "from": { "type": "string" }, "assignment": { "type": "string" }, "body": { "type": "string" }, "replyTo": { "type": "string" }, "result": { "type": "object" }, "redelivered": { "type": "boolean" } }, "required": ["id", "kind", "from", "assignment"], "additionalProperties": true }, "pin": { "type": "object", "properties": { "id": { "type": "string" }, "project": { "type": "string" }, "kind": { "enum": ["claim", "decision", "finding"] }, "body": { "type": "string" }, "paths": { "type": "array", "items": { "type": "string" } }, "agent": { "type": "string" }, "sessionId": { "type": "string" }, "rootId": { "type": "string" }, "at": { "type": "string" }, "released": { "type": "string" }, "task": { "type": "string" } }, "required": ["id", "project", "kind", "body", "agent", "sessionId", "rootId", "at"], "additionalProperties": true }, "question": { "type": "object", "properties": { "id": { "type": "string" }, "sessionId": { "type": "string" }, "rootId": { "type": "string" }, "agent": { "type": "string" }, "body": { "type": "string" }, "options": { "type": "array", "items": { "type": "string" } }, "askedAt": { "type": "string" }, "gate": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "taskId": { "type": "string" }, "gateId": { "type": "string" } }, "required": ["projectRoot", "taskId", "gateId"], "additionalProperties": true } }, "required": ["id", "sessionId", "rootId", "agent", "body", "askedAt"], "additionalProperties": true }, "attention": { "type": "object", "properties": { "reason": { "enum": ["finished", "error"] }, "at": { "type": "string" }, "turnId": { "type": "string" }, "message": { "type": "string" } }, "required": ["reason", "at"], "additionalProperties": true }, "spec": { "type": "object", "properties": { "cwd": { "type": "string" }, "agent": { "type": "string" }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "persist": { "type": "boolean" }, "restore": { "type": "object" } }, "required": ["cwd"], "additionalProperties": true }, "item": { "anyOf": [{ "$ref": "#/$defs/knownItem" }, { "$ref": "#/$defs/unknownItem" }] }, "event": { "anyOf": [{ "$ref": "#/$defs/knownEvent" }, { "$ref": "#/$defs/unknownEvent" }] }, "envelope": { "type": "object", "properties": { "sessionId": { "type": "string" }, "epoch": { "type": "string" }, "seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "ts": { "type": "string" }, "event": { "$ref": "#/$defs/event" }, "cursor": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, "required": ["sessionId", "epoch", "seq", "ts", "event"], "additionalProperties": true }, "request": { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }] }, "method": { "type": "string" }, "params": { "type": "object" } }, "required": ["jsonrpc", "method", "id"], "additionalProperties": true }, "response": { "oneOf": [{ "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" }] }, "result": {} }, "required": ["jsonrpc", "id", "result"], "additionalProperties": true }, { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" }] }, "error": { "$ref": "#/$defs/error" } }, "required": ["jsonrpc", "id", "error"], "additionalProperties": true }] }, "notification": { "oneOf": [{ "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "event" }, "params": { "$ref": "#/$defs/envelope" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "description": "A terminal's output, exit or detach (capability terminal, \xA712.10).", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "terminal.event" }, "params": { "$ref": "#/$defs/terminalEvent" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "terminal.changed" }, "params": { "$ref": "#/$defs/terminalChanged" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "description": "The live model catalog changed (capability catalog.live): re-read catalog.get.", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "catalog.updated" }, "params": { "type": "object", "properties": { "fetchedAt": { "type": "string" } }, "additionalProperties": true } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }] }, "knownEvent": { "oneOf": [{ "type": "object", "properties": { "type": { "const": "session.opened" }, "session": { "$ref": "#/$defs/session" }, "cwd": { "type": "string" }, "effective": { "type": "object", "properties": { "model": { "type": "string" }, "thinking": { "type": "string" } }, "required": ["model", "thinking"], "additionalProperties": true } }, "required": ["type", "session", "cwd", "effective"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.ready" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.updated" }, "session": { "$ref": "#/$defs/session" } }, "required": ["type", "session"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.closed" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.failed" }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "error"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "prompt.accepted" }, "clientMessageId": { "type": "string" }, "result": { "enum": ["turn", "steer"] }, "turnId": { "type": "string" } }, "required": ["type", "clientMessageId", "result", "turnId"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "prompt.failed" }, "clientMessageId": { "type": "string" }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "clientMessageId", "error"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "turn.started" }, "turnId": { "type": "string" }, "origin": { "enum": ["user", "wake", "assignment", "runtime"] } }, "required": ["type", "turnId", "origin"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "turn.ended" }, "turnId": { "type": "string" }, "state": { "enum": ["completed", "failed", "canceled"] }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "turnId", "state"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "item" }, "item": { "$ref": "#/$defs/item" } }, "required": ["type", "item"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "usage" }, "usage": { "$ref": "#/$defs/usage" } }, "required": ["type", "usage"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "mail" }, "mail": { "$ref": "#/$defs/mail" } }, "required": ["type", "mail"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "assignment" }, "assignment": { "$ref": "#/$defs/assignment" } }, "required": ["type", "assignment"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "question" }, "question": { "$ref": "#/$defs/question" } }, "required": ["type", "question"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "question.resolved" }, "questionId": { "type": "string" }, "outcome": { "enum": ["answered", "dismissed", "timeout", "canceled"] }, "answer": { "type": "string" } }, "required": ["type", "questionId", "outcome"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "pin" }, "pin": { "$ref": "#/$defs/pin" } }, "required": ["type", "pin"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "unpin" }, "pinId": { "type": "string" }, "reason": { "enum": ["unpinned", "session_ended"] } }, "required": ["type", "pinId", "reason"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "attention" }, "attention": { "$ref": "#/$defs/attention" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "history.reset" }, "generation": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "reason": { "const": "rewind" }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" } }, "required": ["type", "generation", "reason", "branchId"], "additionalProperties": true }] }, "unknownEvent": { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["session.opened", "session.ready", "session.updated", "session.closed", "session.failed", "prompt.accepted", "prompt.failed", "turn.started", "turn.ended", "item", "usage", "mail", "assignment", "question", "question.resolved", "pin", "unpin", "attention", "history.reset"] } } }, "required": ["type"], "additionalProperties": true }, "knownItem": { "oneOf": [{ "type": "object", "properties": { "kind": { "const": "user_message" }, "id": { "type": "string" }, "text": { "type": "string" }, "clientMessageId": { "type": "string" }, "images": { "type": "integer", "minimum": 1 }, "attachments": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "name": { "type": "string" }, "mimeType": { "type": "string" }, "size": { "type": "integer", "minimum": 0 } }, "required": ["attachmentId", "name", "mimeType", "size"], "additionalProperties": false } }, "origin": { "enum": ["user", "wake", "assignment", "runtime"] } }, "required": ["kind", "id", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "assistant_message" }, "id": { "type": "string" }, "text": { "type": "string" } }, "required": ["kind", "id", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "notice" }, "id": { "type": "string" }, "level": { "enum": ["info", "warning", "error"] }, "text": { "type": "string" } }, "required": ["kind", "id", "level", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "compaction" }, "id": { "type": "string" }, "status": { "enum": ["running", "completed", "failed"] }, "trigger": { "type": "string" }, "preTokens": { "type": "integer" }, "postTokens": { "type": "integer" } }, "required": ["kind", "id", "status"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "todo" }, "id": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "text": { "type": "string" }, "status": { "enum": ["pending", "in_progress", "completed"] } }, "required": ["id", "text", "status"], "additionalProperties": true } } }, "required": ["kind", "id", "items"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "tool_call" }, "id": { "type": "string" }, "callId": { "type": "string" }, "name": { "type": "string" }, "status": { "enum": ["running", "completed", "failed"] }, "error": { "type": "string" }, "detail": { "$ref": "#/$defs/toolCallDetail" } }, "required": ["kind", "id", "callId", "name", "status", "detail"], "additionalProperties": true }] }, "unknownItem": { "type": "object", "properties": { "kind": { "type": "string", "not": { "enum": ["user_message", "assistant_message", "notice", "compaction", "todo", "tool_call"] } }, "id": { "type": "string" } }, "required": ["kind", "id"], "additionalProperties": true }, "toolCallDetail": { "oneOf": [{ "type": "object", "properties": { "type": { "const": "shell" }, "command": { "type": "string" }, "cwd": { "type": "string" }, "output": { "type": "string" }, "exitCode": { "type": ["integer", "null"] } }, "required": ["type", "command", "output"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "read" }, "filePath": { "type": "string" }, "content": { "type": "string" }, "offset": { "type": "integer" }, "limit": { "type": "integer" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "edit" }, "filePath": { "type": "string" }, "oldString": { "type": "string" }, "newString": { "type": "string" }, "unifiedDiff": { "type": "string" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "write" }, "filePath": { "type": "string" }, "content": { "type": "string" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "search" }, "query": { "type": "string" }, "toolName": { "enum": ["search", "grep", "glob", "web_search"] }, "content": { "type": "string" }, "filePaths": { "type": "array", "items": { "type": "string" } }, "webResults": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string" }, "url": { "type": "string" } }, "required": ["title", "url"], "additionalProperties": true } }, "numFiles": { "type": "integer" }, "numMatches": { "type": "integer" }, "truncated": { "type": "boolean" } }, "required": ["type", "query"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "fetch" }, "url": { "type": "string" }, "prompt": { "type": "string" }, "result": { "type": "string" }, "code": { "type": "integer" } }, "required": ["type", "url"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "sub_agent" }, "subAgentType": { "type": "string" }, "description": { "type": "string" }, "log": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "plan" }, "text": { "type": "string" } }, "required": ["type", "text"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "plain_text" }, "label": { "type": "string" }, "text": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "unknown" }, "input": {}, "output": {} }, "required": ["type", "input", "output"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["shell", "read", "edit", "write", "search", "fetch", "sub_agent", "plan", "plain_text", "unknown"] } } }, "required": ["type"], "additionalProperties": true }] }, "alpError": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "sessionSummary": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "status": { "enum": ["initializing", "idle", "running", "error", "closed"] }, "title": { "type": "string" }, "archived": { "type": "boolean" }, "attention": { "$ref": "#/$defs/attention" }, "lastError": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "conversation": { "type": "object", "properties": { "fork": { "type": "boolean" }, "rewind": { "type": "boolean" }, "reload": { "type": "boolean", "description": "Whether session.reload can restart this root's native process (\xA712.8); the root must also be open and idle." }, "reason": { "enum": ["runtime_unsupported", "not_persistent", "not_root"] }, "configure": { "type": "boolean", "description": "Whether session.configure can change this root's model, effort or team (\xA712.9); the root must also be open and idle." } }, "required": ["fork", "rewind"], "additionalProperties": true }, "forkedFrom": { "$ref": "#/$defs/forkProvenance" }, "branches": { "type": "array", "maxItems": 100, "items": { "$ref": "#/$defs/conversationBranch" } }, "promptAttachments": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["file.path", "document.native", "text.extract"] } } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy", "status"], "additionalProperties": true }, "pause": { "type": "object", "properties": { "since": { "type": "string" }, "by": { "type": "string" }, "reason": { "type": "string" }, "resetsAt": { "type": "string" }, "checkedAt": { "type": "string" } }, "required": ["since", "by", "reason"], "additionalProperties": true }, "pauseState": { "type": "object", "properties": { "all": { "$ref": "#/$defs/pause" }, "runtimes": { "type": "object", "additionalProperties": { "$ref": "#/$defs/pause" } }, "parked": { "type": "array", "items": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "type": "string" }, "rootId": { "type": "string" }, "reason": { "type": "string" }, "since": { "type": "string" } }, "required": ["assignmentId", "agent", "runtime", "rootId", "reason", "since"], "additionalProperties": true } } }, "required": ["runtimes", "parked"], "additionalProperties": true }, "preview": { "type": "object", "properties": { "teams": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" } }, "required": ["id", "label"], "additionalProperties": true } }, "team": { "type": "string" }, "teamLabel": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" } }, "required": ["teams", "team", "agent", "runtime", "model", "mode", "thinking"], "additionalProperties": true }, "treeStatus": { "type": "object", "properties": { "rootId": { "type": "string" }, "sessions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "state": { "enum": ["running", "waiting", "waiting_parent", "waiting_user", "idle"] }, "idleMs": { "type": "number" }, "workdir": { "type": "string" }, "unreadMail": { "type": "integer", "minimum": 0 } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy", "state", "idleMs", "workdir", "unreadMail"], "additionalProperties": true } }, "assignments": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "requester": { "type": "string" }, "isolation": { "enum": ["shared", "worktree"] }, "idleMs": { "type": "number" } }, "required": ["id", "requester", "isolation", "idleMs"], "additionalProperties": true } }, "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "worktrees": { "type": "array", "items": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "requester": { "type": "string" }, "agent": { "type": "string" }, "branch": { "type": "string" }, "files": { "type": "array", "items": { "type": "string" } }, "stat": { "type": "string" } }, "required": ["assignmentId", "requester", "agent", "branch", "files", "stat"], "additionalProperties": true } }, "leases": { "type": "array", "items": { "type": "object", "properties": { "checkout": { "type": "string" }, "assignmentId": { "type": "string" }, "agent": { "type": "string" } }, "required": ["checkout", "assignmentId", "agent"], "additionalProperties": true } }, "claims": { "type": "array", "items": { "$ref": "#/$defs/pin" } } }, "required": ["rootId", "sessions", "assignments", "questions", "worktrees", "leases", "claims"], "additionalProperties": true }, "health": { "type": "object", "properties": { "live": { "type": "boolean" }, "ready": { "type": "boolean" }, "checks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "ok": { "type": "boolean" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["id", "ok"], "additionalProperties": true } } }, "required": ["live", "ready", "checks"], "additionalProperties": true }, "projectRoot": { "type": "string", "minLength": 1, "maxLength": 4096, "description": "An absolute, normalized path on the daemon host to a directory holding .alp/. Compared as is: the daemon never walks up to a parent." }, "taskId": { "type": "string", "pattern": "^t-[0-9a-f]{4,12}(?:\\.\\d+)*$" }, "taskRow": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "title": { "type": "string" }, "type": { "type": "string" }, "priority": { "type": "integer" }, "status": { "enum": ["open", "in_progress", "review", "closed"] }, "rev": { "type": "integer", "minimum": 0 }, "parent": { "type": "string" }, "assignee": { "type": "string" }, "ready": { "type": "boolean" }, "blockedBy": { "type": "array", "items": { "type": "string" } }, "waits": { "type": "array", "items": { "type": "string" } }, "approvals": { "type": "array", "items": { "type": "object", "properties": { "gate": { "type": "string" }, "note": { "type": "string" } }, "required": ["gate", "note"], "additionalProperties": true } }, "handoff": { "type": "object", "properties": { "outcome": { "type": "string" }, "summary": { "type": "string" }, "agent": { "type": "string" } }, "required": ["outcome", "summary"], "additionalProperties": true }, "closed": { "type": "object", "properties": { "reason": { "type": "string" }, "summary": { "type": "string" }, "at": { "type": "string" } }, "required": ["reason", "at"], "additionalProperties": true }, "description": { "type": "string" }, "labels": { "type": "array", "items": { "type": "string" } }, "paths": { "type": "array", "items": { "type": "string" } }, "progress": { "type": "object", "properties": { "done": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 } }, "required": ["done", "total"], "additionalProperties": true }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": ["id", "title", "type", "priority", "status", "rev", "ready", "updatedAt"], "additionalProperties": true }, "libraryKind": { "enum": ["agents", "skills", "mcp", "hooks", "teams", "providers"] }, "libraryScope": { "enum": ["library", "project"] }, "librarySource": { "enum": ["builtin", "library", "project"] }, "entryName": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_.-]+$", "not": { "enum": [".", ".."] } }, "libraryRevision": { "type": ["string", "null"] }, "libraryEntryRow": { "type": "object", "properties": { "name": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "description": { "type": "string" }, "usedBy": { "type": "array", "items": { "type": "string" } } }, "required": ["name", "source"], "additionalProperties": true }, "secretMarker": { "type": "object", "properties": { "$secret": { "const": "keep" } }, "required": ["$secret"], "additionalProperties": false, "description": "Stands for a stored secret value: read results carry it in place of the value; a save that sends it back keeps the stored value." }, "languageSetting": { "type": "object", "properties": { "language": { "type": ["string", "null"] }, "applies": { "type": "string" }, "default": { "type": "string" } }, "required": ["language", "applies", "default"], "additionalProperties": true }, "teamRow": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "error": { "type": "string" } }, "required": ["id", "source"], "additionalProperties": true }, "promptImage": { "type": "object", "properties": { "type": { "const": "image" }, "mimeType": { "enum": ["image/png", "image/jpeg", "image/gif", "image/webp"] }, "data": { "type": "string", "minLength": 4, "maxLength": 6990508, "pattern": "^[A-Za-z0-9+/]+={0,2}$" }, "name": { "type": "string", "maxLength": 255 } }, "required": ["type", "mimeType", "data"], "additionalProperties": false }, "scheduleId": { "type": "string", "pattern": "^sch_[0-9a-f]{16}$" }, "scheduleError": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "scheduleJob": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "sessionId": { "type": "string" }, "prompt": { "type": "string" }, "dueAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?(Z|[+-]\\d{2}:\\d{2})$" }, "status": { "enum": ["pending", "delivered", "failed", "cancelled"] }, "attempts": { "type": "integer", "minimum": 0 }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "deliveredAt": { "type": "string" }, "failedAt": { "type": "string" }, "cancelledAt": { "type": "string" }, "attemptedAt": { "type": "string" }, "lateByMs": { "type": "integer", "minimum": 0 }, "lastError": { "$ref": "#/$defs/scheduleError" }, "keepsSession": { "const": false } }, "required": ["id", "projectRoot", "sessionId", "prompt", "dueAt", "status", "attempts", "createdAt", "updatedAt"], "additionalProperties": true }, "registryProject": { "type": "object", "properties": { "id": { "type": "string" }, "root": { "type": "string" }, "customName": { "type": ["string", "null"] }, "addedAt": { "type": "string" }, "removedAt": { "type": ["string", "null"] }, "revision": { "type": "integer", "minimum": 0 }, "canonical": { "type": "string" } }, "required": ["id", "root", "addedAt"], "additionalProperties": false }, "registryWorkspace": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "directory": { "type": "string" }, "title": { "type": ["string", "null"] }, "pinnedAt": { "type": ["string", "null"] }, "archivedAt": { "type": ["string", "null"] }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "revision": { "type": "integer", "minimum": 0 }, "canonical": { "type": "string" }, "idempotencyKey": { "type": "string" }, "branch": { "type": ["string", "null"] }, "managedWorktree": { "type": "boolean" } }, "required": ["id", "projectId", "directory", "labels", "createdAt"], "additionalProperties": false }, "attachment": { "type": "object", "description": "A committed attachment as clients see it: ids, display metadata and its digest, never a host path or URL.", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "mimeType": { "type": "string", "minLength": 3, "maxLength": 255 }, "detectedMimeType": { "type": "string", "minLength": 3, "maxLength": 255 }, "size": { "type": "integer", "minimum": 0 }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "createdAt": { "type": "string" }, "committedAt": { "type": "string" }, "referenced": { "type": "boolean" } }, "required": ["attachmentId", "sessionId", "name", "mimeType", "detectedMimeType", "size", "sha256", "createdAt", "committedAt", "referenced"], "additionalProperties": false }, "forkProvenance": { "type": "object", "description": "Where a fork came from (\xA712.7): the source root, and the turn its conversation was cut at.", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "turnId": { "type": "string", "minLength": 1, "maxLength": 200 }, "boundary": { "enum": ["through", "before", "whole"] }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "at": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["sessionId", "boundary", "at"], "additionalProperties": true }, "conversationBranch": { "type": "object", "description": "Later turns a rewind set aside (\xA712.7): kept, never deleted, recoverable as a new session with session.fork { branchId }.", "properties": { "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 }, "turns": { "type": "integer", "minimum": 0 }, "at": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["branchId", "beforeTurnId", "turns", "at"], "additionalProperties": true }, "effectiveConfig": { "type": "object", "description": "The configuration a root runs with, or would after a change, as alpd resolved it (\xA712.9).", "properties": { "team": { "type": "string" }, "teamLabel": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "thinking": { "type": "string" }, "mode": { "type": "string" }, "permissionProfile": { "type": "string", "description": "The permission profile capping the agent's mode, when one does." }, "supervisor": { "type": "boolean" }, "maxPeers": { "type": "integer" }, "delegates": { "type": "array", "items": { "type": "string" }, "description": "Agents the root may delegate to." }, "tools": { "type": "array", "items": { "type": "string" }, "description": "ALP tools the root's agent is given." }, "mcpServers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "kind": { "enum": ["stdio", "http"] } }, "required": ["name", "kind"], "additionalProperties": true } }, "hooks": { "type": "integer", "minimum": 0, "description": "How many hook commands the agent runs." }, "instructionsSha": { "type": "string" } }, "required": ["team", "agent", "runtime", "model", "thinking", "mode", "supervisor", "delegates", "tools", "mcpServers", "hooks"], "additionalProperties": true }, "configurePreview": { "type": "object", "properties": { "current": { "$ref": "#/$defs/effectiveConfig" }, "proposed": { "$ref": "#/$defs/effectiveConfig" }, "changes": { "type": "array", "items": { "enum": ["model", "thinking", "team", "mode"] } }, "restart": { "type": "boolean", "description": "Whether applying it restarts the root's native process (on its own conversation)." }, "allowed": { "type": "boolean", "description": "Whether session.configure would take it now; a busy tree may still refuse it later." }, "reason": { "enum": ["session_busy", "session_closed", "not_root", "runtime_unsupported", "runtime_mismatch", "agent_mismatch", "permission_escalation", "team_not_found", "invalid_params", "not_persistent"] }, "message": { "type": "string" }, "teams": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" } }, "required": ["id", "label"], "additionalProperties": true } } }, "required": ["current", "proposed", "changes", "restart", "allowed", "teams"], "additionalProperties": true }, "configureOutcome": { "type": "object", "properties": { "status": { "enum": ["applied", "unchanged"] }, "requested": { "type": "object", "properties": { "model": { "type": "string" }, "thinking": { "type": "string" }, "team": { "type": "string" }, "mode": { "type": "string" } }, "additionalProperties": false }, "effective": { "$ref": "#/$defs/effectiveConfig" }, "restarted": { "type": "boolean" } }, "required": ["status", "requested", "effective", "restarted"], "additionalProperties": true }, "terminal": { "type": "object", "description": "A terminal as clients see it: ids, size and state, never a process id, shell path or host path.", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "title": { "type": "string", "maxLength": 64 }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "state": { "enum": ["running", "exited"] }, "attached": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "lastActivityAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time" }, "exitCode": { "type": ["integer", "null"] }, "signal": { "type": ["integer", "null"] }, "endReason": { "enum": ["exited", "closed", "idle", "lifetime", "detached", "revoked", "disabled", "shutdown"] }, "protection": { "enum": ["root-only", "none"], "description": "Absent: full native process protection (macOS, supported Linux). root-only: best-effort Linux; closing ends the shell, but processes it started may keep running. none: Windows platform PTY (ConPTY); cleanup is best-effort and not guaranteed. Clients show a non-blocking notice." } }, "required": ["terminalId", "workspaceId", "title", "cols", "rows", "state", "attached", "createdAt", "lastActivityAt", "expiresAt"], "additionalProperties": false }, "terminalEvent": { "description": "params of a terminal.event notification (\xA712.10): sent only to the connection attached to the terminal.", "oneOf": [{ "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "output" }, "seq": { "type": "integer", "minimum": 1 }, "data": { "type": "string", "minLength": 1, "maxLength": 65536 } }, "required": ["terminalId", "type", "seq", "data"], "additionalProperties": false }, { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "exit" }, "seq": { "type": "integer", "minimum": 1 }, "exitCode": { "type": ["integer", "null"] }, "signal": { "type": ["integer", "null"] }, "reason": { "enum": ["exited", "closed", "idle", "lifetime", "detached", "revoked", "disabled", "shutdown"] } }, "required": ["terminalId", "type", "seq", "exitCode", "signal", "reason"], "additionalProperties": false }, { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "detached" }, "reason": { "enum": ["replaced", "slow_consumer"] } }, "required": ["terminalId", "type", "reason"], "additionalProperties": false }] }, "terminalChanged": { "type": "object", "properties": { "watchId": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "cursor": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["watchId", "cursor"], "additionalProperties": false } } };
5660
5727
 
5661
5728
  // packages/protocol/src/validate.js
5662
5729
  var MAX_ISSUES = 8;
@@ -5948,6 +6015,9 @@ var TERMINAL_REFUSALS = Object.freeze({
5948
6015
  not_found: "No such terminal",
5949
6016
  terminal_disabled: "The daemon host has not allowed remote terminals (its owner runs alp terminal allow)",
5950
6017
  terminal_unsupported: "Terminals are not available on the daemon host",
6018
+ // Only an older alpd (Linux root-only hosts, before terminals opened with a non-blocking notice)
6019
+ // refuses this way; current clients never send the acknowledgment it wants.
6020
+ terminal_protection_ack_required: "The daemon host runs an older alpd that asks for a terminal protection acknowledgment this version no longer sends. Update ALP on the daemon host (alp update), restart alpd, then retry.",
5951
6021
  terminal_limit: "Too many terminals are open",
5952
6022
  not_attached: "Attach the terminal on this connection first",
5953
6023
  terminal_exited: "The terminal has ended",
@@ -6109,6 +6179,7 @@ var isGeneration = (value) => typeof value === "string" && GENERATION.test(value
6109
6179
  var LIBRARY_ROW_FIELDS = Object.freeze(["name", "source", "overrides", "description", "usedBy"]);
6110
6180
  var TEAM_ROW_FIELDS = Object.freeze(["id", "label", "description", "source", "overrides", "error"]);
6111
6181
  var MODEL_ROW_FIELDS = Object.freeze(["id", "label", "efforts", "effort"]);
6182
+ var CATALOG_MODEL_FIELDS = Object.freeze(["id", "label", "description", "thinkingOptions", "defaultThinkingOptionId", "runtime", "provider", "source", "status"]);
6112
6183
  var LIBRARY_ENTRY_FIELDS = Object.freeze(["kind", "name", "source", "overrides", "revision", "usedBy", "librarySkills"]);
6113
6184
  var SECRET_MARKER = Object.freeze({ $secret: "keep" });
6114
6185
  var plain = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
@@ -6151,7 +6222,6 @@ var LIBRARY_CONTENT = Object.freeze({
6151
6222
  label: isString,
6152
6223
  description: isString,
6153
6224
  enabled: isBoolean,
6154
- readOnlyMode: isString,
6155
6225
  command: "program",
6156
6226
  args: "secretItems",
6157
6227
  env: "secretValues",
@@ -6281,8 +6351,8 @@ function isModelId(value) {
6281
6351
  }
6282
6352
  var EXPOSURE = Object.freeze({
6283
6353
  "daemon.hello": { status: "gateway", scope: "connection", reason: "Answered by the gateway after its own hello to alpd: capabilities are alpd's intersected with FORWARDED_CAPABILITIES; alpd's hostname when hostLabel accepts it; no pid.", tests: ["handshake"] },
6284
- "catalog.get": { status: "exposed", permission: "session.read", scope: "none: the model and mode catalogue (live provider lists merged over static rows, t-e5ee)", params: [], tests: ["permission"] },
6285
- "catalog.refresh": { status: "denied", scope: "host: runs each provider CLI on the daemon host to list its models", reason: "Starts provider processes on the host; remote clients read the catalog alpd refreshes on start, every 6 h and from turns (catalog.get), and the gateway forwards no catalog.updated." },
6354
+ "catalog.get": { status: "exposed", permission: "session.read", scope: "none: the model and mode catalogue (live provider lists merged over static rows, t-e5ee; enabled acp:* rows, t-d0b0); CATALOG_MODEL_FIELDS only, provider errors dropped", params: [], tests: ["permission"] },
6355
+ "catalog.refresh": { status: "denied", scope: "host: runs each provider CLI on the daemon host to list its models", reason: "Starts provider processes on the host; remote clients read the catalog alpd refreshes on start, every 6 h and from turns (catalog.get); the gateway forwards catalog.updated (fetchedAt only) to clients holding session.read." },
6286
6356
  "session.list": { status: "exposed", permission: "session.read", scope: "result: sessions whose tree lies in a granted workspace; projectRoot must name one; with limit, alpd pages are read until the filtered page is full", params: ["projectRoot", "rootsOnly", "includeClosed", "includeArchived", "limit", "cursor", "query"], tests: ["permission", "workspace-param", "result-filter", "paging"] },
6287
6357
  "session.get": { status: "exposed", permission: "session.read", scope: "session: its tree's root and itself in a granted workspace", params: ["sessionId"], tests: ["permission", "session-scope"] },
6288
6358
  "session.status": { status: "exposed", permission: "session.read", scope: "session; the answer must be the checked root's tree with every session in a granted workspace. Rows carry host paths of that tree (workdir, lease checkouts)", params: ["sessionId"], tests: ["permission", "session-scope", "tree-scope"] },
@@ -6326,9 +6396,10 @@ var EXPOSURE = Object.freeze({
6326
6396
  "attachment.abort": { status: "exposed", permission: "attachments.write", alsoRequires: ["session.write"], scope: "upload: as attachment.chunk", capability: CAPABILITY.attachments, params: ["uploadId"], tests: ["permission", "binding"] },
6327
6397
  "attachment.get": { status: "exposed", permission: "attachments.write", alsoRequires: ["session.read"], scope: "attachment: only this credential's own (alpd checks the binding as for chunks), so a credential without attachments.write has none to read; metadata only, never bytes or a path; projected by projectAttachment", capability: CAPABILITY.attachments, params: ["attachmentId"], tests: ["permission", "binding", "result-filter"] },
6328
6398
  "attachment.delete": { status: "exposed", permission: "attachments.write", alsoRequires: ["session.write"], scope: "attachment: as attachment.get; alpd refuses a referenced one (1004 attachment_referenced), never evicts it", capability: CAPABILITY.attachments, params: ["attachmentId"], tests: ["permission", "binding"] },
6329
- "session.fork": { status: "exposed", permission: "session.write", alsoRequires: ["session.read"], scope: "session: sessionId a root in a granted workspace, looked up afresh (it reads that conversation, so session.read too); workspaceId, when given, a registry workspace whose directory a grant names exactly (as session.create), else the fork stays in the source's workspace; newSessionId, when given, never a session outside the grant. The principal context is the gateway's own, never the client's (alpd re-authorizes the source's attachments for it); requestId namespaced per credential; for a grant with modes, the modes of the source and its tree, looked up afresh, within them (as session.prompt: the fork inherits its configuration). Only conversation is copied, never a file. The created root is checked again (a root in the grant, and in the destination asked for) before it is answered; forkedFrom must name the checked source; a forkedFrom in any summary passes only when its source is in the grant (projectForkedFrom). alpd errors rewritten to fixed text keeping code, reason and a generation", capability: CAPABILITY.sessionFork, params: ["sessionId", "requestId", "ifGeneration", "boundary", "branchId", "workspaceId", "newSessionId", "title"], tests: ["permission", "session-scope", "registry-scope", "binding", "result-filter", "mode"] },
6330
- "session.rewind": { status: "exposed", permission: "session.write", scope: "session: sessionId a root in a granted workspace, looked up afresh; for a grant with modes, the modes of the root and its tree, looked up afresh, within them (as session.prompt); conversation only under the same session id, no file is changed, the later turns stay a branch session.fork { branchId } recovers; requestId namespaced per credential; the answer must be that session, its branch and generation projected; alpd errors rewritten to fixed text keeping code, reason and a generation. history.reset reaches the root's attached connections as alpd sent it", capability: CAPABILITY.sessionRewind, params: ["sessionId", "requestId", "ifGeneration", "beforeTurnId"], tests: ["permission", "session-scope", "result-filter", "event-filter", "mode"] },
6331
- "session.reload": { status: "exposed", permission: "session.write", scope: "session: sessionId a root in a granted workspace, looked up afresh; for a grant with modes, the modes of the root and its tree, looked up afresh, within them (as session.prompt: the restarted process drives the session); restarts its native process on its own conversation and configuration, nothing else; requestId namespaced per credential; the answer must be that root, projected; alpd errors rewritten to fixed text keeping code and reason", capability: CAPABILITY.sessionReload, params: ["sessionId", "requestId", "ifGeneration"], tests: ["permission", "session-scope", "result-filter", "mode"] },
6399
+ "session.fork": { status: "exposed", permission: "session.write", alsoRequires: ["session.read"], scope: "session: sessionId a root in a granted workspace, looked up afresh (it reads that conversation, so session.read too); workspaceId, when given, a registry workspace whose directory a grant names exactly (as session.create), else the fork stays in the source's workspace; newSessionId, when given, never a session outside the grant. The principal context is the gateway's own, never the client's (alpd re-authorizes the source's attachments for it); requestId namespaced per credential; for a grant with modes, the modes of the source and its tree, looked up afresh, within them (as session.prompt: the fork inherits its configuration). Only conversation is copied, never a file. The created root is checked again (a root in the grant, and in the destination asked for) before it is answered; forkedFrom must name the checked source; a forkedFrom in any summary passes only when its source is in the grant (projectForkedFrom). alpd errors rewritten to fixed text keeping code, reason and a generation; user-only: the gateway and alpd refuse an agent-marked credential (user_only)", capability: CAPABILITY.sessionFork, params: ["sessionId", "requestId", "ifGeneration", "boundary", "branchId", "workspaceId", "newSessionId", "title"], tests: ["permission", "session-scope", "registry-scope", "binding", "result-filter", "mode"] },
6400
+ "session.rewind": { status: "exposed", permission: "session.write", scope: "session: sessionId a root in a granted workspace, looked up afresh; for a grant with modes, the modes of the root and its tree, looked up afresh, within them (as session.prompt); conversation only under the same session id, no file is changed, the later turns stay a branch session.fork { branchId } recovers; requestId namespaced per credential; the answer must be that session, its branch and generation projected; alpd errors rewritten to fixed text keeping code, reason and a generation. history.reset reaches the root's attached connections as alpd sent it; user-only: the gateway and alpd refuse an agent-marked credential (user_only)", capability: CAPABILITY.sessionRewind, params: ["sessionId", "requestId", "ifGeneration", "beforeTurnId"], tests: ["permission", "session-scope", "result-filter", "event-filter", "mode"] },
6401
+ "session.reload": { status: "exposed", permission: "session.write", scope: "session: sessionId a root in a granted workspace, looked up afresh; for a grant with modes, the modes of the root and its tree, looked up afresh, within them (as session.prompt: the restarted process drives the session); restarts its native process on its own conversation and configuration, nothing else; requestId namespaced per credential; the answer must be that root, projected; alpd errors rewritten to fixed text keeping code and reason; user-only: the gateway and alpd refuse an agent-marked credential (user_only)", capability: CAPABILITY.sessionReload, params: ["sessionId", "requestId", "ifGeneration"], tests: ["permission", "session-scope", "result-filter", "mode"] },
6402
+ "session.compact": { status: "exposed", permission: "session.write", scope: "session: sessionId a root in a granted workspace, looked up afresh; for a grant with modes, the modes of the root and its tree, looked up afresh, within them (as session.prompt: the checkpoint turn drives the session); the answer projected to its status only (started, deferred or running), anything else refused; alpd errors rewritten to fixed text keeping code and reason; user-only: alpd refuses an agent-marked connection (user_only)", params: ["sessionId"], tests: ["permission", "session-scope", "result-filter", "mode"] },
6332
6403
  "session.commands": { status: "exposed", permission: "session.read", scope: "session: its tree's root and itself in a granted workspace; the answer projected (name, description, argumentHint, kind of each, never a path)", capability: CAPABILITY.sessionCommands, params: ["sessionId"], tests: ["permission", "session-scope", "result-filter"] },
6333
6404
  "session.resumeCommand": { status: "exposed", permission: "session.read", scope: "session: its tree's root and itself in a granted workspace; the answer is rebuilt by the gateway from the session id (resumeCommandOf, `alp attach <id>`) and refused unless alpd answered the same, so no path, env, credential or native runtime command passes; for the clipboard only, never run", capability: CAPABILITY.sessionResumeCommand, params: ["sessionId"], tests: ["permission", "session-scope", "result-filter"] },
6334
6405
  "session.interrupt": { status: "exposed", permission: "session.write", scope: "session; stops: a root always, an assignment when its requesters' modes are within the grant's", params: ["sessionId", "turnId"], tests: ["permission", "session-scope", "mode"] },
@@ -6369,7 +6440,6 @@ var EXPOSURE = Object.freeze({
6369
6440
  "daemon.pause": { status: "denied", scope: "host", reason: "host.admin" },
6370
6441
  "daemon.resume": { status: "denied", scope: "host", reason: "host.admin" },
6371
6442
  "daemon.pauses": { status: "denied", scope: "host", reason: "host.admin" },
6372
- "session.compact": { status: "prohibited", scope: "session", reason: "Compacting main is a local CLI operation (alp compact) for now; remote clients may get it later." },
6373
6443
  "daemon.shutdown": { status: "prohibited", scope: "host", reason: "Stops alpd." },
6374
6444
  "extension.register": { status: "prohibited", scope: "host", reason: "Would let a remote client serve methods every local client calls." },
6375
6445
  "extension.unregister": { status: "prohibited", scope: "host", reason: "Extension methods are never remote." },
@@ -6538,6 +6608,24 @@ function projectGitDiff(raw, { path: path11 } = {}) {
6538
6608
 
6539
6609
  // packages/core/src/resolver.js
6540
6610
  import path6 from "node:path";
6611
+
6612
+ // packages/core/src/library.js
6613
+ var SHIPPED_ROLE_SKILLS = Object.freeze({
6614
+ // 0086846 (2026-10-07)
6615
+ "7132b9ef1f10db55caea23dbe705a0ab06c83c86f51f074e663d12043a79327a": { main: ["goal-griller", "xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], lead: ["xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], peer: ["xia", "bug-loop", "smart-commits"] },
6616
+ // 9ccd54c (2026-10-08): oracle and reviewer, with none
6617
+ "c03f7bcecd61e26e70ef05b268aa7881a75f9e9c45ae5486ae9659cefd6bb449": { main: ["goal-griller", "xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], lead: ["xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], peer: ["xia", "bug-loop", "smart-commits"] },
6618
+ // 61181b5 (2026-10-09): supervisor, with none
6619
+ "8c5664042d4a4ecd3ded61240d8febbffa6e8965a88af0e9ba0420ad2f2ce8fe": { main: ["goal-griller", "xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], lead: ["xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], peer: ["xia", "bug-loop", "smart-commits"] },
6620
+ // 9180aa1 (2026-10-29): compact for main
6621
+ "b12b52102c358119cf834e5f3be54e6a69aa4c9f388fe889dffbb529755292dc": { main: ["goal-griller", "xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits", "compact"], lead: ["xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], peer: ["xia", "bug-loop", "smart-commits"] },
6622
+ // f4d7986 (2026-10-29): curate for main
6623
+ "a84b035d0058cbfcda7e32dc1706b9e83e67764eed24e2e121bdfcd60f924e46": { main: ["goal-griller", "xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits", "compact", "curate"], lead: ["xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits"], peer: ["xia", "bug-loop", "smart-commits"] },
6624
+ // Skill system v2 (2026-11-05): engineering core skills; reviewer gets its first two
6625
+ "e60be7eec8d9b5180866c9b5a2c14cf0d95a9f1331ed771e93791f7b524af9b1": { main: ["goal-griller", "xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits", "compact", "curate", "skill-authoring", "architecture-docs", "feature-architecture", "test-strategy", "safe-refactor", "security-review", "release-readiness"], lead: ["xia", "sequence-execution-plan", "prompt-leverage", "bug-loop", "smart-commits", "architecture-docs", "feature-architecture", "test-strategy", "safe-refactor", "security-review", "release-readiness"], peer: ["xia", "bug-loop", "smart-commits", "feature-architecture", "test-strategy", "safe-refactor"], reviewer: ["security-review", "release-readiness"] }
6626
+ });
6627
+
6628
+ // packages/core/src/resolver.js
6541
6629
  var KINDS = {
6542
6630
  skills: (name2) => path6.join(name2, "SKILL.md"),
6543
6631
  mcp: (name2) => `${name2}.json`,
@@ -6713,6 +6801,11 @@ var RELOAD_REFUSALS = Object.freeze({
6713
6801
  not_root: "Only a root session can be reloaded",
6714
6802
  native_refused: "The agent could not be restarted on its conversation; the session is closed with its conversation kept and opens again with the next message"
6715
6803
  });
6804
+ var COMPACT_REFUSALS = Object.freeze({
6805
+ session_busy: "The session is not open; open it first, then compact it",
6806
+ runtime_unsupported: "Only a root session can be compacted",
6807
+ not_root: "Only a root session can be compacted"
6808
+ });
6716
6809
  var CONVERSATION_REFUSALS = Object.freeze({
6717
6810
  not_found: "No such session or turn for this credential",
6718
6811
  session_busy: "The session is running a turn; wait for it to end, then try again",
@@ -6811,7 +6904,7 @@ var ClientConnection = class {
6811
6904
  #queue = [];
6812
6905
  #queuedBytes = 0;
6813
6906
  #helloed = false;
6814
- /** The client said in daemon.hello that an ALP agent started it: the re-hello that says so on its alpd connection (t-e706). */
6907
+ /** The credential is an agent's (t-53aa), or the client said in daemon.hello that an ALP agent started it: the re-hello that says so on its alpd connection (t-e706). */
6815
6908
  /** @type {Promise<unknown> | undefined} */
6816
6909
  #agent;
6817
6910
  /** A hello waiting for alpd: requests pipelined behind it wait too, as alpd answers hello at once. */
@@ -6905,6 +6998,7 @@ var ClientConnection = class {
6905
6998
  client.onNotification((method, params) => {
6906
6999
  if (method === "terminal.event") this.#terminalEvent(params);
6907
7000
  else if (method === "terminal.changed") this.#terminalChanged(params);
7001
+ else if (method === "catalog.updated") this.#catalogUpdated(params);
6908
7002
  });
6909
7003
  client.onEvent((envelope) => {
6910
7004
  if (!this.#capabilities.includes("workspace.worktree") || !this.#grant.permissions.has("workspace.manage")) {
@@ -7223,7 +7317,7 @@ var ClientConnection = class {
7223
7317
  await this.#ready.catch(() => {
7224
7318
  throw new GatewayError(GATEWAY_ERROR.unavailable, "alpd is unavailable", { reason: GATEWAY_REASON.daemonDisconnected });
7225
7319
  });
7226
- if (Array.isArray(params.capabilities) && params.capabilities.includes(AGENT_CAPABILITY)) this.#agent ??= this.#call("daemon.hello", { protocolVersion: PROTOCOL_VERSION, client: { name: "alp-gateway", version: "0" }, capabilities: [AGENT_CAPABILITY] });
7320
+ if (this.#grant.agent === true || Array.isArray(params.capabilities) && params.capabilities.includes(AGENT_CAPABILITY)) this.#agent ??= this.#call("daemon.hello", { protocolVersion: PROTOCOL_VERSION, client: { name: "alp-gateway", version: "0" }, capabilities: [AGENT_CAPABILITY], ...this.#grant.agentName ? { principal: { agent: this.#grant.agentName } } : {} });
7227
7321
  if (this.#agent) {
7228
7322
  try {
7229
7323
  await this.#agent;
@@ -7621,6 +7715,14 @@ var ClientConnection = class {
7621
7715
  if (event.type === "detached") this.#terminals.delete(event.terminalId);
7622
7716
  this.#push(JSON.stringify({ jsonrpc: "2.0", method: "terminal.event", params: event }));
7623
7717
  }
7718
+ /** The live catalog changed (t-e5ee): read-only news for clients that may read it (catalog.get), with
7719
+ * fetchedAt only; the client re-reads catalog.get, which the gateway projects.
7720
+ * @param {any} raw */
7721
+ #catalogUpdated(raw) {
7722
+ if (this.#closed || !this.#helloed || !this.#grant.permissions.has("session.read")) return;
7723
+ const fetchedAt = typeof raw?.fetchedAt === "string" && raw.fetchedAt.length <= 64 ? raw.fetchedAt : void 0;
7724
+ this.#push(JSON.stringify({ jsonrpc: "2.0", method: "catalog.updated", params: fetchedAt ? { fetchedAt } : {} }));
7725
+ }
7624
7726
  /** Only this connection's authorized watch gets opaque invalidations; never host terminal data.
7625
7727
  * @param {any} raw */
7626
7728
  #terminalChanged(raw) {
@@ -7891,7 +7993,8 @@ var ClientConnection = class {
7891
7993
  },
7892
7994
  // Provider errors can name host paths and exit codes: remote clients get each provider's status only (t-e5ee).
7893
7995
  "catalog.get": async () => {
7894
- const { providers, ...catalog } = await this.#call("catalog.get", {});
7996
+ const { providers, models, ...rest } = await this.#call("catalog.get", {});
7997
+ const catalog = { ...rest, models: (Array.isArray(models) ? models : []).filter((model) => !(model?.runtime === "acp" && model?.enabled === false)).map((model) => pick(model, CATALOG_MODEL_FIELDS)) };
7895
7998
  return providers && typeof providers === "object" ? { ...catalog, providers: Object.fromEntries(Object.entries(providers).map(([runtime, state]) => [runtime, { status: state?.status, ...typeof state?.fetchedAt === "string" ? { fetchedAt: state.fetchedAt } : {} }])) } : catalog;
7896
7999
  },
7897
8000
  "session.list": async (params) => {
@@ -8089,6 +8192,7 @@ ${session.id}`.toLowerCase().includes(word))));
8089
8192
  // up afresh; requestIds are this credential's own (namespaced, as registry mutations), so another
8090
8193
  // credential's request is never answered as a duplicate of it; alpd's errors leave as fixed text.
8091
8194
  "session.rewind": async (params) => {
8195
+ if (this.#grant.agent === true) throw forbidden("session.rewind is the user's; this credential is an agent's", "user_only");
8092
8196
  await this.#conversationRoot(params.sessionId);
8093
8197
  const result = await this.#call("session.rewind", { ...params, requestId: this.#registryRequestId(params.requestId) }).catch((error) => {
8094
8198
  throw this.#conversationError(error);
@@ -8103,6 +8207,7 @@ ${session.id}`.toLowerCase().includes(word))));
8103
8207
  // Reload (§12.8, issue #121 G2): the root's native process restarts on its own conversation. A
8104
8208
  // root in the grant, looked up afresh, driven within the grant's modes as session.prompt is.
8105
8209
  "session.reload": async (params) => {
8210
+ if (this.#grant.agent === true) throw forbidden("session.reload is the user's; this credential is an agent's", "user_only");
8106
8211
  await this.#conversationRoot(params.sessionId, RELOAD_REFUSALS);
8107
8212
  const result = await this.#call("session.reload", { ...params, requestId: this.#registryRequestId(params.requestId) }).catch((error) => {
8108
8213
  throw this.#conversationError(error, RELOAD_REFUSALS);
@@ -8112,6 +8217,18 @@ ${session.id}`.toLowerCase().includes(word))));
8112
8217
  await this.#seeForkSources([session]);
8113
8218
  return { session: this.#safeSession(session), ...result.duplicate === true ? { duplicate: true } : {} };
8114
8219
  },
8220
+ // Compaction (t-de1a): a root in the grant, looked up afresh and driven within the grant's modes as
8221
+ // session.prompt is (its checkpoint turn drives the session); the answer is its status only.
8222
+ "session.compact": async (params) => {
8223
+ if (this.#grant.agent === true) throw forbidden("session.compact is the user's; this credential is an agent's", "user_only");
8224
+ await this.#conversationRoot(params.sessionId, COMPACT_REFUSALS);
8225
+ const result = await this.#call("session.compact", { sessionId: params.sessionId }).catch((error) => {
8226
+ throw this.#conversationError(error, COMPACT_REFUSALS);
8227
+ });
8228
+ const status = result?.status;
8229
+ if (status !== "started" && status !== "deferred" && status !== "running") throw this.#conversationRefused("session.compact", "shape");
8230
+ return { status };
8231
+ },
8115
8232
  // The composer's "/" list: known fields of each entry only, never a path.
8116
8233
  "session.commands": async (params) => {
8117
8234
  await this.#resolve(params.sessionId);
@@ -8138,6 +8255,7 @@ ${session.id}`.toLowerCase().includes(word))));
8138
8255
  // registry workspace the grant names exactly; alpd gets this credential's principal context and
8139
8256
  // re-authorizes the source's attachments for it. The created root is checked before it is answered.
8140
8257
  "session.fork": async (params) => {
8258
+ if (this.#grant.agent === true) throw forbidden("session.fork is the user's; this credential is an agent's", "user_only");
8141
8259
  const scoped = await this.#conversationRoot(params.sessionId);
8142
8260
  let destination;
8143
8261
  if (params.workspaceId !== void 0) destination = this.#workspace((await this.#registryWorkspace(params.workspaceId)).workspace.directory);
@@ -9068,7 +9186,7 @@ Content-Length: 0\r
9068
9186
 
9069
9187
  // apps/gateway/src/credentials.js
9070
9188
  import { createHash as createHash5, randomBytes as randomBytes4, timingSafeEqual } from "node:crypto";
9071
- import { lstat as lstat2, readFile as readFile4, realpath as realpath2, rename as rename3, stat as stat3, writeFile as writeFile5, chmod, unlink as unlink5 } from "node:fs/promises";
9189
+ import { lstat as lstat2, readFile as readFile4, realpath as realpath2, rename as rename3, stat as stat3, writeFile as writeFile5, chmod as chmod2, unlink as unlink5 } from "node:fs/promises";
9072
9190
  import { setTimeout as sleep } from "node:timers/promises";
9073
9191
  import path7 from "node:path";
9074
9192
  var RETRIABLE_RENAME_ERRORS = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
@@ -9133,7 +9251,7 @@ async function writeCredentials(home, data) {
9133
9251
  try {
9134
9252
  await writeFile5(temporary, `${JSON.stringify(data, null, 2)}
9135
9253
  `, { mode: 384, flag: "wx" });
9136
- await chmod(temporary, 384);
9254
+ await chmod2(temporary, 384);
9137
9255
  await renameWithRetry(temporary, file);
9138
9256
  } catch (error) {
9139
9257
  await unlink5(temporary).catch(() => {
@@ -9176,8 +9294,14 @@ function checkModes(modes) {
9176
9294
  if (!Array.isArray(modes) || !modes.length || modes.some((mode) => typeof mode !== "string" || !MODE.test(mode))) throw new Error("modes must be a non-empty list of session mode ids");
9177
9295
  return [...new Set(modes)];
9178
9296
  }
9179
- async function createCredential(home, { label, workspaces, permissions, worktreeMappings = [], modes, expiresAt, now = /* @__PURE__ */ new Date() }) {
9297
+ function checkAgent(agent) {
9298
+ if (agent === void 0 || typeof agent === "boolean") return { agent: agent === true };
9299
+ if (typeof agent !== "string" || !AGENT_NAME.test(agent) || agent === "true" || agent === "false") throw new Error(`agent must be true, false or an agent name (lower-case letters, digits and single hyphens, starting with a letter, at most 64 characters, not true or false); got ${JSON.stringify(agent)}`);
9300
+ return { agent: true, name: agent };
9301
+ }
9302
+ async function createCredential(home, { label, workspaces, permissions, worktreeMappings = [], modes, agent, expiresAt, now = /* @__PURE__ */ new Date() }) {
9180
9303
  if (typeof label !== "string" || !label.trim() || label.length > 100) throw new Error("A credential needs a label of 1 to 100 characters");
9304
+ const forAgent = checkAgent(agent);
9181
9305
  if (expiresAt !== void 0 && !(Date.parse(expiresAt) > now.getTime())) throw new Error("expiresAt must be a future ISO 8601 time");
9182
9306
  const data = await readCredentials(home);
9183
9307
  const token = newToken();
@@ -9190,6 +9314,8 @@ async function createCredential(home, { label, workspaces, permissions, worktree
9190
9314
  worktreeMappings: checkMappings(worktreeMappings),
9191
9315
  scopeId: randomBytes4(16).toString("hex"),
9192
9316
  ...checkModes(modes) ? { modes: checkModes(modes) } : {},
9317
+ ...forAgent.agent ? { agent: true } : {},
9318
+ ...forAgent.name ? { agentName: forAgent.name } : {},
9193
9319
  createdAt: now.toISOString(),
9194
9320
  ...expiresAt ? { expiresAt: new Date(expiresAt).toISOString() } : {}
9195
9321
  };
@@ -9225,6 +9351,12 @@ async function revokeCredential(home, id, { now = /* @__PURE__ */ new Date() } =
9225
9351
  async function listCredentials(home) {
9226
9352
  return (await readCredentials(home)).credentials.map(describeCredential);
9227
9353
  }
9354
+ function malformedAgent(stored) {
9355
+ if (stored.agent !== void 0 && stored.agent !== true) return "agent is not true";
9356
+ if (stored.agentName !== void 0 && stored.agent !== true) return "agentName on a credential that is not an agent's";
9357
+ if (stored.agentName !== void 0 && (typeof stored.agentName !== "string" || !AGENT_NAME.test(stored.agentName))) return "agentName is not a valid agent name";
9358
+ return void 0;
9359
+ }
9228
9360
  function grantOf(stored, now) {
9229
9361
  if (stored.revokedAt) return void 0;
9230
9362
  const expiresAt = stored.expiresAt === void 0 ? void 0 : Date.parse(stored.expiresAt);
@@ -9239,6 +9371,9 @@ function grantOf(stored, now) {
9239
9371
  return void 0;
9240
9372
  }
9241
9373
  if (stored.scopeId !== void 0 && (typeof stored.scopeId !== "string" || !/^[a-f0-9]{32}$/.test(stored.scopeId))) return void 0;
9374
+ if (malformedAgent(stored)) return void 0;
9375
+ const agent = stored.agent === true;
9376
+ const agentName = stored.agentName;
9242
9377
  return (
9243
9378
  /** @type {Grant} */
9244
9379
  {
@@ -9249,9 +9384,13 @@ function grantOf(stored, now) {
9249
9384
  worktreeMappings: mappingIds,
9250
9385
  scopeId: stored.scopeId ?? digest(JSON.stringify([workspaces, permissions, stored.worktreeMappings ?? []])),
9251
9386
  ...Array.isArray(stored.modes) ? { modes: new Set(stored.modes.filter((mode) => typeof mode === "string")) } : {},
9387
+ ...agent ? { agent: true } : {},
9388
+ ...agentName ? { agentName } : {},
9252
9389
  ...expiresAt !== void 0 ? { expiresAt } : {},
9253
9390
  secretHash: stored.hash,
9254
- fingerprint: JSON.stringify([workspaces, permissions, stored.modes ?? null, stored.expiresAt ?? null, stored.worktreeMappings ?? [], stored.scopeId ?? null])
9391
+ // The mark is appended only when set: a user credential's fingerprint (its epoch, when it has
9392
+ // no scopeId) stays what it was; gaining the mark changes it, so its connections close.
9393
+ fingerprint: JSON.stringify([workspaces, permissions, stored.modes ?? null, stored.expiresAt ?? null, stored.worktreeMappings ?? [], stored.scopeId ?? null, ...agent ? ["agent"] : [], ...agentName ? [agentName] : []])
9255
9394
  }
9256
9395
  );
9257
9396
  }
@@ -9265,6 +9404,8 @@ var CredentialStore = class {
9265
9404
  /** @type {ReturnType<typeof setInterval> | undefined} */
9266
9405
  #timer;
9267
9406
  #signature = "";
9407
+ /** @type {Map<string, string>} */
9408
+ #malformed = /* @__PURE__ */ new Map();
9268
9409
  #home;
9269
9410
  #log;
9270
9411
  #now;
@@ -9289,6 +9430,15 @@ var CredentialStore = class {
9289
9430
  this.#log?.error("the credentials file cannot be used; every credential is refused until it is fixed", { code: "ALP_GATEWAY_CREDENTIALS_UNREADABLE", error });
9290
9431
  }
9291
9432
  this.#stored = new Map(list.filter((entry) => typeof entry?.id === "string").map((entry) => [entry.id, entry]));
9433
+ const malformed = /* @__PURE__ */ new Map();
9434
+ for (const [id, stored] of this.#stored) {
9435
+ const reason = malformedAgent(stored);
9436
+ if (!reason) continue;
9437
+ const mark = createHash5("sha256").update(JSON.stringify([stored.agent, stored.agentName])).digest("hex");
9438
+ malformed.set(id, mark);
9439
+ if (this.#malformed.get(id) !== mark) this.#log?.warn("a credential with a malformed agent mark is skipped; every connection with it is refused", { code: "ALP_GATEWAY_CREDENTIAL_MALFORMED_AGENT", id, reason });
9440
+ }
9441
+ this.#malformed = malformed;
9292
9442
  this.#refresh();
9293
9443
  }
9294
9444
  /** Re-evaluates expiry; the gateway calls it on a timer so expired grants close their connections. */
@@ -9374,7 +9524,7 @@ function scrubGatewaySecrets(line) {
9374
9524
  );
9375
9525
  return result;
9376
9526
  }
9377
- function createGatewayLogger({ write, level, env } = {}) {
9527
+ function createGatewayLogger({ write, level, env: env2 } = {}) {
9378
9528
  const sink = write ?? ((line) => {
9379
9529
  try {
9380
9530
  process.stderr.write(`${line}
@@ -9382,15 +9532,28 @@ function createGatewayLogger({ write, level, env } = {}) {
9382
9532
  } catch {
9383
9533
  }
9384
9534
  });
9385
- return createLogger({ component: "alp-gateway", level, env, write: (line) => sink(scrubGatewaySecrets(line)) });
9535
+ return createLogger({ component: "alp-gateway", level, env: env2, write: (line) => sink(scrubGatewaySecrets(line)) });
9386
9536
  }
9387
9537
 
9388
- // packages/cli/src/web/grant.js
9538
+ // packages/cli/src/dashboard/grant.js
9389
9539
  import { mkdir as mkdir5, realpath as realpath3, stat as stat4 } from "node:fs/promises";
9390
9540
  import path8 from "node:path";
9391
- var LABEL = "alp web (this machine)";
9541
+
9542
+ // packages/core/src/tasks.js
9543
+ var AGENT_MARKER = "ALP_AGENT_SESSION";
9544
+ var isAgentProcess = (env2 = process.env) => typeof env2[AGENT_MARKER] === "string" && env2[AGENT_MARKER] !== "";
9545
+ var LOCK = ".lock";
9546
+ var GITIGNORE = `${LOCK}
9547
+ *.tmp
9548
+ `;
9549
+ var GATE_REJECT_LABELS = ["Reject", "T\u1EEB ch\u1ED1i"];
9550
+ var labelKey = (text) => text.normalize("NFC").trim().toLowerCase();
9551
+ var REJECT_KEYS = new Set(GATE_REJECT_LABELS.map(labelKey));
9552
+
9553
+ // packages/cli/src/dashboard/grant.js
9554
+ var LABEL = "alp dashboard (this machine)";
9392
9555
  var BASE_PERMISSIONS = Object.freeze([...DEFAULT_PERMISSIONS, "workspace.write"]);
9393
- var webGatewayHome = (home) => path8.join(home, "web");
9556
+ var dashboardGatewayHome = (home) => path8.join(home, "dashboard");
9394
9557
  function grantPermissions(extra, warn = () => {
9395
9558
  }) {
9396
9559
  const wanted = new Set(BASE_PERMISSIONS);
@@ -9401,7 +9564,7 @@ function grantPermissions(extra, warn = () => {
9401
9564
  /** @type {string[]} */
9402
9565
  extra
9403
9566
  ) wanted.add(entry);
9404
- else warn(`ignoring web.permissions: ${unknown.map((entry) => JSON.stringify(entry)).join(", ")} ${unknown.length === 1 ? "is not a permission" : "are not permissions"} a credential may hold (${PERMISSIONS.join(", ")}); the default grant (${BASE_PERMISSIONS.join(", ")}) is in use`);
9567
+ else warn(`ignoring dashboard.permissions: ${unknown.map((entry) => JSON.stringify(entry)).join(", ")} ${unknown.length === 1 ? "is not a permission" : "are not permissions"} a credential may hold (${PERMISSIONS.join(", ")}); the default grant (${BASE_PERMISSIONS.join(", ")}) is in use`);
9405
9568
  }
9406
9569
  if (wanted.has("session.write")) wanted.add("session.read");
9407
9570
  if (wanted.has("project.write") || wanted.has("library.write")) wanted.add("project.read");
@@ -9447,7 +9610,7 @@ async function registryRoots(socket, { timeoutMs = 3e3 } = {}) {
9447
9610
  async function listRoots(socket, opened) {
9448
9611
  let client;
9449
9612
  try {
9450
- client = await connect(socket, { name: "alp-web", version: "1" });
9613
+ client = await connect(socket, { name: "alp-dashboard", version: "1" });
9451
9614
  opened(client);
9452
9615
  const roots = [];
9453
9616
  let cursor;
@@ -9477,7 +9640,7 @@ var sameWorkspaces = (a, b) => {
9477
9640
  var samePermissions = (a, b) => JSON.stringify([...a].sort()) === JSON.stringify([...b].sort());
9478
9641
  function createGrant({ home, store, permissions, project, socket, log = () => {
9479
9642
  } }) {
9480
- const credentialsHome = webGatewayHome(home);
9643
+ const credentialsHome = dashboardGatewayHome(home);
9481
9644
  const placeholder = path8.join(credentialsHome, "no-project");
9482
9645
  let tail2 = Promise.resolve();
9483
9646
  const serial = (run2) => {
@@ -9505,12 +9668,13 @@ function createGrant({ home, store, permissions, project, socket, log = () => {
9505
9668
  settled: () => tail2.then(() => void 0),
9506
9669
  /**
9507
9670
  * Reuses the credential of `token` when it still verifies, else creates one; revokes every other
9508
- * live credential in alp-web's file. Returns the token to publish.
9509
- * @param {{ token?: unknown, credentialId?: unknown }} previous what web.json held
9671
+ * live credential in alp dashboard's file. Returns the token to publish.
9672
+ * @param {{ token?: unknown, credentialId?: unknown }} previous what dashboard.json held
9510
9673
  */
9511
9674
  ensure: (previous) => serial(async () => {
9675
+ if (isAgentProcess()) throw new Error("alp dashboard hands out a user credential; this process was started by an ALP agent (ALP_AGENT_SESSION is set), so it is refused");
9512
9676
  await assertPrivateDirectory(credentialsHome, { create: true }).catch((error) => {
9513
- throw new Error(`alp web keeps its credentials in ${credentialsHome}, which must be a directory owned by you with private permissions (0700); run chmod 700 on it (${error?.message ?? error})`, { cause: error });
9677
+ throw new Error(`alp dashboard keeps its credentials in ${credentialsHome}, which must be a directory owned by you with private permissions (0700); run chmod 700 on it (${error?.message ?? error})`, { cause: error });
9514
9678
  });
9515
9679
  await store.reload();
9516
9680
  const reused = typeof previous.token === "string" ? store.verify(previous.token) : void 0;
@@ -9561,7 +9725,7 @@ function createGrant({ home, store, permissions, project, socket, log = () => {
9561
9725
  };
9562
9726
  }
9563
9727
 
9564
- // packages/cli/src/web/serve.js
9728
+ // packages/cli/src/dashboard/serve.js
9565
9729
  import { createReadStream } from "node:fs";
9566
9730
  import { realpath as realpath4, stat as stat5 } from "node:fs/promises";
9567
9731
  import path9 from "node:path";
@@ -9589,16 +9753,16 @@ var TYPES = {
9589
9753
  };
9590
9754
  var FORBIDDEN_IN_SEGMENT = /[\u0000-\u001f\u007f/\\:]/;
9591
9755
  var missingPage = (dir) => `<!doctype html><meta charset="utf-8"><title>ALP</title><body style="font:16px system-ui;max-width:40rem;margin:4rem auto;padding:0 1rem">
9592
- <h1>ALP web is not built</h1><p>The web app's files are missing from <code>${dir.replace(/[&<>"]/g, (char) => `&#${char.charCodeAt(0)};`)}</code>. Build them from a checkout with <code>node scripts/build-workspace.mjs cli</code> (or <code>node scripts/build-alp-web.mjs</code>), or install ALP from npm, which carries them. The gateway on this address keeps running.</p>`;
9756
+ <h1>ALP dashboard is not built</h1><p>The web app's files are missing from <code>${dir.replace(/[&<>"]/g, (char) => `&#${char.charCodeAt(0)};`)}</code>. Build them from a checkout with <code>node scripts/build-workspace.mjs cli</code> (or <code>node scripts/build-alp-dashboard.mjs</code>), or install ALP from npm, which carries them. The gateway on this address keeps running.</p>`;
9593
9757
  function parseTarget(raw) {
9594
9758
  if (typeof raw !== "string" || !raw.startsWith("/") || raw.includes("\\") || /%5c/i.test(raw) || raw.includes("\0")) return { status: 400 };
9595
9759
  let url;
9596
9760
  try {
9597
- url = new URL(`http://alp-web.invalid${raw}`);
9761
+ url = new URL(`http://alp-dashboard.invalid${raw}`);
9598
9762
  } catch {
9599
9763
  return { status: 400 };
9600
9764
  }
9601
- if (url.host !== "alp-web.invalid") return { status: 400 };
9765
+ if (url.host !== "alp-dashboard.invalid") return { status: 400 };
9602
9766
  const parts = url.pathname.split("/").slice(1);
9603
9767
  const segments = [];
9604
9768
  for (let index = 0; index < parts.length; index++) {
@@ -9694,18 +9858,20 @@ function createStaticServer({ dir, csp, log = () => {
9694
9858
  };
9695
9859
  }
9696
9860
 
9697
- // packages/cli/src/web/main.js
9698
- var VERSION = true ? "0.0.1-beta.7" : "0.0.0-source";
9861
+ // packages/cli/src/dashboard/main.js
9862
+ var VERSION = true ? "0.0.1-beta.9" : "0.0.0-source";
9699
9863
  var DEFAULT_WEB_PORT = 7433;
9700
9864
  var PORT_TRIES = 10;
9701
- var REFRESH_MS = Number(process.env.ALP_WEB_GRANT_REFRESH_MS) > 0 ? Number(process.env.ALP_WEB_GRANT_REFRESH_MS) : 5e3;
9865
+ var env = (name2) => process.env[`ALP_DASHBOARD_${name2}`] || process.env[`ALP_WEB_${name2}`] || void 0;
9866
+ var REFRESH_MS = Number(env("GRANT_REFRESH_MS")) > 0 ? Number(env("GRANT_REFRESH_MS")) : 5e3;
9702
9867
  var WEB_FILE_VERSION = 2;
9703
9868
  var here = path10.dirname(fileURLToPath(import.meta.url));
9704
- var appDir = () => path10.resolve(process.env.ALP_WEB_APP || path10.join(here, "alp-web"));
9705
- var daemonEntry = () => process.env.ALP_DAEMON_ENTRY ?? selfEntry(path10.join(here, "alpd.js"));
9706
- var webFile = (home) => path10.join(home, "web.json");
9869
+ var appDir = () => path10.resolve(env("APP") || path10.join(here, "alp-dashboard"));
9870
+ var daemonEntry2 = () => process.env.ALP_DAEMON_ENTRY ?? daemonEntry(path10.join(here, "alpd.js"));
9871
+ var webFile = (home) => path10.join(home, "dashboard.json");
9872
+ var legacyWebFile = (home) => path10.join(home, "web.json");
9707
9873
  function serviceLog(home) {
9708
- const file = path10.join(home, "logs", "integrations", "alp-web.log");
9874
+ const file = path10.join(home, "logs", "integrations", "alp-dashboard.log");
9709
9875
  mkdirSync(path10.dirname(file), { recursive: true, mode: 448 });
9710
9876
  const fd = openSync(file, "a", 384);
9711
9877
  for (const stream of [process.stdout, process.stderr]) {
@@ -9742,7 +9908,7 @@ async function userSettings(home, log) {
9742
9908
  async function previousWeb(home) {
9743
9909
  try {
9744
9910
  const kept = JSON.parse(await readFile5(webFile(home), "utf8"));
9745
- if (kept?.app !== "alp-web" || kept?.version !== WEB_FILE_VERSION || !parseToken(kept.token)) return {};
9911
+ if (kept?.app !== "alp-dashboard" || kept?.version !== WEB_FILE_VERSION || !parseToken(kept.token)) return {};
9746
9912
  return { token: kept.token, credentialId: kept.credentialId };
9747
9913
  } catch {
9748
9914
  return {};
@@ -9754,7 +9920,7 @@ async function publish(home, info) {
9754
9920
  try {
9755
9921
  await writeFile6(temporary, `${JSON.stringify(info)}
9756
9922
  `, { mode: 384, flag: "wx" });
9757
- await chmod2(temporary, 384);
9923
+ await chmod3(temporary, 384);
9758
9924
  await renameWithRetry(temporary, file);
9759
9925
  } catch (error) {
9760
9926
  await unlink6(temporary).catch(() => {
@@ -9766,7 +9932,7 @@ var LOCK_HELD = 3;
9766
9932
  async function carryPaseoIdentity(home, log) {
9767
9933
  let legacy;
9768
9934
  try {
9769
- legacy = JSON.parse(await readFile5(webFile(home), "utf8"));
9935
+ legacy = JSON.parse(await readFile5(legacyWebFile(home), "utf8"));
9770
9936
  } catch {
9771
9937
  return false;
9772
9938
  }
@@ -9781,51 +9947,51 @@ async function carryPaseoIdentity(home, log) {
9781
9947
  try {
9782
9948
  await writeFile6(temporary, `${JSON.stringify(identity)}
9783
9949
  `, { mode: 384, flag: "wx" });
9784
- await chmod2(temporary, 384);
9950
+ await chmod3(temporary, 384);
9785
9951
  await link2(temporary, target);
9786
9952
  } catch (error) {
9787
9953
  if (
9788
9954
  /** @type {any} */
9789
9955
  error?.code === "EEXIST"
9790
9956
  ) return false;
9791
- throw new Error(`the Paseo integration's identity in ${webFile(home)} could not be kept in ${target}, so alp web leaves web.json alone: ${/** @type {any} */
9957
+ throw new Error(`the Paseo integration's identity in ${legacyWebFile(home)} could not be kept in ${target}, so alp dashboard does not start: ${/** @type {any} */
9792
9958
  error?.message ?? error}`, { cause: error });
9793
9959
  } finally {
9794
9960
  await unlink6(temporary).catch(() => {
9795
9961
  });
9796
9962
  }
9797
- log.info(`kept the Paseo integration's identity from web.json in ${target}, so paired devices stay paired`, { code: "ALP_WEB_PASEO_IDENTITY" });
9963
+ log.info(`kept the Paseo integration's identity from web.json in ${target}, so paired devices stay paired`, { code: "ALP_DASHBOARD_PASEO_IDENTITY" });
9798
9964
  return true;
9799
9965
  }
9800
- async function rotate(home, project, settings, log) {
9801
- const lock = createIntegrationLock(home, "web");
9966
+ async function rotate(home, project, dashboard, log) {
9967
+ const lock = createIntegrationLock(home, "dashboard");
9802
9968
  const { acquired, lock: held } = await lock.acquire();
9803
9969
  if (!acquired) {
9804
- process.stderr.write(`alp web runs (pid ${held.pid}); it must stop before its token is rotated
9970
+ process.stderr.write(`alp dashboard runs (pid ${held.pid}); it must stop before its token is rotated
9805
9971
  `);
9806
9972
  process.exit(LOCK_HELD);
9807
9973
  }
9808
9974
  let code = 0;
9809
9975
  try {
9810
9976
  await carryPaseoIdentity(home, log);
9811
- const permissions = grantPermissions(settings?.web?.permissions, (message) => log.warn(message, { code: "ALP_WEB_PERMISSIONS_IGNORED" }));
9812
- const store = new CredentialStore({ home: webGatewayHome(home), logger: log });
9977
+ const permissions = grantPermissions(dashboard.permissions, (message) => log.warn(message, { code: "ALP_DASHBOARD_PERMISSIONS_IGNORED" }));
9978
+ const store = new CredentialStore({ home: dashboardGatewayHome(home), logger: log });
9813
9979
  try {
9814
9980
  const socket = daemonPaths(home).socket;
9815
- const grant = createGrant({ home, store, permissions, project, socket: () => socket, log: (message) => log.info(message, { code: "ALP_WEB_GRANT" }) });
9981
+ const grant = createGrant({ home, store, permissions, project, socket: () => socket, log: (message) => log.info(message, { code: "ALP_DASHBOARD_GRANT" }) });
9816
9982
  const token = await grant.ensure({});
9817
9983
  await grant.settled();
9818
- await publish(home, { version: WEB_FILE_VERSION, app: "alp-web", token, credentialId: grant.id });
9819
- log.info(`rotated the token: credential ${grant.id}`, { code: "ALP_WEB_ROTATED" });
9984
+ await publish(home, { version: WEB_FILE_VERSION, app: "alp-dashboard", token, credentialId: grant.id });
9985
+ log.info(`rotated the token: credential ${grant.id}`, { code: "ALP_DASHBOARD_ROTATED" });
9820
9986
  } finally {
9821
9987
  store.close();
9822
9988
  }
9823
9989
  } catch (error) {
9824
- log.error("alp web could not rotate its token", { code: "ALP_WEB_ROTATE_FAILED", error });
9990
+ log.error("alp dashboard could not rotate its token", { code: "ALP_DASHBOARD_ROTATE_FAILED", error });
9825
9991
  code = 1;
9826
9992
  }
9827
9993
  await lock.release().catch((error) => {
9828
- log.error("web lock not released", { code: "ALP_LOCK_RELEASE_FAILED", error });
9994
+ log.error("dashboard lock not released", { code: "ALP_LOCK_RELEASE_FAILED", error });
9829
9995
  code = 1;
9830
9996
  });
9831
9997
  process.exit(code);
@@ -9846,25 +10012,27 @@ var policy = (port) => {
9846
10012
  ].join("; ");
9847
10013
  };
9848
10014
  async function run() {
9849
- const { values } = parseArgs({ options: { service: { type: "boolean" }, rotate: { type: "boolean" }, project: { type: "string" } }, strict: true });
10015
+ const { values } = parseArgs({ options: { service: { type: "boolean" }, rotate: { type: "boolean" }, project: { type: "string" }, port: { type: "string" } }, strict: true });
10016
+ const portOption = values.port === void 0 ? void 0 : Number(values.port);
10017
+ if (portOption !== void 0 && !(Number.isInteger(portOption) && portOption >= 1024 && portOption <= 65535)) throw new Error(`--port must be a port from 1024 to 65535, not ${values.port}`);
9850
10018
  const home = alpHome();
9851
10019
  await mkdir6(home, { recursive: true, mode: 448 });
9852
10020
  if (values.service) serviceLog(home);
9853
10021
  const log = createGatewayLogger();
9854
- const settings = await userSettings(home, log);
9855
- if (values.rotate) return rotate(home, values.project ? path10.resolve(values.project) : void 0, settings, log);
9856
- if (settings?.web?.enabled === false) {
9857
- log.info('alp web is disabled by settings ("web.enabled": false)', { code: "ALP_WEB_DISABLED" });
10022
+ const dashboard = dashboardSettings(await userSettings(home, log));
10023
+ if (values.rotate) return rotate(home, values.project ? path10.resolve(values.project) : void 0, dashboard, log);
10024
+ if (dashboard.enabled === false) {
10025
+ log.info('alp dashboard is disabled by settings ("dashboard.enabled": false)', { code: "ALP_DASHBOARD_DISABLED" });
9858
10026
  process.exit(0);
9859
10027
  }
9860
10028
  const project = values.project ? path10.resolve(values.project) : void 0;
9861
- const lock = createIntegrationLock(home, "web");
10029
+ const lock = createIntegrationLock(home, "dashboard");
9862
10030
  const { acquired, lock: held } = await lock.acquire();
9863
10031
  if (!acquired) {
9864
- log.info(`alp web already runs (pid ${held.pid})`, { code: "ALP_LOCK_HELD" });
10032
+ log.info(`alp dashboard already runs (pid ${held.pid})`, { code: "ALP_LOCK_HELD" });
9865
10033
  process.exit(0);
9866
10034
  }
9867
- const releaseLock = () => lock.release().catch((error) => log.error("web lock not released; alp web stops anyway", { code: "ALP_LOCK_RELEASE_FAILED", error }));
10035
+ const releaseLock = () => lock.release().catch((error) => log.error("dashboard lock not released; alp dashboard stops anyway", { code: "ALP_LOCK_RELEASE_FAILED", error }));
9868
10036
  const cleanups = [];
9869
10037
  let shuttingDown = false;
9870
10038
  let startup = Promise.resolve();
@@ -9874,7 +10042,7 @@ async function run() {
9874
10042
  try {
9875
10043
  await startup.catch(() => {
9876
10044
  });
9877
- for (const cleanup of cleanups.reverse()) await cleanup().catch((error) => log.warn("a shutdown step failed", { code: "ALP_WEB_SHUTDOWN_STEP", error }));
10045
+ for (const cleanup of cleanups.reverse()) await cleanup().catch((error) => log.warn("a shutdown step failed", { code: "ALP_DASHBOARD_SHUTDOWN_STEP", error }));
9878
10046
  await releaseLock();
9879
10047
  } finally {
9880
10048
  process.exit(code);
@@ -9886,16 +10054,16 @@ async function run() {
9886
10054
  ["SIGINT", "SIGTERM"]
9887
10055
  ) process.on(signal, () => void shutdown());
9888
10056
  process.on("uncaughtException", (error) => {
9889
- log.error("uncaught exception; alp web stops", { code: "ALP_FATAL", error });
10057
+ log.error("uncaught exception; alp dashboard stops", { code: "ALP_FATAL", error });
9890
10058
  void shutdown(1);
9891
10059
  });
9892
10060
  startup = (async () => {
9893
10061
  const stopDaemon = process.env.ALP_SUPERVISE === "0" ? async () => {
9894
- } : superviseDaemon({ home, entry: daemonEntry, by: "alp web", log: (message) => log.warn(message, { code: "ALP_DAEMON_SUPERVISION" }) });
10062
+ } : superviseDaemon({ home, entry: daemonEntry2, by: "alp dashboard", log: (message) => log.warn(message, { code: "ALP_DAEMON_SUPERVISION" }) });
9895
10063
  cleanups.push(() => stopDaemon());
9896
- const permissions = grantPermissions(settings?.web?.permissions, (message) => log.warn(message, { code: "ALP_WEB_PERMISSIONS_IGNORED" }));
9897
- if (permissions.includes("terminal.exec")) log.warn(TERMINAL_EXEC_WARNING, { code: "ALP_WEB_TERMINAL_EXEC" });
9898
- const store = new CredentialStore({ home: webGatewayHome(home), logger: log });
10064
+ const permissions = grantPermissions(dashboard.permissions, (message) => log.warn(message, { code: "ALP_DASHBOARD_PERMISSIONS_IGNORED" }));
10065
+ if (permissions.includes("terminal.exec")) log.warn(TERMINAL_EXEC_WARNING, { code: "ALP_DASHBOARD_TERMINAL_EXEC" });
10066
+ const store = new CredentialStore({ home: dashboardGatewayHome(home), logger: log });
9899
10067
  cleanups.push(async () => store.close());
9900
10068
  const socket = daemonPaths(home).socket;
9901
10069
  const grant = createGrant({
@@ -9904,7 +10072,7 @@ async function run() {
9904
10072
  permissions,
9905
10073
  project,
9906
10074
  socket: () => socket,
9907
- log: (message) => log.info(message, { code: "ALP_WEB_GRANT" })
10075
+ log: (message) => log.info(message, { code: "ALP_DASHBOARD_GRANT" })
9908
10076
  });
9909
10077
  cleanups.push(() => grant.settled());
9910
10078
  await carryPaseoIdentity(home, log);
@@ -9915,8 +10083,8 @@ async function run() {
9915
10083
  if (shuttingDown) return;
9916
10084
  const dir = appDir();
9917
10085
  let bound = 0;
9918
- const serveStatic = createStaticServer({ dir, csp: () => policy(bound), log: (message) => log.warn(message, { code: "ALP_WEB_STATIC" }) });
9919
- const base = settings?.web?.port ?? DEFAULT_WEB_PORT;
10086
+ const serveStatic = createStaticServer({ dir, csp: () => policy(bound), log: (message) => log.warn(message, { code: "ALP_DASHBOARD_STATIC" }) });
10087
+ const base = portOption ?? dashboard.port ?? DEFAULT_WEB_PORT;
9920
10088
  for (let attempt = 0; ; attempt++) {
9921
10089
  if (shuttingDown) return;
9922
10090
  const port = base + attempt;
@@ -9947,12 +10115,12 @@ async function run() {
9947
10115
  error?.code
9948
10116
  );
9949
10117
  if (code !== "EADDRINUSE" && code !== "EACCES" || attempt + 1 >= PORT_TRIES) throw error;
9950
- log.info(`port ${port} is ${code === "EACCES" ? "not available" : "in use"}; trying ${port + 1}`, { code: "ALP_WEB_PORT_BUSY" });
10118
+ log.info(`port ${port} is ${code === "EACCES" ? "not available" : "in use"}; trying ${port + 1}`, { code: "ALP_DASHBOARD_PORT_BUSY" });
9951
10119
  }
9952
10120
  }
9953
10121
  if (shuttingDown) return;
9954
10122
  const url = `http://127.0.0.1:${bound}/`;
9955
- await publish(home, { version: WEB_FILE_VERSION, app: "alp-web", pid: process.pid, port: bound, url, token, credentialId: grant.id });
10123
+ await publish(home, { version: WEB_FILE_VERSION, app: "alp-dashboard", pid: process.pid, port: bound, url, token, credentialId: grant.id });
9956
10124
  if (shuttingDown) return;
9957
10125
  const timer = setInterval(() => {
9958
10126
  if (!shuttingDown) void grant.refresh();
@@ -9980,16 +10148,16 @@ async function run() {
9980
10148
  });
9981
10149
  } catch {
9982
10150
  }
9983
- if (!await lock.setReady(true)) throw new Error("the web lock is no longer held by this process");
9984
- log.info(`alp web on ${url}`, { code: "ALP_WEB_LISTENING" });
10151
+ if (!await lock.setReady(true)) throw new Error("the dashboard lock is no longer held by this process");
10152
+ log.info(`alp dashboard on ${url}`, { code: "ALP_DASHBOARD_LISTENING" });
9985
10153
  })();
9986
10154
  await startup.catch((error) => {
9987
- log.error("alp web did not start", { code: "ALP_WEB_START_FAILED", error });
10155
+ log.error("alp dashboard did not start", { code: "ALP_DASHBOARD_START_FAILED", error });
9988
10156
  void shutdown(1);
9989
10157
  });
9990
10158
  }
9991
10159
  await run().catch((error) => {
9992
- createGatewayLogger().error("alp web did not start", { code: "ALP_WEB_START_FAILED", error });
10160
+ createGatewayLogger().error("alp dashboard did not start", { code: "ALP_DASHBOARD_START_FAILED", error });
9993
10161
  process.exitCode = 1;
9994
10162
  });
9995
10163
  export {