agency-lang 0.17.0 → 0.17.1

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 (156) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +35 -14
  2. package/dist/lib/agents/agency-agent/agent.js +195 -57
  3. package/dist/lib/agents/agency-agent/brains/brain.agency +3 -0
  4. package/dist/lib/agents/agency-agent/brains/brain.js +1 -1
  5. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency +1 -0
  6. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.js +1 -0
  7. package/dist/lib/agents/agency-agent/brains/simple/simple.agency +1 -0
  8. package/dist/lib/agents/agency-agent/brains/simple/simple.js +1 -0
  9. package/dist/lib/agents/agency-agent/lib/args.agency +9 -0
  10. package/dist/lib/agents/agency-agent/lib/args.js +9 -0
  11. package/dist/lib/agents/agency-agent/lib/commandPalette.agency +1 -0
  12. package/dist/lib/agents/agency-agent/lib/commandPalette.js +2 -1
  13. package/dist/lib/agents/agency-agent/lib/config.agency +0 -75
  14. package/dist/lib/agents/agency-agent/lib/config.js +2 -61
  15. package/dist/lib/agents/agency-agent/lib/repl.agency +33 -8
  16. package/dist/lib/agents/agency-agent/lib/repl.js +421 -86
  17. package/dist/lib/agents/agency-agent/lib/resume.agency +220 -0
  18. package/dist/lib/agents/agency-agent/lib/resume.js +1927 -0
  19. package/dist/lib/agents/agency-agent/lib/sessionTitle.agency +93 -0
  20. package/dist/lib/agents/agency-agent/lib/sessionTitle.js +1114 -0
  21. package/dist/lib/agents/agency-agent/lib/sessions.agency +108 -0
  22. package/dist/lib/agents/agency-agent/lib/sessions.js +1727 -0
  23. package/dist/lib/agents/agency-agent/lib/transcript.agency +25 -0
  24. package/dist/lib/agents/agency-agent/lib/transcript.js +648 -0
  25. package/dist/lib/agents/agency-agent/lib/turn.agency +0 -2
  26. package/dist/lib/agents/agency-agent/lib/turn.js +1 -4
  27. package/dist/lib/agents/agency-agent/tests/envPolicy.agency +18 -0
  28. package/dist/lib/agents/agency-agent/tests/envPolicy.js +446 -0
  29. package/dist/lib/agents/agency-agent/tests/envPolicy.test.json +11 -0
  30. package/dist/lib/agents/agency-agent/tests/stubBrains.agency +3 -0
  31. package/dist/lib/agents/agency-agent/tests/stubBrains.js +4 -1
  32. package/dist/lib/backends/typescriptBuilder/sectionAssembler.d.ts +2 -0
  33. package/dist/lib/backends/typescriptBuilder/sectionAssembler.js +3 -0
  34. package/dist/lib/backends/typescriptBuilder.d.ts +2 -0
  35. package/dist/lib/backends/typescriptBuilder.js +13 -2
  36. package/dist/lib/cli/commands.d.ts +7 -0
  37. package/dist/lib/cli/commands.js +15 -1
  38. package/dist/lib/compiler/compileSandboxed.d.ts +3 -0
  39. package/dist/lib/compiler/compileSandboxed.js +6 -2
  40. package/dist/lib/compiler/compileValidatedClosure.d.ts +8 -1
  41. package/dist/lib/compiler/compileValidatedClosure.js +17 -2
  42. package/dist/lib/config.d.ts +13 -0
  43. package/dist/lib/config.js +1 -0
  44. package/dist/lib/runtime/alwaysScope.d.ts +29 -0
  45. package/dist/lib/runtime/alwaysScope.js +70 -0
  46. package/dist/lib/runtime/builtinPolicies.js +1 -8
  47. package/dist/lib/runtime/checkpoint.d.ts +2 -2
  48. package/dist/lib/runtime/checkpoint.js +6 -1
  49. package/dist/lib/runtime/index.d.ts +3 -1
  50. package/dist/lib/runtime/index.js +2 -0
  51. package/dist/lib/runtime/interrupts.js +8 -6
  52. package/dist/lib/runtime/invocationOptions.d.ts +13 -0
  53. package/dist/lib/runtime/invocationOptions.js +19 -2
  54. package/dist/lib/runtime/ipc.d.ts +6 -7
  55. package/dist/lib/runtime/ipc.js +6 -0
  56. package/dist/lib/runtime/node.js +3 -3
  57. package/dist/lib/runtime/policy.d.ts +4 -0
  58. package/dist/lib/runtime/policy.js +6 -0
  59. package/dist/lib/runtime/runPolicyHandler.d.ts +1 -1
  60. package/dist/lib/runtime/runPolicyHandler.js +14 -10
  61. package/dist/lib/runtime/state/schemas.d.ts +170 -0
  62. package/dist/lib/runtime/state/schemas.js +42 -0
  63. package/dist/lib/stdlib/agentSessions.d.ts +47 -0
  64. package/dist/lib/stdlib/agentSessions.js +148 -0
  65. package/dist/lib/stdlib/cli.d.ts +4 -0
  66. package/dist/lib/stdlib/cli.js +14 -2
  67. package/dist/lib/stdlib/policy.d.ts +2 -1
  68. package/dist/lib/stdlib/policy.js +2 -1
  69. package/dist/lib/stdlib/system.d.ts +5 -0
  70. package/dist/lib/stdlib/system.js +8 -0
  71. package/dist/lib/stdlib/threads.d.ts +3 -0
  72. package/dist/lib/stdlib/threads.js +10 -0
  73. package/dist/lib/symbolTable.js +2 -5
  74. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  75. package/dist/lib/templates/backends/typescriptGenerator/imports.js +1 -1
  76. package/dist/lib/typeChecker/diagnosticExplanations.js +32 -0
  77. package/dist/lib/typeChecker/diagnostics.d.ts +30 -0
  78. package/dist/lib/typeChecker/diagnostics.js +30 -0
  79. package/dist/lib/typeChecker/effectPayloadCheck.js +68 -6
  80. package/dist/lib/typeChecker/index.js +5 -0
  81. package/dist/lib/typeChecker/resolveCall.d.ts +29 -4
  82. package/dist/lib/typeChecker/resolveCall.js +81 -9
  83. package/dist/lib/typeChecker/resolveVariable.d.ts +4 -0
  84. package/dist/lib/typeChecker/resolveVariable.js +1 -1
  85. package/dist/lib/typeChecker/sandboxNameCheck.d.ts +18 -0
  86. package/dist/lib/typeChecker/sandboxNameCheck.js +234 -0
  87. package/dist/lib/typeChecker/undefinedFunctionDiagnostic.js +23 -13
  88. package/dist/lib/typeChecker/undefinedVariableDiagnostic.js +17 -6
  89. package/dist/lib/utils/alwaysTag.d.ts +21 -0
  90. package/dist/lib/utils/alwaysTag.js +53 -0
  91. package/dist/lib/utils/tagsAbove.d.ts +22 -0
  92. package/dist/lib/utils/tagsAbove.js +36 -0
  93. package/package.json +1 -1
  94. package/stdlib/agency.agency +2 -0
  95. package/stdlib/agency.js +4 -1
  96. package/stdlib/auth/keyring.agency +3 -0
  97. package/stdlib/auth/keyring.js +5 -1
  98. package/stdlib/auth/oauth.agency +3 -0
  99. package/stdlib/auth/oauth.js +5 -1
  100. package/stdlib/calendar.agency +3 -0
  101. package/stdlib/calendar.js +5 -1
  102. package/stdlib/docs/diagnostics/effects.md +66 -0
  103. package/stdlib/docs/diagnostics/index.md +6 -0
  104. package/stdlib/docs/diagnostics/names.md +8 -0
  105. package/stdlib/docs/stdlib/agency.md +51 -49
  106. package/stdlib/docs/stdlib/auth/keyring.md +10 -7
  107. package/stdlib/docs/stdlib/auth/oauth.md +10 -7
  108. package/stdlib/docs/stdlib/calendar.md +14 -11
  109. package/stdlib/docs/stdlib/fs.md +17 -12
  110. package/stdlib/docs/stdlib/git.md +55 -38
  111. package/stdlib/docs/stdlib/http.md +10 -7
  112. package/stdlib/docs/stdlib/index.md +61 -33
  113. package/stdlib/docs/stdlib/mcp.md +7 -6
  114. package/stdlib/docs/stdlib/messaging/email.md +5 -4
  115. package/stdlib/docs/stdlib/messaging/imessage.md +3 -2
  116. package/stdlib/docs/stdlib/messaging/sms.md +3 -2
  117. package/stdlib/docs/stdlib/notes/apple.md +19 -13
  118. package/stdlib/docs/stdlib/policy.md +95 -56
  119. package/stdlib/docs/stdlib/shell.md +18 -13
  120. package/stdlib/docs/stdlib/skills.md +10 -8
  121. package/stdlib/docs/stdlib/system.md +22 -18
  122. package/stdlib/docs/stdlib/thread.md +41 -22
  123. package/stdlib/docs/stdlib/toolbox.md +10 -9
  124. package/stdlib/docs/stdlib/ui/cli.md +26 -6
  125. package/stdlib/fs.agency +5 -0
  126. package/stdlib/fs.js +7 -1
  127. package/stdlib/git.agency +17 -0
  128. package/stdlib/git.js +19 -1
  129. package/stdlib/http.agency +3 -0
  130. package/stdlib/http.js +5 -1
  131. package/stdlib/index.agency +16 -0
  132. package/stdlib/index.js +7 -1
  133. package/stdlib/mcp.agency +1 -0
  134. package/stdlib/mcp.js +3 -1
  135. package/stdlib/messaging/email.agency +1 -0
  136. package/stdlib/messaging/email.js +3 -1
  137. package/stdlib/messaging/imessage.agency +1 -0
  138. package/stdlib/messaging/imessage.js +3 -1
  139. package/stdlib/messaging/sms.agency +1 -0
  140. package/stdlib/messaging/sms.js +3 -1
  141. package/stdlib/notes/apple.agency +6 -0
  142. package/stdlib/notes/apple.js +8 -1
  143. package/stdlib/policy.agency +100 -57
  144. package/stdlib/policy.js +685 -78
  145. package/stdlib/shell.agency +5 -0
  146. package/stdlib/shell.js +7 -1
  147. package/stdlib/skills.agency +2 -0
  148. package/stdlib/skills.js +4 -1
  149. package/stdlib/system.agency +13 -2
  150. package/stdlib/system.js +148 -8
  151. package/stdlib/thread.agency +9 -0
  152. package/stdlib/thread.js +123 -2
  153. package/stdlib/toolbox.agency +1 -0
  154. package/stdlib/toolbox.js +3 -1
  155. package/stdlib/ui/cli.agency +10 -1
  156. package/stdlib/ui/cli.js +130 -3
