@agentconnect.md/daemon 1.0.0-rc.220 → 1.0.0-rc.221

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.
@@ -435,6 +435,7 @@ const AgentSpec = object({
435
435
  "high"
436
436
  ]).optional(),
437
437
  fastMode: boolean().optional(),
438
+ permissionMode: string().optional(),
438
439
  workspace: AgentWorkspace.optional(),
439
440
  env: record(string(), string()).optional()
440
441
  });
@@ -899,6 +900,82 @@ const WorkspaceGitPullResult = object({
899
900
  deletions: number().int().nonnegative().optional()
900
901
  });
901
902
  //#endregion
903
+ //#region ../protocol/dist/frames/memory.js
904
+ /**
905
+ * Agent memory directory (C→D REQ → REP) — the console's read/write of an agent's
906
+ * long-term memory, and the surface the daemon serves it from.
907
+ *
908
+ * Memory is a DIRECTORY at the agent's ROOT (`<agent-root>/memory/`), OUTSIDE the
909
+ * workspace — so it survives a workspace reset / re-clone and is never committed
910
+ * into a github-workspace repo. It follows the index-plus-topics shape: a lean
911
+ * `MEMORY.md` index (injected into the prompt every session, bounded) plus any
912
+ * number of `<topic>.md` files the agent reads on demand. The agent maintains it
913
+ * via MCP tools; these frames are the third channel — the CP reading/writing it
914
+ * for the console — all pointing at the same directory.
915
+ *
916
+ * The CP stores NO memory content — bytes are pulled live from the owning daemon
917
+ * and proxied to the console, never persisted (body-locality). A not-yet-created
918
+ * file/dir is DATA (`exists:false`), not an error; only an unknown agent or a
919
+ * path-containment violation (`BAD_PAYLOAD`) or an unexpected fs failure
920
+ * (`INTERNAL`) comes back as an `error` frame.
921
+ *
922
+ * - `memory/list`: the topic files in the memory dir (flat; the index + topics).
923
+ * - `memory/read`: one byte slice of a memory file (`path` relative to the memory
924
+ * dir; default `MEMORY.md`). `limit` is a ceiling — the daemon returns fewer
925
+ * bytes to keep the JSON-escaped REP under the 256 KiB frame cap and always ends
926
+ * on a UTF-8 boundary. `nextOffset` is authoritative — do NOT recompute it.
927
+ * - `memory/write`: replace the whole named memory file with `content`.
928
+ */
929
+ /** The default file name of the memory index (loaded into the prompt each session). */
930
+ const MEMORY_INDEX = "MEMORY.md";
931
+ /** One entry in a memory-dir listing (name-only; not a path). */
932
+ const MemoryEntry = object({
933
+ name: string(),
934
+ size: number().int().nonnegative(),
935
+ mtime: string()
936
+ });
937
+ /** C→D REQ: list the files in the agent's memory dir. */
938
+ const MemoryListReq = object({ agentId: string().min(1) });
939
+ /** D→C REP (corr = the req id): the memory dir's files (or `exists:false`). */
940
+ const MemoryListPage = object({
941
+ agentId: string(),
942
+ exists: boolean(),
943
+ entries: array(MemoryEntry)
944
+ });
945
+ /** C→D REQ: read one byte slice of a memory file (path relative to the memory dir). */
946
+ const MemoryReadReq = object({
947
+ agentId: string().min(1),
948
+ path: string().default(MEMORY_INDEX),
949
+ offset: number().int().nonnegative().default(0),
950
+ limit: number().int().positive().max(65536).default(65536)
951
+ });
952
+ /** D→C REP (corr = the req id): the memory file slice (or `exists:false`). Always utf8 text. */
953
+ const MemoryReadContent = object({
954
+ agentId: string(),
955
+ path: string(),
956
+ exists: boolean(),
957
+ size: number().int().nonnegative().optional(),
958
+ mtime: string().optional(),
959
+ content: string().optional(),
960
+ offset: number().int().nonnegative().optional(),
961
+ nextOffset: number().int().nonnegative().optional(),
962
+ truncated: boolean().optional()
963
+ });
964
+ /** C→D REQ: replace the whole named memory file with `content` (console edit). */
965
+ const MemoryWriteReq = object({
966
+ agentId: string().min(1),
967
+ path: string().default(MEMORY_INDEX),
968
+ content: string(),
969
+ ifMatchMtime: string().optional()
970
+ });
971
+ /** D→C REP (corr = the req id): the written state, so the console can refresh. */
972
+ const MemoryWriteOk = object({
973
+ agentId: string(),
974
+ path: string(),
975
+ size: number().int().nonnegative(),
976
+ mtime: string()
977
+ });
978
+ //#endregion
902
979
  //#region ../protocol/dist/frames/telemetry.js
