@standardagents/builder 0.32.0 → 0.33.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 (38) hide show
  1. package/dist/built-in-routes.js +41 -7
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-CxNw8yvZ.js → ApiKeysView-Bv8qoGeD.js} +1 -1
  4. package/dist/client/{CenteredContentView-D4G91Thq.js → CenteredContentView-BVJCN57C.js} +1 -1
  5. package/dist/client/{CompositionView-BaWfyUW6.js → CompositionView-XRs1hJPR.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-CVzMoEOi.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-nQMuZPnp.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-Cz_ZrOAS.js → CopyButton.vue_vue_type_script_setup_true_lang-DK7RbS4C.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-CQwcIXyb.js → DataTable.vue_vue_type_script_setup_true_lang-Bxbhd23r.js} +1 -1
  9. package/dist/client/{JsonViewer-Dsl-e2IH.js → JsonViewer-UqksKmyo.js} +1 -1
  10. package/dist/client/{LoginView-CX0lmKUS.js → LoginView-D2kAR5Tu.js} +1 -1
  11. package/dist/client/{MarketplaceView-BJAG7kej.js → MarketplaceView-SIE1hoDP.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-B2Yd_pvh.js → Modal.vue_vue_type_script_setup_true_lang-jYwcc2L_.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-CCH8VxwI.js → ModelModal.vue_vue_type_script_setup_true_lang-C3ZjIJtP.js} +1 -1
  14. package/dist/client/{ModelsView-CGgNBkY-.js → ModelsView-BpR8UKW2.js} +1 -1
  15. package/dist/client/{PromptEditView-CL2LEH80.js → PromptEditView-DIavw2J0.js} +1 -1
  16. package/dist/client/{PromptModal-DHHy53-v.js → PromptModal-Dg39Yq2j.js} +1 -1
  17. package/dist/client/{PromptsView-BcTfvJdH.js → PromptsView-Ba1UL0TN.js} +1 -1
  18. package/dist/client/{ProvidersView-B2yy_Kbe.js → ProvidersView-cMELUEfj.js} +1 -1
  19. package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-DANY3J0L.js +22 -0
  20. package/dist/client/{ThreadsView-BKSAJipV.js → ThreadsView-BldKUFh8.js} +1 -1
  21. package/dist/client/{ToolsView-DBkare-6.js → ToolsView-ug4WlvVe.js} +1 -1
  22. package/dist/client/{UsersView-yBnliXIU.js → UsersView-Dcs0DUTh.js} +1 -1
  23. package/dist/client/{VariablesView-N-VgGqPg.js → VariablesView-DyIy7q3P.js} +1 -1
  24. package/dist/client/assets/{ThreadInspectorPane-DSQsKyG6.css → ThreadInspectorPane-B2xKm6jM.css} +1 -1
  25. package/dist/client/assets/index-DBe2myN2.css +1 -0
  26. package/dist/client/{index-DANZMMwO.js → index-C8NBza63.js} +2 -2
  27. package/dist/client/index.html +2 -2
  28. package/dist/{index-1AMgutkG.d.ts → index-CqhPhqAI.d.ts} +7 -0
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +68 -9
  31. package/dist/index.js.map +1 -1
  32. package/dist/runtime.d.ts +20 -2
  33. package/dist/runtime.js +68 -9
  34. package/dist/runtime.js.map +1 -1
  35. package/dist/test.d.ts +1 -1
  36. package/package.json +5 -5
  37. package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang-BCiZyZu-.js +0 -22
  38. package/dist/client/assets/index-C4KCxdCv.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-DANZMMwO.js"></script>
29
+ <script type="module" crossorigin src="/agents/index-C8NBza63.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-C4KCxdCv.css">
36
+ <link rel="stylesheet" crossorigin href="/agents/assets/index-DBe2myN2.css">
37
37
  </head>
38
38
  <body>
39
39
  <div id="app"></div>
