@sixb/agent 0.2.0 → 0.2.2

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 (76) hide show
  1. package/README.md +2 -1
  2. package/dist/agent-prompt.d.ts +13 -0
  3. package/dist/agent-prompt.d.ts.map +1 -1
  4. package/dist/agent-runtime/preflight.d.ts.map +1 -1
  5. package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -1
  6. package/dist/background-commands.d.ts +95 -0
  7. package/dist/background-commands.d.ts.map +1 -0
  8. package/dist/background-notices.d.ts +31 -0
  9. package/dist/background-notices.d.ts.map +1 -0
  10. package/dist/computer-runner.d.ts +63 -2
  11. package/dist/computer-runner.d.ts.map +1 -1
  12. package/dist/context-compaction.d.ts +3 -0
  13. package/dist/context-compaction.d.ts.map +1 -1
  14. package/dist/execution-plan.d.ts +12 -2
  15. package/dist/execution-plan.d.ts.map +1 -1
  16. package/dist/index.d.ts +2 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2287 -230
  19. package/dist/index.js.map +28 -18
  20. package/dist/login-shell.d.ts +16 -0
  21. package/dist/login-shell.d.ts.map +1 -0
  22. package/dist/run-child.d.ts +3 -0
  23. package/dist/run-child.d.ts.map +1 -1
  24. package/dist/run-conversation-turn.d.ts +6 -2
  25. package/dist/run-conversation-turn.d.ts.map +1 -1
  26. package/dist/run-environment.d.ts +12 -2
  27. package/dist/run-environment.d.ts.map +1 -1
  28. package/dist/run-sandbox.d.ts +23 -0
  29. package/dist/run-sandbox.d.ts.map +1 -1
  30. package/dist/sandbox-files.d.ts.map +1 -1
  31. package/dist/tools/background.d.ts +50 -0
  32. package/dist/tools/background.d.ts.map +1 -0
  33. package/dist/tools/bash.d.ts +12 -4
  34. package/dist/tools/bash.d.ts.map +1 -1
  35. package/dist/tools/model-spec.d.ts +9 -2
  36. package/dist/tools/model-spec.d.ts.map +1 -1
  37. package/dist/tools/tool-outputs.d.ts +12 -2
  38. package/dist/tools/tool-outputs.d.ts.map +1 -1
  39. package/dist/tools/web-fetch/cache.d.ts +33 -0
  40. package/dist/tools/web-fetch/cache.d.ts.map +1 -0
  41. package/dist/tools/web-fetch/html-markdown.d.ts +25 -0
  42. package/dist/tools/web-fetch/html-markdown.d.ts.map +1 -0
  43. package/dist/tools/web-fetch/network.d.ts +55 -0
  44. package/dist/tools/web-fetch/network.d.ts.map +1 -0
  45. package/dist/tools/web-fetch/tool.d.ts +96 -0
  46. package/dist/tools/web-fetch/tool.d.ts.map +1 -0
  47. package/dist/tools/web-search.d.ts +40 -0
  48. package/dist/tools/web-search.d.ts.map +1 -0
  49. package/dist/workspace-instructions.d.ts +15 -0
  50. package/dist/workspace-instructions.d.ts.map +1 -0
  51. package/package.json +13 -4
  52. package/src/agent-prompt.ts +60 -1
  53. package/src/agent-runtime/preflight.ts +2 -1
  54. package/src/artifacts/layout-check/layout-check.ts +4 -4
  55. package/src/background-commands.ts +573 -0
  56. package/src/background-notices.ts +178 -0
  57. package/src/computer-runner.ts +211 -9
  58. package/src/context-compaction.ts +4 -1
  59. package/src/execution-plan.ts +15 -2
  60. package/src/index.ts +3 -0
  61. package/src/login-shell.ts +18 -0
  62. package/src/run-child.ts +5 -0
  63. package/src/run-conversation-turn.ts +23 -4
  64. package/src/run-environment.ts +92 -12
  65. package/src/run-sandbox.ts +41 -0
  66. package/src/sandbox-files.ts +2 -1
  67. package/src/tools/background.ts +127 -0
  68. package/src/tools/bash.ts +80 -11
  69. package/src/tools/model-spec.ts +25 -3
  70. package/src/tools/tool-outputs.ts +46 -6
  71. package/src/tools/web-fetch/cache.ts +91 -0
  72. package/src/tools/web-fetch/html-markdown.ts +479 -0
  73. package/src/tools/web-fetch/network.ts +452 -0
  74. package/src/tools/web-fetch/tool.ts +619 -0
  75. package/src/tools/web-search.ts +139 -0
  76. package/src/workspace-instructions.ts +163 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Runs a script in a bash that is not a login shell, once a login shell has loaded the profile:
