broods 0.3.0 → 0.4.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/dist/index.d.ts CHANGED
@@ -1,8 +1,19 @@
1
1
  import { SystemModelMessage, LanguageModelCallOptions, RequestOptions, streamText, JSONSchema7, ModelMessage, TextStreamPart, ToolSet } from 'ai';
2
- import { DiscordAdapterConfig } from '@chat-adapter/discord';
3
- import { GitHubAdapterConfig } from '@chat-adapter/github';
4
- import { SlackAdapterConfig } from '@chat-adapter/slack';
5
- import { TelegramAdapterConfig } from '@chat-adapter/telegram';
2
+
3
+ /**
4
+ * Supported account model provider names.
5
+ * Keep provider identifiers here so config validation and model resolution share one source.
6
+ */
7
+ declare const ACCOUNT_MODEL_PROVIDERS: {
8
+ readonly google: true;
9
+ readonly openai: true;
10
+ readonly anthropic: true;
11
+ readonly bedrock: true;
12
+ readonly gateway: true;
13
+ readonly minimax: true;
14
+ readonly custom: true;
15
+ };
16
+ type AccountModelProviderName = keyof typeof ACCOUNT_MODEL_PROVIDERS;
6
17
 
7
18
  /**
8
19
  * Agent policy contracts and validation.
@@ -43,21 +54,6 @@ interface AgentPolicyConfig {
43
54
  mode?: AgentPolicyMode;
44
55
  }
45
56
 
46
- /**
47
- * Supported account model provider names.
48
- * Keep provider identifiers here so config validation and model resolution share one source.
49
- */
50
- declare const ACCOUNT_MODEL_PROVIDERS: {
51
- readonly google: true;
52
- readonly openai: true;
53
- readonly anthropic: true;
54
- readonly bedrock: true;
55
- readonly gateway: true;
56
- readonly minimax: true;
57
- readonly custom: true;
58
- };
59
- type AccountModelProviderName = keyof typeof ACCOUNT_MODEL_PROVIDERS;
60
-
61
57
  /**
62
58
  * Agent configuration: types for the per-agent settings object, input
63
59
  * normalization, encryption helpers, patch-merge, and redaction.
@@ -232,9 +228,9 @@ type AgentChannelWorkspaceScope = {
232
228
  };
233
229
  interface AgentTelegramChannelConfig {
234
230
  id?: string;
235
- apiUrl?: TelegramAdapterConfig["apiUrl"];
236
- botToken?: TelegramAdapterConfig["botToken"];
237
- webhookSecret?: TelegramAdapterConfig["secretToken"];
231
+ apiUrl?: string;
232
+ botToken?: string;
233
+ webhookSecret?: string;
238
234
  allowedChatIds?: number[];
239
235
  reactionEmoji?: string;
240
236
  workspaceScope?: AgentChannelWorkspaceScope;
@@ -242,18 +238,10 @@ interface AgentTelegramChannelConfig {
242
238
  }
243
239
  interface AgentGitHubChannelConfig {
244
240
  id?: string;
245
- apiUrl?: Extract<GitHubAdapterConfig, {
246
- appId: string;
247
- }>["apiUrl"];
248
- webhookSecret?: Extract<GitHubAdapterConfig, {
249
- appId: string;
250
- }>["webhookSecret"];
251
- appId?: Extract<GitHubAdapterConfig, {
252
- appId: string;
253
- }>["appId"];
254
- privateKey?: Extract<GitHubAdapterConfig, {
255
- appId: string;
256
- }>["privateKey"];
241
+ apiUrl?: string;
242
+ webhookSecret?: string;
243
+ appId?: string;
244
+ privateKey?: string;
257
245
  allowedRepos?: string[];
258
246
  /** Bot username for @-mention detection (e.g. "my-bot" or "my-bot[bot]"). */
259
247
  userName?: string;
@@ -268,9 +256,9 @@ interface AgentGitHubChannelConfig {
268
256
  }
