broods 0.2.1 → 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/README.md +89 -0
- package/dist/account.d.ts +802 -0
- package/dist/account.js +290 -0
- package/dist/cli/index.js +414 -157
- package/dist/index.d.ts +530 -80
- package/dist/index.js +419 -25
- package/package.json +12 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { SystemModelMessage, LanguageModelCallOptions, RequestOptions, streamText, JSONSchema7, ModelMessage, TextStreamPart, ToolSet } from 'ai';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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?:
|
|
236
|
-
botToken?:
|
|
237
|
-
webhookSecret?:
|
|
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?:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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?:
|
|
259
|
+
apiUrl?: string;
|
|
272
260
|
botToken?: string;
|
|
273
|
-
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?:
|
|
282
|
-
botToken?:
|
|
283
|
-
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
|
|
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
|
|
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
|
|
412
|
-
* here
|
|
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
|
|
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
|
-
} |
|
|
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;
|
|
@@ -950,6 +1019,332 @@ declare class BroodsClient {
|
|
|
950
1019
|
}
|
|
951
1020
|
declare function normalizeHttpServiceUrl(value: string): string;
|
|
952
1021
|
|
|
1022
|
+
/**
|
|
1023
|
+
* Account config-plane client for the broods public account REST API.
|
|
1024
|
+
*
|
|
1025
|
+
* This is the DYNAMIC counterpart to the config-first `broods dev` / `broods
|
|
1026
|
+
* deploy` flow: `broods dev` syncs the predefined resources declared in your
|
|
1027
|
+
* `broods/` folder, while `BroodsAccountClient` creates and mutates the full
|
|
1028
|
+
* account config plane at runtime — agents, sandboxes (config + lifecycle),
|
|
1029
|
+
* workspaces (config + files), tools, policies, skills, crons, and the account
|
|
1030
|
+
* itself — e.g. a multi-tenant app provisioning one agent per customer from its
|
|
1031
|
+
* own backend.
|
|
1032
|
+
*
|
|
1033
|
+
* Kept intentionally standalone (import from `broods/account`): pure fetch,
|
|
1034
|
+
* no Node built-ins, no `.env` file loading — so it runs in edge/worker
|
|
1035
|
+
* runtimes such as Convex actions, Cloudflare Workers, and the browser-less
|
|
1036
|
+
* server runtimes, as well as Node and Bun.
|
|
1037
|
+
*
|
|
1038
|
+
* Auth: every call sends `Authorization: Bearer {accountSecret}` to
|
|
1039
|
+
* `{baseUrl}/v1/...`. Secrets inside agent configs are encrypted at rest by
|
|
1040
|
+
* the platform and come back redacted (`********`) on reads.
|
|
1041
|
+
*/
|
|
1042
|
+
|
|
1043
|
+
interface BroodsAccountClientOptions {
|
|
1044
|
+
/** Base URL of the broods gateway. Falls back to `BROODS_BASE_URL`, then `https://gateway.broods.app`. */
|
|
1045
|
+
baseUrl?: string;
|
|
1046
|
+
/** Account secret used as the Bearer token. Falls back to `BROODS_ACCOUNT_SECRET`. */
|
|
1047
|
+
accountSecret?: string;
|
|
1048
|
+
fetch?: typeof fetch;
|
|
1049
|
+
}
|
|
1050
|
+
/** Public account record returned by `GET /v1/account`. */
|
|
1051
|
+
interface BroodsAccount {
|
|
1052
|
+
accountId: string;
|
|
1053
|
+
username: string;
|
|
1054
|
+
status: string;
|
|
1055
|
+
[key: string]: unknown;
|
|
1056
|
+
}
|
|
1057
|
+
/** Public agent record; `config` comes back with secret values redacted. */
|
|
1058
|
+
interface AccountAgent {
|
|
1059
|
+
accountId: string;
|
|
1060
|
+
agentId: string;
|
|
1061
|
+
name: string;
|
|
1062
|
+
description?: string;
|
|
1063
|
+
status: string;
|
|
1064
|
+
config: AgentConfig;
|
|
1065
|
+
createdAt: string;
|
|
1066
|
+
updatedAt: string;
|
|
1067
|
+
}
|
|
1068
|
+
interface CreateAgentResult {
|
|
1069
|
+
accountId: string;
|
|
1070
|
+
agentId: string;
|
|
1071
|
+
name: string;
|
|
1072
|
+
description?: string;
|
|
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;
|
|
1081
|
+
/** Fields accepted by `PATCH /v1/agents/{id}`. `config` is deep-merged; `null` values delete keys. */
|
|
1082
|
+
interface UpdateAgentInput {
|
|
1083
|
+
name?: string;
|
|
1084
|
+
description?: string | null;
|
|
1085
|
+
config?: unknown;
|
|
1086
|
+
}
|
|
1087
|
+
/** Public workspace record returned by the workspaces routes. */
|
|
1088
|
+
interface AccountWorkspace {
|
|
1089
|
+
accountId: string;
|
|
1090
|
+
workspaceId: string;
|
|
1091
|
+
name: string;
|
|
1092
|
+
description?: string;
|
|
1093
|
+
config: WorkspaceConfig;
|
|
1094
|
+
createdAt: string;
|
|
1095
|
+
updatedAt: string;
|
|
1096
|
+
}
|
|
1097
|
+
/** One entry of a workspace file listing (`GET /v1/workspaces/{id}/files`). */
|
|
1098
|
+
interface WorkspaceFileEntry {
|
|
1099
|
+
path: string;
|
|
1100
|
+
name: string;
|
|
1101
|
+
isFolder: boolean;
|
|
1102
|
+
sizeBytes?: number;
|
|
1103
|
+
updatedAt?: string;
|
|
1104
|
+
}
|
|
1105
|
+
/** Public sandbox config record; `config` comes back with secret values (e.g. `envVars`) redacted. */
|
|
1106
|
+
interface AccountSandbox {
|
|
1107
|
+
accountId: string;
|
|
1108
|
+
sandboxId: string;
|
|
1109
|
+
name: string;
|
|
1110
|
+
description?: string;
|
|
1111
|
+
config: SandboxConfig;
|
|
1112
|
+
createdAt: string;
|
|
1113
|
+
updatedAt: string;
|
|
1114
|
+
[key: string]: unknown;
|
|
1115
|
+
}
|
|
1116
|
+
/** Public agent-policy record returned by the policies routes. */
|
|
1117
|
+
interface AccountPolicy {
|
|
1118
|
+
accountId: string;
|
|
1119
|
+
policyId: string;
|
|
1120
|
+
name: string;
|
|
1121
|
+
description?: string;
|
|
1122
|
+
document: AgentPolicyDocument;
|
|
1123
|
+
status: string;
|
|
1124
|
+
createdAt: string;
|
|
1125
|
+
updatedAt: string;
|
|
1126
|
+
}
|
|
1127
|
+
/** Public uploaded-tool record returned by the tools routes. */
|
|
1128
|
+
interface AccountTool {
|
|
1129
|
+
accountId: string;
|
|
1130
|
+
toolId: string;
|
|
1131
|
+
name: string;
|
|
1132
|
+
description: string;
|
|
1133
|
+
inputSchema: unknown;
|
|
1134
|
+
sha256: string;
|
|
1135
|
+
runtime: "isolate" | "sandbox";
|
|
1136
|
+
defaultConfig?: unknown;
|
|
1137
|
+
status: string;
|
|
1138
|
+
createdAt: string;
|
|
1139
|
+
updatedAt: string;
|
|
1140
|
+
deletedAt?: string;
|
|
1141
|
+
}
|
|
1142
|
+
/** Fields accepted by `POST /v1/tools`. `bundle` is already-bundled JavaScript module source. */
|
|
1143
|
+
interface CreateToolInput {
|
|
1144
|
+
name: string;
|
|
1145
|
+
description: string;
|
|
1146
|
+
inputSchema: unknown;
|
|
1147
|
+
bundle: string;
|
|
1148
|
+
runtime?: "isolate" | "sandbox";
|
|
1149
|
+
defaultConfig?: unknown;
|
|
1150
|
+
}
|
|
1151
|
+
/** Fields accepted by `PATCH /v1/tools/{toolId}`; every field is optional. Omitting `bundle` keeps the stored one. */
|
|
1152
|
+
interface UpdateToolInput {
|
|
1153
|
+
name?: string;
|
|
1154
|
+
description?: string;
|
|
1155
|
+
inputSchema?: unknown;
|
|
1156
|
+
bundle?: string;
|
|
1157
|
+
runtime?: "isolate" | "sandbox";
|
|
1158
|
+
defaultConfig?: unknown;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Body of a skill upload (`POST /v1/skills`, `PUT /v1/skills/{skillName}`).
|
|
1162
|
+
* `json` needs `name`/`description`/`content`; `files` needs base64 `files`
|
|
1163
|
+
* including a root `SKILL.md`; `github` needs a tree `url`.
|
|
1164
|
+
*/
|
|
1165
|
+
interface SkillUploadInput {
|
|
1166
|
+
source: "json" | "files" | "github";
|
|
1167
|
+
name?: string;
|
|
1168
|
+
description?: string;
|
|
1169
|
+
content?: string;
|
|
1170
|
+
files?: Array<{
|
|
1171
|
+
path: string;
|
|
1172
|
+
contentBase64: string;
|
|
1173
|
+
contentType?: string;
|
|
1174
|
+
}>;
|
|
1175
|
+
url?: string;
|
|
1176
|
+
}
|
|
1177
|
+
/** Result of `POST /v1/account/rotate-secret`. The returned `secret` is shown once; the old secret stops working immediately. */
|
|
1178
|
+
interface RotateSecretResult {
|
|
1179
|
+
account: BroodsAccount;
|
|
1180
|
+
secret: string;
|
|
1181
|
+
}
|
|
1182
|
+
/** Result of `DELETE /v1/account`: the account and all account-scoped data are removed; `cleanup` reports per-resource deletion counts. */
|
|
1183
|
+
interface DeleteAccountResult {
|
|
1184
|
+
deleted: boolean;
|
|
1185
|
+
cleanup?: Record<string, number>;
|
|
1186
|
+
}
|
|
1187
|
+
/** Result of a suspend/resume/terminate sandbox lifecycle action. */
|
|
1188
|
+
interface SandboxLifecycleResult {
|
|
1189
|
+
status: string;
|
|
1190
|
+
}
|
|
1191
|
+
/** Result of `POST /v1/sandboxes/{id}/snapshot`. */
|
|
1192
|
+
interface SandboxSnapshotResult {
|
|
1193
|
+
status: string;
|
|
1194
|
+
snapshotId?: string;
|
|
1195
|
+
externalImageId?: string;
|
|
1196
|
+
}
|
|
1197
|
+
/** Sealed ticket from `POST /v1/sandboxes/{id}/terminal`; hand `token` to the gateway terminal WebSocket at `websocketPath`. */
|
|
1198
|
+
interface SandboxTerminalTicket {
|
|
1199
|
+
token: string;
|
|
1200
|
+
expiresAt: number;
|
|
1201
|
+
websocketPath: string;
|
|
1202
|
+
}
|
|
1203
|
+
/** Non-2xx response from the account API (404s on id routes return null instead). */
|
|
1204
|
+
declare class BroodsAccountApiError extends Error {
|
|
1205
|
+
readonly status: number;
|
|
1206
|
+
readonly body: string;
|
|
1207
|
+
constructor(method: string, path: string, status: number, body: string);
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Typed client for the broods account config API. All `get`/`update`/`delete`
|
|
1211
|
+
* methods return `null`/`false` when the resource does not exist (HTTP 404) so
|
|
1212
|
+
* callers can implement upsert flows without try/catch; every other non-2xx
|
|
1213
|
+
* status throws {@link BroodsAccountApiError}.
|
|
1214
|
+
*/
|
|
1215
|
+
declare class BroodsAccountClient {
|
|
1216
|
+
private readonly baseUrl;
|
|
1217
|
+
private readonly accountSecret;
|
|
1218
|
+
private readonly fetchImpl;
|
|
1219
|
+
constructor(options?: BroodsAccountClientOptions);
|
|
1220
|
+
/** The account this secret belongs to. Its `accountId` is the first segment of channel webhook URLs. */
|
|
1221
|
+
getAccount(): Promise<BroodsAccount>;
|
|
1222
|
+
/** Update account metadata (username/description). Returns null when the account is gone. Runtime config is managed through the agent endpoints. */
|
|
1223
|
+
updateAccount(patch: {
|
|
1224
|
+
username?: string;
|
|
1225
|
+
description?: string | null;
|
|
1226
|
+
}): Promise<BroodsAccount | null>;
|
|
1227
|
+
/** Rotate the account secret. The returned `secret` is shown once and the current secret stops working immediately, so persist it before the process exits. */
|
|
1228
|
+
rotateSecret(): Promise<RotateSecretResult>;
|
|
1229
|
+
/** Delete this account and cascade-clean every account-scoped resource. `cleanup` reports per-resource deletion counts. */
|
|
1230
|
+
deleteAccount(): Promise<DeleteAccountResult>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Provider webhook URL for one of an agent's channels. Paste this into the
|
|
1233
|
+
* provider's webhook settings (Slack Event Subscriptions, Zalo OA webhook,
|
|
1234
|
+
* Pancake page webhook). Routing is per account + agent, so each agent's
|
|
1235
|
+
* channels are isolated from every other agent's.
|
|
1236
|
+
*/
|
|
1237
|
+
webhookUrl(accountId: string, agentId: string, channelType: string): string;
|
|
1238
|
+
listAgents(): Promise<AccountAgent[]>;
|
|
1239
|
+
createAgent(input: {
|
|
1240
|
+
name: string;
|
|
1241
|
+
description?: string;
|
|
1242
|
+
config: unknown;
|
|
1243
|
+
}): Promise<CreateAgentResult>;
|
|
1244
|
+
getAgent(agentId: string): Promise<AccountAgent | null>;
|
|
1245
|
+
/** PATCH an agent. `config` deep-merges into the stored config; `null` leaves delete keys. Returns null when the agent is gone. */
|
|
1246
|
+
updateAgent(agentId: string, patch: UpdateAgentInput): Promise<AccountAgent | null>;
|
|
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>;
|
|
1254
|
+
listCrons(): Promise<Cron[]>;
|
|
1255
|
+
createCron(input: CreateCronInput): Promise<Cron>;
|
|
1256
|
+
getCron(cronId: string): Promise<Cron | null>;
|
|
1257
|
+
updateCron(cronId: string, patch: UpdateCronInput): Promise<Cron | null>;
|
|
1258
|
+
deleteCron(cronId: string): Promise<boolean>;
|
|
1259
|
+
/** Run history for a cron, newest first. Returns [] when the cron is gone. */
|
|
1260
|
+
listCronRuns(cronId: string, options?: {
|
|
1261
|
+
limit?: number;
|
|
1262
|
+
}): Promise<CronRun[]>;
|
|
1263
|
+
listWorkspaces(): Promise<AccountWorkspace[]>;
|
|
1264
|
+
createWorkspace(input: {
|
|
1265
|
+
name: string;
|
|
1266
|
+
description?: string;
|
|
1267
|
+
config?: unknown;
|
|
1268
|
+
}): Promise<AccountWorkspace>;
|
|
1269
|
+
getWorkspace(workspaceId: string): Promise<AccountWorkspace | null>;
|
|
1270
|
+
updateWorkspace(workspaceId: string, patch: {
|
|
1271
|
+
name?: string;
|
|
1272
|
+
description?: string | null;
|
|
1273
|
+
config?: unknown;
|
|
1274
|
+
}): Promise<AccountWorkspace | null>;
|
|
1275
|
+
deleteWorkspace(workspaceId: string): Promise<boolean>;
|
|
1276
|
+
/** Flat listing of every file in the workspace's S3-backed filesystem. Returns [] when the workspace is gone. */
|
|
1277
|
+
listWorkspaceFiles(workspaceId: string): Promise<WorkspaceFileEntry[]>;
|
|
1278
|
+
/** Short-lived download URL for one workspace file. Returns null when the workspace or file is gone. */
|
|
1279
|
+
getWorkspaceFileUrl(workspaceId: string, path: string): Promise<string | null>;
|
|
1280
|
+
/** Upload or replace one workspace file from base64 content. Throws when the workspace is gone (404). */
|
|
1281
|
+
uploadWorkspaceFile(workspaceId: string, input: {
|
|
1282
|
+
path: string;
|
|
1283
|
+
contentBase64: string;
|
|
1284
|
+
contentType?: string;
|
|
1285
|
+
}): Promise<WorkspaceFileEntry>;
|
|
1286
|
+
/** Rename a workspace file or folder. Returns false when the workspace or source path is gone. */
|
|
1287
|
+
renameWorkspaceFile(workspaceId: string, path: string, newPath: string): Promise<boolean>;
|
|
1288
|
+
/** Delete a workspace file or folder. Returns false when the workspace or path is gone. */
|
|
1289
|
+
deleteWorkspaceFile(workspaceId: string, path: string): Promise<boolean>;
|
|
1290
|
+
listSandboxes(): Promise<AccountSandbox[]>;
|
|
1291
|
+
createSandbox(input: {
|
|
1292
|
+
name: string;
|
|
1293
|
+
description?: string;
|
|
1294
|
+
config?: unknown;
|
|
1295
|
+
}): Promise<AccountSandbox>;
|
|
1296
|
+
getSandbox(sandboxId: string): Promise<AccountSandbox | null>;
|
|
1297
|
+
/** PATCH a sandbox config. `config` fully replaces the stored config. Returns null when the sandbox is gone. */
|
|
1298
|
+
updateSandbox(sandboxId: string, patch: {
|
|
1299
|
+
name?: string;
|
|
1300
|
+
description?: string | null;
|
|
1301
|
+
config?: unknown;
|
|
1302
|
+
}): Promise<AccountSandbox | null>;
|
|
1303
|
+
deleteSandbox(sandboxId: string): Promise<boolean>;
|
|
1304
|
+
/** Suspend a persistent sandbox reservation. Throws on 404/403/409 (missing sandbox, foreign reservation, or unsupported provider). */
|
|
1305
|
+
suspendSandbox(sandboxId: string, reservationKey: string): Promise<SandboxLifecycleResult>;
|
|
1306
|
+
/** Resume a persistent sandbox reservation. Throws on 404/403/409. */
|
|
1307
|
+
resumeSandbox(sandboxId: string, reservationKey: string): Promise<SandboxLifecycleResult>;
|
|
1308
|
+
/** Terminate a persistent sandbox reservation and drop its live-instance row. Throws on 404/403/409. */
|
|
1309
|
+
terminateSandbox(sandboxId: string, reservationKey: string): Promise<SandboxLifecycleResult>;
|
|
1310
|
+
/** Snapshot a persistent sandbox reservation into a reusable image (self-hosted `sandbox` provider). Throws on 404/403/409. */
|
|
1311
|
+
snapshotSandbox(sandboxId: string, reservationKey: string, name: string): Promise<SandboxSnapshotResult>;
|
|
1312
|
+
/** Mint a short-lived sealed ticket for an interactive PTY session on a persistent sandbox (`sandbox`/`lambda` providers). Throws on 404/403/409. */
|
|
1313
|
+
openSandboxTerminal(sandboxId: string, reservationKey: string): Promise<SandboxTerminalTicket>;
|
|
1314
|
+
listTools(): Promise<AccountTool[]>;
|
|
1315
|
+
createTool(input: CreateToolInput): Promise<AccountTool>;
|
|
1316
|
+
getTool(toolId: string): Promise<AccountTool | null>;
|
|
1317
|
+
/** PATCH an uploaded tool. Omitting `bundle` keeps the stored bundle and runtime. Returns null when the tool is gone. */
|
|
1318
|
+
updateTool(toolId: string, patch: UpdateToolInput): Promise<AccountTool | null>;
|
|
1319
|
+
deleteTool(toolId: string): Promise<boolean>;
|
|
1320
|
+
listPolicies(): Promise<AccountPolicy[]>;
|
|
1321
|
+
createPolicy(input: {
|
|
1322
|
+
name: string;
|
|
1323
|
+
description?: string;
|
|
1324
|
+
document: AgentPolicyDocument;
|
|
1325
|
+
}): Promise<AccountPolicy>;
|
|
1326
|
+
getPolicy(policyId: string): Promise<AccountPolicy | null>;
|
|
1327
|
+
/** PATCH a policy. `description: null` clears it. Returns null when the policy is gone. */
|
|
1328
|
+
updatePolicy(policyId: string, patch: {
|
|
1329
|
+
name?: string;
|
|
1330
|
+
description?: string | null;
|
|
1331
|
+
document?: AgentPolicyDocument;
|
|
1332
|
+
status?: string;
|
|
1333
|
+
}): Promise<AccountPolicy | null>;
|
|
1334
|
+
deletePolicy(policyId: string): Promise<boolean>;
|
|
1335
|
+
/** All skills for the account, each with its `<accountId>/<name>` path. */
|
|
1336
|
+
listSkills(): Promise<Skill[]>;
|
|
1337
|
+
/** Upload a new skill from JSON content, a base64 file bundle, or a GitHub tree URL. Every bundle must include a root `SKILL.md`. */
|
|
1338
|
+
createSkill(input: SkillUploadInput): Promise<Skill>;
|
|
1339
|
+
getSkill(skillName: string): Promise<Skill | null>;
|
|
1340
|
+
/** Replace a skill's bundle in place (`PUT`). Throws when the skill is gone (404). */
|
|
1341
|
+
uploadSkill(skillName: string, input: SkillUploadInput): Promise<Skill>;
|
|
1342
|
+
deleteSkill(skillName: string): Promise<boolean>;
|
|
1343
|
+
/** POST a sandbox lifecycle action, throwing on any non-2xx (including 404, since these are not upsert flows). */
|
|
1344
|
+
private sandboxAction;
|
|
1345
|
+
private request;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
953
1348
|
/**
|
|
954
1349
|
* WebSocket client for deployed-agent endpoints.
|
|
955
1350
|
* Uses the gateway URL when configured, or derives one from the core service URL.
|
|
@@ -964,9 +1359,26 @@ type WebSocketRunInput = {
|
|
|
964
1359
|
projectSlug?: string;
|
|
965
1360
|
environmentSlug?: string;
|
|
966
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;
|
|
967
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
|
+
};
|
|
968
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
|
+
*/
|
|
969
1379
|
onMessage?(message: WebSocketServerMessage): void;
|
|
1380
|
+
/** Receives the raw durable output envelope (cursor, replay flag, part). */
|
|
1381
|
+
onOutput?(output: WebSocketOutputMessage): void;
|
|
970
1382
|
onMeta?(meta: Extract<WebSocketServerMessage, {
|
|
971
1383
|
type: "meta";
|
|
972
1384
|
}>): void;
|
|
@@ -975,6 +1387,7 @@ interface WebSocketHandlers {
|
|
|
975
1387
|
}
|
|
976
1388
|
interface WebSocketSubscription {
|
|
977
1389
|
readonly url: string;
|
|
1390
|
+
sendControl(message: Omit<WebSocketClientControlMessage, "type">): void;
|
|
978
1391
|
close(code?: number, reason?: string): void;
|
|
979
1392
|
}
|
|
980
1393
|
interface BroodsWebSocketClientOptions {
|
|
@@ -1011,6 +1424,8 @@ declare class BroodsWebSocketClient {
|
|
|
1011
1424
|
private readonly connectTimeoutMs;
|
|
1012
1425
|
constructor(options?: BroodsWebSocketClientOptions);
|
|
1013
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;
|
|
1014
1429
|
stream(input: WebSocketRunInput): AsyncGenerator<WebSocketServerMessage>;
|
|
1015
1430
|
buildUrl(input: Pick<WebSocketRunInput, "agent" | "endpointId" | "projectSlug" | "environmentSlug">): string;
|
|
1016
1431
|
private resolveWebSocket;
|
|
@@ -1034,10 +1449,9 @@ interface EnvRef<Name extends string = string> {
|
|
|
1034
1449
|
readonly __beeblastEnv: true;
|
|
1035
1450
|
readonly name: Name;
|
|
1036
1451
|
}
|
|
1037
|
-
/** Callable
|
|
1452
|
+
/** Callable accessor for {@link env}. */
|
|
1038
1453
|
interface EnvAccessor {
|
|
1039
1454
|
<const Name extends string>(name: Name): EnvRef<Name>;
|
|
1040
|
-
readonly [name: string]: EnvRef;
|
|
1041
1455
|
}
|
|
1042
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 ? {
|
|
1043
1457
|
[Key in keyof T]: EnvRefString<T[Key]>;
|
|
@@ -1065,14 +1479,17 @@ interface ResourceDefinition<Kind extends ResourceKind, Name extends string, Con
|
|
|
1065
1479
|
readonly description?: string;
|
|
1066
1480
|
readonly config: Config;
|
|
1067
1481
|
}
|
|
1068
|
-
|
|
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> = {
|
|
1069
1487
|
name: Name;
|
|
1070
1488
|
description?: string;
|
|
1071
|
-
|
|
1072
|
-
}
|
|
1489
|
+
} & Config;
|
|
1073
1490
|
/**
|
|
1074
1491
|
* Code-first sandbox config surface. Mirrors core's `SandboxConfig` but lets
|
|
1075
|
-
* `envVars` values be `env
|
|
1492
|
+
* `envVars` values be `env("NAME")` references (compiled to `${NAME}` placeholders
|
|
1076
1493
|
* at sync time, exactly like provider `apiKey`). Add overrides here if more
|
|
1077
1494
|
* sandbox fields should accept env refs.
|
|
1078
1495
|
*/
|
|
@@ -1086,15 +1503,46 @@ interface SkillDefinitionConfig {
|
|
|
1086
1503
|
*/
|
|
1087
1504
|
path: string;
|
|
1088
1505
|
}
|
|
1089
|
-
|
|
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>> {
|
|
1090
1525
|
/**
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
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.
|
|
1093
1529
|
*/
|
|
1094
|
-
path
|
|
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;
|
|
1095
1538
|
description: string;
|
|
1096
1539
|
inputSchema: Record<string, unknown>;
|
|
1097
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
|
+
*/
|
|
1098
1546
|
defaultConfig?: Record<string, unknown>;
|
|
1099
1547
|
}
|
|
1100
1548
|
type PolicyDefinitionConfig = Omit<AgentPolicyDocument, "version"> & {
|
|
@@ -1126,7 +1574,7 @@ interface PancakeChannelInput extends ChannelIdentityInput {
|
|
|
1126
1574
|
interface ZaloChannelInput extends ChannelIdentityInput {
|
|
1127
1575
|
botToken: ChannelSecret;
|
|
1128
1576
|
webhookSecret: ChannelSecret;
|
|
1129
|
-
allowedUserIds
|
|
1577
|
+
allowedUserIds?: readonly (string | EnvRef)[];
|
|
1130
1578
|
}
|
|
1131
1579
|
type TelegramChannelDefinition = ChannelDefinition<"telegram", TelegramChannelInput>;
|
|
1132
1580
|
type GitHubChannelDefinition = ChannelDefinition<"github", GitHubChannelInput>;
|
|
@@ -1272,6 +1720,7 @@ interface AgentHooks {
|
|
|
1272
1720
|
onMessageReceived?: Handler<ChannelMessageReceived, {
|
|
1273
1721
|
drop?: boolean;
|
|
1274
1722
|
text?: string;
|
|
1723
|
+
metadata?: unknown;
|
|
1275
1724
|
}>;
|
|
1276
1725
|
onMessageSending?: Handler<{
|
|
1277
1726
|
channel: ChannelType;
|
|
@@ -1299,7 +1748,7 @@ type AgentPolicyDefinitionConfig = Omit<AgentPolicyConfig, "policyIds"> & {
|
|
|
1299
1748
|
* typo like the camel `baseUrl` (instead of `base_url`/`baseURL`) slip past
|
|
1300
1749
|
* `tsc`. Keep the keys in lockstep with core's `AgentProviderSettings`; the
|
|
1301
1750
|
* `_ProviderKeyParity` assertion below fails `broods check` if they drift.
|
|
1302
|
-
* Every string field also accepts an `env(
|
|
1751
|
+
* Every string field also accepts an `env("NAME")` reference.
|
|
1303
1752
|
*/
|
|
1304
1753
|
interface ProviderSettingsInput {
|
|
1305
1754
|
apiKey?: string | EnvRef;
|
|
@@ -1351,12 +1800,11 @@ type AnyResource = AgentResource | WorkspaceResource | SandboxResource | CronRes
|
|
|
1351
1800
|
* References an account/environment variable resolved on the SERVER at runtime —
|
|
1352
1801
|
* set it with `broods env set <NAME>` or in the dashboard (the Convex-style
|
|
1353
1802
|
* `convex env set` model). It is a deferred reference, never read from your local
|
|
1354
|
-
* environment and never baked into the deployed config
|
|
1803
|
+
* environment and never baked into the deployed config:
|
|
1355
1804
|
*
|
|
1356
|
-
* apiKey: env
|
|
1357
|
-
* apiKey: env("OPENAI_API_KEY") // call form (equivalent)
|
|
1805
|
+
* apiKey: env("OPENAI_API_KEY")
|
|
1358
1806
|
*
|
|
1359
|
-
*
|
|
1807
|
+
* It compiles to a `${NAME}` placeholder the harness fills in at run time. This is
|
|
1360
1808
|
* NOT `process.env`: agent configs are compiled locally, so `process.env.NAME` would
|
|
1361
1809
|
* bake the literal local value into the deployed config instead of deferring it.
|
|
1362
1810
|
*/
|
|
@@ -1368,16 +1816,18 @@ declare function defineDiscordChannel(config: DiscordChannelInput): DiscordChann
|
|
|
1368
1816
|
declare function definePancakeChannel(config: PancakeChannelInput): PancakeChannelDefinition;
|
|
1369
1817
|
declare function defineZaloChannel(config: ZaloChannelInput): ZaloChannelDefinition;
|
|
1370
1818
|
declare function defineBroods(config: BroodsProjectConfig): BroodsConfigDefinition;
|
|
1371
|
-
declare function defineAgent<const Name extends string>(input:
|
|
1372
|
-
declare function defineWorkspace<const Name extends string>(input:
|
|
1373
|
-
declare function defineSandbox<const Name extends string>(input:
|
|
1374
|
-
declare function defineSkill<const Name extends string>(input:
|
|
1375
|
-
declare function defineTool<const Name extends string
|
|
1376
|
-
|
|
1377
|
-
|
|
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>;
|
|
1378
1828
|
declare function isResource(value: unknown): value is AnyResource;
|
|
1379
1829
|
declare function isChannelDefinition(value: unknown): value is AnyChannelDefinition;
|
|
1380
1830
|
declare function isBroodsConfig(value: unknown): value is BroodsConfigDefinition;
|
|
1381
1831
|
|
|
1382
|
-
export { 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 };
|
|
1383
|
-
export type { Account, 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, BroodsClientOptions, BroodsConfigDefinition, BroodsProjectConfig, BroodsWebSocketClientOptions, ChannelDefinition, ChannelMessageReceived, ChannelReference, ChannelType, CliManifest, CliManifestResource, CliResourceKind, CreateClientCronInput, CreateCronInput, Cron, CronDefinitionConfig, CronDoc, CronLastStatus, CronResource, CronRun, CronStatus, CustomTool, 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,
|
|
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 };
|