@hachej/boring-agent 0.1.20 → 0.1.23

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.
@@ -1,8 +1,8 @@
1
1
  import { S as Sandbox, f as SandboxHandleStore, e as SandboxHandleRecord, W as Workspace, F as FileSearch, P as PluginRestartWarning } from '../agentPluginEvents-zyIvVjsA.js';
2
2
  import { Sandbox as Sandbox$1 } from '@vercel/sandbox';
3
3
  import { FastifyInstance, FastifyRequest, FastifyPluginAsync } from 'fastify';
4
- import { A as AgentTool, g as AgentHarnessFactory } from '../harness-DRrTn_5T.js';
5
- export { h as AgentHarnessFactoryInput } from '../harness-DRrTn_5T.js';
4
+ import { f as TelemetrySink, A as AgentTool, i as AgentHarnessFactory } from '../harness-BCit36Ha.js';
5
+ export { j as AgentHarnessFactoryInput } from '../harness-BCit36Ha.js';
6
6
  import { PackageSource, ExtensionFactory, SettingsManager } from '@mariozechner/pi-coding-agent';
7
7
  import 'ai';
8
8
 
@@ -181,12 +181,12 @@ declare function fileRoutes(app: FastifyInstance, opts: {
181
181
  getWorkspace?: (request: FastifyRequest) => Workspace | Promise<Workspace>;
182
182
  }, done: (err?: Error) => void): void;
183
183
 
