@standardagents/builder 0.22.1 → 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.
Files changed (33) hide show
  1. package/dist/built-in-routes.js +136 -43
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-N0JkbRqs.js → ApiKeysView-1m7uIS8S.js} +1 -1
  4. package/dist/client/{CenteredContentView-DTm87Sif.js → CenteredContentView-DJzHRMGj.js} +1 -1
  5. package/dist/client/{CompositionView-DnSaz1Nk.js → CompositionView-nzqzVKAg.js} +1 -1
  6. 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
  7. 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
  8. 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
  9. package/dist/client/{JsonViewer-dnp9s6ji.js → JsonViewer-BdNA5OCG.js} +1 -1
  10. package/dist/client/{LoginView-C4vODzeq.js → LoginView-BlF_2TtB.js} +1 -1
  11. package/dist/client/{MarketplaceView-D4QuJAyk.js → MarketplaceView-DrlOb57k.js} +1 -1
  12. 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
  13. 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
  14. package/dist/client/{ModelsView-CYQm6yLC.js → ModelsView-CHBanMSH.js} +1 -1
  15. package/dist/client/{PromptEditView-BAJoqY8N.js → PromptEditView-b5B43l4Q.js} +1 -1
  16. package/dist/client/{PromptModal-CFd4gHai.js → PromptModal-BF5bdmNQ.js} +1 -1
  17. package/dist/client/{PromptsView-DDapP7U-.js → PromptsView-6TfMOScI.js} +1 -1
  18. package/dist/client/{ProvidersView-D2g5wSI1.js → ProvidersView-CA5Yx2Fn.js} +1 -1
  19. 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
  20. package/dist/client/{ThreadsView-Dc3lr6Au.js → ThreadsView-yJpVmf42.js} +1 -1
  21. package/dist/client/{ToolsView-C-marn6m.js → ToolsView-DE1TDnlU.js} +1 -1
  22. package/dist/client/{UsersView-D4j8izbK.js → UsersView-BXDHjJLB.js} +1 -1
  23. package/dist/client/{VariablesView-d3lOE_O2.js → VariablesView-Bz-CbaEv.js} +1 -1
  24. package/dist/client/assets/index-V68N0r_5.css +1 -0
  25. package/dist/client/{index-DR9DbKrm.js → index-TIntu1KJ.js} +2 -2
  26. package/dist/client/index.html +2 -2
  27. package/dist/index.js +66 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/runtime.d.ts +29 -0
  30. package/dist/runtime.js +66 -3
  31. package/dist/runtime.js.map +1 -1
  32. package/package.json +5 -5
  33. package/dist/client/assets/index-_JaOWezk.css +0 -1
@@ -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-DR9DbKrm.js"></script>
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-_JaOWezk.css">
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++) {
@@ -9419,7 +9419,7 @@ ${lines.join("\n\n")}`
9419
9419
  const base64Data = match[2];
9420
9420
  const ext = mimeType.split("/")[1] || "png";
9421
9421
  const attachmentId = crypto.randomUUID();
9422
- const path20 = `/attachments/${Date.now()}-${attachmentId}.${ext}`;
9422
+ const path20 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
9423
9423
  try {
9424
9424
  await state.thread.instance.writeFile(path20, base64Data, mimeType);
9425
9425
  if (image.id) {
@@ -9489,7 +9489,7 @@ ${lines.join("\n\n")}`
9489
9489
  const base64Data = imageUrl.slice(base64Index + base64Marker.length);
9490
9490
  const ext = mimeType.split("/")[1] || "png";
9491
9491
  const attachmentId = crypto.randomUUID();
9492
- const path20 = `/attachments/${Date.now()}-${attachmentId}.${ext}`;
9492
+ const path20 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
9493
9493
  try {
9494
9494
  await state.thread.instance.writeFile(path20, base64Data, mimeType);
9495
9495
  const attachmentRef = {
@@ -26499,6 +26499,38 @@ ${resultContent}${attachmentSummary}`;
26499
26499
  throw error;
26500
26500
  }
26501
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
+ }
26502
26534
  /**
26503
26535
  * Get specific logs, optionally including all descendant logs.
26504
26536
  */
@@ -29891,6 +29923,37 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
29891
29923
  created_at: row.created_at
29892
29924
  };
29893
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
+ }
29894
29957
  /**
29895
29958
  * List threads with optional filtering.
29896
29959
  * Note: tenvs are not decrypted in list operations for performance.