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.
@@ -0,0 +1,631 @@
1
+ import { A as Async } from './effect-DbEMiMvv.js';
2
+
3
+ /** Per-arm statistics for Thompson Sampling (Beta distribution). */
4
+ type ArmStats = {
5
+ readonly alpha: number;
6
+ readonly beta: number;
7
+ readonly pulls: number;
8
+ readonly lastPulledAt: number;
9
+ };
10
+ /** The complete persisted bandit state. */
11
+ type BanditState = {
12
+ readonly version: 1;
13
+ readonly arms: Readonly<Record<string, ArmStats>>;
14
+ readonly log: readonly AttributionLogEntry[];
15
+ };
16
+ /** A single attribution log entry for one agent run. */
17
+ type AttributionLogEntry = {
18
+ readonly timestamp: number;
19
+ readonly pulledArms: readonly string[];
20
+ readonly filesPerArm: Readonly<Record<string, readonly string[]>>;
21
+ readonly reward: number;
22
+ };
23
+
24
+ type HostSignalSource = "argv" | "env-key" | "stdio" | "parent-process" | "workspace-marker" | "protocol-handshake" | "config";
25
+ type HostSignal = {
26
+ readonly source: HostSignalSource;
27
+ readonly value: string;
28
+ };
29
+ type HostTransport = "stdio" | "terminal" | "mcp" | "extension" | "ci" | "unknown";
30
+ type HostCapabilities = {
31
+ readonly hasOwnLLM: boolean;
32
+ readonly wantsJson: boolean;
33
+ readonly supportsStreamingEvents: boolean;
34
+ readonly supportsMcp: boolean;
35
+ readonly canAskApproval: boolean;
36
+ readonly canRenderDiff: boolean;
37
+ readonly canApplyPatch: boolean;
38
+ readonly interactiveTty: boolean;
39
+ };
40
+ type HostConstraints = {
41
+ readonly readOnlyByDefault: boolean;
42
+ readonly patchPreviewRequired: boolean;
43
+ readonly requireNoNetwork: boolean;
44
+ };
45
+ type HostIdentity = {
46
+ readonly name: string;
47
+ readonly confidence: number;
48
+ };
49
+ type HostProfile = {
50
+ readonly transport: HostTransport;
51
+ readonly capabilities: HostCapabilities;
52
+ readonly constraints: HostConstraints;
53
+ readonly identity: HostIdentity | undefined;
54
+ readonly evidence: readonly HostSignal[];
55
+ };
56
+ /**
57
+ * Recursively freezes an object and all nested objects/arrays so that
58
+ * Object.isFrozen returns true at every nesting level. Attempted mutations
59
+ * throw TypeError in strict mode.
60
+ */
61
+ declare const deepFreeze: <T extends object>(obj: T) => Readonly<T>;
62
+
63
+ type AgentPreset = "fix-tests" | "inspect" | "typecheck" | "lint";
64
+ type AgentBatchGoal = string | {
65
+ readonly goal?: string;
66
+ readonly preset?: AgentPreset;
67
+ readonly mode?: AgentMode;
68
+ readonly cwd?: string;
69
+ readonly patchFile?: string;
70
+ readonly patchFileMode?: "apply" | "rollback";
71
+ readonly saveRunDir?: string;
72
+ };
73
+ type AgentBatchConfig = {
74
+ /** Goals to execute sequentially when no --batch-file is provided. */
75
+ readonly goals?: readonly AgentBatchGoal[];
76
+ /** Stop after the first failed run. Default: true in --ci mode, false otherwise. */
77
+ readonly stopOnFailure?: boolean;
78
+ };
79
+ declare const isAgentPreset: (value: string) => value is AgentPreset;
80
+ declare const goalForAgentPreset: (preset: AgentPreset) => string;
81
+
82
+ type PatchStrategy = "direct-patch" | "multi-step-patch" | "propose-then-refine";
83
+ type BanditAlgorithm = "thompson" | "exp3";
84
+ type PatchStrategyConfig = {
85
+ readonly algorithm?: BanditAlgorithm;
86
+ readonly gamma?: number;
87
+ readonly enabled?: boolean;
88
+ };
89
+ type RewardEntry = {
90
+ readonly arm: PatchStrategy;
91
+ readonly reward: number;
92
+ readonly timestamp: number;
93
+ };
94
+
95
+ type AgentConfigApprovalMode = "auto" | "interactive" | "approve" | "deny";
96
+ type AgentConfigLLMProvider = "fake" | "google" | "gemini" | "openai" | "openai-compatible";
97
+ type AgentLLMConfig = {
98
+ readonly provider?: AgentConfigLLMProvider;
99
+ readonly model?: string;
100
+ readonly endpoint?: string;
101
+ readonly baseUrl?: string;
102
+ readonly apiVersion?: string;
103
+ readonly apiKeyEnv?: string;
104
+ readonly systemInstruction?: string;
105
+ readonly temperature?: number;
106
+ readonly topP?: number;
107
+ readonly topK?: number;
108
+ readonly maxOutputTokens?: number;
109
+ readonly fakeResponse?: string;
110
+ };
111
+ type ShellAskRule = string | {
112
+ readonly pattern: string;
113
+ readonly reason?: string;
114
+ readonly risk?: ApprovalRisk;
115
+ readonly defaultAnswer?: ApprovalDefaultAnswer;
116
+ };
117
+ type ShellPermissionConfig = {
118
+ /**
119
+ * When true or omitted, the built-in safe read/validation commands remain
120
+ * allowed. Set to false for a strict allowlist defined only by this file.
121
+ */
122
+ readonly inheritDefaults?: boolean;
123
+ readonly allow?: readonly string[];
124
+ readonly ask?: readonly ShellAskRule[];
125
+ readonly deny?: readonly string[];
126
+ };
127
+ type PatchApplyPermissionConfig = "allow" | "ask" | "deny" | {
128
+ readonly decision?: "allow" | "ask" | "deny";
129
+ readonly reason?: string;
130
+ readonly risk?: ApprovalRisk;
131
+ readonly defaultAnswer?: ApprovalDefaultAnswer;
132
+ };
133
+ type AgentPermissionConfig = {
134
+ readonly shell?: ShellPermissionConfig;
135
+ readonly patchApply?: PatchApplyPermissionConfig;
136
+ };
137
+ type AgentConfig = {
138
+ readonly mode?: AgentMode;
139
+ readonly approval?: AgentConfigApprovalMode;
140
+ readonly llm?: AgentLLMConfig;
141
+ readonly project?: AgentProjectConfig;
142
+ readonly context?: AgentContextConfig;
143
+ readonly patchQuality?: AgentPatchQualityConfig;
144
+ readonly rollback?: AgentRollbackConfig;
145
+ readonly redaction?: AgentRedactionConfig;
146
+ readonly language?: AgentLanguageConfig;
147
+ readonly permissions?: AgentPermissionConfig;
148
+ readonly tools?: AgentToolPolicyConfig;
149
+ readonly batch?: AgentBatchConfig;
150
+ readonly patchStrategy?: PatchStrategyConfig;
151
+ readonly budget?: BudgetConfigInput;
152
+ };
153
+ type LoadedAgentConfig = {
154
+ readonly path?: string;
155
+ readonly config: AgentConfig;
156
+ };
157
+ declare const isAgentConfigMode: (value: string) => value is AgentMode;
158
+ declare const isAgentConfigApprovalMode: (value: string) => value is AgentConfigApprovalMode;
159
+ declare const isAgentConfigLLMProvider: (value: string) => value is AgentConfigLLMProvider;
160
+ declare const AGENT_CONFIG_FILE_NAMES: readonly [".brass-agent.json", "brass-agent.config.json"];
161
+
162
+ type ModelTier = "small" | "large";
163
+ type ModelTiersConfig = Readonly<Record<ModelTier, AgentLLMConfig>>;
164
+ type BudgetConfigInput = {
165
+ readonly tokenBudget?: number;
166
+ readonly overshootFraction?: number;
167
+ readonly enabled?: boolean;
168
+ readonly modelTiers?: ModelTiersConfig;
169
+ };
170
+ type TokenUsage = {
171
+ readonly inputTokens: number;
172
+ readonly outputTokens: number;
173
+ };
174
+ type ConfidenceSignals = {
175
+ readonly hasDiffBlock: boolean;
176
+ readonly isConcise: boolean;
177
+ readonly referencesGoal: boolean;
178
+ readonly referencesReadFiles: boolean;
179
+ readonly hedgingCount: number;
180
+ };
181
+ type ComplexitySignals = {
182
+ readonly goalLength: number;
183
+ readonly filesRead: number;
184
+ readonly searchMatches: number;
185
+ readonly hasValidationErrors: boolean;
186
+ readonly repairAttempts: number;
187
+ };
188
+ type BudgetEvent = {
189
+ readonly type: "budget.usage";
190
+ readonly usage: TokenUsage;
191
+ readonly cumulative: {
192
+ readonly totalTokens: number;
193
+ readonly callCount: number;
194
+ };
195
+ readonly tier: ModelTier;
196
+ readonly remaining: number;
197
+ readonly at: number;
198
+ } | {
199
+ readonly type: "budget.routed";
200
+ readonly tier: ModelTier;
201
+ readonly signals: ComplexitySignals;
202
+ readonly resolvedProvider: string | undefined;
203
+ readonly at: number;
204
+ } | {
205
+ readonly type: "budget.confidence";
206
+ readonly score: number;
207
+ readonly signals: ConfidenceSignals;
208
+ readonly purpose: LLMPurpose;
209
+ readonly at: number;
210
+ } | {
211
+ readonly type: "budget.warning";
212
+ readonly totalTokens: number;
213
+ readonly tokenBudget: number;
214
+ readonly at: number;
215
+ } | {
216
+ readonly type: "budget.exceeded";
217
+ readonly totalTokens: number;
218
+ readonly tokenBudget: number;
219
+ readonly overshootFraction: number;
220
+ readonly hardCap: number;
221
+ readonly at: number;
222
+ };
223
+
224
+ type AgentMode = "read-only" | "propose" | "write" | "autonomous";
225
+ type AgentPackageManager = "npm" | "pnpm" | "yarn" | "bun";
226
+ type AgentPackageManagerConfig = AgentPackageManager | "auto";
227
+ type AgentResponseLanguage = "auto" | "match-user" | "en" | "es" | "pt" | "fr" | "de" | "it" | "custom";
228
+ type AgentLanguageConfig = {
229
+ /** Natural language used for LLM-facing responses. Default: auto, which matches the user goal when possible. */
230
+ readonly response?: AgentResponseLanguage;
231
+ /** Human-readable language name used when response is custom, e.g. "Argentinian Spanish". */
232
+ readonly custom?: string;
233
+ };
234
+ type AgentContextConfig = {
235
+ /** Enable or disable context discovery before the first LLM planning call. Default: true. */
236
+ readonly enabled?: boolean;
237
+ /** Maximum searchText actions to run before planning. Default: 3. */
238
+ readonly maxSearchQueries?: number;
239
+ /** Maximum distinct files to read from direct error paths and search results. Default: 4. */
240
+ readonly maxFiles?: number;
241
+ /** Maximum matches to consider from search results when selecting files. Default: 40. */
242
+ readonly maxSearchResults?: number;
243
+ /** Ripgrep globs used for context searches. */
244
+ readonly globs?: readonly string[];
245
+ /** Glob-like paths excluded from context reads/searches, e.g. secrets/** or *.pem. */
246
+ readonly excludeGlobs?: readonly string[];
247
+ };
248
+ type AgentRedactionConfig = {
249
+ /** Redact likely secrets before prompts/protocol summaries. Default: true. */
250
+ readonly enabled?: boolean;
251
+ /** Extra regular-expression source strings to redact. Invalid patterns are ignored. */
252
+ readonly additionalPatterns?: readonly string[];
253
+ };
254
+ type AgentPatchQualityConfig = {
255
+ /** Enable repair attempts after generated patches fail to apply or fail validation. Default: true. */
256
+ readonly enabled?: boolean;
257
+ /** Number of llm.patch repair calls after the initial generated patch. Default: 1. */
258
+ readonly maxRepairAttempts?: number;
259
+ };
260
+ type AgentRollbackConfig = {
261
+ /** Enable automatic rollback safety for generated patches. Default: true. */
262
+ readonly enabled?: boolean;
263
+ /** Roll back generated patches when final validation still fails and no repair remains. Default: true. */
264
+ readonly onFinalValidationFailure?: boolean;
265
+ /** Roll back only the latest patch or the full generated patch stack. Default: all. */
266
+ readonly strategy?: "last" | "all";
267
+ /** Maximum automatic rollback actions in one run. Default: 8. */
268
+ readonly maxRollbackDepth?: number;
269
+ /** Re-run validation after automatic rollback completes. Default: true. */
270
+ readonly runValidationAfterRollback?: boolean;
271
+ /** Allow automatic rollback for exact supplied patches. Default: false. */
272
+ readonly allowForSuppliedPatches?: boolean;
273
+ };
274
+ type AgentProjectConfig = {
275
+ /** Force a package manager or let the agent infer it from package.json and lockfiles. */
276
+ readonly packageManager?: AgentPackageManagerConfig;
277
+ /** Exact validation commands to run. When present, discovery from package.json is skipped. */
278
+ readonly validationCommands?: readonly string[];
279
+ /** Ordered script names to consider as the primary test command. */
280
+ readonly testScriptNames?: readonly string[];
281
+ /** Include a typecheck/check script even when the goal does not mention it. */
282
+ readonly includeTypecheck?: boolean;
283
+ /** Include a lint script even when the goal does not mention it. */
284
+ readonly includeLint?: boolean;
285
+ /** Bound the amount of validation work discovered automatically. Default: 2. */
286
+ readonly maxValidationCommands?: number;
287
+ };
288
+ type AgentGoal = {
289
+ readonly id: string;
290
+ readonly cwd: string;
291
+ readonly text: string;
292
+ readonly mode: AgentMode;
293
+ readonly project?: AgentProjectConfig;
294
+ readonly context?: AgentContextConfig;
295
+ readonly patchQuality?: AgentPatchQualityConfig;
296
+ readonly rollback?: AgentRollbackConfig;
297
+ readonly redaction?: AgentRedactionConfig;
298
+ readonly language?: AgentLanguageConfig;
299
+ /** Optional precomputed unified diff. Used by trusted clients after a patch preview approval. */
300
+ readonly initialPatch?: string;
301
+ /** How to materialize initialPatch in write/autonomous mode. Default: apply. */
302
+ readonly initialPatchMode?: "apply" | "rollback";
303
+ /** Whether an LLM provider is available for planning/repair. */
304
+ readonly llmAvailable?: boolean;
305
+ /** Optional bandit state for adaptive context budget prioritization. */
306
+ readonly banditState?: BanditState;
307
+ /** Patch strategy configuration from .brass-agent.json. */
308
+ readonly patchStrategy?: PatchStrategyConfig;
309
+ /** Historical reward data loaded at boot. */
310
+ readonly rewardHistory?: readonly RewardEntry[];
311
+ /** Optional budget configuration for token budget tracking and model routing. */
312
+ readonly budget?: BudgetConfigInput;
313
+ };
314
+ type AgentPhase = "boot" | "discovering" | "planning" | "validating" | "proposing" | "done" | "failed";
315
+ type AgentState = {
316
+ readonly goal: AgentGoal;
317
+ readonly phase: AgentPhase;
318
+ readonly observations: readonly Observation[];
319
+ readonly errors: readonly AgentError[];
320
+ readonly steps: number;
321
+ };
322
+ type AgentEvent = {
323
+ readonly type: "agent.run.started";
324
+ readonly goal: AgentGoal;
325
+ readonly at: number;
326
+ } | {
327
+ readonly type: "agent.action.started";
328
+ readonly action: AgentAction;
329
+ readonly step: number;
330
+ readonly phase: AgentPhase;
331
+ readonly at: number;
332
+ } | {
333
+ readonly type: "agent.action.completed";
334
+ readonly action: AgentAction;
335
+ readonly observation: Observation;
336
+ readonly step: number;
337
+ readonly phase: AgentPhase;
338
+ readonly durationMs: number;
339
+ readonly at: number;
340
+ } | {
341
+ readonly type: "agent.action.failed";
342
+ readonly action: AgentAction;
343
+ readonly error: AgentError;
344
+ readonly step: number;
345
+ readonly phase: AgentPhase;
346
+ readonly durationMs: number;
347
+ readonly at: number;
348
+ } | {
349
+ readonly type: "agent.observation.recorded";
350
+ readonly observation: Observation;
351
+ readonly step: number;
352
+ readonly phase: AgentPhase;
353
+ readonly at: number;
354
+ } | {
355
+ readonly type: "agent.tool.timeout";
356
+ readonly action: AgentAction;
357
+ readonly step: number;
358
+ readonly phase: AgentPhase;
359
+ readonly timeoutMs: number;
360
+ readonly at: number;
361
+ } | {
362
+ readonly type: "agent.permission.denied";
363
+ readonly action: AgentAction;
364
+ readonly step: number;
365
+ readonly phase: AgentPhase;
366
+ readonly reason: string;
367
+ readonly at: number;
368
+ } | {
369
+ readonly type: "agent.approval.requested";
370
+ readonly action: AgentAction;
371
+ readonly step: number;
372
+ readonly phase: AgentPhase;
373
+ readonly reason: string;
374
+ readonly risk: ApprovalRisk;
375
+ readonly defaultAnswer: ApprovalDefaultAnswer;
376
+ readonly at: number;
377
+ } | {
378
+ readonly type: "agent.approval.resolved";
379
+ readonly action: AgentAction;
380
+ readonly step: number;
381
+ readonly phase: AgentPhase;
382
+ readonly approved: boolean;
383
+ readonly reason?: string;
384
+ readonly at: number;
385
+ } | {
386
+ readonly type: "agent.patch.applied";
387
+ readonly step: number;
388
+ readonly phase: AgentPhase;
389
+ readonly changedFiles: readonly string[];
390
+ readonly automaticRollbackEligible?: boolean;
391
+ readonly at: number;
392
+ } | {
393
+ readonly type: "agent.patch.rolledBack";
394
+ readonly step: number;
395
+ readonly phase: AgentPhase;
396
+ readonly changedFiles: readonly string[];
397
+ readonly automatic?: boolean;
398
+ readonly reason?: string;
399
+ readonly at: number;
400
+ } | {
401
+ readonly type: "agent.run.completed";
402
+ readonly goal: AgentGoal;
403
+ readonly status: "done" | "failed";
404
+ readonly phase: AgentPhase;
405
+ readonly steps: number;
406
+ readonly durationMs: number;
407
+ readonly at: number;
408
+ } | BudgetEvent;
409
+ type AgentEventSink = {
410
+ readonly emit: (event: AgentEvent) => void;
411
+ };
412
+ type LLMPurpose = "plan" | "patch" | "explain";
413
+ type AgentAction = {
414
+ readonly type: "fs.readFile";
415
+ readonly path: string;
416
+ } | {
417
+ readonly type: "fs.exists";
418
+ readonly path: string;
419
+ } | {
420
+ readonly type: "fs.searchText";
421
+ readonly query: string;
422
+ readonly globs?: readonly string[];
423
+ } | {
424
+ readonly type: "shell.exec";
425
+ readonly command: readonly string[];
426
+ readonly cwd?: string;
427
+ } | {
428
+ readonly type: "llm.complete";
429
+ readonly purpose: LLMPurpose;
430
+ readonly prompt: string;
431
+ } | {
432
+ readonly type: "patch.propose";
433
+ readonly patch: string;
434
+ } | {
435
+ readonly type: "patch.apply";
436
+ readonly patch: string;
437
+ } | {
438
+ readonly type: "patch.rollback";
439
+ readonly patch: string;
440
+ readonly automatic?: boolean;
441
+ readonly reason?: string;
442
+ } | {
443
+ readonly type: "agent.finish";
444
+ readonly summary: string;
445
+ } | {
446
+ readonly type: "agent.fail";
447
+ readonly reason: string;
448
+ };
449
+ type AgentActionType = AgentAction["type"];
450
+ type AgentToolPolicyOverride = {
451
+ readonly timeoutMs?: number;
452
+ readonly retries?: number;
453
+ };
454
+ type AgentToolPolicyConfig = Partial<Record<AgentActionType, AgentToolPolicyOverride>>;
455
+ type Observation = {
456
+ readonly type: "fs.fileRead";
457
+ readonly path: string;
458
+ readonly content: string;
459
+ } | {
460
+ readonly type: "fs.exists";
461
+ readonly path: string;
462
+ readonly exists: boolean;
463
+ } | {
464
+ readonly type: "fs.searchResult";
465
+ readonly query: string;
466
+ readonly matches: readonly SearchMatch[];
467
+ } | {
468
+ readonly type: "shell.result";
469
+ readonly command: readonly string[];
470
+ readonly exitCode: number;
471
+ readonly stdout: string;
472
+ readonly stderr: string;
473
+ } | {
474
+ readonly type: "llm.response";
475
+ readonly purpose: LLMPurpose;
476
+ readonly content: string;
477
+ } | {
478
+ readonly type: "patch.proposed";
479
+ readonly patch: string;
480
+ } | {
481
+ readonly type: "patch.applied";
482
+ readonly changedFiles: readonly string[];
483
+ readonly patch?: string;
484
+ } | {
485
+ readonly type: "patch.rolledBack";
486
+ readonly changedFiles: readonly string[];
487
+ readonly patch?: string;
488
+ readonly automatic?: boolean;
489
+ readonly reason?: string;
490
+ } | {
491
+ readonly type: "agent.done";
492
+ readonly summary: string;
493
+ } | {
494
+ readonly type: "agent.error";
495
+ readonly error: AgentError;
496
+ };
497
+ type SearchMatch = {
498
+ readonly path: string;
499
+ readonly line: number;
500
+ readonly text: string;
501
+ };
502
+ type ExecResult = {
503
+ readonly exitCode: number;
504
+ readonly stdout: string;
505
+ readonly stderr: string;
506
+ };
507
+ type LLMRequest = {
508
+ readonly purpose: LLMPurpose;
509
+ readonly prompt: string;
510
+ };
511
+ type LLMResponse = {
512
+ readonly content: string;
513
+ readonly usage?: TokenUsage;
514
+ };
515
+ type AgentError = {
516
+ readonly _tag: "FsError";
517
+ readonly operation: string;
518
+ readonly cause: unknown;
519
+ } | {
520
+ readonly _tag: "ShellError";
521
+ readonly operation: string;
522
+ readonly command?: readonly string[];
523
+ readonly cause: unknown;
524
+ } | {
525
+ readonly _tag: "LLMError";
526
+ readonly cause: unknown;
527
+ } | {
528
+ readonly _tag: "PatchError";
529
+ readonly operation: string;
530
+ readonly cause: unknown;
531
+ readonly patch?: string;
532
+ } | {
533
+ readonly _tag: "PermissionDenied";
534
+ readonly action: AgentAction;
535
+ readonly reason: string;
536
+ } | {
537
+ readonly _tag: "ApprovalRejected";
538
+ readonly action: AgentAction;
539
+ readonly reason: string;
540
+ } | {
541
+ readonly _tag: "ToolTimeout";
542
+ readonly timeoutMs: number;
543
+ } | {
544
+ readonly _tag: "AgentLoopError";
545
+ readonly message: string;
546
+ } | {
547
+ readonly _tag: "PathOutsideWorkspace";
548
+ readonly path: string;
549
+ readonly cwd: string;
550
+ };
551
+ type FileSystem = {
552
+ readonly readFile: (path: string) => Async<unknown, AgentError, string>;
553
+ readonly exists: (path: string) => Async<unknown, AgentError, boolean>;
554
+ readonly searchText: (cwd: string, query: string, options?: {
555
+ readonly globs?: readonly string[];
556
+ }) => Async<unknown, AgentError, readonly SearchMatch[]>;
557
+ };
558
+ type Shell = {
559
+ readonly exec: (command: readonly string[], options: {
560
+ readonly cwd: string;
561
+ readonly stdin?: string;
562
+ }) => Async<unknown, AgentError, ExecResult>;
563
+ };
564
+ type LLM = {
565
+ readonly complete: (request: LLMRequest) => Async<unknown, AgentError, LLMResponse>;
566
+ };
567
+ type PatchApplyResult = {
568
+ readonly changedFiles: readonly string[];
569
+ };
570
+ type PatchService = {
571
+ readonly apply: (cwd: string, patch: string) => Async<unknown, AgentError, PatchApplyResult>;
572
+ /** Reverse-apply a unified diff, usually for manual rollback of an approved patch. */
573
+ readonly rollback: (cwd: string, patch: string) => Async<unknown, AgentError, PatchApplyResult>;
574
+ };
575
+ type ApprovalRisk = "low" | "medium" | "high";
576
+ type ApprovalDefaultAnswer = "approve" | "reject";
577
+ type ApprovalRequest = {
578
+ readonly action: AgentAction;
579
+ readonly state: AgentState;
580
+ readonly reason: string;
581
+ readonly risk: ApprovalRisk;
582
+ readonly defaultAnswer: ApprovalDefaultAnswer;
583
+ };
584
+ type ApprovalResponse = {
585
+ readonly type: "approved";
586
+ } | {
587
+ readonly type: "rejected";
588
+ readonly reason?: string;
589
+ };
590
+ type ApprovalService = {
591
+ readonly request: (request: ApprovalRequest) => Async<AgentEnv, AgentError, ApprovalResponse>;
592
+ };
593
+ type PermissionDecision = {
594
+ readonly type: "allow";
595
+ } | {
596
+ readonly type: "deny";
597
+ readonly reason: string;
598
+ } | {
599
+ readonly type: "ask";
600
+ readonly reason: string;
601
+ readonly risk: ApprovalRisk;
602
+ readonly defaultAnswer?: ApprovalDefaultAnswer;
603
+ };
604
+ type PermissionService = {
605
+ readonly check: (action: AgentAction, state: AgentState) => Async<AgentEnv, AgentError, PermissionDecision>;
606
+ };
607
+ type AgentEnv = {
608
+ readonly fs: FileSystem;
609
+ readonly shell: Shell;
610
+ readonly llm: LLM | undefined;
611
+ readonly patch: PatchService;
612
+ readonly permissions: PermissionService;
613
+ readonly approvals?: ApprovalService;
614
+ readonly events?: AgentEventSink;
615
+ readonly toolPolicies?: AgentToolPolicyConfig;
616
+ readonly hostProfile?: HostProfile;
617
+ };
618
+
619
+ type AgentWorkspaceDiscoveryResult = {
620
+ readonly inputCwd: string;
621
+ readonly cwd: string;
622
+ readonly marker?: string;
623
+ readonly markerPath?: string;
624
+ readonly changed: boolean;
625
+ readonly disabled?: boolean;
626
+ };
627
+ declare const discoverNodeWorkspaceRoot: (cwd: string, options?: {
628
+ readonly enabled?: boolean;
629
+ }) => AgentWorkspaceDiscoveryResult;
630
+
631
+ export { type ExecResult as $, type AgentMode as A, type BudgetConfigInput as B, type AgentActionType as C, type AgentBatchConfig as D, type AgentBatchGoal as E, type FileSystem as F, type AgentConfigApprovalMode as G, type HostProfile as H, type AgentConfigLLMProvider as I, type AgentContextConfig as J, type AgentEventSink as K, type LLM as L, type AgentLanguageConfig as M, type AgentPackageManagerConfig as N, type Observation as O, type PermissionService as P, type AgentPatchQualityConfig as Q, type AgentProjectConfig as R, type Shell as S, type AgentRollbackConfig as T, type AgentToolPolicyConfig as U, type AgentToolPolicyOverride as V, type AgentWorkspaceDiscoveryResult as W, type ApprovalDefaultAnswer as X, type ApprovalRequest as Y, type ApprovalResponse as Z, type ApprovalRisk as _, type AgentPreset as a, type HostSignalSource as a0, type LLMPurpose as a1, type LLMResponse as a2, type PatchApplyPermissionConfig as a3, type PatchApplyResult as a4, type PermissionDecision as a5, type SearchMatch as a6, type ShellAskRule as a7, type ShellPermissionConfig as a8, deepFreeze as a9, goalForAgentPreset as aa, isAgentConfigApprovalMode as ab, isAgentConfigLLMProvider as ac, isAgentConfigMode as ad, isAgentPreset as ae, type AgentResponseLanguage as b, type AgentConfig as c, discoverNodeWorkspaceRoot as d, type AgentLLMConfig as e, type AgentGoal as f, type AgentState as g, type AgentEnv as h, type AgentError as i, type AgentAction as j, type AgentEvent as k, type AgentPhase as l, type AgentPackageManager as m, type BanditState as n, type AgentRedactionConfig as o, type HostSignal as p, type HostTransport as q, type HostCapabilities as r, type HostConstraints as s, type HostIdentity as t, type AgentPermissionConfig as u, type ApprovalService as v, type PatchService as w, type LoadedAgentConfig as x, type LLMRequest as y, AGENT_CONFIG_FILE_NAMES as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brass-runtime",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "Effect runtime utilities for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Augusto Vivaldelli",
@@ -10,4 +10,4 @@
10
10
  ],
11
11
  "main": "brass_runtime_wasm_engine.js",
12
12
  "types": "brass_runtime_wasm_engine.d.ts"
13
- }
13
+ }