@standardagents/builder 0.34.0 → 0.35.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 (41) hide show
  1. package/dist/built-in-routes.js +5 -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 +48 -15
  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 +46 -15
  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,8 +31648,23 @@ 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];
31667
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49, migration50];
31651
31668
  var LATEST_SCHEMA_VERSION2 = 15;
31652
31669
 
31653
31670
  // src/utils/crypto.ts
@@ -32424,9 +32441,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32424
32441
  }
32425
32442
  }
32426
32443
  async runMigrations(fromVersion) {
32427
- for (const migration50 of migrations2) {
32428
- if (migration50.version > fromVersion) {
32429
- await migration50.up(this.ctx.storage.sql);
32444
+ for (const migration51 of migrations2) {
32445
+ if (migration51.version > fromVersion) {
32446
+ await migration51.up(this.ctx.storage.sql);
32430
32447
  }
32431
32448
  }
32432
32449
  }
@@ -32468,10 +32485,11 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32468
32485
  const encryptedEnv = await this.encryptEnvRecord(env);
32469
32486
  const properties = this.withEnvTypeRecord(params.properties ?? null, envTypes);
32470
32487
  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, ?, ?)`,
32488
+ `INSERT INTO threads (id, agent_name, origin_agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
32489
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
32473
32490
  id,
32474
32491
  params.agent_name,
32492
+ params.agent_name,
32475
32493
  params.user_id || null,
32476
32494
  params.tags ? JSON.stringify(params.tags) : null,
32477
32495
  encryptedEnv,
@@ -32484,6 +32502,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32484
32502
  const thread = {
32485
32503
  id,
32486
32504
  agent_name: params.agent_name,
32505
+ origin_agent_name: params.agent_name,
32487
32506
  user_id: params.user_id || null,
32488
32507
  tags: params.tags || null,
32489
32508
  env,
@@ -32551,7 +32570,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32551
32570
  async getThread(id) {
32552
32571
  await this.ensureMigrated();
32553
32572
  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 = ?`,
32573
+ `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
32574
  id
32556
32575
  );
32557
32576
  const rows = cursor.toArray();
@@ -32565,6 +32584,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32565
32584
  return {
32566
32585
  id: row.id,
32567
32586
  agent_name: row.agent_name,
32587
+ origin_agent_name: row.origin_agent_name,
32568
32588
  user_id: row.user_id,
32569
32589
  tags: row.tags ? JSON.parse(row.tags) : null,
32570
32590
  env,
@@ -32627,16 +32647,16 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32627
32647
  if (params.include_children) {
32628
32648
  whereClauses.push(`id IN (
32629
32649
  WITH RECURSIVE descendants(id) AS (
32630
- SELECT id FROM threads WHERE agent_name = ?
32650
+ SELECT id FROM threads WHERE agent_name = ? OR origin_agent_name = ?
32631
32651
  UNION ALL
32632
32652
  SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
32633
32653
  )
32634
32654
  SELECT id FROM descendants
32635
32655
  )`);
32636
- args.push(params.agent_name);
32656
+ args.push(params.agent_name, params.agent_name);
32637
32657
  } else {
32638
- whereClauses.push("agent_name = ?");
32639
- args.push(params.agent_name);
32658
+ whereClauses.push("(agent_name = ? OR origin_agent_name = ?)");
32659
+ args.push(params.agent_name, params.agent_name);
32640
32660
  }
32641
32661
  }
32642
32662
  if (params?.user_id) {
@@ -32678,7 +32698,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32678
32698
  const offset = params?.offset ?? 0;
32679
32699
  const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
32680
32700
  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
32701
+ `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
32702
  ${whereClause}
32683
32703
  ORDER BY ${orderByClause}
32684
32704
  LIMIT ? OFFSET ?`,
@@ -32689,6 +32709,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32689
32709
  const threads = cursor.toArray().map((row) => ({
32690
32710
  id: row.id,
32691
32711
  agent_name: row.agent_name,
32712
+ origin_agent_name: row.origin_agent_name,
32692
32713
  user_id: row.user_id,
32693
32714
  tags: row.tags ? JSON.parse(row.tags) : null,
32694
32715
  env: null,
@@ -32856,6 +32877,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32856
32877
  }
32857
32878
  /**
32858
32879
  * Update a thread's agent_name (used during agent handoff).
32880
+ * origin_agent_name is deliberately untouched — it pins the thread to the
32881
+ * agent page it started on. Broadcasts thread_updated so connected clients
32882
+ * re-render the row immediately instead of on the next activity tick
32883
+ * (which is when handed-off threads used to silently vanish mid-watch).
32859
32884
  */
32860
32885
  async updateThreadAgent(id, agent_name) {
32861
32886
  await this.ensureMigrated();
@@ -32864,6 +32889,14 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32864
32889
  agent_name,
32865
32890
  id
32866
32891
  );
32892
+ try {
32893
+ const updated = await this.getThread(id);
32894
+ if (updated) {
32895
+ const eventThread = await this.toThreadEventPayload(updated);
32896
+ this.broadcastEvent({ type: "thread_updated", thread: eventThread });
32897
+ }
32898
+ } catch {
32899
+ }
32867
32900
  return true;
32868
32901
  }
32869
32902
  /**