broods 0.43.1 → 0.44.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/account.d.ts +68 -2
- package/dist/account.js +1 -1
- package/dist/{chunk-gx4bgysk.js → chunk-7ddy2nyy.js} +1 -1
- package/dist/chunk-a3f2xzbr.js +2 -0
- package/dist/{chunk-43d2rmnt.js → chunk-dcjq5a2g.js} +10 -10
- package/dist/{chunk-kv5jt2qt.js → chunk-dmax7s31.js} +3 -3
- package/dist/{chunk-f3e652yr.js → chunk-ee92fs0x.js} +1 -1
- package/dist/{chunk-e1r3sjyg.js → chunk-g9yebag8.js} +1 -1
- package/dist/chunk-m7ws7kqc.js +19 -0
- package/dist/{chunk-44z8fx25.js → chunk-naxtmb6t.js} +33 -33
- package/dist/{chunk-r0kw4h6z.js → chunk-qyq5kyz9.js} +1 -1
- package/dist/{chunk-8h6ctjyq.js → chunk-t0fvmbkd.js} +4 -4
- package/dist/cli/index.js +84 -67
- package/dist/index.d.ts +68 -2
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-6en45n1d.js +0 -19
- package/dist/chunk-p7t6yawg.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ type AgentHookEventName = (typeof AGENT_HOOK_EVENT_NAMES)[number];
|
|
|
10
10
|
/**
|
|
11
11
|
* Every Vercel AI SDK provider that ships language models, the community
|
|
12
12
|
* providers on the same spec that take an API key (`cloudflare`, `llmgateway`,
|
|
13
|
-
* `ollama`, `openrouter`),
|
|
13
|
+
* `ollama`, `openrouter`), `custom` (any OpenAI-compatible endpoint), and
|
|
14
|
+
* `chatgpt` (OpenAI on a Sign in with ChatGPT login instead of an API key).
|
|
14
15
|
* Image-, speech- and transcription-only providers are deliberately absent:
|
|
15
16
|
* they cannot back `config.model`.
|
|
16
17
|
*/
|
|
@@ -39,6 +40,10 @@ declare const MODEL_PROVIDERS: {
|
|
|
39
40
|
readonly label: "Cerebras";
|
|
40
41
|
readonly modelPlaceholder: "llama3.1-8b";
|
|
41
42
|
};
|
|
43
|
+
readonly chatgpt: {
|
|
44
|
+
readonly label: "ChatGPT plan";
|
|
45
|
+
readonly modelPlaceholder: "gpt-5.5";
|
|
46
|
+
};
|
|
42
47
|
readonly cloudflare: {
|
|
43
48
|
readonly label: "Cloudflare Workers AI";
|
|
44
49
|
readonly modelPlaceholder: "@cf/meta/llama-3.3-70b-instruct-fp8-fast";
|
|
@@ -1682,6 +1687,56 @@ declare class BroodsClient {
|
|
|
1682
1687
|
}
|
|
1683
1688
|
declare function normalizeHttpServiceUrl(value: string): string;
|
|
1684
1689
|
|
|
1690
|
+
/**
|
|
1691
|
+
* Connections: external accounts an agent acts through, one of each type per
|
|
1692
|
+
* Broods account. `broods connect <type>` opens the provider's sign-in; the
|
|
1693
|
+
* deployment trades the code, checks the ID token and keeps the tokens, and
|
|
1694
|
+
* core refreshes them from then on. `chatgpt` backs the `chatgpt` model
|
|
1695
|
+
* provider. Plain data, so the CLI, the config plane, core and the dashboard
|
|
1696
|
+
* read one copy.
|
|
1697
|
+
*/
|
|
1698
|
+
declare const CONNECTION_TYPE_NAMES: readonly ["chatgpt"];
|
|
1699
|
+
type ConnectionType = (typeof CONNECTION_TYPE_NAMES)[number];
|
|
1700
|
+
/** Starts a sign-in: `POST /v1/account/connections/{type}/start`. */
|
|
1701
|
+
interface ConnectionStart {
|
|
1702
|
+
/** The loopback address the provider redirects back to. */
|
|
1703
|
+
redirectUri: string;
|
|
1704
|
+
codeChallenge: string;
|
|
1705
|
+
state: string;
|
|
1706
|
+
nonce: string;
|
|
1707
|
+
}
|
|
1708
|
+
/** The provider's consent screen, plus the client and host id the PUT echoes back. */
|
|
1709
|
+
interface ConnectionStartResult {
|
|
1710
|
+
authorizeUrl: string;
|
|
1711
|
+
/** The client the consent runs on; a redirect that signs in again may omit it. */
|
|
1712
|
+
clientId: string;
|
|
1713
|
+
hostId: string;
|
|
1714
|
+
}
|
|
1715
|
+
/** Finishes a sign-in: `PUT /v1/account/connections/{type}` with the redirect's code. */
|
|
1716
|
+
interface ConnectionCode {
|
|
1717
|
+
code: string;
|
|
1718
|
+
codeVerifier: string;
|
|
1719
|
+
redirectUri: string;
|
|
1720
|
+
nonce: string;
|
|
1721
|
+
/** The client OpenAI issued on the redirect, else the one `start` answered. */
|
|
1722
|
+
clientId: string;
|
|
1723
|
+
hostId: string;
|
|
1724
|
+
}
|
|
1725
|
+
/** A connection as the API answers it: never its tokens. */
|
|
1726
|
+
interface Connection {
|
|
1727
|
+
type: ConnectionType;
|
|
1728
|
+
clientId: string;
|
|
1729
|
+
/** The deployment's `ext_agent_host_id`, kept across sign-ins. */
|
|
1730
|
+
hostId: string;
|
|
1731
|
+
email?: string;
|
|
1732
|
+
scopes: string[];
|
|
1733
|
+
/** ISO 8601 access-token expiry; Broods refreshes it before then. */
|
|
1734
|
+
expiresAt: string;
|
|
1735
|
+
updatedAt: string;
|
|
1736
|
+
/** Answered by a sign-in only: the models the plan may call. */
|
|
1737
|
+
models?: string[];
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1685
1740
|
/**
|
|
1686
1741
|
* Account config-plane client for the broods public account REST API.
|
|
1687
1742
|
*
|
|
@@ -1752,6 +1807,7 @@ interface AccountEnvVar {
|
|
|
1752
1807
|
/** ISO 8601, like every other timestamp in the API. */
|
|
1753
1808
|
updatedAt: string;
|
|
1754
1809
|
}
|
|
1810
|
+
|
|
1755
1811
|
/** Fields accepted by `PATCH /v1/agents/{id}`. `config` is deep-merged; `null` values delete keys. */
|
|
1756
1812
|
interface UpdateAgentInput {
|
|
1757
1813
|
name?: string;
|
|
@@ -2059,6 +2115,16 @@ declare class BroodsAccountClient {
|
|
|
2059
2115
|
setEnvVar(name: string, value: string): Promise<void>;
|
|
2060
2116
|
/** Delete one account environment variable. Returns false when it is already absent. */
|
|
2061
2117
|
deleteEnvVar(name: string): Promise<boolean>;
|
|
2118
|
+
/** The account's connections (`broods connect`), never their tokens. */
|
|
2119
|
+
listConnections(): Promise<Connection[]>;
|
|
2120
|
+
/** The account's connection of one type, or null when there is none. */
|
|
2121
|
+
getConnection(type: ConnectionType): Promise<Connection | null>;
|
|
2122
|
+
/** Starts a sign-in: the provider's consent screen for `broods connect` to open. */
|
|
2123
|
+
startConnection(type: ConnectionType, start: ConnectionStart): Promise<ConnectionStartResult>;
|
|
2124
|
+
/** Finishes a sign-in with the code the browser brought back; the deployment keeps the tokens. */
|
|
2125
|
+
connect(type: ConnectionType, code: ConnectionCode): Promise<Connection>;
|
|
2126
|
+
/** Forget a connection and revoke it at the provider. False when there was none. */
|
|
2127
|
+
disconnect(type: ConnectionType): Promise<boolean>;
|
|
2062
2128
|
listCrons(): Promise<Cron[]>;
|
|
2063
2129
|
createCron(input: CreateCronInput): Promise<Cron>;
|
|
2064
2130
|
getCron(cronId: string): Promise<Cron | null>;
|
|
@@ -2949,4 +3015,4 @@ declare function isConnectionDefinition(value: unknown): value is AnyConnectionD
|
|
|
2949
3015
|
declare function isResource(value: unknown): value is AnyResource;
|
|
2950
3016
|
|
|
2951
3017
|
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, defineGoogleChatChannel, defineGoogleChatConnection, defineHarness, defineInstagramChannel, defineInstagramConnection, defineLinearChannel, defineLinearConnection, defineMatrixChannel, defineMatrixConnection, defineMcp, defineMessengerChannel, defineMessengerConnection, definePancakeChannel, definePancakeConnection, definePolicy, defineSandbox, defineSkill, defineSlackChannel, defineSlackConnection, defineTeamsChannel, defineTeamsConnection, defineTelegramChannel, defineTelegramConnection, defineTwilioChannel, defineTwilioConnection, defineWhatsAppChannel, defineWhatsAppConnection, defineWorkspace, defineZaloChannel, defineZaloConnection, env, envPlaceholder, isBroodsConfig, isConnectionDefinition, isLogLevel, isObservabilityClientMessage, isResource, isRootSpanKind, isSandboxLogId, isTraceId, normalizeHttpServiceUrl, readSseStream, resolveEnvCredential, resolveRunEvents, toWebSocketBaseUrl, webSocketSubprotocols };
|
|
2952
|
-
export type { Account, AccountAgent, AccountChannel, AccountEnvVar, AccountMcp, AccountPolicy, AccountRole, AccountSandbox, AccountWorkspace, Agent, AgentChannelsConfig, AgentCodeHookConfig, AgentConfig, AgentConfigDoc, AgentContinueInput, AgentDefinitionConfig, AgentDiscordChannelConfig, AgentGitHubChannelConfig, AgentGoogleChatChannelConfig, AgentHandle, AgentHookEventName, AgentHooks, AgentHooksConfig, AgentInstagramChannelConfig, AgentLinearChannelConfig, AgentMatrixChannelConfig, AgentMessengerChannelConfig, AgentPancakeChannelConfig, AgentProviderSettings, AgentReference, AgentResource, AgentRunAnswerInput, AgentRunEventInput, AgentRunInput, AgentRunModelOverrides, AgentRunOverrides, AgentRunResult, AgentSkillsDefinitionConfig, AgentSlackChannelConfig, AgentStreamPart, AgentSubagentDefinitionConfig, AgentTeamsChannelConfig, AgentTelegramChannelConfig, AgentTwilioChannelConfig, AgentWebhookHookConfig, AgentWhatsAppChannelConfig, 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, ConfigPatch, ConnectionDefinition, CreateAgentResult, 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, GoogleChatChannelInput, GoogleChatConnectionDefinition, GoogleChatConnectionInput, GoogleChatMessageSource, GoogleChatSource, HarnessDefinition, HarnessType, HookAgentConfig, HookContext, Id, IngressMode, IngressStatus, InstagramChannelInput, InstagramConnectionDefinition, InstagramConnectionInput, InstagramMessageSource, InstagramSource, LinearChannelInput, LinearConnectionDefinition, LinearConnectionInput, LinearMessageSource, LinearSource, LogLevel, MatrixChannelInput, MatrixConnectionDefinition, MatrixConnectionInput, MatrixMessageSource, MatrixSource, McpDefinitionConfig, McpHandler, McpOauthInput, McpResource, MessengerChannelInput, MessengerConnectionDefinition, MessengerConnectionInput, MessengerMessageSource, MessengerSource, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityFetchTraceMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelInput, PancakeConnectionDefinition, PancakeConnectionInput, PancakeMessageSource, PancakeSource, PendingQuestion, PolicyDefinitionConfig, PolicyDocument, PolicyResource, ProjectDoc, ProviderConfigInput, ProviderSettingsInput, QuestionAnswer, 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, TaskWaitingOn, TeamsChannelInput, TeamsConnectionDefinition, TeamsConnectionInput, TeamsMessageSource, TeamsSource, TelegramChannelInput, TelegramConnectionDefinition, TelegramConnectionInput, TelegramMessageSource, TelegramSource, ToolApprovalSummary, TwilioChannelInput, TwilioConnectionDefinition, TwilioConnectionInput, TwilioMessageSource, TwilioSource, UpdateAgentInput, UpdateCronInput, UpdateMcpInput, WebSocketAttachInput, WebSocketClientAttachMessage, WebSocketClientCancelMessage, WebSocketClientControlMessage, WebSocketClientExecuteMessage, WebSocketClientMessage, WebSocketConstructorLike, WebSocketHandlers, WebSocketLike, WebSocketOutputMessage, WebSocketRunInput, WebSocketServerMessage, WebSocketStreamMessage, WebSocketSubscription, WhatsAppChannelInput, WhatsAppConnectionDefinition, WhatsAppConnectionInput, WhatsAppMessageSource, WhatsAppSource, Workspace, WorkspaceConfig, WorkspaceConfigDoc, WorkspaceDefinitionConfig, WorkspaceFileEntry, WorkspaceResource, ZaloChannelInput, ZaloConnectionDefinition, ZaloConnectionInput, ZaloMessageSource, ZaloSource };
|
|
3018
|
+
export type { Account, AccountAgent, AccountChannel, AccountEnvVar, AccountMcp, AccountPolicy, AccountRole, AccountSandbox, AccountWorkspace, Agent, AgentChannelsConfig, AgentCodeHookConfig, AgentConfig, AgentConfigDoc, AgentContinueInput, AgentDefinitionConfig, AgentDiscordChannelConfig, AgentGitHubChannelConfig, AgentGoogleChatChannelConfig, AgentHandle, AgentHookEventName, AgentHooks, AgentHooksConfig, AgentInstagramChannelConfig, AgentLinearChannelConfig, AgentMatrixChannelConfig, AgentMessengerChannelConfig, AgentPancakeChannelConfig, AgentProviderSettings, AgentReference, AgentResource, AgentRunAnswerInput, AgentRunEventInput, AgentRunInput, AgentRunModelOverrides, AgentRunOverrides, AgentRunResult, AgentSkillsDefinitionConfig, AgentSlackChannelConfig, AgentStreamPart, AgentSubagentDefinitionConfig, AgentTeamsChannelConfig, AgentTelegramChannelConfig, AgentTwilioChannelConfig, AgentWebhookHookConfig, AgentWhatsAppChannelConfig, 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, ConfigPatch, Connection, ConnectionCode, ConnectionDefinition, ConnectionStart, ConnectionStartResult, ConnectionType, CreateAgentResult, 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, GoogleChatChannelInput, GoogleChatConnectionDefinition, GoogleChatConnectionInput, GoogleChatMessageSource, GoogleChatSource, HarnessDefinition, HarnessType, HookAgentConfig, HookContext, Id, IngressMode, IngressStatus, InstagramChannelInput, InstagramConnectionDefinition, InstagramConnectionInput, InstagramMessageSource, InstagramSource, LinearChannelInput, LinearConnectionDefinition, LinearConnectionInput, LinearMessageSource, LinearSource, LogLevel, MatrixChannelInput, MatrixConnectionDefinition, MatrixConnectionInput, MatrixMessageSource, MatrixSource, McpDefinitionConfig, McpHandler, McpOauthInput, McpResource, MessengerChannelInput, MessengerConnectionDefinition, MessengerConnectionInput, MessengerMessageSource, MessengerSource, ObservabilityBackfillMessage, ObservabilityClientMessage, ObservabilityErrorMessage, ObservabilityFetchTraceMessage, ObservabilityLogEntry, ObservabilityLogMessage, ObservabilityReadyMessage, ObservabilityServerMessage, ObservabilitySpanMessage, ObservabilitySpanRow, ObservabilitySubscribeMessage, ObservabilityUnsubscribeMessage, PancakeChannelInput, PancakeConnectionDefinition, PancakeConnectionInput, PancakeMessageSource, PancakeSource, PendingQuestion, PolicyDefinitionConfig, PolicyDocument, PolicyResource, ProjectDoc, ProviderConfigInput, ProviderSettingsInput, QuestionAnswer, 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, TaskWaitingOn, TeamsChannelInput, TeamsConnectionDefinition, TeamsConnectionInput, TeamsMessageSource, TeamsSource, TelegramChannelInput, TelegramConnectionDefinition, TelegramConnectionInput, TelegramMessageSource, TelegramSource, ToolApprovalSummary, TwilioChannelInput, TwilioConnectionDefinition, TwilioConnectionInput, TwilioMessageSource, TwilioSource, UpdateAgentInput, UpdateCronInput, UpdateMcpInput, WebSocketAttachInput, WebSocketClientAttachMessage, WebSocketClientCancelMessage, WebSocketClientControlMessage, WebSocketClientExecuteMessage, WebSocketClientMessage, WebSocketConstructorLike, WebSocketHandlers, WebSocketLike, WebSocketOutputMessage, WebSocketRunInput, WebSocketServerMessage, WebSocketStreamMessage, WebSocketSubscription, WhatsAppChannelInput, WhatsAppConnectionDefinition, WhatsAppConnectionInput, WhatsAppMessageSource, WhatsAppSource, Workspace, WorkspaceConfig, WorkspaceConfigDoc, WorkspaceDefinitionConfig, WorkspaceFileEntry, WorkspaceResource, ZaloChannelInput, ZaloConnectionDefinition, ZaloConnectionInput, ZaloMessageSource, ZaloSource };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V,ge,Me,Pe,Ne,je,G,Ie,
|
|
1
|
+
import{V,ge,Me,Pe,Ne,je,G,Ie,E,ye,F,J,xe,Y,z,qe,De,Le,Ue,Fe,Be,Ze,He,Ve,Ge,We,Ke,Je,Ye,Xe,Qe,et,tt,nt,rt,ot,st,it,at,ct,lt,ut,dt,pt,mt,ht,ft,gt,yt,St,bt,vt,_t,ie,w,g}from"./chunk-t0fvmbkd.js";import{m,Ae,Z,R}from"./chunk-a3f2xzbr.js";export{m as BroodsAccountApiError,R as BroodsAccountClient,F as BroodsClient,xe as BroodsWebSocketClient,E as DEFAULT_CORE_BASE_URL,ye as IngressAcceptedError,Me as MAX_OBSERVABILITY_BACKFILL,xe as WebSocketClient,xe as WebsocketClient,De as defineAgent,Le as defineBroods,Ue as defineCron,ct as defineDiscordChannel,We as defineDiscordConnection,lt as defineGitHubChannel,Ke as defineGitHubConnection,ut as defineGoogleChatChannel,Je as defineGoogleChatConnection,Fe as defineHarness,dt as defineInstagramChannel,Ye as defineInstagramConnection,pt as defineLinearChannel,Xe as defineLinearConnection,mt as defineMatrixChannel,Qe as defineMatrixConnection,Be as defineMcp,ht as defineMessengerChannel,et as defineMessengerConnection,ft as definePancakeChannel,tt as definePancakeConnection,Ze as definePolicy,He as defineSandbox,Ve as defineSkill,gt as defineSlackChannel,nt as defineSlackConnection,yt as defineTeamsChannel,rt as defineTeamsConnection,St as defineTelegramChannel,ot as defineTelegramConnection,bt as defineTwilioChannel,st as defineTwilioConnection,vt as defineWhatsAppChannel,it as defineWhatsAppConnection,Ge as defineWorkspace,_t as defineZaloChannel,at as defineZaloConnection,qe as env,Ae as envPlaceholder,ie as isBroodsConfig,w as isConnectionDefinition,Pe as isLogLevel,Ne as isObservabilityClientMessage,g as isResource,je as isRootSpanKind,G as isSandboxLogId,Ie as isTraceId,J as normalizeHttpServiceUrl,ge as readSseStream,Z as resolveEnvCredential,V as resolveRunEvents,Y as toWebSocketBaseUrl,z as webSocketSubprotocols};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "broods",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "CLI + TypeScript SDK for the broods agent platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"esbuild": "^0.28.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@ai-sdk/tui": "1.0.
|
|
62
|
+
"@ai-sdk/tui": "1.0.128",
|
|
63
63
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
64
64
|
"@chat-adapter/discord": "^4.38.1",
|
|
65
65
|
"@chat-adapter/github": "^4.38.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@modelcontextprotocol/server": "2.0.0",
|
|
69
69
|
"@types/bun": "^1.3.14",
|
|
70
70
|
"@typescript/typescript6": "6.0.2",
|
|
71
|
-
"ai": "^7.0.
|
|
71
|
+
"ai": "^7.0.127",
|
|
72
72
|
"publint": "^0.3.23",
|
|
73
73
|
"rollup": "^4.62.4",
|
|
74
74
|
"rollup-plugin-dts": "^6.5.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"zod": "^4.4.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"ai": "^7.0.
|
|
79
|
+
"ai": "^7.0.127"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=22.15"
|
package/dist/chunk-6en45n1d.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{getToolName as St,isToolUIPart as J,readUIMessageStream as wt}from"ai";import{convertToModelMessages as te,generateId as ee,getToolName as re,isToolUIPart as Q}from"ai";var H=String.fromCharCode(27),ve=new RegExp(`${H}\\[[0-?]*[ -/]*[@-~]`,"g"),M=new RegExp(`^${H}\\[[0-?]*[ -/]*[@-~]`);function h(t){let e=0,r=0;while(r<t.length){let s=t.slice(r).match(M);if(s){r+=s[0].length;continue}let a=t.codePointAt(r);if(a==null)break;let i=String.fromCodePoint(a);e+=K(a),r+=i.length}return e}function v(t,e){if(e<=0)return"";let r="",s=0,a=0;while(a<t.length&&s<e){let i=t.slice(a).match(M);if(i){r+=i[0],a+=i[0].length;continue}let o=t.codePointAt(a);if(o==null)break;let u=String.fromCodePoint(o),l=K(o);if(l>0&&s+l>e)break;r+=u,a+=u.length,s+=l}while(a<t.length){let i=t.slice(a).match(M);if(!i)break;r+=i[0],a+=i[0].length}return r}function K(t){if(t===9)return 4;if(t<32||t>=127&&t<160)return 0;if(at(t))return 0;return nt(t)?2:1}function at(t){return t>=768&&t<=879||t>=1155&&t<=1161||t>=1425&&t<=1469||t===1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t===1479||t>=1552&&t<=1562||t>=1611&&t<=1631||t===1648||t>=1750&&t<=1756||t>=1759&&t<=1764||t>=1767&&t<=1768||t>=1770&&t<=1773||t===1809||t>=1840&&t<=1866||t>=1958&&t<=1968||t>=2027&&t<=2035||t>=2070&&t<=2073||t>=2075&&t<=2083||t>=2085&&t<=2087||t>=2089&&t<=2093||t>=2137&&t<=2139||t>=2259&&t<=2306||t===2362||t===2364||t>=2369&&t<=2376||t===2381||t>=2385&&t<=2391||t===8205||t>=65024&&t<=65039||t>=917760&&t<=917999}function nt(t){return t>=4352&&(t<=4447||t===9001||t===9002||t>=11904&&t<=42191&&t!==12351||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510||t>=127744&&t<=128591||t>=129280&&t<=129535||t>=131072&&t<=262141)}function g(t,{multiline:e=!1}={}){let r="";for(let s of t){let a=s.charCodeAt(0);if(s===`
|
|
2
|
-
`&&e)r+=`
|
|
3
|
-
`;else if(s==="\t")r+=" ";else if(a<32||a>=127&&a<=159)r+=`\\u${a.toString(16).padStart(4,"0")}`;else r+=s}return r}var d={bold:"\x1B[1m",boldOff:"\x1B[22m",italic:"\x1B[3m",italicOff:"\x1B[23m"},it="─";function ot(t){let e=g(t,{multiline:!0}).split(`
|
|
4
|
-
`),r=[];for(let s=0;s<e.length;s+=1){let a=ut(e,s);if(a!=null){r.push(...pt(a)),s=a.endIndex-1;continue}r.push(lt(e[s]??""))}return r.join(`
|
|
5
|
-
`)}function lt(t){if(t.startsWith("### "))return p(`▶ ${t.slice(4)}`);if(t.startsWith("## "))return p(`■ ${t.slice(3)}`);if(t.startsWith("# "))return p(`█ ${t.slice(2)}`);let e=t.match(/^(\s*)[-+*]\s+(.*)$/);if(e){let[,r,s=""]=e;return p(`${r}•${s.length>0?` ${s}`:""}`)}if(/^\d+\. /.test(t))return p(t.replace(/^(\d+)\. /,"$1. "));if(t.startsWith("> "))return p(`│ ${t.slice(2)}`);return p(t)}function p(t){return t.replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*\n]+)\*\*/g,`${d.bold}$1${d.boldOff}`).replace(/__([^_\n]+)__/g,`${d.bold}$1${d.boldOff}`).replace(/\*([^*\n]+)\*/g,`${d.italic}$1${d.italicOff}`).replace(/_([^_\n]+)_/g,`${d.italic}$1${d.italicOff}`)}function ut(t,e){let r=k(t[e]??"");if(r==null||r.length<2)return;let s=k(t[e+1]??"");if(s==null||s.length!==r.length)return;let a=ct(s);if(a==null)return;let i=[],o=e+2;while(o<t.length){let u=k(t[o]??"");if(u==null)break;i.push(dt(u,r.length)),o+=1}return{alignments:a,endIndex:o,header:r,rows:i}}function k(t){if(!t.includes("|"))return;let e=t.trim();if(e.startsWith("|"))e=e.slice(1);if(e.endsWith("|")&&!e.endsWith("\\|"))e=e.slice(0,-1);let r=[],s="";for(let a=0;a<e.length;a+=1){let i=e[a],o=e[a+1];if(i==="\\"&&o==="|"){s+="|",a+=1;continue}if(i==="|"){r.push(s.trim()),s="";continue}s+=i}return r.push(s.trim()),r}function ct(t){let e=[];for(let r of t){let s=r.match(/^(:)?-{3,}(:)?$/);if(s==null)return;let[,a,i]=s;e.push(a!=null&&i!=null?"center":i!=null?"right":"left")}return e}function dt(t,e){return Array.from({length:e},(r,s)=>t[s]??"")}function pt(t){let e=t.header.map((i)=>`${d.bold}${p(i)}${d.boldOff}`),r=t.rows.map((i)=>i.map(p)),s=[e,...r],a=t.alignments.map((i,o)=>Math.max(3,...s.map((u)=>h(u[o]??""))));return[E(e,a,t.alignments),a.map((i)=>it.repeat(i)).join(" "),...r.map((i)=>E(i,a,t.alignments))]}function E(t,e,r){return t.map((s,a)=>ht(s,e[a]??0,r[a]??"left")).join(" ")}function ht(t,e,r){let s=Math.max(0,e-h(t));if(r==="right")return`${" ".repeat(s)}${t}`;if(r==="center"){let a=Math.floor(s/2),i=s-a;return`${" ".repeat(a)}${t}${" ".repeat(i)}`}return`${t}${" ".repeat(s)}`}var j="─";function ft(t){let e=Math.max(20,t.width),r=Math.max(8,t.height),s=3,i=r-3-2,o=t.visibleBodyLines.slice(0,i);while(o.length<i)o.push("");return[A(e,t.title,t.rightTitle),...o.map((l)=>U(l,e)),R(e),A(e,t.inputActive?"Input":"Status"),U(t.inputActive?`> ${g(t.input)}${t.inputCursorVisible===!1?" ":"█"}`:g(t.status??"Streaming... ↑/↓ scroll · Ctrl+C quit"),e),R(e)].join(`
|
|
6
|
-
`)}function A(t,e,r){e=g(e),r=r==null?void 0:g(r);let s=Math.max(0,t-2),a=e?v(` ${e} `,s):"",i=r?v(` ${r} `,Math.max(0,s-h(a))):"",o=Math.max(0,s-h(a)-h(i));return`┌${a}${j.repeat(o)}${i}┐`}function R(t){return`└${j.repeat(t-2)}┘`}function U(t,e){let r=e-4,s=v(t,r),a=" ".repeat(Math.max(0,r-h(s)));return`│ ${s}${a} │`}var y="\x1B",mt=`${y}[H`,gt=`${y}[2J`,vt=`${y}[2K`,yt=`${y}[?2026h`,bt=`${y}[?2026l`,xt=class{#e;#r;#i;#c=!1;#d=!1;constructor(t,e){this.#r=t.write.bind(t),this.#e=e?.useSynchronizedUpdates??!0,t.write=(r,s,a)=>{if(!this.#c)this.#d=!0;return this.#r(r,s,a)}}present(t){let e=Tt(t),r=this.#i&&!this.#d?kt(this.#i,e):`${mt}${gt}${t}`;if(this.#i=e,this.#d=!1,r.length===0)return;this.#S(r)}reset(){this.#i=void 0}#S(t){this.#c=!0;try{if(!this.#e){this.#r(t);return}this.#r(`${yt}${t}${bt}`)}finally{this.#c=!1}}};function Tt(t){return{lines:t.split(`
|
|
7
|
-
`)}}function kt(t,e){let r="",s=Math.max(t.lines.length,e.lines.length);for(let a=0;a<s;a++){let i=e.lines[a];if(t.lines[a]===i)continue;r+=`${y}[${a+1};1H${vt}${i??""}`}return r}var Mt="outputTokensPerSecond",c={reset:"\x1B[0m",dim:"\x1B[2m",user:"\x1B[96m",assistant:"\x1B[92m",reasoning:"\x1B[94m",tool:"\x1B[95m",error:"\x1B[91m"},$t={user:{color:c.user,border:"─"},assistant:{color:c.assistant,border:"─"},reasoning:{color:c.reasoning,border:"·"},tool:{color:c.tool,border:"─"},error:{color:c.error,border:"─"}},Ct=500,It=new Intl.Segmenter(void 0,{granularity:"grapheme"}),m="↑/↓ · PgUp/PgDn · Esc/Ctrl+C",Bt="↑/↓ · PgUp/PgDn · q/Esc/Ctrl+C",b=`Processing input... ${m}`,L=`Processing tool results... ${m}`,S=`Streaming... ${m}`,O=`Executing tools... ${m}`,C=class{#e;#r;#i;#c;#d;#S;#F;#a=[];#u="";#g=!1;#p=0;#I="";#s=S;#w=!1;#n=!1;#h;#B;#f;#v;#y=!0;#b;#o;#x;#E;constructor(t){this.#e=t?.input??process.stdin,this.#r=t?.output??process.stdout,this.#i=t?.frameBuffer??new xt(this.#r),this.#c=t?.tools??"auto-collapsed",this.#d=t?.reasoning??"auto-collapsed",this.#S=t?.responseStatistics??Mt,this.#F=t?.contextSize,this.#B=t?.contextSize}async readPrompt(t){return this.#A(t),this.#g=!0,this.#u=t?.initialPrompt??"",this.#s=`Type a prompt and press Enter · ${m}`,this.#K(),this.#t(),await new Promise((e,r)=>{this.#o=(s)=>{let a=T(s);switch(a.type){case"character":this.#u+=a.value,this.#U(),this.#t();break;case"backspace":this.#u=Pt(this.#u),this.#U(),this.#t();break;case"enter":{let i=this.#u;this.#g=!1,this.#C(),this.#s=b,this.#N(i),this.#u="",this.#t(),this.#l(),e(i);break}case"up":case"down":this.#T(a.type);break;case"page-up":case"page-down":this.#$(a.type);break;case"ctrl-l":this.#k();break;case"escape":case"ctrl-c":this.#C(),this.#R(),r(w());break;case"ignore":break}},this.#M()})}async renderStream(t,e){this.#A(e),this.#g=!1,this.#s=b,this.#j(e?.submittedPrompt),this.#n=!1,this.#h=void 0,this.#f=void 0,this.#v=void 0;let r={tools:e?.tools??this.#c,reasoning:e?.reasoning??this.#d,responseStatistics:e?.responseStatistics??this.#S};this.#t();let s=new Promise((o)=>{this.#E=o});this.#o=(o)=>this.#H(o),this.#M();let a,i=Dt(this.#G(t.uiMessageStream));try{let o=wt({message:t.message,stream:i,onError:(u)=>this.#q("Error",At(u))});for await(let u of Et(o,s)){if(this.#n)break;a=u,this.#D(u,r)}if(!this.#n&&a&&this.#f!=null)this.#D(a,r)}finally{if(this.#E=void 0,this.#n)t.abort?.();if(this.#l(),this.#s=this.#n?"Interrupted":e?.continueSession?`Done · Enter another prompt · ${m}`:`Done · ${Bt}`,this.#t(),await this.#Z(e),this.#n||!e?.continueSession)this.#R()}if(this.#n)throw w();return a}async readToolApproval(t,e){return this.#A(e),this.#g=!1,this.#s=`Approve ${Ft(t)}? y/n · ${m}`,this.#n=!1,this.#t(),await new Promise((r,s)=>{this.#o=(a)=>{let i=T(a);switch(i.type){case"character":{let o=i.value.toLowerCase();if(o==="y")this.#s=`Approved · ${b}`,this.#l(),this.#t(),r({approved:!0});else if(o==="n")this.#s=`Denied · ${b}`,this.#l(),this.#t(),r({approved:!1,reason:"Denied by user."});break}case"up":case"down":this.#T(i.type);break;case"page-up":case"page-down":this.#$(i.type);break;case"ctrl-l":this.#k();break;case"escape":case"ctrl-c":this.#n=!0,this.#R(),s(w());break;default:break}},this.#M()})}#A(t){if(this.#I=t?.title??this.#I,this.#B=t?.contextSize??this.#F,this.#w)return;if(this.#w=!0,this.#i.reset(),this.#r.write("\x1B[?1049h\x1B[?25l"),this.#e.isTTY)this.#e.setRawMode?.(!0),this.#e.resume();this.#x=()=>this.#k(),this.#r.on("resize",this.#x)}#R(){if(this.#l(),this.#C(),!this.#w)return;if(this.#e.isTTY)this.#e.setRawMode?.(!1),this.#e.pause();if(this.#x)this.#r.off("resize",this.#x),this.#x=void 0;this.#r.write("\x1B[?25h\x1B[?1049l"),this.#i.reset(),this.#w=!1}#M(){if(this.#o)this.#e.on("data",this.#o)}#l(){if(this.#o)this.#e.off("data",this.#o),this.#o=void 0}#H(t){let e=T(t);switch(e.type){case"up":case"down":this.#T(e.type);break;case"page-up":case"page-down":this.#$(e.type);break;case"ctrl-l":this.#k();break;case"escape":case"ctrl-c":this.#n=!0,this.#E?.();break;default:break}}#T(t,e=1){let r=t==="up"?e:-e;this.#p=this.#_(this.#p+r),this.#t()}#$(t){this.#T(t==="page-up"?"up":"down",this.#W())}#K(){this.#C(),this.#U(),this.#b=setInterval(()=>{this.#y=!this.#y,this.#t()},Ct),this.#b.unref?.()}#C(){if(this.#b)clearInterval(this.#b),this.#b=void 0;this.#y=!0}#U(){this.#y=!0}#j(t){if(t==null)return;let e=this.#a.at(-1);if(e?.kind==="user"&&e.content===t)return;this.#N(t)}#N(t){let e=this.#m();this.#a.push({kind:"user",title:"User",content:t}),this.#O(e)}#D(t,e){let r=this.#m(),s=new Set,a=Jt(t.metadata);this.#h=a.totalTokens??this.#h,this.#f=a.outputTokens??this.#f,this.#v=a.outputTokensPerSecond??this.#v;for(let[i,o]of t.parts.entries()){let u=Nt(t.id,i);switch(o.type){case"text":{let l=o.text.trim();if(l.length===0)break;s.add(u),this.#L({id:u,kind:"assistant",title:"Assistant",rightTitle:Zt({totalTokens:this.#h,outputTokens:this.#f,outputTokensPerSecond:this.#v},e.responseStatistics),content:l});break}case"reasoning":{let l=o.text.trim();if(e.reasoning==="hidden"||l.length===0)break;s.add(u),this.#L({id:u,kind:"reasoning",title:"Reasoning",content:l,collapsed:W(t,i,e.reasoning,e)});break}default:if(J(o)){if(e.tools==="hidden")break;s.add(u),this.#L({id:u,...Rt(o,{mode:e.tools,collapsed:W(t,i,e.tools,e)})})}break}}this.#J(t.id,s),this.#O(r)}#L(t){let e=t.id?this.#a.find((r)=>r.id===t.id):void 0;if(e){let r=e.cache;e.kind=t.kind,e.title=t.title,e.rightTitle=t.rightTitle,e.content=t.content,e.collapsed=t.collapsed,e.cache=r&&G(t,r)?r:void 0;return}this.#a.push(t)}#J(t,e){let r=`${t}:`;this.#a=this.#a.filter((s)=>s.id==null||!s.id.startsWith(r)||e.has(s.id))}async*#G(t){let e=!1;for await(let r of qt(t)){let s=Ot(r,{hasPendingToolResults:e});if(r.type==="start-step")e=!1;else if(Wt(r))e=!0;if(s&&this.#s!==s)this.#s=s,this.#t();else if(Lt(r)&&this.#s!==S)this.#s=S,this.#t();if(r.type==="error")this.#q("Error",r.errorText);if(r.type==="finish"){let a=jt(r);this.#h=a.totalTokens,this.#f=a.outputTokens,this.#v=a.outputTokensPerSecond}yield r}}#q(t,e){let r=this.#m();this.#a.push({kind:"error",title:t,content:e}),this.#O(r)}#O(t){if(this.#p!==0){let e=this.#m()-t;this.#p=this.#_(this.#p+e)}this.#t()}#t(){let t=ft({width:this.#z(),height:this.#V(),title:this.#I,rightTitle:Z(this.#h,this.#B),visibleBodyLines:this.#Y(),input:this.#u,inputActive:this.#g,inputCursorVisible:this.#y,status:this.#s});this.#i.present(t)}#k(){this.#i.reset(),this.#t()}#Y(){if(this.#a.length===0)return["Waiting for input..."];let t=this.#W(),e=this.#m(),r=Math.max(0,e-t-this.#p),s=r+t,a=[],i=0;for(let o of this.#a){let u=F(o,this.#z()-4),l=i+u.length;if(l>r&&i<s)a.push(...u.slice(Math.max(0,r-i),s-i));if(a.length>=t)break;i=l}return a}#_(t){let e=Math.max(0,this.#m()-this.#W());return Math.min(Math.max(0,t),e)}#m(){if(this.#a.length===0)return 1;let t=0;for(let e of this.#a)t+=F(e,this.#z()-4).length;return t}#W(){return Math.max(1,this.#V()-5)}#z(){return Math.max(20,this.#r.columns??80)}#V(){return Math.max(8,this.#r.rows??24)}async#Z(t){if(t?.waitForExit===!1||!this.#e.isTTY||this.#n)return;await new Promise((e)=>{this.#o=(r)=>{let s=T(r);switch(s.type){case"up":case"down":this.#T(s.type);break;case"page-up":case"page-down":this.#$(s.type);break;case"ctrl-l":this.#k();break;case"escape":this.#l(),e();break;case"character":if(s.value==="q")this.#l(),e();break;case"ctrl-c":this.#l(),process.exitCode=130,e();break;default:break}},this.#M()})}};function w(){return Error("Interrupted")}async function*Et(t,e){let r=t[Symbol.asyncIterator](),s=e.then(()=>({done:!0,value:void 0}));while(!0){let a=await Promise.race([r.next(),s]);if(a.done)break;yield a.value}}function At(t){if(t instanceof Error)return t.message;if(typeof t==="string")return t;return JSON.stringify(t)}function Rt(t,e){let r=St(t),s=`Tool · ${t.title??r}`,a="input"in t?t.input:void 0,i=a===void 0?"Input: (streaming...)":`Input:
|
|
8
|
-
${z(a)}`,o=zt(t);if(e.collapsed)return{kind:"tool",title:s,rightTitle:o,content:"",collapsed:!0};switch(t.state){case"input-streaming":return{kind:"tool",title:s,rightTitle:o,content:i};case"input-available":return{kind:"tool",title:s,rightTitle:o,content:i};case"approval-requested":return{kind:"tool",title:s,rightTitle:o,content:i};case"approval-responded":return{kind:"tool",title:s,rightTitle:o,content:i};case"output-available":return{kind:"tool",title:s,rightTitle:o,content:`${i}
|
|
9
|
-
|
|
10
|
-
Output:
|
|
11
|
-
${z(t.output)}`};case"output-error":return{kind:"error",title:`Tool Error · ${t.title??r}`,rightTitle:o,content:`${i}
|
|
12
|
-
|
|
13
|
-
Error:
|
|
14
|
-
${t.errorText}`};case"output-denied":return{kind:"error",title:`Tool Denied · ${t.title??r}`,rightTitle:o,content:`${i}
|
|
15
|
-
|
|
16
|
-
Reason: ${t.approval.reason??"denied"}`}}}function W(t,e,r,s){switch(r){case"collapsed":return!0;case"auto-collapsed":return t.parts.slice(e+1).some((a)=>Ut(a,s));case"full":case"hidden":return!1}}function Ut(t,e){switch(t.type){case"text":return t.text.trim().length>0;case"reasoning":return e.reasoning!=="hidden"&&t.text.trim().length>0;default:return J(t)&&e.tools!=="hidden"}}function Lt(t){switch(t.type){case"text-start":case"text-delta":case"reasoning-start":case"reasoning-delta":case"tool-input-start":case"tool-input-delta":return!0;default:return!1}}function Ot(t,{hasPendingToolResults:e}){switch(t.type){case"start-step":return e?L:b;case"tool-output-available":case"tool-output-error":case"tool-output-denied":return L;case"tool-input-available":return O;case"tool-approval-response":return t.approved?O:void 0;default:return}}function Wt(t){switch(t.type){case"tool-output-available":case"tool-output-error":case"tool-output-denied":return!0;default:return!1}}function zt(t){switch(t.state){case"input-streaming":return"waiting";case"approval-requested":return"approval requested";case"input-available":return"executing";case"approval-responded":return t.approval.approved?"executing":"denied";case"output-available":case"output-error":return"done";case"output-denied":return"denied"}}function z(t){if(typeof t==="string")return t;return JSON.stringify(t,null,2)}function Ft(t){return`tool ${t.title??t.toolName}`}function Nt(t,e){return`${t}:${e}`}function Dt(t){if(t instanceof ReadableStream)return t;return new ReadableStream({async start(e){try{for await(let r of t)e.enqueue(r);e.close()}catch(r){e.error(r)}}})}async function*qt(t){if(t instanceof ReadableStream){let e=t.getReader();try{while(!0){let{done:r,value:s}=await e.read();if(r)return;yield s}}finally{e.releaseLock()}return}yield*t}function F(t,e){if(t.cache&&G(t,t.cache,e))return t.cache.lines;let r=_t(t,e);return t.cache={width:e,kind:t.kind,title:t.title,rightTitle:t.rightTitle,content:t.content,collapsed:t.collapsed===!0,lines:r},r}function G(t,e,r=e.width){return e.width===r&&e.kind===t.kind&&e.title===t.title&&e.rightTitle===t.rightTitle&&e.content===t.content&&e.collapsed===(t.collapsed===!0)}function _t(t,e){let r=$t[t.kind],s=Math.max(1,e-4),a=` ${g(t.title)} `,i=t.rightTitle?` ${g(t.rightTitle)} `:"";if(t.collapsed){let f=Math.max(0,e-2-a.length-i.length),rt=`${r.color}╭${a}${r.border.repeat(f)}${i}╮${c.reset}`,st=`${r.color}╰${r.border.repeat(Math.max(0,e-2))}╯${c.reset}`;return[rt,st]}let o=Math.max(0,e-2-a.length-i.length),u=`${r.color}╭${a}${r.border.repeat(o)}${i}╮${c.reset}`,l=`${r.color}╰${r.border.repeat(Math.max(0,e-2))}╯${c.reset}`,x=(t.content.length>0?ot(t.content):c.dim+"(streaming...)"+c.reset).split(`
|
|
17
|
-
`).flatMap((f)=>Ht(f,s));return[u,...x.map((f)=>Vt(f,s,r.color)),l]}function Vt(t,e,r){let s=v(t,e),a=" ".repeat(Math.max(0,e-h(s)));return`${r}│${c.reset} ${s}${a} ${r}│${c.reset}`}function Ht(t,e){if(t.length===0)return[""];let r=[],s=t;while(h(s)>e){let a=Kt(s,e);r.push(s.slice(0,a).trimEnd()),s=s.slice(a).trimStart()}return r.push(s),r}function Kt(t,e){let s=v(t,e+1).lastIndexOf(" ");if(s>0)return s;return v(t,e).length}function jt(t){let e="usage"in t?t.usage:void 0,r="messageMetadata"in t?t.messageMetadata?.usage:void 0,s="messageMetadata"in t?t.messageMetadata?.performance:void 0;return{totalTokens:Y(e??r),outputTokens:B(e??r),outputTokensPerSecond:s?.outputTokensPerSecond}}function Jt(t){let e=t;return{totalTokens:Y(e?.usage),outputTokens:B(e?.usage),outputTokensPerSecond:e?.performance?.outputTokensPerSecond}}function Y(t){let e=t?.totalTokens;if(typeof e==="number")return e;if(typeof e?.total==="number")return e.total;let r=Gt(t),s=B(t);if(r!=null&&s!=null)return r+s}function Gt(t){let e=t?.inputTokens;if(typeof e==="number")return e;if(typeof e?.total==="number")return e.total;return t?.promptTokens}function B(t){let e=t?.outputTokens;if(typeof e==="number")return e;if(typeof e?.total==="number")return e.total;return t?.completionTokens}function Z(t,e){if(t==null)return;let r=`${t.toLocaleString()} ${t===1?"token":"tokens"}`,s=Yt(t,e);return s==null?r:`${r} ${s}`}function Yt(t,e){if(e==null||e<=0||!Number.isFinite(e))return;return`${Math.round(t/e*100).toLocaleString()}%`}function Zt(t,e){if(e==="outputTokensPerSecond")return Qt(t.outputTokensPerSecond);return Z(t.outputTokens)}function Qt(t){if(t==null)return;return`${Xt(t)} tok/s`}function Xt(t){return Number.isInteger(t)?t.toLocaleString():t.toLocaleString(void 0,{maximumFractionDigits:1})}function Pt(t){let e=0;for(let{index:r}of It.segment(t))e=r;return t.slice(0,e)}function T(t){let e=t.toString("utf8");switch(e){case"\f":return{type:"ctrl-l"};case"\x03":return{type:"ctrl-c"};case"\x1B":return{type:"escape"};case"\r":case`
|
|
18
|
-
`:return{type:"enter"};case"":case"\b":return{type:"backspace"};case"\x1B[A":return{type:"up"};case"\x1B[B":return{type:"down"};case"\x1B[5~":return{type:"page-up"};case"\x1B[6~":return{type:"page-down"};default:if(e>=" "&&e!=="")return{type:"character",value:e};return{type:"ignore"}}}var se="outputTokensPerSecond",ae=class{constructor(t){this.chatId=ee(),this.agent=t.agent,this.transport=t.transport,this.renderer=ie(t)??ne(t),this.title=t.title,this.tools=t.tools??"auto-collapsed",this.reasoning=t.reasoning??"auto-collapsed",this.responseStatistics=t.responseStatistics??se,this.contextSize=t.contextSize,this.sandbox=t.sandbox}async run(){let t=this.title,e=[],r=0,s=()=>`message-${++r}`,a,i=!1,o=!1;while(!0){if(!o){if(a==null){if(!this.renderer.readPrompt){if(i)return;throw Error("No prompt was provided and the renderer does not support prompt input.")}try{a=await this.renderer.readPrompt({title:t})}catch(l){if(V(l))return;throw l}if(a==null)return}e.push(ue(s(),a)),i=!0}let u=await this.streamMessages([...e],s);try{let l=await this.renderer.renderStream(u,{title:t,submittedPrompt:a,continueSession:Boolean(this.renderer.readPrompt),tools:this.tools,reasoning:this.reasoning,responseStatistics:this.responseStatistics,contextSize:this.contextSize,waitForExit:!1});if(l&&l.parts.length>0){let n=ce(l);if(n.length>0){if(!this.renderer.readToolApproval)throw Error("Tool approval was requested, but the renderer does not support tool approval input.");for(let x of n){let f=await this.renderer.readToolApproval(x,{title:t});de(l,x,f)}D(e,l,o),o=!0,a=void 0;continue}D(e,l,o)}}catch(l){if(V(l))return;throw l}o=!1,a=void 0}}async streamMessages(t,e){let r=new AbortController,s=()=>r.abort();if(this.transport)return{uiMessageStream:await this.transport.sendMessages({trigger:"submit-message",chatId:this.chatId,messageId:void 0,messages:t,abortSignal:r.signal}),message:I(t),abort:s};let a=this.agent,i=await a.stream({prompt:await te(t,{tools:a.tools}),abortSignal:r.signal,options:void 0,experimental_sandbox:this.sandbox});return{uiMessageStream:oe(i.fullStream,e,t),message:I(t),abort:s}}};function ne(t){return t.tools===void 0&&t.reasoning===void 0&&t.responseStatistics===void 0&&t.contextSize===void 0?new C:new C({tools:t.tools,reasoning:t.reasoning,responseStatistics:t.responseStatistics,contextSize:t.contextSize})}function ie(t){if(t.renderer)return t.renderer;if(!t.screen&&!t.userInput)return;return new C({tools:t.tools,reasoning:t.reasoning,responseStatistics:t.responseStatistics,contextSize:t.contextSize,input:t.userInput,output:t.screen})}async function*oe(t,e,r=[]){let s=new Set,a=new Set,i=new Set,o,u,l=!1;yield{type:"start",messageId:I(r)?.id??e()};for await(let n of t)switch(n.type){case"text-start":s.add(n.id),yield{type:"text-start",id:n.id,providerMetadata:n.providerMetadata};break;case"text-delta":if(!s.has(n.id))s.add(n.id),yield{type:"text-start",id:n.id,providerMetadata:n.providerMetadata};yield{type:"text-delta",id:n.id,delta:n.text,providerMetadata:n.providerMetadata};break;case"text-end":s.delete(n.id),yield{type:"text-end",id:n.id,providerMetadata:n.providerMetadata};break;case"reasoning-start":a.add(n.id),yield{type:"reasoning-start",id:n.id,providerMetadata:n.providerMetadata};break;case"reasoning-delta":if(!a.has(n.id))a.add(n.id),yield{type:"reasoning-start",id:n.id,providerMetadata:n.providerMetadata};yield{type:"reasoning-delta",id:n.id,delta:n.text,providerMetadata:n.providerMetadata};break;case"reasoning-end":a.delete(n.id),yield{type:"reasoning-end",id:n.id,providerMetadata:n.providerMetadata};break;case"tool-input-start":yield{type:"tool-input-start",toolCallId:n.id,toolName:n.toolName,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,toolMetadata:n.toolMetadata,dynamic:n.dynamic,title:n.title};break;case"tool-input-delta":yield{type:"tool-input-delta",toolCallId:n.id,inputTextDelta:n.delta};break;case"tool-call":i.add(n.toolCallId),yield{type:"tool-input-available",toolCallId:n.toolCallId,toolName:n.toolName,input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,toolMetadata:n.toolMetadata,dynamic:n.dynamic,title:n.title};break;case"tool-approval-request":if(!i.has(n.toolCall.toolCallId))i.add(n.toolCall.toolCallId),yield{type:"tool-input-available",toolCallId:n.toolCall.toolCallId,toolName:n.toolCall.toolName,input:n.toolCall.input,providerExecuted:n.toolCall.providerExecuted,providerMetadata:n.toolCall.providerMetadata,toolMetadata:n.toolCall.toolMetadata,dynamic:n.toolCall.dynamic,title:n.toolCall.title};yield{type:"tool-approval-request",approvalId:n.approvalId,toolCallId:n.toolCall.toolCallId,isAutomatic:n.isAutomatic};break;case"tool-approval-response":yield{type:"tool-approval-response",approvalId:n.approvalId,approved:n.approved,reason:n.reason,providerExecuted:n.providerExecuted};break;case"tool-result":yield{type:"tool-output-available",toolCallId:n.toolCallId,output:n.output,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,toolMetadata:n.toolMetadata,dynamic:n.dynamic,preliminary:n.preliminary};break;case"tool-error":yield{type:"tool-output-error",toolCallId:n.toolCallId,errorText:q(n.error),providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,toolMetadata:n.toolMetadata,dynamic:n.dynamic};break;case"tool-output-denied":yield{type:"tool-output-denied",toolCallId:n.toolCallId};break;case"source":if(n.sourceType==="url")yield{type:"source-url",sourceId:n.id,url:n.url,title:n.title,providerMetadata:n.providerMetadata};else yield{type:"source-document",sourceId:n.id,mediaType:n.mediaType,title:n.title,filename:n.filename,providerMetadata:n.providerMetadata};break;case"file":yield{type:"file",url:_(n.file.mediaType,n.file.base64),mediaType:n.file.mediaType,providerMetadata:n.providerMetadata};break;case"reasoning-file":yield{type:"reasoning-file",url:_(n.file.mediaType,n.file.base64),mediaType:n.file.mediaType,providerMetadata:n.providerMetadata};break;case"start-step":yield{type:"start-step"};break;case"finish-step":o=n.usage,u=n.performance,yield{type:"finish-step"};break;case"finish":yield*N(s,a),l=!0,yield{type:"finish",finishReason:n.finishReason,messageMetadata:le(o??n.totalUsage,u)};break;case"abort":yield{type:"abort",reason:n.reason};break;case"error":yield{type:"error",errorText:q(n.error)};break}if(!l)yield*N(s,a),yield{type:"finish"}}function le(t,e){if(t?.totalTokens==null&&t?.outputTokens==null&&e?.outputTokensPerSecond==null)return;return{...t?.totalTokens==null&&t?.outputTokens==null?{}:{usage:{...t.totalTokens==null?{}:{totalTokens:t.totalTokens},...t.outputTokens==null?{}:{outputTokens:t.outputTokens}}},...e?.outputTokensPerSecond==null?{}:{performance:{outputTokensPerSecond:e.outputTokensPerSecond}}}}function*N(t,e){for(let r of t)yield{type:"text-end",id:r};t.clear();for(let r of e)yield{type:"reasoning-end",id:r};e.clear()}function ue(t,e){return{id:t,role:"user",parts:[{type:"text",text:e}]}}function D(t,e,r){if(r&&t.at(-1)?.role==="assistant"){t[t.length-1]=e;return}t.push(e)}function I(t){let e=t.at(-1);return e?.role==="assistant"?e:void 0}function ce(t){let e=[];for(let[r,s]of t.parts.entries()){if(!Q(s)||s.state!=="approval-requested"||s.approval.isAutomatic===!0)continue;e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:re(s),title:s.title,input:s.input,providerExecuted:s.providerExecuted,messageId:t.id,partIndex:r})}return e}function de(t,e,r){let s=t.parts[e.partIndex];if(!s||!Q(s)||s.toolCallId!==e.toolCallId)throw Error(`Could not find tool approval request ${e.approvalId}.`);s.state="approval-responded",s.approval={id:e.approvalId,approved:r.approved,...r.reason?{reason:r.reason}:{}}}function q(t){if(t instanceof Error)return t.message;if(typeof t==="string")return t;return JSON.stringify(t)}function _(t,e){return`data:${t};base64,${e}`}function V(t){return t instanceof Error&&t.message==="Interrupted"}async function X(t){await new ae(t).run()}import{convertToModelMessages as pe,generateId as P,toTextStream as he,toUIMessageStream as fe}from"ai";async function $e(t){if(t.prompt!==void 0)me(t.prompt);await X({title:`broods · ${t.agent.name}`,tools:"full",transport:new tt(t.client,t.agent)})}async function Ce(t){let e=he({stream:et(t.client.stream(t.agent,{input:t.prompt}),void 0,()=>{})});for await(let r of e)process.stdout.write(r);process.stdout.write(`
|
|
19
|
-
`)}async function me(t){let e=process.stdin.listenerCount("data"),r=Date.now()+1e4;while(process.stdin.listenerCount("data")<=e){if(Date.now()>r)return;await new Promise((s)=>setTimeout(s,20))}process.stdin.emit("data",Buffer.from(t)),process.stdin.emit("data",Buffer.from("\r"))}class tt{client;agent;conversationKey=`tui-${P()}`;sentApprovals=new Set;sentUserTurns=0;constructor(t,e){this.client=t;this.agent=e}async reconnectToStream(){return null}async sendMessages(t){let e=this.pendingEvents(await pe(t.messages));if(e.events.length===0)throw Error("Nothing new to send: the agent already saw this turn.");let r=this.client.stream(this.agent,{conversationKey:this.conversationKey,events:e.events});return fe({stream:et(r,t.abortSignal,e.commit),originalMessages:t.messages,generateMessageId:P,sendSources:!0})}pendingEvents(t){let e=[],r=[],s=0;for(let a of t){if(a.role==="user"){if(s+=1,s>this.sentUserTurns)e.push(a);continue}if(a.role!=="tool")continue;for(let i of a.content)if(i.type==="tool-approval-response"&&!this.sentApprovals.has(i.approvalId))r.push(i)}if(r.length>0)e.push({role:"tool",content:r});return{events:e,commit:()=>{this.sentUserTurns=s;for(let a of r)this.sentApprovals.add(a.approvalId)}}}}function ge(t){return new Promise((e)=>{if(!t)return;let r=()=>e({done:!0,value:void 0});if(t.aborted)r();else t.addEventListener("abort",r,{once:!0})})}function et(t,e,r){let s=!1,a=()=>void t.return(void 0);return new ReadableStream({pull:async function(i){let o=await Promise.race([t.next(),ge(e)]);if(e?.aborted){a(),i.close();return}if(!s)s=!0,r();if(o.done)i.close();else i.enqueue(o.value)},cancel:a})}export{$e as runAgentTui,Ce as streamAgentText};
|
package/dist/chunk-p7t6yawg.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var u=/^[A-Z][A-Z0-9_]*$/;class m 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 Ae(e){if(!u.test(e)||e.length>64)throw Error("envPlaceholder name must match /^[A-Z][A-Z0-9_]*$/ and be at most 64 characters.");return`\${${e}}`}function B(){return o("BROODS_SESSION_TOKEN")??o("BROODS_ACCOUNT_SECRET")}class Z{baseUrl;bearerToken;fetchImpl;constructor(e={}){let t=e.baseUrl??o("BROODS_BASE_URL")??"https://gateway.broods.app",n=e.sessionToken??e.accountSecret??B();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 m("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 m("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 m("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}/v1/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 m("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 m("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 m("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 m("POST",n,404,"Workspace not found");return s.file}async renameWorkspaceFile(e,t,n){let s=`/v1/workspaces/${encodeURIComponent(e)}/files`,r=await this.request("PATCH",s,{path:t,newPath:n});if(!r)throw new m("PATCH",s,404,"Workspace not found");return r.renamed}async deleteWorkspaceFile(e,t){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}/files`,{path:t}))?.deleted??0}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 m("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 listMcp(e){let t=`/v1/mcp${i(e)}`,n=await this.request("GET",t);if(!n)throw new m("GET",t,404,"Not found");return n.servers??[]}async createMcp(e,t){let n=`/v1/mcp${i(e)}`,s=await this.request("POST",n,t);if(!s)throw new m("POST",n,404,"Not found");return s}async uploadMcpBundle(e){let n=await this.request("POST","/v1/mcp/uploads");if(!n?.uploadUrl)throw new m("POST","/v1/mcp/uploads",502,"response omitted uploadUrl");let s=await this.fetchImpl(n.uploadUrl,{method:"POST",headers:{"Content-Type":"application/javascript"},body:e});if(!s.ok)throw new m("POST","/v1/mcp/uploads",s.status,await s.text());let{storageId:r}=await s.json();if(!r)throw new m("POST","/v1/mcp/uploads",502,"upload response omitted storageId");let a=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e)),c=Array.from(new Uint8Array(a)).map((l)=>l.toString(16).padStart(2,"0")).join("");return{bundleStorageId:r,sha256:c}}async getMcp(e){return await this.request("GET",`/v1/mcp/${encodeURIComponent(e)}`)}async updateMcp(e,t){return await this.request("PATCH",`/v1/mcp/${encodeURIComponent(e)}`,t)}async deleteMcp(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 m("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 m("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 m("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 m("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 m("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}`,r=await this.request("POST",s,n);if(!r)throw new m("POST",s,404,"Sandbox not found");return r}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 m(e,t,s.status,await s.text());return await s.json()}}function o(e){return typeof process<"u"?process?.env?.[e]:void 0}function i(e){return`?${new URLSearchParams({project:e.project,stage:e.stage}).toString()}`}
|
|
2
|
-
export{m,Ae,B,Z};
|