@standardagents/builder 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-in-routes.js +175 -47
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/{ApiKeysView-N0JkbRqs.js → ApiKeysView-1m7uIS8S.js} +1 -1
- package/dist/client/{CenteredContentView-DTm87Sif.js → CenteredContentView-DJzHRMGj.js} +1 -1
- package/dist/client/{CompositionView-DnSaz1Nk.js → CompositionView-nzqzVKAg.js} +1 -1
- package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-DgfpzkTb.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-YX8WE_iB.js} +1 -1
- package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-DaO8fv5n.js → CopyButton.vue_vue_type_script_setup_true_lang-BpJt6BT0.js} +1 -1
- package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-CXfKtM8R.js → DataTable.vue_vue_type_script_setup_true_lang-Dg3HMMJ0.js} +1 -1
- package/dist/client/{JsonViewer-dnp9s6ji.js → JsonViewer-BdNA5OCG.js} +1 -1
- package/dist/client/{LoginView-C4vODzeq.js → LoginView-BlF_2TtB.js} +1 -1
- package/dist/client/{MarketplaceView-D4QuJAyk.js → MarketplaceView-DrlOb57k.js} +1 -1
- package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-DbzeQ2-L.js → Modal.vue_vue_type_script_setup_true_lang-hkOmEwrb.js} +1 -1
- package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-CNIgneiU.js → ModelModal.vue_vue_type_script_setup_true_lang-p3esoV-i.js} +1 -1
- package/dist/client/{ModelsView-CYQm6yLC.js → ModelsView-CHBanMSH.js} +1 -1
- package/dist/client/{PromptEditView-BAJoqY8N.js → PromptEditView-b5B43l4Q.js} +1 -1
- package/dist/client/{PromptModal-CFd4gHai.js → PromptModal-BF5bdmNQ.js} +1 -1
- package/dist/client/{PromptsView-DDapP7U-.js → PromptsView-6TfMOScI.js} +1 -1
- package/dist/client/{ProvidersView-D2g5wSI1.js → ProvidersView-CA5Yx2Fn.js} +1 -1
- package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-Cyvuox_G.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-ejyFhmNy.js} +15 -15
- package/dist/client/{ThreadsView-Dc3lr6Au.js → ThreadsView-yJpVmf42.js} +1 -1
- package/dist/client/{ToolsView-C-marn6m.js → ToolsView-DE1TDnlU.js} +1 -1
- package/dist/client/{UsersView-D4j8izbK.js → UsersView-BXDHjJLB.js} +1 -1
- package/dist/client/{VariablesView-d3lOE_O2.js → VariablesView-Bz-CbaEv.js} +1 -1
- package/dist/client/assets/index-V68N0r_5.css +1 -0
- package/dist/client/{index-DR9DbKrm.js → index-TIntu1KJ.js} +2 -2
- package/dist/client/index.html +2 -2
- package/dist/index.js +106 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +8 -0
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +29 -0
- package/dist/runtime.js +98 -6
- package/dist/runtime.js.map +1 -1
- package/package.json +5 -5
- package/dist/client/assets/index-_JaOWezk.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -26,14 +26,14 @@
|
|
|
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-TIntu1KJ.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/agents/formkit-DcuuXZjC.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/agents/vendor-TPZjEwCU.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/agents/syntax-D-ZcovVx.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/agents/vue-2tGL2Ulx.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/agents/monaco-DI2r3M8m.js">
|
|
35
35
|
<link rel="stylesheet" crossorigin href="/agents/assets/monaco-DbLkoLD4.css">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/agents/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/agents/assets/index-V68N0r_5.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="app"></div>
|
package/dist/index.js
CHANGED
|
@@ -5739,7 +5739,7 @@ ${attachmentPaths}`;
|
|
|
5739
5739
|
const attachmentId = crypto.randomUUID();
|
|
5740
5740
|
const timestamp = Date.now();
|
|
5741
5741
|
const ext = attachment.mimeType === "image/png" ? "png" : attachment.mimeType === "image/jpeg" ? "jpg" : attachment.mimeType === "image/gif" ? "gif" : attachment.mimeType === "image/webp" ? "webp" : attachment.name.split(".").pop() || "bin";
|
|
5742
|
-
const path20 = `/attachments/${timestamp}-${attachmentId}.${ext}`;
|
|
5742
|
+
const path20 = `/attachments/${timestamp}-${attachmentId.slice(0, 8)}.${ext}`;
|
|
5743
5743
|
const binaryString = atob(attachment.data);
|
|
5744
5744
|
const dataBuffer = new Uint8Array(binaryString.length);
|
|
5745
5745
|
for (let i = 0; i < binaryString.length; i++) {
|
|
@@ -6066,9 +6066,10 @@ var init_context = __esm({
|
|
|
6066
6066
|
// src/agents/FlowEngine.ts
|
|
6067
6067
|
var FlowEngine_exports = {};
|
|
6068
6068
|
__export(FlowEngine_exports, {
|
|
6069
|
-
FlowEngine: () => FlowEngine
|
|
6069
|
+
FlowEngine: () => FlowEngine,
|
|
6070
|
+
HookBlockedExecutionError: () => HookBlockedExecutionError
|
|
6070
6071
|
});
|
|
6071
|
-
var IMMEDIATE_BOOTSTRAP_TOOL_NAME, FlowEngine;
|
|
6072
|
+
var IMMEDIATE_BOOTSTRAP_TOOL_NAME, HookBlockedExecutionError, FlowEngine;
|
|
6072
6073
|
var init_FlowEngine = __esm({
|
|
6073
6074
|
"src/agents/FlowEngine.ts"() {
|
|
6074
6075
|
init_types();
|
|
@@ -6079,6 +6080,12 @@ var init_FlowEngine = __esm({
|
|
|
6079
6080
|
init_sessionTools();
|
|
6080
6081
|
init_ThreadStateImpl();
|
|
6081
6082
|
IMMEDIATE_BOOTSTRAP_TOOL_NAME = "bootstrap_immediate_subagent";
|
|
6083
|
+
HookBlockedExecutionError = class extends Error {
|
|
6084
|
+
constructor(message) {
|
|
6085
|
+
super(message);
|
|
6086
|
+
this.name = "HookBlockedExecutionError";
|
|
6087
|
+
}
|
|
6088
|
+
};
|
|
6082
6089
|
FlowEngine = class _FlowEngine {
|
|
6083
6090
|
static IMMEDIATE_SCOPED_ENV_CONTEXT_KEY = "__immediate_scoped_env_by_call_id";
|
|
6084
6091
|
/**
|
|
@@ -6626,7 +6633,26 @@ This usually points to something I can't fix from here \u2014 for example the wo
|
|
|
6626
6633
|
state.messageHistory = await this.loadMessageHistory(state);
|
|
6627
6634
|
const context = await this.assembleContext(state);
|
|
6628
6635
|
state.allowedTools = context.tools;
|
|
6629
|
-
|
|
6636
|
+
try {
|
|
6637
|
+
context.messages = await this.runPrefilterLLMHistoryHook(state, context.messages);
|
|
6638
|
+
} catch (error) {
|
|
6639
|
+
if (error instanceof HookBlockedExecutionError) {
|
|
6640
|
+
const threadState = ThreadStateImpl.fromFlowState(state);
|
|
6641
|
+
await threadState.injectMessage({ role: "assistant", content: error.message });
|
|
6642
|
+
state.stopped = true;
|
|
6643
|
+
state.stoppedBy = state.currentSide;
|
|
6644
|
+
state.stopReason = error.message;
|
|
6645
|
+
state.stopReasonCode = "hook_blocked";
|
|
6646
|
+
state.emitTelemetry?.({
|
|
6647
|
+
type: "stopped",
|
|
6648
|
+
reason: state.stopReason,
|
|
6649
|
+
side: state.currentSide,
|
|
6650
|
+
timestamp: Date.now()
|
|
6651
|
+
});
|
|
6652
|
+
return;
|
|
6653
|
+
}
|
|
6654
|
+
throw error;
|
|
6655
|
+
}
|
|
6630
6656
|
const pendingMessageId = await this.createPendingMessage(state);
|
|
6631
6657
|
state.pendingMessageId = pendingMessageId;
|
|
6632
6658
|
let responseStatus = "completed";
|
|
@@ -8782,6 +8808,9 @@ ${lines.join("\n\n")}`
|
|
|
8782
8808
|
try {
|
|
8783
8809
|
result = await executor(threadState, result);
|
|
8784
8810
|
} catch (error) {
|
|
8811
|
+
if (error && typeof error === "object" && error.block === true) {
|
|
8812
|
+
throw new HookBlockedExecutionError(error instanceof Error ? error.message : String(error));
|
|
8813
|
+
}
|
|
8785
8814
|
console.error("[Hooks] \u2717 Error running prefilter_llm_history hook:", error);
|
|
8786
8815
|
}
|
|
8787
8816
|
}
|
|
@@ -9390,7 +9419,7 @@ ${lines.join("\n\n")}`
|
|
|
9390
9419
|
const base64Data = match[2];
|
|
9391
9420
|
const ext = mimeType.split("/")[1] || "png";
|
|
9392
9421
|
const attachmentId = crypto.randomUUID();
|
|
9393
|
-
const path20 = `/attachments/${Date.now()}-${attachmentId}.${ext}`;
|
|
9422
|
+
const path20 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
|
|
9394
9423
|
try {
|
|
9395
9424
|
await state.thread.instance.writeFile(path20, base64Data, mimeType);
|
|
9396
9425
|
if (image.id) {
|
|
@@ -9460,7 +9489,7 @@ ${lines.join("\n\n")}`
|
|
|
9460
9489
|
const base64Data = imageUrl.slice(base64Index + base64Marker.length);
|
|
9461
9490
|
const ext = mimeType.split("/")[1] || "png";
|
|
9462
9491
|
const attachmentId = crypto.randomUUID();
|
|
9463
|
-
const path20 = `/attachments/${Date.now()}-${attachmentId}.${ext}`;
|
|
9492
|
+
const path20 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
|
|
9464
9493
|
try {
|
|
9465
9494
|
await state.thread.instance.writeFile(path20, base64Data, mimeType);
|
|
9466
9495
|
const attachmentRef = {
|
|
@@ -20849,6 +20878,14 @@ function isPublicRoute(routePath, hosted) {
|
|
|
20849
20878
|
return true;
|
|
20850
20879
|
}
|
|
20851
20880
|
|
|
20881
|
+
// Device-code CLI login: start/poll are public by design (possession of the
|
|
20882
|
+
// one-time code is the secret) and the approve page must reach its controller
|
|
20883
|
+
// even when anonymous so it can redirect the browser through the platform
|
|
20884
|
+
// login (the controller enforces session auth itself).
|
|
20885
|
+
if (routePath === '/api/auth/device/start' || routePath.startsWith('/api/auth/device/')) {
|
|
20886
|
+
return true;
|
|
20887
|
+
}
|
|
20888
|
+
|
|
20852
20889
|
// Provider icon routes are public (used by <img src>)
|
|
20853
20890
|
if (routePath.startsWith('/api/providers/') && routePath.includes('/icon')) {
|
|
20854
20891
|
return true;
|
|
@@ -26462,6 +26499,38 @@ ${resultContent}${attachmentSummary}`;
|
|
|
26462
26499
|
throw error;
|
|
26463
26500
|
}
|
|
26464
26501
|
}
|
|
26502
|
+
/**
|
|
26503
|
+
* This thread's OWN request-log cost summary (no descendants), aggregated
|
|
26504
|
+
* in SQL so subtree cost reporting doesn't page full log rows out of every
|
|
26505
|
+
* thread in the tree. Used by GET /api/threads/:id/cost, which merges these
|
|
26506
|
+
* across the thread and all of its subagent descendants.
|
|
26507
|
+
*/
|
|
26508
|
+
async getCostSummary() {
|
|
26509
|
+
await this.ensureMigrated();
|
|
26510
|
+
const byModel = {};
|
|
26511
|
+
let totalCost = 0;
|
|
26512
|
+
let requestCount = 0;
|
|
26513
|
+
const modelRows = await this.ctx.storage.sql.exec(
|
|
26514
|
+
`
|
|
26515
|
+
SELECT COALESCE(model_name, model, 'unknown') AS model_key,
|
|
26516
|
+
SUM(cost_total) AS total_cost,
|
|
26517
|
+
COUNT(*) AS request_count
|
|
26518
|
+
FROM logs
|
|
26519
|
+
WHERE cost_total IS NOT NULL
|
|
26520
|
+
GROUP BY model_key
|
|
26521
|
+
`
|
|
26522
|
+
);
|
|
26523
|
+
for (const row of modelRows.toArray()) {
|
|
26524
|
+
byModel[row.model_key] = { totalCost: row.total_cost, count: row.request_count };
|
|
26525
|
+
totalCost += row.total_cost;
|
|
26526
|
+
requestCount += row.request_count;
|
|
26527
|
+
}
|
|
26528
|
+
const messageRow = await this.ctx.storage.sql.exec(
|
|
26529
|
+
`SELECT COUNT(DISTINCT message_id) AS message_count FROM logs WHERE cost_total IS NOT NULL`
|
|
26530
|
+
);
|
|
26531
|
+
const messageCount = messageRow.one().message_count || 0;
|
|
26532
|
+
return { totalCost, requestCount, messageCount, byModel };
|
|
26533
|
+
}
|
|
26465
26534
|
/**
|
|
26466
26535
|
* Get specific logs, optionally including all descendant logs.
|
|
26467
26536
|
*/
|
|
@@ -29854,6 +29923,37 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
29854
29923
|
created_at: row.created_at
|
|
29855
29924
|
};
|
|
29856
29925
|
}
|
|
29926
|
+
/**
|
|
29927
|
+
* All descendant threads of a root thread (children, grandchildren, …),
|
|
29928
|
+
* excluding the root itself. Used for subtree cost reporting: a thread's
|
|
29929
|
+
* displayed cost is its own plus every subagent thread it spawned,
|
|
29930
|
+
* recursively. Ordered parents-before-children (breadth by creation time).
|
|
29931
|
+
*/
|
|
29932
|
+
async getDescendantThreads(rootId) {
|
|
29933
|
+
await this.ensureMigrated();
|
|
29934
|
+
const cursor = await this.ctx.storage.sql.exec(
|
|
29935
|
+
`
|
|
29936
|
+
WITH RECURSIVE descendants(id) AS (
|
|
29937
|
+
SELECT id FROM threads WHERE parent = ?
|
|
29938
|
+
UNION ALL
|
|
29939
|
+
SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
|
|
29940
|
+
)
|
|
29941
|
+
SELECT id, agent_name, parent, tags, terminated, created_at
|
|
29942
|
+
FROM threads
|
|
29943
|
+
WHERE id IN (SELECT id FROM descendants)
|
|
29944
|
+
ORDER BY created_at ASC
|
|
29945
|
+
`,
|
|
29946
|
+
rootId
|
|
29947
|
+
);
|
|
29948
|
+
return cursor.toArray().map((row) => ({
|
|
29949
|
+
id: row.id,
|
|
29950
|
+
agent_name: row.agent_name,
|
|
29951
|
+
parent: row.parent,
|
|
29952
|
+
tags: row.tags ? JSON.parse(row.tags) : null,
|
|
29953
|
+
terminated: row.terminated,
|
|
29954
|
+
created_at: row.created_at
|
|
29955
|
+
}));
|
|
29956
|
+
}
|
|
29857
29957
|
/**
|
|
29858
29958
|
* List threads with optional filtering.
|
|
29859
29959
|
* Note: tenvs are not decrypted in list operations for performance.
|