184
- interface RuntimeTemplateContribution {
184
+ interface RuntimeTemplateContribution$1 {
185
185
  id: string;
186
186
  path: string | URL;
187
187
  target?: string;
188
188
  }
189
- interface RuntimePythonSpec {
189
+ interface RuntimePythonSpec$1 {
190
190
  id: string;
191
191
  /** uv-compatible pyproject.toml. Console scripts declared here are exposed to the agent. */
192
192
  projectFile: string | URL;
@@ -195,23 +195,23 @@ interface RuntimePythonSpec {
195
195
  /** Env vars exported by command shims, e.g. plugin builtin paths. */
196
196
  env?: Record<string, string | URL>;
197
197
  }
198
- interface RuntimeNodePackageSpec {
198
+ interface RuntimeNodePackageSpec$1 {
199
199
  id: string;
200
200
  /** Package name materialized under workspaceRoot/node_modules, e.g. @boring/workspace. */
201
201
  packageName: string;
202
202
  /** Source package root. The provisioner copies the built package payload into node_modules. */
203
203
  packageRoot: string | URL;
204
204
  }
205
- interface RuntimeProvisioningContribution {
206
- templateDirs?: RuntimeTemplateContribution[];
207
- python?: RuntimePythonSpec[];
208
- nodePackages?: RuntimeNodePackageSpec[];
205
+ interface RuntimeProvisioningContribution$1 {
206
+ templateDirs?: RuntimeTemplateContribution$1[];
207
+ python?: RuntimePythonSpec$1[];
208
+ nodePackages?: RuntimeNodePackageSpec$1[];
209
209
  }
210
210
  interface ProvisionRuntimeWorkspaceOptions {
211
211
  workspaceRoot: string;
212
212
  contributions?: Array<{
213
213
  id: string;
214
- provisioning?: RuntimeProvisioningContribution;
214
+ provisioning?: RuntimeProvisioningContribution$1;
215
215
  }>;
216
216
  force?: boolean;
217
217
  }
@@ -223,6 +223,31 @@ interface RuntimeWorkspaceProvisioningResult {
223
223
  }
224
224
  declare function provisionRuntimeWorkspace({ workspaceRoot, contributions, force, }: ProvisionRuntimeWorkspaceOptions): Promise<RuntimeWorkspaceProvisioningResult>;
225
225
 
226
+ interface BoringAgentRuntimePaths {
227
+ /** Runtime-visible workspace root. This is BORING_AGENT_WORKSPACE_ROOT. */
228
+ workspaceRoot: string;
229
+ agentDir: string;
230
+ node: string;
231
+ nodeModules: string;
232
+ nodeBin: string;
233
+ venv: string;
234
+ venvBin: string;
235
+ venvPython: string;
236
+ sdk: string;
237
+ uvHome: string;
238
+ uvBin: string;
239
+ skills: string;
240
+ cache: string;
241
+ nodeCache: string;
242
+ uvCache: string;
243
+ pipCache: string;
244
+ tmp: string;
245
+ }
246
+ declare function getBoringAgentRuntimePaths(runtimeWorkspaceRoot: string): BoringAgentRuntimePaths;
247
+ declare function getBoringAgentPathEntries(paths: BoringAgentRuntimePaths): string[];
248
+ declare function getBoringAgentRuntimeEnv(paths: BoringAgentRuntimePaths, adapterCacheRoot?: string): Record<string, string>;
249
+
250
+ declare const VERCEL_SANDBOX_WORKSPACE_ROOT = "/workspace";
226
251
  interface VercelSandboxWorkspace extends Workspace {
227
252
  invalidateMetadataCache(): void;
228
253
  }
@@ -231,6 +256,120 @@ interface VercelSandboxWorkspaceOptions {
231
256
  }
232
257
  declare function createVercelSandboxWorkspace(sandbox: Sandbox$1, workspaceOpts?: VercelSandboxWorkspaceOptions): VercelSandboxWorkspace;
233
258
 
259
+ interface ProvisioningLogger {
260
+ info?(message: string, fields?: Record<string, unknown>): void;
261
+ warn?(message: string, fields?: Record<string, unknown>): void;
262
+ error?(message: string, fields?: Record<string, unknown>): void;
263
+ }
264
+
265
+ interface PluginSkillSource {
266
+ name: string;
267
+ source: string | URL;
268
+ }
269
+ interface RuntimeTemplateContribution {
270
+ id: string;
271
+ path: string | URL;
272
+ target?: string;
273
+ }
274
+ interface RuntimePythonSpec {
275
+ id: string;
276
+ projectFile: string | URL;
277
+ packageName?: string;
278
+ packageRoot?: string | URL;
279
+ version?: string;
280
+ extraLibs?: string[];
281
+ env?: Record<string, string | URL>;
282
+ expectedBins?: string[];
283
+ }
284
+ interface RuntimeNodePackageSpec {
285
+ id: string;
286
+ packageName: string;
287
+ packageRoot?: string | URL;
288
+ version?: string;
289
+ expectedBins?: string[];
290
+ }
291
+ interface RuntimeProvisioningContribution {
292
+ templateDirs?: RuntimeTemplateContribution[];
293
+ python?: RuntimePythonSpec[];
294
+ nodePackages?: RuntimeNodePackageSpec[];
295
+ }
296
+ interface WorkspaceProvisioningResult {
297
+ changed: boolean;
298
+ env: Record<string, string>;
299
+ pathEntries: string[];
300
+ skillPaths: string[];
301
+ }
302
+ interface WorkspaceProvisioningExecResult {
303
+ stdout?: string;
304
+ stderr?: string;
305
+ }
306
+ interface WorkspaceProvisioningAdapter {
307
+ mode: 'direct' | 'local' | 'vercel-sandbox';
308
+ exec(command: string, args: string[], opts?: {
309
+ cwd?: string;
310
+ env?: Record<string, string>;
311
+ timeoutMs?: number;
312
+ }): Promise<WorkspaceProvisioningExecResult | void>;
313
+ resolveInstallSource(source: string | URL, opts: {
314
+ kind: 'node' | 'python';
315
+ id: string;
316
+ fingerprint: string;
317
+ }): Promise<string>;
318
+ workspaceFs: {
319
+ exists(workspaceRelativePath: string): Promise<boolean>;
320
+ /** Remove a workspace-relative generated path. Missing path is success. */
321
+ rm(workspaceRelativePath: string): Promise<void>;
322
+ /** Create a workspace-relative directory recursively. */
323
+ mkdir(workspaceRelativePath: string): Promise<void>;
324
+ writeText(workspaceRelativePath: string, content: string): Promise<void>;
325
+ readText(workspaceRelativePath: string): Promise<string | null>;
326
+ /** Copy a host file or directory into the workspace; directory copies are recursive. */
327
+ copyFromHost(hostSourcePath: string | URL, workspaceRelativeTarget: string): Promise<void>;
328
+ };
329
+ getRuntimeCacheRoot(): string;
330
+ }
331
+ interface ProvisioningTelemetryContext {
332
+ workspaceId?: string;
333
+ sessionId?: string;
334
+ requestId?: string;
335
+ runtimeMode?: string;
336
+ }
337
+ interface ProvisionWorkspaceRuntimeOptions {
338
+ plugins: Array<{
339
+ id: string;
340
+ skills?: PluginSkillSource[];
341
+ provisioning?: RuntimeProvisioningContribution;
342
+ }>;
343
+ adapter: WorkspaceProvisioningAdapter;
344
+ runtimeLayout: BoringAgentRuntimePaths;
345
+ logger?: ProvisioningLogger;
346
+ telemetry?: TelemetrySink;
347
+ telemetryContext?: ProvisioningTelemetryContext;
348
+ }
349
+
350
+ declare function provisionWorkspaceRuntime(opts: ProvisionWorkspaceRuntimeOptions): Promise<WorkspaceProvisioningResult>;
351
+
352
+ declare const VERCEL_PROVISIONING_CACHE_ROOT = "/tmp/boring-agent-cache";
353
+ interface VercelProvisioningArtifactRequest {
354
+ kind: 'node' | 'python';
355
+ id: string;
356
+ fingerprint: string;
357
+ source: string | URL;
358
+ outputPath: string;
359
+ }
360
+ interface CreateVercelProvisioningAdapterOptions {
361
+ runtimeLayout: BoringAgentRuntimePaths;
362
+ workspaceFs: WorkspaceProvisioningAdapter['workspaceFs'];
363
+ exec(command: string, args: string[], opts?: {
364
+ cwd?: string;
365
+ env?: Record<string, string>;
366
+ timeoutMs?: number;
367
+ }): Promise<WorkspaceProvisioningExecResult | void>;
368
+ prepareArtifact(request: VercelProvisioningArtifactRequest): Promise<void>;
369
+ cacheRoot?: string;
370
+ }
371
+ declare function createVercelProvisioningAdapter(options: CreateVercelProvisioningAdapterOptions): WorkspaceProvisioningAdapter;
372
+
234
373
  type BuiltinRuntimeModeId = 'direct' | 'local' | 'vercel-sandbox';
235
374
  type RuntimeModeId = BuiltinRuntimeModeId | (string & {});
236
375
  interface RuntimeModeAdapter {
@@ -242,6 +381,7 @@ interface RuntimeModeAdapter {
242
381
  */
243
382
  readonly workspaceFsCapability?: Workspace['fsCapability'];
244
383
  create(ctx: ModeContext): Promise<RuntimeBundle>;
384
+ createProvisioningAdapter?(runtimeLayout: BoringAgentRuntimePaths, ctx?: ModeContext): WorkspaceProvisioningAdapter;
245
385
  dispose?(): Promise<void>;
246
386
  }
247
387
  interface ModeContext {
@@ -249,6 +389,8 @@ interface ModeContext {
249
389
  sessionId: string;
250
390
  workspaceId?: string;
251
391
  templatePath?: string;
392
+ requestId?: string;
393
+ telemetry?: TelemetrySink;
252
394
  }
253
395
  interface RuntimeBundle {
254
396
  workspace: Workspace;
@@ -342,8 +484,14 @@ interface CreateAgentAppOptions {
342
484
  harnessFactory?: AgentHarnessFactory;
343
485
  /** Optional pi adapter/runtime knobs used by the default harness. */
344
486
  pi?: PiHarnessOptions;
487
+ /** Optional runtime provisioning result used to wire generated PATH/env/skills into tools and Pi. */
488
+ runtimeProvisioning?: WorkspaceProvisioningResult;
489
+ /** Optional dynamic runtime provisioning source used after /reload refreshes generated env/PATH. */
490
+ getRuntimeProvisioning?: () => WorkspaceProvisioningResult | undefined;
345
491
  /** Optional stable namespace for file-backed session storage. */
346
492
  sessionNamespace?: string;
493
+ /** Optional best-effort telemetry sink supplied by an embedding host. */
494
+ telemetry?: TelemetrySink;
347
495
  /** Optional explicit file-backed session directory. Mostly for tests/hosts. */
348
496
  sessionDir?: string;
349
497
  /**
@@ -400,6 +548,8 @@ interface RegisterAgentRoutesOptions {
400
548
  request?: FastifyRequest;
401
549
  }) => PiHarnessOptions | undefined | Promise<PiHarnessOptions | undefined>;
402
550
  sessionNamespace?: string;
551
+ /** Optional best-effort telemetry sink supplied by an embedding host. */
552
+ telemetry?: TelemetrySink;
403
553
  getSessionNamespace?: (ctx: {
404
554
  workspaceId: string;
405
555
  workspaceRoot: string;
@@ -409,6 +559,26 @@ interface RegisterAgentRoutesOptions {
409
559
  sandboxHandleStore?: SandboxHandleStore;
410
560
  getWorkspaceId?: (request: FastifyRequest) => string | Promise<string>;
411
561
  getWorkspaceRoot?: (workspaceId: string, request: FastifyRequest) => string | Promise<string>;
562
+ /**
563
+ * Optional runtime reconciliation hook. Callers own plugin discovery and may
564
+ * call provisionWorkspaceRuntime() with the normalized structural inputs.
565
+ * registerAgentRoutes only consumes the returned env/PATH/skill paths.
566
+ */
567
+ provisionRuntime?: (ctx: {
568
+ workspaceId: string;
569
+ workspaceRoot: string;
570
+ runtimeMode: RuntimeModeId;
571
+ runtimeLayout: BoringAgentRuntimePaths;
572
+ provisioningAdapter?: WorkspaceProvisioningAdapter;
573
+ request?: FastifyRequest;
574
+ }) => WorkspaceProvisioningResult | undefined | Promise<WorkspaceProvisioningResult | undefined>;
575
+ provisionWorkspace?: boolean;
576
+ /** Optional hook called before /api/v1/agent/reload reloads the harness. */
577
+ beforeReload?: (ctx: {
578
+ workspaceId: string;
579
+ workspaceRoot: string;
580
+ request: FastifyRequest;
581
+ }) => void | ReloadHookResult | undefined | Promise<void | ReloadHookResult | undefined>;
412
582
  }
413
583
  /**
414
584
  * Fastify plugin that mounts agent routes onto a host app (typically core-built).
@@ -430,4 +600,4 @@ interface Logger {
430
600
  }
431
601
  declare function createLogger(prefix: string): Logger;
432
602
 
433
- export { AgentHarnessFactory, type BuiltinRuntimeModeId, type CreateAgentAppOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, FileHandleStore, type LogFields, type Logger, type ModeContext, PI_PACKAGE_RESOURCE_FILTERS, type PiExtensionFactory, type PiHarnessOptions, type PiPackageSource, type ProvisionRuntimeWorkspaceOptions, type RegisterAgentRoutesOptions, type RuntimeBundle, type RuntimeModeAdapter, type RuntimeModeId, type RuntimeNodePackageSpec, type RuntimeProvisioningContribution, type RuntimePythonSpec, type RuntimeTemplateContribution, type RuntimeWorkspaceProvisioningResult, type SnapshotBakeOptions, type SnapshotBakeResult, UV_SETUP_COMMANDS, UV_SETUP_COMMANDS as VERCEL_UV_SETUP_COMMANDS, type VercelBakeClient, type VercelBakeSandbox, type VercelDeploymentSnapshotOptions, applyCspHeaders, autoDetectMode, bakeSnapshotIfNeeded, buildDeploymentSnapshotRecipe, buildPackageHash, buildSnapshotRecipeHash, compactPiPackages, createAgentApp, createBwrapSandbox, createDirectSandbox, createLogger, createNodeWorkspace, createResourceSettingsManager, createVercelDeploymentSnapshotProvider, createVercelSandboxWorkspace, fileRoutes, hasBwrap, mergePiPackageSources, piPackageSourceKey, prepareDeploymentSnapshot, prepareVercelDeploymentSnapshot, provisionRuntimeWorkspace, registerAgentRoutes, resolveMode, resolveSandboxHandle };
603
+ export { AgentHarnessFactory, type BoringAgentRuntimePaths, type BuiltinRuntimeModeId, type CreateAgentAppOptions, type CreateVercelProvisioningAdapterOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, FileHandleStore, type LogFields, type Logger, type ModeContext, PI_PACKAGE_RESOURCE_FILTERS, type PiExtensionFactory, type PiHarnessOptions, type PiPackageSource, type PluginSkillSource, type ProvisionRuntimeWorkspaceOptions, type ProvisionWorkspaceRuntimeOptions, type RegisterAgentRoutesOptions, type RuntimeBundle, type RuntimeModeAdapter, type RuntimeModeId, type RuntimeNodePackageSpec, type RuntimeProvisioningContribution, type RuntimePythonSpec, type RuntimeTemplateContribution, type RuntimeWorkspaceProvisioningResult, type SnapshotBakeOptions, type SnapshotBakeResult, UV_SETUP_COMMANDS, VERCEL_PROVISIONING_CACHE_ROOT, VERCEL_SANDBOX_WORKSPACE_ROOT, UV_SETUP_COMMANDS as VERCEL_UV_SETUP_COMMANDS, type VercelBakeClient, type VercelBakeSandbox, type VercelDeploymentSnapshotOptions, type VercelProvisioningArtifactRequest, type WorkspaceProvisioningAdapter, type WorkspaceProvisioningExecResult, type WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, bakeSnapshotIfNeeded, buildDeploymentSnapshotRecipe, buildPackageHash, buildSnapshotRecipeHash, compactPiPackages, createAgentApp, createBwrapSandbox, createDirectSandbox, createLogger, createNodeWorkspace, createResourceSettingsManager, createVercelDeploymentSnapshotProvider, createVercelProvisioningAdapter, createVercelSandboxWorkspace, fileRoutes, getBoringAgentPathEntries, getBoringAgentRuntimeEnv, getBoringAgentRuntimePaths, hasBwrap, mergePiPackageSources, piPackageSourceKey, prepareDeploymentSnapshot, prepareVercelDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, resolveMode, resolveSandboxHandle };