@standardagents/builder 0.31.0 → 0.32.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 (37) hide show
  1. package/dist/built-in-routes.js +2 -1
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-wfApkZad.js → ApiKeysView-CxNw8yvZ.js} +1 -1
  4. package/dist/client/{CenteredContentView-JFIi6iAA.js → CenteredContentView-D4G91Thq.js} +1 -1
  5. package/dist/client/{CompositionView-CIm8Kt1I.js → CompositionView-BaWfyUW6.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-DO1fUxUR.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-CVzMoEOi.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-DfEFB4ze.js → CopyButton.vue_vue_type_script_setup_true_lang-Cz_ZrOAS.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-4XH4cxYM.js → DataTable.vue_vue_type_script_setup_true_lang-CQwcIXyb.js} +1 -1
  9. package/dist/client/{JsonViewer-md2l5DdY.js → JsonViewer-Dsl-e2IH.js} +1 -1
  10. package/dist/client/{LoginView-BJSfZpgw.js → LoginView-CX0lmKUS.js} +1 -1
  11. package/dist/client/{MarketplaceView-DXE7ys3s.js → MarketplaceView-BJAG7kej.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-FiL__HMg.js → Modal.vue_vue_type_script_setup_true_lang-B2Yd_pvh.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-BIBHjNB0.js → ModelModal.vue_vue_type_script_setup_true_lang-CCH8VxwI.js} +1 -1
  14. package/dist/client/{ModelsView-BhtR_WPG.js → ModelsView-CGgNBkY-.js} +1 -1
  15. package/dist/client/{PromptEditView-DadQ9eJ0.js → PromptEditView-CL2LEH80.js} +1 -1
  16. package/dist/client/{PromptModal-BMBKSmJC.js → PromptModal-DHHy53-v.js} +1 -1
  17. package/dist/client/{PromptsView-F1l2HocI.js → PromptsView-BcTfvJdH.js} +1 -1
  18. package/dist/client/{ProvidersView-DFWGCJwN.js → ProvidersView-B2yy_Kbe.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-C7JV15r3.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-BCiZyZu-.js} +13 -13
  20. package/dist/client/{ThreadsView-CMb05n9d.js → ThreadsView-BKSAJipV.js} +1 -1
  21. package/dist/client/{ToolsView-7F2ybb1x.js → ToolsView-DBkare-6.js} +1 -1
  22. package/dist/client/{UsersView-Badppc4K.js → UsersView-yBnliXIU.js} +1 -1
  23. package/dist/client/{VariablesView-E45rU9bc.js → VariablesView-N-VgGqPg.js} +1 -1
  24. package/dist/client/assets/{ThreadInspectorPane-Bha1aVZZ.css → ThreadInspectorPane-DSQsKyG6.css} +1 -1
  25. package/dist/client/{index-BYdncvi0.js → index-DANZMMwO.js} +2 -2
  26. package/dist/client/index.html +1 -1
  27. package/dist/{index-CL7q3PuW.d.ts → index-1AMgutkG.d.ts} +3 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +61 -17
  30. package/dist/index.js.map +1 -1
  31. package/dist/plugin.js +2 -0
  32. package/dist/plugin.js.map +1 -1
  33. package/dist/runtime.d.ts +5 -2
  34. package/dist/runtime.js +59 -17
  35. package/dist/runtime.js.map +1 -1
  36. package/dist/test.d.ts +1 -1
  37. package/package.json +5 -5
@@ -26,7 +26,7 @@
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-BYdncvi0.js"></script>
29
+ <script type="module" crossorigin src="/agents/index-DANZMMwO.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">
@@ -1419,6 +1419,8 @@ interface ThreadRegistryEntry {
1419
1419
  last_activity_at?: number | null;
1420
1420
  /** True while the thread is executing a flow (stale markers read as false). */
1421
1421
  executing?: boolean;
1422
+ /** Short excerpt of the most recent user message, for thread-list rows. */
1423
+ last_message_preview?: string | null;
1422
1424
  }
1423
1425
  /**
1424
1426
  * RPC methods exposed by DurableAgentBuilder for external callers.
@@ -1625,6 +1627,7 @@ interface DurableAgentBuilderRpc {
1625
1627
  /** Stamp thread activity / executing state for thread-list recency + status. */
1626
1628
  recordThreadActivity?(threadId: string, options?: {
1627
1629
  executing?: boolean;
1630
+ messagePreview?: string | null;
1628
1631
  }): Promise<void>;
