@standardagents/builder 0.24.5 → 0.24.6
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 +153 -15
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/{ApiKeysView-CmObAp7n.js → ApiKeysView-CmZKVcOR.js} +1 -1
- package/dist/client/CenteredContentView-DK7rPUK2.js +1 -0
- package/dist/client/{CompositionView-BohQwGLE.js → CompositionView-BvVMnyYP.js} +1 -1
- package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-A1C0eTY7.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-h7YuRPAr.js} +1 -1
- package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-D5q8qf4n.js → CopyButton.vue_vue_type_script_setup_true_lang-BpQ6CMUp.js} +1 -1
- package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-DzPpurCp.js → DataTable.vue_vue_type_script_setup_true_lang-DCUZbvUM.js} +1 -1
- package/dist/client/{JsonViewer-CKqMMqjU.js → JsonViewer-CvwfQYW-.js} +1 -1
- package/dist/client/{LoginView-BY2NMQQF.js → LoginView-DnaG5knS.js} +1 -1
- package/dist/client/{MarketplaceView-DVEMUvDq.js → MarketplaceView-fX_Juw54.js} +1 -1
- package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-1t6cxO9H.js → Modal.vue_vue_type_script_setup_true_lang-CFFVfl1g.js} +1 -1
- package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-WFlATqyT.js → ModelModal.vue_vue_type_script_setup_true_lang-B68s7Jo1.js} +1 -1
- package/dist/client/{ModelsView-_qZmXle8.js → ModelsView-lv4-IyA2.js} +1 -1
- package/dist/client/{PromptEditView-DzY493YB.js → PromptEditView-DGaxlMMx.js} +1 -1
- package/dist/client/{PromptModal-BQYwnWKw.js → PromptModal-DaW1J_W6.js} +1 -1
- package/dist/client/{PromptsView-DBiQ9X1g.js → PromptsView-CdiBqZey.js} +1 -1
- package/dist/client/{ProvidersView-DEH34_v0.js → ProvidersView-B37bgFKh.js} +1 -1
- package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-DHlNdv7o.js +22 -0
- package/dist/client/ThreadsView-BAfuNShv.js +1 -0
- package/dist/client/{ToolsView-D-qvyctb.js → ToolsView-BMKgNq7O.js} +1 -1
- package/dist/client/{UiCodeBlock.vue_vue_type_script_setup_true_lang-BawOR_eB.js → UiCodeBlock.vue_vue_type_script_setup_true_lang-BH3WC9G_.js} +1 -1
- package/dist/client/{UsersView-DaXRB61v.js → UsersView-BDKchqNQ.js} +1 -1
- package/dist/client/{VariablesView-DDomn-IB.js → VariablesView-BPioaCbu.js} +1 -1
- package/dist/client/assets/{ThreadInspectorPane-CjK6SKEi.css → ThreadInspectorPane-lJJckks4.css} +1 -1
- package/dist/client/assets/index-Djjx6d3k.css +1 -0
- package/dist/client/{check-DKLwABgc.js → check-Dkzs1C3V.js} +1 -1
- package/dist/client/{chevron-right-DJJGHNE5.js → chevron-right-BGirddPg.js} +1 -1
- package/dist/client/{copy-CLWiDcxB.js → copy-C08OR8rY.js} +1 -1
- package/dist/client/{formkit-DcuuXZjC.js → formkit-YJ1Z7D5r.js} +1 -1
- package/dist/client/{index-DihZBCmQ.js → index-BVfRoUms.js} +3 -3
- package/dist/client/index.html +4 -4
- package/dist/client/{package-CarOhnUs.js → package-guyzMTDG.js} +1 -1
- package/dist/client/{plus-zGapov7j.js → plus-DG3ZN5wg.js} +1 -1
- package/dist/client/{timeAgo-ASgzq6bq.js → timeAgo-D7V247YG.js} +1 -1
- package/dist/client/{useActionFeedback-uUrfjlCo.js → useActionFeedback-byARNQjQ.js} +1 -1
- package/dist/client/vue-BqC6IZDY.js +1 -0
- package/dist/{index-D7KMmRgr.d.ts → index-D3FNNQWC.d.ts} +7 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +9 -2
- package/dist/runtime.js +47 -6
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
- package/dist/client/CenteredContentView-gJXa9UHE.js +0 -1
- package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-Dtd1VFrj.js +0 -22
- package/dist/client/ThreadsView-m1CAq3Aw.js +0 -1
- package/dist/client/assets/index-V68N0r_5.css +0 -1
- package/dist/client/vue-2tGL2Ulx.js +0 -1
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as ThreadEnv, A as Agent, h as ThreadMetadata, i as ToolResult, M as Message, l as FileRecord, F as FlowState, n as FileStats, G as GrepResult, m as AttachmentRef, r as MessageContent, E as Env, g as ThreadInstance } from './index-
|
|
2
|
-
export { f as BuilderThreadEndpointHandler, B as Controller, a as ControllerContext, j as FlowResult, p as ImageContentPart, I as ImageMetadata, L as LLMResponse, q as MultimodalContent, R as RequestContext, S as StorageBackend, k as TelemetryEvent, o as TextContentPart, b as ThreadEndpointContext, T as ToolCall, c as createThreadEndpointHandler, d as defineController } from './index-
|
|
1
|
+
import { e as ThreadEnv, A as Agent, h as ThreadMetadata, i as ToolResult, M as Message, l as FileRecord, F as FlowState, n as FileStats, G as GrepResult, m as AttachmentRef, r as MessageContent, E as Env, g as ThreadInstance } from './index-D3FNNQWC.js';
|
|
2
|
+
export { f as BuilderThreadEndpointHandler, B as Controller, a as ControllerContext, j as FlowResult, p as ImageContentPart, I as ImageMetadata, L as LLMResponse, q as MultimodalContent, R as RequestContext, S as StorageBackend, k as TelemetryEvent, o as TextContentPart, b as ThreadEndpointContext, T as ToolCall, c as createThreadEndpointHandler, d as defineController } from './index-D3FNNQWC.js';
|
|
3
3
|
import { CodeExecutionOptions, CodeExecutionResult, SubagentRegistryEntry, InjectMessageInput, QueueMessageInput, ClientToolRequest, ClientToolResponse, SkillMetadata, SkillFileInput, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, PromptEnvPart, VariableDefinition, SubpromptConfig as SubpromptConfig$1, PromptToolConfig as PromptToolConfig$1, SubagentToolConfig as SubagentToolConfig$1, ReasoningConfig, SideConfig as SideConfig$1, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart, NamespaceContext, DefinitionLoader } from '@standardagents/spec';
|
|
4
4
|
export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ModelCapabilities as ProviderModelCapabilities, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel } from '@standardagents/spec';
|
|
5
5
|
import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -738,6 +738,7 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
738
738
|
error: string | null;
|
|
739
739
|
cost_total: number | null;
|
|
740
740
|
input_tokens: number | null;
|
|
741
|
+
cached_tokens: number | null;
|
|
741
742
|
output_tokens: number | null;
|
|
742
743
|
total_tokens: number | null;
|
|
743
744
|
is_complete: boolean;
|
|
@@ -755,10 +756,16 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
|
|
|
755
756
|
*/
|
|
756
757
|
getCostSummary(): Promise<{
|
|
757
758
|
totalCost: number;
|
|
759
|
+
inputCost: number;
|
|
760
|
+
cachedCost: number;
|
|
761
|
+
outputCost: number;
|
|
758
762
|
requestCount: number;
|
|
759
763
|
messageCount: number;
|
|
760
764
|
byModel: Record<string, {
|
|
761
765
|
totalCost: number;
|
|
766
|
+
inputCost: number;
|
|
767
|
+
cachedCost: number;
|
|
768
|
+
outputCost: number;
|
|
762
769
|
count: number;
|
|
763
770
|
}>;
|
|
764
771
|
}>;
|
package/dist/runtime.js
CHANGED
|
@@ -208,6 +208,18 @@ function getFallbackPricing(providerName, modelId) {
|
|
|
208
208
|
const pricing = getProviderModelPricing(providerName, modelId);
|
|
209
209
|
return pricing ? toResolvedModelPricing(pricing) : null;
|
|
210
210
|
}
|
|
211
|
+
function resolveUsageReportedPricing(usage) {
|
|
212
|
+
const pricing = usage.pricing;
|
|
213
|
+
if (!pricing || typeof pricing.inputPerMillion !== "number" || typeof pricing.outputPerMillion !== "number") {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
inputPrice: pricing.inputPerMillion,
|
|
218
|
+
outputPrice: pricing.outputPerMillion,
|
|
219
|
+
cachedPrice: pricing.cachedInputPerMillion,
|
|
220
|
+
source: "provider"
|
|
221
|
+
};
|
|
222
|
+
}
|
|
211
223
|
function resolveModelPricing(modelDef, providerName) {
|
|
212
224
|
if (typeof modelDef.inputPrice === "number" && typeof modelDef.outputPrice === "number") {
|
|
213
225
|
return {
|
|
@@ -1349,7 +1361,8 @@ function convertUsage(usage) {
|
|
|
1349
1361
|
prompt_tokens_details: usage.cachedTokens ? { cached_tokens: usage.cachedTokens } : void 0,
|
|
1350
1362
|
completion_tokens_details: usage.reasoningTokens ? { reasoning_tokens: usage.reasoningTokens } : void 0,
|
|
1351
1363
|
cost: usage.cost,
|
|
1352
|
-
provider: usage.provider
|
|
1364
|
+
provider: usage.provider,
|
|
1365
|
+
pricing: usage.pricing
|
|
1353
1366
|
};
|
|
1354
1367
|
}
|
|
1355
1368
|
function inferProviderFromModelId(model) {
|
|
@@ -2044,7 +2057,7 @@ var init_LLMRequest = __esm({
|
|
|
2044
2057
|
const toolsCalled = response.tool_calls ? JSON.stringify(response.tool_calls.map((tc) => tc.function.name)) : null;
|
|
2045
2058
|
const providerName = response._provider?.name;
|
|
2046
2059
|
const standardAgentsRouterUsed = response._viaPlatform === true || providerName === "platform";
|
|
2047
|
-
const resolvedPricing = resolveModelPricing(modelDef, providerName);
|
|
2060
|
+
const resolvedPricing = resolveModelPricing(modelDef) ?? resolveUsageReportedPricing(response.usage) ?? resolveModelPricing(modelDef, providerName);
|
|
2048
2061
|
const calculatedCost = calculateUsageCost(response.usage, resolvedPricing);
|
|
2049
2062
|
const providerReportedCost = typeof response.usage.cost === "number" ? response.usage.cost : typeof response.usage.cost === "string" ? parseFloat(response.usage.cost) : null;
|
|
2050
2063
|
const cost_total = providerReportedCost != null && !Number.isNaN(providerReportedCost) ? providerReportedCost : calculatedCost?.costTotal ?? null;
|
|
@@ -16170,8 +16183,10 @@ var DurableThread = class _DurableThread extends DurableObject {
|
|
|
16170
16183
|
async setValue(key, value) {
|
|
16171
16184
|
await this.ensureMigrated();
|
|
16172
16185
|
this.assertValidThreadValueKey(key);
|
|
16186
|
+
const updatedAt = Date.now() * 1e3;
|
|
16173
16187
|
if (value === null || value === void 0) {
|
|
16174
16188
|
await this.ctx.storage.sql.exec(`DELETE FROM thread_values WHERE key = ?`, key);
|
|
16189
|
+
this.broadcastLog({ type: "kv_data", key, deleted: true, updated_at: updatedAt });
|
|
16175
16190
|
return;
|
|
16176
16191
|
}
|
|
16177
16192
|
const serialized = this.serializeThreadValue(value);
|
|
@@ -16185,8 +16200,9 @@ var DurableThread = class _DurableThread extends DurableObject {
|
|
|
16185
16200
|
`,
|
|
16186
16201
|
key,
|
|
16187
16202
|
serialized,
|
|
16188
|
-
|
|
16203
|
+
updatedAt
|
|
16189
16204
|
);
|
|
16205
|
+
this.broadcastLog({ type: "kv_data", key, deleted: false, updated_at: updatedAt });
|
|
16190
16206
|
}
|
|
16191
16207
|
async listValues(options = {}) {
|
|
16192
16208
|
await this.ensureMigrated();
|
|
@@ -18242,7 +18258,7 @@ ${resultContent}${attachmentSummary}`;
|
|
|
18242
18258
|
SELECT
|
|
18243
18259
|
id, message_id, provider, actual_provider, standard_agents_router_used, model, model_name, prompt_name,
|
|
18244
18260
|
tools_called, queued_tools, provider_tools, parent_log_id, retry_of_log_id, error, cost_total,
|
|
18245
|
-
input_tokens, output_tokens, total_tokens,
|
|
18261
|
+
input_tokens, cached_tokens, output_tokens, total_tokens,
|
|
18246
18262
|
is_complete, created_at, request_body
|
|
18247
18263
|
FROM logs
|
|
18248
18264
|
ORDER BY created_at ${order}
|
|
@@ -18268,6 +18284,7 @@ ${resultContent}${attachmentSummary}`;
|
|
|
18268
18284
|
error: row.error,
|
|
18269
18285
|
cost_total: row.cost_total,
|
|
18270
18286
|
input_tokens: row.input_tokens,
|
|
18287
|
+
cached_tokens: row.cached_tokens,
|
|
18271
18288
|
output_tokens: row.output_tokens,
|
|
18272
18289
|
total_tokens: row.total_tokens,
|
|
18273
18290
|
is_complete: row.is_complete === 1,
|
|
@@ -18291,11 +18308,17 @@ ${resultContent}${attachmentSummary}`;
|
|
|
18291
18308
|
await this.ensureMigrated();
|
|
18292
18309
|
const byModel = {};
|
|
18293
18310
|
let totalCost = 0;
|
|
18311
|
+
let inputCost = 0;
|
|
18312
|
+
let cachedCost = 0;
|
|
18313
|
+
let outputCost = 0;
|
|
18294
18314
|
let requestCount = 0;
|
|
18295
18315
|
const modelRows = await this.ctx.storage.sql.exec(
|
|
18296
18316
|
`
|
|
18297
18317
|
SELECT COALESCE(model_name, model, 'unknown') AS model_key,
|
|
18298
18318
|
SUM(cost_total) AS total_cost,
|
|
18319
|
+
SUM(CASE WHEN cost_cached IS NOT NULL THEN cost_input END) AS input_cost,
|
|
18320
|
+
SUM(cost_cached) AS cached_cost,
|
|
18321
|
+
SUM(cost_output) AS output_cost,
|
|
18299
18322
|
COUNT(*) AS request_count
|
|
18300
18323
|
FROM logs
|
|
18301
18324
|
WHERE cost_total IS NOT NULL
|
|
@@ -18303,15 +18326,32 @@ ${resultContent}${attachmentSummary}`;
|
|
|
18303
18326
|
`
|
|
18304
18327
|
);
|
|
18305
18328
|
for (const row of modelRows.toArray()) {
|
|
18306
|
-
byModel[row.model_key] = {
|
|
18329
|
+
byModel[row.model_key] = {
|
|
18330
|
+
totalCost: row.total_cost,
|
|
18331
|
+
inputCost: row.input_cost ?? 0,
|
|
18332
|
+
cachedCost: row.cached_cost ?? 0,
|
|
18333
|
+
outputCost: row.output_cost ?? 0,
|
|
18334
|
+
count: row.request_count
|
|
18335
|
+
};
|
|
18307
18336
|
totalCost += row.total_cost;
|
|
18337
|
+
inputCost += row.input_cost ?? 0;
|
|
18338
|
+
cachedCost += row.cached_cost ?? 0;
|
|
18339
|
+
outputCost += row.output_cost ?? 0;
|
|
18308
18340
|
requestCount += row.request_count;
|
|
18309
18341
|
}
|
|
18310
18342
|
const messageRow = await this.ctx.storage.sql.exec(
|
|
18311
18343
|
`SELECT COUNT(DISTINCT message_id) AS message_count FROM logs WHERE cost_total IS NOT NULL`
|
|
18312
18344
|
);
|
|
18313
18345
|
const messageCount = messageRow.one().message_count || 0;
|
|
18314
|
-
return {
|
|
18346
|
+
return {
|
|
18347
|
+
totalCost,
|
|
18348
|
+
inputCost,
|
|
18349
|
+
cachedCost,
|
|
18350
|
+
outputCost,
|
|
18351
|
+
requestCount,
|
|
18352
|
+
messageCount,
|
|
18353
|
+
byModel
|
|
18354
|
+
};
|
|
18315
18355
|
}
|
|
18316
18356
|
/**
|
|
18317
18357
|
* Get specific logs, optionally including all descendant logs.
|
|
@@ -19114,6 +19154,7 @@ ${resultContent}${attachmentSummary}`;
|
|
|
19114
19154
|
* Broadcast a log record to all connected WebSocket clients
|
|
19115
19155
|
*/
|
|
19116
19156
|
broadcastLog(log) {
|
|
19157
|
+
if (!this.logSockets || this.logSockets.size === 0) return;
|
|
19117
19158
|
const payload = JSON.stringify(log);
|
|
19118
19159
|
for (const ws of Array.from(this.logSockets)) {
|
|
19119
19160
|
try {
|