broods 0.32.0 → 0.33.1

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
@@ -776,99 +776,6 @@ type WorkspaceConfigDoc = Doc<"workspaceConfigs">;
776
776
  type SandboxConfigDoc = Doc<"sandboxConfigs">;
777
777
  type CronDoc = Doc<"crons">;
778
778
 
779
- /**
780
- * Wire types for the public account-manage and harness APIs. These mirror
781
- * the deployed API contract (docs/api-reference/openapi.yaml is the source
782
- * of truth); they are intentionally independent of the runtime internals so
783
- * the SDK keeps working when the runtime is ported.
784
- */
785
-
786
- interface Account {
787
- account: {
788
- accountId: string;
789
- username: string;
790
- };
791
- secret: string;
792
- }
793
- interface Agent {
794
- accountId: string;
795
- agentId: string;
796
- name: string;
797
- }
798
- interface Sandbox {
799
- sandboxId: string;
800
- name: string;
801
- }
802
- interface Workspace {
803
- workspaceId: string;
804
- name: string;
805
- }
806
- /** A tool call held for user approval by an `ask`-mode sandbox. */
807
- interface ToolApprovalSummary {
808
- approvalId: string;
809
- toolCallId: string;
810
- toolName: string;
811
- input: unknown;
812
- }
813
- interface AsyncStatus {
814
- status: "accepted" | "queued" | "applied" | "processing" | "awaiting_approval" | "completed" | "failed" | "expired" | "not_found";
815
- requestedMode?: "reject" | "followup" | "collect" | "steer";
816
- appliedMode?: "reject" | "followup" | "collect" | "steer";
817
- appliedToEventId?: string;
818
- result?: unknown;
819
- response?: unknown;
820
- error?: string;
821
- /** True when `failed` was a deliberate /stop, not a fault. */
822
- stoppedByUser?: boolean;
823
- approvals?: ToolApprovalSummary[];
824
- }
825
- interface AsyncRequestAccepted {
826
- statusUrl: string;
827
- statusId: string;
828
- eventId: string;
829
- agentId: string;
830
- status?: "accepted" | "queued" | "applied" | "processing";
831
- requestedMode?: "reject" | "followup" | "collect" | "steer";
832
- }
833
- interface Cron {
834
- accountId: string;
835
- cronId: string;
836
- name: string;
837
- description?: string;
838
- agentId: string;
839
- events: ModelMessage[];
840
- conversationKey?: string;
841
- scheduleExpression: string;
842
- timezone?: string;
843
- status: CronStatus;
844
- createdAt: string;
845
- updatedAt: string;
846
- lastInvokedAt?: string;
847
- lastStatus?: CronLastStatus;
848
- lastError?: string;
849
- }
850
- interface CronRun {
851
- accountId: string;
852
- cronId: string;
853
- runId: string;
854
- eventId: string;
855
- conversationKey: string;
856
- status: CronLastStatus;
857
- result?: unknown;
858
- error?: string;
859
- startedAt: string;
860
- completedAt?: string;
861
- }
862
- interface Skill {
863
- path: string;
864
- name: string;
865
- description: string;
866
- files?: Array<{
867
- path: string;
868
- size?: number;
869
- }>;
870
- }
871
-
872
779
  type StreamTextOptions = Parameters<typeof streamText>[0];
873
780
  type JsonCallSettings = Partial<LanguageModelCallOptions & Pick<RequestOptions, "maxRetries" | "timeout">>;
874
781
  type AgentRunModelOverrides = JsonCallSettings & Pick<StreamTextOptions, "providerOptions">;
@@ -907,8 +814,28 @@ declare function readSseStream(body: ReadableStream<Uint8Array>): AsyncGenerator
907
814
  */
908
815
 
909
816
  type IngressMode = "reject" | "followup" | "collect" | "steer";
910
- type IngressStatus = "accepted" | "queued" | "applied" | "processing" | "awaiting_approval" | "completed" | "failed" | "expired";
817
+ type IngressStatus = "accepted" | "queued" | "applied" | "processing" | "awaiting_approval" | "awaiting_input" | "completed" | "failed" | "expired";
818
+ /** One open `ask_questions` prompt while a run is `awaiting_input`. */
819
+ interface PendingQuestion {
820
+ /** Pass back as `answers[].statusId`. */
821
+ statusId: string;
822
+ /** After this the prompt settles as no_answer. */
823
+ answerBy: string;
824
+ questions: {
825
+ id: string;
826
+ header: string;
827
+ question: string;
828
+ options: {
829
+ label: string;
830
+ description?: string;
831
+ }[];
832
+ allowFreeText?: boolean;
833
+ }[];
834
+ }
911
835
  type WebSocketStreamMessage = AgentStreamPart | {
836
+ type: "question-request";
837
+ questions: PendingQuestion[];
838
+ } | {
912
839
  type: string;
913
840
  [key: string]: unknown;
914
841
  };
