brass-runtime 1.20.0 → 1.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/CHANGELOG.md +54 -0
- package/dist/agent/cli/main.cjs +265 -43
- package/dist/agent/cli/main.d.ts +99 -0
- package/dist/agent/cli/main.js +238 -16
- package/dist/agent/cli/main.mjs +238 -16
- package/dist/agent/index.cjs +18 -2
- package/dist/agent/index.d.ts +60 -482
- package/dist/agent/index.js +17 -1
- package/dist/agent/index.mjs +17 -1
- package/dist/{chunk-J4F5KC3U.js → chunk-AI3M6624.js} +1260 -45
- package/dist/{chunk-IHY2EJTT.cjs → chunk-EX4VEKUF.cjs} +1340 -125
- package/dist/{chunk-6BNZS2A4.mjs → chunk-Q57ENQUW.mjs} +1260 -45
- package/dist/nodeWorkspaceDiscovery-Ami1UkMt.d.ts +631 -0
- package/package.json +1 -1
- package/wasm/pkg/package.json +1 -1
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,388 +1,7 @@
|
|
|
1
|
+
import { f as AgentGoal, g as AgentState, O as Observation, h as AgentEnv, i as AgentError, j as AgentAction, B as BudgetConfigInput, k as AgentEvent, l as AgentPhase, m as AgentPackageManager, n as BanditState, o as AgentRedactionConfig, p as HostSignal, H as HostProfile, q as HostTransport, r as HostCapabilities, s as HostConstraints, t as HostIdentity, P as PermissionService, u as AgentPermissionConfig, v as ApprovalService, S as Shell, F as FileSystem, w as PatchService, x as LoadedAgentConfig, L as LLM, y as LLMRequest } from '../nodeWorkspaceDiscovery-Ami1UkMt.js';
|
|
2
|
+
export { z as AGENT_CONFIG_FILE_NAMES, C as AgentActionType, D as AgentBatchConfig, E as AgentBatchGoal, c as AgentConfig, G as AgentConfigApprovalMode, I as AgentConfigLLMProvider, J as AgentContextConfig, K as AgentEventSink, e as AgentLLMConfig, M as AgentLanguageConfig, A as AgentMode, N as AgentPackageManagerConfig, Q as AgentPatchQualityConfig, a as AgentPreset, R as AgentProjectConfig, b as AgentResponseLanguage, T as AgentRollbackConfig, U as AgentToolPolicyConfig, V as AgentToolPolicyOverride, W as AgentWorkspaceDiscoveryResult, X as ApprovalDefaultAnswer, Y as ApprovalRequest, Z as ApprovalResponse, _ as ApprovalRisk, $ as ExecResult, a0 as HostSignalSource, a1 as LLMPurpose, a2 as LLMResponse, a3 as PatchApplyPermissionConfig, a4 as PatchApplyResult, a5 as PermissionDecision, a6 as SearchMatch, a7 as ShellAskRule, a8 as ShellPermissionConfig, a9 as deepFreeze, d as discoverNodeWorkspaceRoot, aa as goalForAgentPreset, ab as isAgentConfigApprovalMode, ac as isAgentConfigLLMProvider, ad as isAgentConfigMode, ae as isAgentPreset } from '../nodeWorkspaceDiscovery-Ami1UkMt.js';
|
|
1
3
|
import { A as Async, b as Runtime, S as Scope } from '../effect-DbEMiMvv.js';
|
|
2
4
|
|
|
3
|
-
type AgentMode = "read-only" | "propose" | "write" | "autonomous";
|
|
4
|
-
type AgentPackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
|
5
|
-
type AgentPackageManagerConfig = AgentPackageManager | "auto";
|
|
6
|
-
type AgentResponseLanguage = "auto" | "match-user" | "en" | "es" | "pt" | "fr" | "de" | "it" | "custom";
|
|
7
|
-
type AgentLanguageConfig = {
|
|
8
|
-
/** Natural language used for LLM-facing responses. Default: auto, which matches the user goal when possible. */
|
|
9
|
-
readonly response?: AgentResponseLanguage;
|
|
10
|
-
/** Human-readable language name used when response is custom, e.g. "Argentinian Spanish". */
|
|
11
|
-
readonly custom?: string;
|
|
12
|
-
};
|
|
13
|
-
type AgentContextConfig = {
|
|
14
|
-
/** Enable or disable context discovery before the first LLM planning call. Default: true. */
|
|
15
|
-
readonly enabled?: boolean;
|
|
16
|
-
/** Maximum searchText actions to run before planning. Default: 3. */
|
|
17
|
-
readonly maxSearchQueries?: number;
|
|
18
|
-
/** Maximum distinct files to read from direct error paths and search results. Default: 4. */
|
|
19
|
-
readonly maxFiles?: number;
|
|
20
|
-
/** Maximum matches to consider from search results when selecting files. Default: 40. */
|
|
21
|
-
readonly maxSearchResults?: number;
|
|
22
|
-
/** Ripgrep globs used for context searches. */
|
|
23
|
-
readonly globs?: readonly string[];
|
|
24
|
-
/** Glob-like paths excluded from context reads/searches, e.g. secrets/** or *.pem. */
|
|
25
|
-
readonly excludeGlobs?: readonly string[];
|
|
26
|
-
};
|
|
27
|
-
type AgentRedactionConfig = {
|
|
28
|
-
/** Redact likely secrets before prompts/protocol summaries. Default: true. */
|
|
29
|
-
readonly enabled?: boolean;
|
|
30
|
-
/** Extra regular-expression source strings to redact. Invalid patterns are ignored. */
|
|
31
|
-
readonly additionalPatterns?: readonly string[];
|
|
32
|
-
};
|
|
33
|
-
type AgentPatchQualityConfig = {
|
|
34
|
-
/** Enable repair attempts after generated patches fail to apply or fail validation. Default: true. */
|
|
35
|
-
readonly enabled?: boolean;
|
|
36
|
-
/** Number of llm.patch repair calls after the initial generated patch. Default: 1. */
|
|
37
|
-
readonly maxRepairAttempts?: number;
|
|
38
|
-
};
|
|
39
|
-
type AgentRollbackConfig = {
|
|
40
|
-
/** Enable automatic rollback safety for generated patches. Default: true. */
|
|
41
|
-
readonly enabled?: boolean;
|
|
42
|
-
/** Roll back generated patches when final validation still fails and no repair remains. Default: true. */
|
|
43
|
-
readonly onFinalValidationFailure?: boolean;
|
|
44
|
-
/** Roll back only the latest patch or the full generated patch stack. Default: all. */
|
|
45
|
-
readonly strategy?: "last" | "all";
|
|
46
|
-
/** Maximum automatic rollback actions in one run. Default: 8. */
|
|
47
|
-
readonly maxRollbackDepth?: number;
|
|
48
|
-
/** Re-run validation after automatic rollback completes. Default: true. */
|
|
49
|
-
readonly runValidationAfterRollback?: boolean;
|
|
50
|
-
/** Allow automatic rollback for exact supplied patches. Default: false. */
|
|
51
|
-
readonly allowForSuppliedPatches?: boolean;
|
|
52
|
-
};
|
|
53
|
-
type AgentProjectConfig = {
|
|
54
|
-
/** Force a package manager or let the agent infer it from package.json and lockfiles. */
|
|
55
|
-
readonly packageManager?: AgentPackageManagerConfig;
|
|
56
|
-
/** Exact validation commands to run. When present, discovery from package.json is skipped. */
|
|
57
|
-
readonly validationCommands?: readonly string[];
|
|
58
|
-
/** Ordered script names to consider as the primary test command. */
|
|
59
|
-
readonly testScriptNames?: readonly string[];
|
|
60
|
-
/** Include a typecheck/check script even when the goal does not mention it. */
|
|
61
|
-
readonly includeTypecheck?: boolean;
|
|
62
|
-
/** Include a lint script even when the goal does not mention it. */
|
|
63
|
-
readonly includeLint?: boolean;
|
|
64
|
-
/** Bound the amount of validation work discovered automatically. Default: 2. */
|
|
65
|
-
readonly maxValidationCommands?: number;
|
|
66
|
-
};
|
|
67
|
-
type AgentGoal = {
|
|
68
|
-
readonly id: string;
|
|
69
|
-
readonly cwd: string;
|
|
70
|
-
readonly text: string;
|
|
71
|
-
readonly mode: AgentMode;
|
|
72
|
-
readonly project?: AgentProjectConfig;
|
|
73
|
-
readonly context?: AgentContextConfig;
|
|
74
|
-
readonly patchQuality?: AgentPatchQualityConfig;
|
|
75
|
-
readonly rollback?: AgentRollbackConfig;
|
|
76
|
-
readonly redaction?: AgentRedactionConfig;
|
|
77
|
-
readonly language?: AgentLanguageConfig;
|
|
78
|
-
/** Optional precomputed unified diff. Used by trusted clients after a patch preview approval. */
|
|
79
|
-
readonly initialPatch?: string;
|
|
80
|
-
/** How to materialize initialPatch in write/autonomous mode. Default: apply. */
|
|
81
|
-
readonly initialPatchMode?: "apply" | "rollback";
|
|
82
|
-
};
|
|
83
|
-
type AgentPhase = "boot" | "discovering" | "planning" | "validating" | "proposing" | "done" | "failed";
|
|
84
|
-
type AgentState = {
|
|
85
|
-
readonly goal: AgentGoal;
|
|
86
|
-
readonly phase: AgentPhase;
|
|
87
|
-
readonly observations: readonly Observation[];
|
|
88
|
-
readonly errors: readonly AgentError[];
|
|
89
|
-
readonly steps: number;
|
|
90
|
-
};
|
|
91
|
-
type AgentEvent = {
|
|
92
|
-
readonly type: "agent.run.started";
|
|
93
|
-
readonly goal: AgentGoal;
|
|
94
|
-
readonly at: number;
|
|
95
|
-
} | {
|
|
96
|
-
readonly type: "agent.action.started";
|
|
97
|
-
readonly action: AgentAction;
|
|
98
|
-
readonly step: number;
|
|
99
|
-
readonly phase: AgentPhase;
|
|
100
|
-
readonly at: number;
|
|
101
|
-
} | {
|
|
102
|
-
readonly type: "agent.action.completed";
|
|
103
|
-
readonly action: AgentAction;
|
|
104
|
-
readonly observation: Observation;
|
|
105
|
-
readonly step: number;
|
|
106
|
-
readonly phase: AgentPhase;
|
|
107
|
-
readonly durationMs: number;
|
|
108
|
-
readonly at: number;
|
|
109
|
-
} | {
|
|
110
|
-
readonly type: "agent.action.failed";
|
|
111
|
-
readonly action: AgentAction;
|
|
112
|
-
readonly error: AgentError;
|
|
113
|
-
readonly step: number;
|
|
114
|
-
readonly phase: AgentPhase;
|
|
115
|
-
readonly durationMs: number;
|
|
116
|
-
readonly at: number;
|
|
117
|
-
} | {
|
|
118
|
-
readonly type: "agent.observation.recorded";
|
|
119
|
-
readonly observation: Observation;
|
|
120
|
-
readonly step: number;
|
|
121
|
-
readonly phase: AgentPhase;
|
|
122
|
-
readonly at: number;
|
|
123
|
-
} | {
|
|
124
|
-
readonly type: "agent.tool.timeout";
|
|
125
|
-
readonly action: AgentAction;
|
|
126
|
-
readonly step: number;
|
|
127
|
-
readonly phase: AgentPhase;
|
|
128
|
-
readonly timeoutMs: number;
|
|
129
|
-
readonly at: number;
|
|
130
|
-
} | {
|
|
131
|
-
readonly type: "agent.permission.denied";
|
|
132
|
-
readonly action: AgentAction;
|
|
133
|
-
readonly step: number;
|
|
134
|
-
readonly phase: AgentPhase;
|
|
135
|
-
readonly reason: string;
|
|
136
|
-
readonly at: number;
|
|
137
|
-
} | {
|
|
138
|
-
readonly type: "agent.approval.requested";
|
|
139
|
-
readonly action: AgentAction;
|
|
140
|
-
readonly step: number;
|
|
141
|
-
readonly phase: AgentPhase;
|
|
142
|
-
readonly reason: string;
|
|
143
|
-
readonly risk: ApprovalRisk;
|
|
144
|
-
readonly defaultAnswer: ApprovalDefaultAnswer;
|
|
145
|
-
readonly at: number;
|
|
146
|
-
} | {
|
|
147
|
-
readonly type: "agent.approval.resolved";
|
|
148
|
-
readonly action: AgentAction;
|
|
149
|
-
readonly step: number;
|
|
150
|
-
readonly phase: AgentPhase;
|
|
151
|
-
readonly approved: boolean;
|
|
152
|
-
readonly reason?: string;
|
|
153
|
-
readonly at: number;
|
|
154
|
-
} | {
|
|
155
|
-
readonly type: "agent.patch.applied";
|
|
156
|
-
readonly step: number;
|
|
157
|
-
readonly phase: AgentPhase;
|
|
158
|
-
readonly changedFiles: readonly string[];
|
|
159
|
-
readonly automaticRollbackEligible?: boolean;
|
|
160
|
-
readonly at: number;
|
|
161
|
-
} | {
|
|
162
|
-
readonly type: "agent.patch.rolledBack";
|
|
163
|
-
readonly step: number;
|
|
164
|
-
readonly phase: AgentPhase;
|
|
165
|
-
readonly changedFiles: readonly string[];
|
|
166
|
-
readonly automatic?: boolean;
|
|
167
|
-
readonly reason?: string;
|
|
168
|
-
readonly at: number;
|
|
169
|
-
} | {
|
|
170
|
-
readonly type: "agent.run.completed";
|
|
171
|
-
readonly goal: AgentGoal;
|
|
172
|
-
readonly status: "done" | "failed";
|
|
173
|
-
readonly phase: AgentPhase;
|
|
174
|
-
readonly steps: number;
|
|
175
|
-
readonly durationMs: number;
|
|
176
|
-
readonly at: number;
|
|
177
|
-
};
|
|
178
|
-
type AgentEventSink = {
|
|
179
|
-
readonly emit: (event: AgentEvent) => void;
|
|
180
|
-
};
|
|
181
|
-
type LLMPurpose = "plan" | "patch" | "explain";
|
|
182
|
-
type AgentAction = {
|
|
183
|
-
readonly type: "fs.readFile";
|
|
184
|
-
readonly path: string;
|
|
185
|
-
} | {
|
|
186
|
-
readonly type: "fs.exists";
|
|
187
|
-
readonly path: string;
|
|
188
|
-
} | {
|
|
189
|
-
readonly type: "fs.searchText";
|
|
190
|
-
readonly query: string;
|
|
191
|
-
readonly globs?: readonly string[];
|
|
192
|
-
} | {
|
|
193
|
-
readonly type: "shell.exec";
|
|
194
|
-
readonly command: readonly string[];
|
|
195
|
-
readonly cwd?: string;
|
|
196
|
-
} | {
|
|
197
|
-
readonly type: "llm.complete";
|
|
198
|
-
readonly purpose: LLMPurpose;
|
|
199
|
-
readonly prompt: string;
|
|
200
|
-
} | {
|
|
201
|
-
readonly type: "patch.propose";
|
|
202
|
-
readonly patch: string;
|
|
203
|
-
} | {
|
|
204
|
-
readonly type: "patch.apply";
|
|
205
|
-
readonly patch: string;
|
|
206
|
-
} | {
|
|
207
|
-
readonly type: "patch.rollback";
|
|
208
|
-
readonly patch: string;
|
|
209
|
-
readonly automatic?: boolean;
|
|
210
|
-
readonly reason?: string;
|
|
211
|
-
} | {
|
|
212
|
-
readonly type: "agent.finish";
|
|
213
|
-
readonly summary: string;
|
|
214
|
-
} | {
|
|
215
|
-
readonly type: "agent.fail";
|
|
216
|
-
readonly reason: string;
|
|
217
|
-
};
|
|
218
|
-
type AgentActionType = AgentAction["type"];
|
|
219
|
-
type AgentToolPolicyOverride = {
|
|
220
|
-
readonly timeoutMs?: number;
|
|
221
|
-
readonly retries?: number;
|
|
222
|
-
};
|
|
223
|
-
type AgentToolPolicyConfig = Partial<Record<AgentActionType, AgentToolPolicyOverride>>;
|
|
224
|
-
type Observation = {
|
|
225
|
-
readonly type: "fs.fileRead";
|
|
226
|
-
readonly path: string;
|
|
227
|
-
readonly content: string;
|
|
228
|
-
} | {
|
|
229
|
-
readonly type: "fs.exists";
|
|
230
|
-
readonly path: string;
|
|
231
|
-
readonly exists: boolean;
|
|
232
|
-
} | {
|
|
233
|
-
readonly type: "fs.searchResult";
|
|
234
|
-
readonly query: string;
|
|
235
|
-
readonly matches: readonly SearchMatch[];
|
|
236
|
-
} | {
|
|
237
|
-
readonly type: "shell.result";
|
|
238
|
-
readonly command: readonly string[];
|
|
239
|
-
readonly exitCode: number;
|
|
240
|
-
readonly stdout: string;
|
|
241
|
-
readonly stderr: string;
|
|
242
|
-
} | {
|
|
243
|
-
readonly type: "llm.response";
|
|
244
|
-
readonly purpose: LLMPurpose;
|
|
245
|
-
readonly content: string;
|
|
246
|
-
} | {
|
|
247
|
-
readonly type: "patch.proposed";
|
|
248
|
-
readonly patch: string;
|
|
249
|
-
} | {
|
|
250
|
-
readonly type: "patch.applied";
|
|
251
|
-
readonly changedFiles: readonly string[];
|
|
252
|
-
readonly patch?: string;
|
|
253
|
-
} | {
|
|
254
|
-
readonly type: "patch.rolledBack";
|
|
255
|
-
readonly changedFiles: readonly string[];
|
|
256
|
-
readonly patch?: string;
|
|
257
|
-
readonly automatic?: boolean;
|
|
258
|
-
readonly reason?: string;
|
|
259
|
-
} | {
|
|
260
|
-
readonly type: "agent.done";
|
|
261
|
-
readonly summary: string;
|
|
262
|
-
} | {
|
|
263
|
-
readonly type: "agent.error";
|
|
264
|
-
readonly error: AgentError;
|
|
265
|
-
};
|
|
266
|
-
type SearchMatch = {
|
|
267
|
-
readonly path: string;
|
|
268
|
-
readonly line: number;
|
|
269
|
-
readonly text: string;
|
|
270
|
-
};
|
|
271
|
-
type ExecResult = {
|
|
272
|
-
readonly exitCode: number;
|
|
273
|
-
readonly stdout: string;
|
|
274
|
-
readonly stderr: string;
|
|
275
|
-
};
|
|
276
|
-
type LLMRequest = {
|
|
277
|
-
readonly purpose: LLMPurpose;
|
|
278
|
-
readonly prompt: string;
|
|
279
|
-
};
|
|
280
|
-
type LLMResponse = {
|
|
281
|
-
readonly content: string;
|
|
282
|
-
};
|
|
283
|
-
type AgentError = {
|
|
284
|
-
readonly _tag: "FsError";
|
|
285
|
-
readonly operation: string;
|
|
286
|
-
readonly cause: unknown;
|
|
287
|
-
} | {
|
|
288
|
-
readonly _tag: "ShellError";
|
|
289
|
-
readonly operation: string;
|
|
290
|
-
readonly command?: readonly string[];
|
|
291
|
-
readonly cause: unknown;
|
|
292
|
-
} | {
|
|
293
|
-
readonly _tag: "LLMError";
|
|
294
|
-
readonly cause: unknown;
|
|
295
|
-
} | {
|
|
296
|
-
readonly _tag: "PatchError";
|
|
297
|
-
readonly operation: string;
|
|
298
|
-
readonly cause: unknown;
|
|
299
|
-
readonly patch?: string;
|
|
300
|
-
} | {
|
|
301
|
-
readonly _tag: "PermissionDenied";
|
|
302
|
-
readonly action: AgentAction;
|
|
303
|
-
readonly reason: string;
|
|
304
|
-
} | {
|
|
305
|
-
readonly _tag: "ApprovalRejected";
|
|
306
|
-
readonly action: AgentAction;
|
|
307
|
-
readonly reason: string;
|
|
308
|
-
} | {
|
|
309
|
-
readonly _tag: "ToolTimeout";
|
|
310
|
-
readonly timeoutMs: number;
|
|
311
|
-
} | {
|
|
312
|
-
readonly _tag: "AgentLoopError";
|
|
313
|
-
readonly message: string;
|
|
314
|
-
} | {
|
|
315
|
-
readonly _tag: "PathOutsideWorkspace";
|
|
316
|
-
readonly path: string;
|
|
317
|
-
readonly cwd: string;
|
|
318
|
-
};
|
|
319
|
-
type FileSystem = {
|
|
320
|
-
readonly readFile: (path: string) => Async<unknown, AgentError, string>;
|
|
321
|
-
readonly exists: (path: string) => Async<unknown, AgentError, boolean>;
|
|
322
|
-
readonly searchText: (cwd: string, query: string, options?: {
|
|
323
|
-
readonly globs?: readonly string[];
|
|
324
|
-
}) => Async<unknown, AgentError, readonly SearchMatch[]>;
|
|
325
|
-
};
|
|
326
|
-
type Shell = {
|
|
327
|
-
readonly exec: (command: readonly string[], options: {
|
|
328
|
-
readonly cwd: string;
|
|
329
|
-
readonly stdin?: string;
|
|
330
|
-
}) => Async<unknown, AgentError, ExecResult>;
|
|
331
|
-
};
|
|
332
|
-
type LLM = {
|
|
333
|
-
readonly complete: (request: LLMRequest) => Async<unknown, AgentError, LLMResponse>;
|
|
334
|
-
};
|
|
335
|
-
type PatchApplyResult = {
|
|
336
|
-
readonly changedFiles: readonly string[];
|
|
337
|
-
};
|
|
338
|
-
type PatchService = {
|
|
339
|
-
readonly apply: (cwd: string, patch: string) => Async<unknown, AgentError, PatchApplyResult>;
|
|
340
|
-
/** Reverse-apply a unified diff, usually for manual rollback of an approved patch. */
|
|
341
|
-
readonly rollback: (cwd: string, patch: string) => Async<unknown, AgentError, PatchApplyResult>;
|
|
342
|
-
};
|
|
343
|
-
type ApprovalRisk = "low" | "medium" | "high";
|
|
344
|
-
type ApprovalDefaultAnswer = "approve" | "reject";
|
|
345
|
-
type ApprovalRequest = {
|
|
346
|
-
readonly action: AgentAction;
|
|
347
|
-
readonly state: AgentState;
|
|
348
|
-
readonly reason: string;
|
|
349
|
-
readonly risk: ApprovalRisk;
|
|
350
|
-
readonly defaultAnswer: ApprovalDefaultAnswer;
|
|
351
|
-
};
|
|
352
|
-
type ApprovalResponse = {
|
|
353
|
-
readonly type: "approved";
|
|
354
|
-
} | {
|
|
355
|
-
readonly type: "rejected";
|
|
356
|
-
readonly reason?: string;
|
|
357
|
-
};
|
|
358
|
-
type ApprovalService = {
|
|
359
|
-
readonly request: (request: ApprovalRequest) => Async<AgentEnv, AgentError, ApprovalResponse>;
|
|
360
|
-
};
|
|
361
|
-
type PermissionDecision = {
|
|
362
|
-
readonly type: "allow";
|
|
363
|
-
} | {
|
|
364
|
-
readonly type: "deny";
|
|
365
|
-
readonly reason: string;
|
|
366
|
-
} | {
|
|
367
|
-
readonly type: "ask";
|
|
368
|
-
readonly reason: string;
|
|
369
|
-
readonly risk: ApprovalRisk;
|
|
370
|
-
readonly defaultAnswer?: ApprovalDefaultAnswer;
|
|
371
|
-
};
|
|
372
|
-
type PermissionService = {
|
|
373
|
-
readonly check: (action: AgentAction, state: AgentState) => Async<AgentEnv, AgentError, PermissionDecision>;
|
|
374
|
-
};
|
|
375
|
-
type AgentEnv = {
|
|
376
|
-
readonly fs: FileSystem;
|
|
377
|
-
readonly shell: Shell;
|
|
378
|
-
readonly llm: LLM;
|
|
379
|
-
readonly patch: PatchService;
|
|
380
|
-
readonly permissions: PermissionService;
|
|
381
|
-
readonly approvals?: ApprovalService;
|
|
382
|
-
readonly events?: AgentEventSink;
|
|
383
|
-
readonly toolPolicies?: AgentToolPolicyConfig;
|
|
384
|
-
};
|
|
385
|
-
|
|
386
5
|
declare const initialAgentState: (goal: AgentGoal) => AgentState;
|
|
387
6
|
|
|
388
7
|
declare const reduceAgentState: (state: AgentState, observation: Observation) => AgentState;
|
|
@@ -390,7 +9,7 @@ declare const isTerminal: (state: AgentState) => boolean;
|
|
|
390
9
|
|
|
391
10
|
declare const decideNextAction: (state: AgentState) => Async<AgentEnv, AgentError, AgentAction>;
|
|
392
11
|
|
|
393
|
-
declare const runAgent: (runtime: Runtime<AgentEnv>, goal: AgentGoal) => Async<AgentEnv, AgentError, AgentState>;
|
|
12
|
+
declare const runAgent: (runtime: Runtime<AgentEnv>, goal: AgentGoal, configBudget?: BudgetConfigInput) => Async<AgentEnv, AgentError, AgentState>;
|
|
394
13
|
|
|
395
14
|
declare const nowMillis: () => Async<unknown, never, number>;
|
|
396
15
|
declare const emitAgentEvent: (event: AgentEvent) => Async<AgentEnv, never, void>;
|
|
@@ -402,90 +21,6 @@ declare const errorEventFor: (action: AgentAction, state: AgentState, error: Age
|
|
|
402
21
|
declare const observationEventFor: (state: AgentState, observation: Observation, at: number) => AgentEvent | undefined;
|
|
403
22
|
declare const runStatusFor: (phase: AgentPhase) => "done" | "failed";
|
|
404
23
|
|
|
405
|
-
type AgentPreset = "fix-tests" | "inspect" | "typecheck" | "lint";
|
|
406
|
-
type AgentBatchGoal = string | {
|
|
407
|
-
readonly goal?: string;
|
|
408
|
-
readonly preset?: AgentPreset;
|
|
409
|
-
readonly mode?: AgentMode;
|
|
410
|
-
readonly cwd?: string;
|
|
411
|
-
readonly patchFile?: string;
|
|
412
|
-
readonly patchFileMode?: "apply" | "rollback";
|
|
413
|
-
readonly saveRunDir?: string;
|
|
414
|
-
};
|
|
415
|
-
type AgentBatchConfig = {
|
|
416
|
-
/** Goals to execute sequentially when no --batch-file is provided. */
|
|
417
|
-
readonly goals?: readonly AgentBatchGoal[];
|
|
418
|
-
/** Stop after the first failed run. Default: true in --ci mode, false otherwise. */
|
|
419
|
-
readonly stopOnFailure?: boolean;
|
|
420
|
-
};
|
|
421
|
-
declare const isAgentPreset: (value: string) => value is AgentPreset;
|
|
422
|
-
declare const goalForAgentPreset: (preset: AgentPreset) => string;
|
|
423
|
-
|
|
424
|
-
type AgentConfigApprovalMode = "auto" | "interactive" | "approve" | "deny";
|
|
425
|
-
type AgentConfigLLMProvider = "fake" | "google" | "gemini" | "openai" | "openai-compatible";
|
|
426
|
-
type AgentLLMConfig = {
|
|
427
|
-
readonly provider?: AgentConfigLLMProvider;
|
|
428
|
-
readonly model?: string;
|
|
429
|
-
readonly endpoint?: string;
|
|
430
|
-
readonly baseUrl?: string;
|
|
431
|
-
readonly apiVersion?: string;
|
|
432
|
-
readonly apiKeyEnv?: string;
|
|
433
|
-
readonly systemInstruction?: string;
|
|
434
|
-
readonly temperature?: number;
|
|
435
|
-
readonly topP?: number;
|
|
436
|
-
readonly topK?: number;
|
|
437
|
-
readonly maxOutputTokens?: number;
|
|
438
|
-
readonly fakeResponse?: string;
|
|
439
|
-
};
|
|
440
|
-
type ShellAskRule = string | {
|
|
441
|
-
readonly pattern: string;
|
|
442
|
-
readonly reason?: string;
|
|
443
|
-
readonly risk?: ApprovalRisk;
|
|
444
|
-
readonly defaultAnswer?: ApprovalDefaultAnswer;
|
|
445
|
-
};
|
|
446
|
-
type ShellPermissionConfig = {
|
|
447
|
-
/**
|
|
448
|
-
* When true or omitted, the built-in safe read/validation commands remain
|
|
449
|
-
* allowed. Set to false for a strict allowlist defined only by this file.
|
|
450
|
-
*/
|
|
451
|
-
readonly inheritDefaults?: boolean;
|
|
452
|
-
readonly allow?: readonly string[];
|
|
453
|
-
readonly ask?: readonly ShellAskRule[];
|
|
454
|
-
readonly deny?: readonly string[];
|
|
455
|
-
};
|
|
456
|
-
type PatchApplyPermissionConfig = "allow" | "ask" | "deny" | {
|
|
457
|
-
readonly decision?: "allow" | "ask" | "deny";
|
|
458
|
-
readonly reason?: string;
|
|
459
|
-
readonly risk?: ApprovalRisk;
|
|
460
|
-
readonly defaultAnswer?: ApprovalDefaultAnswer;
|
|
461
|
-
};
|
|
462
|
-
type AgentPermissionConfig = {
|
|
463
|
-
readonly shell?: ShellPermissionConfig;
|
|
464
|
-
readonly patchApply?: PatchApplyPermissionConfig;
|
|
465
|
-
};
|
|
466
|
-
type AgentConfig = {
|
|
467
|
-
readonly mode?: AgentMode;
|
|
468
|
-
readonly approval?: AgentConfigApprovalMode;
|
|
469
|
-
readonly llm?: AgentLLMConfig;
|
|
470
|
-
readonly project?: AgentProjectConfig;
|
|
471
|
-
readonly context?: AgentContextConfig;
|
|
472
|
-
readonly patchQuality?: AgentPatchQualityConfig;
|
|
473
|
-
readonly rollback?: AgentRollbackConfig;
|
|
474
|
-
readonly redaction?: AgentRedactionConfig;
|
|
475
|
-
readonly language?: AgentLanguageConfig;
|
|
476
|
-
readonly permissions?: AgentPermissionConfig;
|
|
477
|
-
readonly tools?: AgentToolPolicyConfig;
|
|
478
|
-
readonly batch?: AgentBatchConfig;
|
|
479
|
-
};
|
|
480
|
-
type LoadedAgentConfig = {
|
|
481
|
-
readonly path?: string;
|
|
482
|
-
readonly config: AgentConfig;
|
|
483
|
-
};
|
|
484
|
-
declare const isAgentConfigMode: (value: string) => value is AgentMode;
|
|
485
|
-
declare const isAgentConfigApprovalMode: (value: string) => value is AgentConfigApprovalMode;
|
|
486
|
-
declare const isAgentConfigLLMProvider: (value: string) => value is AgentConfigLLMProvider;
|
|
487
|
-
declare const AGENT_CONFIG_FILE_NAMES: readonly [".brass-agent.json", "brass-agent.config.json"];
|
|
488
|
-
|
|
489
24
|
type ProjectCommand = readonly string[];
|
|
490
25
|
type ProjectCommandDiscovery = {
|
|
491
26
|
readonly packageManager: AgentPackageManager;
|
|
@@ -534,7 +69,7 @@ declare const extractLikelyFilePaths: (state: AgentState) => readonly string[];
|
|
|
534
69
|
declare const deriveContextSearchQueries: (state: AgentState) => readonly string[];
|
|
535
70
|
declare const describeContextDiscovery: (state: AgentState) => string;
|
|
536
71
|
declare const summarizeContextDiscovery: (state: AgentState) => ContextDiscoverySummary;
|
|
537
|
-
declare const nextContextDiscoveryAction: (state: AgentState) => AgentAction | undefined;
|
|
72
|
+
declare const nextContextDiscoveryAction: (state: AgentState, banditState?: BanditState) => AgentAction | undefined;
|
|
538
73
|
|
|
539
74
|
type PatchQualitySummary = {
|
|
540
75
|
readonly enabled: boolean;
|
|
@@ -606,6 +141,61 @@ declare const responseLanguageName: (goal: AgentGoal) => string | undefined;
|
|
|
606
141
|
declare const describeLanguagePolicy: (goal: AgentGoal) => string;
|
|
607
142
|
declare const spanishLike: (goal: AgentGoal) => boolean;
|
|
608
143
|
|
|
144
|
+
type HostSignalInput = {
|
|
145
|
+
readonly argv: readonly string[];
|
|
146
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
147
|
+
readonly stdoutIsTTY: boolean;
|
|
148
|
+
readonly stdinIsTTY: boolean;
|
|
149
|
+
readonly ttyColumns: number | undefined;
|
|
150
|
+
readonly parentProcessName: string | undefined;
|
|
151
|
+
readonly workspaceMarkers: readonly string[];
|
|
152
|
+
readonly stdinFirstLine: string | undefined;
|
|
153
|
+
readonly configPaths: readonly string[];
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Collects host signals from the provided input in fixed source category order.
|
|
157
|
+
*
|
|
158
|
+
* Each source is collected independently with try/catch — if a source fails,
|
|
159
|
+
* it is omitted from the result. Returns an empty array if all sources are
|
|
160
|
+
* unavailable (never throws).
|
|
161
|
+
*/
|
|
162
|
+
declare const collectHostSignals: (input: HostSignalInput) => readonly HostSignal[];
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Known CI environment variable indicators.
|
|
166
|
+
* Presence of any of these keys in the environment signals a CI transport.
|
|
167
|
+
*/
|
|
168
|
+
declare const CI_INDICATORS: readonly ["CI", "GITHUB_ACTIONS", "JENKINS_URL", "CIRCLECI", "TRAVIS", "GITLAB_CI", "BUILDKITE", "TF_BUILD"];
|
|
169
|
+
/**
|
|
170
|
+
* Infers the communication transport from collected signals.
|
|
171
|
+
* Priority order: mcp > extension > ci > terminal > stdio > unknown.
|
|
172
|
+
* Returns "unknown" when no signals match any known pattern.
|
|
173
|
+
*/
|
|
174
|
+
declare const inferTransport: (signals: readonly HostSignal[]) => HostTransport;
|
|
175
|
+
/**
|
|
176
|
+
* Infers host capabilities from collected signals and resolved transport.
|
|
177
|
+
* All fields default to false when no signal triggers them.
|
|
178
|
+
*/
|
|
179
|
+
declare const inferCapabilities: (signals: readonly HostSignal[], transport: HostTransport) => HostCapabilities;
|
|
180
|
+
/**
|
|
181
|
+
* Infers behavioral constraints from capabilities and transport.
|
|
182
|
+
* All fields default to false when their inference rules do not match.
|
|
183
|
+
*/
|
|
184
|
+
declare const inferConstraints: (capabilities: HostCapabilities, transport: HostTransport) => HostConstraints;
|
|
185
|
+
/**
|
|
186
|
+
* Infers optional host identity from collected signals.
|
|
187
|
+
* Returns undefined when no pattern matches.
|
|
188
|
+
* When multiple patterns match, selects the one with highest confidence.
|
|
189
|
+
* Confidence is rounded to 2 decimal places.
|
|
190
|
+
*/
|
|
191
|
+
declare const inferOptionalIdentity: (signals: readonly HostSignal[]) => HostIdentity | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Builds a complete HostProfile from raw signal input.
|
|
194
|
+
* Composes all inference stages and applies deepFreeze to the result.
|
|
195
|
+
* Pure function — no shared mutable state.
|
|
196
|
+
*/
|
|
197
|
+
declare const buildHostProfile: (input: HostSignalInput) => HostProfile;
|
|
198
|
+
|
|
609
199
|
declare const makeConfiguredPermissions: (config?: AgentPermissionConfig) => PermissionService;
|
|
610
200
|
declare const defaultPermissions: PermissionService;
|
|
611
201
|
|
|
@@ -673,16 +263,4 @@ type FakeLLMOptions = {
|
|
|
673
263
|
};
|
|
674
264
|
declare const makeFakeLLM: (options?: FakeLLMOptions) => LLM;
|
|
675
265
|
|
|
676
|
-
type
|
|
677
|
-
readonly inputCwd: string;
|
|
678
|
-
readonly cwd: string;
|
|
679
|
-
readonly marker?: string;
|
|
680
|
-
readonly markerPath?: string;
|
|
681
|
-
readonly changed: boolean;
|
|
682
|
-
readonly disabled?: boolean;
|
|
683
|
-
};
|
|
684
|
-
declare const discoverNodeWorkspaceRoot: (cwd: string, options?: {
|
|
685
|
-
readonly enabled?: boolean;
|
|
686
|
-
}) => AgentWorkspaceDiscoveryResult;
|
|
687
|
-
|
|
688
|
-
export { AGENT_CONFIG_FILE_NAMES, type AgentAction, type AgentActionType, type AgentBatchConfig, type AgentBatchGoal, type AgentConfig, type AgentConfigApprovalMode, type AgentConfigLLMProvider, type AgentContextConfig, type AgentEnv, type AgentError, type AgentEvent, type AgentEventSink, type AgentGoal, type AgentLLMConfig, type AgentLanguageConfig, type AgentMode, type AgentPackageManager, type AgentPackageManagerConfig, type AgentPatchQualityConfig, type AgentPermissionConfig, type AgentPhase, type AgentPreset, type AgentProjectConfig, type AgentProjectProfile, type AgentProjectStack, type AgentRedactionConfig, type AgentResponseLanguage, type AgentRollbackConfig, type AgentRollbackStrategy, type AgentState, type AgentToolPolicyConfig, type AgentToolPolicyOverride, type AgentWorkspaceDiscoveryResult, type AgentWorkspaceStyle, type AppliedPatchEntry, type ApprovalDefaultAnswer, type ApprovalRequest, type ApprovalResponse, type ApprovalRisk, type ApprovalService, type ContextDiscoverySummary, type ExecResult, type FakeLLMOptions, type FileSystem, type GoogleGenerativeAIConfig, type LLM, type LLMPurpose, type LLMRequest, type LLMResponse, type LoadedAgentConfig, NodeShell, type Observation, PROJECT_LOCKFILE_PROBES, PROJECT_PROFILE_PROBES, type PatchApplyPermissionConfig, type PatchApplyResult, type PatchQualitySummary, type PatchService, type PatchValidationStatus, type PermissionDecision, type PermissionService, type ProjectCommand, type ProjectCommandDiscovery, type RollbackSafetySummary, type SearchMatch, type Shell, type ShellAskRule, type ShellPermissionConfig, type WorkspaceValidationStatus, autoApproveApprovals, canAutoRollback, canRequestPatchRepair, commandForScript, decideNextAction, defaultPermissions, deriveContextSearchQueries, describeCommandDiscovery, describeContextDiscovery, describeLanguagePolicy, describePatchQuality, describeProjectProfile, describeRollbackSafety, discoverNodeWorkspaceRoot, discoverPackageManager, discoverProjectProfile, discoverValidationCommands, emitAgentEvent, emitAgentEvents, errorEventFor, extractLikelyFilePaths, extractPatchPaths, extractUnifiedDiff, goalForAgentPreset, inferUserLanguage, initialAgentState, invokeAction, isAgentConfigApprovalMode, isAgentConfigLLMProvider, isAgentConfigMode, isAgentPreset, isRedactionEnabled, isTerminal, latestUnappliedPatch, loadNodeAgentConfig, makeAutoDenyApprovals, makeConfiguredPermissions, makeFakeLLM, makeGoogleGenerativeAILLM, makeNodeFileSystem, makeNodePatchService, makeOpenAICompatibleLLM, nextContextDiscoveryAction, nextProjectProbeAction, nextUnrunValidationCommand, nowMillis, observationEventFor, observationStatus, parseProjectPackageJson, patchQualitySummary, patchRepairAttemptsUsed, patchValidationStatus, projectProfileProbePending, redactText, reduceAgentState, responseLanguageName, retry, rollbackSafetySummary, runAgent, runStatusFor, shouldContinueRollbackStack, sleep, spanishLike, splitCommand, summarizeAgentAction, summarizeAgentObservation, summarizeContextDiscovery, timeout, unappliedPatchStack, workspaceValidationStatus };
|
|
266
|
+
export { AgentAction, AgentEnv, AgentError, AgentEvent, AgentGoal, AgentPackageManager, AgentPermissionConfig, AgentPhase, type AgentProjectProfile, type AgentProjectStack, AgentRedactionConfig, type AgentRollbackStrategy, AgentState, type AgentWorkspaceStyle, type AppliedPatchEntry, ApprovalService, CI_INDICATORS, type ContextDiscoverySummary, type FakeLLMOptions, FileSystem, type GoogleGenerativeAIConfig, HostCapabilities, HostConstraints, HostIdentity, HostProfile, HostSignal, type HostSignalInput, HostTransport, LLM, LLMRequest, LoadedAgentConfig, NodeShell, Observation, PROJECT_LOCKFILE_PROBES, PROJECT_PROFILE_PROBES, type PatchQualitySummary, PatchService, type PatchValidationStatus, PermissionService, type ProjectCommand, type ProjectCommandDiscovery, type RollbackSafetySummary, Shell, type WorkspaceValidationStatus, autoApproveApprovals, buildHostProfile, canAutoRollback, canRequestPatchRepair, collectHostSignals, commandForScript, decideNextAction, defaultPermissions, deriveContextSearchQueries, describeCommandDiscovery, describeContextDiscovery, describeLanguagePolicy, describePatchQuality, describeProjectProfile, describeRollbackSafety, discoverPackageManager, discoverProjectProfile, discoverValidationCommands, emitAgentEvent, emitAgentEvents, errorEventFor, extractLikelyFilePaths, extractPatchPaths, extractUnifiedDiff, inferCapabilities, inferConstraints, inferOptionalIdentity, inferTransport, inferUserLanguage, initialAgentState, invokeAction, isRedactionEnabled, isTerminal, latestUnappliedPatch, loadNodeAgentConfig, makeAutoDenyApprovals, makeConfiguredPermissions, makeFakeLLM, makeGoogleGenerativeAILLM, makeNodeFileSystem, makeNodePatchService, makeOpenAICompatibleLLM, nextContextDiscoveryAction, nextProjectProbeAction, nextUnrunValidationCommand, nowMillis, observationEventFor, observationStatus, parseProjectPackageJson, patchQualitySummary, patchRepairAttemptsUsed, patchValidationStatus, projectProfileProbePending, redactText, reduceAgentState, responseLanguageName, retry, rollbackSafetySummary, runAgent, runStatusFor, shouldContinueRollbackStack, sleep, spanishLike, splitCommand, summarizeAgentAction, summarizeAgentObservation, summarizeContextDiscovery, timeout, unappliedPatchStack, workspaceValidationStatus };
|
package/dist/agent/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_CONFIG_FILE_NAMES,
|
|
3
|
+
CI_INDICATORS,
|
|
3
4
|
NodeShell,
|
|
4
5
|
PROJECT_LOCKFILE_PROBES,
|
|
5
6
|
PROJECT_PROFILE_PROBES,
|
|
6
7
|
autoApproveApprovals,
|
|
8
|
+
buildHostProfile,
|
|
7
9
|
canAutoRollback,
|
|
8
10
|
canRequestPatchRepair,
|
|
11
|
+
collectHostSignals,
|
|
9
12
|
commandForScript,
|
|
10
13
|
decideNextAction,
|
|
14
|
+
deepFreeze,
|
|
11
15
|
defaultPermissions,
|
|
12
16
|
deriveContextSearchQueries,
|
|
13
17
|
describeCommandDiscovery,
|
|
@@ -27,6 +31,10 @@ import {
|
|
|
27
31
|
extractPatchPaths,
|
|
28
32
|
extractUnifiedDiff,
|
|
29
33
|
goalForAgentPreset,
|
|
34
|
+
inferCapabilities,
|
|
35
|
+
inferConstraints,
|
|
36
|
+
inferOptionalIdentity,
|
|
37
|
+
inferTransport,
|
|
30
38
|
inferUserLanguage,
|
|
31
39
|
initialAgentState,
|
|
32
40
|
invokeAction,
|
|
@@ -73,7 +81,7 @@ import {
|
|
|
73
81
|
timeout,
|
|
74
82
|
unappliedPatchStack,
|
|
75
83
|
workspaceValidationStatus
|
|
76
|
-
} from "../chunk-
|
|
84
|
+
} from "../chunk-AI3M6624.js";
|
|
77
85
|
import "../chunk-UCUBNWM2.js";
|
|
78
86
|
import "../chunk-TN2P7RNK.js";
|
|
79
87
|
import "../chunk-UB4B6OFY.js";
|
|
@@ -81,14 +89,18 @@ import "../chunk-FNWOH2T2.js";
|
|
|
81
89
|
import "../chunk-3RG5ZIWI.js";
|
|
82
90
|
export {
|
|
83
91
|
AGENT_CONFIG_FILE_NAMES,
|
|
92
|
+
CI_INDICATORS,
|
|
84
93
|
NodeShell,
|
|
85
94
|
PROJECT_LOCKFILE_PROBES,
|
|
86
95
|
PROJECT_PROFILE_PROBES,
|
|
87
96
|
autoApproveApprovals,
|
|
97
|
+
buildHostProfile,
|
|
88
98
|
canAutoRollback,
|
|
89
99
|
canRequestPatchRepair,
|
|
100
|
+
collectHostSignals,
|
|
90
101
|
commandForScript,
|
|
91
102
|
decideNextAction,
|
|
103
|
+
deepFreeze,
|
|
92
104
|
defaultPermissions,
|
|
93
105
|
deriveContextSearchQueries,
|
|
94
106
|
describeCommandDiscovery,
|
|
@@ -108,6 +120,10 @@ export {
|
|
|
108
120
|
extractPatchPaths,
|
|
109
121
|
extractUnifiedDiff,
|
|
110
122
|
goalForAgentPreset,
|
|
123
|
+
inferCapabilities,
|
|
124
|
+
inferConstraints,
|
|
125
|
+
inferOptionalIdentity,
|
|
126
|
+
inferTransport,
|
|
111
127
|
inferUserLanguage,
|
|
112
128
|
initialAgentState,
|
|
113
129
|
invokeAction,
|