@njeybe/nativ 2.4.1 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +26 -0
- package/dist/commands/db/db-formatter.d.ts +5 -0
- package/dist/commands/db/db-formatter.js +116 -0
- package/dist/commands/db/db-introspect.d.ts +11 -0
- package/dist/commands/db/db-introspect.js +84 -0
- package/dist/commands/db.js +4 -206
- package/dist/commands/profile.d.ts +3 -0
- package/dist/commands/profile.js +39 -0
- package/dist/commands/task/task-add.d.ts +11 -0
- package/dist/commands/task/task-add.js +169 -0
- package/dist/commands/task/task-common.d.ts +57 -0
- package/dist/commands/task/task-common.js +45 -0
- package/dist/commands/task/task-escalate.d.ts +7 -0
- package/dist/commands/task/task-escalate.js +119 -0
- package/dist/commands/task/task-lifecycle.d.ts +5 -0
- package/dist/commands/task/task-lifecycle.js +252 -0
- package/dist/commands/task/task-query.d.ts +10 -0
- package/dist/commands/task/task-query.js +269 -0
- package/dist/commands/task.d.ts +9 -87
- package/dist/commands/task.js +8 -850
- package/dist/commands/triage/triage-store.d.ts +56 -0
- package/dist/commands/triage/triage-store.js +108 -0
- package/dist/commands/triage/triage-ui.d.ts +14 -0
- package/dist/commands/triage/triage-ui.js +104 -0
- package/dist/commands/triage.d.ts +3 -52
- package/dist/commands/triage.js +8 -216
- package/dist/core/enforcement.d.ts +1 -0
- package/dist/core/enforcement.js +19 -0
- package/dist/core/human-gate.d.ts +2 -1
- package/dist/core/human-gate.js +9 -2
- package/dist/core/profiles.d.ts +14 -0
- package/dist/core/profiles.js +82 -0
- package/dist/core/setup/config-merger.d.ts +59 -0
- package/dist/core/setup/config-merger.js +107 -0
- package/dist/core/setup/session-context.d.ts +4 -0
- package/dist/core/setup/session-context.js +65 -0
- package/dist/core/setup/setup-planner.d.ts +14 -0
- package/dist/core/setup/setup-planner.js +180 -0
- package/dist/core/setup/template-planner.d.ts +8 -0
- package/dist/core/setup/template-planner.js +32 -0
- package/dist/core/setup/types.d.ts +65 -0
- package/dist/core/setup/types.js +55 -0
- package/dist/core/setup-assets.d.ts +8 -119
- package/dist/core/setup-assets.js +7 -437
- package/dist/core/tier1-liaison.d.ts +2 -0
- package/dist/core/tier1-liaison.js +64 -3
- package/dist/core/verifier/executor.d.ts +5 -0
- package/dist/core/verifier/executor.js +62 -0
- package/dist/core/verifier/phases.d.ts +5 -0
- package/dist/core/verifier/phases.js +71 -0
- package/dist/core/verifier/task-verifier.d.ts +37 -0
- package/dist/core/verifier/task-verifier.js +233 -0
- package/dist/core/verifier/types.d.ts +51 -0
- package/dist/core/verifier/types.js +1 -0
- package/dist/core/verifier.d.ts +5 -93
- package/dist/core/verifier.js +5 -359
- package/dist/db/introspector.js +59 -59
- package/dist/governor/evaluator.d.ts +4 -64
- package/dist/governor/evaluator.js +21 -686
- package/dist/governor/patch-applier.d.ts +8 -0
- package/dist/governor/patch-applier.js +121 -0
- package/dist/governor/self-healing.d.ts +24 -0
- package/dist/governor/self-healing.js +351 -0
- package/dist/governor/test-integrity.d.ts +41 -0
- package/dist/governor/test-integrity.js +237 -0
- package/dist/index.js +8 -0
- package/dist/mcp/capture.d.ts +4 -0
- package/dist/mcp/capture.js +33 -0
- package/dist/mcp/resources.d.ts +39 -0
- package/dist/mcp/resources.js +44 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.js +14 -89
- package/dist/mcp/tools.d.ts +1 -0
- package/dist/mcp/tools.js +1 -0
- package/dist/runner/agent-supervisor.d.ts +8 -302
- package/dist/runner/agent-supervisor.js +41 -1030
- package/dist/runner/cli-config.d.ts +84 -0
- package/dist/runner/cli-config.js +215 -0
- package/dist/runner/native-driver.d.ts +18 -0
- package/dist/runner/native-driver.js +208 -0
- package/dist/runner/native-engine.d.ts +27 -0
- package/dist/runner/native-engine.js +184 -0
- package/dist/runner/native-tools.d.ts +31 -0
- package/dist/runner/native-tools.js +241 -0
- package/dist/runner/process-utils.d.ts +12 -0
- package/dist/runner/process-utils.js +96 -0
- package/dist/runner/run-lifecycle.d.ts +6 -0
- package/dist/runner/run-lifecycle.js +42 -0
- package/dist/runner/types.d.ts +215 -0
- package/dist/runner/types.js +41 -0
- package/dist/scanner/detector.js +42 -663
- package/dist/scanner/detectors/ecosystem-detector.d.ts +16 -0
- package/dist/scanner/detectors/ecosystem-detector.js +354 -0
- package/dist/scanner/detectors/orm-detector.d.ts +5 -0
- package/dist/scanner/detectors/orm-detector.js +59 -0
- package/dist/scanner/detectors/workspace-detector.d.ts +19 -0
- package/dist/scanner/detectors/workspace-detector.js +266 -0
- package/dist/server/cli-runner.d.ts +15 -0
- package/dist/server/cli-runner.js +43 -0
- package/dist/server/event-hub.d.ts +42 -0
- package/dist/server/event-hub.js +169 -0
- package/dist/server/http-utils.d.ts +15 -0
- package/dist/server/http-utils.js +56 -0
- package/dist/server/plan-utils.d.ts +9 -0
- package/dist/server/plan-utils.js +31 -0
- package/dist/server/routes/db-routes.d.ts +57 -0
- package/dist/server/routes/db-routes.js +484 -0
- package/dist/server/routes/task-routes.d.ts +266 -0
- package/dist/server/routes/task-routes.js +285 -0
- package/dist/server/routes/telemetry-routes.d.ts +128 -0
- package/dist/server/routes/telemetry-routes.js +179 -0
- package/dist/server/routes/triage-routes.d.ts +81 -0
- package/dist/server/routes/triage-routes.js +244 -0
- package/dist/server/routes/worktree-routes.d.ts +31 -0
- package/dist/server/routes/worktree-routes.js +144 -0
- package/dist/server/studio-server.d.ts +4 -11
- package/dist/server/studio-server.js +34 -1578
- package/dist/server/studio-ui/shell/pipeline-state.js +2 -0
- package/dist/server/studio-ui/shell/triage.js +10 -0
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/agents/architect.md +4 -2
- package/plugin/agents/verifier.md +1 -1
- package/plugin/agents/worker.md +7 -4
- package/plugin/skills/nativ/SKILL.md +1 -0
- package/templates/.claudeignore +62 -45
- package/templates/AGENTS.md +1 -0
- package/templates/CLAUDE.md +13 -0
- package/templates/claude-agents/architect.md +4 -2
- package/templates/claude-agents/verifier.md +1 -1
- package/templates/claude-agents/worker.md +7 -4
- package/templates/dot-ai/api_contracts.json +66 -66
- package/templates/dot-ai/context.md +38 -38
- package/templates/dot-ai/db_schema.json +39 -39
- package/templates/dot-ai/subagents/architect.md +54 -0
- package/dist/commands/session.d.ts +0 -22
- package/dist/commands/session.js +0 -106
- package/dist/core/session-memory.d.ts +0 -42
- package/dist/core/session-memory.js +0 -121
|
@@ -1,296 +1,12 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export declare const ACTIVE_RUNNER_STATUSES: readonly RunnerStatus[];
|
|
11
|
-
export declare function isActiveStatus(status: RunnerStatus): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* `native` drives the Messages API in-process with local bash/editor tools;
|
|
14
|
-
* `cli` spawns a runner command (Claude Code by default).
|
|
15
|
-
*/
|
|
16
|
-
export type RunnerEngine = 'native' | 'cli';
|
|
17
|
-
export type ThinkingEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
18
|
-
export interface RunnerThinking {
|
|
19
|
-
/** The dispatch's `thinkingBudget`, echoed back; null when unset. */
|
|
20
|
-
budget: number | null;
|
|
21
|
-
/** `output_config.effort` sent to adaptive-thinking models; null otherwise. */
|
|
22
|
-
effort: ThinkingEffort | null;
|
|
23
|
-
/** Literal `budget_tokens` (legacy models) or `MAX_THINKING_TOKENS` (cli); null otherwise. */
|
|
24
|
-
budgetTokens: number | null;
|
|
25
|
-
}
|
|
26
|
-
/** Payload of the `runner_token_usage` channel, emitted after every native turn. */
|
|
27
|
-
export interface RunnerTokenUsageEvent {
|
|
28
|
-
runId: string;
|
|
29
|
-
taskId: string;
|
|
30
|
-
/** Model that served this turn (differs from the requested one after a refusal fallback). */
|
|
31
|
-
model: string;
|
|
32
|
-
turn: number;
|
|
33
|
-
delta: ActualTokenUsage;
|
|
34
|
-
total: ActualTokenUsage & {
|
|
35
|
-
cacheHitRate: number;
|
|
36
|
-
};
|
|
37
|
-
at: string;
|
|
38
|
-
}
|
|
39
|
-
/** Persisted, serializable state of a single agent execution. */
|
|
40
|
-
export interface RunnerRecord {
|
|
41
|
-
runId: string;
|
|
42
|
-
taskId: string;
|
|
43
|
-
status: RunnerStatus;
|
|
44
|
-
engine: RunnerEngine;
|
|
45
|
-
/** Requested model; null for cli runs that keep the runner's own default. */
|
|
46
|
-
model: string | null;
|
|
47
|
-
thinking: RunnerThinking | null;
|
|
48
|
-
/** API-reported usage accumulated across turns; null for cli runs. */
|
|
49
|
-
usage: ActualTokenUsage | null;
|
|
50
|
-
/** PID of the spawned process-group leader; null before spawn and after exit. */
|
|
51
|
-
pid: number | null;
|
|
52
|
-
/** Branch backing the isolated worktree, or null when running in place. */
|
|
53
|
-
branch: string | null;
|
|
54
|
-
/** Absolute worktree path, or the project root when `useWorktree` is false. */
|
|
55
|
-
worktreeDir: string;
|
|
56
|
-
command: string;
|
|
57
|
-
startedAt: string;
|
|
58
|
-
endedAt: string | null;
|
|
59
|
-
durationMs: number | null;
|
|
60
|
-
exitCode: number | null;
|
|
61
|
-
signal: string | null;
|
|
62
|
-
timeoutSeconds: number;
|
|
63
|
-
timedOut: boolean;
|
|
64
|
-
logBytes: number;
|
|
65
|
-
logFile: string;
|
|
66
|
-
error: string | null;
|
|
67
|
-
abortReason: string | null;
|
|
68
|
-
verification: {
|
|
69
|
-
command: string;
|
|
70
|
-
success: boolean;
|
|
71
|
-
exitCode: number;
|
|
72
|
-
durationMs: number;
|
|
73
|
-
skipped: boolean;
|
|
74
|
-
/** Why it failed: a named phase, an unreadable config, or the code-shape block. */
|
|
75
|
-
error?: string;
|
|
76
|
-
phases?: Array<{
|
|
77
|
-
name: string;
|
|
78
|
-
success: boolean;
|
|
79
|
-
durationMs: number;
|
|
80
|
-
}>;
|
|
81
|
-
} | null;
|
|
82
|
-
}
|
|
83
|
-
export interface DispatchOptions {
|
|
84
|
-
taskId: string;
|
|
85
|
-
/** Defaults to the supervisor's `defaultEngine` (`cli` unless configured). */
|
|
86
|
-
runnerEngine?: RunnerEngine;
|
|
87
|
-
/** Shell command that launches the agent (cli engine only). Defaults to `defaultRunnerCommand`. */
|
|
88
|
-
runnerCommand?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Reasoning budget in tokens. Adaptive-thinking models receive it as an
|
|
91
|
-
* `effort` level (they reject `budget_tokens`); legacy models receive it
|
|
92
|
-
* literally; the Claude Code CLI receives it as `MAX_THINKING_TOKENS`.
|
|
93
|
-
*/
|
|
94
|
-
thinkingBudget?: number;
|
|
95
|
-
/** Model ID. Native runs default to `defaultNativeModel`; cli runs pass it as `--model`. */
|
|
96
|
-
model?: string;
|
|
97
|
-
/** Killswitch budget in seconds. Defaults to the supervisor's `defaultTimeoutSeconds`. */
|
|
98
|
-
timeoutSeconds?: number;
|
|
99
|
-
/** Run inside `.worktrees/task-<id>` on branch `agent/task-<id>`. Default true. */
|
|
100
|
-
useWorktree?: boolean;
|
|
101
|
-
/** Run the task's `verificationCommand` after a clean exit. Default false. */
|
|
102
|
-
verify?: boolean;
|
|
103
|
-
/** Merge the agent branch back after a passing verification. Default false. */
|
|
104
|
-
autoMerge?: boolean;
|
|
105
|
-
/** Extra environment variables handed to the child (never logged or persisted). */
|
|
106
|
-
env?: Record<string, string>;
|
|
107
|
-
/** Extra permission rules for the default cli runner, e.g. `Bash(pnpm test *)`. Added to the per-task allowlist. */
|
|
108
|
-
allowedTools?: string[];
|
|
109
|
-
}
|
|
110
|
-
export interface AbortResult {
|
|
111
|
-
taskId: string;
|
|
112
|
-
runId: string;
|
|
113
|
-
status: 'aborted';
|
|
114
|
-
message: string;
|
|
115
|
-
}
|
|
116
|
-
export interface LogSlice {
|
|
117
|
-
taskId: string;
|
|
118
|
-
runId: string | null;
|
|
119
|
-
status: RunnerStatus | null;
|
|
120
|
-
totalBytes: number;
|
|
121
|
-
log: string;
|
|
122
|
-
truncated: boolean;
|
|
123
|
-
}
|
|
124
|
-
export interface ListRunsQuery {
|
|
125
|
-
taskId?: string;
|
|
126
|
-
activeOnly?: boolean;
|
|
127
|
-
}
|
|
128
|
-
export interface AgentSupervisorOptions {
|
|
129
|
-
/** Directory used to resolve the project root holding `.ai/`. Defaults to `process.cwd()`. */
|
|
130
|
-
cwd?: string;
|
|
131
|
-
defaultRunnerCommand?: string;
|
|
132
|
-
defaultTimeoutSeconds?: number;
|
|
133
|
-
/** Hard cap on the in-memory log ring buffer per run. */
|
|
134
|
-
maxLogBufferBytes?: number;
|
|
135
|
-
/** Grace period between SIGTERM and the forced kill during abort/timeout. */
|
|
136
|
-
killGraceMs?: number;
|
|
137
|
-
/**
|
|
138
|
-
* Inactivity watchdog: terminate a run that emits no output for this many seconds. Defaults to
|
|
139
|
-
* `NATIV_RUNNER_IDLE_TIMEOUT`, then `DEFAULT_IDLE_TIMEOUT_SECONDS`; 0 disables it.
|
|
140
|
-
*/
|
|
141
|
-
idleTimeoutSeconds?: number;
|
|
142
|
-
/** How many finished runs to keep in memory. */
|
|
143
|
-
maxHistory?: number;
|
|
144
|
-
/** Engine used when a dispatch omits `runnerEngine`. Defaults to `NATIV_RUNNER_ENGINE`, then `cli`. */
|
|
145
|
-
defaultEngine?: RunnerEngine;
|
|
146
|
-
/** Model used by native runs that omit `model`. Defaults to `NATIV_NATIVE_MODEL`, then `DEFAULT_NATIVE_MODEL`. */
|
|
147
|
-
defaultNativeModel?: string;
|
|
148
|
-
/** Hard cap on API round-trips per native run. */
|
|
149
|
-
nativeMaxTurns?: number;
|
|
150
|
-
/** Per-command budget for the native bash tool. */
|
|
151
|
-
nativeToolTimeoutMs?: number;
|
|
152
|
-
/** Executables the native bash tool may invoke. */
|
|
153
|
-
nativeAllowedCommands?: readonly string[];
|
|
154
|
-
/** Builds the Claude API client for native runs; injectable for tests. */
|
|
155
|
-
anthropicClientFactory?: () => Anthropic;
|
|
156
|
-
/**
|
|
157
|
-
* Shell for the native bash tool: a path to bash, or `true` for the platform default shell.
|
|
158
|
-
* Defaults to NATIV_BASH_PATH, then Git Bash on Windows, then /bin/bash.
|
|
159
|
-
*/
|
|
160
|
-
nativeShell?: string | boolean;
|
|
161
|
-
}
|
|
162
|
-
/** Structured failure carrying the `{ code, message }` shape used by the pipeline API. */
|
|
163
|
-
export declare class SupervisorError extends Error {
|
|
164
|
-
readonly code: string;
|
|
165
|
-
readonly status: number;
|
|
166
|
-
constructor(code: string, message: string, status?: number);
|
|
167
|
-
}
|
|
168
|
-
export declare const DEFAULT_RUNNER_COMMAND = "claude";
|
|
169
|
-
/** Hard cap per run. Real agent tasks routinely take tens of minutes; hung runs are caught by the idle watchdog. */
|
|
170
|
-
export declare const DEFAULT_TIMEOUT_SECONDS = 3600;
|
|
171
|
-
/** A run that produces no output (log lines, tool activity, API turns) for this long is treated as hung. */
|
|
172
|
-
export declare const DEFAULT_IDLE_TIMEOUT_SECONDS = 900;
|
|
173
|
-
export declare const DEFAULT_MAX_LOG_BUFFER_BYTES: number;
|
|
174
|
-
export declare const DEFAULT_KILL_GRACE_MS = 5000;
|
|
175
|
-
export declare const DEFAULT_MAX_HISTORY = 50;
|
|
176
|
-
export declare const DEFAULT_RUNNER_ENGINE: RunnerEngine;
|
|
177
|
-
export declare const DEFAULT_NATIVE_MODEL = "claude-opus-5-5";
|
|
178
|
-
export declare const DEFAULT_NATIVE_EFFORT: ThinkingEffort;
|
|
179
|
-
export declare const DEFAULT_NATIVE_MAX_TURNS = 150;
|
|
180
|
-
export declare const DEFAULT_NATIVE_TOOL_TIMEOUT_MS: number;
|
|
181
|
-
export declare const NATIVE_MAX_OUTPUT_TOKENS = 64000;
|
|
182
|
-
/** Characters of tool output handed back to the model per call. */
|
|
183
|
-
export declare const NATIVE_TOOL_OUTPUT_LIMIT = 30000;
|
|
184
|
-
export declare const DEFAULT_NATIVE_ALLOWED_COMMANDS: readonly string[];
|
|
185
|
-
/** Extracts the executable binary or command name, handling quoted Windows paths. */
|
|
186
|
-
export declare function extractBinary(cmd: string): string;
|
|
187
|
-
/** Pre-flight check verifying whether a command binary exists in PATH or on the filesystem. */
|
|
188
|
-
export declare function isExecutableInPath(cmd: string): boolean;
|
|
189
|
-
/** The pieces of a compound command as Claude Code matches them: each must satisfy an allow rule on its own. */
|
|
190
|
-
export declare function splitCompoundCommand(command: string): string[];
|
|
191
|
-
/** Operator-supplied extra rules from NATIV_RUNNER_ALLOW, comma separated, e.g. `Bash(pnpm test *),Bash(cargo test *)`. */
|
|
192
|
-
export declare function parseRunnerAllowList(raw: string | undefined): string[];
|
|
193
|
-
export interface RunnerPermissions {
|
|
194
|
-
permissions: {
|
|
195
|
-
allow: string[];
|
|
196
|
-
deny: string[];
|
|
197
|
-
ask: string[];
|
|
198
|
-
};
|
|
199
|
-
/** Omitted when the project's own settings already run the enforcement hook, so it never runs (and logs) twice. */
|
|
200
|
-
hooks?: {
|
|
201
|
-
PreToolUse: Array<{
|
|
202
|
-
matcher: string;
|
|
203
|
-
hooks: Array<{
|
|
204
|
-
type: 'command';
|
|
205
|
-
command: string;
|
|
206
|
-
timeout: number;
|
|
207
|
-
}>;
|
|
208
|
-
}>;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Settings handed to a dispatched agent with `--settings`. The deny and ask rules and the enforcement hook come
|
|
213
|
-
* from the same source as `nativ setup`, so a dispatched agent is guarded even in a project where setup never ran.
|
|
214
|
-
*/
|
|
215
|
-
export declare function buildRunnerPermissions(task: Pick<MasterPlanTask, 'verificationCommand'>, rootDir: string, extraAllowed?: readonly string[]): RunnerPermissions;
|
|
216
|
-
/** Where a task's runner settings live: a subdirectory, because run history parses every top-level .json in runs/. */
|
|
217
|
-
export declare function runnerSettingsPath(runsDir: string, taskId: string): string;
|
|
218
|
-
export declare function writeRunnerSettings(runsDir: string, taskId: string, settings: RunnerPermissions): string;
|
|
219
|
-
/** The instructions text handed to the agent on its standard input. */
|
|
220
|
-
export declare function buildRunnerPrompt(task: MasterPlanTask): string;
|
|
221
|
-
/**
|
|
222
|
-
* Arguments for Claude Code CLI to run headless. The prompt goes on stdin, never in this string:
|
|
223
|
-
* quotes or symbols in task text would break the shell.
|
|
224
|
-
*
|
|
225
|
-
* It runs in `acceptEdits` mode with the rules in `settingsFile` (see buildRunnerPermissions); it does not bypass
|
|
226
|
-
* permissions. Without a settings file only the file-edit tools and read-only commands are pre-approved.
|
|
227
|
-
*/
|
|
228
|
-
export declare function buildDefaultClaudeCommand(_task: MasterPlanTask, model?: string | null, settingsFile?: string): string;
|
|
229
|
-
/** True when a runner command asks Claude Code for its line-delimited JSON event stream. */
|
|
230
|
-
export declare function usesClaudeStreamJson(command: string): boolean;
|
|
231
|
-
/** Final `result` event of a Claude Code stream: grounded usage for cli runs. */
|
|
232
|
-
export interface ClaudeStreamResult {
|
|
233
|
-
isError: boolean;
|
|
234
|
-
turns: number;
|
|
235
|
-
costUsd: number | null;
|
|
236
|
-
inputTokens: number;
|
|
237
|
-
outputTokens: number;
|
|
238
|
-
cacheCreationTokens: number;
|
|
239
|
-
cacheReadTokens: number;
|
|
240
|
-
}
|
|
241
|
-
export interface ClaudeStreamLine {
|
|
242
|
-
/** Human-readable log text (newline-terminated), or null when the event is not worth showing. */
|
|
243
|
-
text: string | null;
|
|
244
|
-
model?: string;
|
|
245
|
-
result?: ClaudeStreamResult;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Turns one line of `claude -p --output-format stream-json` into a log line. Anything that is not
|
|
249
|
-
* a recognised event (warnings, custom runners, future event types) passes through or is dropped,
|
|
250
|
-
* never thrown on.
|
|
251
|
-
*/
|
|
252
|
-
export declare function formatClaudeStreamLine(line: string): ClaudeStreamLine;
|
|
253
|
-
/** Models that predate adaptive thinking and still take `thinking.budget_tokens`. */
|
|
254
|
-
export declare function usesLegacyThinkingBudget(model: string): boolean;
|
|
255
|
-
/**
|
|
256
|
-
* Buckets a token budget into an effort level. Current models reject `budget_tokens`, so the
|
|
257
|
-
* contract's numeric `thinkingBudget` maps onto effort. The buckets follow the Studio's budget
|
|
258
|
-
* chips: 0 ("None, fast") is the least thinking a model allows, 2,048 ("Standard") is the
|
|
259
|
-
* standard effort, 4,096 ("Deep") is high, and larger budgets reach xhigh and max.
|
|
260
|
-
*/
|
|
261
|
-
export declare function thinkingBudgetToEffort(budget: number): ThinkingEffort;
|
|
262
|
-
export declare function resolveNativeThinking(model: string, budget: number | null): RunnerThinking;
|
|
263
|
-
/**
|
|
264
|
-
* Effort used when a dispatch sets no `thinkingBudget`. Claude Opus 5.5 at
|
|
265
|
-
* `medium` outperforms Claude Opus 5 at `high` on coding work, so it starts lower.
|
|
266
|
-
*/
|
|
267
|
-
export declare function defaultNativeEffort(model: string): ThinkingEffort;
|
|
268
|
-
/** Models that opt into server-side refusal fallbacks by default. */
|
|
269
|
-
export declare function supportsServerFallback(model: string): boolean;
|
|
270
|
-
/** Keeps stored text from closing the block it sits in and passing as instructions. */
|
|
271
|
-
export declare function untag(text: string, tag: string): string;
|
|
272
|
-
export declare function buildNativeTaskPrompt(task: MasterPlanTask, roleGuide: string | null, useWorktree: boolean, rootDir?: string): string;
|
|
273
|
-
/**
|
|
274
|
-
* Environment for cli runners. The agent inside can run the commands its allowlist permits (and any custom
|
|
275
|
-
* runner command runs unrestricted), so it can print anything it inherits: credential-looking variables are
|
|
276
|
-
* withheld, except the ones Claude
|
|
277
|
-
* Code itself authenticates with (and AWS credentials when it is configured for Bedrock).
|
|
278
|
-
* NATIV_RUNNER_PASS_ENV="NAME1,NAME2" passes extra variables through deliberately; variables an
|
|
279
|
-
* operator hands to dispatch() explicitly are also passed as-is.
|
|
280
|
-
*/
|
|
281
|
-
export declare function buildRunnerEnv(base: NodeJS.ProcessEnv, explicit?: Record<string, string>): NodeJS.ProcessEnv;
|
|
282
|
-
/**
|
|
283
|
-
* Best-effort policy for model-authored shell commands. The worktree is the
|
|
284
|
-
* real boundary (as with the cli engine); this blocks the obvious escapes and
|
|
285
|
-
* keeps every executable on an allowlist. Returns the rejection reason, or null.
|
|
286
|
-
*/
|
|
287
|
-
export declare function checkNativeBashCommand(command: string, allowed: ReadonlySet<string>): string | null;
|
|
288
|
-
/**
|
|
289
|
-
* Confines a model-supplied editor path to the workspace. Reads may follow the
|
|
290
|
-
* `.ai/` and `node_modules/` junctions the supervisor mounts into worktrees;
|
|
291
|
-
* writes may not touch them at all.
|
|
292
|
-
*/
|
|
293
|
-
export declare function resolveEditorPath(workspace: string, projectRoot: string, raw: unknown, mode: 'read' | 'write'): string;
|
|
2
|
+
import { type AbortResult, type AgentSupervisorOptions, type DispatchOptions, type ListRunsQuery, type LogSlice, type RunnerRecord } from './types.js';
|
|
3
|
+
export * from './types.js';
|
|
4
|
+
export * from './process-utils.js';
|
|
5
|
+
export * from './cli-config.js';
|
|
6
|
+
export * from './native-tools.js';
|
|
7
|
+
export * from './native-engine.js';
|
|
8
|
+
export * from './native-driver.js';
|
|
9
|
+
export * from './run-lifecycle.js';
|
|
294
10
|
/**
|
|
295
11
|
* Supervises autonomous agent runs: detached spawn inside an isolated git
|
|
296
12
|
* worktree, a timeout killswitch, a bounded streaming log buffer, and
|
|
@@ -352,16 +68,6 @@ export declare class AgentSupervisor extends EventEmitter {
|
|
|
352
68
|
private interruptNative;
|
|
353
69
|
private startNativeRun;
|
|
354
70
|
private driveNativeRun;
|
|
355
|
-
/**
|
|
356
|
-
* Manual agentic loop over the Messages API: stream a turn, capture usage,
|
|
357
|
-
* execute the requested local tools, repeat until the model ends its turn.
|
|
358
|
-
*/
|
|
359
|
-
private runNativeLoop;
|
|
360
|
-
private recordTurnUsage;
|
|
361
|
-
private executeNativeTool;
|
|
362
|
-
/** Runs one model-authored command in a fresh shell at the workspace root. */
|
|
363
|
-
private runBashTool;
|
|
364
|
-
private readRoleGuide;
|
|
365
71
|
private runVerification;
|
|
366
72
|
/** Quiet counterpart to `nativ worktree merge`: same safe merge, no stdout noise inside a server. */
|
|
367
73
|
private mergeWorktree;
|