3
+ * the profile's exports reach the script, and its `exit` leaves the login shell alone.
4
+ *
5
+ * A login shell runs `~/.bash_logout` when the `exit` builtin ends it, with the script's options
6
+ * still set. Debian's and Ubuntu's default one runs `clear_console`, which fails without a
7
+ * terminal, so a script under `set -e` that ends with `exit 0` exits 1. `exec` replaces the login
8
+ * shell without running that file, and keeps its pid, so a background command's `$!` and process
9
+ * group are still the script's.
10
+ *
11
+ * Arguments: the script.
12
+ */
13
+ export declare const LOGIN_SHELL_SCRIPT = "exec \"$BASH\" -c \"$1\" bash";
14
+ /** `bash` arguments that run `script` as {@link LOGIN_SHELL_SCRIPT} does. */
15
+ export declare function loginShellArgs(script: string): string[];
16
+ //# sourceMappingURL=login-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-shell.d.ts","sourceRoot":"","sources":["../src/login-shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,kCAA8B,CAAA;AAE7D,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvD"}
@@ -1,4 +1,5 @@
1
1
  import { type AgentRunSession } from "@sixb/core/internal/agents";
2
+ import type { SandboxNetworkPolicy } from "@sixb/core/sandboxes";
2
3
  import type { AgentRunRecord, AgentThreadRecord, ExecutionRecord, SubagentRunRecord } from "@sixb/core/storage";
3
4
  import type { AgentRunFailure } from "./failure";
4
5
  import type { FamilyMailbox } from "./family-mailbox";
@@ -42,6 +43,8 @@ export interface ChildParent {
42
43
  holdLease(session: AgentRunSession<SubagentRunRecord>): Promise<() => void>;
43
44
  /** The turn's mailbox, through which they talk. */
44
45
  readonly family: FamilyMailbox;
46
+ /** The network the turn's `web_fetch` follows, which the child's follows too. */
47
+ readonly networkPolicy?: SandboxNetworkPolicy;
45
48
  }
46
49
  /**
47
50
  * Runs the children of a runner's turns. A child holds its own run, session, token and sandbox,
@@ -1 +1 @@
1
- {"version":3,"file":"run-child.d.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W;YAML,UAAU;IAyGxB,sFAAsF;YACxE,OAAO;CA0DtB"}
@@ -1,4 +1,5 @@
1
1
  import { type AgentRunSession } from "@sixb/core/internal/agents";
2
+ import type { SandboxNetworkPolicy } from "@sixb/core/sandboxes";
2
3
  import type { AgentRunRecord, AgentThreadRecord, ConversationAgentRunRecord, ExecutionRecord, SubagentRunRecord } from "@sixb/core/storage";
3
4
  import type { AgentRunFailure } from "./failure";
4
5
  import type { FamilyMailbox } from "./family-mailbox";
@@ -15,8 +16,11 @@ export interface ConversationTurnRunner {
15
16
  readonly execution: ExecutionRecord;
16
17
  readonly thread: AgentThreadRecord | null;
17
18
  }): OpenRunSandbox;
18
- /** Run a child the turn spawned or continues, beside the turn, on the turn's mailbox. */
19
- startChild(run: SubagentRunRecord, family: FamilyMailbox): void;
19
+ /**
20
+ * Run a child the turn spawned or continues, beside the turn, on the turn's mailbox, its
21
+ * `web_fetch` following the network the turn's sandbox declared.
22
+ */
23
+ startChild(run: SubagentRunRecord, family: FamilyMailbox, networkPolicy: SandboxNetworkPolicy | undefined): void;
20
24
  /** A sandbox teardown that outlives the turn: the runner waits for it before it stops. */
21
25
  onDetachedTeardown(teardown: Promise<void>): void;
22
26
  /** A turn that failed: the runner reports it, once its end is recorded. */