903
980
  /**
904
981
  * Telemetry & facts (D→C) — protocol §7.
@@ -1026,6 +1103,7 @@ const ErrorFrame = object({
1026
1103
  "LEASE_EXPIRED",
1027
1104
  "LEASE_DENIED",
1028
1105
  "RATE_LIMITED",
1106
+ "CONFLICT",
1029
1107
  "INTERNAL"
1030
1108
  ]),
1031
1109
  message: string(),
@@ -1077,6 +1155,7 @@ const WebchatEvent = discriminatedUnion("kind", [
1077
1155
  const WebchatStatus = object({
1078
1156
  model: string().optional(),
1079
1157
  effort: string().optional(),
1158
+ permissionMode: string().optional(),
1080
1159
  fastMode: boolean().optional(),
1081
1160
  contextUsed: number().int().optional(),
1082
1161
  contextSize: number().int().optional(),
@@ -1085,6 +1164,7 @@ const WebchatStatus = object({
1085
1164
  costCurrency: string().optional(),
1086
1165
  models: array(string()).optional(),
1087
1166
  efforts: array(string()).optional(),
1167
+ permissionModes: array(string()).optional(),
1088
1168
  fastModeAvailable: boolean().optional(),
1089
1169
  sessionId: string().optional()
1090
1170
  });
@@ -1144,6 +1224,11 @@ const FRAME_SCHEMAS = {
1144
1224
  agentId: string().uuid(),
1145
1225
  effort: string()
1146
1226
  }),
1227
+ "webchat/set-permission-mode": object({
1228
+ conversationId: string().uuid(),
1229
+ agentId: string().uuid(),
1230
+ permissionMode: string()
1231
+ }),
1147
1232
  "webchat/set-fast": object({
1148
1233
  conversationId: string().uuid(),
1149
1234
  agentId: string().uuid(),
@@ -1190,6 +1275,12 @@ const FRAME_SCHEMAS = {
1190
1275
  "workspace/gitstatus/result": WorkspaceGitStatus,
1191
1276
  "workspace/gitpull": WorkspaceGitPullReq,
1192
1277
  "workspace/gitpull/result": WorkspaceGitPullResult,
1278
+ "memory/list": MemoryListReq,
1279
+ "memory/list/page": MemoryListPage,
1280
+ "memory/read": MemoryReadReq,
1281
+ "memory/read/content": MemoryReadContent,
1282
+ "memory/write": MemoryWriteReq,
1283
+ "memory/write/ok": MemoryWriteOk,
1193
1284
  "config/push": ConfigPush,
1194
1285
  "daemon/restart": DaemonRestart,
1195
1286
  "daemon/upgrade": DaemonUpgrade,
@@ -1232,6 +1323,7 @@ discriminatedUnion("type", [
1232
1323
  frame("webchat/close", FRAME_SCHEMAS["webchat/close"]),
1233
1324
  frame("webchat/set-model", FRAME_SCHEMAS["webchat/set-model"]),
1234
1325
  frame("webchat/set-effort", FRAME_SCHEMAS["webchat/set-effort"]),
1326
+ frame("webchat/set-permission-mode", FRAME_SCHEMAS["webchat/set-permission-mode"]),
1235
1327
  frame("webchat/set-fast", FRAME_SCHEMAS["webchat/set-fast"]),
1236
1328
  frame("webchat/cancel", FRAME_SCHEMAS["webchat/cancel"]),
1237
1329
  frame("route/assign", FRAME_SCHEMAS["route/assign"]),
@@ -1274,6 +1366,12 @@ discriminatedUnion("type", [
1274
1366
  frame("workspace/gitstatus/result", FRAME_SCHEMAS["workspace/gitstatus/result"]),
1275
1367
  frame("workspace/gitpull", FRAME_SCHEMAS["workspace/gitpull"]),
1276
1368
  frame("workspace/gitpull/result", FRAME_SCHEMAS["workspace/gitpull/result"]),
1369
+ frame("memory/list", FRAME_SCHEMAS["memory/list"]),
1370
+ frame("memory/list/page", FRAME_SCHEMAS["memory/list/page"]),
1371
+ frame("memory/read", FRAME_SCHEMAS["memory/read"]),
1372
+ frame("memory/read/content", FRAME_SCHEMAS["memory/read/content"]),
1373
+ frame("memory/write", FRAME_SCHEMAS["memory/write"]),
1374
+ frame("memory/write/ok", FRAME_SCHEMAS["memory/write/ok"]),
1277
1375
  frame("config/push", FRAME_SCHEMAS["config/push"]),
1278
1376
  frame("daemon/restart", FRAME_SCHEMAS["daemon/restart"]),
1279
1377
  frame("daemon/upgrade", FRAME_SCHEMAS["daemon/upgrade"]),
@@ -5773,11 +5871,7 @@ function usesGithubApp(agent) {
5773
5871
  async function prepareWorkspace(agent) {
5774
5872
  const cwd = agent.workspace.path;
5775
5873
  mkdirSync(cwd, { recursive: true });
5776
- if (agent.workspace.mode === "from-scratch") {
5777
- const mem = join(cwd, "memory.md");
5778
- if (!existsSync(mem)) writeFileSync(mem, `# ${agent.name} memory\n`);
5779
- return cwd;
5780
- }
5874
+ if (agent.workspace.mode === "from-scratch") return cwd;
5781
5875
  if (!existsSync(join(cwd, ".git"))) {
5782
5876
  await cloneRepo(agent);
5783
5877
  return cwd;
@@ -10149,6 +10243,20 @@ function effortOptionsFrom(configOptions, isClaudeRuntime) {
10149
10243
  };
10150
10244
  }
10151
10245
  /**
10246
+ * Extract the permission/approval mode selector from a session's `configOptions` (ACP
10247
+ * `category: "mode"`, `type: "select"`). Returns null when the runtime exposes no mode
10248
+ * selector.
10249
+ */
10250
+ function permissionModeOptionsFrom(configOptions) {
10251
+ const opt = configOptions?.find((o) => o.category === "mode" && o.type === "select");
10252
+ if (!opt || opt.type !== "select") return null;
10253
+ const modes = opt.options.flatMap((o) => "group" in o ? o.options : [o]).map((o) => o.value);
10254
+ return {
10255
+ current: opt.currentValue,
10256
+ modes
10257
+ };
10258
+ }
10259
+ /**
10152
10260
  * Extract the fast-mode toggle from a session's `configOptions` (ACP `category:
10153
10261
  * "model_config"`, `type: "select"` with on/off values). Returns null when the current
10154
10262
  * model advertises no fast toggle.
@@ -10169,6 +10277,7 @@ var AcpHost = class {
10169
10277
  promptCaps = {};
10170
10278
  lastModelOptions = null;
10171
10279
  lastEffortOptions = null;
10280
+ lastPermissionModeOptions = null;
10172
10281
  lastFastOption = null;
10173
10282
  sessionConfigs = /* @__PURE__ */ new Map();
