aegiscode 7.0.12 → 7.0.14

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.
@@ -86,10 +86,18 @@ const OUTPUT_CAP = 30_000; // chars fed back to the model per tool result
86
86
  * Desktop. The schema is the first place to say so — a refusal after the fact
87
87
  * costs the model a round, a correct description costs it nothing.
88
88
  */
89
+ // Kept SHORT on purpose. This sentence is repeated in the description of every
90
+ // path argument (9 of the 10 tools), so its length is paid once per tool, every
91
+ // round, and the tool schemas are part of the wire prefix the provider is asked
92
+ // to cache. The long form spelled out win32 examples and the Environment-block
93
+ // cross-reference — 267 chars, ~68 tokens, ~616 tokens per round once
94
+ // multiplied across the nine. That instruction is NOT lost: prompt.js's
95
+ // TOOL_LINE states the same rule once, in the system prompt where it belongs
96
+ // and where it costs one copy instead of nine. `test/tool-paths.test.mjs`
97
+ // asserts this constant appears in each path argument, so it must stay the
98
+ // single shared string rather than being inlined per tool.
89
99
  const PATH_ARG_DESC =
90
- 'Absolute path in THIS machine\'s own form (the Environment block names the platform and home ' +
91
- 'directory — a win32 host needs C:\\Users\\you\\file.txt, never /home/you/file.txt), or "~" / ' +
92
- '"~/…" for the home directory. A relative path resolves against the working directory.';
100
+ 'Absolute path on THIS machine; "~"/"~/…" = home. Relative resolves against the working directory.';
93
101
 
94
102
  /** `<what>. <the path rules>` — the shape every path argument's description takes. */
95
103
  const pathDesc = (what) => `${what}. ${PATH_ARG_DESC}`;
@@ -297,18 +305,45 @@ const SCHEMAS = {
297
305
  // MAX_SUBAGENT_DEPTH, hard-bounding runaway recursion.
298
306
  const SUBAGENT_TOOL = 'task';
299
307
 
308
+ /**
309
+ * The hook layer (`hooks`, `installHooks`) is the ONE part of this registry that
310
+ * is not agent work, and it is the one part the benchmark never touches.
311
+ *
312
+ * Measured on `benchmarks/raw/beat-pi-20261022-2318` (three tasks, the same wire
313
+ * model, nine trials): the advertised schemas are re-sent as a wire PREFIX on
314
+ * every round, and these two are 427 of its ~1,757 tokens. On the round that
315
+ * misses the prefix cache they are billed at the miss rate; on every later round
316
+ * they are billed at the cheap hit rate but are still tokens the model reads
317
+ * before it reads the task. Pi ships seven tools and no hook surface at all.
318
+ *
319
+ * So they stay RUNNABLE (`isTool`, `executeTool`, `toolList`, the CLI's `/hooks`)
320
+ * and stay on the schema list for a caller that asks for them, but they are no
321
+ * longer advertised to the model by default. Capability is unchanged; the
322
+ * prefix it was paying for is gone.
323
+ */
324
+ const HOOK_TOOLS = new Set(['hooks', 'installHooks']);
325
+
300
326
  /** Tool names in advertisement order. `includeSubagent: false` drops task (depth cap). */
301
- function toolNames({ includeSubagent = true } = {}) {
302
- return schemaList(includeSubagent).map((s) => s.name);
327
+ function toolNames({ includeSubagent = true, includeHooks = false } = {}) {
328
+ return schemaList({ includeSubagent, includeHooks }).map((s) => s.name);
303
329
  }
304
330
 
305
- function schemaList(includeSubagent) {
306
- return Object.values(SCHEMAS).filter((s) => includeSubagent || s.name !== SUBAGENT_TOOL);
331
+ function schemaList({ includeSubagent = true, includeHooks = false } = {}) {
332
+ return Object.values(SCHEMAS).filter(
333
+ (s) =>
334
+ (includeSubagent || s.name !== SUBAGENT_TOOL) &&
335
+ (includeHooks || !HOOK_TOOLS.has(s.name))
336
+ );
307
337
  }
308
338
 
309
- /** OpenAI-compatible /chat/completions tool definitions ({type:'function', function}). */
310
- function openaiTools({ includeSubagent = true } = {}) {
311
- return schemaList(includeSubagent).map((s) => ({
339
+ /**
340
+ * OpenAI-compatible /chat/completions tool definitions ({type:'function', function}).
341
+ * `includeHooks: true` re-advertises the hook tools; the default is the agent
342
+ * set, because a hook install is a thing the USER asks the CLI for, not a step
343
+ * in a coding task.
344
+ */
345
+ function openaiTools({ includeSubagent = true, includeHooks = false } = {}) {
346
+ return schemaList({ includeSubagent, includeHooks }).map((s) => ({
312
347
  type: 'function',
313
348
  function: { name: s.name, description: s.description, parameters: s.parameters },
314
349
  }));
@@ -319,10 +354,10 @@ function openaiTools({ includeSubagent = true } = {}) {
319
354
  * goes through the AEGIS relay, which speaks the OpenAI shape — so this takes
320
355
  * no `wire` argument. The Anthropic-shaped variant went away with the
321
356
  * direct-dial transport. `includeSubagent: false` drops the task tool
322
- * (subagent depth cap).
357
+ * (subagent depth cap); `includeHooks: true` re-adds hooks/installHooks.
323
358
  */
324
- function toolsFor({ includeSubagent = true } = {}) {
325
- return openaiTools({ includeSubagent });
359
+ function toolsFor({ includeSubagent = true, includeHooks = false } = {}) {
360
+ return openaiTools({ includeSubagent, includeHooks });
326
361
  }
327
362
 
328
363
  // ── Path normalisation ──────────────────────────────────────────────────────
@@ -1175,6 +1210,7 @@ module.exports = {
1175
1210
  // schemas
1176
1211
  SCHEMAS,
1177
1212
  SUBAGENT_TOOL,
1213
+ HOOK_TOOLS,
1178
1214
  toolNames,
1179
1215
  openaiTools,
1180
1216
  toolsFor,