@vietor/agent-core 0.8.0 → 0.8.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.
@@ -1,6 +1,6 @@
1
1
  import type { SubAgentRunResult } from "../runtime/sub-agent-runner.js";
2
2
  import type { Tool } from "./types.js";
3
- export declare const SUB_AGENT_GUIDANCE = "- Consider delegating to the SubAgent tool when the task matches an agent type, when you have independent work to run in parallel, or when answering would mean reading across several files \u2014 delegate and keep the conclusion, not the file dumps. type: \"explore\" \u2014 read-only search agent for broad fan-out searches (state the search breadth in the task); type: \"plan\" \u2014 software architect producing implementation plans. For a single-fact lookup where you already know the file, symbol, or value, search directly. Once you have delegated a search, do not also run it yourself \u2014 wait for the result. Issue at most 2 SubAgent calls per turn; multiple calls in the same turn run concurrently. Sub-agents are read-only and return only their final report, not intermediate steps \u2014 verify important results yourself. For large workloads with many independent items that would exceed the turn budget, split the items into chunks sized so each sub-agent can complete its chunk within its own loop budget, delegate one SubAgent per chunk, and run the remaining chunks in the following turns as results return. Instruct each sub-agent to report results per item in structured lines so you can consolidate.";
3
+ export declare const SUB_AGENT_GUIDANCE = "- Consider delegating to the SubAgent tool when the task matches an agent type, when you have independent work to run in parallel, or when answering would mean reading across several files \u2014 delegate and keep the conclusion, not the file dumps. The only valid values for type are \"explore\" \u2014 read-only search agent for broad fan-out searches (state the search breadth in the task) \u2014 and \"plan\" \u2014 software architect producing implementation plans; never use any other value. For a single-fact lookup where you already know the file, symbol, or value, search directly. Once you have delegated a search, do not also run it yourself \u2014 wait for the result. Issue at most 2 SubAgent calls per turn; multiple calls in the same turn run concurrently. Sub-agents are read-only and return only their final report, not intermediate steps \u2014 verify important results yourself. For large workloads with many independent items that would exceed the turn budget, split the items into chunks sized so each sub-agent can complete its chunk within its own loop budget, delegate one SubAgent per chunk, and run the remaining chunks in the following turns as results return. Instruct each sub-agent to report results per item in structured lines so you can consolidate.";
4
4
  export interface SubAgentToolDeps {
5
5
  runSubAgent: (systemPrompt: string, task: string, signal?: AbortSignal) => Promise<SubAgentRunResult>;
6
6
  }
@@ -2,7 +2,7 @@ import { NOT_EXECUTED_PREFIX } from "../util/constants.js";
2
2
  import { summarizeText } from "../util/text.js";
3
3
  import { toolError } from "./types.js";
4
4
  const MAX_LABEL_LENGTH = 50;
5
- export const SUB_AGENT_GUIDANCE = '- Consider delegating to the SubAgent tool when the task matches an agent type, when you have independent work to run in parallel, or when answering would mean reading across several files — delegate and keep the conclusion, not the file dumps. type: "explore" — read-only search agent for broad fan-out searches (state the search breadth in the task); type: "plan" — software architect producing implementation plans. For a single-fact lookup where you already know the file, symbol, or value, search directly. Once you have delegated a search, do not also run it yourself — wait for the result. Issue at most 2 SubAgent calls per turn; multiple calls in the same turn run concurrently. Sub-agents are read-only and return only their final report, not intermediate steps — verify important results yourself. For large workloads with many independent items that would exceed the turn budget, split the items into chunks sized so each sub-agent can complete its chunk within its own loop budget, delegate one SubAgent per chunk, and run the remaining chunks in the following turns as results return. Instruct each sub-agent to report results per item in structured lines so you can consolidate.';
5
+ export const SUB_AGENT_GUIDANCE = '- Consider delegating to the SubAgent tool when the task matches an agent type, when you have independent work to run in parallel, or when answering would mean reading across several files — delegate and keep the conclusion, not the file dumps. The only valid values for type are "explore" — read-only search agent for broad fan-out searches (state the search breadth in the task) and "plan" — software architect producing implementation plans; never use any other value. For a single-fact lookup where you already know the file, symbol, or value, search directly. Once you have delegated a search, do not also run it yourself — wait for the result. Issue at most 2 SubAgent calls per turn; multiple calls in the same turn run concurrently. Sub-agents are read-only and return only their final report, not intermediate steps — verify important results yourself. For large workloads with many independent items that would exceed the turn budget, split the items into chunks sized so each sub-agent can complete its chunk within its own loop budget, delegate one SubAgent per chunk, and run the remaining chunks in the following turns as results return. Instruct each sub-agent to report results per item in structured lines so you can consolidate.';
6
6
  const EXPLORE_PROMPT = [
7
7
  "You are the Explore sub-agent — a read-only search agent for broad fan-out searches. Use it when answering means sweeping many files, directories, or naming conventions and the parent needs only the conclusion, not the file dumps. You read excerpts rather than whole files, so you locate code — you do not review or audit it. You are read-only: you must not modify any files.",
8
8
  "Guidelines:",
@@ -40,7 +40,7 @@ const SUB_AGENT_DEFS = [
40
40
  systemPrompt: PLAN_PROMPT,
41
41
  },
42
42
  ];