10174
10283
  negotiatedProtocolVersion;
@@ -10195,6 +10304,7 @@ var AcpHost = class {
10195
10304
  this.opts.log?.info(`acp: CLAUDE_CODE_EXECUTABLE not set — using claude on PATH (${claude})`);
10196
10305
  }
10197
10306
  }
10307
+ if (this.isClaudeRuntime() && env.CLAUDE_CODE_DISABLE_AUTO_MEMORY === void 0) env.CLAUDE_CODE_DISABLE_AUTO_MEMORY = "1";
10198
10308
  const child = spawn$1(resolveCommandPath(this.runtime.command, env) ?? this.runtime.command, this.runtime.args, {
10199
10309
  stdio: [
10200
10310
  "pipe",
@@ -10277,6 +10387,7 @@ var AcpHost = class {
10277
10387
  const fastMode = this.opts.configPrefs?.fastMode;
10278
10388
  const prefs = [
10279
10389
  ["model", this.opts.configPrefs?.model],
10390
+ ["mode", this.opts.configPrefs?.permissionMode],
10280
10391
  ["thought_level", ultracode ? void 0 : this.opts.configPrefs?.reasoningEffort],
10281
10392
  ["model_config", fastMode === void 0 ? void 0 : fastMode ? "on" : "off"]
10282
10393
  ];
@@ -10304,6 +10415,7 @@ var AcpHost = class {
10304
10415
  refreshOptionCaches(configOptions) {
10305
10416
  this.lastModelOptions = modelOptionsFrom(configOptions);
10306
10417
  this.lastEffortOptions = effortOptionsFrom(configOptions, this.isClaudeRuntime());
10418
+ this.lastPermissionModeOptions = permissionModeOptionsFrom(configOptions);
10307
10419
  this.lastFastOption = fastOptionFrom(configOptions);
10308
10420
  }
10309
10421
  /** The model selector advertised by the most recent session/new|load, or null if the
@@ -10316,6 +10428,11 @@ var AcpHost = class {
10316
10428
  effortOptions() {
10317
10429
  return this.lastEffortOptions;
10318
10430
  }
10431
+ /** The permission/approval mode selector from the most recent session/new|load, or
10432
+ * null if none is offered. */
10433
+ permissionModeOptions() {
10434
+ return this.lastPermissionModeOptions;
10435
+ }
10319
10436
  /** The fast-mode toggle from the most recent session/new|load, or null if the current
10320
10437
  * model offers no fast mode. */
10321
10438
  fastModeOption() {
@@ -10357,6 +10474,11 @@ var AcpHost = class {
10357
10474
  if (effort === "ultracode") return false;
10358
10475
  return this.setSessionConfig(sessionId, "thought_level", effort);
10359
10476
  }
10477
+ /** Switch the permission/approval mode of an already-running session (ACP `mode`
10478
+ * select). Values are runtime-owned and validated against the advertised options. */
10479
+ async setSessionPermissionMode(sessionId, mode) {
10480
+ return this.setSessionConfig(sessionId, "mode", mode);
10481
+ }
10360
10482
  /** Toggle fast mode on an already-running session (ACP `model_config` on/off select).
10361
10483
  * False when the current model offers no fast toggle. */
10362
10484
  async setSessionFastMode(sessionId, on) {
@@ -10443,6 +10565,6 @@ var AcpHost = class {
10443
10565
  }
10444
10566
  };
10445
10567
  //#endregion
10446
- export { resolveRuntimes as _, initGitInjection as a, simpleGit as c, MAX_FRAME_BYTES as d, buildEnvelope as f, cachedRuntimeVersions as g, cachedRuntimeNames as h, prepareWorkspace as i, isFrame as l, encode as m, installedRuntimes as n, probeGitVersion as o, decodeEnvelope as p, prefetchWorkspace as r, sessionGitEnv as s, AcpHost as t, normalizeGitUrl as u };
10568
+ export { cachedRuntimeVersions as _, initGitInjection as a, simpleGit as c, MAX_FRAME_BYTES as d, buildEnvelope as f, cachedRuntimeNames as g, MEMORY_INDEX as h, prepareWorkspace as i, isFrame as l, encode as m, installedRuntimes as n, probeGitVersion as o, decodeEnvelope as p, prefetchWorkspace as r, sessionGitEnv as s, AcpHost as t, normalizeGitUrl as u, resolveRuntimes as v };
10447
10569
 
10448
- //# sourceMappingURL=acp-host-CeJJZbtg.js.map
10570
+ //# sourceMappingURL=acp-host-zyZ_j0yY.js.map