@brickkit/core 0.16.0-beta.1 → 0.16.0-beta.3
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/chunks/client.d.ts +1 -1
- package/dist/chunks/server.d.ts +37 -2
- package/dist/chunks/server.js +231 -10
- package/dist/chunks/server.js.map +1 -1
- package/dist/chunks/types.d.ts +11 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -137
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/workflow.d.ts +1 -1
- package/package.json +1 -1
package/dist/chunks/types.d.ts
CHANGED
|
@@ -2905,6 +2905,16 @@ declare const DASHBOARD_KEY_ENV = "BRICK_DASHBOARD_KEY";
|
|
|
2905
2905
|
declare function dashboardKey(): string;
|
|
2906
2906
|
/** The header value for an identity: `<base64url(json)>.<hmac>`. */
|
|
2907
2907
|
declare function signDashboardIdentity(identity: DashboardIdentity, now?: number): string;
|
|
2908
|
+
/** Who a call forwarded by the dashboard's `/mcp` is for, and whether tools that change data may run. */
|
|
2909
|
+
interface DashboardMcpCaller extends DashboardIdentity {
|
|
2910
|
+
write: boolean;
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* The header value for a call the dashboard's `/mcp` forwards to the app. It is
|
|
2914
|
+
* scoped to the MCP route: the `/app` proxy never signs one, and a signature
|
|
2915
|
+
* made for `/app` is not accepted there.
|
|
2916
|
+
*/
|
|
2917
|
+
declare function signDashboardMcp(caller: DashboardMcpCaller, now?: number): string;
|
|
2908
2918
|
/**
|
|
2909
2919
|
* The dashboard user a request came from, for an endpoint: the person
|
|
2910
2920
|
* `dashboard.auth.authorize` let in, when the request arrived through the
|
|
@@ -4021,4 +4031,4 @@ interface ProxyOptions {
|
|
|
4021
4031
|
from?: string;
|
|
4022
4032
|
context?: Partial<ActionContext>;
|
|
4023
4033
|
}
|
|
4024
|
-
export { BrickSocketClient as $,
|
|
4034
|
+
export { BrickSocketClient as $, PluginContext as $n, defineSecret as $r, PostgresDatabase as $t, PreparationContribution as A, ResourceActionInfo as An, ScheduleRun as Ar, DashboardIdentity as At, ResourceTypeOptions as B, scheduleTable as Bn, isCrudEvent as Br, isControlEvent as Bt, DuplicateNameError as C, ResourcePlugin as Cn, ListenerFailure as Cr, OutboxCounts as Ct, InferTableRow as D, ServicePlugin as Dn, WorkflowsOptions as Dr, Identity as Dt, InferTableInsert as E, ResourcePluginTypes as En, WorkflowEvent as Er, clientAddress as Et, ResourceActionConfig as F, ServicePort as Fn, EventCatalog as Fr, signDashboardIdentity as Ft, Tool as G, outboxTable as Gn, RawDeps as Gr, redact as Gt, ServiceOptions as H, OutboxTable as Hn, CallFiles as Hr, Sensitive as Ht, ResourceActionInput as I, PostgresScheduleTable as In, EventRef as Ir, signDashboardMcp as It, ToolConfigWithoutAuthorize as J, SQLiteAuditTable as Jn, StoredFile as Jr, EnvInput as Jt, ToolAnnotations as K, AuditTable as Kn, S3StorageOptions as Kr, DatabaseDefinition as Kt, ResourceChild as L, SQLiteScheduleTable as Ln, EventRefs as Lr, STANDARD_ERRORS as Lt, RateLimits as M, WebhookRequest as Mn, ScheduleWorkflowRun as Mr, DashboardUser as Mt, Resource as N, WebhookVerifier as Nn, defineSchedule as Nr, dashboardKey as Nt, Logger as O, ServicePluginContext as On, Schedule as Or, DASHBOARD_IDENTITY_HEADER as Ot, ResourceActionAccess as P, isWebhook as Pn, CrudEventOperation as Pr, dashboardUser as Pt, BrickClientSocket as Q, PluginAppContext as Qn, SecretSource as Qr, isDatabaseHandle as Qt, ResourceConfig as R, ScheduleRunRecord as Rn, crudEventName as Rr, StandardErrorCode as Rt, DefaultServiceContext as S, PluginRoutes as Sn, EventsWorld as Sr, Dispatcher as St, ErrorDetails as T, ResourcePluginContext as Tn, ServiceEvents as Tr, RateLimit as Tt, ServiceSchema as U, PostgresOutboxTable as Un, FileDriver as Ur, Sensitivity as Ut, Service as V, OutboxStatus as Vn, CallDeps as Vr, Reveal as Vt, StandardErrorMap as W, SQLiteOutboxTable as Wn, FileStorage as Wr, hasSensitive as Wt, ValidationError as X, isAuditTable as Xn, SecretOptions as Xr, SQLiteDefinition as Xt, ToolOptions as Y, auditTable as Yn, s3 as Yr, PostgresDefinition as Yt, ValidationErrorItem as Z, recordAudit as Zn, SecretRef as Zr, defineDatabase as Zt, CommandChildren as _, PLUGIN_KIND as _n, EventEnvelope as _r, EventsDefinition as _t, ActionConfigWithoutAuthorize as a, HttpMethod as ai, blob as an, PluginManifest as ar, BrickSocketReconnectOptions as at, CommandErrors as b, PluginRouteRegistrar as bn, EventWorkflow as br, stopAllEvents as bt, ActionExecutionError as c, index as cn, definePlugin as cr, BrickSocketStatus as ct, AuditConfig as d, real as dn, PluginHookArgs as dr, SocketEmitArgs as dt, envSource as ei, PostgresDatabaseConfig as en, PluginFactory as er, BrickSocketConfig as et, BaseActionConfig as f, sqliteTable as fn, PluginHooks as fr, SocketEmitOptions as ft, Command as g, InstalledPlugin as gn, EventDelivery as gr, SocketSchemas as gt, ChildChanges as h, ContextOf as hn, DispatchOptions as hr, SocketReplay as ht, ActionConfigWithAuthorize as i, resolveSecrets as ii, SQLiteDatabaseConfig as in, PluginLifecycleContext as ir, BrickSocketHandlerError as it, ProxyOptions as j, WebhookConfig as jn, ScheduleWorkflow as jr, DashboardMcpCaller as jt, NarrowAuthorizedContext as k, ActionAccessInfo as kn, ScheduleConfig as kr, DASHBOARD_KEY_ENV as kt, ActionSchema as l, integer as ln, PluginTableBuilders as lr, SocketBroker as lt, CallContext as m, uniqueIndex as mn, CrudEventPayload as mr, SocketPayloads as mt, ActionAccessPolicy as n, overrideSecret as ni, BrickSQLiteDatabase as nn, PluginInstallOptions as nr, BrickSocketError as nt, ActionContext as o, createSQLiteDatabase as on, PluginServiceContext as or, BrickSocketSchema as ot, BaseContext as p, text as pn, getHostHooks as pr, SocketEventArgs as pt, ToolConfigWithAuthorize as q, PostgresAuditTable as qn, ScopedFiles as qr, DatabaseHandle as qt, ActionConfig as r, resetSecrets as ri, BunSQLiteDatabase as rn, PluginInstance as rr, BrickSocketHandle as rt, ActionErrorDefinition as s, foreignKey as sn, PluginSetupContext as sr, BrickSocketSender as st, Action as t, listSecrets as ti, createPostgresDatabase as tn, PluginInfo as tr, BrickSocketConnectOptions as tt, ArchitectureSchema as u, primaryKey as un, HostHooks as ur, SocketBrokerMessage as ut, CommandConfig as v, PluginEndpointContext as vn, EventListener as vr, EventsHub as vt, ErrorBuilder as w, ResourcePluginAPI as wn, RetryDecision as wr, ClientIp as wt, CommandRow as x, PluginRouteScope as xn, EventsOptions as xr, ScheduleState as xt, CommandDecision as y, PluginRouteMethod as yn, EventRecorder as yr, ScheduleControl as yt, ResourceIdentity as z, ScheduleTable as zn, crudEventSource as zr, WireError as zt };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as BrickSocketClient,
|
|
1
|
+
import { $ as BrickSocketClient, Bt as isControlEvent, Lt as STANDARD_ERRORS, Q as BrickClientSocket, at as BrickSocketReconnectOptions, ct as BrickSocketStatus, it as BrickSocketHandlerError, nt as BrickSocketError, pt as SocketEventArgs, st as BrickSocketSender, tt as BrickSocketConnectOptions } from "./chunks/types.js";
|
|
2
2
|
import { a as BrickClientOptions, c as BrickTransportError, d as InferActionInput, f as InferActionOutput, g as ATTR, h as isBrickTransportError, i as BrickClientAction, l as InferActionErrorCodes, m as isBrickServerError, n as BrickCallOptions, o as BrickServerError, p as createBrickClient, r as BrickClient, s as BrickServices, t as BrickActionCaller, u as InferActionFailure, v as SPAN, y as kebabCase } from "./chunks/client.js";
|
|
3
3
|
export { ATTR, BrickActionCaller, BrickCallOptions, BrickClient, BrickClientAction, BrickClientOptions, type BrickClientSocket, BrickServerError, BrickServices, type BrickSocketClient, type BrickSocketConnectOptions, BrickSocketError, type BrickSocketHandlerError, type BrickSocketReconnectOptions, type BrickSocketSender, type BrickSocketStatus, BrickTransportError, InferActionErrorCodes, InferActionFailure, InferActionInput, InferActionOutput, SPAN, STANDARD_ERRORS, type SocketEventArgs, createBrickClient, isBrickServerError, isBrickTransportError, isControlEvent, kebabCase };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import { A as
|
|
1
|
+
import { $n as PluginContext, $r as defineSecret, $t as PostgresDatabase, A as PreparationContribution, An as ResourceActionInfo, Ar as ScheduleRun, At as DashboardIdentity, B as ResourceTypeOptions, Bn as scheduleTable, Br as isCrudEvent, C as DuplicateNameError, Cn as ResourcePlugin, Cr as ListenerFailure, Ct as OutboxCounts, D as InferTableRow, Dn as ServicePlugin, Dr as WorkflowsOptions, Dt as Identity, E as InferTableInsert, En as ResourcePluginTypes, Er as WorkflowEvent, Et as clientAddress, F as ResourceActionConfig, Fr as EventCatalog, Ft as signDashboardIdentity, G as Tool, Gn as outboxTable, Gr as RawDeps, Gt as redact, H as ServiceOptions, Hn as OutboxTable, Hr as CallFiles, Ht as Sensitive, I as ResourceActionInput, In as PostgresScheduleTable, Ir as EventRef, It as signDashboardMcp, J as ToolConfigWithoutAuthorize, Jn as SQLiteAuditTable, Jr as StoredFile, Jt as EnvInput, K as ToolAnnotations, Kn as AuditTable, Kr as S3StorageOptions, Kt as DatabaseDefinition, L as ResourceChild, Ln as SQLiteScheduleTable, Lr as EventRefs, M as RateLimits, Mn as WebhookRequest, Mr as ScheduleWorkflowRun, Mt as DashboardUser, N as Resource, Nn as WebhookVerifier, Nr as defineSchedule, Nt as dashboardKey, O as Logger, On as ServicePluginContext, Or as Schedule, Ot as DASHBOARD_IDENTITY_HEADER, P as ResourceActionAccess, Pn as isWebhook, Pr as CrudEventOperation, Pt as dashboardUser, Q as BrickClientSocket, Qn as PluginAppContext, Qr as SecretSource, Qt as isDatabaseHandle, R as ResourceConfig, Rn as ScheduleRunRecord, Rr as crudEventName, S as DefaultServiceContext, Sn as PluginRoutes, Sr as EventsWorld, St as Dispatcher, T as ErrorDetails, Tn as ResourcePluginContext, Tr as ServiceEvents, Tt as RateLimit, U as ServiceSchema, Un as PostgresOutboxTable, Ur as FileDriver, V as Service, Vn as OutboxStatus, Vr as CallDeps, Vt as Reveal, W as StandardErrorMap, Wn as SQLiteOutboxTable, Wr as FileStorage, Wt as hasSensitive, X as ValidationError, Xn as isAuditTable, Xr as SecretOptions, Xt as SQLiteDefinition, Y as ToolOptions, Yn as auditTable, Yr as s3, Yt as PostgresDefinition, Z as ValidationErrorItem, Zn as recordAudit, Zr as SecretRef, Zt as defineDatabase, _ as CommandChildren, _n as PLUGIN_KIND, _r as EventEnvelope, _t as EventsDefinition, a as ActionConfigWithoutAuthorize, ai as HttpMethod, an as blob, ar as PluginManifest, b as CommandErrors, bn as PluginRouteRegistrar, br as EventWorkflow, bt as stopAllEvents, c as ActionExecutionError, cn as index, cr as definePlugin, d as AuditConfig, dn as real, dr as PluginHookArgs, dt as SocketEmitArgs, ei as envSource, en as PostgresDatabaseConfig, er as PluginFactory, et as BrickSocketConfig, f as BaseActionConfig, fn as sqliteTable, fr as PluginHooks, ft as SocketEmitOptions, g as Command, gn as InstalledPlugin, gr as EventDelivery, gt as SocketSchemas, h as ChildChanges, hn as ContextOf, hr as DispatchOptions, ht as SocketReplay, i as ActionConfigWithAuthorize, ii as resolveSecrets, in as SQLiteDatabaseConfig, ir as PluginLifecycleContext, j as ProxyOptions, jn as WebhookConfig, jr as ScheduleWorkflow, jt as DashboardMcpCaller, k as NarrowAuthorizedContext, kn as ActionAccessInfo, kr as ScheduleConfig, kt as DASHBOARD_KEY_ENV, l as ActionSchema, ln as integer, lr as PluginTableBuilders, lt as SocketBroker, m as CallContext, mn as uniqueIndex, mr as CrudEventPayload, mt as SocketPayloads, n as ActionAccessPolicy, ni as overrideSecret, nn as BrickSQLiteDatabase, nr as PluginInstallOptions, o as ActionContext, on as createSQLiteDatabase, or as PluginServiceContext, ot as BrickSocketSchema, p as BaseContext, pn as text, pr as getHostHooks, pt as SocketEventArgs, q as ToolConfigWithAuthorize, qn as PostgresAuditTable, qr as ScopedFiles, qt as DatabaseHandle, r as ActionConfig, ri as resetSecrets, rn as BunSQLiteDatabase, rr as PluginInstance, rt as BrickSocketHandle, s as ActionErrorDefinition, sn as foreignKey, sr as PluginSetupContext, st as BrickSocketSender, t as Action, ti as listSecrets, tn as createPostgresDatabase, tr as PluginInfo, u as ArchitectureSchema, un as primaryKey, ur as HostHooks, ut as SocketBrokerMessage, v as CommandConfig, vn as PluginEndpointContext, vr as EventListener, vt as EventsHub, w as ErrorBuilder, wn as ResourcePluginAPI, wr as RetryDecision, wt as ClientIp, x as CommandRow, xn as PluginRouteScope, xr as EventsOptions, xt as ScheduleState, y as CommandDecision, yn as PluginRouteMethod, yr as EventRecorder, yt as ScheduleControl, z as ResourceIdentity, zn as ScheduleTable, zr as crudEventSource, zt as WireError } from "./chunks/types.js";
|
|
2
|
+
import { A as referencePlugin, C as DashboardAuth, D as OpenApiDocument, E as DocumentationOptions, F as RouteMethod, M as scalarDocsHTML, N as BrickIR, O as ReferenceDocument, P as RouteIR, S as DASHBOARD_MCP_TOOLS, T as ApiDocument, _ as EndpointContext, a as RequestLoggingOptions, b as EndpointMethod, c as CompiledRoute, d as loadCompiledBrickApp, f as CompiledHandler, g as BrickApp, h as deny, i as CorsOrigin, j as registerReferenceRoute, k as ReferenceOptions, l as bindCompiledApplication, m as HandlerFactory, n as brick, o as requestLoggingPlugin, p as CompiledRoutePlan, r as CorsOptions, s as CompiledApplication, t as CreateServerOptions, u as compileBrickApplication, v as EndpointDefinition, w as DashboardOptions, x as DASHBOARD_MCP_ROUTE, y as EndpointLogger } from "./chunks/server.js";
|
|
3
3
|
import { _ as GLOBAL_SYMBOL, a as BrickClientOptions, c as BrickTransportError, d as InferActionInput, f as InferActionOutput, g as ATTR, h as isBrickTransportError, i as BrickClientAction, l as InferActionErrorCodes, m as isBrickServerError, n as BrickCallOptions, o as BrickServerError, p as createBrickClient, r as BrickClient, s as BrickServices, t as BrickActionCaller, u as InferActionFailure, v as SPAN, y as kebabCase } from "./chunks/client.js";
|
|
4
4
|
import { StepErrorBuilder, defineError, stepErrors, stepFailure } from "./workflow.js";
|
|
5
5
|
import "@opentelemetry/api";
|
|
@@ -897,6 +897,7 @@ export declare class UnknownToolError extends Error {
|
|
|
897
897
|
}
|
|
898
898
|
/** Collect only explicitly defined tools, without exposing ordinary actions. */
|
|
899
899
|
export declare function createMcpRegistry(options: McpRegistryOptions): McpRegistry;
|
|
900
|
+
export declare const WRAP_RESULT = "x-brick-wrap-result";
|
|
900
901
|
interface McpHandlerOptions {
|
|
901
902
|
registry: McpRegistry;
|
|
902
903
|
serverInfo: {
|
|
@@ -982,4 +983,4 @@ interface TwilioSignatureOptions {
|
|
|
982
983
|
* verify: twilioSignature({ authToken, url: "https://api.example.com/api/telephony/voice-status" })
|
|
983
984
|
*/
|
|
984
985
|
export declare function twilioSignature(options: TwilioSignatureOptions): WebhookVerifier;
|
|
985
|
-
export { ATTR, Action, type ActionAccessInfo, ActionAccessPolicy, ActionConfig, ActionConfigWithAuthorize, ActionConfigWithoutAuthorize, ActionContext, ActionErrorDefinition, ActionExecutionError, type ActionRoute, ActionSchema, type ApiDocument, ArchitectureSchema, AuditConfig, type AuditTable, BaseActionConfig, BaseContext, type BrickActionCaller, type BrickApp, type BrickCallOptions, type BrickClient, type BrickClientAction, type BrickClientOptions, type BrickIR, BrickSQLiteDatabase, BrickServerError, type BrickServices, type BrickSocketConfig, type BrickSocketHandle, type BrickSocketSchema, type BrickSocketSender, BrickTransportError, type BunSQLiteDatabase, CallContext, type CallDeps, type CallFiles, ChildChanges, type ClientIp, Command, CommandChildren, CommandConfig, CommandDecision, CommandErrors, CommandRow, type CompiledApplication, type CompiledHandler, type CompiledRoute, type CompiledRoutePlan, type CorsOptions, type CorsOrigin, type Counter, type CreateServerOptions, type CrudEventOperation, type CrudEventPayload, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, type DashboardAuth, type DashboardIdentity, type DashboardOptions, type DashboardUser, DatabaseDefinition, DatabaseHandle, DefaultServiceContext, type DispatchOptions, Dispatcher, type DocumentationOptions, DuplicateNameError, type EndpointContext, type EndpointDefinition, type EndpointLogger, type EndpointMethod, EnvInput, ErrorBuilder, ErrorDetails, type ErrorEnvelope, type EventCatalog, type EventDelivery, type EventEnvelope, type EventListener, type EventRecorder, type EventRef, type EventRefs, type EventWorkflow, type EventsDefinition, type EventsHub, type EventsOptions, type EventsWorld, type FileDriver, type FileStorage, GLOBAL_SYMBOL, type HandlerFactory, type HmacSignatureOptions, type HostHooks, type HttpMethod, type Identity, type InferActionErrorCodes, type InferActionFailure, type InferActionInput, type InferActionOutput, InferTableInsert, InferTableRow, type InstalledPlugin, type KeyValueDriver, type KeyValueStorage, type ListenerFailure, Logger, type McpHandlerOptions, type McpRegistry, type McpRegistryOptions, type McpToolDefinition, NarrowAuthorizedContext, type OpenApiDocument, type OpenApiGeneratorOptions, type OutboxCounts, type OutboxStatus, type OutboxTable, type PluginAppContext, type PluginContext, type PluginEndpointContext, type PluginFactory, type PluginHookArgs, type PluginHooks, type PluginInfo, type PluginInstallOptions, type PluginInstance, type PluginLifecycleContext, type PluginManifest, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, type PluginServiceContext, type PluginSetupContext, type PluginTableBuilders, type PostgresAuditTable, PostgresDatabase, PostgresDatabaseConfig, PostgresDefinition, type PostgresOutboxTable, type PostgresScheduleTable, PreparationContribution, ProxyOptions, type PutIfAbsentResult, type RateLimit, RateLimits, type RedisBrokerOptions, type RedisStorageOptions, type ReferenceDocument, type ReferenceOptions, type RequestLoggingOptions, Resource, ResourceActionAccess, ResourceActionConfig, type ResourceActionInfo, ResourceActionInput, ResourceChild, ResourceConfig, ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, ResourceTypeOptions, type RetryDecision, type Reveal, type RouteIR, type RouteMethod, type S3StorageOptions, SPAN, type SQLiteAuditTable, SQLiteDatabaseConfig, SQLiteDefinition, type SQLiteOutboxTable, type SQLiteScheduleTable, type Schedule, type ScheduleConfig, type ScheduleControl, type ScheduleRun, type ScheduleRunRecord, type ScheduleState, type ScheduleTable, type ScheduleWorkflow, type ScheduleWorkflowRun, type ScopedFiles, type SecretOptions, SecretRef, type SecretSource, Service, type ServiceActionCaller, type ServiceClient, type ServiceEvents, ServiceOptions, type ServicePlugin, type ServicePluginContext, type ServiceRegistry, ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchemas, StandardErrorMap, type StandardWebhooksOptions, type Static, type StepErrorBuilder, type StorageDriver, type StorageOf, type StoredFile, type TSchema, type Table, Tool, ToolAnnotations, ToolConfigWithAuthorize, ToolConfigWithoutAuthorize, ToolOptions, type TwilioSignatureOptions, Type as t, type UntypedServiceClient, ValidationError, ValidationErrorItem, type WebhookConfig, type WebhookRequest, type WebhookSecret, type WebhookVerifier, type WorkflowEvent, type WorkflowsOptions, and, asc, auditTable, bindCompiledApplication, blob, brick, clientAddress, compileBrickApplication, createBrickClient, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardKey, dashboardUser, defineDatabase, defineError, definePlugin, defineSchedule, defineSecret, deny, desc, envSource, eq, foreignKey, getHostHooks, getTableColumns, getTableName, gt, gte, hasSensitive, ilike, inArray, index, integer, is, isAuditTable, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, isWebhook, kebabCase, like, listSecrets, loadCompiledBrickApp, lt, lte, ne, not, notInArray, or, outboxTable, overrideSecret, primaryKey, real, recordAudit, redact, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, resetSecrets, resolveSecrets, s3, scalarDocsHTML, scheduleTable, signDashboardIdentity, sql, sqliteTable, stepErrors, stepFailure, stopAllEvents, text, uniqueIndex };
|
|
986
|
+
export { ATTR, Action, type ActionAccessInfo, ActionAccessPolicy, ActionConfig, ActionConfigWithAuthorize, ActionConfigWithoutAuthorize, ActionContext, ActionErrorDefinition, ActionExecutionError, type ActionRoute, ActionSchema, type ApiDocument, ArchitectureSchema, AuditConfig, type AuditTable, BaseActionConfig, BaseContext, type BrickActionCaller, type BrickApp, type BrickCallOptions, type BrickClient, type BrickClientAction, type BrickClientOptions, type BrickIR, BrickSQLiteDatabase, BrickServerError, type BrickServices, type BrickSocketConfig, type BrickSocketHandle, type BrickSocketSchema, type BrickSocketSender, BrickTransportError, type BunSQLiteDatabase, CallContext, type CallDeps, type CallFiles, ChildChanges, type ClientIp, Command, CommandChildren, CommandConfig, CommandDecision, CommandErrors, CommandRow, type CompiledApplication, type CompiledHandler, type CompiledRoute, type CompiledRoutePlan, type CorsOptions, type CorsOrigin, type Counter, type CreateServerOptions, type CrudEventOperation, type CrudEventPayload, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, DASHBOARD_MCP_ROUTE, DASHBOARD_MCP_TOOLS, type DashboardAuth, type DashboardIdentity, type DashboardMcpCaller, type DashboardOptions, type DashboardUser, DatabaseDefinition, DatabaseHandle, DefaultServiceContext, type DispatchOptions, Dispatcher, type DocumentationOptions, DuplicateNameError, type EndpointContext, type EndpointDefinition, type EndpointLogger, type EndpointMethod, EnvInput, ErrorBuilder, ErrorDetails, type ErrorEnvelope, type EventCatalog, type EventDelivery, type EventEnvelope, type EventListener, type EventRecorder, type EventRef, type EventRefs, type EventWorkflow, type EventsDefinition, type EventsHub, type EventsOptions, type EventsWorld, type FileDriver, type FileStorage, GLOBAL_SYMBOL, type HandlerFactory, type HmacSignatureOptions, type HostHooks, type HttpMethod, type Identity, type InferActionErrorCodes, type InferActionFailure, type InferActionInput, type InferActionOutput, InferTableInsert, InferTableRow, type InstalledPlugin, type KeyValueDriver, type KeyValueStorage, type ListenerFailure, Logger, type McpHandlerOptions, type McpRegistry, type McpRegistryOptions, type McpToolDefinition, NarrowAuthorizedContext, type OpenApiDocument, type OpenApiGeneratorOptions, type OutboxCounts, type OutboxStatus, type OutboxTable, type PluginAppContext, type PluginContext, type PluginEndpointContext, type PluginFactory, type PluginHookArgs, type PluginHooks, type PluginInfo, type PluginInstallOptions, type PluginInstance, type PluginLifecycleContext, type PluginManifest, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, type PluginServiceContext, type PluginSetupContext, type PluginTableBuilders, type PostgresAuditTable, PostgresDatabase, PostgresDatabaseConfig, PostgresDefinition, type PostgresOutboxTable, type PostgresScheduleTable, PreparationContribution, ProxyOptions, type PutIfAbsentResult, type RateLimit, RateLimits, type RedisBrokerOptions, type RedisStorageOptions, type ReferenceDocument, type ReferenceOptions, type RequestLoggingOptions, Resource, ResourceActionAccess, ResourceActionConfig, type ResourceActionInfo, ResourceActionInput, ResourceChild, ResourceConfig, ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, ResourceTypeOptions, type RetryDecision, type Reveal, type RouteIR, type RouteMethod, type S3StorageOptions, SPAN, type SQLiteAuditTable, SQLiteDatabaseConfig, SQLiteDefinition, type SQLiteOutboxTable, type SQLiteScheduleTable, type Schedule, type ScheduleConfig, type ScheduleControl, type ScheduleRun, type ScheduleRunRecord, type ScheduleState, type ScheduleTable, type ScheduleWorkflow, type ScheduleWorkflowRun, type ScopedFiles, type SecretOptions, SecretRef, type SecretSource, Service, type ServiceActionCaller, type ServiceClient, type ServiceEvents, ServiceOptions, type ServicePlugin, type ServicePluginContext, type ServiceRegistry, ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchemas, StandardErrorMap, type StandardWebhooksOptions, type Static, type StepErrorBuilder, type StorageDriver, type StorageOf, type StoredFile, type TSchema, type Table, Tool, ToolAnnotations, ToolConfigWithAuthorize, ToolConfigWithoutAuthorize, ToolOptions, type TwilioSignatureOptions, Type as t, type UntypedServiceClient, ValidationError, ValidationErrorItem, type WebhookConfig, type WebhookRequest, type WebhookSecret, type WebhookVerifier, type WorkflowEvent, type WorkflowsOptions, and, asc, auditTable, bindCompiledApplication, blob, brick, clientAddress, compileBrickApplication, createBrickClient, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardKey, dashboardUser, defineDatabase, defineError, definePlugin, defineSchedule, defineSecret, deny, desc, envSource, eq, foreignKey, getHostHooks, getTableColumns, getTableName, gt, gte, hasSensitive, ilike, inArray, index, integer, is, isAuditTable, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, isWebhook, kebabCase, like, listSecrets, loadCompiledBrickApp, lt, lte, ne, not, notInArray, or, outboxTable, overrideSecret, primaryKey, real, recordAudit, redact, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, resetSecrets, resolveSecrets, s3, scalarDocsHTML, scheduleTable, signDashboardIdentity, signDashboardMcp, sql, sqliteTable, stepErrors, stepFailure, stopAllEvents, text, uniqueIndex };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as auditStage, $t as hasSensitive, A as defineListener, At as listSecrets, B as INTERNALS, Bt as hasIdentity, C as getGlobalRegistry, Ct as redisBroker, D as loadCompiledBrickApp, Dt as SecretRef, E as compileBrickApplication, Et as scopeFiles, F as eventRefs, Ft as definitionSite, G as installPlugin, Gt as signDashboardIdentity, H as defineServicePlugin, Ht as DASHBOARD_KEY_ENV, I as isCrudEvent, It as depsOverride, J as validateName, Jt as fileFields, K as isInstallingPlugin, Kt as signDashboardMcp, L as isBrickApp, Lt as freezeAsBuiltDeps, M as checkPayload, Mt as resetSecrets, N as crudEventName, Nt as resolveSecrets, O as WORKFLOW_BUNDLE, Ot as defineSecret, P as crudEventSource, Pt as claimName, Q as deny, Qt as Sensitive, R as requireBrickApp, Rt as useDeps, S as setActionAudit, St as redis, T as bindCompiledApplication, Tt as s3, U as getPluginEndpoints, Ut as dashboardKey, V as defineResourcePlugin, Vt as DASHBOARD_IDENTITY_HEADER, W as hasPlugin, Wt as dashboardUser, X as defineAction, Xt as traceRoute, Y as buildErrorHelpers, Yt as validateWithSchema, Z as errorsOf, Zt as withCallSpan, _ as scalarDocsHTML, _t as clientAddress, a as defineSchedule, at as recordInline, b as getActionAccess, bt as defineStorage, c as outboxTable, ct as checkWebhook, d as createMcpHandler, dt as webhookOf, en as isSensitive, et as auditTable, f as createMcpRegistry, ft as baseContext, g as registerReferenceRoute, gt as checkRateLimits, h as referencePlugin, ht as resolvedDeps, i as stopAllEvents, in as PLUGIN_KIND, it as recordAudit, j as checkEvent, jt as overrideSecret, k as resolveWorkflowPaths, kt as envSource, l as UnknownToolError, lt as defineWebhookMeta, m as DASHBOARD_MCP_TOOLS, mt as pickContextEnvelope, n as defineServiceSocket, nn as sensitivity, nt as inlineAudit, o as Dispatcher, ot as onTransactionCommit, p as DASHBOARD_MCP_ROUTE, pt as markResolved, q as segmentClaimant, qt as Type, r as recordingServices, rn as PLUGIN_COMMIT, rt as isAuditTable, s as isOutboxTable, st as runInTransaction, t as brick, tn as redact, tt as entryOf, u as WRAP_RESULT, ut as isWebhook, v as requestLoggingPlugin, vt as rateLimitsOf, w as resetGlobalRegistry, wt as hasFilesView, x as setActionAccess, xt as memory, y as generateOpenApiSpec, yt as StorageUnavailableError, z as createActionHandler, zt as portOf } from "./chunks/server.js";
|
|
2
2
|
import { C as actionMeta, G as ActionExecutionError, H as ATTR, K as DuplicateNameError, S as kebabCase, U as GLOBAL_SYMBOL, W as SPAN, a as isBrickTransportError, f as getActionRoute, i as isBrickServerError, n as BrickTransportError, p as getPluginActionRoute, q as ValidationError, r as createBrickClient, s as serializeSocketSchema, t as BrickServerError, u as actionOwners } from "./chunks/client.js";
|
|
3
3
|
import { defineError, stepErrors, stepFailure } from "./workflow.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
@@ -1625,141 +1625,6 @@ async function emitEvent(ctx, event, payload, options = {}) {
|
|
|
1625
1625
|
await record(name, payload);
|
|
1626
1626
|
});
|
|
1627
1627
|
}
|
|
1628
|
-
// src/mcp.ts
|
|
1629
|
-
var UnknownToolError = class extends Error {
|
|
1630
|
-
constructor(name) {
|
|
1631
|
-
super(`unknown tool: ${name}`);
|
|
1632
|
-
this.name = "UnknownToolError";
|
|
1633
|
-
}
|
|
1634
|
-
};
|
|
1635
|
-
/** Collect only explicitly defined tools, without exposing ordinary actions. */
|
|
1636
|
-
function createMcpRegistry(options) {
|
|
1637
|
-
function toolsByName() {
|
|
1638
|
-
const tools = /* @__PURE__ */ new Map();
|
|
1639
|
-
for (const tool of [...options.tools ?? [], ...(options.services ?? []).flatMap((service) => service.listTools())]) {
|
|
1640
|
-
const existing = tools.get(tool.name);
|
|
1641
|
-
if (existing && existing !== tool) throw new DuplicateNameError(`Duplicate MCP tool: ${tool.name}`);
|
|
1642
|
-
tools.set(tool.name, tool);
|
|
1643
|
-
}
|
|
1644
|
-
return tools;
|
|
1645
|
-
}
|
|
1646
|
-
toolsByName();
|
|
1647
|
-
return {
|
|
1648
|
-
listTools: () => Array.from(toolsByName().values(), (tool) => ({
|
|
1649
|
-
name: tool.name,
|
|
1650
|
-
...tool.config.title ?? tool.config.annotations?.title ? { title: tool.config.title ?? tool.config.annotations?.title } : {},
|
|
1651
|
-
description: tool.config.description ?? "",
|
|
1652
|
-
inputSchema: tool.config.input ?? {
|
|
1653
|
-
type: "object",
|
|
1654
|
-
properties: {},
|
|
1655
|
-
additionalProperties: false
|
|
1656
|
-
},
|
|
1657
|
-
...tool.config.output ? { outputSchema: outputSchema(tool.config.output) } : {},
|
|
1658
|
-
annotations: tool.config.annotations ?? {}
|
|
1659
|
-
})),
|
|
1660
|
-
async callTool(name, args = {}, ctx) {
|
|
1661
|
-
const tool = toolsByName().get(name);
|
|
1662
|
-
if (!tool) throw new UnknownToolError(name);
|
|
1663
|
-
return tool({
|
|
1664
|
-
input: args,
|
|
1665
|
-
ctx
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
};
|
|
1669
|
-
}
|
|
1670
|
-
const WRAP_RESULT = "x-brick-wrap-result";
|
|
1671
|
-
function outputSchema(schema) {
|
|
1672
|
-
return schema.type === "object" ? schema : {
|
|
1673
|
-
type: "object",
|
|
1674
|
-
properties: { result: schema },
|
|
1675
|
-
required: ["result"],
|
|
1676
|
-
[WRAP_RESULT]: true
|
|
1677
|
-
};
|
|
1678
|
-
}
|
|
1679
|
-
function result(id, value) {
|
|
1680
|
-
return Response.json({
|
|
1681
|
-
jsonrpc: "2.0",
|
|
1682
|
-
id,
|
|
1683
|
-
result: value
|
|
1684
|
-
});
|
|
1685
|
-
}
|
|
1686
|
-
function rpcError(id, code, message) {
|
|
1687
|
-
return Response.json({
|
|
1688
|
-
jsonrpc: "2.0",
|
|
1689
|
-
id,
|
|
1690
|
-
error: {
|
|
1691
|
-
code,
|
|
1692
|
-
message
|
|
1693
|
-
}
|
|
1694
|
-
});
|
|
1695
|
-
}
|
|
1696
|
-
function isRecord(value) {
|
|
1697
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
1698
|
-
}
|
|
1699
|
-
/** Stateless MCP JSON-RPC POST handler. Wrap with the app's authentication. */
|
|
1700
|
-
function createMcpHandler(options) {
|
|
1701
|
-
const versions = options.protocolVersions ?? ["2025-06-18"];
|
|
1702
|
-
if (!versions.length) throw new Error("At least one MCP protocol version is required");
|
|
1703
|
-
return async (request, ctx) => {
|
|
1704
|
-
if (request.method !== "POST") return new Response(null, {
|
|
1705
|
-
status: 405,
|
|
1706
|
-
headers: { Allow: "POST" }
|
|
1707
|
-
});
|
|
1708
|
-
if (options.clientIp) withClientIp(request, options.clientIp);
|
|
1709
|
-
let body;
|
|
1710
|
-
try {
|
|
1711
|
-
body = await request.json();
|
|
1712
|
-
} catch {
|
|
1713
|
-
return rpcError(null, -32700, "parse error");
|
|
1714
|
-
}
|
|
1715
|
-
if (!isRecord(body) || body.jsonrpc !== "2.0" || typeof body.method !== "string" || body.id !== void 0 && body.id !== null && typeof body.id !== "string" && typeof body.id !== "number" || body.params !== void 0 && !isRecord(body.params)) return rpcError(null, -32600, "invalid request");
|
|
1716
|
-
if (body.id === void 0) return new Response(null, { status: 202 });
|
|
1717
|
-
const { id, method } = body;
|
|
1718
|
-
const params = body.params;
|
|
1719
|
-
switch (method) {
|
|
1720
|
-
case "initialize": {
|
|
1721
|
-
const requested = params?.protocolVersion;
|
|
1722
|
-
return result(id, {
|
|
1723
|
-
capabilities: { tools: {} },
|
|
1724
|
-
protocolVersion: typeof requested === "string" && versions.includes(requested) ? requested : versions[0],
|
|
1725
|
-
serverInfo: options.serverInfo
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
case "ping": return result(id, {});
|
|
1729
|
-
case "tools/list": try {
|
|
1730
|
-
return result(id, { tools: options.registry.listTools() });
|
|
1731
|
-
} catch {
|
|
1732
|
-
return rpcError(id, -32603, "internal error");
|
|
1733
|
-
}
|
|
1734
|
-
case "tools/call":
|
|
1735
|
-
if (typeof params?.name !== "string" || params.arguments !== void 0 && !isRecord(params.arguments)) return rpcError(id, -32602, "invalid tool parameters");
|
|
1736
|
-
try {
|
|
1737
|
-
const value = await options.registry.callTool(params.name, params.arguments, {
|
|
1738
|
-
...ctx,
|
|
1739
|
-
request
|
|
1740
|
-
});
|
|
1741
|
-
const schema = options.registry.listTools().find((tool) => tool.name === params.name)?.outputSchema;
|
|
1742
|
-
return result(id, {
|
|
1743
|
-
content: [{
|
|
1744
|
-
type: "text",
|
|
1745
|
-
text: typeof value === "string" ? value : JSON.stringify(value, null, 2) ?? "null"
|
|
1746
|
-
}],
|
|
1747
|
-
...schema ? { structuredContent: schema[WRAP_RESULT] ? { result: value } : value } : {}
|
|
1748
|
-
});
|
|
1749
|
-
} catch (error) {
|
|
1750
|
-
if (error instanceof UnknownToolError) return rpcError(id, -32602, error.message);
|
|
1751
|
-
return result(id, {
|
|
1752
|
-
content: [{
|
|
1753
|
-
type: "text",
|
|
1754
|
-
text: error instanceof Error ? error.message : String(error)
|
|
1755
|
-
}],
|
|
1756
|
-
isError: true
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
default: return rpcError(id, -32601, `method not found: ${method}`);
|
|
1760
|
-
}
|
|
1761
|
-
};
|
|
1762
|
-
}
|
|
1763
1628
|
// src/webhook-verifiers.ts
|
|
1764
1629
|
function valuesOf(secret) {
|
|
1765
1630
|
const values = (Array.isArray(secret) ? secret : [secret]).map((item) => typeof item === "string" ? item : item.require());
|
|
@@ -1866,6 +1731,6 @@ function twilioSignature(options) {
|
|
|
1866
1731
|
return matchesAnyWithoutShortCircuit(given, valuesOf(options.authToken).map((token) => createHmac("sha1", token).update(signed).digest("base64")));
|
|
1867
1732
|
};
|
|
1868
1733
|
}
|
|
1869
|
-
export { ATTR, ActionExecutionError, BrickServerError, BrickTransportError, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, Dispatcher, DuplicateNameError, GLOBAL_SYMBOL, SPAN, SecretRef, StorageUnavailableError, Table, Type, Type as t, UnknownToolError, ValidationError, WORKFLOW_BUNDLE, actionOwners, and, asc, attachDatabase, auditTable, bindCompiledApplication, blob, brick, buildErrorHelpers, buildFtsMatchQuery, clientAddress, columnValue, compileBrickApplication, createActionHandler, createBrickClient, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardKey, dashboardUser, defineAction, defineDatabase, defineError, defineListener, definePlugin, defineResource, defineResourcePlugin, defineSchedule, defineSecret, defineService, defineServicePlugin, defineStorage, defineTool, deny, desc, drizzleSchema, emitEvent, ensureResourceIndexes, ensureSQLiteFts, envSource, eq, errorsOf, foreignKey, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getActionRoute, getGlobalRegistry, getHostHooks, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, hasSensitive, hmacSignature, idSchema, ilike, inArray, index, integer, is, isAuditTable, isBrickApp, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, isTool, isWebhook, kebabCase, like, listSecrets, loadCompiledBrickApp, loadRecord, lt, lte, memory, migrateDatabase, ne, not, notInArray, onTransactionCommit, or, outboxTable, overrideSecret, primaryKey, real, recordAudit, redact, redis, redisBroker, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveSecrets, resolveWorkflowPaths, runInTransaction, s3, scalarDocsHTML, scheduleTable, serializeSocketSchema, setActionAccess, setActionAudit, signDashboardIdentity, sql, sqliteTable, standardWebhooks, stepErrors, stepFailure, stopAllEvents, syncSchema, text, traceRoute, twilioSignature, uniqueIndex, useDeps, useService, validateWithSchema };
|
|
1734
|
+
export { ATTR, ActionExecutionError, BrickServerError, BrickTransportError, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, DASHBOARD_MCP_ROUTE, DASHBOARD_MCP_TOOLS, Dispatcher, DuplicateNameError, GLOBAL_SYMBOL, SPAN, SecretRef, StorageUnavailableError, Table, Type, Type as t, UnknownToolError, ValidationError, WORKFLOW_BUNDLE, WRAP_RESULT, actionOwners, and, asc, attachDatabase, auditTable, bindCompiledApplication, blob, brick, buildErrorHelpers, buildFtsMatchQuery, clientAddress, columnValue, compileBrickApplication, createActionHandler, createBrickClient, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardKey, dashboardUser, defineAction, defineDatabase, defineError, defineListener, definePlugin, defineResource, defineResourcePlugin, defineSchedule, defineSecret, defineService, defineServicePlugin, defineStorage, defineTool, deny, desc, drizzleSchema, emitEvent, ensureResourceIndexes, ensureSQLiteFts, envSource, eq, errorsOf, foreignKey, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getActionRoute, getGlobalRegistry, getHostHooks, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, hasSensitive, hmacSignature, idSchema, ilike, inArray, index, integer, is, isAuditTable, isBrickApp, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, isTool, isWebhook, kebabCase, like, listSecrets, loadCompiledBrickApp, loadRecord, lt, lte, memory, migrateDatabase, ne, not, notInArray, onTransactionCommit, or, outboxTable, overrideSecret, primaryKey, real, recordAudit, redact, redis, redisBroker, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveSecrets, resolveWorkflowPaths, runInTransaction, s3, scalarDocsHTML, scheduleTable, serializeSocketSchema, setActionAccess, setActionAudit, signDashboardIdentity, signDashboardMcp, sql, sqliteTable, standardWebhooks, stepErrors, stepFailure, stopAllEvents, syncSchema, text, traceRoute, twilioSignature, uniqueIndex, useDeps, useService, validateWithSchema };
|
|
1870
1735
|
|
|
1871
1736
|
//# sourceMappingURL=index.js.map
|