@standardagents/builder 0.34.0 → 0.35.1

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 (41) hide show
  1. package/dist/built-in-routes.js +490 -1
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-Bv8qoGeD.js → ApiKeysView-Dmq8ljTo.js} +1 -1
  4. package/dist/client/{CenteredContentView-BVJCN57C.js → CenteredContentView-DM7LkIKF.js} +1 -1
  5. package/dist/client/CompositionView-CCW3XCKA.js +32 -0
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-nQMuZPnp.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-Cfo-jqEF.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-DK7RbS4C.js → CopyButton.vue_vue_type_script_setup_true_lang-C5aCLIhv.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-Bxbhd23r.js → DataTable.vue_vue_type_script_setup_true_lang-deYaXdha.js} +1 -1
  9. package/dist/client/{JsonViewer-UqksKmyo.js → JsonViewer-BCNJYUIz.js} +1 -1
  10. package/dist/client/{LoginView-D2kAR5Tu.js → LoginView-BHA2IKoE.js} +1 -1
  11. package/dist/client/{MarketplaceView-SIE1hoDP.js → MarketplaceView-BaYCbQeY.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-jYwcc2L_.js → Modal.vue_vue_type_script_setup_true_lang-B1DUndvK.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-C3ZjIJtP.js → ModelModal.vue_vue_type_script_setup_true_lang-BWl1Kknp.js} +1 -1
  14. package/dist/client/{ModelsView-BpR8UKW2.js → ModelsView-CapeJwZE.js} +1 -1
  15. package/dist/client/{PromptEditView-DIavw2J0.js → PromptEditView-DhGDru6i.js} +1 -1
  16. package/dist/client/{PromptModal-Dg39Yq2j.js → PromptModal-Dy7ZLTrD.js} +1 -1
  17. package/dist/client/{PromptsView-Ba1UL0TN.js → PromptsView-DzyP3URp.js} +1 -1
  18. package/dist/client/{ProvidersView-cMELUEfj.js → ProvidersView-CEM2pkVl.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-DANY3J0L.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-TEAPHb0Y.js} +5 -5
  20. package/dist/client/{ThreadsView-BldKUFh8.js → ThreadsView-DeQ1mZp6.js} +1 -1
  21. package/dist/client/{ToolsView-ug4WlvVe.js → ToolsView--_ivoaJq.js} +1 -1
  22. package/dist/client/{UsersView-Dcs0DUTh.js → UsersView-CHVGj7RB.js} +1 -1
  23. package/dist/client/{VariablesView-DyIy7q3P.js → VariablesView-Ey6egYHo.js} +1 -1
  24. package/dist/client/assets/{CompositionView-CWFus-Gl.css → CompositionView-eTR5Ewx2.css} +1 -1
  25. package/dist/client/assets/{ThreadInspectorPane-B2xKm6jM.css → ThreadInspectorPane-B9HsKfCN.css} +1 -1
  26. package/dist/client/assets/{index-DBe2myN2.css → index-CPBDhUF1.css} +1 -1
  27. package/dist/client/index-oR3Tbjo6.js +6 -0
  28. package/dist/client/index.html +2 -2
  29. package/dist/{index-NmFt-OEl.d.ts → index-D7luZUMB.d.ts} +2 -0
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +52 -16
  32. package/dist/index.js.map +1 -1
  33. package/dist/plugin.js +2 -0
  34. package/dist/plugin.js.map +1 -1
  35. package/dist/runtime.d.ts +20 -2
  36. package/dist/runtime.js +50 -16
  37. package/dist/runtime.js.map +1 -1
  38. package/dist/test.d.ts +1 -1
  39. package/package.json +5 -5
  40. package/dist/client/CompositionView-XRs1hJPR.js +0 -32
  41. package/dist/client/index-C8NBza63.js +0 -6