@@ -989,6 +916,100 @@ type WebSocketClientCancelMessage = {
989
916
  };
990
917
  type WebSocketClientMessage = WebSocketClientExecuteMessage | WebSocketClientControlMessage | WebSocketClientAttachMessage | WebSocketClientCancelMessage;
991
918
 
919
+ /**
920
+ * Wire types for the public account-manage and harness APIs. These mirror
921
+ * the deployed API contract (docs/api-reference/openapi.yaml is the source
922
+ * of truth); they are intentionally independent of the runtime internals so
923
+ * the SDK keeps working when the runtime is ported.
924
+ */
925
+
926
+ interface Account {
927
+ account: {
928
+ accountId: string;
929
+ username: string;
930
+ };
931
+ secret: string;
932
+ }
933
+ interface Agent {
934
+ accountId: string;
935
+ agentId: string;
936
+ name: string;
937
+ }
938
+ interface Sandbox {
939
+ sandboxId: string;
940
+ name: string;
941
+ }
942
+ interface Workspace {
943
+ workspaceId: string;
944
+ name: string;
945
+ }
946
+ /** A tool call held for user approval by an `ask`-mode sandbox. */
947
+ interface ToolApprovalSummary {
948
+ approvalId: string;
949
+ toolCallId: string;
950
+ toolName: string;
951
+ input: unknown;
952
+ }
953
+ interface AsyncStatus {
954
+ status: "accepted" | "queued" | "applied" | "processing" | "awaiting_approval" | "awaiting_input" | "completed" | "failed" | "expired" | "not_found";
955
+ requestedMode?: "reject" | "followup" | "collect" | "steer";
956
+ appliedMode?: "reject" | "followup" | "collect" | "steer";
957
+ appliedToEventId?: string;
958
+ result?: unknown;
959
+ response?: unknown;
960
+ error?: string;
961
+ /** True when `failed` was a deliberate /stop, not a fault. */
962
+ stoppedByUser?: boolean;
963
+ approvals?: ToolApprovalSummary[];
964
+ questions?: PendingQuestion[];
965
+ }
966
+ interface AsyncRequestAccepted {
967
+ statusUrl: string;
968
+ statusId: string;
969
+ eventId: string;
970
+ agentId: string;
971
+ status?: "accepted" | "queued" | "applied" | "processing";
972
+ requestedMode?: "reject" | "followup" | "collect" | "steer";
973
+ }
974
+ interface Cron {
975
+ accountId: string;
976
+ cronId: string;
977
+ name: string;
978
+ description?: string;
979
+ agentId: string;
980
+ events: ModelMessage[];
981
+ conversationKey?: string;
982
+ scheduleExpression: string;
983
+ timezone?: string;
984
+ status: CronStatus;
985
+ createdAt: string;
986
+ updatedAt: string;
987
+ lastInvokedAt?: string;
988
+ lastStatus?: CronLastStatus;
989
+ lastError?: string;
990
+ }
991
+ interface CronRun {
992
+ accountId: string;
993
+ cronId: string;
994
+ runId: string;
995
+ eventId: string;
996
+ conversationKey: string;
997
+ status: CronLastStatus;
998
+ result?: unknown;
999
+ error?: string;
1000
+ startedAt: string;
1001
+ completedAt?: string;
1002
+ }
1003
+ interface Skill {
1004
+ path: string;
1005
+ name: string;
1006
+ description: string;
1007
+ files?: Array<{
1008
+ path: string;
1009
+ size?: number;
1010
+ }>;
1011
+ }
1012
+
992
1013
  /**
993
1014
  * Shared WebSocket wire-protocol types for the observability gateway, used by
994
1015
  * the gateway, the SDK/CLI, and the dashboard. Pure types + tiny pure helpers,
@@ -1206,7 +1227,7 @@ declare class BroodsClient {
1206
1227
  getAsyncStatus(status: AsyncRequestAccepted | string, options?: {
1207
1228
  agentId?: string;
1208
1229
  }): Promise<AsyncStatus>;
1209
- /** Poll async status until it reaches completed, failed, awaiting_approval, or timeout. */
1230
+ /** Poll async status until it reaches completed, failed, awaiting_approval, awaiting_input, or timeout. */
1210
1231
  waitForAsyncStatus(status: AsyncRequestAccepted | string, options?: AsyncPollOptions & {
1211
1232
  agentId?: string;
1212
1233
  }): Promise<AsyncStatus>;
@@ -2358,4 +2379,4 @@ declare function isConnectionDefinition(value: unknown): value is AnyConnectionD
2358
2379
  declare function isBroodsConfig(value: unknown): value is BroodsConfigDefinition;
2359
2380
 
2360
2381
  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, isSandboxLogId, normalizeHttpServiceUrl, readSseStream, resolveEnvCredential, resolveRunEvents, toWebSocketBaseUrl, webSocketSubprotocols };