@@ -1 +1 @@
1
- {"version":3,"file":"run-conversation-turn.d.ts","sourceRoot":"","sources":["../src/run-conversation-turn.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,4BAA4B,CAAA;AAInC,OAAO,KAAK,EACV,cAAc,EAEd,iBAAiB,EAEjB,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAI3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,KAAK,E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O,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CACnD;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAC/C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,0BAA0B,CAAC,CAAA;IAC7D,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAA;IACvC,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAC7B,GAAG,OAAO,CAAC,IAAI,CAAC,CAgIhB"}
@@ -1,13 +1,14 @@
1
1
  import type { Principal } from "@sixb/core";
2
- import { type AgentContextBudget, type AgentRunSession, type AgentTurnHistory } from "@sixb/core/internal/agents";
2
+ import { type AgentContextBudget, type AgentRunModels, type AgentRunSession, type AgentTurnHistory } from "@sixb/core/internal/agents";
3
3
  import type { WorkflowIOSnapshot } from "@sixb/core/internal/workflows";
4
4
  import type { ModelTool } from "@sixb/core/models";
5
+ import type { SandboxNetworkPolicy } from "@sixb/core/sandboxes";
5
6
  import type { AgentContextCheckpointReason, AgentThreadRecord, ConversationAgentRunRecord, SubagentRunRecord, WorkflowAgentNodeRunRecord } from "@sixb/core/storage";
6
7
  import { type ConversationRequest } from "./context-compaction";
7
8
  import type { ResolvedAgentExecutionPlan } from "./execution-plan";
8
9
  import { type ConversationReaders } from "./message-authors";
9
10
  import { type AgentErrorDetails, type AgentToolCaller } from "./model-adapters";
10
- import type { BeforeFinalizeOptions, RunSandbox } from "./run-sandbox";
11
+ import { type BeforeFinalizeOptions, type RunSandbox } from "./run-sandbox";
11
12
  import { type SubagentThreadContext } from "./subagent-context";
12
13
  import type { SubagentHistory } from "./subagent-continuation";
13
14
  import { type LoadedAgentThreadModelContext } from "./thread-context";
@@ -34,6 +35,8 @@ export interface ConversationAgentExecutionEnvironment extends AgentExecutionEnv
34
35
  }) => Promise<ConversationRequest | undefined>;
35
36
  /** The bytes per token the preflight measured the history at, which the turn's calls go by. */
36
37
  readonly bytesPerToken?: number;
38
+ /** The network its sandbox declared, which `web_fetch` follows: its children's too. */
39
+ readonly networkPolicy?: SandboxNetworkPolicy;
37
40
  }
38
41
  /**
39
42
  * How a runner gives a run its environment: a cloud sandbox, or a folder on a computer. The runner
@@ -103,6 +106,11 @@ export interface CreateSubagentEnvironmentInput extends CreateAgentEnvironmentIn
103
106
  readonly budget: AgentContextBudget;
104
107
  readonly runtime: AgentTurnRuntime;
105
108
  };
109
+ /**
110
+ * The network its parent's `web_fetch` follows, which the child's follows too: a child's blank
111
+ * sandbox declares none, and would otherwise read any URL.
112
+ */
113
+ readonly parentNetworkPolicy?: SandboxNetworkPolicy;
106
114
  }
107
115
  export interface SubagentAgentExecutionEnvironment extends AgentExecutionEnvironment {
108
116
  /** The thread the child runs on: as it started, or as its compaction left it. */
@@ -126,6 +134,8 @@ export interface CreateWorkflowAgentNodeEnvironmentInput extends CreateAgentEnvi
126
134
  readonly errorDetails: AgentErrorDetails;
127
135
  /** How the step calls a project tool: it runs in the cloud, so in the worker's process. */
128
136
  readonly callTool: AgentToolCaller;
137
+ /** How the step searches the web, recorded with its other model calls. */
138
+ readonly webSearch: AgentRunModels["webSearch"];
129
139
  }
130
140
  /** Prepare conversation history and attachments, then start the shared agent environment. */
131
141
  export declare function createConversationAgentEnvironment(input: CreateConversationAgentEnvironmentInput): Promise<ConversationAgentExecutionEnvironment>;
@@ -1 +1 @@
1
- {"version":3,"file":"run-environment.d.ts","sourceRoot":"","sources":["../src/run-environment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EAGtB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,M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AClF,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;IACtC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAC9B,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAA;KAC9C,KAAK,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAA;IAC9C,6FAA6F;IAC7F,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAChC;AAED,MAAM,WAAW,uCAAwC,SAAQ,2BAA2B;IAC1F,QAAQ,CAAC,GAAG,EAAE,0BAA0B,CAAA;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;IACtC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAA;IACxC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CAChD;AAED,6FAA6F;AAC7F,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,qCAAqC,CAAC,CAwNhD;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,iCAAiC,CAAC,CAsC5C;AAoND,mFAAmF;AACnF,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,yBAAyB,CAAC,CAqDpC"}
@@ -1,5 +1,8 @@
1
1
  import type { Sandbox } from "@sixb/core";
2
+ import type { SandboxNetworkPolicy } from "@sixb/core/sandboxes";
2
3
  import type { AgentWorkspacePromptContext } from "./agent-prompt";
4
+ import type { BackgroundCommands } from "./background-commands";
5
+ import type { WebFetchNetwork } from "./tools/web-fetch/network";
3
6
  /**
4
7
  * Where a provider's sandbox keeps a run's files: in its working directory, which a Git checkout
5
8
  * excludes (see `prepareWorkspaceRunFiles`).
@@ -39,6 +42,20 @@ export interface RunSandbox {
39
42
  * names it: relative to the working directory, or absolute.
40
43
  */
41
44
  readonly contextDirectory: string;
45
+ /**
46
+ * The background commands the run's tools start and see, when they outlive the run: a
47
+ * computer's thread keeps them across its turns, and its runner stops them. Absent, the run has
48
+ * its own, stopped as it ends.
49
+ */
50
+ readonly background?: BackgroundCommands;
51
+ /**
52
+ * The network policy the project declared for the sandbox, which `web_fetch` follows: only the
53
+ * origins a `restricted` one lists, and no tool for `none`. Absent, as for a blank sandbox: any
54
+ * URL.
55
+ */
56
+ readonly networkPolicy?: SandboxNetworkPolicy;
57
+ /** Where `web_fetch` reads pages from. Absent: Sixb's servers. */
58
+ readonly webNetwork?: WebFetchNetwork;
42
59
  /** Called once, when the run environment starts. */
43
60
  acquire(): Promise<AcquiredRunSandbox>;
44
61
  /**
@@ -57,4 +74,10 @@ export interface BeforeFinalizeOptions {
57
74
  */
58
75
  readonly discard?: boolean;
59
76
  }
