broods 0.28.0 → 0.30.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
@@ -122,7 +122,7 @@ interface AgentConfig {
122
122
  channels?: AgentChannelsConfig;
123
123
  tools?: AgentToolsConfig;
124
124
  /** Connected MCP servers, keyed by their config-plane row id (#331). */
125
- mcpServers?: AgentMcpServersConfig;
125
+ mcp?: AgentMcpConfig;
126
126
  /**
127
127
  * Tool names withheld for this run, applied after the tool set is built.
128
128
  * Set by a channel record; a channel can take a tool away, never add one.
@@ -287,8 +287,8 @@ interface AgentToolConfig {
287
287
  config?: Record<string, unknown>;
288
288
  [key: string]: unknown;
289
289
  }
290
- type AgentMcpServersConfig = Record<string, AgentMcpServerConfig>;
291
- interface AgentMcpServerConfig {
290
+ type AgentMcpConfig = Record<string, AgentMcpEntry>;
291
+ interface AgentMcpEntry {
292
292
  enabled?: boolean;
293
293
  /** Applies to every tool the server exposes. */
294
294
  needsApproval?: boolean;
@@ -728,7 +728,7 @@ type GeneratedIds = {
728
728
  crons: Record<string, string>;
729
729
  skills: Record<string, string>;
730
730
  hooks: Record<string, string>;
731
- mcpServers: Record<string, string>;
731
+ mcp: Record<string, string>;
732
732
  policies: Record<string, string>;
733
733
  channelRecords: Record<string, string>;
734
734
  };
@@ -1404,7 +1404,7 @@ interface StageScope {
1404
1404
  stage: string;
1405
1405
  }
1406
1406
  /** Public MCP server registration returned by the `/v1/mcp` routes (#331). */
1407
- interface AccountMcpServer {
1407
+ interface AccountMcp {
1408
1408
  accountId: string;
1409
1409
  serverId: string;
1410
1410
  projectId: string;
@@ -1424,21 +1424,28 @@ interface AccountMcpServer {
1424
1424
  updatedAt: string;
1425
1425
  deletedAt?: string;
1426
1426
  }
1427
- /** Fields accepted by `POST /v1/mcp`: `url` connects, `bundle` uploads. */
1428
- interface CreateMcpServerInput {
1427
+ /**
1428
+ * Fields accepted by `POST /v1/mcp`: `url` connects, `bundle` uploads inline
1429
+ * (≤10 MB); a larger bundle goes through `uploadMcpBundle` first.
1430
+ */
1431
+ interface CreateMcpInput {
1429
1432
  name: string;
1430
1433
  description?: string;
1431
1434
  url?: string;
1432
1435
  bundle?: string;
1436
+ bundleStorageId?: string;
1437
+ sha256?: string;
1433
1438
  headers?: Record<string, string>;
1434
1439
  allowedTools?: string[];
1435
1440
  }
1436
1441
  /** Fields accepted by `PATCH /v1/mcp/{serverId}`; every field is optional. */
1437
- interface UpdateMcpServerInput {
1442
+ interface UpdateMcpInput {
1438
1443
  name?: string;
1439
1444
  description?: string;
1440
1445
  url?: string;
1441
1446
  bundle?: string;
1447
+ bundleStorageId?: string;
1448
+ sha256?: string;
1442
1449
  headers?: Record<string, string>;
1443
1450
  allowedTools?: string[];
1444
1451
  disabled?: boolean;
@@ -1492,6 +1499,13 @@ declare class BroodsAccountApiError extends Error {
1492
1499
  readonly body: string;
1493
1500
  constructor(method: string, path: string, status: number, body: string);
1494
1501
  }
1502
+ /**
1503
+ * The credential the environment supplies, with a role session winning over
1504
+ * the account secret. The constructor throws through this same resolution, so
1505
+ * callers that can run without an account credential (`broods mcp` with only a
1506
+ * stored login) probe here instead of catching the constructor.
1507
+ */
1508
+ declare function resolveEnvCredential(): string | undefined;
1495
1509
  /**
1496
1510
  * Typed client for the broods account config API. All `get`/`update`/`delete`
1497
1511
  * methods return `null`/`false` when the resource does not exist (HTTP 404) so
@@ -1608,11 +1622,19 @@ declare class BroodsAccountClient {
1608
1622
  /** Mint a short-lived sealed ticket for an interactive PTY session on a persistent sandbox (`sandbox`/`lambda` providers). Throws on 404/403/409. */
1609
1623
  openSandboxTerminal(sandboxId: string, reservationKey: string): Promise<SandboxTerminalTicket>;
1610
1624
  /** MCP servers live in one stage, so the collection routes need a scope. */
1611
- listMcpServers(scope: StageScope): Promise<AccountMcpServer[]>;
1612
- createMcpServer(scope: StageScope, input: CreateMcpServerInput): Promise<AccountMcpServer>;
1613
- getMcpServer(serverId: string): Promise<AccountMcpServer | null>;
1614
- updateMcpServer(serverId: string, patch: UpdateMcpServerInput): Promise<AccountMcpServer | null>;
1615
- deleteMcpServer(serverId: string): Promise<boolean>;
1625
+ listMcp(scope: StageScope): Promise<AccountMcp[]>;
1626
+ createMcp(scope: StageScope, input: CreateMcpInput): Promise<AccountMcp>;
1627
+ /**
1628
+ * Upload a hosted MCP bundle too large for the JSON body; returns the
1629
+ * `bundleStorageId` + `sha256` pair `createMcp`/`updateMcp` accept.
1630
+ */
1631
+ uploadMcpBundle(bundle: string): Promise<{
1632
+ bundleStorageId: string;
1633
+ sha256: string;
1634
+ }>;
1635
+ getMcp(serverId: string): Promise<AccountMcp | null>;
1636
+ updateMcp(serverId: string, patch: UpdateMcpInput): Promise<AccountMcp | null>;
1637
+ deleteMcp(serverId: string): Promise<boolean>;
1616
1638
  listPolicies(): Promise<AccountPolicy[]>;
1617
1639
  createPolicy(input: {
1618
1640
  name: string;
@@ -1855,23 +1877,30 @@ type PolicyDefinitionConfig = Omit<PolicyDocument, "version"> & {
1855
1877
  version?: PolicyDocument["version"];
1856
1878
  };
1857
1879
  /**
1858
- * MCP server registration (#331) — external (`url`) or hosted (`path`).
1880
+ * Fetch-style MCP handler for a hosted server: what
1881
+ * `createMcpHandler(...)` from @modelcontextprotocol/server returns —
1882
+ * either the request function itself or an object exposing it as `fetch`.
1883
+ */
1884
+ type McpHandler = ((request: Request) => Response | Promise<Response>) | {
1885
+ fetch(request: Request): Response | Promise<Response>;
1886
+ };
1887
+ /**
1888
+ * MCP server registration (#331) — external (`url`) or hosted (`handler`).
1859
1889
  * Either way the server's tools are offered as `<name>__<tool>`; an external
1860
1890
  * row is dialed over the stateless HTTP transport (spec 2026-07-28) at agent
1861
1891
  * registration time. The name namespaces those tools, so it must be 1-32
1862
1892
  * lowercase letters, digits, or hyphens, starting with a letter.
1863
1893
  */
1864
- interface McpServerDefinitionConfig {
1894
+ interface McpDefinitionConfig {
1865
1895
  /** External server's MCP endpoint; http(s), no embedded credentials. */
1866
1896
  url?: string;
1867
1897
  /**
1868
- * Hosted alternative to `url`: a module (resolved from the `broods/`
1869
- * directory) whose default export is a fetch-style MCP handler —
1870
- * `export default createMcpHandler(...)` from @modelcontextprotocol/server.
1871
- * The CLI bundles it and the tool-runner Lambda hosts it, one invoke per
1872
- * request.
1898
+ * Hosted alternative to `url`: declare the server inline —
1899
+ * `handler: createMcpHandler(...)` from @modelcontextprotocol/server,
1900
+ * right next to the `defineMcp` call. The CLI bundles the defining module
1901
+ * and the tool-runner Lambda hosts it, one invoke per request.
1873
1902
  */
1874
- path?: string;
1903
+ handler?: McpHandler;
1875
1904
  /**
1876
1905
  * Extra request headers. Credential-bearing headers (Authorization,
1877
1906
  * X-Api-Key, ...) must reference an account env var — e.g.
@@ -2182,7 +2211,7 @@ interface ProviderSettingsInput {
2182
2211
  }
2183
2212
  /** Per-provider settings; provider names stay synced with core's `AgentConfig`. */
2184
2213
  type ProviderConfigInput = Partial<Record<keyof NonNullable<AgentConfig["provider"]>, ProviderSettingsInput>>;
2185
- type AgentDefinitionConfig = EnvRefString<Pick<AgentConfig, "agent" | "model" | "scheduler" | "session" | "tools" | "mcpServers">> & {
2214
+ type AgentDefinitionConfig = EnvRefString<Pick<AgentConfig, "agent" | "model" | "scheduler" | "session" | "tools" | "mcp">> & {
2186
2215
  provider?: ProviderConfigInput;
2187
2216
  } & {
2188
2217
  harness?: HarnessDefinition;
@@ -2220,11 +2249,11 @@ type WorkspaceDefinitionConfig = Omit<WorkspaceConfig, "isolation"> & {
2220
2249
  type WorkspaceResource<Name extends string = string> = ResourceDefinition<"workspace", Name, WorkspaceDefinitionConfig>;
2221
2250
  type SandboxResource<Name extends string = string> = ResourceDefinition<"sandbox", Name, SandboxDefinitionConfig>;
2222
2251
  type SkillResource<Name extends string = string> = ResourceDefinition<"skill", Name, SkillDefinitionConfig>;
2223
- type McpServerResource<Name extends string = string> = ResourceDefinition<"mcp", Name, McpServerDefinitionConfig>;
2252
+ type McpResource<Name extends string = string> = ResourceDefinition<"mcp", Name, McpDefinitionConfig>;
2224
2253
  type PolicyResource<Name extends string = string> = ResourceDefinition<"policy", Name, PolicyDefinitionConfig>;
2225
2254
  type CronResource<Name extends string = string> = ResourceDefinition<"cron", Name, CronDefinitionConfig>;
2226
2255
  type ChannelResource<Name extends string = string> = ResourceDefinition<"channelRecord", Name, ChannelDefinitionConfig>;
2227
- type AnyResource = AgentResource | WorkspaceResource | SandboxResource | CronResource | SkillResource | McpServerResource | PolicyResource | ChannelResource;
2256
+ type AnyResource = AgentResource | WorkspaceResource | SandboxResource | CronResource | SkillResource | McpResource | PolicyResource | ChannelResource;
2228
2257
  /**
2229
2258
  * References an account/environment variable resolved on the SERVER at runtime —
2230
2259
  * set it with `broods env set <NAME>` or in the dashboard (the Convex-style
@@ -2261,12 +2290,12 @@ declare function defineHarness<const Definition extends HarnessDefinition>(defin
2261
2290
  declare function defineWorkspace<const Name extends string>(input: ResourceInput<Name, WorkspaceDefinitionConfig>): WorkspaceResource<Name>;
2262
2291
  declare function defineSandbox<const Name extends string>(input: ResourceInput<Name, SandboxDefinitionConfig>): SandboxResource<Name>;
2263
2292
  declare function defineSkill<const Name extends string>(input: ResourceInput<Name, SkillDefinitionConfig>): SkillResource<Name>;
2264
- declare function defineMcp<const Name extends string>(input: ResourceInput<Name, McpServerDefinitionConfig>): McpServerResource<Name>;
2293
+ declare function defineMcp<const Name extends string>(input: ResourceInput<Name, McpDefinitionConfig>): McpResource<Name>;
2265
2294
  declare function definePolicy<const Name extends string>(input: ResourceInput<Name, PolicyDefinitionConfig>): PolicyResource<Name>;
2266
2295
  declare function defineCron<const Name extends string>(input: ResourceInput<Name, CronDefinitionConfig>): CronResource<Name>;
2267
2296
  declare function isResource(value: unknown): value is AnyResource;
2268
2297
  declare function isConnectionDefinition(value: unknown): value is AnyConnectionDefinition;
2269
2298
  declare function isBroodsConfig(value: unknown): value is BroodsConfigDefinition;
2270
2299
 
2271
- export { BroodsAccountApiError, BroodsAccountClient, BroodsClient, BroodsWebSocketClient, DEFAULT_CORE_BASE_URL, IngressAcceptedError, MAX_OBSERVABILITY_BACKFILL, BroodsWebSocketClient as WebSocketClient, BroodsWebSocketClient as WebsocketClient, defineAgent, defineBroods, defineCron, defineDiscordChannel, defineDiscordConnection, defineGitHubChannel, defineGitHubConnection, defineHarness, defineMcp, definePancakeChannel, definePancakeConnection, definePolicy, defineSandbox, defineSkill, defineSlackChannel, defineSlackConnection, defineTelegramChannel, defineTelegramConnection, defineWorkspace, defineZaloChannel, defineZaloConnection, env, envPlaceholder, isBroodsConfig, isConnectionDefinition, isLogLevel, isObservabilityClientMessage, isResource, isRootSpanKind, normalizeHttpServiceUrl, readSseStream, resolveRunEvents, toWebSocketBaseUrl };
2272
- export type { Account, AccountAgent, AccountChannel, AccountEnvVar, AccountMcpServer, AccountPolicy, AccountRole, AccountSandbox, AccountWorkspace, Agent, AgentChannelsConfig, AgentCodeHookConfig, AgentConfig, AgentConfigDoc, AgentDefinitionConfig, AgentDiscordChannelConfig, AgentGitHubChannelConfig, AgentHandle, AgentHookEventName, AgentHooks, AgentHooksConfig, AgentPancakeChannelConfig, AgentProviderSettings, AgentReference, AgentResource, AgentRunEventInput, AgentRunInput, AgentRunModelOverrides, AgentRunOverrides, AgentRunResult, AgentSkillsDefinitionConfig, AgentSlackChannelConfig, AgentStreamPart, AgentSubagentDefinitionConfig, AgentTelegramChannelConfig, AgentWebhookHookConfig, AgentWorkspaceInput, AgentWorkspaceRef, AgentWorkspaceRefInput, AgentZaloChannelConfig, AnyConnectionDefinition, AnyResource, AssumeRoleResult, AsyncAgentRun, AsyncPollOptions, AsyncRequestAccepted, AsyncStatus, BroodsAccount, BroodsAccountClientOptions, BroodsClientOptions, BroodsConfigDefinition, BroodsProjectConfig, BroodsWebSocketClientOptions, ChannelAgentInput, ChannelDefinitionConfig, ChannelMessageReceived, ChannelPartition, ChannelRecordConfig, ChannelReference, ChannelReplyIn, ChannelResource, ChannelType, CliManifest, CliManifestResource, ConnectionDefinition, CreateAgentResult, CreateClientCronInput, CreateCronInput, CreateMcpServerInput, Cron, CronDefinitionConfig, CronDoc, CronLastStatus, CronResource, CronRun, CronStatus, DeleteAccountResult, DiscordChannelInput, DiscordConnectionDefinition, DiscordConnectionInput, DiscordMessageSource, DiscordSource, Doc, EnvAccessor, EnvRef, EnvRefString, GeneratedIds, GitHubChannelInput, GitHubConnectionDefinition, GitHubConnectionInput, GitHubMessageSource, GitHubSource, HarnessDefinition, HarnessType, HookContext, Id, IngressMode, IngressStatus, LogLevel, McpServerDefinitionConfig, McpServerResource, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelInput, PancakeConnectionDefinition, PancakeConnectionInput, PancakeMessageSource, PancakeSource, PolicyDefinitionConfig, PolicyDocument, PolicyResource, ProjectDoc, ProviderConfigInput, ProviderSettingsInput, ResourceApi, ResourceDefinition, ResourceInput, ResourceKind, RotateSecretResult, Sandbox, SandboxConfig, SandboxConfigDoc, SandboxDefinitionConfig, SandboxDefinitionOptions, SandboxLifecycleResult, SandboxResource, SandboxSnapshotResult, SandboxTerminalTicket, Skill, SkillDefinitionConfig, SkillResource, SkillUploadInput, SlackChannelInput, SlackConnectionDefinition, SlackConnectionInput, SlackMessageSource, SlackSource, StageDoc, StageScope, TelegramChannelInput, TelegramConnectionDefinition, TelegramConnectionInput, TelegramMessageSource, TelegramSource, ToolApprovalSummary, UpdateAgentInput, UpdateCronInput, UpdateMcpServerInput, WebSocketAttachInput, WebSocketClientAttachMessage, WebSocketClientCancelMessage, WebSocketClientControlMessage, WebSocketClientExecuteMessage, WebSocketClientMessage, WebSocketConstructorLike, WebSocketHandlers, WebSocketLike, WebSocketOutputMessage, WebSocketRunInput, WebSocketServerMessage, WebSocketStreamMessage, WebSocketSubscription, Workspace, WorkspaceConfig, WorkspaceConfigDoc, WorkspaceDefinitionConfig, WorkspaceFileEntry, WorkspaceResource, ZaloChannelInput, ZaloConnectionDefinition, ZaloConnectionInput, ZaloMessageSource, ZaloSource };
2300
+ export { BroodsAccountApiError, BroodsAccountClient, BroodsClient, BroodsWebSocketClient, DEFAULT_CORE_BASE_URL, IngressAcceptedError, MAX_OBSERVABILITY_BACKFILL, BroodsWebSocketClient as WebSocketClient, BroodsWebSocketClient as WebsocketClient, defineAgent, defineBroods, defineCron, defineDiscordChannel, defineDiscordConnection, defineGitHubChannel, defineGitHubConnection, defineHarness, defineMcp, definePancakeChannel, definePancakeConnection, definePolicy, defineSandbox, defineSkill, defineSlackChannel, defineSlackConnection, defineTelegramChannel, defineTelegramConnection, defineWorkspace, defineZaloChannel, defineZaloConnection, env, envPlaceholder, isBroodsConfig, isConnectionDefinition, isLogLevel, isObservabilityClientMessage, isResource, isRootSpanKind, normalizeHttpServiceUrl, readSseStream, resolveEnvCredential, resolveRunEvents, toWebSocketBaseUrl };
2301
+ export type { Account, AccountAgent, AccountChannel, AccountEnvVar, AccountMcp, AccountPolicy, AccountRole, AccountSandbox, AccountWorkspace, Agent, AgentChannelsConfig, AgentCodeHookConfig, AgentConfig, AgentConfigDoc, AgentDefinitionConfig, AgentDiscordChannelConfig, AgentGitHubChannelConfig, AgentHandle, AgentHookEventName, AgentHooks, AgentHooksConfig, AgentPancakeChannelConfig, AgentProviderSettings, AgentReference, AgentResource, AgentRunEventInput, AgentRunInput, AgentRunModelOverrides, AgentRunOverrides, AgentRunResult, AgentSkillsDefinitionConfig, AgentSlackChannelConfig, AgentStreamPart, AgentSubagentDefinitionConfig, AgentTelegramChannelConfig, AgentWebhookHookConfig, AgentWorkspaceInput, AgentWorkspaceRef, AgentWorkspaceRefInput, AgentZaloChannelConfig, AnyConnectionDefinition, AnyResource, AssumeRoleResult, AsyncAgentRun, AsyncPollOptions, AsyncRequestAccepted, AsyncStatus, BroodsAccount, BroodsAccountClientOptions, BroodsClientOptions, BroodsConfigDefinition, BroodsProjectConfig, BroodsWebSocketClientOptions, ChannelAgentInput, ChannelDefinitionConfig, ChannelMessageReceived, ChannelPartition, ChannelRecordConfig, ChannelReference, ChannelReplyIn, ChannelResource, ChannelType, CliManifest, CliManifestResource, ConnectionDefinition, CreateAgentResult, CreateClientCronInput, CreateCronInput, CreateMcpInput, Cron, CronDefinitionConfig, CronDoc, CronLastStatus, CronResource, CronRun, CronStatus, DeleteAccountResult, DiscordChannelInput, DiscordConnectionDefinition, DiscordConnectionInput, DiscordMessageSource, DiscordSource, Doc, EnvAccessor, EnvRef, EnvRefString, GeneratedIds, GitHubChannelInput, GitHubConnectionDefinition, GitHubConnectionInput, GitHubMessageSource, GitHubSource, HarnessDefinition, HarnessType, HookContext, Id, IngressMode, IngressStatus, LogLevel, McpDefinitionConfig, McpHandler, McpResource, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelInput, PancakeConnectionDefinition, PancakeConnectionInput, PancakeMessageSource, PancakeSource, PolicyDefinitionConfig, PolicyDocument, PolicyResource, ProjectDoc, ProviderConfigInput, ProviderSettingsInput, ResourceApi, ResourceDefinition, ResourceInput, ResourceKind, RotateSecretResult, Sandbox, SandboxConfig, SandboxConfigDoc, SandboxDefinitionConfig, SandboxDefinitionOptions, SandboxLifecycleResult, SandboxResource, SandboxSnapshotResult, SandboxTerminalTicket, Skill, SkillDefinitionConfig, SkillResource, SkillUploadInput, SlackChannelInput, SlackConnectionDefinition, SlackConnectionInput, SlackMessageSource, SlackSource, StageDoc, StageScope, TelegramChannelInput, TelegramConnectionDefinition, TelegramConnectionInput, TelegramMessageSource, TelegramSource, ToolApprovalSummary, UpdateAgentInput, UpdateCronInput, UpdateMcpInput, WebSocketAttachInput, WebSocketClientAttachMessage, WebSocketClientCancelMessage, WebSocketClientControlMessage, WebSocketClientExecuteMessage, WebSocketClientMessage, WebSocketConstructorLike, WebSocketHandlers, WebSocketLike, WebSocketOutputMessage, WebSocketRunInput, WebSocketServerMessage, WebSocketStreamMessage, WebSocketSubscription, Workspace, WorkspaceConfig, WorkspaceConfigDoc, WorkspaceDefinitionConfig, WorkspaceFileEntry, WorkspaceResource, ZaloChannelInput, ZaloConnectionDefinition, ZaloConnectionInput, ZaloMessageSource, ZaloSource };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as O,b as R,c as L}from"./chunk-mnc0tart.js";import{A as _,B as P,C as U,D as B,E as H,F as K,G as j,H as G,I as F,J as z,K as Z,L as V,M as X,N as Y,O as J,P as Q,Q as ee,R as te,S as re,T as ne,d as v,e as S,p as k,q as A,r as M,s as h,t as W,u as w,v as E,w as D,x as T,y as q,z as N}from"./chunk-2149yqc1.js";import"./chunk-3cvxks4m.js";var a=500;function i(e){if(typeof e!=="object"||e===null)return!1;let t=e;if(t.type==="subscribe"){let r=t.stream;if(r!=="logs"&&r!=="traces")return!1;let n=t.backfill;if(n!==void 0&&(typeof n!=="number"||!Number.isSafeInteger(n)||n<0||n>500))return!1;if(t.liveOnly!==void 0&&typeof t.liveOnly!=="boolean")return!1;let s=t.minLevel;if(s!==void 0&&!o(s))return!1;return!0}if(t.type==="unsubscribe"){let r=t.stream;return r==="logs"||r==="traces"}return!1}function o(e){return e==="DEBUG"||e==="INFO"||e==="WARN"||e==="ERROR"}function p(e){return e==="task"||e==="cron"||e==="subtask"}export{R as BroodsAccountApiError,L as BroodsAccountClient,M as BroodsClient,W as BroodsWebSocketClient,k as DEFAULT_CORE_BASE_URL,A as IngressAcceptedError,a as MAX_OBSERVABILITY_BACKFILL,W as WebSocketClient,W as WebsocketClient,z as defineAgent,F as defineBroods,ee as defineCron,U as defineDiscordChannel,D as defineDiscordConnection,B as defineGitHubChannel,T as defineGitHubConnection,Z as defineHarness,J as defineMcp,H as definePancakeChannel,q as definePancakeConnection,Q as definePolicy,X as defineSandbox,Y as defineSkill,K as defineSlackChannel,N as defineSlackConnection,j as defineTelegramChannel,_ as defineTelegramConnection,V as defineWorkspace,G as defineZaloChannel,P as defineZaloConnection,E as env,O as envPlaceholder,ne as isBroodsConfig,re as isConnectionDefinition,o as isLogLevel,i as isObservabilityClientMessage,te as isResource,p as isRootSpanKind,h as normalizeHttpServiceUrl,S as readSseStream,v as resolveRunEvents,w as toWebSocketBaseUrl};
1
+ import{A as H,B as K,C as j,D as G,E as F,F as z,G as Z,H as V,I as X,J as Y,K as J,L as Q,M as ee,N as te,O as re,P as ne,Q as se,a as v,b as S,m as k,n as A,o as M,p as h,q as w,r as E,s as D,t as T,u as q,v as N,w as _,x as P,y as U,z as B}from"./chunk-3qpgf0c1.js";import{R as O,S as R,T as L,U as W}from"./chunk-yy11cxjg.js";import"./chunk-rx5qcgbh.js";var a=500;function i(e){if(typeof e!=="object"||e===null)return!1;let t=e;if(t.type==="subscribe"){let r=t.stream;if(r!=="logs"&&r!=="traces")return!1;let n=t.backfill;if(n!==void 0&&(typeof n!=="number"||!Number.isSafeInteger(n)||n<0||n>500))return!1;if(t.liveOnly!==void 0&&typeof t.liveOnly!=="boolean")return!1;let s=t.minLevel;if(s!==void 0&&!o(s))return!1;return!0}if(t.type==="unsubscribe"){let r=t.stream;return r==="logs"||r==="traces"}return!1}function o(e){return e==="DEBUG"||e==="INFO"||e==="WARN"||e==="ERROR"}function p(e){return e==="task"||e==="cron"||e==="subtask"}export{R as BroodsAccountApiError,W as BroodsAccountClient,M as BroodsClient,w as BroodsWebSocketClient,k as DEFAULT_CORE_BASE_URL,A as IngressAcceptedError,a as MAX_OBSERVABILITY_BACKFILL,w as WebSocketClient,w as WebsocketClient,Z as defineAgent,z as defineBroods,te as defineCron,B as defineDiscordChannel,T as defineDiscordConnection,H as defineGitHubChannel,q as defineGitHubConnection,V as defineHarness,Q as defineMcp,K as definePancakeChannel,N as definePancakeConnection,ee as definePolicy,Y as defineSandbox,J as defineSkill,j as defineSlackChannel,_ as defineSlackConnection,G as defineTelegramChannel,P as defineTelegramConnection,X as defineWorkspace,F as defineZaloChannel,U as defineZaloConnection,D as env,O as envPlaceholder,se as isBroodsConfig,ne as isConnectionDefinition,o as isLogLevel,i as isObservabilityClientMessage,re as isResource,p as isRootSpanKind,h as normalizeHttpServiceUrl,S as readSseStream,L as resolveEnvCredential,v as resolveRunEvents,E as toWebSocketBaseUrl};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "broods",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "description": "CLI + TypeScript SDK for the broods agent platform.",
5
5
  "keywords": [
6
6
  "agents",
@@ -54,7 +54,9 @@
54
54
  "test": "bun test"
55
55
  },
56
56
  "dependencies": {
57
- "esbuild": "^0.28.2"
57
+ "@modelcontextprotocol/server": "2.0.0",
58
+ "esbuild": "^0.28.2",
59
+ "zod": "^4.4.3"
58
60
  },
59
61
  "devDependencies": {
60
62
  "@ai-sdk/tui": "1.0.78",
@@ -63,6 +65,7 @@
63
65
  "@chat-adapter/github": "^4.38.1",
64
66
  "@chat-adapter/slack": "^4.38.1",
65
67
  "@chat-adapter/telegram": "^4.38.1",
68
+ "@modelcontextprotocol/client": "^2.0.0",
66
69
  "@types/bun": "^1.3.14",
67
70
  "@typescript/typescript6": "6.0.2",
68
71
  "ai": "^7.0.77",
@@ -1,2 +0,0 @@
1
- var d=Object.defineProperty;var e=(a)=>a;function f(a,b){this[a]=e.bind(null,b)}var g=(a,b)=>{for(var c in b)d(a,c,{get:b[c],enumerable:!0,configurable:!0,set:f.bind(b,c)})};
2
- export{g as U};
@@ -1,2 +0,0 @@
1
- var c=/^[A-Z][A-Z0-9_]*$/;function u(e){if(!c.test(e)||e.length>64)throw Error("envPlaceholder name must match /^[A-Z][A-Z0-9_]*$/ and be at most 64 characters.");return`\${${e}}`}class r extends Error{status;body;constructor(e,t,n,s){super(`${e} ${t} failed with ${n}: ${s}`);this.name="BroodsAccountApiError",this.status=n,this.body=s}}function o(e){return typeof process<"u"?process?.env?.[e]:void 0}function a(e){return`?${new URLSearchParams({project:e.project,stage:e.stage}).toString()}`}class l{baseUrl;bearerToken;fetchImpl;constructor(e={}){let t=e.baseUrl??o("BROODS_BASE_URL")??"https://gateway.broods.app",n=e.sessionToken??e.accountSecret??o("BROODS_SESSION_TOKEN")??o("BROODS_ACCOUNT_SECRET");if(!n)throw Error("BroodsAccountClient requires an accountSecret or sessionToken (or BROODS_ACCOUNT_SECRET / BROODS_SESSION_TOKEN).");let s=t.length;while(s>0&&t.charCodeAt(s-1)===47)s-=1;this.baseUrl=t.slice(0,s),this.bearerToken=n,this.fetchImpl=e.fetch??fetch}async getAccount(){let e=await this.request("GET","/v1/account");if(!e)throw new r("GET","/v1/account",404,"Account not found");return e.account}async updateAccount(e){return(await this.request("PATCH","/v1/account",e))?.account??null}async assumeRole(e,t={}){let n=await this.request("POST","/v1/account/assume-role",{roleId:e,...t.ttlSeconds!==void 0?{ttlSeconds:t.ttlSeconds}:{}});if(!n)throw new r("POST","/v1/account/assume-role",404,"Role not found");return n}async rotateSecret(){let e=await this.request("POST","/v1/account/rotate-secret");if(!e)throw new r("POST","/v1/account/rotate-secret",404,"Account not found");return e}async deleteAccount(){return await this.request("DELETE","/v1/account")??{deleted:!1}}webhookUrl(e,t){let n=[e,t].map(encodeURIComponent);return`${this.baseUrl}/webhooks/${n.join("/")}`}async listAgents(){return(await this.request("GET","/v1/agents"))?.agents??[]}async createAgent(e){let t=await this.request("POST","/v1/agents",e);if(!t)throw new r("POST","/v1/agents",404,"Not found");return t}async getAgent(e){return await this.request("GET",`/v1/agents/${encodeURIComponent(e)}`)}async updateAgent(e,t){return await this.request("PATCH",`/v1/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return(await this.request("DELETE",`/v1/agents/${encodeURIComponent(e)}`))?.deleted??!1}async listEnvVars(){return(await this.request("GET","/v1/env"))?.env??[]}async setEnvVar(e,t){await this.request("PUT",`/v1/env/${encodeURIComponent(e)}`,{value:t})}async deleteEnvVar(e){return(await this.request("DELETE",`/v1/env/${encodeURIComponent(e)}`))?.deleted??!1}async listCrons(){return(await this.request("GET","/v1/crons"))?.crons??[]}async createCron(e){let t=await this.request("POST","/v1/crons",e);if(!t)throw new r("POST","/v1/crons",404,"Not found");return t}async getCron(e){return await this.request("GET",`/v1/crons/${encodeURIComponent(e)}`)}async updateCron(e,t){return await this.request("PATCH",`/v1/crons/${encodeURIComponent(e)}`,t)}async deleteCron(e){return(await this.request("DELETE",`/v1/crons/${encodeURIComponent(e)}`))?.deleted??!1}async listCronRuns(e,t={}){let n=t.limit!==void 0?`?limit=${t.limit}`:"";return(await this.request("GET",`/v1/crons/${encodeURIComponent(e)}/runs${n}`))?.runs??[]}async listWorkspaces(){return(await this.request("GET","/v1/workspaces"))?.workspaces??[]}async createWorkspace(e){let t=await this.request("POST","/v1/workspaces",e);if(!t)throw new r("POST","/v1/workspaces",404,"Not found");return t}async getWorkspace(e){return await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}`)}async updateWorkspace(e,t){return await this.request("PATCH",`/v1/workspaces/${encodeURIComponent(e)}`,t)}async deleteWorkspace(e){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}`))?.deleted??!1}async listWorkspaceFiles(e){return(await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}/files`))?.files??[]}async getWorkspaceFileUrl(e,t){let n=`?path=${encodeURIComponent(t)}`;return(await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}/files${n}`))?.url??null}async uploadWorkspaceFile(e,t){let n=`/v1/workspaces/${encodeURIComponent(e)}/files`,s=await this.request("POST",n,t);if(!s)throw new r("POST",n,404,"Workspace not found");return s.file}async renameWorkspaceFile(e,t,n){return(await this.request("PATCH",`/v1/workspaces/${encodeURIComponent(e)}/files`,{path:t,newPath:n}))?.renamed??!1}async deleteWorkspaceFile(e,t){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}/files`,{path:t}))?.deleted??!1}async listSandboxes(){return(await this.request("GET","/v1/sandboxes"))?.sandboxes??[]}async createSandbox(e){let t=await this.request("POST","/v1/sandboxes",e);if(!t)throw new r("POST","/v1/sandboxes",404,"Not found");return t}async getSandbox(e){return await this.request("GET",`/v1/sandboxes/${encodeURIComponent(e)}`)}async updateSandbox(e,t){return await this.request("PATCH",`/v1/sandboxes/${encodeURIComponent(e)}`,t)}async deleteSandbox(e){return(await this.request("DELETE",`/v1/sandboxes/${encodeURIComponent(e)}`))?.deleted??!1}async suspendSandbox(e,t){return await this.sandboxAction(e,"suspend",{reservationKey:t})}async resumeSandbox(e,t){return await this.sandboxAction(e,"resume",{reservationKey:t})}async terminateSandbox(e,t){return await this.sandboxAction(e,"terminate",{reservationKey:t})}async snapshotSandbox(e,t,n){return await this.sandboxAction(e,"snapshot",{reservationKey:t,name:n})}async openSandboxTerminal(e,t){return await this.sandboxAction(e,"terminal",{reservationKey:t})}async listMcpServers(e){let t=`/v1/mcp${a(e)}`,n=await this.request("GET",t);if(!n)throw new r("GET",t,404,"Not found");return n.servers??[]}async createMcpServer(e,t){let n=`/v1/mcp${a(e)}`,s=await this.request("POST",n,t);if(!s)throw new r("POST",n,404,"Not found");return s}async getMcpServer(e){return await this.request("GET",`/v1/mcp/${encodeURIComponent(e)}`)}async updateMcpServer(e,t){return await this.request("PATCH",`/v1/mcp/${encodeURIComponent(e)}`,t)}async deleteMcpServer(e){return(await this.request("DELETE",`/v1/mcp/${encodeURIComponent(e)}`))?.deleted??!1}async listPolicies(){return(await this.request("GET","/v1/policies"))?.policies??[]}async createPolicy(e){let t=await this.request("POST","/v1/policies",e);if(!t)throw new r("POST","/v1/policies",404,"Not found");return t}async getPolicy(e){return await this.request("GET",`/v1/policies/${encodeURIComponent(e)}`)}async updatePolicy(e,t){return await this.request("PATCH",`/v1/policies/${encodeURIComponent(e)}`,t)}async deletePolicy(e){return(await this.request("DELETE",`/v1/policies/${encodeURIComponent(e)}`))?.deleted??!1}async listRoles(){return(await this.request("GET","/v1/roles"))?.roles??[]}async createRole(e){let t=await this.request("POST","/v1/roles",e);if(!t)throw new r("POST","/v1/roles",404,"Not found");return t}async getRole(e){return await this.request("GET",`/v1/roles/${encodeURIComponent(e)}`)}async updateRole(e,t){return await this.request("PATCH",`/v1/roles/${encodeURIComponent(e)}`,t)}async deleteRole(e){return(await this.request("DELETE",`/v1/roles/${encodeURIComponent(e)}`))?.deleted??!1}async listChannels(){return(await this.request("GET","/v1/channels"))?.channels??[]}async createChannel(e){let t=await this.request("POST","/v1/channels",e);if(!t)throw new r("POST","/v1/channels",404,"Not found");return t}async getChannel(e){return await this.request("GET",`/v1/channels/${encodeURIComponent(e)}`)}async updateChannel(e,t){return await this.request("PATCH",`/v1/channels/${encodeURIComponent(e)}`,t)}async deleteChannel(e){return(await this.request("DELETE",`/v1/channels/${encodeURIComponent(e)}`))?.deleted??!1}async listSkills(){return(await this.request("GET","/v1/skills"))?.skills??[]}async createSkill(e){let t=await this.request("POST","/v1/skills",e);if(!t)throw new r("POST","/v1/skills",404,"Not found");return t}async getSkill(e){return await this.request("GET",`/v1/skills/${encodeURIComponent(e)}`)}async uploadSkill(e,t){let n=`/v1/skills/${encodeURIComponent(e)}`,s=await this.request("PUT",n,t);if(!s)throw new r("PUT",n,404,"Skill not found");return s}async deleteSkill(e){return(await this.request("DELETE",`/v1/skills/${encodeURIComponent(e)}`))?.deleted??!1}async sandboxAction(e,t,n){let s=`/v1/sandboxes/${encodeURIComponent(e)}/${t}`,i=await this.request("POST",s,n);if(!i)throw new r("POST",s,404,"Sandbox not found");return i}async request(e,t,n){let s=await this.fetchImpl(`${this.baseUrl}${t}`,{method:e,headers:{Authorization:`Bearer ${this.bearerToken}`,...n!==void 0?{"Content-Type":"application/json"}:{}},...n!==void 0?{body:JSON.stringify(n)}:{}});if(s.status===404)return null;if(!s.ok)throw new r(e,t,s.status,await s.text());return await s.json()}}
2
- export{u as a,r as b,l as c};