269
257
  interface AgentSlackChannelConfig {
270
258
  id?: string;
271
- apiUrl?: SlackAdapterConfig["apiUrl"];
259
+ apiUrl?: string;
272
260
  botToken?: string;
273
- signingSecret?: SlackAdapterConfig["signingSecret"];
261
+ signingSecret?: string;
274
262
  allowedChannelIds?: string[];
275
263
  reactionEmoji?: string;
276
264
  workspaceScope?: AgentChannelWorkspaceScope;
@@ -278,9 +266,9 @@ interface AgentSlackChannelConfig {
278
266
  }
279
267
  interface AgentDiscordChannelConfig {
280
268
  id?: string;
281
- apiUrl?: DiscordAdapterConfig["apiUrl"];
282
- botToken?: DiscordAdapterConfig["botToken"];
283
- publicKey?: DiscordAdapterConfig["publicKey"];
269
+ apiUrl?: string;
270
+ botToken?: string;
271
+ publicKey?: string;
284
272
  allowedGuildIds?: string[];
285
273
  workspaceScope?: AgentChannelWorkspaceScope;
286
274
  [key: string]: unknown;
@@ -304,10 +292,7 @@ interface AgentZaloChannelConfig {
304
292
  }
305
293
 
306
294
  /**
307
- * Cron-job types, input normalization, and patch-merge helpers.
308
- * Provider-agnostic — both the DynamoDB and Convex stores import the
309
- * normalizer at their create/update entry points so behaviour is
310
- * symmetric across modes.
295
+ * Cron-job records, input normalization, and patch-merge helpers.
311
296
  */
312
297
 
313
298
  type CronStatus = "active" | "paused";
@@ -366,9 +351,8 @@ type SandboxSize = "tiny" | "xsmall" | "small" | "medium" | "large";
366
351
  /**
367
352
  * Sandbox config: account-scoped, reusable sandbox definitions referenced by
368
353
  * agents via `config.sandbox`. A sandbox is a collection of Claude-Code-style
369
- * tools (bash/read/write/edit/glob/grep) backed by a provider. Validation +
370
- * the public projection live here; the
371
- * DynamoDB / Convex stores call these at their create/update entry points.
354
+ * tools (bash/read/write/edit/glob/grep) backed by a provider. Validation and
355
+ * the public projection live here.
372
356
  * Stored encrypted at rest because `envVars`/`options` may hold secrets.
373
357
  */
374
358
 
@@ -408,8 +392,8 @@ interface SandboxConfig {
408
392
  * agents via `config.workspaces[].workspaceId`. A workspace is the persistent
409
393
  * S3-backed filesystem mounted into a sandbox; agents referencing the same
410
394
  * workspaceId share the same files. Holds no secrets, so it is stored in
411
- * plaintext (unlike sandbox config). Validation + the public projection live
412
- * here; the DynamoDB / Convex stores call these at create/update.
395
+ * plaintext (unlike sandbox config). Validation and the public projection live
396
+ * here.
413
397
  */
414
398
  declare const WORKSPACE_STORAGE_PROVIDERS: readonly ["s3"];
415
399
  type WorkspaceStorageProvider = (typeof WORKSPACE_STORAGE_PROVIDERS)[number];
@@ -428,12 +412,18 @@ interface WorkspaceStorageConfig {
428
412
  prefix?: string;
429
413
  auth?: WorkspaceStorageAuth;
430
414
  }
415
+ interface WorkspaceHarnessConfig {
416
+ workspace?: {
417
+ enabled?: boolean;
418
+ };
419
+ memory?: {
420
+ enabled?: boolean;
421
+ };
422
+ }
431
423
  interface WorkspaceConfig {
432
424
  storage: WorkspaceStorageConfig;
433
425
  isolation?: boolean;
434
- harness?: {
435
- enabled?: boolean;
436
- };
426
+ harness?: WorkspaceHarnessConfig;
437
427
  }
438
428
 
439
429
  /**
@@ -565,7 +555,7 @@ type CliManifest = {
565
555
  };
566
556
 
567
557
  /**
568
- * Type contracts inherited from Convex and core storage/runtime modules.
558
+ * Type contracts inherited from Convex and core domain/runtime modules.
569
559
  * Keep this file type-only so the public SDK does not bundle backend code.
570
560
  */
571
561
 
@@ -619,9 +609,15 @@ interface ToolApprovalSummary {
619
609
  input: unknown;
620
610
  }
621
611
  interface AsyncStatus {
622
- status: "processing" | "awaiting_approval" | "completed" | "failed" | "not_found";
612
+ status: "accepted" | "queued" | "applied" | "processing" | "awaiting_approval" | "completed" | "failed" | "expired" | "not_found";
613
+ requestedMode?: "reject" | "followup" | "collect" | "steer";
614
+ appliedMode?: "reject" | "followup" | "collect" | "steer";
615
+ appliedToEventId?: string;
616
+ result?: unknown;
623
617
  response?: unknown;
624
618
  error?: string;
619
+ /** True when `failed` was a deliberate /stop, not a fault. */
620
+ stoppedByUser?: boolean;
625
621
  approvals?: ToolApprovalSummary[];
626
622
  }
627
623
  interface AsyncRequestAccepted {
@@ -629,6 +625,8 @@ interface AsyncRequestAccepted {
629
625
  statusId: string;
630
626
  eventId: string;
631
627
  agentId: string;
628
+ status?: "accepted" | "queued" | "applied" | "processing";
629
+ requestedMode?: "reject" | "followup" | "collect" | "steer";
632
630
  }
633
631
  interface Cron {
634
632
  accountId: string;
@@ -714,6 +712,8 @@ declare function readSseStream(body: ReadableStream<Uint8Array>): AsyncGenerator
714
712
  * Shared WebSocket wire message contracts used by the SDK client and gateway.
715
713
  */
716
714
 
715
+ type IngressMode = "reject" | "followup" | "collect" | "steer";
716
+ type IngressStatus = "accepted" | "queued" | "applied" | "processing" | "awaiting_approval" | "completed" | "failed" | "expired";
717
717
  type WebSocketStreamMessage = AgentStreamPart | {
718
718
  type: string;
719
719
  [key: string]: unknown;
@@ -722,17 +722,78 @@ type WebSocketServerMessage = {
722
722
  type: "meta";
723
723
  sessionId: string;
724
724
  taskId: string;
725
- } | WebSocketStreamMessage;
725
+ } | {
726
+ type: "ack";
727
+ requestId: string;
728
+ eventId: string;
729
+ status: IngressStatus;
730
+ statusUrl?: string;
731
+ } | {
732
+ type: "status";
733
+ requestId: string;
734
+ eventId: string;
735
+ status: IngressStatus | "not_found";
736
+ requestedMode?: IngressMode;
737
+ appliedMode?: IngressMode;
738
+ appliedToEventId?: string;
739
+ statusUrl?: string;
740
+ error?: string;
741
+ } | {
742
+ type: "attached";
743
+ requestId: string;
744
+ eventId: string;
745
+ status: IngressStatus;
746
+ replayFromCursor?: string;
747
+ replayThroughCursor?: string;
748
+ statusUrl?: string;
749
+ } | {
750
+ type: "replay_unavailable";
751
+ requestId: string;
752
+ eventId: string;
753
+ status: IngressStatus | "not_found";
754
+ statusUrl?: string;
755
+ } | WebSocketOutputMessage | WebSocketStreamMessage;
756
+ /**
757
+ * Durable-stream envelope around one stream part. The SDK unwraps `data` for
758
+ * handlers and surfaces the envelope itself through `onOutput` so clients can
759
+ * persist `cursor` for attach-based resume.
760
+ */
761
+ type WebSocketOutputMessage = {
762
+ type: "output";
763
+ eventId: string;
764
+ cursor: string;
765
+ replay: boolean;
766
+ data: WebSocketStreamMessage;
767
+ };
726
768
  type WebSocketClientExecuteMessage = {
727
769
  type: "execute";
728
770
  agentId: string;
729
771
  sessionId?: string;
730
772
  eventId?: string;
773
+ /** Defaults to "steer": join the live run at its next step boundary. */
774
+ mode?: IngressMode;
775
+ idempotencyKey?: string;
731
776
  } & AgentRunEventInput & AgentRunOverrides;
777
+ type WebSocketClientControlMessage = {
778
+ type: "control";
779
+ requestId: string;
780
+ eventId: string;
781
+ idempotencyKey?: string;
782
+ /** Defaults to "steer": join the live run at its next step boundary. */
783
+ mode?: IngressMode;
784
+ } & AgentRunEventInput;
785
+ type WebSocketClientAttachMessage = {
786
+ type: "attach";
787
+ requestId: string;
788
+ agentId: string;
789
+ conversationKey: string;
790
+ eventId: string;
791
+ afterCursor?: string;
792
+ };
732
793
  type WebSocketClientCancelMessage = {
733
794
  type: "cancel";
734
795
  };
735
- type WebSocketClientMessage = WebSocketClientExecuteMessage | WebSocketClientCancelMessage;
796
+ type WebSocketClientMessage = WebSocketClientExecuteMessage | WebSocketClientControlMessage | WebSocketClientAttachMessage | WebSocketClientCancelMessage;
736
797
 
737
798
  /**
738
799
  * Shared WebSocket wire-protocol types for the observability gateway, used by
@@ -821,12 +882,20 @@ declare const DEFAULT_CORE_BASE_URL = "https://gateway.broods.app";
821
882
  type AgentRunInputBase = {
822
883
  conversationKey?: string;
823
884
  eventId?: string;
885
+ /** Busy-conversation behavior. Defaults to `steer`: join the live run at its next step boundary (falls back to a FIFO follow-up). */
886
+ mode?: "reject" | "followup" | "collect" | "steer";
887
+ /** Stable retry identity within the conversation; defaults to eventId. */
888
+ idempotencyKey?: string;
824
889
  } & AgentRunOverrides;
825
890
  type AgentRunInput = AgentRunInputBase & AgentRunEventInput;
826
891
  interface AgentRunResult {
827
892
  text: string;
828
893
  events: TextStreamPart<ToolSet>[];
829
894
  }
895
+ declare class IngressAcceptedError extends Error {
896
+ readonly accepted: AsyncRequestAccepted;
897
+ constructor(accepted: AsyncRequestAccepted);
898
+ }
830
899
  interface AsyncPollOptions {
831
900
  intervalMs?: number;
832
901
  timeoutMs?: number;
@@ -1002,6 +1071,13 @@ interface CreateAgentResult {
1002
1071
  name: string;
1003
1072
  description?: string;
1004
1073
  }
1074
+ /** Write-only account environment variable metadata. */
1075
+ interface AccountEnvVar {
1076
+ name: string;
1077
+ updatedAt: number;
1078
+ }
1079
+ /** Build a validated account env-var reference for use in an agent config. */
1080
+ declare function envPlaceholder(name: string): string;
1005
1081
  /** Fields accepted by `PATCH /v1/agents/{id}`. `config` is deep-merged; `null` values delete keys. */
1006
1082
  interface UpdateAgentInput {
1007
1083
  name?: string;
@@ -1169,6 +1245,12 @@ declare class BroodsAccountClient {
1169
1245
  /** PATCH an agent. `config` deep-merges into the stored config; `null` leaves delete keys. Returns null when the agent is gone. */
1170
1246
  updateAgent(agentId: string, patch: UpdateAgentInput): Promise<AccountAgent | null>;
1171
1247
  deleteAgent(agentId: string): Promise<boolean>;
1248
+ /** List account environment variable names and update timestamps; values are never returned. */
1249
+ listEnvVars(): Promise<AccountEnvVar[]>;
1250
+ /** Create or replace one write-only account environment variable. */
1251
+ setEnvVar(name: string, value: string): Promise<void>;
1252
+ /** Delete one account environment variable. Returns false when it is already absent. */
1253
+ deleteEnvVar(name: string): Promise<boolean>;
1172
1254
  listCrons(): Promise<Cron[]>;
1173
1255
  createCron(input: CreateCronInput): Promise<Cron>;
1174
1256
  getCron(cronId: string): Promise<Cron | null>;
@@ -1277,9 +1359,26 @@ type WebSocketRunInput = {
1277
1359
  projectSlug?: string;
1278
1360
  environmentSlug?: string;
1279
1361
  signal?: AbortSignal;
1362
+ /** Defaults to "steer": join the live run at its next step boundary. */
1363
+ mode?: "reject" | "followup" | "collect" | "steer";
1364
+ idempotencyKey?: string;
1280
1365
  } & AgentRunEventInput & AgentRunOverrides;
1366
+ type WebSocketAttachInput = Omit<WebSocketClientAttachMessage, "type"> & {
1367
+ endpointId?: string;
1368
+ agent?: AgentReference;
1369
+ projectSlug?: string;
1370
+ environmentSlug?: string;
1371
+ signal?: AbortSignal;
1372
+ };
1281
1373
  interface WebSocketHandlers {
1374
+ /**
1375
+ * Receives every server message with durable output envelopes unwrapped:
1376
+ * stream parts arrive as themselves (`message.type === "text-delta"`), never
1377
+ * nested under `data`. Use `onOutput` when the envelope cursor is needed.
1378
+ */
1282
1379
  onMessage?(message: WebSocketServerMessage): void;
1380
+ /** Receives the raw durable output envelope (cursor, replay flag, part). */
1381
+ onOutput?(output: WebSocketOutputMessage): void;
1283
1382
  onMeta?(meta: Extract<WebSocketServerMessage, {
1284
1383
  type: "meta";
1285
1384
  }>): void;
@@ -1288,6 +1387,7 @@ interface WebSocketHandlers {
1288
1387
  }
1289
1388
  interface WebSocketSubscription {
1290
1389
  readonly url: string;
1390
+ sendControl(message: Omit<WebSocketClientControlMessage, "type">): void;
1291
1391
  close(code?: number, reason?: string): void;
1292
1392
  }
1293
1393
  interface BroodsWebSocketClientOptions {
@@ -1324,6 +1424,8 @@ declare class BroodsWebSocketClient {
1324
1424
  private readonly connectTimeoutMs;
1325
1425
  constructor(options?: BroodsWebSocketClientOptions);
1326
1426
  subscribe(input: WebSocketRunInput, handlers?: WebSocketHandlers): WebSocketSubscription;
1427
+ /** Attach to a previously started event and replay from an exclusive cursor. */
1428
+ attach(input: WebSocketAttachInput, handlers?: WebSocketHandlers): WebSocketSubscription;
1327
1429
  stream(input: WebSocketRunInput): AsyncGenerator<WebSocketServerMessage>;
1328
1430
  buildUrl(input: Pick<WebSocketRunInput, "agent" | "endpointId" | "projectSlug" | "environmentSlug">): string;
1329
1431
  private resolveWebSocket;
@@ -1347,10 +1449,9 @@ interface EnvRef<Name extends string = string> {
1347
1449
  readonly __beeblastEnv: true;
1348
1450
  readonly name: Name;
1349
1451
  }
1350
- /** Callable + property-access accessor for {@link env}. */
1452
+ /** Callable accessor for {@link env}. */
1351
1453
  interface EnvAccessor {
1352
1454
  <const Name extends string>(name: Name): EnvRef<Name>;
1353
- readonly [name: string]: EnvRef;
1354
1455
  }
1355
1456
  type EnvRefString<T> = T extends string ? T | EnvRef : T extends readonly (infer Item)[] ? readonly EnvRefString<Item>[] : T extends (infer Item)[] ? EnvRefString<Item>[] : T extends object ? {
1356
1457
  [Key in keyof T]: EnvRefString<T[Key]>;
@@ -1378,14 +1479,17 @@ interface ResourceDefinition<Kind extends ResourceKind, Name extends string, Con
1378
1479
  readonly description?: string;
1379
1480
  readonly config: Config;
1380
1481
  }
1381
- interface ResourceDefinitionInput<Name extends string, Config> {
1482
+ /**
1483
+ * Authoring shape for every resource helper: the resource's own `name` (plus an
1484
+ * optional human `description`) sits inline with that resource's config keys.
1485
+ */
1486
+ type ResourceInput<Name extends string, Config> = {
1382
1487
  name: Name;
1383
1488
  description?: string;
1384
- config: Config;
1385
- }
1489
+ } & Config;
1386
1490
  /**
1387
1491
  * Code-first sandbox config surface. Mirrors core's `SandboxConfig` but lets
1388
- * `envVars` values be `env.NAME` references (compiled to `${NAME}` placeholders
1492
+ * `envVars` values be `env("NAME")` references (compiled to `${NAME}` placeholders
1389
1493
  * at sync time, exactly like provider `apiKey`). Add overrides here if more
1390
1494
  * sandbox fields should accept env refs.
1391
1495
  */
@@ -1399,15 +1503,46 @@ interface SkillDefinitionConfig {
1399
1503
  */
1400
1504
  path: string;
1401
1505
  }
1402
- interface ToolDefinitionConfig {
1506
+ /** Broods-side context on `ToolExecuteOptions`, alongside the AI SDK's own fields. */
1507
+ interface ToolExecuteContext {
1508
+ /** Resolved tool config, `env("NAME")` already substituted. Where secrets arrive. */
1509
+ config: Record<string, unknown>;
1510
+ /** SSRF-guarded fetch. Also installed as the global `fetch`. */
1511
+ fetch: typeof fetch;
1512
+ /** Per-run scratchpad. Read back after hooks; empty and unused for tools. */
1513
+ state: Record<string, unknown>;
1514
+ }
1515
+ /** Call options an inline `execute` receives, mirroring the AI SDK's tool(). */
1516
+ interface ToolExecuteOptions {
1517
+ toolCallId?: string;
1518
+ context: ToolExecuteContext;
1519
+ abortSignal?: AbortSignal;
1520
+ /** Conversation so far. Truncated from the front to the newest 512 KB. */
1521
+ messages: ModelMessage[];
1522
+ experimental_context?: unknown;
1523
+ }
1524
+ interface ToolDefinitionConfig<Input = Record<string, unknown>> {
1403
1525
  /**
1404
- * JavaScript module file exporting the custom tool bundle. Relative paths are
1405
- * resolved from the `broods/` project directory.
1526
+ * Optional module file exporting the tool implementation, resolved from the
1527
+ * `broods/` project directory. Omit it and declare `execute` inline instead —
1528
+ * the CLI then bundles the module this tool is exported from.
1406
1529
  */
1407
- path: string;
1530
+ path?: string;
1531
+ /**
1532
+ * Runs in the isolate or the sandbox runner, not locally. Shaped like the AI
1533
+ * SDK's `tool({ execute })`: the input first, call options second. Annotate
1534
+ * the parameter to type it — `inputSchema` is JSON Schema, so it cannot be
1535
+ * inferred.
1536
+ */
1537
+ execute?: (input: Input, options: ToolExecuteOptions) => unknown;
1408
1538
  description: string;
1409
1539
  inputSchema: Record<string, unknown>;
1410
1540
  runtime?: "isolate" | "sandbox";
1541
+ /**
1542
+ * Account-wide, non-secret defaults. Environment references are rejected
1543
+ * here; put `env("NAME")` under the enabling agent's `tools.<tool>.config` so
1544
+ * the value is resolved per environment and stored with encrypted agent config.
1545
+ */
1411
1546
  defaultConfig?: Record<string, unknown>;
1412
1547
  }
1413
1548
  type PolicyDefinitionConfig = Omit<AgentPolicyDocument, "version"> & {
@@ -1439,7 +1574,7 @@ interface PancakeChannelInput extends ChannelIdentityInput {
1439
1574
  interface ZaloChannelInput extends ChannelIdentityInput {
1440
1575
  botToken: ChannelSecret;
1441
1576
  webhookSecret: ChannelSecret;
1442
- allowedUserIds: readonly (string | EnvRef)[];
1577
+ allowedUserIds?: readonly (string | EnvRef)[];
1443
1578
  }
1444
1579
  type TelegramChannelDefinition = ChannelDefinition<"telegram", TelegramChannelInput>;
1445
1580
  type GitHubChannelDefinition = ChannelDefinition<"github", GitHubChannelInput>;
@@ -1585,6 +1720,7 @@ interface AgentHooks {
1585
1720
  onMessageReceived?: Handler<ChannelMessageReceived, {
1586
1721
  drop?: boolean;
1587
1722
  text?: string;
1723
+ metadata?: unknown;
1588
1724
  }>;
1589
1725
  onMessageSending?: Handler<{
1590
1726
  channel: ChannelType;
@@ -1612,7 +1748,7 @@ type AgentPolicyDefinitionConfig = Omit<AgentPolicyConfig, "policyIds"> & {
1612
1748
  * typo like the camel `baseUrl` (instead of `base_url`/`baseURL`) slip past
1613
1749
  * `tsc`. Keep the keys in lockstep with core's `AgentProviderSettings`; the
1614
1750
  * `_ProviderKeyParity` assertion below fails `broods check` if they drift.
1615
- * Every string field also accepts an `env(...)` reference.
1751
+ * Every string field also accepts an `env("NAME")` reference.
1616
1752
  */
1617
1753
  interface ProviderSettingsInput {
1618
1754
  apiKey?: string | EnvRef;
@@ -1664,12 +1800,11 @@ type AnyResource = AgentResource | WorkspaceResource | SandboxResource | CronRes
1664
1800
  * References an account/environment variable resolved on the SERVER at runtime —
1665
1801
  * set it with `broods env set <NAME>` or in the dashboard (the Convex-style
1666
1802
  * `convex env set` model). It is a deferred reference, never read from your local
1667
- * environment and never baked into the deployed config. Use either form:
1803
+ * environment and never baked into the deployed config:
1668
1804
  *
1669
- * apiKey: env.OPENAI_API_KEY // property access (reads like process.env)
1670
- * apiKey: env("OPENAI_API_KEY") // call form (equivalent)
1805
+ * apiKey: env("OPENAI_API_KEY")
1671
1806
  *
1672
- * Both compile to a `${NAME}` placeholder the harness fills in at run time. This is
1807
+ * It compiles to a `${NAME}` placeholder the harness fills in at run time. This is
1673
1808
  * NOT `process.env`: agent configs are compiled locally, so `process.env.NAME` would
1674
1809
  * bake the literal local value into the deployed config instead of deferring it.
1675
1810
  */
@@ -1681,16 +1816,18 @@ declare function defineDiscordChannel(config: DiscordChannelInput): DiscordChann
1681
1816
  declare function definePancakeChannel(config: PancakeChannelInput): PancakeChannelDefinition;
1682
1817
  declare function defineZaloChannel(config: ZaloChannelInput): ZaloChannelDefinition;
1683
1818
  declare function defineBroods(config: BroodsProjectConfig): BroodsConfigDefinition;
1684
- declare function defineAgent<const Name extends string>(input: ResourceDefinitionInput<Name, AgentDefinitionConfig>): AgentResource<Name>;
1685
- declare function defineWorkspace<const Name extends string>(input: ResourceDefinitionInput<Name, WorkspaceConfig>): WorkspaceResource<Name>;
1686
- declare function defineSandbox<const Name extends string>(input: ResourceDefinitionInput<Name, SandboxDefinitionConfig>): SandboxResource<Name>;
1687
- declare function defineSkill<const Name extends string>(input: ResourceDefinitionInput<Name, SkillDefinitionConfig>): SkillResource<Name>;
1688
- declare function defineTool<const Name extends string>(input: ResourceDefinitionInput<Name, ToolDefinitionConfig>): ToolResource<Name>;
1689
- declare function definePolicy<const Name extends string>(input: ResourceDefinitionInput<Name, PolicyDefinitionConfig>): PolicyResource<Name>;
1690
- declare function defineCron<const Name extends string>(input: ResourceDefinitionInput<Name, CronDefinitionConfig>): CronResource<Name>;
1819
+ declare function defineAgent<const Name extends string>(input: ResourceInput<Name, AgentDefinitionConfig>): AgentResource<Name>;
1820
+ declare function defineWorkspace<const Name extends string>(input: ResourceInput<Name, WorkspaceConfig>): WorkspaceResource<Name>;
1821
+ declare function defineSandbox<const Name extends string>(input: ResourceInput<Name, SandboxDefinitionConfig>): SandboxResource<Name>;
1822
+ declare function defineSkill<const Name extends string>(input: ResourceInput<Name, SkillDefinitionConfig>): SkillResource<Name>;
1823
+ declare function defineTool<const Name extends string, Input = Record<string, unknown>>(input: {
1824
+ name: Name;
1825
+ } & ToolDefinitionConfig<Input>): ToolResource<Name>;
1826
+ declare function definePolicy<const Name extends string>(input: ResourceInput<Name, PolicyDefinitionConfig>): PolicyResource<Name>;
1827
+ declare function defineCron<const Name extends string>(input: ResourceInput<Name, CronDefinitionConfig>): CronResource<Name>;
1691
1828
  declare function isResource(value: unknown): value is AnyResource;
1692
1829
  declare function isChannelDefinition(value: unknown): value is AnyChannelDefinition;
1693
1830
  declare function isBroodsConfig(value: unknown): value is BroodsConfigDefinition;
1694
1831
 
1695
- export { BroodsAccountApiError, BroodsAccountClient, BroodsClient, BroodsWebSocketClient, DEFAULT_CORE_BASE_URL, MAX_OBSERVABILITY_BACKFILL, BroodsWebSocketClient as WebSocketClient, BroodsWebSocketClient as WebsocketClient, defineAgent, defineBroods, defineCron, defineDiscordChannel, defineGitHubChannel, definePancakeChannel, definePolicy, defineSandbox, defineSkill, defineSlackChannel, defineTelegramChannel, defineTool, defineWorkspace, defineZaloChannel, env, isBroodsConfig, isChannelDefinition, isObservabilityClientMessage, isResource, normalizeHttpServiceUrl, readSseStream, resolveRunEvents, toWebSocketBaseUrl };
1696
- export type { Account, AccountAgent, AccountPolicy, AccountSandbox, AccountTool, AccountWorkspace, Agent, AgentChannelWorkspaceScope, AgentChannelsConfig, AgentCodeHookConfig, AgentConfig, AgentConfigDoc, AgentDefinitionConfig, AgentDiscordChannelConfig, AgentGitHubChannelConfig, AgentHandle, AgentHookEventName, AgentHooks, AgentHooksConfig, AgentPancakeChannelConfig, AgentPolicyConfig, AgentPolicyDefinitionConfig, AgentPolicyDocument, AgentProviderSettings, AgentReference, AgentResource, AgentRunEventInput, AgentRunInput, AgentRunModelOverrides, AgentRunOverrides, AgentRunResult, AgentSkillsDefinitionConfig, AgentSlackChannelConfig, AgentStreamPart, AgentSubagentDefinitionConfig, AgentTelegramChannelConfig, AgentWebhookHookConfig, AgentWorkspaceInput, AgentWorkspaceRef, AgentWorkspaceRefInput, AgentZaloChannelConfig, AnyChannelDefinition, AnyResource, AsyncAgentRun, AsyncPollOptions, AsyncRequestAccepted, AsyncStatus, BroodsAccount, BroodsAccountClientOptions, BroodsClientOptions, BroodsConfigDefinition, BroodsProjectConfig, BroodsWebSocketClientOptions, ChannelDefinition, ChannelMessageReceived, ChannelReference, ChannelType, CliManifest, CliManifestResource, CliResourceKind, CreateAgentResult, CreateClientCronInput, CreateCronInput, CreateToolInput, Cron, CronDefinitionConfig, CronDoc, CronLastStatus, CronResource, CronRun, CronStatus, CustomTool, DeleteAccountResult, DiscordChannelDefinition, DiscordChannelInput, DiscordMessageSource, DiscordSource, Doc, EnvAccessor, EnvRef, EnvRefString, EnvironmentDoc, GeneratedIds, GitHubChannelDefinition, GitHubChannelInput, GitHubMessageSource, GitHubSource, HookContext, Id, LogLevel, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelDefinition, PancakeChannelInput, PancakeMessageSource, PancakeSource, PolicyDefinitionConfig, PolicyResource, ProjectDoc, ProviderConfigInput, ProviderSettingsInput, ResourceApi, ResourceDefinition, ResourceDefinitionInput, ResourceKind, RotateSecretResult, Sandbox, SandboxConfig, SandboxConfigDoc, SandboxDefinitionConfig, SandboxLifecycleResult, SandboxResource, SandboxSnapshotResult, SandboxTerminalTicket, Skill, SkillDefinitionConfig, SkillResource, SkillUploadInput, SlackChannelDefinition, SlackChannelInput, SlackMessageSource, SlackSource, TelegramChannelDefinition, TelegramChannelInput, TelegramMessageSource, TelegramSource, ToolApprovalSummary, ToolDefinitionConfig, ToolResource, UpdateAgentInput, UpdateCronInput, UpdateToolInput, WebSocketClientCancelMessage, WebSocketClientExecuteMessage, WebSocketClientMessage, WebSocketConstructorLike, WebSocketHandlers, WebSocketLike, WebSocketRunInput, WebSocketServerMessage, WebSocketStreamMessage, WebSocketSubscription, Workspace, WorkspaceConfig, WorkspaceConfigDoc, WorkspaceFileEntry, WorkspaceResource, ZaloChannelDefinition, ZaloChannelInput, ZaloMessageSource, ZaloSource };
1832
+ export { BroodsAccountApiError, BroodsAccountClient, BroodsClient, BroodsWebSocketClient, DEFAULT_CORE_BASE_URL, IngressAcceptedError, MAX_OBSERVABILITY_BACKFILL, BroodsWebSocketClient as WebSocketClient, BroodsWebSocketClient as WebsocketClient, defineAgent, defineBroods, defineCron, defineDiscordChannel, defineGitHubChannel, definePancakeChannel, definePolicy, defineSandbox, defineSkill, defineSlackChannel, defineTelegramChannel, defineTool, defineWorkspace, defineZaloChannel, env, envPlaceholder, isBroodsConfig, isChannelDefinition, isObservabilityClientMessage, isResource, normalizeHttpServiceUrl, readSseStream, resolveRunEvents, toWebSocketBaseUrl };
1833
+ export type { Account, AccountAgent, AccountEnvVar, AccountPolicy, AccountSandbox, AccountTool, AccountWorkspace, Agent, AgentChannelWorkspaceScope, AgentChannelsConfig, AgentCodeHookConfig, AgentConfig, AgentConfigDoc, AgentDefinitionConfig, AgentDiscordChannelConfig, AgentGitHubChannelConfig, AgentHandle, AgentHookEventName, AgentHooks, AgentHooksConfig, AgentPancakeChannelConfig, AgentPolicyConfig, AgentPolicyDefinitionConfig, AgentPolicyDocument, AgentProviderSettings, AgentReference, AgentResource, AgentRunEventInput, AgentRunInput, AgentRunModelOverrides, AgentRunOverrides, AgentRunResult, AgentSkillsDefinitionConfig, AgentSlackChannelConfig, AgentStreamPart, AgentSubagentDefinitionConfig, AgentTelegramChannelConfig, AgentWebhookHookConfig, AgentWorkspaceInput, AgentWorkspaceRef, AgentWorkspaceRefInput, AgentZaloChannelConfig, AnyChannelDefinition, AnyResource, AsyncAgentRun, AsyncPollOptions, AsyncRequestAccepted, AsyncStatus, BroodsAccount, BroodsAccountClientOptions, BroodsClientOptions, BroodsConfigDefinition, BroodsProjectConfig, BroodsWebSocketClientOptions, ChannelDefinition, ChannelMessageReceived, ChannelReference, ChannelType, CliManifest, CliManifestResource, CliResourceKind, CreateAgentResult, CreateClientCronInput, CreateCronInput, CreateToolInput, Cron, CronDefinitionConfig, CronDoc, CronLastStatus, CronResource, CronRun, CronStatus, CustomTool, DeleteAccountResult, DiscordChannelDefinition, DiscordChannelInput, DiscordMessageSource, DiscordSource, Doc, EnvAccessor, EnvRef, EnvRefString, EnvironmentDoc, GeneratedIds, GitHubChannelDefinition, GitHubChannelInput, GitHubMessageSource, GitHubSource, HookContext, Id, IngressMode, IngressStatus, LogLevel, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelDefinition, PancakeChannelInput, PancakeMessageSource, PancakeSource, PolicyDefinitionConfig, PolicyResource, ProjectDoc, ProviderConfigInput, ProviderSettingsInput, ResourceApi, ResourceDefinition, ResourceInput, ResourceKind, RotateSecretResult, Sandbox, SandboxConfig, SandboxConfigDoc, SandboxDefinitionConfig, SandboxLifecycleResult, SandboxResource, SandboxSnapshotResult, SandboxTerminalTicket, Skill, SkillDefinitionConfig, SkillResource, SkillUploadInput, SlackChannelDefinition, SlackChannelInput, SlackMessageSource, SlackSource, TelegramChannelDefinition, TelegramChannelInput, TelegramMessageSource, TelegramSource, ToolApprovalSummary, ToolDefinitionConfig, ToolExecuteContext, ToolExecuteOptions, ToolResource, UpdateAgentInput, UpdateCronInput, UpdateToolInput, WebSocketAttachInput, WebSocketClientAttachMessage, WebSocketClientCancelMessage, WebSocketClientControlMessage, WebSocketClientExecuteMessage, WebSocketClientMessage, WebSocketConstructorLike, WebSocketHandlers, WebSocketLike, WebSocketOutputMessage, WebSocketRunInput, WebSocketServerMessage, WebSocketStreamMessage, WebSocketSubscription, Workspace, WorkspaceConfig, WorkspaceConfigDoc, WorkspaceFileEntry, WorkspaceResource, ZaloChannelDefinition, ZaloChannelInput, ZaloMessageSource, ZaloSource };