77
+ /**
78
+ * Acquire a run's sandbox. A workspace the prompt describes comes with the instruction files it
79
+ * carries, read once here: every request of the run then renders the same prompt, and so does the
80
+ * next run while the files stay as they are.
81
+ */
82
+ export declare function acquireRunSandbox(sandbox: RunSandbox, signal?: AbortSignal): Promise<AcquiredRunSandbox>;
60
83
  //# sourceMappingURL=run-sandbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-sandbox.d.ts","sourceRoot":"","sources":["../src/run-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAA;AAEjE;;;GAGG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAEtE,gFAAgF;AAChF,MAAM,WAAW,kBAAkB;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AAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7B;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,qBAAqB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACvD,OAAO,CAAC,gBAAgB,CAAC,CAsB3B"}
@@ -0,0 +1,50 @@
1
+ import type { ModelTool } from "@sixb/core/models";
2
+ import type { BackgroundCommands } from "../background-commands";
3
+ import type { AgentSandboxHandle } from "../sandbox-handle";
4
+ export declare const BASH_OUTPUT_TOOL_SPEC: {
5
+ readonly name: "bash_output";
6
+ readonly description: "A background command's status (running, exited with its code, or stopped) and its output since your last read: the newest 20,000 bytes, the rest in its file. wait blocks until it ends, at most that many ms. You are told when one ends: do not poll.";
7
+ readonly inputSchema: {
8
+ type: string;
9
+ properties: {
10
+ id: {
11
+ type: string;
12
+ description: string;
13
+ };
14
+ wait: {
15
+ type: string;
16
+ description: string;
17
+ };
18
+ };
19
+ required: string[];
20
+ additionalProperties: false;
21
+ };
22
+ };
23
+ export declare const BASH_STOP_TOOL_SPEC: {
24
+ readonly name: "bash_stop";
25
+ readonly description: "Stop a background command and all it started: SIGTERM, then SIGKILL after 3 s. Returns its final status and output since your last read.";
26
+ readonly inputSchema: {
27
+ type: string;
28
+ properties: {
29
+ id: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ };
34
+ required: string[];
35
+ additionalProperties: false;
36
+ };
37
+ };
38
+ interface BashOutputToolInput {
39
+ readonly id: string;
40
+ readonly wait?: number;
41
+ }
42
+ interface BashStopToolInput {
43
+ readonly id: string;
44
+ }
45
+ /** `bash_output`: a background command's status and new output, after waiting when asked. */
46
+ export declare function createBashOutputTool(resolveSandbox: () => Promise<AgentSandboxHandle>, commands: BackgroundCommands): ModelTool<BashOutputToolInput>;
47
+ /** `bash_stop`: stop a background command, then report how it ended and its last output. */
48
+ export declare function createBashStopTool(resolveSandbox: () => Promise<AgentSandboxHandle>, commands: BackgroundCommands): ModelTool<BashStopToolInput>;
49
+ export {};
50
+ //# sourceMappingURL=background.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/tools/background.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAA2B,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAK3D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;CAgBxB,CAAA;AAEV,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;CAYtB,CAAA;AAEV,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACpB;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,EACjD,QAAQ,EAAE,kBAAkB,GAC3B,SAAS,CAAC,mBAAmB,CAAC,CA0BhC;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,EACjD,QAAQ,EAAE,kBAAkB,GAC3B,SAAS,CAAC,iBAAiB,CAAC,CAkB9B"}
@@ -1,9 +1,10 @@
1
- import type { CommandResult } from "@sixb/core";
1
+ import { type CommandResult } from "@sixb/core";
2
2
  import type { ModelTool } from "@sixb/core/models";