2361
- 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, McpOauthInput, 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 };
2382
+ 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, McpOauthInput, McpResource, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelInput, PancakeConnectionDefinition, PancakeConnectionInput, PancakeMessageSource, PancakeSource, PendingQuestion, 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 R,B as P,C as T,D as E,E as H,F as _,G as N,H as U,I as j,J as K,K as L,L as G,M as O,N as z,O as Z,P as B,Q as F,R as J,S as Q,T as V,U as X,V as Y,W as ee,a as d,b as l,c as u,d as C,e as f,f as m,g as y,r as x,s as I,t as S,u as k,v as M,w as W,x as D,y as w,z as q}from"./chunk-h9meaxpn.js";import{X as A,Y as h,Z as b,_ as v}from"./chunk-zk74tvhq.js";import"./chunk-7qxgm62s.js";export{h as BroodsAccountApiError,v as BroodsAccountClient,S as BroodsClient,M as BroodsWebSocketClient,x as DEFAULT_CORE_BASE_URL,I as IngressAcceptedError,u as MAX_OBSERVABILITY_BACKFILL,M as WebSocketClient,M as WebsocketClient,O as defineAgent,G as defineBroods,V as defineCron,_ as defineDiscordChannel,q as defineDiscordConnection,N as defineGitHubChannel,R as defineGitHubConnection,z as defineHarness,J as defineMcp,U as definePancakeChannel,P as definePancakeConnection,Q as definePolicy,B as defineSandbox,F as defineSkill,j as defineSlackChannel,T as defineSlackConnection,K as defineTelegramChannel,E as defineTelegramConnection,Z as defineWorkspace,L as defineZaloChannel,H as defineZaloConnection,w as env,A as envPlaceholder,ee as isBroodsConfig,Y as isConnectionDefinition,f as isLogLevel,C as isObservabilityClientMessage,X as isResource,m as isRootSpanKind,y as isSandboxLogId,k as normalizeHttpServiceUrl,l as readSseStream,b as resolveEnvCredential,d as resolveRunEvents,D as toWebSocketBaseUrl,W as webSocketSubprotocols};
1
+ import{B,pe,Ce,xe,Te,ke,V,C,me,q,W,Ie,D,K,Pe,Me,Ae,ze,Oe,Ne,je,qe,De,Le,Ue,Fe,Be,Ve,Ze,He,We,Ke,Ge,Je,Ye,Xe,h,_,ne}from"./chunk-pvpa68ca.js";import{$e,m,L,U}from"./chunk-0622rd68.js";export{m as BroodsAccountApiError,U as BroodsAccountClient,q as BroodsClient,Ie as BroodsWebSocketClient,C as DEFAULT_CORE_BASE_URL,me as IngressAcceptedError,Ce as MAX_OBSERVABILITY_BACKFILL,Ie as WebSocketClient,Ie as WebsocketClient,Ze as defineAgent,Ve as defineBroods,Xe as defineCron,qe as defineDiscordChannel,Me as defineDiscordConnection,De as defineGitHubChannel,Ae as defineGitHubConnection,He as defineHarness,Je as defineMcp,Le as definePancakeChannel,ze as definePancakeConnection,Ye as definePolicy,Ke as defineSandbox,Ge as defineSkill,Ue as defineSlackChannel,Oe as defineSlackConnection,Fe as defineTelegramChannel,Ne as defineTelegramConnection,We as defineWorkspace,Be as defineZaloChannel,je as defineZaloConnection,Pe as env,$e as envPlaceholder,ne as isBroodsConfig,_ as isConnectionDefinition,Te as isLogLevel,xe as isObservabilityClientMessage,h as isResource,ke as isRootSpanKind,V as isSandboxLogId,W as normalizeHttpServiceUrl,pe as readSseStream,L as resolveEnvCredential,B as resolveRunEvents,K as toWebSocketBaseUrl,D as webSocketSubprotocols};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "broods",
3
- "version": "0.32.0",
3
+ "version": "0.33.1",
4
4
  "description": "CLI + TypeScript SDK for the broods agent platform.",
5
5
  "keywords": [
6
6
  "agents",
@@ -54,28 +54,33 @@
54
54
  "test": "bun test"
55
55
  },
56
56
  "dependencies": {
57
- "@modelcontextprotocol/server": "2.0.0",
58
- "esbuild": "^0.28.2",
59
- "zod": "^4.4.3"
57
+ "esbuild": "^0.28.2"
60
58
  },
