@mono-agent/agent-runtime 0.20.14 → 0.21.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/ARCHITECTURE.md +50 -11
- package/MIGRATION.md +30 -7
- package/README.md +219 -35
- package/package.json +9 -4
- package/src/agent/tool-bloat.js +145 -9
- package/src/agent/tools/agent-tool.js +104 -5
- package/src/agent/tools/bash.js +10 -2
- package/src/agent/tools/codex-subscription-search.js +122 -28
- package/src/agent/tools/exec.js +10 -2
- package/src/agent/tools/monitor.js +11 -2
- package/src/agent/tools/pi-bridge.js +33 -14
- package/src/agent/tools/shared/monitors.js +22 -3
- package/src/agent/tools/shared/path-resolver.js +25 -6
- package/src/agent/tools/shared/process-jobs.js +6 -1
- package/src/agent/tools/shared/process-runner.js +3 -1
- package/src/agent/tools/shared/tool-context.js +8 -0
- package/src/agent/tools/web-access-interstitial.js +70 -0
- package/src/agent/tools/web-browser-render.js +83 -58
- package/src/agent/tools/web-controller.js +112 -21
- package/src/agent/tools/web-document-extractor.js +379 -0
- package/src/agent/tools/web-fetch.js +271 -243
- package/src/agent/tools/web-request.js +65 -0
- package/src/agent/tools/web-search-output.js +165 -0
- package/src/agent/tools/web-search-state.js +75 -0
- package/src/agent/tools/web-search.js +532 -71
- package/src/ai/failure.js +3 -3
- package/src/ai/index.js +1 -0
- package/src/ai/observer.js +8 -0
- package/src/ai/pi-interop.js +156 -0
- package/src/ai/provider-check.js +131 -0
- package/src/ai/providers/pi-native/compaction-driver.js +45 -21
- package/src/ai/providers/pi-native/compaction-summary.js +140 -0
- package/src/ai/providers/pi-native/harness-adapter.js +40 -2
- package/src/ai/providers/pi-native/prompt-cache-diagnostics.js +103 -0
- package/src/ai/providers/pi-native/provider-attribution.js +102 -0
- package/src/ai/providers/pi-native/result-builder.js +28 -4
- package/src/ai/providers/pi-native/session-lifecycle.js +167 -24
- package/src/ai/providers/pi-native/stream-subscriber.js +30 -2
- package/src/ai/providers/pi-native/terminal-recovery.js +40 -0
- package/src/ai/providers/pi-native/turn-runner.js +245 -13
- package/src/ai/providers/pi-native.js +159 -40
- package/src/ai/runtime/live-input-events.js +250 -54
- package/src/ai/runtime/router.js +30 -11
- package/src/ai/tool-lifecycle.js +32 -18
- package/src/ai/types.js +26 -5
- package/src/runtime.js +24 -5
- package/types/agent/tool-bloat.d.ts +1 -1
- package/types/agent/tools/agent-tool.d.ts +4 -1
- package/types/agent/tools/bash.d.ts +5 -3
- package/types/agent/tools/codex-subscription-search.d.ts +6 -2
- package/types/agent/tools/exec.d.ts +5 -3
- package/types/agent/tools/monitor.d.ts +5 -2
- package/types/agent/tools/pi-bridge.d.ts +6 -4
- package/types/agent/tools/shared/monitors.d.ts +17 -2
- package/types/agent/tools/shared/process-jobs.d.ts +5 -1
- package/types/agent/tools/shared/process-runner.d.ts +3 -2
- package/types/agent/tools/shared/tool-context.d.ts +2 -0
- package/types/agent/tools/web-access-interstitial.d.ts +23 -0
- package/types/agent/tools/web-browser-render.d.ts +4 -1
- package/types/agent/tools/web-controller.d.ts +4 -2
- package/types/agent/tools/web-document-extractor.d.ts +27 -0
- package/types/agent/tools/web-fetch.d.ts +19 -24
- package/types/agent/tools/web-request.d.ts +20 -0
- package/types/agent/tools/web-search-output.d.ts +31 -0
- package/types/agent/tools/web-search-state.d.ts +21 -0
- package/types/agent/tools/web-search.d.ts +10 -45
- package/types/ai/index.d.ts +1 -0
- package/types/ai/observer.d.ts +6 -0
- package/types/ai/pi-interop.d.ts +61 -0
- package/types/ai/provider-check.d.ts +53 -0
- package/types/ai/providers/pi-native/compaction-driver.d.ts +2 -1
- package/types/ai/providers/pi-native/compaction-summary.d.ts +19 -0
- package/types/ai/providers/pi-native/harness-adapter.d.ts +3 -1
- package/types/ai/providers/pi-native/prompt-cache-diagnostics.d.ts +3 -0
- package/types/ai/providers/pi-native/provider-attribution.d.ts +26 -0
- package/types/ai/providers/pi-native/result-builder.d.ts +11 -1
- package/types/ai/providers/pi-native/session-lifecycle.d.ts +23 -5
- package/types/ai/providers/pi-native/terminal-recovery.d.ts +2 -0
- package/types/ai/providers/pi-native/turn-runner.d.ts +36 -5
- package/types/ai/runtime/live-input-events.d.ts +32 -8
- package/types/ai/tool-lifecycle.d.ts +4 -3
- package/types/ai/types.d.ts +140 -12
package/src/ai/types.js
CHANGED
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
* nested native agent. Informational only; `id` remains the attachment key.
|
|
43
43
|
* @property {number} [costUsd] Priced delegation cost, when the runtime can
|
|
44
44
|
* attribute it to this subagent.
|
|
45
|
+
* @property {*} [attribution] Bounded provider-route attribution for the
|
|
46
|
+
* completed child run. Consumers must treat it as operator telemetry.
|
|
45
47
|
*/
|
|
46
48
|
|
|
47
49
|
/**
|
|
@@ -110,7 +112,7 @@
|
|
|
110
112
|
* @typedef {Readonly<{
|
|
111
113
|
* recordId?: string,
|
|
112
114
|
* sequence?: number,
|
|
113
|
-
* persistence: "persisted"|"failed",
|
|
115
|
+
* persistence: "persisted"|"deferred"|"failed",
|
|
114
116
|
* truncated?: boolean,
|
|
115
117
|
* originalBytes?: number,
|
|
116
118
|
* retainedBytes?: number,
|
|
@@ -130,6 +132,7 @@
|
|
|
130
132
|
* @typedef {Object} RuntimeObserver
|
|
131
133
|
* Per-call or host-level observer merged by createObserverHub (ai/observer.js).
|
|
132
134
|
* Loose on purpose: observer.js is not a kernel seam file.
|
|
135
|
+
* @property {(event: RuntimeToolLifecycleEvent) => void} [recordToolLifecycle] Synchronous admission before queued lifecycle persistence.
|
|
133
136
|
* @property {(event: RuntimeEvent) => (void|Promise<void>)} [onEvent]
|
|
134
137
|
* @property {() => (void|Promise<void>)} [flush]
|
|
135
138
|
*/
|
|
@@ -190,11 +193,14 @@
|
|
|
190
193
|
* @property {RuntimeModelRef} model Resolved model reference; see parseRuntimeModelReference.
|
|
191
194
|
* @property {string} [sessionId] Host conversation/session key for resumable bridges.
|
|
192
195
|
* @property {string} [providerSessionId] Provider-owned resume id for resumable bridges.
|
|
196
|
+
* @property {string} [providerAttributionSessionId] Host-owned provider attribution continuity key; does not authorize transcript resume.
|
|
197
|
+
* @property {{runId: string, revision: number}} [sessionRecovery] Host-owned durable recovery opt-in.
|
|
193
198
|
* @property {boolean} [sessionKeepAlive] Keep resumable provider state alive after the turn.
|
|
194
199
|
* @property {number} [sessionIdleTimeoutMs] Idle TTL for resumable provider state.
|
|
195
|
-
* @property {AsyncIterable<{body: string, id?: string, receivedAt?: string, acknowledge?: () =>
|
|
200
|
+
* @property {AsyncIterable<{body: string, id?: string, receivedAt?: string, logicalOwner?: object, accepted?: (evidence?: {providerEntryId?: string, providerRunId?: string}) => unknown, acknowledge?: (evidence?: {providerEntryId?: string, providerRunId?: string}) => unknown, uncertain?: (details: {reason: "delivery_uncertain", providerEntryId?: string, providerRunId?: string}) => unknown, reject?: (error?: unknown) => unknown}>} [liveInput] Stream of in-flight user messages for steering an active run. Native acceptance, exact transcript consumption, and uncertain delivery are distinct synchronous callbacks; thenables are never awaited as settlement confirmation. An optional opaque logicalOwner object proves that a later same-id value is a fresh callback lease for the first logical owner, not an independent duplicate.
|
|
196
201
|
* @property {ReadonlyArray<*>} [observers] Per-call observers (see RuntimeObserver) merged with host-level (createRuntime) observers.
|
|
197
202
|
* @property {(event: RuntimeEvent) => void} [onEvent]
|
|
203
|
+
* @property {boolean} [promptCacheDiagnostics] Emit metadata-only prompt-cache request fingerprints.
|
|
198
204
|
* @property {RuntimeToolLifecycleSink} [toolLifecycleSink] Awaited host-owned incremental lifecycle persistence boundary.
|
|
199
205
|
* @property {ReadonlyArray<Object>} [messages]
|
|
200
206
|
* @property {string} [effort]
|
|
@@ -206,23 +212,31 @@
|
|
|
206
212
|
* @property {ReadonlyArray<string>} [disallowedTools]
|
|
207
213
|
* @property {string} [permissionMode]
|
|
208
214
|
* @property {number} [maxTurns]
|
|
215
|
+
* @property {number} [providerCheckMaxTokens] Internal provider-check output cap; ordinary callers must omit it.
|
|
216
|
+
* @property {{env(name: string): Promise<string|undefined>, fileExists(path: string): Promise<boolean>}} [providerCheckAuthContext] Internal provider-check effective auth context; ordinary callers must omit it.
|
|
209
217
|
* @property {Object} [outputSchema]
|
|
210
218
|
* @property {string} [runArtifactDir]
|
|
211
219
|
* @property {AbortSignal} [abortSignal]
|
|
220
|
+
* @property {(artifact: {filename: string, buffer: Buffer, toolName: string, toolUseId: (string|null)}) => (string|null)} [persistArtifact] Host-owned synchronous artifact writer bound to this run.
|
|
212
221
|
* @property {{schema: 1, values: Readonly<Record<string, string>>, pathPrepend?: readonly string[]}} [toolEnvironment] Host-only environment for Bash, Exec, and nested subagents in this run.
|
|
213
222
|
* @property {import('../agent/sandbox-seam.js').SandboxPolicy} [sandboxPolicy] Per-run sandbox policy; merged monotonically with the host policy (see resolveSandboxPolicy, agent/tools/shared/tool-context.js).
|
|
214
223
|
* @property {import('../agent/sandbox-seam.js').RuntimeSandboxEngine} [sandboxEngine] Per-run concrete sandbox engine handed to the active sandbox implementation.
|
|
215
224
|
* @property {import('../agent/sandbox-seam.js').RuntimeSandbox} [sandbox] Per-run sandbox IMPLEMENTATION override; when set it enforces this run's tools instead of the host/ToolContext impl (precedence run > host > passthrough). Policy DATA still merges monotonically (I13); this overrides only the enforcing code.
|
|
216
225
|
* @property {RuntimeToolLimits} [toolLimits] Typed per-run tool-output limits (supported replacement for the deprecated `settings` tool keys).
|
|
226
|
+
* @property {readonly string[]} [mcpCallNoTotalTimeoutTools] Exact `server:tool`
|
|
227
|
+
* names whose host-owned lifecycle has no total deadline. Inactivity and abort still apply.
|
|
217
228
|
* @property {RuntimeCompactionPolicy} [compaction] Typed per-run compaction policy (supported replacement for the deprecated `settings` compaction keys).
|
|
218
229
|
* @property {RuntimePromptOverrides} [prompts] Per-run prompt-fragment overrides (run wins over the host default).
|
|
219
|
-
* @property {
|
|
230
|
+
* @property {any} [webRequestCoordinator] Host-owned shared web admission and quota state.
|
|
231
|
+
* @property {{backend?: "auto"|"searxng"|"ollama"|"codex"|"keyless", maxRequestsPerRun?: number, endpoint?: string, searxng?: {endpoint?: string}, ollama?: {baseUrl?: string, apiKey?: string, apiKeyEnv?: string, trustPublicUrl?: boolean}, codex?: {model?: string}}} [webSearchConfig] Run-scoped WebSearch backend configuration.
|
|
232
|
+
* @property {any} [webSearchState] Private request budget and provider deferral state for one logical run.
|
|
220
233
|
* @property {{render?: "never"|"auto", browserCommand?: string}} [webFetchConfig] Run-scoped WebFetch extraction/render configuration.
|
|
221
234
|
* @property {"sequential"|"safe-parallel"} [piToolExecutionMode] Pi built-in tool scheduling mode. Safe parallelism is the default.
|
|
222
235
|
* @property {"one-at-a-time"|"all"} [piToolParallelismMode] DEPRECATED. Compatibility alias mapped to piToolExecutionMode.
|
|
223
236
|
* @property {Object} [settings] DEPRECATED. Legacy flat settings bag; consumed only as a per-group FALLBACK when the corresponding typed object (`toolLimits` / `compaction`) is absent. Consuming any key emits one `deprecated_settings_option` runtime_warning per run. Migrate via resolveRuntimePolicies (@mono-agent/runtime-adapter).
|
|
224
237
|
* @property {RuntimeSubagentsOptions} [subagents] In-process `Agent` built-in: profiles, caps, and the nested-run callback.
|
|
225
238
|
* @property {import('../agent/tools/shared/process-jobs.js').ProcessJobsController} [processJobs] Pi-native-only structural process-job controller. When absent, Exec/Bash schemas and foreground behavior are unchanged.
|
|
239
|
+
* @property {{chainDepth: number, maxChainDepth: number, remainingStarts: number, unavailableReason?: string}} [processJobsAvailability] Host-owned request lineage diagnostics, including when the controller is unavailable.
|
|
226
240
|
* @property {import('../agent/tools/shared/monitors.js').MonitorsController} [monitors] Pi-native-only structural monitor controller. When absent, the Monitor and MonitorStop tools are not registered at all.
|
|
227
241
|
* @property {Object} [diagnosticsSeed] Set by createRouterRuntime (ai/runtime/router.js) with a `resume_snapshot` when
|
|
228
242
|
* failing over mid-chain; a host-level coordinator may relay it forward (see agent/transcript.js), not read by any
|
|
@@ -234,7 +248,7 @@
|
|
|
234
248
|
|
|
235
249
|
/**
|
|
236
250
|
* @typedef {RuntimeRunOptions
|
|
237
|
-
* & Pick<AgentRuntimeHostOptions, "resolveCustomPricing" | "resolvePiApiKey" | "
|
|
251
|
+
* & Pick<AgentRuntimeHostOptions, "resolveCustomPricing" | "resolvePiApiKey" | "onCompactionRecorded" | "onToolApprovalRequest" | "toolRiskTiers" | "approvalDefaultRiskTier" | "approvalTimeoutMs" | "approvalAlwaysAllowTools">
|
|
238
252
|
* & {runtimeBrand: import('../runtime-brand.js').RuntimeBrand, toolContext?: import('../agent/tools/shared/tool-context.js').ToolContext, observerHub: {emit: (event: RuntimeEvent) => void, flush: () => Promise<void>}}
|
|
239
253
|
* } RuntimeRequest
|
|
240
254
|
* The request shape a bridge's `execute(systemPrompt, req)` receives as its
|
|
@@ -306,11 +320,13 @@
|
|
|
306
320
|
* @property {number} [numTurns]
|
|
307
321
|
* @property {string} [model]
|
|
308
322
|
* @property {string} [effort]
|
|
323
|
+
* @property {string} [effectiveEffort] Provider-effective reasoning/thinking level when reported.
|
|
309
324
|
* @property {RuntimeSdkId} [sdk]
|
|
310
325
|
* @property {boolean} [cancelled]
|
|
311
326
|
* @property {string|null} [error]
|
|
312
327
|
* @property {Object|null} [errorDetails]
|
|
313
328
|
* @property {string|null} [failureKind]
|
|
329
|
+
* @property {{runId: string, revision: number, providerSessionId: string, modelKey: string, tipId: string}} [providerSessionRecovery]
|
|
314
330
|
* @property {string|null} [providerSessionId]
|
|
315
331
|
* @property {string|null} [stderrTail] Bounded stderr tail from a CLI-backed bridge; see createStderrTail (ai/failure.js).
|
|
316
332
|
* @property {Array<Object>} [runtimeWarnings]
|
|
@@ -407,6 +423,8 @@
|
|
|
407
423
|
* host-integration callbacks (bound once, applied to every run via hostDefaults).
|
|
408
424
|
* @property {string} [workspace]
|
|
409
425
|
* @property {string} [repoRoot]
|
|
426
|
+
* @property {ReadonlyArray<string>} [additionalReadRoots]
|
|
427
|
+
* @property {ReadonlyArray<string>} [additionalWriteRoots]
|
|
410
428
|
* @property {string} [ripgrepPath]
|
|
411
429
|
* @property {string} [qaOutputDir]
|
|
412
430
|
* @property {import('../agent/sandbox-seam.js').SandboxPolicy} [sandboxPolicy]
|
|
@@ -432,6 +450,8 @@
|
|
|
432
450
|
* (createRuntime's TOOL_RUNTIME_KEYS pick).
|
|
433
451
|
* @property {string} [workspace]
|
|
434
452
|
* @property {string} [repoRoot]
|
|
453
|
+
* @property {ReadonlyArray<string>} [additionalReadRoots]
|
|
454
|
+
* @property {ReadonlyArray<string>} [additionalWriteRoots]
|
|
435
455
|
* @property {string} [ripgrepPath]
|
|
436
456
|
* @property {string} [qaOutputDir]
|
|
437
457
|
* @property {import('../agent/sandbox-seam.js').SandboxPolicy} [sandboxPolicy]
|
|
@@ -444,9 +464,10 @@
|
|
|
444
464
|
* The object `createRuntime`/`createRouterRuntime` return.
|
|
445
465
|
* @property {(systemPrompt: string, options: RuntimeRunOptions) => Promise<RuntimeResult>} run
|
|
446
466
|
* @property {(next?: AgentRuntimeToolOptions) => void} configureTools
|
|
467
|
+
* @property {(receipt: NonNullable<RuntimeResult["providerSessionRecovery"]>, context: {appliedInputIds: readonly string[]}) => Promise<boolean>} recoverSession
|
|
447
468
|
* @property {(providerSessionId: string) => Promise<boolean>} syncSession
|
|
448
469
|
* @property {(providerSessionId: string) => Promise<void>} refreshSession Guarantees the id has no reusable process-local handle; rejects on failure.
|
|
449
|
-
* @property {(providerSessionId: string, sessionsRoot: string) => Promise<void>} retireDurableSession
|
|
470
|
+
* @property {(providerSessionId: string, sessionsRoot: string) => Promise<void>} retireDurableSession Deletes every currently materialized durable transcript with the exact id; callers retry after an active retired run settles to reclaim any late same-name append. Absence is success.
|
|
450
471
|
* @property {(providerSessionId: string) => Promise<boolean>} disposeSession
|
|
451
472
|
* @property {(providerSessionId: string) => Promise<boolean>} invalidateSession
|
|
452
473
|
* @property {() => Promise<void>} disposeAllSessions
|
package/src/runtime.js
CHANGED
|
@@ -36,9 +36,10 @@ import {
|
|
|
36
36
|
} from "./ai/runtime/sessions.js";
|
|
37
37
|
import { createToolContext, updateToolContext } from "./agent/tools/shared/tool-context.js";
|
|
38
38
|
import { resolveRuntimeBrand } from "./runtime-brand.js";
|
|
39
|
-
import { retireDurableNativeSession } from "./ai/providers/pi-native/session-lifecycle.js";
|
|
39
|
+
import { recoverDurableNativeSession, retireDurableNativeSession } from "./ai/providers/pi-native/session-lifecycle.js";
|
|
40
40
|
import { instrumentLiveInputAppliedEvents } from "./ai/runtime/live-input-events.js";
|
|
41
41
|
import { createToolLifecycleEventGate } from "./ai/tool-lifecycle.js";
|
|
42
|
+
import { createWebSearchRunState } from "./agent/tools/web-search-state.js";
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* @typedef {import('./ai/types.js').AgentRuntimeHostOptions} AgentRuntimeHostOptions
|
|
@@ -49,9 +50,8 @@ import { createToolLifecycleEventGate } from "./ai/tool-lifecycle.js";
|
|
|
49
50
|
*/
|
|
50
51
|
|
|
51
52
|
// Host-integration callbacks bound onto every request. This list is the runtime
|
|
52
|
-
// half of
|
|
53
|
-
//
|
|
54
|
-
// declared request shape does not admit.
|
|
53
|
+
// host-default half of `RuntimeRequest` in ai/types.js. Every entry must be
|
|
54
|
+
// admitted either by RuntimeRunOptions itself or by its host-option Pick.
|
|
55
55
|
const HOST_KEYS = [
|
|
56
56
|
"resolveCustomPricing",
|
|
57
57
|
"resolvePiApiKey",
|
|
@@ -67,6 +67,8 @@ const HOST_KEYS = [
|
|
|
67
67
|
const TOOL_RUNTIME_KEYS = [
|
|
68
68
|
"workspace",
|
|
69
69
|
"repoRoot",
|
|
70
|
+
"additionalReadRoots",
|
|
71
|
+
"additionalWriteRoots",
|
|
70
72
|
"ripgrepPath",
|
|
71
73
|
"qaOutputDir",
|
|
72
74
|
"sandboxPolicy",
|
|
@@ -175,6 +177,9 @@ export function createRuntime(host = {}) {
|
|
|
175
177
|
...(request.skills === undefined ? {} : { skills: request.skills }),
|
|
176
178
|
...(request.skillsRoot === undefined ? {} : { skillsRoot: request.skillsRoot }),
|
|
177
179
|
...(request.toolEnvironment === undefined ? {} : { toolEnvironment: request.toolEnvironment }),
|
|
180
|
+
...(request.webSearchConfig === undefined ? {} : { webSearchConfig: request.webSearchConfig }),
|
|
181
|
+
...(request.webRequestCoordinator === undefined ? {} : { webRequestCoordinator: request.webRequestCoordinator }),
|
|
182
|
+
...(request.webFetchConfig === undefined ? {} : { webFetchConfig: request.webFetchConfig }),
|
|
178
183
|
...(request.cwd === undefined ? {} : { cwd: request.cwd }),
|
|
179
184
|
// A profile that pins effort — declared or authored at call time — means it
|
|
180
185
|
// on this path too; dropping it would silently run the child at the
|
|
@@ -200,6 +205,7 @@ export function createRuntime(host = {}) {
|
|
|
200
205
|
*/
|
|
201
206
|
async run(systemPrompt, options = {}) {
|
|
202
207
|
if (!options.model) throw new Error("createRuntime.run requires options.model");
|
|
208
|
+
const webSearchState = createWebSearchRunState(options.webSearchConfig, options.webSearchState);
|
|
203
209
|
const bridge = await resolveRuntimeBridge(options.model, {
|
|
204
210
|
liveInput: !!options.liveInput,
|
|
205
211
|
});
|
|
@@ -212,6 +218,7 @@ export function createRuntime(host = {}) {
|
|
|
212
218
|
// Observer delivery keeps the runtime's synchronous contract. Only the
|
|
213
219
|
// client-facing lifecycle event waits for its serialized persistence.
|
|
214
220
|
onObserve: (event) => hub.emit(event),
|
|
221
|
+
onLifecycleAdmitted: (event) => hub.recordToolLifecycle(event),
|
|
215
222
|
onEvent: options.onEvent,
|
|
216
223
|
abortSignal: options.abortSignal,
|
|
217
224
|
});
|
|
@@ -228,11 +235,20 @@ export function createRuntime(host = {}) {
|
|
|
228
235
|
// defaultSubagentRun is what increments it for the child.
|
|
229
236
|
const subagents = options.subagents === undefined
|
|
230
237
|
? undefined
|
|
231
|
-
: {
|
|
238
|
+
: {
|
|
239
|
+
...options.subagents,
|
|
240
|
+
run: options.subagents.run ?? ((request) => defaultSubagentRun({
|
|
241
|
+
...request,
|
|
242
|
+
...(options.webSearchConfig === undefined ? {} : { webSearchConfig: options.webSearchConfig }),
|
|
243
|
+
...(options.webRequestCoordinator === undefined ? {} : { webRequestCoordinator: options.webRequestCoordinator }),
|
|
244
|
+
...(options.webFetchConfig === undefined ? {} : { webFetchConfig: options.webFetchConfig }),
|
|
245
|
+
})),
|
|
246
|
+
};
|
|
232
247
|
try {
|
|
233
248
|
return await bridge.execute(systemPrompt, {
|
|
234
249
|
...hostDefaults,
|
|
235
250
|
...options,
|
|
251
|
+
webSearchState,
|
|
236
252
|
...(subagents === undefined ? {} : { subagents }),
|
|
237
253
|
// `...options` alone doesn't carry the `options.model` narrowing above
|
|
238
254
|
// (spread reads the parameter's declared — Partial — type); re-assert
|
|
@@ -258,6 +274,9 @@ export function createRuntime(host = {}) {
|
|
|
258
274
|
configureTools(next = {}) {
|
|
259
275
|
updateToolContext(toolContext, pickPresent(next, TOOL_RUNTIME_KEYS));
|
|
260
276
|
},
|
|
277
|
+
async recoverSession(receipt, context) {
|
|
278
|
+
return recoverDurableNativeSession(receipt, context);
|
|
279
|
+
},
|
|
261
280
|
async syncSession(providerSessionId) {
|
|
262
281
|
return syncProviderSession(providerSessionId);
|
|
263
282
|
},
|
|
@@ -38,7 +38,7 @@ export function subagentUsageForRun(subagents: any, parentRunId: string | undefi
|
|
|
38
38
|
* Build the `Agent` tool, or null when subagents are unavailable for this run.
|
|
39
39
|
*
|
|
40
40
|
* @param {RuntimeSubagentsOptions|null|undefined} subagents
|
|
41
|
-
* @param {{model?: *, cwd?: string, parentRunId?: string, sandboxPolicy?: *, sandboxEngine?: *, skills?: {name: string, description?: string}[], skillsRoot?: string, toolEnvironment?: *, onEvent?: (event: *) => void}} [context]
|
|
41
|
+
* @param {{model?: *, cwd?: string, parentRunId?: string, sandboxPolicy?: *, sandboxEngine?: *, skills?: {name: string, description?: string}[], skillsRoot?: string, toolEnvironment?: *, webSearchConfig?: *, webRequestCoordinator?: *, webFetchConfig?: *, onEvent?: (event: *) => void}} [context]
|
|
42
42
|
* @returns {*|null}
|
|
43
43
|
*/
|
|
44
44
|
export function createAgentTool(subagents: RuntimeSubagentsOptions | null | undefined, context?: {
|
|
@@ -53,6 +53,9 @@ export function createAgentTool(subagents: RuntimeSubagentsOptions | null | unde
|
|
|
53
53
|
}[];
|
|
54
54
|
skillsRoot?: string;
|
|
55
55
|
toolEnvironment?: any;
|
|
56
|
+
webSearchConfig?: any;
|
|
57
|
+
webRequestCoordinator?: any;
|
|
58
|
+
webFetchConfig?: any;
|
|
56
59
|
onEvent?: (event: any) => void;
|
|
57
60
|
}): any | null;
|
|
58
61
|
/**
|
|
@@ -24,7 +24,7 @@ export function normalizeBackgroundBashTimeoutMs(value: any): number;
|
|
|
24
24
|
/**
|
|
25
25
|
* Compatibility wrapper retained for direct callers and tests.
|
|
26
26
|
*
|
|
27
|
-
* @param {{command: string, description?: string, timeout?: number, timeout_ms?: number, max_output_chars?: number, workdir?: string, background?: boolean}} params
|
|
27
|
+
* @param {{command: string, description?: string, timeout?: number, timeout_ms?: number, max_output_chars?: number, workdir?: string, background?: boolean, wake_on_completion?: boolean}} params
|
|
28
28
|
* @param {{signal?: AbortSignal, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, processJobsController?: import("./shared/process-jobs.js").ProcessJobsController}} [options]
|
|
29
29
|
*/
|
|
30
30
|
export function bashToolImpl(params: {
|
|
@@ -35,6 +35,7 @@ export function bashToolImpl(params: {
|
|
|
35
35
|
max_output_chars?: number;
|
|
36
36
|
workdir?: string;
|
|
37
37
|
background?: boolean;
|
|
38
|
+
wake_on_completion?: boolean;
|
|
38
39
|
}, options?: {
|
|
39
40
|
signal?: AbortSignal;
|
|
40
41
|
sandboxPolicy?: any;
|
|
@@ -45,10 +46,10 @@ export function bashToolImpl(params: {
|
|
|
45
46
|
/**
|
|
46
47
|
* Structured Bash execution used by the Pi bridge.
|
|
47
48
|
*
|
|
48
|
-
* @param {{command: string, description?: string, timeout?: number, timeout_ms?: number, max_output_chars?: number, workdir?: string, background?: boolean}} params
|
|
49
|
+
* @param {{command: string, description?: string, timeout?: number, timeout_ms?: number, max_output_chars?: number, workdir?: string, background?: boolean, wake_on_completion?: boolean}} params
|
|
49
50
|
* @param {{signal?: AbortSignal, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, processJobsController?: import("./shared/process-jobs.js").ProcessJobsController}} [options]
|
|
50
51
|
*/
|
|
51
|
-
export function bashToolRun({ command, description, timeout, timeout_ms, max_output_chars, workdir, background, }: {
|
|
52
|
+
export function bashToolRun({ command, description, timeout, timeout_ms, max_output_chars, workdir, background, wake_on_completion, }: {
|
|
52
53
|
command: string;
|
|
53
54
|
description?: string;
|
|
54
55
|
timeout?: number;
|
|
@@ -56,6 +57,7 @@ export function bashToolRun({ command, description, timeout, timeout_ms, max_out
|
|
|
56
57
|
max_output_chars?: number;
|
|
57
58
|
workdir?: string;
|
|
58
59
|
background?: boolean;
|
|
60
|
+
wake_on_completion?: boolean;
|
|
59
61
|
}, { signal, sandboxPolicy, sandboxEngine, ctx, processJobsController, }?: {
|
|
60
62
|
signal?: AbortSignal;
|
|
61
63
|
sandboxPolicy?: any;
|
|
@@ -18,13 +18,17 @@ export function inspectCodexSubscriptionSearch(options?: {
|
|
|
18
18
|
* turns or cross-wire app-server notifications between requests.
|
|
19
19
|
*
|
|
20
20
|
* @param {string} query
|
|
21
|
-
* @param {{model?: string, signal?: AbortSignal, clientFactory?: typeof createCodexAppServerClient}} [options]
|
|
21
|
+
* @param {{model?: string, signal?: AbortSignal, clientFactory?: typeof createCodexAppServerClient, coordinator?: any, language?: string, timeRange?: string, claimRequest?: () => void}} [options]
|
|
22
22
|
*/
|
|
23
23
|
export function searchCodexSubscription(query: string, options?: {
|
|
24
24
|
model?: string;
|
|
25
25
|
signal?: AbortSignal;
|
|
26
26
|
clientFactory?: typeof createCodexAppServerClient;
|
|
27
|
-
|
|
27
|
+
coordinator?: any;
|
|
28
|
+
language?: string;
|
|
29
|
+
timeRange?: string;
|
|
30
|
+
claimRequest?: () => void;
|
|
31
|
+
}): any;
|
|
28
32
|
/** Test hook for process-shared broker state. */
|
|
29
33
|
export function __resetCodexSubscriptionSearchForTests(): Promise<void>;
|
|
30
34
|
export const DEFAULT_CODEX_SEARCH_MODEL: "gpt-5.6-luna";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @typedef {import("./shared/process-jobs.js").ProcessJobsController} ProcessJobsController */
|
|
2
2
|
/**
|
|
3
|
-
* @param {{executable: string, args?: string[], workdir?: string, description?: string, timeout_ms?: number, max_output_chars?: number, background?: boolean}} params
|
|
3
|
+
* @param {{executable: string, args?: string[], workdir?: string, description?: string, timeout_ms?: number, max_output_chars?: number, background?: boolean, wake_on_completion?: boolean}} params
|
|
4
4
|
* @param {{signal?: AbortSignal, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, processJobsController?: ProcessJobsController}} [options]
|
|
5
5
|
*/
|
|
6
6
|
export function execToolImpl(params: {
|
|
@@ -11,6 +11,7 @@ export function execToolImpl(params: {
|
|
|
11
11
|
timeout_ms?: number;
|
|
12
12
|
max_output_chars?: number;
|
|
13
13
|
background?: boolean;
|
|
14
|
+
wake_on_completion?: boolean;
|
|
14
15
|
}, options?: {
|
|
15
16
|
signal?: AbortSignal;
|
|
16
17
|
sandboxPolicy?: any;
|
|
@@ -21,10 +22,10 @@ export function execToolImpl(params: {
|
|
|
21
22
|
/**
|
|
22
23
|
* Execute an argv vector directly, without shell parsing.
|
|
23
24
|
*
|
|
24
|
-
* @param {{executable: string, args?: string[], workdir?: string, description?: string, timeout_ms?: number, max_output_chars?: number, background?: boolean}} params
|
|
25
|
+
* @param {{executable: string, args?: string[], workdir?: string, description?: string, timeout_ms?: number, max_output_chars?: number, background?: boolean, wake_on_completion?: boolean}} params
|
|
25
26
|
* @param {{signal?: AbortSignal, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, processJobsController?: ProcessJobsController}} [options]
|
|
26
27
|
*/
|
|
27
|
-
export function execToolRun({ executable, args, workdir, description, timeout_ms, max_output_chars, background, }: {
|
|
28
|
+
export function execToolRun({ executable, args, workdir, description, timeout_ms, max_output_chars, background, wake_on_completion, }: {
|
|
28
29
|
executable: string;
|
|
29
30
|
args?: string[];
|
|
30
31
|
workdir?: string;
|
|
@@ -32,6 +33,7 @@ export function execToolRun({ executable, args, workdir, description, timeout_ms
|
|
|
32
33
|
timeout_ms?: number;
|
|
33
34
|
max_output_chars?: number;
|
|
34
35
|
background?: boolean;
|
|
36
|
+
wake_on_completion?: boolean;
|
|
35
37
|
}, { signal, sandboxPolicy, sandboxEngine, ctx, processJobsController, }?: {
|
|
36
38
|
signal?: AbortSignal;
|
|
37
39
|
sandboxPolicy?: any;
|
|
@@ -14,15 +14,18 @@ export function normalizeMonitorTimeoutMs(value: any, fallback?: number): number
|
|
|
14
14
|
* cleaned startup environment, and the same sandbox `prepareCommand` seam. A
|
|
15
15
|
* monitor must never be a way to run a command Bash could not.
|
|
16
16
|
*
|
|
17
|
-
* @param {{command?: string, description?: string, timeout_ms?: number, persistent?: boolean, workdir?: string}} params
|
|
17
|
+
* @param {{command?: string, description?: string, timeout_ms?: number, persistent?: boolean, workdir?: string, wake_on?: "batch"|"exit", dedupe?: "none"|"batch", min_wake_interval_ms?: number}} params
|
|
18
18
|
* @param {{signal?: AbortSignal, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, monitorsController?: import("./shared/monitors.js").MonitorsController}} [options]
|
|
19
19
|
*/
|
|
20
|
-
export function monitorToolRun({ command, description, timeout_ms, persistent, workdir }: {
|
|
20
|
+
export function monitorToolRun({ command, description, timeout_ms, persistent, workdir, wake_on, dedupe, min_wake_interval_ms }: {
|
|
21
21
|
command?: string;
|
|
22
22
|
description?: string;
|
|
23
23
|
timeout_ms?: number;
|
|
24
24
|
persistent?: boolean;
|
|
25
25
|
workdir?: string;
|
|
26
|
+
wake_on?: "batch" | "exit";
|
|
27
|
+
dedupe?: "none" | "batch";
|
|
28
|
+
min_wake_interval_ms?: number;
|
|
26
29
|
}, { sandboxPolicy, sandboxEngine, ctx, monitorsController }?: {
|
|
27
30
|
signal?: AbortSignal;
|
|
28
31
|
sandboxPolicy?: any;
|
|
@@ -35,9 +35,9 @@ export function createStructuredOutputTool(outputSchema: any, onStructuredOutput
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* @param {any} allowedTools
|
|
38
|
-
* @param {{disallowedTools?: any[], skillNames?: any[], skills?: any[], skillsRoot?: any, dataDir?: any, cwd?: any, onEvent?: (event: any) => void, toolLimits?: any, persistArtifact?: any, onTruncate?: any, toolPayloadMaxBytes?: number, imageInlineMaxBytes?: any, toolPolicy?: any, sandboxPolicy?: any, sandboxEngine?: any, approvalManager?: any, approvalModel?: any, nodeReplController?: any, webController?: any, processJobsController?: any, monitorsController?: any, toolExecutionMode?: "sequential"|"safe-parallel", subagents?: any, subagentContext?: any, ctx?: any}} [options]
|
|
38
|
+
* @param {{disallowedTools?: any[], skillNames?: any[], skills?: any[], skillsRoot?: any, dataDir?: any, cwd?: any, onEvent?: (event: any) => void, toolLimits?: any, persistArtifact?: any, onTruncate?: any, toolPayloadMaxBytes?: number, imageInlineMaxBytes?: any, toolPolicy?: any, sandboxPolicy?: any, sandboxEngine?: any, approvalManager?: any, approvalModel?: any, nodeReplController?: any, webController?: any, processJobsController?: any, processJobsAvailability?: any, monitorsController?: any, toolExecutionMode?: "sequential"|"safe-parallel", subagents?: any, subagentContext?: any, ctx?: any}} [options]
|
|
39
39
|
*/
|
|
40
|
-
export function getPiBuiltinTools(allowedTools: any, { disallowedTools, skillNames, skills, skillsRoot, dataDir, cwd, onEvent, toolLimits, persistArtifact, onTruncate, toolPayloadMaxBytes, imageInlineMaxBytes, toolPolicy, sandboxPolicy, sandboxEngine, approvalManager, approvalModel, nodeReplController, webController, processJobsController, monitorsController, subagents, subagentContext, toolExecutionMode, ctx, }?: {
|
|
40
|
+
export function getPiBuiltinTools(allowedTools: any, { disallowedTools, skillNames, skills, skillsRoot, dataDir, cwd, onEvent, toolLimits, persistArtifact, onTruncate, toolPayloadMaxBytes, imageInlineMaxBytes, toolPolicy, sandboxPolicy, sandboxEngine, approvalManager, approvalModel, nodeReplController, webController, processJobsController, processJobsAvailability, monitorsController, subagents, subagentContext, toolExecutionMode, ctx, }?: {
|
|
41
41
|
disallowedTools?: any[];
|
|
42
42
|
skillNames?: any[];
|
|
43
43
|
skills?: any[];
|
|
@@ -58,6 +58,7 @@ export function getPiBuiltinTools(allowedTools: any, { disallowedTools, skillNam
|
|
|
58
58
|
nodeReplController?: any;
|
|
59
59
|
webController?: any;
|
|
60
60
|
processJobsController?: any;
|
|
61
|
+
processJobsAvailability?: any;
|
|
61
62
|
monitorsController?: any;
|
|
62
63
|
toolExecutionMode?: "sequential" | "safe-parallel";
|
|
63
64
|
subagents?: any;
|
|
@@ -82,10 +83,11 @@ export function coerceMcpContent(out: any, { textLimit, imageInlineMaxBytes, per
|
|
|
82
83
|
/**
|
|
83
84
|
* @param {any} mcpConfig
|
|
84
85
|
* @param {Set<any>} [reservedNames]
|
|
85
|
-
* @param {{limits?: any, cwd?: any, persistArtifact?: any, qaOutputDir?: any, onTruncate?: any, toolPayloadMaxBytes?: number, sandboxPolicy?: any, sandboxEngine?: any, onToolProgress?: any, ctx?: any, mcpApps?: any, runId?: string}} [options]
|
|
86
|
+
* @param {{limits?: any, mcpCallNoTotalTimeoutTools?: readonly string[], cwd?: any, persistArtifact?: any, qaOutputDir?: any, onTruncate?: any, toolPayloadMaxBytes?: number, sandboxPolicy?: any, sandboxEngine?: any, onToolProgress?: any, ctx?: any, mcpApps?: any, runId?: string}} [options]
|
|
86
87
|
*/
|
|
87
|
-
export function initPiMcpTools(mcpConfig: any, reservedNames?: Set<any>, { limits, cwd, persistArtifact, qaOutputDir, onTruncate, toolPayloadMaxBytes, sandboxPolicy, sandboxEngine, onToolProgress, ctx, mcpApps, runId, }?: {
|
|
88
|
+
export function initPiMcpTools(mcpConfig: any, reservedNames?: Set<any>, { limits, mcpCallNoTotalTimeoutTools, cwd, persistArtifact, qaOutputDir, onTruncate, toolPayloadMaxBytes, sandboxPolicy, sandboxEngine, onToolProgress, ctx, mcpApps, runId, }?: {
|
|
88
89
|
limits?: any;
|
|
90
|
+
mcpCallNoTotalTimeoutTools?: readonly string[];
|
|
89
91
|
cwd?: any;
|
|
90
92
|
persistArtifact?: any;
|
|
91
93
|
qaOutputDir?: any;
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
* description: string,
|
|
10
10
|
* timeoutMs?: number,
|
|
11
11
|
* persistent?: boolean,
|
|
12
|
+
* wakeOn?: "batch"|"exit",
|
|
13
|
+
* dedupe?: "none"|"batch",
|
|
14
|
+
* minWakeIntervalMs?: number,
|
|
12
15
|
* launch: (options?: {timeoutMs?: number, onStdout?: (chunk: Buffer) => void, onStderr?: (chunk: Buffer) => void}) => ReturnType<typeof startPreparedProcess>,
|
|
13
|
-
* }) => Promise<{monitorId: string, state: "starting"|"running", startedAt: string, maxRuntimeMs: number, persistent: boolean}>} start
|
|
16
|
+
* }) => Promise<{monitorId: string, state: "starting"|"running", startedAt: string, maxRuntimeMs: number, persistent: boolean, wakeOn: "batch"|"exit", dedupe: "none"|"batch", minWakeIntervalMs: number}>} start
|
|
14
17
|
* @property {(monitorId: string) => Promise<{monitorId: string, state: string, stopped: boolean}>} stop
|
|
15
18
|
*/
|
|
16
19
|
/**
|
|
@@ -24,17 +27,23 @@
|
|
|
24
27
|
* description: string,
|
|
25
28
|
* timeoutMs?: number,
|
|
26
29
|
* persistent?: boolean,
|
|
30
|
+
* wakeOn?: "batch"|"exit",
|
|
31
|
+
* dedupe?: "none"|"batch",
|
|
32
|
+
* minWakeIntervalMs?: number,
|
|
27
33
|
* startedAt: number,
|
|
28
34
|
* failed: (text: string, code: string, startedAt: number) => any,
|
|
29
35
|
* }} input
|
|
30
36
|
*/
|
|
31
|
-
export function handOffMonitor({ controller, prepared, summary, description, timeoutMs, persistent, startedAt, failed, }: {
|
|
37
|
+
export function handOffMonitor({ controller, prepared, summary, description, timeoutMs, persistent, wakeOn, dedupe, minWakeIntervalMs, startedAt, failed, }: {
|
|
32
38
|
controller: MonitorsController;
|
|
33
39
|
prepared: import("../../sandbox-seam.js").PreparedSandboxCommand;
|
|
34
40
|
summary: string;
|
|
35
41
|
description: string;
|
|
36
42
|
timeoutMs?: number;
|
|
37
43
|
persistent?: boolean;
|
|
44
|
+
wakeOn?: "batch" | "exit";
|
|
45
|
+
dedupe?: "none" | "batch";
|
|
46
|
+
minWakeIntervalMs?: number;
|
|
38
47
|
startedAt: number;
|
|
39
48
|
failed: (text: string, code: string, startedAt: number) => any;
|
|
40
49
|
}): Promise<any>;
|
|
@@ -62,6 +71,9 @@ export type MonitorsController = {
|
|
|
62
71
|
description: string;
|
|
63
72
|
timeoutMs?: number;
|
|
64
73
|
persistent?: boolean;
|
|
74
|
+
wakeOn?: "batch" | "exit";
|
|
75
|
+
dedupe?: "none" | "batch";
|
|
76
|
+
minWakeIntervalMs?: number;
|
|
65
77
|
launch: (options?: {
|
|
66
78
|
timeoutMs?: number;
|
|
67
79
|
onStdout?: (chunk: Buffer) => void;
|
|
@@ -73,6 +85,9 @@ export type MonitorsController = {
|
|
|
73
85
|
startedAt: string;
|
|
74
86
|
maxRuntimeMs: number;
|
|
75
87
|
persistent: boolean;
|
|
88
|
+
wakeOn: "batch" | "exit";
|
|
89
|
+
dedupe: "none" | "batch";
|
|
90
|
+
minWakeIntervalMs: number;
|
|
76
91
|
}>;
|
|
77
92
|
stop: (monitorId: string) => Promise<{
|
|
78
93
|
monitorId: string;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* prepared: import("../../sandbox-seam.js").PreparedSandboxCommand,
|
|
9
9
|
* summary: string,
|
|
10
10
|
* description?: string,
|
|
11
|
+
* wakeOnCompletion?: boolean,
|
|
11
12
|
* timeoutMs?: number,
|
|
12
13
|
* maxOutputChars?: number,
|
|
13
14
|
* launch: (options?: {timeoutMs?: number, signal?: AbortSignal, maxBufferBytes?: number, onStdout?: (chunk: Buffer) => void, onStderr?: (chunk: Buffer) => void}) => ReturnType<typeof startPreparedProcess>,
|
|
@@ -23,18 +24,20 @@
|
|
|
23
24
|
* prepared: import("../../sandbox-seam.js").PreparedSandboxCommand,
|
|
24
25
|
* summary: string,
|
|
25
26
|
* description?: string,
|
|
27
|
+
* wakeOnCompletion?: boolean,
|
|
26
28
|
* timeoutMs?: number,
|
|
27
29
|
* maxOutputChars?: number,
|
|
28
30
|
* startedAt: number,
|
|
29
31
|
* failed: (text: string, code: string, startedAt: number) => any,
|
|
30
32
|
* }} input
|
|
31
33
|
*/
|
|
32
|
-
export function handOffProcessJob({ controller, tool, prepared, summary, description, timeoutMs, maxOutputChars, startedAt, failed, }: {
|
|
34
|
+
export function handOffProcessJob({ controller, tool, prepared, summary, description, wakeOnCompletion, timeoutMs, maxOutputChars, startedAt, failed, }: {
|
|
33
35
|
controller: ProcessJobsController;
|
|
34
36
|
tool: "Exec" | "Bash";
|
|
35
37
|
prepared: import("../../sandbox-seam.js").PreparedSandboxCommand;
|
|
36
38
|
summary: string;
|
|
37
39
|
description?: string;
|
|
40
|
+
wakeOnCompletion?: boolean;
|
|
38
41
|
timeoutMs?: number;
|
|
39
42
|
maxOutputChars?: number;
|
|
40
43
|
startedAt: number;
|
|
@@ -50,6 +53,7 @@ export type ProcessJobsController = {
|
|
|
50
53
|
prepared: import("../../sandbox-seam.js").PreparedSandboxCommand;
|
|
51
54
|
summary: string;
|
|
52
55
|
description?: string;
|
|
56
|
+
wakeOnCompletion?: boolean;
|
|
53
57
|
timeoutMs?: number;
|
|
54
58
|
maxOutputChars?: number;
|
|
55
59
|
launch: (options?: {
|
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
* or exceeds that cap.
|
|
7
7
|
*
|
|
8
8
|
* @param {{command: string, args?: string[], cwd?: string, env?: Record<string, string|undefined>}} commandSpec
|
|
9
|
-
* @param {{timeoutMs?: number, signal?: AbortSignal, maxBufferBytes?: number, input?: string|Buffer}} [options]
|
|
9
|
+
* @param {{timeoutMs?: number, signal?: AbortSignal, maxBufferBytes?: number, input?: string|Buffer, exactEnvironment?: boolean}} [options]
|
|
10
10
|
*/
|
|
11
11
|
export function runPreparedProcess(commandSpec: {
|
|
12
12
|
command: string;
|
|
13
13
|
args?: string[];
|
|
14
14
|
cwd?: string;
|
|
15
15
|
env?: Record<string, string | undefined>;
|
|
16
|
-
}, { timeoutMs, signal, maxBufferBytes, input, }?: {
|
|
16
|
+
}, { timeoutMs, signal, maxBufferBytes, input, exactEnvironment, }?: {
|
|
17
17
|
timeoutMs?: number;
|
|
18
18
|
signal?: AbortSignal;
|
|
19
19
|
maxBufferBytes?: number;
|
|
20
20
|
input?: string | Buffer;
|
|
21
|
+
exactEnvironment?: boolean;
|
|
21
22
|
}): Promise<any>;
|
|
22
23
|
/**
|
|
23
24
|
* Start one already-prepared executable and expose its process-group handle.
|
|
@@ -47,6 +47,8 @@ export type RuntimeSandbox = import("../../sandbox-seam.js").RuntimeSandbox;
|
|
|
47
47
|
export type ToolContext = {
|
|
48
48
|
workspace?: string;
|
|
49
49
|
repoRoot?: string;
|
|
50
|
+
additionalReadRoots?: ReadonlyArray<string>;
|
|
51
|
+
additionalWriteRoots?: ReadonlyArray<string>;
|
|
50
52
|
runId?: string;
|
|
51
53
|
toolArtifactDir?: string;
|
|
52
54
|
ripgrepPath?: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify access and authentication interstitials without treating incidental
|
|
3
|
+
* words such as "captcha" or "access denied" as conclusive evidence.
|
|
4
|
+
*
|
|
5
|
+
* @param {{url?: string, text?: string, statusCode?: number}} input
|
|
6
|
+
* @returns {{code: "access_challenge"|"authentication_required", message: string}|undefined}
|
|
7
|
+
*/
|
|
8
|
+
export function classifyWebAccessInterstitial({ url, text, statusCode }?: {
|
|
9
|
+
url?: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
statusCode?: number;
|
|
12
|
+
}): {
|
|
13
|
+
code: "access_challenge" | "authentication_required";
|
|
14
|
+
message: string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* @param {{url?: string, text?: string, statusCode?: number}} input
|
|
18
|
+
*/
|
|
19
|
+
export function assertNoWebAccessInterstitial(input: {
|
|
20
|
+
url?: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
statusCode?: number;
|
|
23
|
+
}): void;
|
|
@@ -12,5 +12,8 @@ export function renderWithAgentBrowser(url: string, { browserCommand, namespace,
|
|
|
12
12
|
ctx?: any;
|
|
13
13
|
signal?: AbortSignal;
|
|
14
14
|
registerCleanup?: (cleanup: () => Promise<void>) => () => void;
|
|
15
|
-
}): Promise<
|
|
15
|
+
}): Promise<{
|
|
16
|
+
text: any;
|
|
17
|
+
finalUrl: string;
|
|
18
|
+
}>;
|
|
16
19
|
export function extractBrowserText(output: any): any;
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* cleanup. Search results are the exception: they live in the process-wide
|
|
5
5
|
* cache above so sibling subagents and later turns can reuse them.
|
|
6
6
|
*
|
|
7
|
-
* @param {{searchConfig?: any, fetchConfig?: any, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, fetchImpl?: typeof fetch, browserRenderer?: any, codexSearch?: any}} [options]
|
|
7
|
+
* @param {{coordinator?: any, searchConfig?: any, searchState?: any, fetchConfig?: any, sandboxPolicy?: any, sandboxEngine?: any, ctx?: any, fetchImpl?: typeof fetch, browserRenderer?: any, codexSearch?: any}} [options]
|
|
8
8
|
*/
|
|
9
|
-
export function createWebToolController({ searchConfig, fetchConfig, sandboxPolicy, sandboxEngine, ctx, fetchImpl, browserRenderer, codexSearch, }?: {
|
|
9
|
+
export function createWebToolController({ coordinator, searchConfig, searchState: suppliedSearchState, fetchConfig, sandboxPolicy, sandboxEngine, ctx, fetchImpl, browserRenderer, codexSearch, }?: {
|
|
10
|
+
coordinator?: any;
|
|
10
11
|
searchConfig?: any;
|
|
12
|
+
searchState?: any;
|
|
11
13
|
fetchConfig?: any;
|
|
12
14
|
sandboxPolicy?: any;
|
|
13
15
|
sandboxEngine?: any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function contentKind(contentType: any, bytes: any): "binary" | "text" | "markdown" | "pdf" | "json" | "xml" | "html";
|
|
2
|
+
export function decodeWebBytes(bytes: any, contentType: any, kind?: string): {
|
|
3
|
+
text: string;
|
|
4
|
+
charset: string;
|
|
5
|
+
charsetSource: string;
|
|
6
|
+
hadDecodingReplacement: boolean;
|
|
7
|
+
};
|
|
8
|
+
export function extractWebDocument(bytes: any, { contentType, format, url }: {
|
|
9
|
+
contentType: any;
|
|
10
|
+
format: any;
|
|
11
|
+
url: any;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
text: string;
|
|
14
|
+
charset: string;
|
|
15
|
+
charsetSource: string;
|
|
16
|
+
hadDecodingReplacement: boolean;
|
|
17
|
+
kind: string;
|
|
18
|
+
body: any;
|
|
19
|
+
readableText: string;
|
|
20
|
+
title: any;
|
|
21
|
+
extractionStage: any;
|
|
22
|
+
parserFailureCount: any;
|
|
23
|
+
parserFailures: any;
|
|
24
|
+
}>;
|
|
25
|
+
export function shouldAutoRender(readableText: any, html: any): boolean;
|
|
26
|
+
export function markdownToText(value: any): string;
|
|
27
|
+
export const MAX_STRUCTURED_DOCUMENT_BYTES: number;
|