topchester-ai 0.68.0 → 0.70.0

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.
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as runTopchesterCli } from "./cli-CRhzHqMB.mjs";
2
+ import { t as runTopchesterCli } from "./cli-BWEWnkpM.mjs";
3
3
  //#region src/bin.ts
4
4
  await runTopchesterCli();
5
5
  //#endregion
@@ -5287,8 +5287,8 @@ function formatSkillSource$2(skill) {
5287
5287
  }
5288
5288
  const taskTool = defineTool({
5289
5289
  name: "task",
5290
- description: "Delegate a focused prompt to a constrained child agent session.",
5291
- prompt: "task: delegate focused read-only research or isolated analysis to a child agent session. Use it when parallel context gathering would help. To use it, reply with only JSON: {\"tool\":\"task\",\"args\":{\"description\":\"Inspect runtime event flow\",\"prompt\":\"Read the runtime and summarize how events are emitted.\",\"subagent_type\":\"explore\"}}",
5290
+ description: "Delegate read-only file/search/git research to a child agent. Do not use for shell commands, bash, Python/Node scripts, validators, edits, writes, tiny local inspections, or other execution work.",
5291
+ prompt: "task: delegate read-only file/search/git research to a child agent. Do not use task for shell commands, bash, Python/Node scripts, validators, edits, writes, finish_task, tiny local inspections, or other execution work; use parent tools directly. If the relevant workspace context is just a README plus a few obvious source files, inspect them directly with list_files/read_file instead of spawning a subagent. To use it, reply with only JSON: {\"tool\":\"task\",\"args\":{\"description\":\"Inspect runtime event flow\",\"prompt\":\"Read the runtime and summarize how events are emitted.\",\"subagent_type\":\"explore\"}}",
5292
5292
  argsSchema: z.object({
5293
5293
  description: z.string().min(1),
5294
5294
  prompt: z.string().min(1),
@@ -5297,6 +5297,7 @@ const taskTool = defineTool({
5297
5297
  }),
5298
5298
  async execute(context, args) {
5299
5299
  if (!context.subagents) throw new Error("task requires a runtime subagent manager.");
5300
+ rejectUnsupportedSubagentPrompt(args);
5300
5301
  const result = await context.subagents.runTask({
5301
5302
  description: args.description,
5302
5303
  prompt: args.prompt,
@@ -5304,7 +5305,8 @@ const taskTool = defineTool({
5304
5305
  taskId: args.task_id,
5305
5306
  parentToolCallId: context.toolCallId ?? args.task_id ?? "task",
5306
5307
  eventSink: context.eventSink,
5307
- abortSignal: context.abortSignal
5308
+ abortSignal: context.abortSignal,
5309
+ benchmarkProfile: context.benchmarkProfile
5308
5310
  });
5309
5311
  return {
5310
5312
  tool: "task",
@@ -5321,6 +5323,14 @@ const taskTool = defineTool({
5321
5323
  };
5322
5324
  }
5323
5325
  });
5326
+ function rejectUnsupportedSubagentPrompt(args) {
5327
+ const profile = resolveAgentProfile(args.subagent_type ?? "explore");
5328
+ if (isToolAllowed(createToolPermissionView(profile), "bash") || !looksLikeShellExecutionRequest(args.prompt)) return;
5329
+ throw new Error(`task subagent "${profile.id}" cannot run bash, shell commands, Python/Node scripts, validators, or other execution tools. Use the parent bash/run_validator tools directly, or delegate only read-only file/search/git research.`);
5330
+ }
5331
+ function looksLikeShellExecutionRequest(prompt) {
5332
+ return /\b(use|run|execute)\s+(bash|shell|command|commands|python3?|node|npm|npx|pnpm|xxd|readelf|objdump|file)\b/i.test(prompt);
5333
+ }
5324
5334
  //#endregion
5325
5335
  //#region src/agent/tools/registry.ts
5326
5336
  const toolRegistry = {
@@ -12656,6 +12666,7 @@ function getChatSystemPrompt(options = {}) {
12656
12666
  ] : [],
12657
12667
  ...canUseTool("inspect_command") ? ["- Do not use inspect_command for file creation or file mutation."] : [],
12658
12668
  ...canUseTool("edit_file") ? ["- Keep edit_file old_text small but unique. Do not include line labels or grep prefixes in old_text; use exact file text only."] : [],
12669
+ ...canUseTool("apply_patch") && canUseTool("write_file") && canUseTool("read_file") ? ["- If apply_patch/edit_file fails twice on the same file, stop retrying equivalent patches. Read the current file and, when the intended change is broad, use write_file overwrite:true with the current read_file hash to replace the whole file."] : [],
12659
12670
  ...canUseTool("edit_file") || canUseTool("write_file") ? ["- Use edit/write/patch tools when they are available and the user asks you to implement, fix, add, update, or refactor code."] : [],
12660
12671
  ...canUseTool("finish_task") ? ["- Use finish_task to complete implementation tasks after the requested work is actually done. Do not call finish_task to claim edits or validation that tool results did not confirm."] : [],
12661
12672
  ...canUseTool("inspect_command") || canUseTool("run_validator") ? ["- Use command/test tools when they are available and you need to inspect the environment or verify behavior."] : [],
@@ -12784,7 +12795,10 @@ var SubagentManager = class {
12784
12795
  });
12785
12796
  let finalResponse = "";
12786
12797
  try {
12787
- for await (const childEvent of childRuntime.submitMessageStream([], options.prompt, options.abortSignal, { session: child })) {
12798
+ for await (const childEvent of childRuntime.submitMessageStream([], options.prompt, options.abortSignal, {
12799
+ session: child,
12800
+ benchmarkProfile: options.benchmarkProfile
12801
+ })) {
12788
12802
  const payload = runtimeEventToSessionPayload(childEvent);
12789
12803
  if (payload) await child.append(payload);
12790
12804
  if (childEvent.type === "message" && childEvent.role === "assistant") finalResponse = childEvent.text;
@@ -16774,4 +16788,4 @@ function formatDryRunSyncStatus(status) {
16774
16788
  //#endregion
16775
16789
  export { runTopchesterCli as t };
16776
16790
 
16777
- //# sourceMappingURL=cli-CRhzHqMB.mjs.map
16791
+ //# sourceMappingURL=cli-BWEWnkpM.mjs.map