61
59
  "devDependencies": {
62
- "@ai-sdk/tui": "1.0.88",
60
+ "@ai-sdk/tui": "1.0.93",
63
61
  "@arethetypeswrong/cli": "^0.18.5",
64
62
  "@chat-adapter/discord": "^4.38.1",
65
63
  "@chat-adapter/github": "^4.38.1",
66
64
  "@chat-adapter/slack": "^4.38.1",
67
65
  "@chat-adapter/telegram": "^4.38.1",
68
66
  "@modelcontextprotocol/client": "^2.0.0",
67
+ "@modelcontextprotocol/server": "2.0.0",
69
68
  "@types/bun": "^1.3.14",
70
69
  "@typescript/typescript6": "6.0.2",
71
- "ai": "^7.0.87",
70
+ "ai": "^7.0.92",
72
71
  "publint": "^0.3.23",
73
72
  "rollup": "^4.62.4",
74
73
  "rollup-plugin-dts": "^6.5.1",
75
- "typescript": "^7.0.2"
74
+ "typescript": "^7.0.2",
75
+ "zod": "^4.4.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "ai": "^7.0.87"
78
+ "ai": "^7.0.92"
79
+ },
80
+ "peerDependenciesMeta": {
81
+ "ai": {
82
+ "optional": true
83
+ }
79
84
  },
