@standardagents/builder 0.41.22 → 0.41.26
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 +387 -134
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/{ApiKeysView-D4g6ZNWG.js → ApiKeysView-CJYLO_ua.js} +1 -1
- package/dist/client/{CenteredContentView-B3WUhJPU.js → CenteredContentView-V1sCsISI.js} +1 -1
- package/dist/client/{CompositionView-pL0H07yI.js → CompositionView-hqbZ8f7d.js} +1 -1
- package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-uehuZFVv.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-CYrgsA6b.js} +1 -1
- package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-vwNMv4kh.js → CopyButton.vue_vue_type_script_setup_true_lang-DFIJfKuD.js} +1 -1
- package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-lgIAQ4Oz.js → DataTable.vue_vue_type_script_setup_true_lang-IvRbPHup.js} +1 -1
- package/dist/client/{JsonViewer-BsC-w_01.js → JsonViewer-C6FsqOlJ.js} +1 -1
- package/dist/client/{LoginView-DriOurmS.js → LoginView-san5UrfX.js} +1 -1
- package/dist/client/{MarketplaceView-7pl01VFg.js → MarketplaceView-B89Shmm7.js} +1 -1
- package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-CQE6ME9a.js → Modal.vue_vue_type_script_setup_true_lang-BLzEXJtn.js} +1 -1
- package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-Dv-GVzNy.js → ModelModal.vue_vue_type_script_setup_true_lang-DTd4Jp3K.js} +1 -1
- package/dist/client/{ModelsView-BDxyu8pj.js → ModelsView-DWLrrwGf.js} +1 -1
- package/dist/client/{PromptEditView-Brn_lMum.js → PromptEditView-PHQ8rLZn.js} +1 -1
- package/dist/client/{PromptModal-BeqgBmpj.js → PromptModal-Bk5rLNB7.js} +1 -1
- package/dist/client/{PromptsView-Dgu1UMES.js → PromptsView-gugjlK3M.js} +1 -1
- package/dist/client/{ProvidersView-B3SPkaxt.js → ProvidersView-DVV8Q1Sw.js} +1 -1
- package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-BvsyovVV.js +22 -0
- package/dist/client/{ThreadsView-D0hT0NXg.js → ThreadsView-Doxz0NfK.js} +1 -1
- package/dist/client/{ToolsView-BitH87Mf.js → ToolsView-BZfq0wpk.js} +1 -1
- package/dist/client/{UsersView-BArKqDfJ.js → UsersView-D5sXzAHz.js} +1 -1
- package/dist/client/{VariablesView-BJtT_XLQ.js → VariablesView-BlEY-E07.js} +1 -1
- package/dist/client/assets/{ThreadInspectorPane-C9Lp8kxl.css → ThreadInspectorPane-DczJCBBm.css} +1 -1
- package/dist/client/{index-CAiyJVjz.js → index-CdsRfG1j.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/{index-BhIiPl8o.d.ts → index-Dn0rBA1H.d.ts} +4 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +196 -35
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/{resolver-D30lNT4L.d.ts → resolver-C6zKX6kw.d.ts} +11 -5
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +195 -34
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
- package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-DaArzwIz.js +0 -22
package/dist/client/index.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
27
27
|
<link rel="icon" type="image/svg+xml" href="/agents/assets/img/favicon-9uH1rb2F.svg">
|
|
28
28
|
<title>AgentBuilder Admin</title>
|
|
29
|
-
<script type="module" crossorigin src="/agents/index-
|
|
29
|
+
<script type="module" crossorigin src="/agents/index-CdsRfG1j.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/agents/formkit-Cu5ivce0.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/agents/vendor-c_uwtQ-S.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/agents/syntax-D68HCEYm.js">
|
|
@@ -1050,7 +1050,8 @@ interface LogData {
|
|
|
1050
1050
|
app_error?: string | null;
|
|
1051
1051
|
/** `app` rows only: operation duration in milliseconds. */
|
|
1052
1052
|
app_duration_ms?: number | null;
|
|
1053
|
-
/** `app` rows only: operation cost in USD
|
|
1053
|
+
/** `app` rows only: operation cost in USD. Row `cost_total` stays null;
|
|
1054
|
+
* thread cost totals add it to the LLM `cost_total` sums. */
|
|
1054
1055
|
app_cost?: number | null;
|
|
1055
1056
|
/** `app` rows only: JSON-encoded ThreadLogTrigger. */
|
|
1056
1057
|
app_trigger?: string | null;
|
|
@@ -1347,7 +1348,8 @@ interface LogEntry {
|
|
|
1347
1348
|
kind?: string | null;
|
|
1348
1349
|
/**
|
|
1349
1350
|
* 'app' rows (ThreadState.log(), spec ThreadLogEntry): severity, message,
|
|
1350
|
-
* outcome, failure reason, duration (ms), cost (USD
|
|
1351
|
+
* outcome, failure reason, duration (ms), cost (USD; the row's cost_total stays
|
|
1352
|
+
* null, but thread cost totals include it),
|
|
1351
1353
|
* and JSON text for data, request, response and trigger.
|
|
1352
1354
|
*/
|
|
1353
1355
|
app_level?: string | null;
|
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-C6zKX6kw.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-C6zKX6kw.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-Dn0rBA1H.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
|
@@ -3442,6 +3442,153 @@ var init_remoteAttachment = __esm({
|
|
|
3442
3442
|
}
|
|
3443
3443
|
});
|
|
3444
3444
|
|
|
3445
|
+
// src/agents/strictToolSchema.ts
|
|
3446
|
+
function isRecord(value) {
|
|
3447
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3448
|
+
}
|
|
3449
|
+
function isObjectSchema(schema) {
|
|
3450
|
+
const type = schema.type;
|
|
3451
|
+
return type === "object" || Array.isArray(type) && type.includes("object") || type === void 0 && isRecord(schema.properties);
|
|
3452
|
+
}
|
|
3453
|
+
function acceptsNull(schema) {
|
|
3454
|
+
if (schema.type === "null") return true;
|
|
3455
|
+
if (Array.isArray(schema.type) && schema.type.includes("null")) return true;
|
|
3456
|
+
return Array.isArray(schema.anyOf) && schema.anyOf.some((v) => isRecord(v) && acceptsNull(v));
|
|
3457
|
+
}
|
|
3458
|
+
function nullableStrictSchema(schema) {
|
|
3459
|
+
if (acceptsNull(schema)) return schema;
|
|
3460
|
+
const { description, title, ...rest } = schema;
|
|
3461
|
+
const variants = Array.isArray(rest.anyOf) && Object.keys(rest).length === 1 ? [...rest.anyOf] : [rest];
|
|
3462
|
+
return {
|
|
3463
|
+
anyOf: [...variants, { type: "null" }],
|
|
3464
|
+
...description !== void 0 ? { description } : {},
|
|
3465
|
+
...title !== void 0 ? { title } : {}
|
|
3466
|
+
};
|
|
3467
|
+
}
|
|
3468
|
+
function toStrictSchema(value) {
|
|
3469
|
+
if (!isRecord(value)) return {};
|
|
3470
|
+
if (Array.isArray(value.anyOf)) {
|
|
3471
|
+
const node2 = { anyOf: value.anyOf.map((v) => toStrictSchema(v)) };
|
|
3472
|
+
if (typeof value.description === "string") node2.description = value.description;
|
|
3473
|
+
if (typeof value.title === "string") node2.title = value.title;
|
|
3474
|
+
return node2;
|
|
3475
|
+
}
|
|
3476
|
+
const node = {};
|
|
3477
|
+
for (const [key, child] of Object.entries(value)) {
|
|
3478
|
+
if (!SUPPORTED_KEYWORDS.has(key)) continue;
|
|
3479
|
+
if (key === "properties" || key === "required" || key === "additionalProperties") continue;
|
|
3480
|
+
if (key === "items") node.items = toStrictSchema(child);
|
|
3481
|
+
else if (key === "$defs" && isRecord(child)) {
|
|
3482
|
+
node.$defs = Object.fromEntries(
|
|
3483
|
+
Object.entries(child).map(([name, def]) => [name, toStrictSchema(def)])
|
|
3484
|
+
);
|
|
3485
|
+
} else node[key] = child;
|
|
3486
|
+
}
|
|
3487
|
+
if (isObjectSchema(value)) {
|
|
3488
|
+
const properties = isRecord(value.properties) ? value.properties : {};
|
|
3489
|
+
const required = new Set(
|
|
3490
|
+
Array.isArray(value.required) ? value.required.filter((item) => typeof item === "string") : []
|
|
3491
|
+
);
|
|
3492
|
+
node.type = "object";
|
|
3493
|
+
node.properties = Object.fromEntries(
|
|
3494
|
+
Object.entries(properties).map(([name, child]) => {
|
|
3495
|
+
const strict = toStrictSchema(child);
|
|
3496
|
+
return [name, required.has(name) ? strict : nullableStrictSchema(strict)];
|
|
3497
|
+
})
|
|
3498
|
+
);
|
|
3499
|
+
node.required = Object.keys(properties);
|
|
3500
|
+
node.additionalProperties = false;
|
|
3501
|
+
}
|
|
3502
|
+
return node;
|
|
3503
|
+
}
|
|
3504
|
+
function stripNullArguments(value) {
|
|
3505
|
+
if (Array.isArray(value)) {
|
|
3506
|
+
return value.map((item) => isRecord(item) ? stripNullArguments(item) : item);
|
|
3507
|
+
}
|
|
3508
|
+
if (!isRecord(value)) return value;
|
|
3509
|
+
const out = {};
|
|
3510
|
+
for (const [key, child] of Object.entries(value)) {
|
|
3511
|
+
if (child === null) continue;
|
|
3512
|
+
out[key] = stripNullArguments(child);
|
|
3513
|
+
}
|
|
3514
|
+
return out;
|
|
3515
|
+
}
|
|
3516
|
+
function buildSubagentArgumentsSchema(sources) {
|
|
3517
|
+
const merged = /* @__PURE__ */ new Map();
|
|
3518
|
+
for (const source of sources) {
|
|
3519
|
+
const schema = isRecord(source.argumentSchema) ? source.argumentSchema : {};
|
|
3520
|
+
const properties2 = isRecord(schema.properties) ? schema.properties : {};
|
|
3521
|
+
const required = new Set(
|
|
3522
|
+
Array.isArray(schema.required) ? schema.required.filter((item) => typeof item === "string") : []
|
|
3523
|
+
);
|
|
3524
|
+
for (const [prop, child] of Object.entries(properties2)) {
|
|
3525
|
+
const entry = merged.get(prop) ?? {
|
|
3526
|
+
variants: /* @__PURE__ */ new Map(),
|
|
3527
|
+
declaredBy: [],
|
|
3528
|
+
requiredBy: []
|
|
3529
|
+
};
|
|
3530
|
+
const strict = toStrictSchema(child);
|
|
3531
|
+
entry.variants.set(JSON.stringify(strict), strict);
|
|
3532
|
+
entry.declaredBy.push(source.name);
|
|
3533
|
+
if (required.has(prop)) entry.requiredBy.push(source.name);
|
|
3534
|
+
merged.set(prop, entry);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
const multiple = sources.length > 1;
|
|
3538
|
+
const properties = {};
|
|
3539
|
+
for (const [prop, entry] of merged) {
|
|
3540
|
+
const variants = [...entry.variants.values()];
|
|
3541
|
+
let schema = variants.length === 1 ? variants[0] : { anyOf: variants };
|
|
3542
|
+
if (multiple) {
|
|
3543
|
+
const usage = [`Used by: ${entry.declaredBy.join(", ")}.`];
|
|
3544
|
+
usage.push(
|
|
3545
|
+
entry.requiredBy.length === sources.length ? "Required." : entry.requiredBy.length > 0 ? `Required for: ${entry.requiredBy.join(", ")}; pass null for other agents.` : "Optional; pass null to omit."
|
|
3546
|
+
);
|
|
3547
|
+
const own = typeof schema.description === "string" ? `${schema.description} ` : "";
|
|
3548
|
+
schema = { ...schema, description: `${own}${usage.join(" ")}` };
|
|
3549
|
+
}
|
|
3550
|
+
const alwaysRequired = entry.variants.size === 1 && sources.every((source) => entry.requiredBy.includes(source.name));
|
|
3551
|
+
properties[prop] = alwaysRequired ? schema : nullableStrictSchema(schema);
|
|
3552
|
+
}
|
|
3553
|
+
return {
|
|
3554
|
+
type: "object",
|
|
3555
|
+
description: multiple ? "Initial arguments for the selected agent; they persist for the child thread lifetime. Fill the properties the selected agent uses and pass null for the rest." : `Initial arguments for ${sources[0]?.name ?? "the subagent"}; they persist for the child thread lifetime.`,
|
|
3556
|
+
properties,
|
|
3557
|
+
required: Object.keys(properties),
|
|
3558
|
+
additionalProperties: false
|
|
3559
|
+
};
|
|
3560
|
+
}
|
|
3561
|
+
var SUPPORTED_KEYWORDS;
|
|
3562
|
+
var init_strictToolSchema = __esm({
|
|
3563
|
+
"src/agents/strictToolSchema.ts"() {
|
|
3564
|
+
SUPPORTED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
3565
|
+
"type",
|
|
3566
|
+
"properties",
|
|
3567
|
+
"required",
|
|
3568
|
+
"additionalProperties",
|
|
3569
|
+
"items",
|
|
3570
|
+
"enum",
|
|
3571
|
+
"const",
|
|
3572
|
+
"anyOf",
|
|
3573
|
+
"description",
|
|
3574
|
+
"title",
|
|
3575
|
+
"pattern",
|
|
3576
|
+
"format",
|
|
3577
|
+
"minLength",
|
|
3578
|
+
"maxLength",
|
|
3579
|
+
"minimum",
|
|
3580
|
+
"maximum",
|
|
3581
|
+
"exclusiveMinimum",
|
|
3582
|
+
"exclusiveMaximum",
|
|
3583
|
+
"multipleOf",
|
|
3584
|
+
"minItems",
|
|
3585
|
+
"maxItems",
|
|
3586
|
+
"$ref",
|
|
3587
|
+
"$defs"
|
|
3588
|
+
]);
|
|
3589
|
+
}
|
|
3590
|
+
});
|
|
3591
|
+
|
|
3445
3592
|
// src/durable-objects/files.ts
|
|
3446
3593
|
var files_exports = {};
|
|
3447
3594
|
__export(files_exports, {
|
|
@@ -4180,6 +4327,7 @@ var init_ToolExecutor = __esm({
|
|
|
4180
4327
|
init_ThreadStateImpl();
|
|
4181
4328
|
init_sessionTools();
|
|
4182
4329
|
init_remoteAttachment();
|
|
4330
|
+
init_strictToolSchema();
|
|
4183
4331
|
SUBAGENT_CREATE_TOOL = "subagent_create";
|
|
4184
4332
|
SUBAGENT_MESSAGE_TOOL = "subagent_message";
|
|
4185
4333
|
SUBAGENTS_LIST_TOOL = "subagents";
|
|
@@ -5100,16 +5248,26 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5100
5248
|
args,
|
|
5101
5249
|
initAttachmentsProperty
|
|
5102
5250
|
);
|
|
5103
|
-
const
|
|
5104
|
-
|
|
5251
|
+
const validationOptions = { agentName, packageId };
|
|
5252
|
+
let initialArguments = builtinSubagentAction === "create" ? stripNullArguments(builtinCreateInitialArguments) : args;
|
|
5253
|
+
let argumentValidationError = await this.validateSubagentArguments(
|
|
5105
5254
|
state,
|
|
5106
5255
|
agentDef,
|
|
5107
5256
|
initialArguments,
|
|
5108
|
-
|
|
5109
|
-
agentName,
|
|
5110
|
-
packageId
|
|
5111
|
-
}
|
|
5257
|
+
validationOptions
|
|
5112
5258
|
);
|
|
5259
|
+
if (argumentValidationError && builtinSubagentAction === "create") {
|
|
5260
|
+
const rawError = await this.validateSubagentArguments(
|
|
5261
|
+
state,
|
|
5262
|
+
agentDef,
|
|
5263
|
+
builtinCreateInitialArguments,
|
|
5264
|
+
validationOptions
|
|
5265
|
+
);
|
|
5266
|
+
if (!rawError) {
|
|
5267
|
+
argumentValidationError = null;
|
|
5268
|
+
initialArguments = builtinCreateInitialArguments;
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5113
5271
|
if (argumentValidationError) {
|
|
5114
5272
|
return argumentValidationError;
|
|
5115
5273
|
}
|
|
@@ -5419,7 +5577,7 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5419
5577
|
error: `${SUBAGENT_CREATE_TOOL} requires agent.`
|
|
5420
5578
|
};
|
|
5421
5579
|
}
|
|
5422
|
-
if (rawArguments !== void 0 && (typeof rawArguments !== "object" || rawArguments === null || Array.isArray(rawArguments))) {
|
|
5580
|
+
if (rawArguments !== void 0 && rawArguments !== null && (typeof rawArguments !== "object" || rawArguments === null || Array.isArray(rawArguments))) {
|
|
5423
5581
|
return {
|
|
5424
5582
|
agent,
|
|
5425
5583
|
message,
|
|
@@ -19665,10 +19823,15 @@ ${resultContent}${attachmentSummary}`;
|
|
|
19665
19823
|
}
|
|
19666
19824
|
}
|
|
19667
19825
|
/**
|
|
19668
|
-
* This thread's OWN
|
|
19669
|
-
*
|
|
19670
|
-
*
|
|
19671
|
-
*
|
|
19826
|
+
* This thread's OWN cost summary (no descendants), aggregated in SQL so
|
|
19827
|
+
* subtree cost reporting doesn't page full log rows out of every thread in
|
|
19828
|
+
* the tree. Used by GET /api/threads/:id/cost, which merges these across
|
|
19829
|
+
* the thread and all of its subagent descendants.
|
|
19830
|
+
*
|
|
19831
|
+
* `totalCost` is everything the thread cost: LLM request rows (`cost_total`)
|
|
19832
|
+
* plus application log rows (`kind = 'app'`, ThreadState.log() `cost`,
|
|
19833
|
+
* stored as `app_cost`). `appCost` reports the application share apart;
|
|
19834
|
+
* the per-model breakdown, component sums and `requestCount` stay LLM-only.
|
|
19672
19835
|
*/
|
|
19673
19836
|
async getCostSummary() {
|
|
19674
19837
|
await this.ensureMigrated();
|
|
@@ -19689,7 +19852,7 @@ ${resultContent}${attachmentSummary}`;
|
|
|
19689
19852
|
SUM(cost_router_fee) AS router_fee_cost,
|
|
19690
19853
|
COUNT(*) AS request_count
|
|
19691
19854
|
FROM logs
|
|
19692
|
-
WHERE cost_total IS NOT NULL
|
|
19855
|
+
WHERE cost_total IS NOT NULL AND (kind IS NULL OR kind != '${APP_LOG_KIND}')
|
|
19693
19856
|
GROUP BY model_key
|
|
19694
19857
|
`
|
|
19695
19858
|
);
|
|
@@ -19709,12 +19872,21 @@ ${resultContent}${attachmentSummary}`;
|
|
|
19709
19872
|
routerFeeCost += row.router_fee_cost ?? 0;
|
|
19710
19873
|
requestCount += row.request_count;
|
|
19711
19874
|
}
|
|
19875
|
+
const appRow = await this.ctx.storage.sql.exec(
|
|
19876
|
+
`SELECT SUM(app_cost) AS app_cost FROM logs WHERE kind = ? AND app_cost IS NOT NULL`,
|
|
19877
|
+
APP_LOG_KIND
|
|
19878
|
+
);
|
|
19879
|
+
const appCost = appRow.one().app_cost ?? 0;
|
|
19880
|
+
totalCost += appCost;
|
|
19712
19881
|
const messageRow = await this.ctx.storage.sql.exec(
|
|
19713
|
-
`SELECT COUNT(DISTINCT message_id) AS message_count FROM logs
|
|
19882
|
+
`SELECT COUNT(DISTINCT message_id) AS message_count FROM logs
|
|
19883
|
+
WHERE cost_total IS NOT NULL OR (kind = ? AND app_cost IS NOT NULL)`,
|
|
19884
|
+
APP_LOG_KIND
|
|
19714
19885
|
);
|
|
19715
19886
|
const messageCount = messageRow.one().message_count || 0;
|
|
19716
19887
|
return {
|
|
19717
19888
|
totalCost,
|
|
19889
|
+
appCost,
|
|
19718
19890
|
inputCost,
|
|
19719
19891
|
cachedCost,
|
|
19720
19892
|
outputCost,
|
|
@@ -23472,6 +23644,7 @@ var init_FlowEngine = __esm({
|
|
|
23472
23644
|
init_sessionTools();
|
|
23473
23645
|
init_ThreadStateImpl();
|
|
23474
23646
|
init_ParentHookResolver();
|
|
23647
|
+
init_strictToolSchema();
|
|
23475
23648
|
IMMEDIATE_BOOTSTRAP_TOOL_NAME = "bootstrap_immediate_subagent";
|
|
23476
23649
|
HookBlockedExecutionError = class extends Error {
|
|
23477
23650
|
constructor(message) {
|
|
@@ -26244,22 +26417,6 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
26244
26417
|
}
|
|
26245
26418
|
return parts.length > 0 ? parts.join("; ") : "no extra initial arguments";
|
|
26246
26419
|
}
|
|
26247
|
-
static buildSubagentArgumentsSchema(sideSubagentDescriptors) {
|
|
26248
|
-
const variants = sideSubagentDescriptors.map((entry) => ({
|
|
26249
|
-
...this.normalizeSubagentArgumentSchema(entry.argumentSchema),
|
|
26250
|
-
title: `${entry.name} initial arguments`,
|
|
26251
|
-
description: `Initial arguments for ${entry.name}. These values persist for the child thread lifetime.`
|
|
26252
|
-
}));
|
|
26253
|
-
if (variants.length === 1) {
|
|
26254
|
-
return variants[0];
|
|
26255
|
-
}
|
|
26256
|
-
return {
|
|
26257
|
-
type: "object",
|
|
26258
|
-
description: "Agent-specific initial arguments for the selected subagent. Use the schema matching the selected agent.",
|
|
26259
|
-
additionalProperties: false,
|
|
26260
|
-
anyOf: variants
|
|
26261
|
-
};
|
|
26262
|
-
}
|
|
26263
26420
|
static buildSubagentCreateTool(sideSubagentDescriptors) {
|
|
26264
26421
|
const agentNames = sideSubagentDescriptors.map((entry) => entry.name);
|
|
26265
26422
|
const descriptionLines = sideSubagentDescriptors.map((entry) => {
|
|
@@ -26276,7 +26433,7 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
26276
26433
|
"Create and run a configured subagent. Every instance is a persistent, addressable thread.",
|
|
26277
26434
|
"Available subagents:",
|
|
26278
26435
|
...descriptionLines,
|
|
26279
|
-
"Provide
|
|
26436
|
+
"Provide the selected agent's invocation arguments via `arguments` (null for properties it does not use); they persist for the life of the subagent thread.",
|
|
26280
26437
|
"Before creating a new instance, call `subagents` to check the status of instances you already have \u2014 an existing one may already cover the work, and instance caps count live children.",
|
|
26281
26438
|
"Use subagent_message for follow-up communication with existing instances."
|
|
26282
26439
|
].join("\n"),
|
|
@@ -26303,10 +26460,14 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
26303
26460
|
type: "string",
|
|
26304
26461
|
description: "Required human-readable instance name for the spawned subagent thread. Use a concise stable label that identifies this child instance."
|
|
26305
26462
|
},
|
|
26306
|
-
|
|
26463
|
+
// One strict object (union of every relationship's arguments,
|
|
26464
|
+
// optional ones nullable) — see strictToolSchema.ts for the
|
|
26465
|
+
// provider rules this satisfies. Required like every property
|
|
26466
|
+
// under strict mode; the model passes {} when there are none.
|
|
26467
|
+
arguments: buildSubagentArgumentsSchema(sideSubagentDescriptors)
|
|
26307
26468
|
},
|
|
26308
26469
|
additionalProperties: false,
|
|
26309
|
-
required: ["agent", "message", "attachments", "name"]
|
|
26470
|
+
required: ["agent", "message", "attachments", "name", "arguments"]
|
|
26310
26471
|
}
|
|
26311
26472
|
}
|
|
26312
26473
|
};
|
|
@@ -26330,8 +26491,8 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
26330
26491
|
sanitized[key] = this.sanitizeToolJsonSchema(child);
|
|
26331
26492
|
}
|
|
26332
26493
|
const type = sanitized.type;
|
|
26333
|
-
const
|
|
26334
|
-
if (
|
|
26494
|
+
const isObjectSchema2 = type === "object" || Array.isArray(type) && type.includes("object");
|
|
26495
|
+
if (isObjectSchema2) {
|
|
26335
26496
|
sanitized.additionalProperties = false;
|
|
26336
26497
|
}
|
|
26337
26498
|
return sanitized;
|
|
@@ -30527,7 +30688,7 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
30527
30688
|
app_error: string | null;
|
|
30528
30689
|
/** 'app' rows: operation duration in milliseconds. */
|
|
30529
30690
|
app_duration_ms: number | null;
|
|
30530
|
-
/** 'app' rows: operation cost in USD (
|
|
30691
|
+
/** 'app' rows: operation cost in USD (cost_total stays null; thread cost totals include it). */
|
|
30531
30692
|
app_cost: number | null;
|
|
30532
30693
|
/** 'app' rows: JSON-encoded trigger ({ kind, id?, summary? }). */
|
|
30533
30694
|
app_trigger: string | null;
|