@@ -4,6 +4,7 @@ import { setLlmOptions } from "std::llm"
4
4
  import { evalOutput, evalValue, setAgentName } from "std::statelog"
5
5
  import { cwd, env, isTTY, readStdin, setTitle } from "std::system"
6
6
  import { getCost } from "std::thread"
7
+ import { setSlashPalette } from "std::ui/cli"
7
8
  import {
8
9
  clearMessages,
9
10
  pushMessage,
@@ -13,11 +14,13 @@ import {
13
14
 
14
15
  import { brainByName, allBrains, brainFlagHelp } from "./brains/registry.agency"
15
16
  import { agentNameFor } from "./lib/agentName.agency"
17
+ import { mergedPalette } from "./lib/commandPalette.agency"
16
18
  import { parseAgentArgs } from "./lib/args.agency"
17
19
  import { getHeader } from "./lib/header.agency"
18
20
  import { maybeLoadMcp } from "./lib/mcp.agency"
19
21
  import { printPolicyHelp } from "./lib/policy.agency"
20
- import { startInteractive } from "./lib/repl.agency"
22
+ import { chooseSession, startSession } from "./lib/resume.agency"
23
+ import { installSessionHooks, startInteractive } from "./lib/repl.agency"
21
24
  import { pickModelsForAgent, maybeEnableMemory } from "./lib/session.agency"
22
25
  import { loadSettings } from "./lib/settings.agency"
23
26
  import { setDebug, setVerbose, setInteractive } from "./lib/trace.agency"
@@ -102,6 +105,19 @@ node main() {
102
105
  return
103
106
  }
104
107
  setBrain(brain)
108
+
109
+ // Positional args (everything after flags) are joined with spaces to
110
+ // form the starting prompt. `--` ends flag parsing if a positional
111
+ // would otherwise look like a flag.
112
+ const positionalQuery = args.positionals.join(" ")
113
+ const hasQuery = positionalQuery != ""
114
+ const wantInteractive = args.flags.interactive
115
+
116
+ // Seeded interactive: run the prompt as the first turn, then hand over the
117
+ // REPL (needs a TTY + query, and not --print). Everything else is one-shot.
118
+ const seededInteractive = wantInteractive && hasQuery && isTTY() && !args.flags.print
119
+ const isOneShot = !seededInteractive && (args.flags.print || hasQuery || !isTTY())
120
+
105
121
  // Group this trace under its brain wherever runs are compared.
106
122
  setAgentName(agentNameFor(brain))
107
123
 
@@ -128,19 +144,6 @@ node main() {
128
144
  // coordinator. Must run before the first turn (mcpTools ordering contract).
129
145
  maybeLoadMcp(loadSettings())
130
146
 
131
- // Positional args (everything after flags) are joined with spaces to
132
- // form the starting prompt. `--` ends flag parsing if a positional
133
- // would otherwise look like a flag.
134
- const positionalQuery = args.positionals.join(" ")
135
- const hasQuery = positionalQuery != ""
136
-
137
- const wantInteractive = args.flags.interactive
138
-
139
- // Seeded interactive: run the prompt as the first turn, then hand over the
140
- // REPL (needs a TTY + query, and not --print). Everything else is one-shot.
141
- const seededInteractive = wantInteractive && hasQuery && isTTY() && !args.flags.print
142
- const isOneShot = !seededInteractive && (args.flags.print || hasQuery || !isTTY())
143
-
144
147
  const maxRounds = resolveMaxToolCallRounds(
145
148
  args.flags["max-tool-call-rounds"] ?? null,
146
149
  isOneShot,
@@ -166,6 +169,24 @@ node main() {
166
169
 
167
170
  setAgentCwd(cwd())
168
171
 
172
+ // Interactive runs are saved per turn, and a resumed one restores its
173
+ // checkpoint here, after the setup above and before the session starts.
174
+ // One-shot runs are not saved, so a resume flag on one is a mistake
175
+ // rather than something to ignore.
176
+ if (isOneShot && (args.flags.continue || args.flags.resume != null)) {
177
+ print(color.red("--continue and --resume need an interactive session; one-shot runs are not saved."))
178
+ process.exit(1)
179
+ }
180
+ // Everything above is process-level: model resolution feeds the memory
181
+ // layer, and memory, MCP, and the settings reads behind them must run
182
+ // before the policy handler exists or they prompt. A restore keeps
183
+ // those TypeScript-side effects and replaces only the Agency state.
184
+ if (!isOneShot) {
185
+ installSessionHooks()
186
+ setSlashPalette(mergedPalette())
187
+ startSession(chooseSession(args.flags.continue, args.flags.resume ?? null), brain)
188
+ }
189
+
169
190
  if (isOneShot) {
170
191
  let prompt = positionalQuery
171
192
  if (!hasQuery) {
@@ -5,14 +5,17 @@ import { setLlmOptions } from "agency-lang/stdlib/llm.js";
5
5
  import { evalOutput, evalValue, setAgentName } from "agency-lang/stdlib/statelog.js";
6
6
  import { cwd, env, isTTY, readStdin, setTitle } from "agency-lang/stdlib/system.js";
7
7
  import { getCost } from "agency-lang/stdlib/thread.js";
8
+ import { setSlashPalette } from "agency-lang/stdlib/ui/cli.js";
8
9
  import { clearMessages, pushMessage, repl, clearScreen } from "agency-lang/stdlib/ui/cli.js";
9
10
  import { brainByName, allBrains, brainFlagHelp } from "./brains/registry.js";
10
11
  import { agentNameFor } from "./lib/agentName.js";
12
+ import { mergedPalette } from "./lib/commandPalette.js";
11
13
  import { parseAgentArgs } from "./lib/args.js";
12
14
  import { getHeader } from "./lib/header.js";
13
15
  import { maybeLoadMcp } from "./lib/mcp.js";
14
16
  import { printPolicyHelp } from "./lib/policy.js";
15
- import { startInteractive } from "./lib/repl.js";
17
+ import { chooseSession, startSession } from "./lib/resume.js";
18
+ import { installSessionHooks, startInteractive } from "./lib/repl.js";
16
19
  import { pickModelsForAgent, maybeEnableMemory } from "./lib/session.js";
17
20
  import { loadSettings } from "./lib/settings.js";
18
21
  import { setDebug, setVerbose, setInteractive } from "./lib/trace.js";
@@ -218,6 +221,7 @@ __registerTool(isTTY);
218
221
  __registerTool(readStdin);
219
222
  __registerTool(setTitle);
220
223
  __registerTool(getCost);
224
+ __registerTool(setSlashPalette);
221
225
  __registerTool(clearMessages);
222
226
  __registerTool(pushMessage);
223
227
  __registerTool(repl);
@@ -226,10 +230,14 @@ __registerTool(brainByName);
226
230
  __registerTool(allBrains);
227
231
  __registerTool(brainFlagHelp);
228
232
  __registerTool(agentNameFor);
233
+ __registerTool(mergedPalette);
229
234
  __registerTool(parseAgentArgs);
230
235
  __registerTool(getHeader);
231
236
  __registerTool(maybeLoadMcp);
232
237
  __registerTool(printPolicyHelp);
238
+ __registerTool(chooseSession);
239
+ __registerTool(startSession);
240
+ __registerTool(installSessionHooks);
233
241
  __registerTool(startInteractive);
234
242
  __registerTool(pickModelsForAgent);
235
243
  __registerTool(maybeEnableMemory);
@@ -882,6 +890,30 @@ graph.node("main", async (__state) => {
882
890
  }
883
891
  });
884
892
  await runner.step(14, async (runner2) => {
893
+ __stack.locals.positionalQuery = await __callMethod(__stack.locals.args.positionals, "join", {
894
+ type: "positional",
895
+ args: [` `]
896
+ });
897
+ });
898
+ await runner.step(15, async (runner2) => {
899
+ __stack.locals.hasQuery = !__eq(__stack.locals.positionalQuery, ``);
900
+ });
901
+ await runner.step(16, async (runner2) => {
902
+ __stack.locals.wantInteractive = __stack.locals.args.flags.interactive;
903
+ });
904
+ await runner.step(17, async (runner2) => {
905
+ __stack.locals.seededInteractive = __stack.locals.wantInteractive && __stack.locals.hasQuery && await __call(isTTY, {
906
+ type: "positional",
907
+ args: []
908
+ }) && !__stack.locals.args.flags.print;
909
+ });
910
+ await runner.step(18, async (runner2) => {
911
+ __stack.locals.isOneShot = !__stack.locals.seededInteractive && (__stack.locals.args.flags.print || __stack.locals.hasQuery || !await __call(isTTY, {
912
+ type: "positional",
913
+ args: []
914
+ }));
915
+ });
916
+ await runner.step(19, async (runner2) => {
885
917
  __stack.locals.__hoist_5 = await __call(agentNameFor, {
886
918
  type: "positional",
887
919
  args: [__stack.locals.brain]
@@ -898,7 +930,7 @@ graph.node("main", async (__state) => {
898
930
  throw __stack.locals.__hoist_5.toError();
899
931
  }
900
932
  });
901
- await runner.step(15, async (runner2) => {
933
+ await runner.step(20, async (runner2) => {
902
934
  const __funcResult = await __call(setAgentName, {
903
935
  type: "positional",
904
936
  args: [__stack.locals.__hoist_5]
@@ -915,10 +947,10 @@ graph.node("main", async (__state) => {
915
947
  throw __funcResult.toError();
916
948
  }
917
949
  });
918
- await runner.step(16, async (runner2) => {
950
+ await runner.step(21, async (runner2) => {
919
951
  __stack.locals.requestedStartTarget = __stack.locals.args.flags.agent ?? ``;
920
952
  });
921
- await runner.step(17, async (runner2) => {
953
+ await runner.step(22, async (runner2) => {
922
954
  __stack.locals.resolvedStartTarget = await __call(resolveStartTarget, {
923
955
  type: "positional",
924
956
  args: [__stack.locals.brain, __stack.locals.requestedStartTarget]
@@ -935,10 +967,10 @@ graph.node("main", async (__state) => {
935
967
  throw __stack.locals.resolvedStartTarget.toError();
936
968
  }
937
969
  });
938
- await runner.step(18, async (runner2) => {
970
+ await runner.step(23, async (runner2) => {
939
971
  __stack.locals.startAgent = ``;
940
972
  });
941
- await runner.ifElse(19, [
973
+ await runner.ifElse(24, [
942
974
  {
943
975
  condition: async () => __eq(__stack.locals.resolvedStartTarget, null),
944
976
  body: async (runner2) => {
@@ -991,7 +1023,7 @@ graph.node("main", async (__state) => {
991
1023
  __stack.locals.startAgent = __stack.locals.resolvedStartTarget;
992
1024
  });
993
1025
  });
994
- await runner.step(20, async (runner2) => {
1026
+ await runner.step(25, async (runner2) => {
995
1027
  const __funcResult = await __call(pickModelsForAgent, {
996
1028
  type: "positional",
997
1029
  args: [__stack.locals.args]
@@ -1008,7 +1040,7 @@ graph.node("main", async (__state) => {
1008
1040
  throw __funcResult.toError();
1009
1041
  }
1010
1042
  });
1011
- await runner.step(21, async (runner2) => {
1043
+ await runner.step(26, async (runner2) => {
1012
1044
  const __funcResult = await __call(maybeEnableMemory, {
1013
1045
  type: "positional",
1014
1046
  args: []
@@ -1025,7 +1057,7 @@ graph.node("main", async (__state) => {
1025
1057
  throw __funcResult.toError();
1026
1058
  }
1027
1059
  });
1028
- await runner.step(22, async (runner2) => {
1060
+ await runner.step(27, async (runner2) => {
1029
1061
  __stack.locals.__hoist_7 = await __call(loadSettings, {
1030
1062
  type: "positional",
1031
1063
  args: []
@@ -1042,7 +1074,7 @@ graph.node("main", async (__state) => {
1042
1074
  throw __stack.locals.__hoist_7.toError();
1043
1075
  }
1044
1076
  });
1045
- await runner.step(23, async (runner2) => {
1077
+ await runner.step(28, async (runner2) => {
1046
1078
  const __funcResult = await __call(maybeLoadMcp, {
1047
1079
  type: "positional",
1048
1080
  args: [__stack.locals.__hoist_7]
@@ -1059,30 +1091,6 @@ graph.node("main", async (__state) => {
1059
1091
  throw __funcResult.toError();
1060
1092
  }
1061
1093
  });
1062
- await runner.step(24, async (runner2) => {
1063
- __stack.locals.positionalQuery = await __callMethod(__stack.locals.args.positionals, "join", {
1064
- type: "positional",
1065
- args: [` `]
1066
- });
1067
- });
1068
- await runner.step(25, async (runner2) => {
1069
- __stack.locals.hasQuery = !__eq(__stack.locals.positionalQuery, ``);
1070
- });
1071
- await runner.step(26, async (runner2) => {
1072
- __stack.locals.wantInteractive = __stack.locals.args.flags.interactive;
1073
- });
1074
- await runner.step(27, async (runner2) => {
1075
- __stack.locals.seededInteractive = __stack.locals.wantInteractive && __stack.locals.hasQuery && await __call(isTTY, {
1076
- type: "positional",
1077
- args: []
1078
- }) && !__stack.locals.args.flags.print;
1079
- });
1080
- await runner.step(28, async (runner2) => {
1081
- __stack.locals.isOneShot = !__stack.locals.seededInteractive && (__stack.locals.args.flags.print || __stack.locals.hasQuery || !await __call(isTTY, {
1082
- type: "positional",
1083
- args: []
1084
- }));
1085
- });
1086
1094
  await runner.step(29, async (runner2) => {
1087
1095
  __stack.locals.maxRounds = await __call(resolveMaxToolCallRounds, {
1088
1096
  type: "positional",
@@ -1236,6 +1244,136 @@ graph.node("main", async (__state) => {
1236
1244
  }
1237
1245
  });
1238
1246
  await runner.ifElse(38, [
1247
+ {
1248
+ condition: async () => __stack.locals.isOneShot && (__stack.locals.args.flags.continue || !__eq(__stack.locals.args.flags.resume, null)),
1249
+ body: async (runner2) => {
1250
+ await runner2.step(0, async (runner3) => {
1251
+ __stack.locals.__hoist_10 = await __callMethod(color, "red", {
1252
+ type: "positional",
1253
+ args: [`--continue and --resume need an interactive session; one-shot runs are not saved.`]
1254
+ });
1255
+ });
1256
+ await runner2.step(1, async (runner3) => {
1257
+ const __funcResult = await __call(print, {
1258
+ type: "positional",
1259
+ args: [__stack.locals.__hoist_10]
1260
+ });
1261
+ if (hasInterrupts(__funcResult)) {
1262
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1263
+ runner3.halt({
1264
+ ...__state,
1265
+ data: __funcResult
1266
+ });
1267
+ return;
1268
+ }
1269
+ if (isAborted(__funcResult)) {
1270
+ throw __funcResult.toError();
1271
+ }
1272
+ });
1273
+ await runner2.step(2, async (runner3) => {
1274
+ await __callMethod(process, "exit", {
1275
+ type: "positional",
1276
+ args: [1]
1277
+ });
1278
+ });
1279
+ }
1280
+ }
1281
+ ]);
1282
+ await runner.step(39, async (runner2) => {
1283
+ });
1284
+ await runner.ifElse(40, [
1285
+ {
1286
+ condition: async () => !__stack.locals.isOneShot,
1287
+ body: async (runner2) => {
1288
+ await runner2.step(0, async (runner3) => {
1289
+ const __funcResult = await __call(installSessionHooks, {
1290
+ type: "positional",
1291
+ args: []
1292
+ });
1293
+ if (hasInterrupts(__funcResult)) {
1294
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1295
+ runner3.halt({
1296
+ ...__state,
1297
+ data: __funcResult
1298
+ });
1299
+ return;
1300
+ }
1301
+ if (isAborted(__funcResult)) {
1302
+ throw __funcResult.toError();
1303
+ }
1304
+ });
1305
+ await runner2.step(1, async (runner3) => {
1306
+ __stack.locals.__hoist_11 = await __call(mergedPalette, {
1307
+ type: "positional",
1308
+ args: []
1309
+ });
1310
+ if (hasInterrupts(__stack.locals.__hoist_11)) {
1311
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1312
+ runner3.halt({
1313
+ ...__state,
1314
+ data: __stack.locals.__hoist_11
1315
+ });
1316
+ return;
1317
+ }
1318
+ if (isAborted(__stack.locals.__hoist_11)) {
1319
+ throw __stack.locals.__hoist_11.toError();
1320
+ }
1321
+ });
1322
+ await runner2.step(2, async (runner3) => {
1323
+ const __funcResult = await __call(setSlashPalette, {
1324
+ type: "positional",
1325
+ args: [__stack.locals.__hoist_11]
1326
+ });
1327
+ if (hasInterrupts(__funcResult)) {
1328
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1329
+ runner3.halt({
1330
+ ...__state,
1331
+ data: __funcResult
1332
+ });
1333
+ return;
1334
+ }
1335
+ if (isAborted(__funcResult)) {
1336
+ throw __funcResult.toError();
1337
+ }
1338
+ });
1339
+ await runner2.step(3, async (runner3) => {
1340
+ __stack.locals.__hoist_12 = await __call(chooseSession, {
1341
+ type: "positional",
1342
+ args: [__stack.locals.args.flags.continue, __stack.locals.args.flags.resume ?? null]
1343
+ });
1344
+ if (hasInterrupts(__stack.locals.__hoist_12)) {
1345
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1346
+ runner3.halt({
1347
+ ...__state,
1348
+ data: __stack.locals.__hoist_12
1349
+ });
1350
+ return;
1351
+ }
1352
+ if (isAborted(__stack.locals.__hoist_12)) {
1353
+ throw __stack.locals.__hoist_12.toError();
1354
+ }
1355
+ });
1356
+ await runner2.step(4, async (runner3) => {
1357
+ const __funcResult = await __call(startSession, {
1358
+ type: "positional",
1359
+ args: [__stack.locals.__hoist_12, __stack.locals.brain]
1360
+ });
1361
+ if (hasInterrupts(__funcResult)) {
1362
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1363
+ runner3.halt({
1364
+ ...__state,
1365
+ data: __funcResult
1366
+ });
1367
+ return;
1368
+ }
1369
+ if (isAborted(__funcResult)) {
1370
+ throw __funcResult.toError();
1371
+ }
1372
+ });
1373
+ }
1374
+ }
1375
+ ]);
1376
+ await runner.ifElse(41, [
1239
1377
  {
1240
1378
  condition: async () => __stack.locals.isOneShot,
1241
1379
  body: async (runner2) => {
@@ -1283,26 +1421,26 @@ graph.node("main", async (__state) => {
1283
1421
  }
1284
1422
  ]);
1285
1423
  await runner2.step(2, async (runner3) => {
1286
- __stack.locals.__hoist_10 = await __call(oneShotAgent, {
1424
+ __stack.locals.__hoist_13 = await __call(oneShotAgent, {
1287
1425
  type: "positional",
1288
1426
  args: [__stack.locals.startAgent, __stack.locals.prompt]
1289
1427
  });
1290
- if (hasInterrupts(__stack.locals.__hoist_10)) {
1428
+ if (hasInterrupts(__stack.locals.__hoist_13)) {
1291
1429
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1292
1430
  runner3.halt({
1293
1431
  ...__state,
1294
- data: __stack.locals.__hoist_10
1432
+ data: __stack.locals.__hoist_13
1295
1433
  });
1296
1434
  return;
1297
1435
  }
1298
- if (isAborted(__stack.locals.__hoist_10)) {
1299
- throw __stack.locals.__hoist_10.toError();
1436
+ if (isAborted(__stack.locals.__hoist_13)) {
1437
+ throw __stack.locals.__hoist_13.toError();
1300
1438
  }
1301
1439
  });
1302
1440
  await runner2.step(3, async (runner3) => {
1303
1441
  const __funcResult = await __call(print, {
1304
1442
  type: "positional",
1305
- args: [__stack.locals.__hoist_10]
1443
+ args: [__stack.locals.__hoist_13]
1306
1444
  });
1307
1445
  if (hasInterrupts(__funcResult)) {
1308
1446
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1317,33 +1455,33 @@ graph.node("main", async (__state) => {
1317
1455
  }
1318
1456
  });
1319
1457
  await runner2.step(4, async (runner3) => {
1320
- __stack.locals.__hoist_11 = await __call(getCost, {
1458
+ __stack.locals.__hoist_14 = await __call(getCost, {
1321
1459
  type: "positional",
1322
1460
  args: []
1323
1461
  });
1324
- if (hasInterrupts(__stack.locals.__hoist_11)) {
1462
+ if (hasInterrupts(__stack.locals.__hoist_14)) {
1325
1463
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1326
1464
  runner3.halt({
1327
1465
  ...__state,
1328
- data: __stack.locals.__hoist_11
1466
+ data: __stack.locals.__hoist_14
1329
1467
  });
1330
1468
  return;
1331
1469
  }
1332
- if (isAborted(__stack.locals.__hoist_11)) {
1333
- throw __stack.locals.__hoist_11.toError();
1470
+ if (isAborted(__stack.locals.__hoist_14)) {
1471
+ throw __stack.locals.__hoist_14.toError();
1334
1472
  }
1335
1473
  });
1336
1474
  await runner2.step(5, async (runner3) => {
1337
- __stack.locals.__hoist_12 = await __callMethod(__stack.locals.__hoist_11, "toFixed", {
1475
+ __stack.locals.__hoist_15 = await __callMethod(__stack.locals.__hoist_14, "toFixed", {
1338
1476
  type: "positional",
1339
1477
  args: [4]
1340
1478
  });
1341
1479
  });
1342
1480
  await runner2.step(6, async (runner3) => {
1343
- __stack.locals.roundedCost = `$${__stack.locals.__hoist_12}`;
1481
+ __stack.locals.roundedCost = `$${__stack.locals.__hoist_15}`;
1344
1482
  });
1345
1483
  await runner2.step(7, async (runner3) => {
1346
- __stack.locals.__hoist_13 = await __callMethod(color, "dim", {
1484
+ __stack.locals.__hoist_16 = await __callMethod(color, "dim", {
1347
1485
  type: "positional",
1348
1486
  args: [`
1349
1487
  Session cost: ${__stack.locals.roundedCost}`]
@@ -1352,7 +1490,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1352
1490
  await runner2.step(8, async (runner3) => {
1353
1491
  const __funcResult = await __call(print, {
1354
1492
  type: "positional",
1355
- args: [__stack.locals.__hoist_13]
1493
+ args: [__stack.locals.__hoist_16]
1356
1494
  });
1357
1495
  if (hasInterrupts(__funcResult)) {
1358
1496
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1404,26 +1542,26 @@ Session cost: ${__stack.locals.roundedCost}`]
1404
1542
  }
1405
1543
  });
1406
1544
  await runner2.step(11, async (runner3) => {
1407
- __stack.locals.__hoist_14 = await __call(getHeader, {
1545
+ __stack.locals.__hoist_17 = await __call(getHeader, {
1408
1546
  type: "positional",
1409
1547
  args: [__stack.locals.brain.name]
1410
1548
  });
1411
- if (hasInterrupts(__stack.locals.__hoist_14)) {
1549
+ if (hasInterrupts(__stack.locals.__hoist_17)) {
1412
1550
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1413
1551
  runner3.halt({
1414
1552
  ...__state,
1415
- data: __stack.locals.__hoist_14
1553
+ data: __stack.locals.__hoist_17
1416
1554
  });
1417
1555
  return;
1418
1556
  }
1419
- if (isAborted(__stack.locals.__hoist_14)) {
1420
- throw __stack.locals.__hoist_14.toError();
1557
+ if (isAborted(__stack.locals.__hoist_17)) {
1558
+ throw __stack.locals.__hoist_17.toError();
1421
1559
  }
1422
1560
  });
1423
1561
  await runner2.step(12, async (runner3) => {
1424
1562
  const __funcResult = await __call(print, {
1425
1563
  type: "positional",
1426
- args: [__stack.locals.__hoist_14]
1564
+ args: [__stack.locals.__hoist_17]
1427
1565
  });
1428
1566
  if (hasInterrupts(__funcResult)) {
1429
1567
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1491,7 +1629,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1491
1629
  });
1492
1630
  });
1493
1631
  if (runner.halted) return runner.haltResult;
1494
- await runner.hook(39, async () => {
1632
+ await runner.hook(42, async () => {
1495
1633
  await callHook({
1496
1634
  name: "onNodeEnd",
1497
1635
  data: {
@@ -1561,7 +1699,7 @@ Agent crashed: ${__error.message}`);
1561
1699
  }
1562
1700
  }
1563
1701
  var stdin_default = graph;
1564
- const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 44, "col": 2 }, "2": { "line": 48, "col": 2 }, "3": { "line": 49, "col": 2 }, "4": { "line": 50, "col": 2 }, "5": { "line": 60, "col": 2 }, "6": { "line": 61, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 51, "col": 4 }, "4.1": { "line": 54, "col": 18 }, "4.2.0": { "line": 54, "col": 4 }, "4.2.1": { "line": 55, "col": 6 }, "4.2.2": { "line": 56, "col": 25 }, "4.2.3.0": { "line": 56, "col": 11 }, "4.2.3.1": { "line": 57, "col": 6 }, "4.2.3": { "line": 56, "col": 11 }, "4.2": { "line": 54, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 71, "col": 30 }, "3": { "line": 71, "col": 2 }, "4": { "line": 79, "col": 2 }, "5": { "line": 82, "col": 2 }, "7": { "line": 89, "col": 2 }, "8": { "line": 93, "col": 2 }, "9": { "line": 95, "col": 63 }, "10": { "line": 95, "col": 2 }, "11": { "line": 96, "col": 2 }, "12": { "line": 97, "col": 2 }, "13": { "line": 103, "col": 2 }, "14": { "line": 105, "col": 15 }, "15": { "line": 105, "col": 2 }, "16": { "line": 108, "col": 2 }, "17": { "line": 109, "col": 2 }, "18": { "line": 110, "col": 2 }, "19": { "line": 111, "col": 2 }, "20": { "line": 120, "col": 2 }, "21": { "line": 124, "col": 2 }, "22": { "line": 128, "col": 15 }, "23": { "line": 128, "col": 2 }, "24": { "line": 133, "col": 2 }, "25": { "line": 134, "col": 2 }, "26": { "line": 136, "col": 2 }, "27": { "line": 140, "col": 2 }, "28": { "line": 141, "col": 2 }, "29": { "line": 143, "col": 2 }, "30": { "line": 147, "col": 2 }, "31": { "line": 152, "col": 2 }, "32": { "line": 153, "col": 2 }, "34": { "line": 159, "col": 2 }, "35": { "line": 160, "col": 2 }, "36": { "line": 166, "col": 14 }, "37": { "line": 166, "col": 2 }, "38": { "line": 168, "col": 2 }, "4.0": { "line": 80, "col": 4 }, "5.0": { "line": 83, "col": 4 }, "7.0": { "line": 90, "col": 4 }, "7.1": { "line": 91, "col": 4 }, "12.0": { "line": 98, "col": 22 }, "12.2": { "line": 98, "col": 4 }, "12.3": { "line": 99, "col": 10 }, "12.4": { "line": 99, "col": 4 }, "12.5": { "line": 100, "col": 4 }, "12.6": { "line": 101, "col": 4 }, "19.0": { "line": 112, "col": 4 }, "19.1": { "line": 113, "col": 10 }, "19.2": { "line": 113, "col": 4 }, "19.3": { "line": 114, "col": 4 }, "19.4": { "line": 115, "col": 4 }, "19.5": { "line": 117, "col": 4 }, "30.0": { "line": 148, "col": 4 }, "32.0": { "line": 154, "col": 4 }, "35.0": { "line": 161, "col": 4 }, "38.0": { "line": 169, "col": 4 }, "38.1.0": { "line": 171, "col": 6 }, "38.1.1.0": { "line": 173, "col": 8 }, "38.1.1": { "line": 172, "col": 6 }, "38.1.2": { "line": 175, "col": 6 }, "38.1": { "line": 170, "col": 4 }, "38.2": { "line": 177, "col": 10 }, "38.3": { "line": 177, "col": 4 }, "38.5": { "line": 178, "col": 28 }, "38.6": { "line": 178, "col": 4 }, "38.7": { "line": 179, "col": 10 }, "38.8": { "line": 179, "col": 4 }, "38.9": { "line": 181, "col": 4 }, "38.10": { "line": 182, "col": 4 }, "38.11": { "line": 183, "col": 10 }, "38.12": { "line": 183, "col": 4 }, "38.13": { "line": 184, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "38.13.0": { "line": 185, "col": 6 } } };
1702
+ const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 47, "col": 2 }, "2": { "line": 51, "col": 2 }, "3": { "line": 52, "col": 2 }, "4": { "line": 53, "col": 2 }, "5": { "line": 63, "col": 2 }, "6": { "line": 64, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 54, "col": 4 }, "4.1": { "line": 57, "col": 18 }, "4.2.0": { "line": 57, "col": 4 }, "4.2.1": { "line": 58, "col": 6 }, "4.2.2": { "line": 59, "col": 25 }, "4.2.3.0": { "line": 59, "col": 11 }, "4.2.3.1": { "line": 60, "col": 6 }, "4.2.3": { "line": 59, "col": 11 }, "4.2": { "line": 57, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 74, "col": 30 }, "3": { "line": 74, "col": 2 }, "4": { "line": 82, "col": 2 }, "5": { "line": 85, "col": 2 }, "7": { "line": 92, "col": 2 }, "8": { "line": 96, "col": 2 }, "9": { "line": 98, "col": 63 }, "10": { "line": 98, "col": 2 }, "11": { "line": 99, "col": 2 }, "12": { "line": 100, "col": 2 }, "13": { "line": 106, "col": 2 }, "14": { "line": 111, "col": 2 }, "15": { "line": 112, "col": 2 }, "16": { "line": 113, "col": 2 }, "17": { "line": 117, "col": 2 }, "18": { "line": 118, "col": 2 }, "19": { "line": 121, "col": 15 }, "20": { "line": 121, "col": 2 }, "21": { "line": 124, "col": 2 }, "22": { "line": 125, "col": 2 }, "23": { "line": 126, "col": 2 }, "24": { "line": 127, "col": 2 }, "25": { "line": 136, "col": 2 }, "26": { "line": 140, "col": 2 }, "27": { "line": 144, "col": 15 }, "28": { "line": 144, "col": 2 }, "29": { "line": 146, "col": 2 }, "30": { "line": 150, "col": 2 }, "31": { "line": 155, "col": 2 }, "32": { "line": 156, "col": 2 }, "34": { "line": 162, "col": 2 }, "35": { "line": 163, "col": 2 }, "36": { "line": 169, "col": 14 }, "37": { "line": 169, "col": 2 }, "38": { "line": 175, "col": 2 }, "40": { "line": 183, "col": 2 }, "41": { "line": 189, "col": 2 }, "4.0": { "line": 83, "col": 4 }, "5.0": { "line": 86, "col": 4 }, "7.0": { "line": 93, "col": 4 }, "7.1": { "line": 94, "col": 4 }, "12.0": { "line": 101, "col": 22 }, "12.2": { "line": 101, "col": 4 }, "12.3": { "line": 102, "col": 10 }, "12.4": { "line": 102, "col": 4 }, "12.5": { "line": 103, "col": 4 }, "12.6": { "line": 104, "col": 4 }, "24.0": { "line": 128, "col": 4 }, "24.1": { "line": 129, "col": 10 }, "24.2": { "line": 129, "col": 4 }, "24.3": { "line": 130, "col": 4 }, "24.4": { "line": 131, "col": 4 }, "24.5": { "line": 133, "col": 4 }, "30.0": { "line": 151, "col": 4 }, "32.0": { "line": 157, "col": 4 }, "35.0": { "line": 164, "col": 4 }, "38.0": { "line": 176, "col": 10 }, "38.1": { "line": 176, "col": 4 }, "38.2": { "line": 177, "col": 4 }, "40.0": { "line": 184, "col": 4 }, "40.1": { "line": 185, "col": 20 }, "40.2": { "line": 185, "col": 4 }, "40.3": { "line": 186, "col": 17 }, "40.4": { "line": 186, "col": 4 }, "41.0": { "line": 190, "col": 4 }, "41.1.0": { "line": 192, "col": 6 }, "41.1.1.0": { "line": 194, "col": 8 }, "41.1.1": { "line": 193, "col": 6 }, "41.1.2": { "line": 196, "col": 6 }, "41.1": { "line": 191, "col": 4 }, "41.2": { "line": 198, "col": 10 }, "41.3": { "line": 198, "col": 4 }, "41.5": { "line": 199, "col": 28 }, "41.6": { "line": 199, "col": 4 }, "41.7": { "line": 200, "col": 10 }, "41.8": { "line": 200, "col": 4 }, "41.9": { "line": 202, "col": 4 }, "41.10": { "line": 203, "col": 4 }, "41.11": { "line": 204, "col": 10 }, "41.12": { "line": 204, "col": 4 }, "41.13": { "line": 205, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "41.13.0": { "line": 206, "col": 6 } } };
1565
1703
  export {
1566
1704
  __getCheckpoints,
1567
1705
  __invokeFunction,
@@ -17,6 +17,9 @@ export type AgentBrain = {
17
17
  name: string;
18
18
  // One line, shown by --help next to the name.
19
19
  description: string;
20
+ // The `thread(session: ...)` name of the conversation with the user. The
21
+ // saved-session title and the transcript printed on resume read it.
22
+ session: string;
20
23
  // Valid --agent values. "" (the main entry) is always valid and not listed.
21
24
  startTargets: string[];
22
25
  // Called once, inside the policy handler, before any turn. Validate the
@@ -172,7 +172,7 @@ async function __registerTopLevelCallbacks(__ctx) {
172
172
  __registerCallbacksInit("dist/lib/agents/agency-agent/brains/brain.agency", __registerTopLevelCallbacks);
173
173
  __functionRefReviver.registry = __toolRegistry;
174
174
  const BrainContext = z.object({ "interactive": z.boolean(), "grounding": z.string() });
175
- const AgentBrain = z.object({ "name": z.string(), "description": z.string(), "startTargets": z.array(z.string()), "init": z.string(), "runTurn": z.string() });
175
+ const AgentBrain = z.object({ "name": z.string(), "description": z.string(), "session": z.string(), "startTargets": z.array(z.string()), "init": z.string(), "runTurn": z.string() });
176
176
  var stdin_default = graph;
177
177
  const __sourceMap = {};
178
178
  export {
@@ -122,6 +122,7 @@ def coordinatorRunTurn(
122
122
  export def coordinatorBrain(): AgentBrain {
123
123
  return {
124
124
  name: "coordinator",
125
+ session: "main",
125
126
  description: "One coordinator LLM that routes to code, research, oracle, explorer, review, writing, and rewrite subagents",
126
127
  startTargets: ["code", "research", "oracle", "explorer", "review", "writing", "rewrite"],
127
128
  init: coordinatorInit,
@@ -1383,6 +1383,7 @@ async function __coordinatorBrain_impl() {
1383
1383
  __functionCompleted = true;
1384
1384
  runner2.halt({
1385
1385
  "name": `coordinator`,
1386
+ "session": `main`,
1386
1387
  "description": `One coordinator LLM that routes to code, research, oracle, explorer, review, writing, and rewrite subagents`,
1387
1388
  "startTargets": [`code`, `research`, `oracle`, `explorer`, `review`, `writing`, `rewrite`],
1388
1389
  "init": coordinatorInit,
@@ -35,6 +35,7 @@ def simpleRunTurn(
35
35
  export def simpleBrain(): AgentBrain {
36
36
  return {
37
37
  name: "simple",
38
+ session: "simple",
38
39
  description: "One tool-less LLM call per turn, in a single thread",
39
40
  startTargets: [],
40
41
  init: simpleInit,
@@ -527,6 +527,7 @@ async function __simpleBrain_impl() {
527
527
  __functionCompleted = true;
528
528
  runner2.halt({
529
529
  "name": `simple`,
530
+ "session": `simple`,
530
531
  "description": `One tool-less LLM call per turn, in a single thread`,
531
532
  "startTargets": [],
532
533
  "init": simpleInit,
@@ -54,6 +54,15 @@ export def parseAgentArgs(brainHelp: string) {
54
54
  optional: true,
55
55
  description: "Approval policy for this run: a built-in name (minimal, recommended, with-writes, approve-all) or a path to a policy JSON file. with-writes auto-approves file writes and git changes scoped to the current directory and its children; approve-all approves EVERY interrupt with no scoping (sandbox use only). Overrides the saved policy without persisting it. Pass --policy with no value to list the built-in policies."
56
56
  },
57
+ continue: {
58
+ type: "boolean",
59
+ description: "Resume the most recent saved session for this directory"
60
+ },
61
+ resume: {
62
+ type: "string",
63
+ optional: true,
64
+ description: "Resume a saved session by id, or pass --resume alone to pick one from a list"
65
+ },
57
66
  "agent-home": {
58
67
  type: "string",
59
68
  description: "Directory to use instead of ~/.agency-agent for settings, policy, and history (equivalent to the AGENCY_AGENT_HOME env var; the flag wins when both are set)"
@@ -305,6 +305,15 @@ async function __parseAgentArgs_impl(brainHelp) {
305
305
  "optional": true,
306
306
  "description": `Approval policy for this run: a built-in name (minimal, recommended, with-writes, approve-all) or a path to a policy JSON file. with-writes auto-approves file writes and git changes scoped to the current directory and its children; approve-all approves EVERY interrupt with no scoping (sandbox use only). Overrides the saved policy without persisting it. Pass --policy with no value to list the built-in policies.`
307
307
  },
308
+ "continue": {
309
+ "type": `boolean`,
310
+ "description": `Resume the most recent saved session for this directory`
311
+ },
312
+ "resume": {
313
+ "type": `string`,
314
+ "optional": true,
315
+ "description": `Resume a saved session by id, or pass --resume alone to pick one from a list`
316
+ },
308
317
  "agent-home": {
309
318
  "type": `string`,
310
319
  "description": `Directory to use instead of ~/.agency-agent for settings, policy, and history (equivalent to the AGENCY_AGENT_HOME env var; the flag wins when both are set)`
@@ -8,6 +8,7 @@ export def builtinPalette(): Record<string, string> {
8
8
  "/clear": "Clear the conversation transcript",
9
9
  "/clear-history": "Clear the input history (recall + saved file)",
10
10
  "/cost": "Show cumulative LLM cost and tokens",
11
+ "/rename": "Give this session a title: /rename <title>",
11
12
  "/model": "Switch the model (bare to pick, or slot=model)",
12
13
  "/models": "List / filter the hosted model catalog",
13
14
  "/local": "Switch to a local model",