@@ -1234,6 +1234,8 @@ interface LogDetails {
1234
1234
  */
1235
1235
  interface DurableThreadRpc {
1236
1236
  stop(): Promise<Response>;
1237
+ /** Newest non-empty user message on the thread, for thread-list previews. */
1238
+ getLatestUserMessagePreview(): Promise<string | null>;
1237
1239
  executeBlocking?(threadId: string, agentId: string, initial_messages?: unknown[], data?: unknown): Promise<{
1238
1240
  status: "success" | "error";
1239
1241
  result?: string;
@@ -1624,6 +1626,11 @@ interface DurableAgentBuilderRpc {
1624
1626
  email: string | null;
1625
1627
  thread_count: number;
1626
1628
  }>>;
1629
+ /** Fill previews for threads that predate preview tracking (bulk, idempotent). */
1630
+ backfillThreadPreviews?(entries: Array<{
1631
+ id: string;
1632
+ preview: string | null;
1633
+ }>): Promise<void>;
1627
1634
  /** Stamp thread activity / executing state for thread-list recency + status. */
1628
1635
  recordThreadActivity?(threadId: string, options?: {
1629
1636
  executing?: boolean;
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-1AMgutkG.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-CqhPhqAI.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
@@ -26011,6 +26011,9 @@ var DurableThread = class _DurableThread extends DurableObject {
26011
26011
  if (await this.hasPendingTurnAlarm()) {
26012
26012
  return;
26013
26013
  }
26014
+ if (await this.shouldStop()) {
26015
+ return;
26016
+ }
26014
26017
  await this.alarmQueue.enqueue("continueExecution", { threadId, side }, 1);
26015
26018
  }
26016
26019
  async ensureRootMessageId(existingRootMessageId) {
@@ -26198,9 +26201,9 @@ var DurableThread = class _DurableThread extends DurableObject {
26198
26201
  * Each migration is run in order, starting from the current version + 1.
26199
26202
  */
26200
26203
  async runMigrations(fromVersion) {
26201
- for (const migration49 of migrations) {
26202
- if (migration49.version > fromVersion) {
26203
- await migration49.up(this.ctx.storage.sql);
26204
+ for (const migration50 of migrations) {
26205
+ if (migration50.version > fromVersion) {
26206
+ await migration50.up(this.ctx.storage.sql);
26204
26207
  }
26205
26208
  }
26206
26209
  }
@@ -29616,6 +29619,27 @@ ${resultContent}${attachmentSummary}`;
29616
29619
  );
29617
29620
  }
29618
29621
  }
29622
+ /**
29623
+ * The newest non-empty user message on this thread, for thread-list previews.
29624
+ * Returns null when the thread has none. The Durable Object does not know its
29625
+ * own thread id, so the caller is the one that stamps the registry.
29626
+ */
29627
+ async getLatestUserMessagePreview() {
29628
+ await this.ensureMigrated();
29629
+ try {
29630
+ const rows = this.ctx.storage.sql.exec(
29631
+ `SELECT content FROM messages
29632
+ WHERE role = 'user'
29633
+ AND content IS NOT NULL AND content != ''
29634
+ AND subagent_id IS NULL
29635
+ AND (silent IS NULL OR silent = 0)
29636
+ ORDER BY created_at DESC LIMIT 1`
29637
+ ).toArray();
29638
+ return rows[0]?.content ?? null;
29639
+ } catch {
29640
+ return null;
29641
+ }
29642
+ }
29619
29643
  /** Arm the standing watchdog for an execution start. One pending row max. */
29620
29644
  async armExecutionWatchdog(threadId) {
29621
29645
  try {
@@ -31599,9 +31623,23 @@ var migration48 = {
31599
31623
  }
31600
31624
  };
31601
31625
 
31626
+ // src/durable-objects/agentbuilder-migrations/0015_clear_envelope_previews.ts
31627
+ var migration49 = {
31628
+ version: 15,
31629
+ async up(sql) {
31630
+ sql.exec(
31631
+ `UPDATE threads SET last_message_preview = NULL
31632
+ WHERE last_message_preview LIKE 'Subagent (reference: %'`
31633
+ );
31634
+ sql.exec(`
31635
+ INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '15')
31636
+ `);
31637
+ }
31638
+ };
31639
+
31602
31640
  // src/durable-objects/agentbuilder-migrations/index.ts
31603
- var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48];
31604
- var LATEST_SCHEMA_VERSION2 = 14;
31641
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49];
31642
+ var LATEST_SCHEMA_VERSION2 = 15;
31605
31643
 
31606
31644
  // src/utils/crypto.ts
31607
31645
  var CryptoUtil = class {
@@ -31802,6 +31840,7 @@ function parseStoredPermissions(value) {
31802
31840
  }
31803
31841
  var EXECUTING_STALE_AFTER_SECONDS = 15 * 60;
31804
31842
  var THREAD_PREVIEW_MAX_CHARS = 140;
31843
+ var isRuntimeSubagentEnvelope = (content) => /^Subagent \(reference: /.test(content.trimStart());
31805
31844
  var buildThreadPreview = (content) => {
31806
31845
  const collapsed = content.replace(/\s+/g, " ").trim();
31807
31846
  if (!collapsed) return null;
@@ -32376,9 +32415,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32376
32415
  }
32377
32416
  }
32378
32417
  async runMigrations(fromVersion) {
32379
- for (const migration49 of migrations2) {
32380
- if (migration49.version > fromVersion) {
32381
- await migration49.up(this.ctx.storage.sql);
32418
+ for (const migration50 of migrations2) {
32419
+ if (migration50.version > fromVersion) {
32420
+ await migration50.up(this.ctx.storage.sql);
32382
32421
  }
32383
32422
  }
32384
32423
  }
@@ -32694,7 +32733,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32694
32733
  await this.ensureMigrated();
32695
32734
  const now = Math.floor(Date.now() / 1e3);
32696
32735
  const executing = options?.executing;
32697
- const preview = typeof options?.messagePreview === "string" ? buildThreadPreview(options.messagePreview) : void 0;
32736
+ const preview = typeof options?.messagePreview === "string" && !isRuntimeSubagentEnvelope(options.messagePreview) ? buildThreadPreview(options.messagePreview) : void 0;
32698
32737
  await this.ctx.storage.sql.exec(
32699
32738
  `UPDATE threads
32700
32739
  SET last_activity_at = ?
@@ -32736,6 +32775,26 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
32736
32775
  ...preview !== void 0 ? { last_message_preview: preview } : {}
32737
32776
  });
32738
32777
  }
32778
+ /**
32779
+ * Fill in previews for threads that predate preview tracking. Callers read
32780
+ * each thread's newest user message and stamp the results here in one batch.
32781
+ *
32782
+ * A thread with no user message is stamped with an empty string rather than
32783
+ * left NULL: NULL means "not looked at yet", so without the sentinel an
32784
+ * empty thread would be re-read on every list request forever.
32785
+ */
32786
+ async backfillThreadPreviews(entries) {
32787
+ if (entries.length === 0) return;
32788
+ await this.ensureMigrated();
32789
+ for (const entry of entries) {
32790
+ const preview = typeof entry.preview === "string" && !isRuntimeSubagentEnvelope(entry.preview) ? buildThreadPreview(entry.preview) ?? "" : "";
32791
+ await this.ctx.storage.sql.exec(
32792
+ `UPDATE threads SET last_message_preview = ? WHERE id = ? AND last_message_preview IS NULL`,
32793
+ preview,
32794
+ entry.id
32795
+ );
32796
+ }
32797
+ }
32739
32798
  /**
32740
32799
  * Delete a thread from the registry.
32741
32800
  */