80
85
  "engines": {
81
86
  "node": ">=22.15"
@@ -1 +0,0 @@
1
- import{aa as _,ba as q,ca as C,da as P,ea as j,fa as k,ga as D,ha as p,ia as v,ja as z,ka as A,la as M,ma as J,na as L,oa as U,pa as x,qa as O,ra as g,sa as F,ta as X,ua as H,va as Q}from"./chunk-ejgnb5z6.js";import"./chunk-ss48287m.js";import"./chunk-7qxgm62s.js";var re=class{_readBuffer;_started=!1;_closed=!1;constructor(r=O.stdin,o=O.stdout,a){this._stdin=r,this._stdout=o,this._readBuffer=new U({maxBufferSize:a?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(r)=>{try{this._readBuffer.append(r),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}};_onerror=(r)=>{this.onerror?.(r)};_onstdouterror=(r)=>{this.onerror?.(r),this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let r=this._readBuffer.readMessage();if(r===null)break;this.onmessage?.(r)}catch(r){this.onerror?.(r)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(r){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((o,a)=>{let d=x(r),t=!1,u=(w)=>{if(t)return;t=!0,this._stdout.off("error",u),this._stdout.off("drain",h),a(w)},h=()=>{if(t)return;t=!0,this._stdout.off("error",u),this._stdout.off("drain",h),o()};if(this._stdout.once("error",u),this._stdout.write(d)){if(t)return;t=!0,this._stdout.off("error",u),o()}else if(!t)this._stdout.once("drain",h)})}},W=3000,te=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(r,o,a){this._wire=r,this._onInstanceClose=o,this._outboundIntercept=a}async start(){}async send(r,o){if(z(r)||A(r)){let{id:a}=r;if(a!==void 0)this._settle(a)}if(this._closed)return;if(this._outboundIntercept?.(r)==="handled")return;return this._wire.send(r,o)}setProtocolVersion=(r)=>{this._wire.setProtocolVersion?.(r)};deliver(r,o){if(this._closed)return;if(p(r))this._pendingRequests.add(r.id);else if(v(r)&&r.method==="notifications/cancelled"){let a=r.params?.requestId;if(a!==void 0)this._settle(a)}this.onmessage?.(r,o)}async whenRequestsAnswered(r){if(this._closed||this._pendingRequests.size===0)return!0;return await new Promise((o)=>{let a=()=>{clearTimeout(d),o(!0)},d=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter((t)=>t!==a),o(!1)},r);this._drainWaiters.push(a)})}async close(){if(this._closed)return;this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}_settle(r){if(this._pendingRequests.delete(r),this._pendingRequests.size===0)this._releaseDrainWaiters()}_releaseDrainWaiters(){let r=this._drainWaiters;this._drainWaiters=[];for(let o of r)o()}};function ne(r){let o=r.params;if(r.method==="initialize"&&!M(o)){let u=o!==null&&typeof o==="object"&&typeof o.protocolVersion==="string"?o.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...u!==void 0&&{requestedVersion:u}}}if(!j(o))return{kind:"legacy",reason:"no-claim"};let a=P(o),d=(a===void 0?[]:D(a))[0];if(d!==void 0)return{kind:"invalid-envelope",issue:d};let t=k(o);if(t===void 0||!_.includes(t))return{kind:"unsupported-revision",requested:t??"unknown"};return{kind:"modern",revision:t,classification:{era:"modern",revision:t}}}function ae(r,o={}){let a=o.legacy??"serve",d=o.transport??new re,t={phase:"opening"},u,h=!1,w=()=>h||t.phase==="closed",c=(e)=>{try{o.onerror?.(e)}catch{}},R=(e,n,i,s)=>d.send({jsonrpc:"2.0",id:e,error:{code:n,message:i,...s!==void 0&&{data:s}}}).catch((l)=>c(f(l))),y=new F(o.maxSubscriptions??g),Y=(e)=>{if(!v(e))return;let n=y.routeOutbound(e);if(n==="passthrough")return;for(let i of n)d.send({jsonrpc:"2.0",...i}).catch((s)=>c(f(s)));return"handled"},V=async(e)=>{if(p(e)&&e.method==="subscriptions/listen"){let n=P(e.params),i=j(e.params)?(n===void 0?[]:D(n))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},s=k(e.params),l;if(i!==void 0)l={jsonrpc:"2.0",id:e.id,error:{code:-32602,message:`Invalid _meta envelope: ${i.key}: ${i.problem}`}};else if(s===void 0||!_.includes(s)){let m=new C({supported:[..._],requested:s??"unknown"});l={jsonrpc:"2.0",id:e.id,error:{code:m.code,message:m.message,data:m.data}}}else l=y.serve(e);return await d.send("error"in l?l:{jsonrpc:"2.0",method:l.method,params:l.params}).catch((m)=>c(f(m))),!0}if(v(e)&&e.method==="notifications/cancelled"){let n=e.params?.requestId;if(n!==void 0&&y.cancel(n))return!0}return!1},T=(e,n,i)=>{let s=J({kind:"legacy",reason:n,...i!==void 0&&{requestedVersion:i}},_);if(s===void 0)return Promise.resolve();return c(Error(`Rejected 2025-era request on a modern-only stdio connection (${s.cell}): ${s.message}`)),R(e.id,s.code,s.message,s.data)},G=(e)=>{if(h||e===u)return;B()},S=async(e,n)=>{let i=await r({era:e}),s=i instanceof Q?i.server:i;if(e==="modern")L(s,n),X(s,_),y.setServerCapabilities(s.getCapabilities(),H(s));let l=new te(d,()=>G(l),e==="modern"?Y:void 0);return await i.connect(l),{product:i,channel:l}},E=(e)=>e.product.close().catch((n)=>c(f(n))),K=async(e)=>{u=e.channel;try{if(!await e.channel.whenRequestsAnswered(W))c(Error(`Discarded the probe instance with requests still unanswered after ${W}ms; continuing with the fallback`));await e.product.close()}catch(n){c(f(n))}finally{u=void 0}},Z=async(e)=>{if(t.phase==="closed")return;if(t.phase==="pinned"){if(t.era==="modern"&&p(e)&&e.method==="initialize"&&!M(e.params)){await T(e,"initialize",e.params!==null&&typeof e.params==="object"&&typeof e.params.protocolVersion==="string"?e.params.protocolVersion:void 0);return}if(t.era==="modern"&&await V(e))return;t.instance.channel.deliver(e);return}if(!p(e)&&!v(e)){c(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let n=ne(e);switch(n.kind){case"invalid-envelope":{let i=`Invalid _meta envelope for protocol revision 2026-07-28: ${n.issue.key}: ${n.issue.problem}`;if(p(e))await R(e.id,q.InvalidParams,i,{envelope:n.issue});else c(Error(`Discarded a notification with a malformed envelope: ${i}`));return}case"unsupported-revision":if(p(e)){let i=new C({supported:[..._],requested:n.requested});c(i),await R(e.id,i.code,i.message,i.data)}else c(Error(`Discarded a notification claiming unsupported protocol revision ${n.requested}`));return;case"modern":if(p(e)&&e.method==="server/discover"){if(t.phase==="probe"){t.instance.channel.deliver(e,{classification:n.classification});return}let i=await S("modern",n.revision);if(w()){await E(i);return}t={phase:"probe",instance:i},i.channel.deliver(e,{classification:n.classification});return}if(t.phase==="probe"){if(v(e)){t.instance.channel.deliver(e,{classification:n.classification});return}t={phase:"pinned",era:"modern",instance:t.instance}}else{let i=await S("modern",n.revision);if(w()){await E(i);return}t={phase:"pinned",era:"modern",instance:i}}if(await V(e))return;t.instance.channel.deliver(e,{classification:n.classification});return;case"legacy":{if(a==="reject"){if(p(e))await T(e,n.reason,n.requestedVersion);return}if(t.phase==="probe"){if(await K(t.instance),w())return;t={phase:"opening"}}let i=await S("legacy");if(w()){await E(i);return}t={phase:"pinned",era:"legacy",instance:i},t.instance.channel.deliver(e);return}}},I=[],b=!1,ee=async()=>{if(b)return;b=!0;try{while(I.length>0){let e=I.shift();try{await Z(e)}catch(n){if(p(e))await R(e.id,q.InternalError,"Internal server error");c(f(n))}}}finally{b=!1}},B=async()=>{if(h||t.phase==="closed")return;h=!0;let e=t;t={phase:"closed"};for(let n of y.teardownAll())await d.send(n).catch((i)=>c(f(i)));if(e.phase==="probe"||e.phase==="pinned")await e.instance.product.close().catch((n)=>c(f(n)));await d.close().catch((n)=>c(f(n)))};d.onmessage=(e)=>{I.push(e),ee()},d.onerror=(e)=>{if(c(e),t.phase==="probe"||t.phase==="pinned")t.instance.channel.onerror?.(e)},d.onclose=()=>{if(h||t.phase==="closed")return;h=!0;let e=t;if(t={phase:"closed"},e.phase==="probe"||e.phase==="pinned")e.instance.product.close().catch((n)=>c(f(n)))};let N=d.start().catch((e)=>{throw c(f(e)),e});return N.catch(()=>{}),{close:async()=>{await N.catch(()=>{}),await B()}}}function f(r){return r instanceof Error?r:Error(String(r))}export{re as StdioServerTransport,ae as serveStdio};
@@ -1,2 +0,0 @@
1
- import{createRequire as g}from"node:module";var d=Object.defineProperty;var e=(a)=>a;function f(a,b){this[a]=e.bind(null,b)}var h=(a,b)=>{for(var c in b)d(a,c,{get:b[c],enumerable:!0,configurable:!0,set:f.bind(b,c)})};var j=g(import.meta.url);
2
- export{h as Te,j as Ue};
@@ -1 +0,0 @@
1
- import{Z as R,_ as E}from"./chunk-zk74tvhq.js";import{$ as o,va as g}from"./chunk-ejgnb5z6.js";import"./chunk-ss48287m.js";import"./chunk-7qxgm62s.js";var y={project:o.string().optional(),stage:o.string().optional()},I={sandboxId:o.string().min(1),reservationKey:o.string().min(1)},h=o.boolean().describe("Must be true, after the owner has agreed to this delete."),S="'********' keeps a stored secret and null deletes a field: never send a placeholder you did not read from a get.",C=[{singular:"agent",plural:"agents",key:"agentId",createHint:"Needs name and config; a 409 returns the existing agentId.",deleteHint:"Deleting an agent also drops its runtime rows.",updateHint:S,list:(e)=>e.listAgents(),get:(e,t)=>e.getAgent(t),create:(e,t)=>e.createAgent(t),update:(e,t,s)=>e.updateAgent(t,s),remove:(e,t)=>e.deleteAgent(t)},{singular:"cron",plural:"crons",key:"cronId",createHint:"Needs name, agentId, scheduleExpression (rate/cron/at) and input or events.",list:(e)=>e.listCrons(),get:(e,t)=>e.getCron(t),create:(e,t)=>e.createCron(t),update:(e,t,s)=>e.updateCron(t,s),remove:(e,t)=>e.deleteCron(t)},{singular:"sandbox",plural:"sandboxes",key:"sandboxId",updateHint:S,list:(e)=>e.listSandboxes(),get:(e,t)=>e.getSandbox(t),create:(e,t)=>e.createSandbox(t),update:(e,t,s)=>e.updateSandbox(t,s),remove:(e,t)=>e.deleteSandbox(t)},{singular:"workspace",plural:"workspaces",key:"workspaceId",list:(e)=>e.listWorkspaces(),get:(e,t)=>e.getWorkspace(t),create:(e,t)=>e.createWorkspace(t),update:(e,t,s)=>e.updateWorkspace(t,s),remove:(e,t)=>e.deleteWorkspace(t)},{singular:"policy",plural:"policies",key:"policyId",createHint:"Agent-runtime policy document (tool.call, skill.load), not API credential scoping.",list:(e)=>e.listPolicies(),get:(e,t)=>e.getPolicy(t),create:(e,t)=>e.createPolicy(t),update:(e,t,s)=>e.updatePolicy(t,s),remove:(e,t)=>e.deletePolicy(t)},{singular:"role",plural:"roles",key:"roleId",createHint:"Needs name and a version-1 policy over the API namespace, e.g. agents:read. Account secret only.",list:(e)=>e.listRoles(),get:(e,t)=>e.getRole(t),create:(e,t)=>e.createRole(t),update:(e,t,s)=>e.updateRole(t,s),remove:(e,t)=>e.deleteRole(t)},{singular:"channel",plural:"channels",key:"channelId",list:(e)=>e.listChannels(),get:(e,t)=>e.getChannel(t),create:(e,t)=>e.createChannel(t),update:(e,t,s)=>e.updateChannel(t,s),remove:(e,t)=>e.deleteChannel(t)},{singular:"skill",plural:"skills",key:"skillName",createHint:'source is "files" (base64), "json" or "github". The stored name comes from the SKILL.md frontmatter.',list:(e)=>e.listSkills(),get:(e,t)=>e.getSkill(t),create:(e,t)=>e.createSkill(t),remove:(e,t)=>e.deleteSkill(t)},{singular:"mcp",plural:"mcp",key:"serverId",scoped:!0,list:(e,t)=>e.listMcp(t),get:(e,t)=>e.getMcp(t),create:(e,t,s)=>e.createMcp(s,t),update:(e,t,s)=>e.updateMcp(t,s),remove:(e,t)=>e.deleteMcp(t)}];function Mt(e={}){let t=R()?new E({}):null;if(!t&&!e.cli)throw Error("broods mcp needs a credential: set BROODS_SESSION_TOKEN or BROODS_ACCOUNT_SECRET, or run `broods login`.");let s=new g({name:"broods",version:"1"},{capabilities:{tools:{}}});if(t){for(let r of C)k(s,t,r,e.scope??{});P(s,t)}if(e.cli)O(s,e.cli);if(e.allowDestructive)q(s,t,e.cli??null);return s}function M(e){return{content:[{type:"text",text:JSON.stringify(e??null,null,2)}]}}function A(e){return{content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}function f(e,t){if(!e)throw Error(`Refusing without confirm:true. ${t}`)}async function a(e){try{return M(await e())}catch(t){return A(t)}}function _(e,t,s,r){if(!e.scoped)return;let n=s??t.project,c=r??t.stage;if(!n||!c)throw Error(`${e.plural} live in one stage, so this call needs both 'project' and 'stage'`);return{project:n,stage:c}}function k(e,t,s,r){let n=o.string().min(1).describe(`The ${s.key}.`),c=s.scoped?` ${s.plural} live in one stage, so this also takes 'project' and 'stage'.`:"",{list:d,get:p,create:m,update:v,remove:w}=s;if(d){let i=`List every ${s.singular} on the account.${c}`;if(s.scoped)e.registerTool(`list-${s.plural}`,{description:i,inputSchema:y},async({project:l,stage:u})=>await a(async()=>await d(t,_(s,r,l,u))));else e.registerTool(`list-${s.plural}`,{description:i,inputSchema:{}},async()=>await a(async()=>await d(t)))}if(p)e.registerTool(`get-${s.singular}`,{description:`Read one ${s.singular} by ${s.key}.`,inputSchema:{id:n}},async({id:i})=>await a(async()=>await p(t,i)));if(m){let i=`Create one ${s.singular}. 'body' is the request body the config plane documents.`+(s.createHint?` ${s.createHint}`:"")+c+" Prefer changing the broods/ manifest and deploying for anything the project already declares.",l=o.record(o.string(),o.unknown());if(s.scoped)e.registerTool(`create-${s.singular}`,{description:i,inputSchema:{body:l,...y}},async({body:u,project:b,stage:T})=>await a(async()=>await m(t,u,_(s,r,b,T))));else e.registerTool(`create-${s.singular}`,{description:i,inputSchema:{body:l}},async({body:u})=>await a(async()=>await m(t,u)))}if(v)e.registerTool(`update-${s.singular}`,{description:`Deep-merge a patch into one ${s.singular} and return the updated record, so there is no need to read it back.`+(s.updateHint?` ${s.updateHint}`:""),inputSchema:{id:n,body:o.record(o.string(),o.unknown())}},async({id:i,body:l})=>await a(async()=>await v(t,i,l)));if(w)e.registerTool(`delete-${s.singular}`,{description:`Delete one ${s.singular}. Requires confirm:true, and takes one ${s.key} per call: never loop this over a list.`+(s.deleteHint?` ${s.deleteHint}`:""),inputSchema:{id:n,confirm:h}},async({id:i,confirm:l})=>await a(async()=>(f(l,`Deleting ${s.singular} '${i}' goes away for good: name it, get the owner's agreement, then retry.`),{deleted:await w(t,i),id:i})))}function P(e,t){e.registerTool("list-cron-runs",{description:"Run history for one cron, newest first. Check this before telling anyone a cron fired.",inputSchema:{cronId:o.string().min(1),limit:o.number().int().positive().max(100).optional()}},async({cronId:r,limit:n})=>await a(async()=>await t.listCronRuns(r,n===void 0?{}:{limit:n})));let s=[["suspend-sandbox","Suspend a persistent sandbox reservation.",(r,n)=>t.suspendSandbox(r,n)],["resume-sandbox","Resume a suspended sandbox reservation.",(r,n)=>t.resumeSandbox(r,n)],["terminate-sandbox","Terminate a sandbox reservation and drop its live-instance row. Terminate only a sandbox you created, and never one holding state you did not put there.",(r,n)=>t.terminateSandbox(r,n)],["open-sandbox-terminal","Mint a short-lived sealed ticket for an interactive PTY session on a persistent sandbox.",(r,n)=>t.openSandboxTerminal(r,n)]];for(let[r,n,c]of s)e.registerTool(r,{description:n,inputSchema:I},async({sandboxId:d,reservationKey:p})=>await a(async()=>await c(d,p)));e.registerTool("snapshot-sandbox",{description:"Snapshot a sandbox reservation into a reusable image (self-hosted provider).",inputSchema:{sandboxId:o.string().min(1),reservationKey:o.string().min(1),name:o.string().min(1)}},async({sandboxId:r,reservationKey:n,name:c})=>await a(async()=>await t.snapshotSandbox(r,n,c))),e.registerTool("upload-skill",{description:"Replace one skill's bundle wholesale (PUT, not a merge) by skillName. 'body' is the same source shape create-skill takes.",inputSchema:{id:o.string().min(1).describe("The skillName."),body:o.record(o.string(),o.unknown())}},async({id:r,body:n})=>await a(async()=>await t.uploadSkill(r,n))),e.registerTool("list-env-vars",{description:"List environment variable names. Values are write-only: the plane never returns them, so there is no read.",inputSchema:{}},async()=>await a(async()=>await t.listEnvVars())),e.registerTool("set-env-var",{description:"Create or replace one write-only environment variable. Reference it from a config as ${NAME} rather than inlining the value.",inputSchema:{name:o.string().min(1),value:o.string()}},async({name:r,value:n})=>await a(async()=>(await t.setEnvVar(r,n),{name:r,stored:!0}))),e.registerTool("delete-env-var",{description:"Delete one environment variable.",inputSchema:{name:o.string().min(1),confirm:h}},async({name:r,confirm:n})=>await a(async()=>(f(n,`Anything referencing \${${r}} breaks the moment this env var goes.`),{deleted:await t.deleteEnvVar(r),name:r}))),e.registerTool("assume-role",{description:"Exchange a role for a short-lived session token (default 1h, max 12h). Hand the returned token to whatever tool needs narrow access, as BROODS_SESSION_TOKEN. It is shown once and is not stored here.",inputSchema:{roleId:o.string().min(1),ttlSeconds:o.number().int().positive().max(43200).optional()}},async({roleId:r,ttlSeconds:n})=>await a(async()=>await t.assumeRole(r,n===void 0?{}:{ttlSeconds:n}))),e.registerTool("update-account",{description:"Rename this account or change its description. Everything else about an account is derived, not settable.",inputSchema:{username:o.string().optional(),description:o.string().nullable().optional()}},async({username:r,description:n})=>await a(async()=>await t.updateAccount({...r===void 0?{}:{username:r},...n===void 0?{}:{description:n}}))),e.registerTool("get-account",{description:"The account this server's credential resolves to. Run it first to confirm which tenant you are about to change.",inputSchema:{}},async()=>await a(async()=>await t.getAccount()))}function O(e,t){e.registerTool("list-orgs",{description:"Every organization this login can reach, with the current one marked.",inputSchema:{}},async()=>await a(async()=>{let s=await t.getOnboarding();return{currentOrgId:s.currentOrgId,orgs:s.orgs}})),e.registerTool("create-org",{description:"Create an organization and switch this login to it. Later calls act in the new org.",inputSchema:{name:o.string().min(1)}},async({name:s})=>await a(async()=>await t.createOnboardingOrg(s))),e.registerTool("select-org",{description:"Switch this login to another organization, by an orgId from list-orgs.",inputSchema:{orgId:o.string().min(1)}},async({orgId:s})=>await a(async()=>await t.selectOnboardingOrg(s))),e.registerTool("list-projects",{description:"Every project in the current org, empty ones last. Project names are not unique, so take the id from here.",inputSchema:{}},async()=>await a(async()=>await t.listProjects())),e.registerTool("list-stages",{description:"Every stage of one project, by project name.",inputSchema:{project:o.string().min(1)}},async({project:s})=>await a(async()=>await t.listStages(s))),e.registerTool("create-stage",{description:"Create a stage in a project, optionally cloning another stage's architecture and env vars. A project name that does not exist yet is created with it, which is the only way to make a project without deploying a manifest.",inputSchema:{project:o.string().min(1),name:o.string().min(1),from:o.string().optional().describe("Stage to clone architecture and env vars from.")}},async({project:s,name:r,from:n})=>await a(async()=>await t.createStage(s,r,n)))}function q(e,t,s){if(t)e.registerTool("rotate-secret",{description:"Rotate the account secret. The current secret stops working immediately and the new one is shown once, so this breaks every deployment and CI job still holding the old one. Requires confirm:true.",inputSchema:{confirm:h}},async({confirm:r})=>await a(async()=>(f(r,"Everything holding the current secret breaks the moment this runs."),await t.rotateSecret())));if(s)e.registerTool("delete-project",{description:"Delete a project and everything under it: stages, agents, canvas, env vars, crons and workspace files. Takes a projectId from list-projects and requires confirm:true.",inputSchema:{projectId:o.string().min(1),confirm:h}},async({projectId:r,confirm:n})=>await a(async()=>(f(n,`Project '${r}' and everything under it goes away: name it, get the owner's agreement, then retry.`),await s.deleteProject(r))))}export{Mt as createBroodsMcpServer};