@@ -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-C8NBza63.js"></script>
29
+ <script type="module" crossorigin src="/agents/index-oR3Tbjo6.js"></script>
30
30
  <link rel="modulepreload" crossorigin href="/agents/formkit-DcZQH9-p.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-KXHVRwln.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-DBe2myN2.css">
36
+ <link rel="stylesheet" crossorigin href="/agents/assets/index-CPBDhUF1.css">
37
37
  </head>
38
38
  <body>
39
39
  <div id="app"></div>
@@ -1408,6 +1408,8 @@ interface DurableUserHubRpc {
1408
1408
  interface ThreadRegistryEntry {
1409
1409
  id: string;
1410
1410
  agent_name: string;
1411
+ /** Agent the thread was created on — never changed by handoffs. */
1412
+ origin_agent_name?: string | null;
1411
1413
  user_id: string | null;
1412
1414
  tags: string[] | null;
1413
1415
  env?: Record<string, string> | null;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ModelDefinition, AgentDefinition } from './runtime.js';
2
2
  export { AgentBuilderEnv, AuthContext, AuthUser, BroadcastOptions, CodeExecutionBridge, DurableAgentBuilder, DurableThread, DurableUserHub, FlowStateSdk, FlowStateWithSdk, HubClientInfo, ImageContextConfig, InjectMessageOptions, LLMProviderInterface, NamespaceResolutionError, PromptContent, PromptDefinition, PromptIncludePart, PromptPart, PromptToolConfig, Provider, ProviderContentPart, ProviderFilePart, ProviderImagePart, ProviderRegistry, ProviderTextPart, SessionToolBinding, SessionToolConfig, SideConfig, SubagentToolConfig, SubpromptConfig, ThreadRegistryEntry, ThreadWatchdog, ThreadWatchdogState, ToolConfig, UpdateThreadParams, User, WatchdogCheckin, WatchdogProbeResult, authenticate, buildImageDescription, cat, createNamespaceContext, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateImageDescription, getFileStats, getMessages, getMessagesToSummarize, getShortName, getThumbnail, getUnsummarizedImageAttachments, getVisibleAgentNames, getVisibleModelNames, getVisiblePromptNames, getVisibleToolNames, grep, hasImageAttachments, head, injectMessage, isQualifiedName, linkFile, mkdir, move, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, rename, replaceImagesWithDescriptions, requireAdmin, requireAuth, resolveAgent, resolveHook, resolveModel, resolvePrompt, resolveTool, rmdir, stat, tail, unlink, updateThread, writeFile, writeImage } from './runtime.js';
3
3
  export { AgentPluginOptions, agentbuilder, builder } from './plugin.js';
4
- export { A as Agent, x as AttachmentRef, f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, m as ClientStreamRequest, n as ClientStreamResponse, k as ClientToolRequest, l as ClientToolResponse, B as Controller, a as ControllerContext, E as Env, w as FileRecord, y as FileStats, u as FlowResult, F as FlowState, G as GrepResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, J as MessageContent, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, e as ThreadEnv, q as ThreadInstance, r as ThreadMetadata, T as ToolCall, t as ToolResult, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-NmFt-OEl.js';
4
+ export { A as Agent, x as AttachmentRef, f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, m as ClientStreamRequest, n as ClientStreamResponse, k as ClientToolRequest, l as ClientToolResponse, B as Controller, a as ControllerContext, E as Env, w as FileRecord, y as FileStats, u as FlowResult, F as FlowState, G as GrepResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, J as MessageContent, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, e as ThreadEnv, q as ThreadInstance, r as ThreadMetadata, T as ToolCall, t as ToolResult, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-D7luZUMB.js';
5
5
  export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, 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, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineProvider, defineTool, 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, c as UnpackOptions, d as UnpackResult } from './types-Bpe7IANZ.js';
7
7
  export { D as DiscoveryConfig, P as PackageDiscoveryService, d as discoverPackages } from './discovery-DiMJWisl.js';
package/dist/index.js CHANGED
@@ -14891,6 +14891,8 @@ declare module 'virtual:@standardagents/builder' {
14891
14891
  export interface ThreadRegistryEntry {
14892
14892
  id: string;
14893
14893
  agent_name: string;
14894
+ /** Agent the thread was created on \u2014 never changed by handoffs. */
14895
+ origin_agent_name?: string | null;
14894
14896
  user_id: string | null;
14895
14897
  tags: string[] | null;
14896
14898
  env?: Record<string, string> | null;
@@ -26210,9 +26212,9 @@ var DurableThread = class _DurableThread extends DurableObject {
26210
26212
  * Each migration is run in order, starting from the current version + 1.
26211
26213
  */
26212
26214
  async runMigrations(fromVersion) {
26213
- for (const migration50 of migrations) {
26214
- if (migration50.version > fromVersion) {
26215
- await migration50.up(this.ctx.storage.sql);
26215
+ for (const migration51 of migrations) {
26216
+ if (migration51.version > fromVersion) {
26217
+ await migration51.up(this.ctx.storage.sql);
26216
26218
  }
26217
26219
  }
26218
26220
  }
@@ -31646,9 +31648,27 @@ var migration49 = {
31646
31648
  }
31647
31649
  };
31648
31650
 
31651
+ // src/durable-objects/agentbuilder-migrations/0016_add_origin_agent.ts
31652
+ var migration50 = {
31653
+ version: 16,
31654
+ async up(sql) {
31655
+ sql.exec(`ALTER TABLE threads ADD COLUMN origin_agent_name TEXT`);
31656
+ sql.exec(
31657
+ `CREATE INDEX IF NOT EXISTS idx_threads_origin_agent_name ON threads(origin_agent_name)`
31658
+ );
31659
+ sql.exec(`UPDATE threads SET origin_agent_name = agent_name`);
31660
+ sql.exec(`
31661
+ INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '16')
31662
+ `);
31663
+ }
31664
+ };
31665
+
31649
31666
  // src/durable-objects/agentbuilder-migrations/index.ts
31650
- var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49];
31651
- var LATEST_SCHEMA_VERSION2 = 15;
31667
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49, migration50];
31668
+ var LATEST_SCHEMA_VERSION2 = migrations2.reduce(
31669
+ (max, migration51) => Math.max(max, migration51.version),
31670
+ 0
31671
+ );
31652
31672
 
31653
31673
  // src/utils/crypto.ts
31654
31674
  var CryptoUtil = class {
@@ -32424,9 +32444,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32424
32444
  }
32425
32445
  }
32426
32446
  async runMigrations(fromVersion) {
32427
- for (const migration50 of migrations2) {
32428
- if (migration50.version > fromVersion) {
32429
- await migration50.up(this.ctx.storage.sql);
32447
+ for (const migration51 of migrations2) {
32448
+ if (migration51.version > fromVersion) {
32449
+ await migration51.up(this.ctx.storage.sql);
32430
32450
  }
32431
32451
  }
32432
32452
  }
@@ -32468,10 +32488,11 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32468
32488
  const encryptedEnv = await this.encryptEnvRecord(env);
32469
32489
  const properties = this.withEnvTypeRecord(params.properties ?? null, envTypes);
32470
32490
  await this.ctx.storage.sql.exec(
32471
- `INSERT INTO threads (id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
32472
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
32491
+ `INSERT INTO threads (id, agent_name, origin_agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
32492
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
32473
32493
  id,
32474
32494
  params.agent_name,
32495
+ params.agent_name,
32475
32496
  params.user_id || null,
32476
32497
  params.tags ? JSON.stringify(params.tags) : null,
32477
32498
  encryptedEnv,
@@ -32484,6 +32505,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32484
32505
  const thread = {
32485
32506
  id,
32486
32507
  agent_name: params.agent_name,
32508
+ origin_agent_name: params.agent_name,
32487
32509
  user_id: params.user_id || null,
32488
32510
  tags: params.tags || null,
32489
32511
  env,
@@ -32551,7 +32573,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32551
32573
  async getThread(id) {
32552
32574
  await this.ensureMigrated();
32553
32575
  const cursor = await this.ctx.storage.sql.exec(
32554
- `SELECT id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads WHERE id = ?`,
32576
+ `SELECT id, agent_name, origin_agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads WHERE id = ?`,
32555
32577
  id
32556
32578
  );
32557
32579
  const rows = cursor.toArray();
@@ -32565,6 +32587,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32565
32587
  return {
32566
32588
  id: row.id,
32567
32589
  agent_name: row.agent_name,
32590
+ origin_agent_name: row.origin_agent_name,
32568
32591
  user_id: row.user_id,
32569
32592
  tags: row.tags ? JSON.parse(row.tags) : null,
32570
32593
  env,
@@ -32627,16 +32650,16 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32627
32650
  if (params.include_children) {
32628
32651
  whereClauses.push(`id IN (
32629
32652
  WITH RECURSIVE descendants(id) AS (
32630
- SELECT id FROM threads WHERE agent_name = ?
32653
+ SELECT id FROM threads WHERE agent_name = ? OR origin_agent_name = ?
32631
32654
  UNION ALL
32632
32655
  SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
32633
32656
  )
32634
32657
  SELECT id FROM descendants
32635
32658
  )`);
32636
- args.push(params.agent_name);
32659
+ args.push(params.agent_name, params.agent_name);
32637
32660
  } else {
32638
- whereClauses.push("agent_name = ?");
32639
- args.push(params.agent_name);
32661
+ whereClauses.push("(agent_name = ? OR origin_agent_name = ?)");
32662
+ args.push(params.agent_name, params.agent_name);
32640
32663
  }
32641
32664
  }
32642
32665
  if (params?.user_id) {
@@ -32678,7 +32701,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32678
32701
  const offset = params?.offset ?? 0;
32679
32702
  const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
32680
32703
  const cursor = await this.ctx.storage.sql.exec(
32681
- `SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads
32704
+ `SELECT id, agent_name, origin_agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads
32682
32705
  ${whereClause}
32683
32706
  ORDER BY ${orderByClause}
32684
32707
  LIMIT ? OFFSET ?`,
@@ -32689,6 +32712,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32689
32712
  const threads = cursor.toArray().map((row) => ({
32690
32713
  id: row.id,
32691
32714
  agent_name: row.agent_name,
32715
+ origin_agent_name: row.origin_agent_name,
32692
32716
  user_id: row.user_id,
32693
32717
  tags: row.tags ? JSON.parse(row.tags) : null,
32694
32718
  env: null,
@@ -32856,6 +32880,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32856
32880
  }
32857
32881
  /**
32858
32882
  * Update a thread's agent_name (used during agent handoff).
32883
+ * origin_agent_name is deliberately untouched — it pins the thread to the
32884
+ * agent page it started on. Broadcasts thread_updated so connected clients
32885
+ * re-render the row immediately instead of on the next activity tick
32886
+ * (which is when handed-off threads used to silently vanish mid-watch).
32859
32887
  */
32860
32888
  async updateThreadAgent(id, agent_name) {
32861
32889
  await this.ensureMigrated();
@@ -32864,6 +32892,14 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32864
32892
  agent_name,
32865
32893
  id
32866
32894
  );
32895
+ try {
32896
+ const updated = await this.getThread(id);
32897
+ if (updated) {
32898
+ const eventThread = await this.toThreadEventPayload(updated);
32899
+ this.broadcastEvent({ type: "thread_updated", thread: eventThread });
32900
+ }
32901
+ } catch {
32902
+ }
32867
32903
  return true;
32868
32904
  }
32869
32905
  /**