1629
1632
  getThreadTreeIds?(threadId: string): Promise<string[]>;
1630
1633
  deleteThread(threadId: string): Promise<void>;
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-CL7q3PuW.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-1AMgutkG.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
@@ -14895,6 +14895,8 @@ declare module 'virtual:@standardagents/builder' {
14895
14895
  last_activity_at?: number | null;
14896
14896
  /** True while the thread is executing a flow. */
14897
14897
  executing?: boolean;
14898
+ /** Short excerpt of the most recent user message, for thread-list rows. */
14899
+ last_message_preview?: string | null;
14898
14900
  }
14899
14901
 
14900
14902
  export interface UpdateThreadParams {
@@ -26196,9 +26198,9 @@ var DurableThread = class _DurableThread extends DurableObject {
26196
26198
  * Each migration is run in order, starting from the current version + 1.
26197
26199
  */
26198
26200
  async runMigrations(fromVersion) {
26199
- for (const migration48 of migrations) {
26200
- if (migration48.version > fromVersion) {
26201
- await migration48.up(this.ctx.storage.sql);
26201
+ for (const migration49 of migrations) {
26202
+ if (migration49.version > fromVersion) {
26203
+ await migration49.up(this.ctx.storage.sql);
26202
26204
  }
26203
26205
  }
26204
26206
  }
@@ -29598,12 +29600,15 @@ ${resultContent}${attachmentSummary}`;
29598
29600
  * bookkeeping is presentation state: a failure here must never take down the
29599
29601
  * turn that triggered it.
29600
29602
  */
29601
- async recordRegistryActivity(threadId, executing) {
29603
+ async recordRegistryActivity(threadId, executing, messagePreview) {
29602
29604
  try {
29603
29605
  const namespace = this.env.AGENT_BUILDER;
29604
29606
  if (!namespace || typeof namespace.idFromName !== "function") return;
29605
29607
  const agentBuilder = namespace.get(namespace.idFromName("singleton"));
29606
- await agentBuilder.recordThreadActivity?.(threadId, { executing });
29608
+ await agentBuilder.recordThreadActivity?.(threadId, {
29609
+ executing,
29610
+ ...messagePreview !== void 0 ? { messagePreview } : {}
29611
+ });
29607
29612
  } catch (error) {
29608
29613
  console.error(
29609
29614
  "[DurableThread] Failed to record thread activity (non-fatal):",
@@ -30194,7 +30199,11 @@ Its execution was lost (the executor restarted or hung) and automatic recovery w
30194
30199
  this.isExecuting = true;
30195
30200
  this.currentAbortController = new AbortController();
30196
30201
  await this.armExecutionWatchdog(threadId);
30197
- await this.recordRegistryActivity(threadId, true);
30202
+ await this.recordRegistryActivity(
30203
+ threadId,
30204
+ true,
30205
+ role === "user" ? content : void 0
30206
+ );
30198
30207
  try {
30199
30208
  const agentBuilderId = this.env.AGENT_BUILDER.idFromName("singleton");
30200
30209
  const agentBuilder = this.env.AGENT_BUILDER.get(agentBuilderId);
@@ -31572,9 +31581,27 @@ var migration47 = {
31572
31581
  }
31573
31582
  };
31574
31583
 
31584
+ // src/durable-objects/agentbuilder-migrations/0014_thread_activity_scale.ts
31585
+ var migration48 = {
31586
+ version: 14,
31587
+ async up(sql) {
31588
+ sql.exec(`ALTER TABLE threads ADD COLUMN last_message_preview TEXT`);
31589
+ sql.exec(
31590
+ `CREATE INDEX IF NOT EXISTS idx_threads_executing_since
31591
+ ON threads(executing_since) WHERE executing_since IS NOT NULL`
31592
+ );
31593
+ sql.exec(
31594
+ `UPDATE threads SET last_activity_at = created_at WHERE last_activity_at IS NULL`
31595
+ );
31596
+ sql.exec(`
31597
+ INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '14')
31598
+ `);
31599
+ }
31600
+ };
31601
+
31575
31602
  // src/durable-objects/agentbuilder-migrations/index.ts
31576
- var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47];
31577
- var LATEST_SCHEMA_VERSION2 = 13;
31603
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48];
31604
+ var LATEST_SCHEMA_VERSION2 = 14;
31578
31605
 
31579
31606
  // src/utils/crypto.ts
31580
31607
  var CryptoUtil = class {
@@ -31774,6 +31801,12 @@ function parseStoredPermissions(value) {
31774
31801
  }
31775
31802
  }
31776
31803
  var EXECUTING_STALE_AFTER_SECONDS = 15 * 60;
31804
+ var THREAD_PREVIEW_MAX_CHARS = 140;
31805
+ var buildThreadPreview = (content) => {
31806
+ const collapsed = content.replace(/\s+/g, " ").trim();
31807
+ if (!collapsed) return null;
31808
+ return collapsed.length > THREAD_PREVIEW_MAX_CHARS ? `${collapsed.slice(0, THREAD_PREVIEW_MAX_CHARS - 1)}\u2026` : collapsed;
31809
+ };
31777
31810
  var isThreadExecuting = (executingSince, nowSeconds) => executingSince != null && nowSeconds - executingSince < EXECUTING_STALE_AFTER_SECONDS;
31778
31811
  var DurableAgentBuilder = class extends DurableObject {
31779
31812
  migratedToVersion = null;
@@ -32343,9 +32376,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32343
32376
  }
32344
32377
  }
32345
32378
  async runMigrations(fromVersion) {
32346
- for (const migration48 of migrations2) {
32347
- if (migration48.version > fromVersion) {
32348
- await migration48.up(this.ctx.storage.sql);
32379
+ for (const migration49 of migrations2) {
32380
+ if (migration49.version > fromVersion) {
32381
+ await migration49.up(this.ctx.storage.sql);
32349
32382
  }
32350
32383
  }
32351
32384
  }
@@ -32470,7 +32503,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32470
32503
  async getThread(id) {
32471
32504
  await this.ensureMigrated();
32472
32505
  const cursor = await this.ctx.storage.sql.exec(
32473
- `SELECT id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at, executing_since FROM threads WHERE id = ?`,
32506
+ `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 = ?`,
32474
32507
  id
32475
32508
  );
32476
32509
  const rows = cursor.toArray();
@@ -32497,7 +32530,8 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32497
32530
  executing: isThreadExecuting(
32498
32531
  row.executing_since,
32499
32532
  Math.floor(Date.now() / 1e3)
32500
- )
32533
+ ),
32534
+ last_message_preview: row.last_message_preview
32501
32535
  };
32502
32536
  }
32503
32537
  /**
@@ -32594,9 +32628,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32594
32628
  const total = countCursor.one().count;
32595
32629
  const limit = params?.limit ?? 100;
32596
32630
  const offset = params?.offset ?? 0;
32597
- const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "COALESCE(last_activity_at, created_at) DESC, created_at DESC";
32631
+ const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
32598
32632
  const cursor = await this.ctx.storage.sql.exec(
32599
- `SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since FROM threads
32633
+ `SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads
32600
32634
  ${whereClause}
32601
32635
  ORDER BY ${orderByClause}
32602
32636
  LIMIT ? OFFSET ?`,
@@ -32620,7 +32654,8 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32620
32654
  terminated: row.terminated,
32621
32655
  created_at: row.created_at,
32622
32656
  last_activity_at: row.last_activity_at ?? row.created_at,
32623
- executing: isThreadExecuting(row.executing_since, nowSeconds)
32657
+ executing: isThreadExecuting(row.executing_since, nowSeconds),
32658
+ last_message_preview: row.last_message_preview
32624
32659
  }));
32625
32660
  return { threads, total };
32626
32661
  }
@@ -32659,6 +32694,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32659
32694
  await this.ensureMigrated();
32660
32695
  const now = Math.floor(Date.now() / 1e3);
32661
32696
  const executing = options?.executing;
32697
+ const preview = typeof options?.messagePreview === "string" ? buildThreadPreview(options.messagePreview) : void 0;
32662
32698
  await this.ctx.storage.sql.exec(
32663
32699
  `UPDATE threads
32664
32700
  SET last_activity_at = ?
@@ -32685,11 +32721,19 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32685
32721
  threadId
32686
32722
  );
32687
32723
  }
32724
+ if (preview !== void 0) {
32725
+ await this.ctx.storage.sql.exec(
32726
+ `UPDATE threads SET last_message_preview = ? WHERE id = ?`,
32727
+ preview,
32728
+ threadId
32729
+ );
32730
+ }
32688
32731
  this.broadcastEvent({
32689
32732
  type: "thread_activity",
32690
32733
  threadId,
32691
32734
  last_activity_at: now,
32692
- executing: executing === true
32735
+ executing: executing === true,
32736
+ ...preview !== void 0 ? { last_message_preview: preview } : {}
32693
32737
  });
32694
32738
  }
32695
32739
  /**