@standardagents/builder 0.41.14 → 0.41.16
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/built-in-routes.js +143 -1
- package/dist/built-in-routes.js.map +1 -1
- package/dist/{index-ChHAVogf.d.ts → index-BrQgCoFh.d.ts} +11 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +21 -1
- package/dist/plugin.js +35 -2
- package/dist/plugin.js.map +1 -1
- package/dist/{resolver-DE5HFRlb.d.ts → resolver-CWWRzZU1.d.ts} +1 -1
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +1 -0
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1864,6 +1864,17 @@ interface DurableAgentBuilderRpc {
|
|
|
1864
1864
|
user_id: string;
|
|
1865
1865
|
id: string;
|
|
1866
1866
|
} | null>;
|
|
1867
|
+
createApiKey(params: {
|
|
1868
|
+
name: string;
|
|
1869
|
+
key_hash: string;
|
|
1870
|
+
key_prefix: string;
|
|
1871
|
+
last_five: string;
|
|
1872
|
+
user_id: string;
|
|
1873
|
+
}): Promise<string>;
|
|
1874
|
+
getUserByPlatformUserId(platformUserId: string): Promise<{
|
|
1875
|
+
id: string;
|
|
1876
|
+
username: string;
|
|
1877
|
+
} | null>;
|
|
1867
1878
|
consumeAuthRateLimit(params: {
|
|
1868
1879
|
key: string;
|
|
1869
1880
|
limit: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { M as ModelDefinition, A as AgentDefinition } from './resolver-
|
|
2
|
-
export { m as AgentBuilderEnv, n as AgentBuilderEvent, ah as BroadcastOptions, C as CodeExecutionBridge, h as DurableAgentBuilder, D as DurableThread, l as DurableUserHub, af as FlowStateSdk, ai as FlowStateWithSdk, G as HandlerSide, H as HubClientInfo, E as HumanSide, aq as ImageContextConfig, ae as InjectMessageOptions, as as LLMProviderInterface, aL as NamespaceResolutionError, w as PromptContent, s as PromptDefinition, y as PromptIncludePart, x as PromptPart, F as PromptSide, t as PromptToolConfig, P as Provider, at as ProviderContentPart, aw as ProviderFilePart, av as ProviderImagePart, ar as ProviderRegistry, au as ProviderTextPart, B as SessionToolBinding, z as SessionToolConfig, I as SideConfig, J as SubagentRelationship, u as SubagentToolConfig, S as SubpromptConfig, o as ThreadEventPayload, p as ThreadRegistryEntry, T as ThreadWatchdog, j as ThreadWatchdogState, v as ToolConfig, U as UpdateThreadParams, q as User, k as WatchdogCheckin, W as WatchdogProbeResult, f as applyRuntimeCors, am as buildImageDescription, c as canAccessThread, a9 as cat, aJ as createNamespaceContext, Q as emitThreadEvent, ag as enhanceFlowState, a0 as exists, ad as find, R as forceTurn, ap as generateImageDescription, a7 as getFileStats, N as getMessages, al as getMessagesToSummarize, az as getShortName, a8 as getThumbnail, ak as getUnsummarizedImageAttachments, aG as getVisibleAgentNames, aI as getVisibleModelNames, aH as getVisiblePromptNames, aF as getVisibleToolNames, ac as grep, aj as hasImageAttachments, aa as head, L as injectMessage, d as isAdminOnlyApiRoute, i as isHostedInstance, b as isPublicApiRoute, aK as isQualifiedName, e as isSameOriginBrowserRequest, a as isTrustedLocalDevelopmentRequest, Z as linkFile, a2 as mkdir, a5 as move, ao as optimizeImageContext, ax as parseQualifiedName, ay as qualifyName, K as queueTool, _ as readFile, a3 as readdir, O as reloadHistory, a6 as rename, an as replaceImagesWithDescriptions, aD as resolveAgent, aE as resolveHook, aC as resolveModel, aB as resolvePrompt, aA as resolveTool, a4 as rmdir, r as runtimeCorsHeaders, g as runtimePreflightResponse, $ as stat, ab as tail, a1 as unlink, V as updateThread, X as writeFile, Y as writeImage } from './resolver-
|
|
1
|
+
import { M as ModelDefinition, A as AgentDefinition } from './resolver-CWWRzZU1.js';
|
|
2
|
+
export { m as AgentBuilderEnv, n as AgentBuilderEvent, ah as BroadcastOptions, C as CodeExecutionBridge, h as DurableAgentBuilder, D as DurableThread, l as DurableUserHub, af as FlowStateSdk, ai as FlowStateWithSdk, G as HandlerSide, H as HubClientInfo, E as HumanSide, aq as ImageContextConfig, ae as InjectMessageOptions, as as LLMProviderInterface, aL as NamespaceResolutionError, w as PromptContent, s as PromptDefinition, y as PromptIncludePart, x as PromptPart, F as PromptSide, t as PromptToolConfig, P as Provider, at as ProviderContentPart, aw as ProviderFilePart, av as ProviderImagePart, ar as ProviderRegistry, au as ProviderTextPart, B as SessionToolBinding, z as SessionToolConfig, I as SideConfig, J as SubagentRelationship, u as SubagentToolConfig, S as SubpromptConfig, o as ThreadEventPayload, p as ThreadRegistryEntry, T as ThreadWatchdog, j as ThreadWatchdogState, v as ToolConfig, U as UpdateThreadParams, q as User, k as WatchdogCheckin, W as WatchdogProbeResult, f as applyRuntimeCors, am as buildImageDescription, c as canAccessThread, a9 as cat, aJ as createNamespaceContext, Q as emitThreadEvent, ag as enhanceFlowState, a0 as exists, ad as find, R as forceTurn, ap as generateImageDescription, a7 as getFileStats, N as getMessages, al as getMessagesToSummarize, az as getShortName, a8 as getThumbnail, ak as getUnsummarizedImageAttachments, aG as getVisibleAgentNames, aI as getVisibleModelNames, aH as getVisiblePromptNames, aF as getVisibleToolNames, ac as grep, aj as hasImageAttachments, aa as head, L as injectMessage, d as isAdminOnlyApiRoute, i as isHostedInstance, b as isPublicApiRoute, aK as isQualifiedName, e as isSameOriginBrowserRequest, a as isTrustedLocalDevelopmentRequest, Z as linkFile, a2 as mkdir, a5 as move, ao as optimizeImageContext, ax as parseQualifiedName, ay as qualifyName, K as queueTool, _ as readFile, a3 as readdir, O as reloadHistory, a6 as rename, an as replaceImagesWithDescriptions, aD as resolveAgent, aE as resolveHook, aC as resolveModel, aB as resolvePrompt, aA as resolveTool, a4 as rmdir, r as runtimeCorsHeaders, g as runtimePreflightResponse, $ as stat, ab as tail, a1 as unlink, V as updateThread, X as writeFile, Y as writeImage } from './resolver-CWWRzZU1.js';
|
|
3
3
|
export { AgentPluginOptions, agentbuilder, builder } from './plugin.js';
|
|
4
|
-
export { v as Agent, J as AttachmentRef, i as AuthContext, A as AuthUser, e as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, t as ClientDuplex, u as ClientForwarding, p as ClientStreamRequest, q as ClientStreamResponse, n as ClientToolRequest, o as ClientToolResponse, B as Controller, a as ControllerContext, G as Env, H as FileRecord, N as FileStats, D as FlowResult, F as FlowState, K as GrepResult, P as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, U as MessageContent, Q as MultimodalContent, R as RequestContext, S as StorageBackend, E as TelemetryEvent, O as TextContentPart, T as ThreadEndpointContext, b as ThreadEnv, w as ThreadInstance, x as ThreadMetadata, y as ToolCall, z as ToolResult, f as authenticate, j as callClient, k as callClientStream, c as createThreadEndpointHandler, m as decodeStreamChunk, d as defineController, l as encodeStreamChunk, h as endpointCallerFromAuth, g as requireAdmin, r as requireAuth, s as supportsClientForwarding } from './index-
|
|
4
|
+
export { v as Agent, J as AttachmentRef, i as AuthContext, A as AuthUser, e as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, t as ClientDuplex, u as ClientForwarding, p as ClientStreamRequest, q as ClientStreamResponse, n as ClientToolRequest, o as ClientToolResponse, B as Controller, a as ControllerContext, G as Env, H as FileRecord, N as FileStats, D as FlowResult, F as FlowState, K as GrepResult, P as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, U as MessageContent, Q as MultimodalContent, R as RequestContext, S as StorageBackend, E as TelemetryEvent, O as TextContentPart, T as ThreadEndpointContext, b as ThreadEnv, w as ThreadInstance, x as ThreadMetadata, y as ToolCall, z as ToolResult, f as authenticate, j as callClient, k as callClientStream, c as createThreadEndpointHandler, m as decodeStreamChunk, d as defineController, l as encodeStreamChunk, h as endpointCallerFromAuth, g as requireAdmin, r as requireAuth, s as supportsClientForwarding } from './index-BrQgCoFh.js';
|
|
5
5
|
export { AgentType, DefineHandlerOptions, DefinitionLoader, GlobalNamespaceContext, HANDLER_SYMBOL, HandlerDefinition, HookExecutionContext, HookExecutionSource, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, ParentHookRequirement, ParentHookStage, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderConfigSlot, ProviderConfigSlots, ProviderConfigValueSource, ProviderDefinition, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ProviderMethodOverrides, ModelCapabilities as ProviderModelCapabilities, ProviderOverride, ProviderOverrideContext, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSyncOverride, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, ThreadHookName, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHandler, defineHook, defineModel, definePrompt, defineProvider, defineTool, isHandler, isPacked, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue } from '@standardagents/spec';
|
|
6
6
|
export { C as ConstituentItem, D as DiscoveredPackage, N as NamespacedRegistry, P as PackingAnalysis, a as PackingOptions, b as PackingResult, U as UnpackOptions, c as UnpackResult } from './types-Dhd0M369.js';
|
|
7
7
|
export { D as DiscoveryConfig, P as PackageDiscoveryService, d as discoverPackages } from './discovery-D5pmuazY.js';
|
package/dist/index.js
CHANGED
|
@@ -36755,6 +36755,7 @@ var PUBLIC_ROUTES = /* @__PURE__ */ new Set([
|
|
|
36755
36755
|
"/api/auth/bootstrap",
|
|
36756
36756
|
"/api/auth/login",
|
|
36757
36757
|
"/api/auth/config",
|
|
36758
|
+
"/api/auth/exchange",
|
|
36758
36759
|
"/api/auth/brolly-control",
|
|
36759
36760
|
"/api/auth/platform-cleanup",
|
|
36760
36761
|
"/api/auth/platform-replica",
|
|
@@ -38027,7 +38028,8 @@ async function loadVirtualModule(id, context) {
|
|
|
38027
38028
|
installedProviders,
|
|
38028
38029
|
rou3Code,
|
|
38029
38030
|
hmr,
|
|
38030
|
-
deviceApproval
|
|
38031
|
+
deviceApproval,
|
|
38032
|
+
keyExchange
|
|
38031
38033
|
} = context;
|
|
38032
38034
|
if (id === RESOLVED_VIRTUAL_TOOLS_ID) {
|
|
38033
38035
|
const tools = await scanToolsDirectory(toolsDir);
|
|
@@ -38092,6 +38094,7 @@ export const config = {
|
|
|
38092
38094
|
promptsDir: "${relativePromptsDir}",
|
|
38093
38095
|
agentsDir: "${relativeAgentsDir}",
|
|
38094
38096
|
deviceApproval: ${JSON.stringify(deviceApproval ?? null)},
|
|
38097
|
+
keyExchange: ${JSON.stringify(keyExchange ?? null)},
|
|
38095
38098
|
};`;
|
|
38096
38099
|
}
|
|
38097
38100
|
if (id === RESOLVED_VIRTUAL_MODELS_ID) {
|
|
@@ -38500,6 +38503,35 @@ function applyPluginEnvironmentConfig(config, options = {}) {
|
|
|
38500
38503
|
}
|
|
38501
38504
|
}
|
|
38502
38505
|
|
|
38506
|
+
// src/utils/key-exchange.ts
|
|
38507
|
+
var HOST_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
38508
|
+
function validHost(host) {
|
|
38509
|
+
return host.length <= 253 && host.split(".").length >= 2 && host.split(".").every((label) => HOST_LABEL.test(label));
|
|
38510
|
+
}
|
|
38511
|
+
function normalizeTrustedOrigin(value) {
|
|
38512
|
+
if (typeof value !== "string") {
|
|
38513
|
+
throw new Error("keyExchange.trustedOrigins entries must be strings");
|
|
38514
|
+
}
|
|
38515
|
+
const entry = value.trim().toLowerCase();
|
|
38516
|
+
const host = entry.startsWith("https://") ? entry.slice("https://".length) : "";
|
|
38517
|
+
const wildcard = host.startsWith("*.");
|
|
38518
|
+
if (!validHost(wildcard ? host.slice(2) : host)) {
|
|
38519
|
+
throw new Error(`keyExchange.trustedOrigins entry ${JSON.stringify(value)} must be https://host or https://*.suffix`);
|
|
38520
|
+
}
|
|
38521
|
+
return entry;
|
|
38522
|
+
}
|
|
38523
|
+
function normalizeKeyExchange(value) {
|
|
38524
|
+
if (value === void 0) return void 0;
|
|
38525
|
+
if (!value || typeof value !== "object" || !Array.isArray(value.trustedOrigins)) {
|
|
38526
|
+
throw new Error("keyExchange must be an object with a trustedOrigins array");
|
|
38527
|
+
}
|
|
38528
|
+
const trustedOrigins = [...new Set(value.trustedOrigins.map(normalizeTrustedOrigin))];
|
|
38529
|
+
if (trustedOrigins.length === 0) {
|
|
38530
|
+
throw new Error("keyExchange.trustedOrigins must name at least one origin");
|
|
38531
|
+
}
|
|
38532
|
+
return { trustedOrigins };
|
|
38533
|
+
}
|
|
38534
|
+
|
|
38503
38535
|
// src/plugin/device-approval.ts
|
|
38504
38536
|
function requiredText(value, field, maxLength) {
|
|
38505
38537
|
if (typeof value !== "string" || !value.trim() || value.trim().length > maxLength) {
|
|
@@ -38544,6 +38576,7 @@ function normalizeDeviceApprovalBrand(value) {
|
|
|
38544
38576
|
// src/plugin.ts
|
|
38545
38577
|
function agentbuilder(options = {}) {
|
|
38546
38578
|
const deviceApproval = normalizeDeviceApprovalBrand(options.deviceApproval);
|
|
38579
|
+
const keyExchange = normalizeKeyExchange(options.keyExchange);
|
|
38547
38580
|
const trustedDevHosts = normalizeTrustedDevHosts(options.trustedDevHosts);
|
|
38548
38581
|
const toolsDir = options.toolsDir ? path9__default.resolve(process.cwd(), options.toolsDir) : path9__default.resolve(process.cwd(), "agents/tools");
|
|
38549
38582
|
const hooksDir = options.hooksDir ? path9__default.resolve(process.cwd(), options.hooksDir) : path9__default.resolve(process.cwd(), "agents/hooks");
|
|
@@ -38640,7 +38673,8 @@ export { CodeExecutionBridge, DurableAgentBuilder, DurableThread, ThreadWatchdog
|
|
|
38640
38673
|
installedProviders,
|
|
38641
38674
|
rou3Code,
|
|
38642
38675
|
hmr,
|
|
38643
|
-
deviceApproval
|
|
38676
|
+
deviceApproval,
|
|
38677
|
+
keyExchange
|
|
38644
38678
|
};
|
|
38645
38679
|
const devMiddlewareContext = {
|
|
38646
38680
|
toolsDir,
|