@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
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-CL7q3PuW.js';
2
- export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, 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';
1
+ import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-1AMgutkG.js';
2
+ export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, 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';
3
3
  import { CodeExecutionOptions, CodeExecutionResult, SubagentRegistryEntry, InjectMessageInput, QueueMessageInput, CredentialGrant, SkillMetadata, SkillFileInput, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, PromptEnvPart, VariableDefinition, SubpromptConfig as SubpromptConfig$1, PromptToolConfig as PromptToolConfig$1, SubagentToolConfig as SubagentToolConfig$1, ReasoningConfig, SideConfig as SideConfig$1, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart, ThreadState, NamespaceContext, DefinitionLoader } from '@standardagents/spec';
4
4
  export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ModelCapabilities as ProviderModelCapabilities, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel } from '@standardagents/spec';
5
5
  import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
@@ -1813,6 +1813,8 @@ interface ThreadRegistryEntry {
1813
1813
  last_activity_at?: number | null;
1814
1814
  /** True while the thread is executing a flow (stale markers read as false). */
1815
1815
  executing?: boolean;
1816
+ /** Short excerpt of the most recent user message, for thread-list rows. */
1817
+ last_message_preview?: string | null;
1816
1818
  }
1817
1819
  interface PendingSubagentAttachmentRef {
1818
1820
  path: string;
@@ -2070,6 +2072,7 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
2070
2072
  */
2071
2073
  recordThreadActivity(threadId: string, options?: {
2072
2074
  executing?: boolean;
2075
+ messagePreview?: string | null;
2073
2076
  }): Promise<void>;
2074
2077
  /**
2075
2078
  * Delete a thread from the registry.
package/dist/runtime.js CHANGED
@@ -17790,9 +17790,9 @@ var DurableThread = class _DurableThread extends DurableObject {
17790
17790
  * Each migration is run in order, starting from the current version + 1.
17791
17791
  */
17792
17792
  async runMigrations(fromVersion) {
17793
- for (const migration48 of migrations) {
17794
- if (migration48.version > fromVersion) {
17795
- await migration48.up(this.ctx.storage.sql);
17793
+ for (const migration49 of migrations) {
17794
+ if (migration49.version > fromVersion) {
17795
+ await migration49.up(this.ctx.storage.sql);
17796
17796
  }
17797
17797
  }
17798
17798
  }
@@ -21192,12 +21192,15 @@ ${resultContent}${attachmentSummary}`;
21192
21192
  * bookkeeping is presentation state: a failure here must never take down the
21193
21193
  * turn that triggered it.
21194
21194
  */
21195
- async recordRegistryActivity(threadId, executing) {
21195
+ async recordRegistryActivity(threadId, executing, messagePreview) {
21196
21196
  try {
21197
21197
  const namespace = this.env.AGENT_BUILDER;
21198
21198
  if (!namespace || typeof namespace.idFromName !== "function") return;
21199
21199
  const agentBuilder = namespace.get(namespace.idFromName("singleton"));
21200
- await agentBuilder.recordThreadActivity?.(threadId, { executing });
21200
+ await agentBuilder.recordThreadActivity?.(threadId, {
21201
+ executing,
21202
+ ...messagePreview !== void 0 ? { messagePreview } : {}
21203
+ });
21201
21204
  } catch (error) {
21202
21205
  console.error(
21203
21206
  "[DurableThread] Failed to record thread activity (non-fatal):",
@@ -21788,7 +21791,11 @@ Its execution was lost (the executor restarted or hung) and automatic recovery w
21788
21791
  this.isExecuting = true;
21789
21792
  this.currentAbortController = new AbortController();
21790
21793
  await this.armExecutionWatchdog(threadId);
21791
- await this.recordRegistryActivity(threadId, true);
21794
+ await this.recordRegistryActivity(
21795
+ threadId,
21796
+ true,
21797
+ role === "user" ? content : void 0
21798
+ );
21792
21799
  try {
21793
21800
  const agentBuilderId = this.env.AGENT_BUILDER.idFromName("singleton");
21794
21801
  const agentBuilder = this.env.AGENT_BUILDER.get(agentBuilderId);
@@ -23166,9 +23173,27 @@ var migration47 = {
23166
23173
  }
23167
23174
  };
23168
23175
 
23176
+ // src/durable-objects/agentbuilder-migrations/0014_thread_activity_scale.ts
23177
+ var migration48 = {
23178
+ version: 14,
23179
+ async up(sql) {
23180
+ sql.exec(`ALTER TABLE threads ADD COLUMN last_message_preview TEXT`);
23181
+ sql.exec(
23182
+ `CREATE INDEX IF NOT EXISTS idx_threads_executing_since
23183
+ ON threads(executing_since) WHERE executing_since IS NOT NULL`
23184
+ );
23185
+ sql.exec(
23186
+ `UPDATE threads SET last_activity_at = created_at WHERE last_activity_at IS NULL`
23187
+ );
23188
+ sql.exec(`
23189
+ INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '14')
23190
+ `);
23191
+ }
23192
+ };
23193
+
23169
23194
  // src/durable-objects/agentbuilder-migrations/index.ts
23170
- var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47];
23171
- var LATEST_SCHEMA_VERSION2 = 13;
23195
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48];
23196
+ var LATEST_SCHEMA_VERSION2 = 14;
23172
23197
 
23173
23198
  // src/utils/crypto.ts
23174
23199
  var CryptoUtil = class {
@@ -23368,6 +23393,12 @@ function parseStoredPermissions(value) {
23368
23393
  }
23369
23394
  }
23370
23395
  var EXECUTING_STALE_AFTER_SECONDS = 15 * 60;
23396
+ var THREAD_PREVIEW_MAX_CHARS = 140;
23397
+ var buildThreadPreview = (content) => {
23398
+ const collapsed = content.replace(/\s+/g, " ").trim();
23399
+ if (!collapsed) return null;
23400
+ return collapsed.length > THREAD_PREVIEW_MAX_CHARS ? `${collapsed.slice(0, THREAD_PREVIEW_MAX_CHARS - 1)}\u2026` : collapsed;
23401
+ };
23371
23402
  var isThreadExecuting = (executingSince, nowSeconds) => executingSince != null && nowSeconds - executingSince < EXECUTING_STALE_AFTER_SECONDS;
23372
23403
  var DurableAgentBuilder = class extends DurableObject {
23373
23404
  migratedToVersion = null;
@@ -23937,9 +23968,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
23937
23968
  }
23938
23969
  }
23939
23970
  async runMigrations(fromVersion) {
23940
- for (const migration48 of migrations2) {
23941
- if (migration48.version > fromVersion) {
23942
- await migration48.up(this.ctx.storage.sql);
23971
+ for (const migration49 of migrations2) {
23972
+ if (migration49.version > fromVersion) {
23973
+ await migration49.up(this.ctx.storage.sql);
23943
23974
  }
23944
23975
  }
23945
23976
  }
@@ -24064,7 +24095,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24064
24095
  async getThread(id) {
24065
24096
  await this.ensureMigrated();
24066
24097
  const cursor = await this.ctx.storage.sql.exec(
24067
- `SELECT id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at, executing_since FROM threads WHERE id = ?`,
24098
+ `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 = ?`,
24068
24099
  id
24069
24100
  );
24070
24101
  const rows = cursor.toArray();
@@ -24091,7 +24122,8 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24091
24122
  executing: isThreadExecuting(
24092
24123
  row.executing_since,
24093
24124
  Math.floor(Date.now() / 1e3)
24094
- )
24125
+ ),
24126
+ last_message_preview: row.last_message_preview
24095
24127
  };
24096
24128
  }
24097
24129
  /**
@@ -24188,9 +24220,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24188
24220
  const total = countCursor.one().count;
24189
24221
  const limit = params?.limit ?? 100;
24190
24222
  const offset = params?.offset ?? 0;
24191
- const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "COALESCE(last_activity_at, created_at) DESC, created_at DESC";
24223
+ const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
24192
24224
  const cursor = await this.ctx.storage.sql.exec(
24193
- `SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since FROM threads
24225
+ `SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads
24194
24226
  ${whereClause}
24195
24227
  ORDER BY ${orderByClause}
24196
24228
  LIMIT ? OFFSET ?`,
@@ -24214,7 +24246,8 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24214
24246
  terminated: row.terminated,
24215
24247
  created_at: row.created_at,
24216
24248
  last_activity_at: row.last_activity_at ?? row.created_at,
24217
- executing: isThreadExecuting(row.executing_since, nowSeconds)
24249
+ executing: isThreadExecuting(row.executing_since, nowSeconds),
24250
+ last_message_preview: row.last_message_preview
24218
24251
  }));
24219
24252
  return { threads, total };
24220
24253
  }
@@ -24253,6 +24286,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24253
24286
  await this.ensureMigrated();
24254
24287
  const now = Math.floor(Date.now() / 1e3);
24255
24288
  const executing = options?.executing;
24289
+ const preview = typeof options?.messagePreview === "string" ? buildThreadPreview(options.messagePreview) : void 0;
24256
24290
  await this.ctx.storage.sql.exec(
24257
24291
  `UPDATE threads
24258
24292
  SET last_activity_at = ?
@@ -24279,11 +24313,19 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24279
24313
  threadId
24280
24314
  );
24281
24315
  }
24316
+ if (preview !== void 0) {
24317
+ await this.ctx.storage.sql.exec(
24318
+ `UPDATE threads SET last_message_preview = ? WHERE id = ?`,
24319
+ preview,
24320
+ threadId
24321
+ );
24322
+ }
24282
24323
  this.broadcastEvent({
24283
24324
  type: "thread_activity",
24284
24325
  threadId,
24285
24326
  last_activity_at: now,
24286
- executing: executing === true
24327
+ executing: executing === true,
24328
+ ...preview !== void 0 ? { last_message_preview: preview } : {}
24287
24329
  });
24288
24330
  }
24289
24331
  /**