/** * H — Harness namespace. The TypeScript port of `python/src/adk_fluent/_harness/_namespace.py`. * * `H` is a purely static namespace. Every method returns a composable * building block. Combine them to construct your harness: * * ```typescript * import { Agent, H } from "adk-fluent-ts"; * * const harness = new Agent("coder", "gemini-2.5-pro") * .tools([ * ...H.workspace("/project"), * ...H.web(), * ...H.processes("/project"), * ]); * * const config = H.config({ * permissions: H.autoAllow("read_file").merge(H.askBefore("bash")), * sandbox: H.workspaceOnly("/project"), * usage: H.usage(), * memory: H.memory("/project/.agent-memory.md"), * onError: H.onError({ retry: ["bash"], skip: ["glob"] }), * }); * ``` * * Naming: Python uses snake_case (`auto_allow`, `workspace_only`, * `tool_policy`); TypeScript uses camelCase (`autoAllow`, * `workspaceOnly`, `toolPolicy`). The semantics are identical. * * Stubbed-out features (not yet ported): * - `H.notebook(...)` — Jupyter notebook tools (requires .ipynb parser) * - `H.mcp(...)` / `H.mcpFromConfig(...)` — MCP toolset loaders * (waiting for `@google/adk` to ship its MCP wiring) * - `H.manifold(...)` — capability discovery (requires SkillRegistry port) * * Calling these stubs throws a clear "not yet ported" error. */ import { TodoStore, WorktreeManager, type AskUserHandler } from "./agent-tools.js"; import { PlanMode, PlanModePolicy } from "./plan-mode.js"; import { SessionStore, SessionSnapshot } from "./session-store.js"; import { CostTable, type ModelRate } from "./usage.js"; import { BudgetPolicy, type BudgetThreshold } from "./lifecycle.js"; import { ArtifactStore } from "./artifacts.js"; import { CodeExecutor, type CodeExecutorOptions } from "./code-executor.js"; import { type CodingAgentBundle, type CodingAgentOptions } from "./coding-agent.js"; import { HarnessConfig, type HarnessConfigOptions } from "./config.js"; import { ErrorStrategy, type ErrorStrategyOptions } from "./error-strategy.js"; import { EventBus, EventDispatcher, SessionTape, type EventBusOptions, type SessionTapeOptions } from "./events.js"; import { GitCheckpointer } from "./git.js"; import { BudgetMonitor, CancellationToken, ContextCompressor, ForkManager, type ContextCompressorOptions, type ForkManagerOptions } from "./lifecycle.js"; import { MemoryHierarchy, ProjectMemory, type ProjectMemoryOptions } from "./memory.js"; import { ApprovalMemory, PermissionPolicy } from "./permissions.js"; import type { PermissionMode } from "./permissions.js"; import { CommandRegistry, HookDecision, HookMatcher, HookRegistry, SystemMessageChannel, TaskLedger, ToolPolicy, type HookMatcherOptions } from "./registries.js"; import { SubagentRegistry, SubagentSpec, type MakeTaskToolOptions, type SubagentRunner, type SubagentSpecOptions, type TaskTool } from "./subagents.js"; import { LocalBackend, MemoryBackend, SandboxedBackend, type FsBackend } from "./fs.js"; import { JsonRenderer, PlainRenderer, type RendererOptions } from "./renderer.js"; import { HarnessRepl, type ReplConfig } from "./repl.js"; import { SandboxPolicy, type SandboxPolicyOptions } from "./sandbox.js"; import { StreamingBash } from "./streaming.js"; import { UsageTracker, type UsageTrackerOptions } from "./usage.js"; import { type WebOptions } from "./web.js"; import { type WorkspaceOptions } from "./workspace.js"; import type { HarnessTool } from "./types.js"; /** * Harness namespace — building blocks for AI coding harnesses. * * Every method is static; instantiating `H` is not supported. */ export declare class H { private constructor(); static workspace(path: string, opts?: WorkspaceOptions): HarnessTool[]; static askBefore(...toolNames: string[]): PermissionPolicy; static autoAllow(...toolNames: string[]): PermissionPolicy; static deny(...toolNames: string[]): PermissionPolicy; static allowPatterns(patterns: string[], mode?: "glob" | "regex"): PermissionPolicy; static denyPatterns(patterns: string[], mode?: "glob" | "regex"): PermissionPolicy; static approvalMemory(): ApprovalMemory; static workspaceOnly(path?: string): SandboxPolicy; static sandbox(opts?: SandboxPolicyOptions): SandboxPolicy; static web(opts?: WebOptions): HarnessTool[]; static memory(path: string, opts?: ProjectMemoryOptions): ProjectMemory; static memoryHierarchy(paths: string[], stateKey?: string): MemoryHierarchy; static usage(opts?: UsageTrackerOptions): UsageTracker; static processes(path?: string, opts?: { allowShell?: boolean; }): HarnessTool[]; /** * Build a `StreamingBash` executor for real-time command output. * * Use this when you want to consume stdout/stderr as it arrives instead * of waiting for the command to finish — long-running builds, dev * servers, or test runs where progressive feedback matters. * * ```ts * const streamer = H.streamingBash(H.workspaceOnly("/project")); * for await (const chunk of streamer.run("npm test")) { * process.stdout.write(chunk); * } * ``` */ static streamingBash(sandbox: SandboxPolicy): StreamingBash; static onError(opts?: ErrorStrategyOptions): ErrorStrategy; static cancellationToken(): CancellationToken; static forks(opts?: ForkManagerOptions): ForkManager; static renderer(format?: "plain" | "rich" | "json", opts?: RendererOptions): PlainRenderer | JsonRenderer; static git(workspace: string): GitCheckpointer; static gitTools(workspace: string, opts?: { allowShell?: boolean; }): HarnessTool[]; static hooks(workspace?: string): HookRegistry; static artifacts(path: string, opts?: { maxInlineBytes?: number; }): ArtifactStore; static dispatcher(): EventDispatcher; static eventBus(opts?: EventBusOptions): EventBus; static tape(opts?: SessionTapeOptions): SessionTape; static compressor(opts?: ContextCompressorOptions): ContextCompressor; static autoCompress(threshold?: number): number; static tasks(opts?: { maxTasks?: number; }): HarnessTool[]; static taskLedger(opts?: { maxTasks?: number; }): TaskLedger; static commands(opts?: { prefix?: string; }): CommandRegistry; static toolPolicy(opts?: { default?: "retry" | "skip" | "ask" | "propagate"; }): ToolPolicy; static budgetMonitor(maxTokens?: number): BudgetMonitor; static repl(agent: { ask?: (text: string) => Promise; }, opts?: { dispatcher?: EventDispatcher; hooks?: HookRegistry; compressor?: ContextCompressor; config?: ReplConfig; }): HarnessRepl; static config(opts?: HarnessConfigOptions): HarnessConfig; /** * Build a polyglot `CodeExecutor` rooted at `workspace`. The returned * executor exposes `.tools()` (LLM-callable `run_code` + `which_languages`) * and `.run(language, source)` (programmatic). */ static codeExecutor(workspace: string, opts?: CodeExecutorOptions): CodeExecutor; /** Shorthand: `H.codeExecutor(...).tools()`. */ static runCodeTools(workspace: string, opts?: CodeExecutorOptions): HarnessTool[]; static todos(): TodoStore; static planMode(): PlanMode; /** * Wrap a base `PermissionPolicy` in a `PlanModePolicy` that flips to * `PermissionMode.PLAN` while `latch.isPlanning`. If no latch is * supplied, a fresh one is created. */ static planModePolicy(base: PermissionPolicy, latch?: PlanMode): PlanModePolicy; static sessionStore(): SessionStore; static sessionSnapshot(path: string): SessionSnapshot; static costTable(rates?: Iterable<[string, ModelRate]>, fallback?: ModelRate): CostTable; static flatCostTable(inputPerMillion: number, outputPerMillion: number): CostTable; static budgetPolicy(maxTokens?: number, thresholds?: readonly BudgetThreshold[]): BudgetPolicy; static permissionMode(mode: PermissionMode): PermissionPolicy; static askUser(handler?: AskUserHandler): HarnessTool; static worktrees(workspace: string): WorktreeManager; /** * Build a fully-wired coding agent harness in one call. * * Returns a `CodingAgentBundle` with `tools` ready to plug into * `Agent.tools(...)` plus every primitive (sandbox, permissions, bus, * memory, executor, todos, …) exposed for inspection / overrides. */ static codingAgent(workspace: string, opts?: CodingAgentOptions): CodingAgentBundle; /** Build a pass-through `HookDecision`. Shorthand for `HookDecision.allow()`. */ static hookAllow(): HookDecision; /** Build a denial decision. */ static hookDeny(reason?: string): HookDecision; /** Build a `modify` decision rewriting tool arguments. */ static hookModify(toolInput: Record): HookDecision; /** Build a `replace` decision short-circuiting the wrapped call. */ static hookReplace(output: unknown): HookDecision; /** Build an `ask` decision that raises a permission request. */ static hookAsk(prompt: string): HookDecision; /** Build an `inject` decision adding a transient system message. */ static hookInject(systemMessage: string): HookDecision; /** Build a matcher for a specific event (no additional filters). */ static hookMatch(options: HookMatcherOptions): HookMatcher; /** Shorthand: match a specific tool by name with optional arg globs. */ static hookForTool(event: string, toolName: string, args?: Record): HookMatcher; /** Build a system-message channel backed by `state`. */ static systemMessages(state: Record | undefined): SystemMessageChannel; /** Construct a single `SubagentSpec`. */ static subagentSpec(options: SubagentSpecOptions): SubagentSpec; /** Build an ordered registry of specs, keyed by role. */ static subagentRegistry(specs?: Iterable): SubagentRegistry; /** * Build a `task(role, prompt) => string` callable backed by a * registry + runner. The returned function carries a docstring * enumerating every registered role. */ static taskTool(registry: SubagentRegistry, runner: SubagentRunner, options?: MakeTaskToolOptions): TaskTool; /** Real on-disk filesystem backend. `root` scopes relative paths. */ static fsLocal(opts?: { root?: string; }): LocalBackend; /** In-memory filesystem backend (for tests + ephemeral scratch). */ static fsMemory(): MemoryBackend; /** * Wrap any `FsBackend` with a `SandboxPolicy` that refuses operations * escaping the allowed paths. */ static fsSandboxed(inner: FsBackend, sandbox: SandboxPolicy): SandboxedBackend; static notebook(_path?: string): never; static mcp(_servers: unknown[]): never; static mcpFromConfig(_path: string): never; static manifold(_opts: unknown): never; } //# sourceMappingURL=H.d.ts.map