43
- const TOOL_DESCRIPTION = 'Run a dedicated sub-agent in its own nested loop — the only result you receive is its final report as text, not intermediate steps. type: "explore" — a read-only search agent for broad fan-out searches of the codebase or web; specify a search breadth in the task ("medium" for moderate exploration, "very thorough" for multiple locations and naming conventions). type: "plan" — a software architect that reads the relevant code first, then returns a step-by-step implementation plan identifying critical files and architectural trade-offs. Sub-agents are read-only and cannot ask questions, use skills, or spawn further sub-agents.';
43
+ const TOOL_DESCRIPTION = 'Run a dedicated sub-agent in its own nested loop — the only result you receive is its final report as text, not intermediate steps. type: "explore" — a read-only search agent for broad fan-out searches of the codebase or web; specify a search breadth in the task ("medium" for moderate exploration, "very thorough" for multiple locations and naming conventions). type: "plan" — a software architect that reads the relevant code first, then returns a step-by-step implementation plan identifying critical files and architectural trade-offs. These are the only two valid type values — never pass any other string. Sub-agents are read-only and cannot ask questions, use skills, or spawn further sub-agents.';
44
44
  export function createSubAgentTool(deps) {
45
45
  return {
46
46
  name: "SubAgent",
@@ -51,7 +51,7 @@ export function createSubAgentTool(deps) {
51
51
  type: {
52
52
  type: "string",
53
53
  enum: SUB_AGENT_DEFS.map((d) => d.type),
54
- description: 'The sub-agent type to invoke: "explore" (read-only fan-out search) or "plan" (implementation plan).',
54
+ description: 'The sub-agent type to invoke — only "explore" (read-only fan-out search) or "plan" (implementation plan) is valid.',
55
55
  },
56
56
  label: {
57
57
  type: "string",
package/dist/util/net.js CHANGED
@@ -15,8 +15,11 @@ const undiciFetch = fetch;
15
15
  export async function netFetch(input, init) {
16
16
  if (!proxyInitialized)
17
17
  ensureProxy();
18
+ const headers = new Headers(init?.headers);
19
+ if (!headers.has("accept-encoding"))
20
+ headers.set("accept-encoding", "gzip, deflate");
18
21
  if (!proxyAgent)
19
- return undiciFetch(input, init);
22
+ return undiciFetch(input, { ...init, headers });
20
23
  const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
21
24
  if (noProxyList) {
22
25
  const hostname = new URL(url).hostname;
@@ -26,7 +29,7 @@ export async function netFetch(input, init) {
26
29
  return hostname === p || hostname.endsWith("." + p);
27
30
  });
28
31
  if (shouldBypass)
29
- return undiciFetch(input, init);
32
+ return undiciFetch(input, { ...init, headers });
30
33
  }
31
- return undiciFetch(input, { ...init, dispatcher: proxyAgent });
34
+ return undiciFetch(input, { ...init, headers, dispatcher: proxyAgent });
32
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vietor/agent-core",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",