3
+ import type { BackgroundCommands } from "../background-commands";
3
4
  import type { AgentSandboxHandle } from "../sandbox-handle";
4
5
  export declare const BASH_TOOL_SPEC: {
5
6
  readonly name: "bash";
6
- readonly description: "Run a Bash command in the agent run sandbox.";
7
+ readonly description: string;
7
8
  readonly inputSchema: {
8
9
  type: string;
9
10
  properties: {
@@ -16,6 +17,11 @@ export declare const BASH_TOOL_SPEC: {
16
17
  };
17
18
  timeoutMs: {
18
19
  type: string;
20
+ description: string;
21
+ };
22
+ run_in_background: {
23
+ type: string;
24
+ description: string;
19
25
  };
20
26
  };
21
27
  required: string[];
@@ -26,6 +32,7 @@ interface BashToolInput {
26
32
  readonly command: string;
27
33
  readonly cwd?: string;
28
34
  readonly timeoutMs?: number;
35
+ readonly run_in_background?: boolean;
29
36
  }
30
37
  export interface BashToolOutput extends CommandResult {
31
38
  readonly stdoutTruncated: boolean;
@@ -38,9 +45,10 @@ export interface BashToolOutput extends CommandResult {
38
45
  * of blocking the turn. A resolver rejection surfaces as a failed command.
39
46
  *
40
47
  * Its output holds the command's streams whole: the run's tools save an output too large for the
41
- * context to a file and keep {@link keptCommandOutput} of it (see tool-outputs.ts).
48
+ * context to a file and keep {@link keptCommandOutput} of it (see tool-outputs.ts). A command run
49
+ * in the background returns its {@link BackgroundCommandState} instead.
42
50
  */
43
- export declare function createBashTool(resolveSandbox: () => Promise<AgentSandboxHandle>): ModelTool<BashToolInput>;
51
+ export declare function createBashTool(resolveSandbox: () => Promise<AgentSandboxHandle>, background: BackgroundCommands): ModelTool<BashToolInput>;
44
52
  /**
45
53
  * What a command's message part keeps of an output saved to a file: each stream within
46
54
  * 20,000 characters, as the app, the TUI and `sixb history` show it.
@@ -1 +1 @@
1
- {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EA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;;;;;;;;;;;;;;;CA8BjB,CAAA;AAEV,UAAU,aAAa;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CACrC;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAClC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,EACjD,UAAU,EAAE,kBAAkB,GAC7B,SAAS,CAAC,aAAa,CAAC,CAoC1B;AAsED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAEvE;AAiBD,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAe7E"}
@@ -1,9 +1,16 @@
1
- import type { AgentToolSpec } from "@sixb/core/internal/agents";
1
+ import type { AgentRunWebPlan, AgentToolSpec } from "@sixb/core/internal/agents";
2
+ import type { SandboxNetworkPolicy } from "@sixb/core/sandboxes";
2
3
  /**
3
4
  * Describe exactly the tools a conversational model receives, in its order, without starting its
4
- * sandbox. A conversation publishes artifacts once its run executes in a thread.
5
+ * sandbox. A conversation publishes artifacts once its run executes in a thread; it searches the
6
+ * web when its plan names a search model, and fetches pages when its plan has web tools at all,
7
+ * unless its sandbox's network is `none`.
5
8
  */
6
9
  export declare function agentModelToolSpecs(projectTools: readonly AgentToolSpec[], options?: {
7
10
  readonly publishes?: boolean;
11
+ readonly web?: AgentRunWebPlan;
12
+ readonly networkPolicy?: SandboxNetworkPolicy;
8
13
  }): readonly AgentToolSpec[];
14
+ /** Whether a run has `web_fetch`: web tools are on, and its sandbox may reach the network. */
15
+ export declare function fetchesWeb(web: AgentRunWebPlan | undefined, networkPolicy: SandboxNetworkPolicy | undefined): boolean;
9
16
  //# sourceMappingURL=model-spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-spec.d.ts","sourceRoot":"","sources":["../../src/tools/model-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAS/D;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,aAAa,EAAE,EACtC,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7C,SAAS,aAAa,EAAE,CAU1B"}
1
+ {"version":3,"file":"model-spec.d.ts","sourceRoot":"","sources":["../../src/tools/model-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAYhE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,aAAa,EAAE,EACtC,OAAO,GAAE;IACP,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACzC,GACL,SAAS,aAAa,EAAE,CAc1B;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CACxB,GAAG,EAAE,eAAe,GAAG,SAAS,EAChC,aAAa,EAAE,oBAAoB,GAAG,SAAS,GAC9C,OAAO,CAET"}
@@ -1,5 +1,5 @@
1
- import { type AgentRunFileStore, type AgentToolCallFile } from "@sixb/core/internal/agents";
2
- import { type ModelTool } from "@sixb/core/models";
1
+ import { type AgentRunFileStore, type AgentToolCallFile, type AgentToolOutputExtension } from "@sixb/core/internal/agents";
2
+ import { type ModelTool, type ModelToolExecutionContext } from "@sixb/core/models";
3
3
  import type { AgentMessageRecord } from "@sixb/core/storage";
4
4
  import { type AgentSandboxHandle } from "../sandbox-handle";
5
5
  import { AgentFileBudget } from "./tool-files";
@@ -37,7 +37,17 @@ export declare class ToolOutputFiles {
37
37
  /** The stored file of a call whose output was saved, for its message part. */
38
38
  fileOf(toolCallId: string): AgentToolCallFile | undefined;
39
39
  private saving;
40
+ /**
41
+ * Save a call's output that its tool shows the model itself, such as a fetched page: stored and
42
+ * written back as an output saved here is, under the same budget, and its call's
43
+ * {@link fileOf}. Returns the path the agent reads it at.
44
+ */
45
+ store(toolName: string, bytes: Uint8Array, type: {
46
+ readonly extension: AgentToolOutputExtension;
47
+ readonly mediaType: string;
48
+ }, context: ModelToolExecutionContext): Promise<string>;
40
49
  private save;
50
+ private write;
41
51
  }
42
52
  /**
43
53
  * The outputs a history saved, to write back: the newest within
@@ -1 +1 @@
1
- {"version":3,"file":"tool-outputs.d.ts","sourceRoot":"","sources":["../../src/tools/tool-outputs.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAIvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,mBAAmB,CAAA;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAY,CAAA;AAEnD,kFAAkF;AAClF,eAAO,MAAM,sBAAsB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;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,iBAAiB,EAAE,CAejG;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC5C,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAC7B,GAAG,OAAO,CAAC,IAAI,CAAC,CAiChB;AAoCD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE"}
@@ -0,0 +1,33 @@
1
+ /** A page as `web_fetch` read it: what it saves, never what a question made of it. */
2
+ export interface CachedWebPage {
3
+ /** The final URL, after the same-host redirects that were followed. */
4
+ readonly url: string;
5
+ readonly title: string;
6
+ readonly status: number;
7
+ /** The media type the server sent, lowercased, or empty when it sent none. */
8
+ readonly contentType: string;
9
+ /** The page as it is saved: markdown or text, or a PDF or image as it came. */
10
+ readonly body: Uint8Array;
11
+ readonly kind: WebPageKind;
12
+ /** How many bytes the server sent, up to the fetch cap. */
13
+ readonly size: number;
14
+ /** The body stopped at the fetch cap, or an HTML page was converted only up to its own. */
15
+ readonly truncated: boolean;
16
+ }
17
+ /** What a saved page is, by its file's extension and media type. */
18
+ export interface WebPageKind {
19
+ readonly extension: "md" | "txt" | "pdf" | "png" | "jpg" | "gif" | "webp";
20
+ readonly mediaType: string;
21
+ }
22
+ /**
23
+ * The pages a runner process fetched in the last 15 minutes, by URL, up to 64 MB: a run that
24
+ * reads a page again, or another run that reads it, does not fetch it again. Least recently used
25
+ * pages go first.
26
+ */
27
+ export declare class WebFetchCache {
28
+ #private;
29
+ get(url: URL): CachedWebPage | undefined;
30
+ set(url: URL, page: CachedWebPage): void;
31
+ private delete;
32
+ }
33
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/tools/web-fetch/cache.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED,oEAAoE;AACpE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAcD;;;;GAIG;AACH,qBAAa,aAAa;;IAIxB,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,GAAG,SAAS;IAgBxC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;IAgBxC,OAAO,CAAC,MAAM;CAOf"}
@@ -0,0 +1,25 @@
1
+ /** A fetched HTML page, as the network returned it. */
2
+ export interface HtmlPage {
3
+ readonly bytes: Uint8Array;
4
+ /** The response's `content-type` header, which may carry the charset. Empty when absent. */
5
+ readonly contentType: string;
6
+ /** The URL the page was finally read from, after redirects: relative links resolve against it. */
7
+ readonly url: string | URL;
8
+ }
9
+ /** The page's readable text. */
10
+ export interface HtmlMarkdown {
11
+ /** `og:title`, else `<title>`; empty when the page names itself nowhere. */
12
+ readonly title: string;
13
+ readonly markdown: string;
14
+ /** The page was cut where it nested too deep or held too many elements: the rest is missing. */
15
+ readonly truncated?: true;
16
+ }
17
+ /**
18
+ * Convert a fetched HTML page to markdown, keeping its content and dropping its chrome.
19
+ *
20
+ * `parse5` builds the tree the way a browser would, whatever the markup; the page is then pruned
21
+ * (scripts, navigation, hidden elements), narrowed to its single `main` or `article` when it has
22
+ * one, and written as GFM markdown. Links and images are absolute.
23
+ */
24
+ export declare function htmlToMarkdown(page: HtmlPage): HtmlMarkdown;
25
+ //# sourceMappingURL=html-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-markdown.d.ts","sourceRoot":"","sources":["../../../src/tools/web-fetch/html-markdown.ts"],"names":[],"mappings":"AAQA,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,kGAAkG;IAClG,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAC3B;AAED,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,gGAAgG;IAChG,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAA;CAC1B;AAuDD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,CAY3D"}
@@ -0,0 +1,55 @@
1
+ import { AgentToolPublicError } from "@sixb/core";
2
+ /**
3
+ * Where a fetch leaves from: Sixb's servers, or the user's computer through the `sixb` CLI. Both
4
+ * reach only public addresses; a computer may also read its own loopback, so a developer can point
5
+ * the agent at their dev server.
6
+ */
7
+ export type WebFetchNetwork = "server" | "computer";
8
+ export interface GuardedFetchInput {
9
+ readonly network: WebFetchNetwork;
10
+ readonly signal: AbortSignal;
11
+ /** The body is read up to this many bytes, then cut (`truncated`). */
12
+ readonly maxBytes: number;
13
+ /** For the whole fetch: every redirect hop and the body. */
14
+ readonly timeoutMs: number;
15
+ /** Throws to refuse a URL before it is requested: the first, and each redirect followed. */
16
+ readonly admit?: (url: URL) => void;
17
+ }
18
+ export interface GuardedPage {
19
+ /** The final URL, after the same-host redirects that were followed. */
20
+ readonly url: string;
21
+ readonly status: number;
22
+ /** The media type, lowercased and without parameters. */
23
+ readonly contentType?: string;
24
+ readonly charset?: string;
25
+ readonly body: Uint8Array;
26
+ readonly truncated: boolean;
27
+ }
28
+ /** A redirect to another host. It is not followed: the agent decides whether to fetch it. */
29
+ export interface GuardedRedirect {
30
+ /** The URL that answered with the redirect. */
31
+ readonly url: string;
32
+ readonly redirect: {
33
+ readonly url: string;
34
+ readonly status: number;
35
+ };
36
+ }
37
+ export type GuardedResponse = GuardedPage | GuardedRedirect;
38
+ export type WebFetchErrorCode = "unsupported-url" | "blocked" | "unresolved" | "unreachable" | "too-many-redirects" | "timeout";
39
+ /** Why a page could not be fetched, worded for the model. */
40
+ export declare class WebFetchError extends AgentToolPublicError {
41
+ readonly code: WebFetchErrorCode;
42
+ readonly name = "WebFetchError";
43
+ constructor(code: WebFetchErrorCode, message: string, options?: ErrorOptions);
44
+ }
45
+ /**
46
+ * Fetch a page for the agent without letting it reach anything but the public web.
47
+ *
48
+ * Every address DNS returns for the host must be public, and the connection goes to the one that
49
+ * was checked: the URL carries the address, `Host` and the TLS server name carry the host, so DNS
50
+ * is never asked again and cannot answer differently in between. Same-host redirects are followed,
51
+ * each hop resolved and checked again; a redirect to another host is returned, unless its target
52
+ * is refused before DNS is even asked.
53
+ */
54
+ export declare function guardedFetch(url: URL, input: GuardedFetchInput): Promise<G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,iBAAiB,GACzB,iBAAiB,GACjB,SAAS,GACT,YAAY,GACZ,aAAa,GACb,oBAAoB,GACpB,SAAS,CAAA;AAEb,6DAA6D;AAC7D,qBAAa,aAAc,SAAQ,oBAAoB;IAInD,QAAQ,CAAC,IAAI,EAAE,iBAAiB;IAHlC,SAAkB,IAAI,mBAAkB;gBAG7B,IAAI,EAAE,iBAAiB,EAChC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY;CAIzB;AAgDD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAuD/F"}
@@ -0,0 +1,96 @@
1
+ import { type AgentRunWebPlan } from "@sixb/core/internal/agents";
2
+ import { type LanguageModel, type ModelTool, type ModelToolOutput } from "@sixb/core/models";
3
+ import type { SandboxNetworkPolicy } from "@sixb/core/sandboxes";
4
+ import type { ToolOutputFiles } from "../tool-outputs";
5
+ import { WebFetchCache } from "./cache";
6
+ import { type WebFetchNetwork } from "./network";
7
+ export declare const WEB_FETCH_TOOL_SPEC: {
8
+ readonly name: "web_fetch";
9
+ readonly description: "Read a web page, PDF or image by URL. A large page is saved to a file. Pass a question to get an answer from the page.";
10
+ readonly inputSchema: {
11
+ type: string;
12
+ properties: {
13
+ url: {
14
+ type: string;
15
+ };
16
+ question: {
17
+ type: string;
18
+ };
19
+ };
20
+ required: string[];
21
+ additionalProperties: false;
22
+ };
23
+ };
24
+ export interface WebFetchToolInput {
25
+ readonly url: string;
26
+ readonly question?: string;
27
+ }
28
+ /** A page the agent read, as the app names it. */
29
+ export interface WebSource {
30
+ readonly url: string;
31
+ readonly title: string;
32
+ }
33
+ /** What a fetch stores, and the app shows. The model reads {@link webFetchModelOutput} of it. */
34
+ export interface WebFetchToolOutput {
35
+ /** The final URL, after the same-host redirects that were followed, and the page's title. */
36
+ readonly source: WebSource;
37
+ readonly status: number;
38
+ /** The media type the server sent, or empty when it sent none, or not one. */
39
+ readonly contentType: string;
40
+ /** How many bytes the server sent, up to the 10 MB cap. */
41
+ readonly bytes: number;
42
+ /** Where the page is saved in the sandbox. Absent for a page small enough to read whole. */
43
+ readonly path?: string;
44
+ /**
45
+ * The body was cut at the 10 MB cap, or an HTML page was converted only up to its first 2 MB or
46
+ * as many elements as conversion takes.
47
+ */
48
+ readonly truncated?: true;
49
+ /** The page needed a file, and saving it failed: the model reads only what the output holds. */
50
+ readonly unsaved?: true;
51
+ readonly question?: string;
52
+ readonly answer?: string;
53
+ /** The answer stopped at its output limit: its end may be missing. */
54
+ readonly answerTruncated?: true;
55
+ /** Why the question went unanswered: the model then reads the preview and the path. */
56
+ readonly answerError?: string;
57
+ /** The page's first 2 KB, or the whole of a page of at most 8 KB. */
58
+ readonly preview?: string;
59
+ /** A redirect to another host, not followed: the agent fetches it if it wants it. */
60
+ readonly redirect?: {
61
+ readonly url: string;
62
+ readonly status: number;
63
+ };
64
+ }
65
+ export interface WebFetchToolOptions {
66
+ readonly web: AgentRunWebPlan;
67
+ /** Where fetches leave from: a computer may read its own loopback. */
68
+ readonly network: WebFetchNetwork;
69
+ /**
70
+ * The network policy the project declared for the run's sandbox: `restricted` limits fetches
71
+ * to its origins. Absent or `all`: any URL. (`none` offers no tool at all.)
72
+ */
73
+ readonly networkPolicy?: SandboxNetworkPolicy;
74
+ /** Where a page is saved, as a call's output file. */
75
+ readonly files: Pick<ToolOutputFiles, "store">;
76
+ /**
77
+ * The run's model as its session records it, without the run's context budget: it answers a
78
+ * question, admitted, limited and accounted with the run's other calls.
79
+ */
80
+ readonly model: LanguageModel;
81
+ /** The runner process's. */
82
+ readonly cache?: WebFetchCache;
83
+ }
84
+ /**
85
+ * Fetch a page through the network guard, within the sandbox's network policy and the project's
86
+ * domain lists, convert an HTML page to markdown, save it as the call's output file unless it is
87
+ * small enough to read whole, and answer a question from it with the run's own model.
88
+ */
89
+ export declare function createWebFetchTool(options: WebFetchToolOptions): ModelTool<WebFetchToolInput>;
90
+ /**
91
+ * What the model reads of a fetch: the answer, or the page or its preview, wrapped as untrusted
92
+ * web content, and where the page is saved. Read from the stored output alone, so a replayed
93
+ * conversation sends the same bytes.
94
+ */
95
+ export declare function webFetchModelOutput(output: WebFetchToolOutput): ModelToolOutput;
96
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/tools/web-fetch/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAiC,MAAM,4BAA4B,CAAA;AAGhG,OAAO,EAEL,KAAK,aAAa,EAKlB,KAAK,SAAS,EAEd,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAsB,aAAa,EAAoB,MAAM,SAAS,CAAA;AAE7E,OAAO,EAAiD,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AAkC/F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAUtB,CAAA;AAEV,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,iGAAiG;AACjG,MAAM,WAAW,kBAAkB;IACjC,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,2DAA2D;IAC3D,QAA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