@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
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-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';
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-CqhPhqAI.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-CqhPhqAI.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';
@@ -1248,6 +1248,12 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
1248
1248
  * turn that triggered it.
1249
1249
  */
1250
1250
  private recordRegistryActivity;
1251
+ /**
1252
+ * The newest non-empty user message on this thread, for thread-list previews.
1253
+ * Returns null when the thread has none. The Durable Object does not know its
1254
+ * own thread id, so the caller is the one that stamps the registry.
1255
+ */
1256
+ getLatestUserMessagePreview(): Promise<string | null>;
1251
1257
  /** Arm the standing watchdog for an execution start. One pending row max. */
1252
1258
  private armExecutionWatchdog;
1253
1259
  /** Disarm on clean execution end. Completed check rows are noise, not history. */
@@ -2074,6 +2080,18 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
2074
2080
  executing?: boolean;
2075
2081
  messagePreview?: string | null;
2076
2082
  }): Promise<void>;
2083
+ /**
2084
+ * Fill in previews for threads that predate preview tracking. Callers read
2085
+ * each thread's newest user message and stamp the results here in one batch.
2086
+ *
2087
+ * A thread with no user message is stamped with an empty string rather than
2088
+ * left NULL: NULL means "not looked at yet", so without the sentinel an
2089
+ * empty thread would be re-read on every list request forever.
2090
+ */
2091
+ backfillThreadPreviews(entries: Array<{
2092
+ id: string;
2093
+ preview: string | null;
2094
+ }>): Promise<void>;
2077
2095
  /**
2078
2096
  * Delete a thread from the registry.
2079
2097
  */
package/dist/runtime.js CHANGED
@@ -17603,6 +17603,9 @@ var DurableThread = class _DurableThread extends DurableObject {
17603
17603
  if (await this.hasPendingTurnAlarm()) {
17604
17604
  return;
17605
17605
  }
17606
+ if (await this.shouldStop()) {
17607
+ return;
17608
+ }
17606
17609
  await this.alarmQueue.enqueue("continueExecution", { threadId, side }, 1);
17607
17610
  }
17608
17611
  async ensureRootMessageId(existingRootMessageId) {
@@ -17790,9 +17793,9 @@ var DurableThread = class _DurableThread extends DurableObject {
17790
17793
  * Each migration is run in order, starting from the current version + 1.
17791
17794
  */
17792
17795
  async runMigrations(fromVersion) {
17793
- for (const migration49 of migrations) {
17794
- if (migration49.version > fromVersion) {
17795
- await migration49.up(this.ctx.storage.sql);
17796
+ for (const migration50 of migrations) {
17797
+ if (migration50.version > fromVersion) {
17798
+ await migration50.up(this.ctx.storage.sql);
17796
17799
  }
17797
17800
  }
17798
17801
  }
@@ -21208,6 +21211,27 @@ ${resultContent}${attachmentSummary}`;
21208
21211
  );
21209
21212
  }
21210
21213
  }
21214
+ /**
21215
+ * The newest non-empty user message on this thread, for thread-list previews.
21216
+ * Returns null when the thread has none. The Durable Object does not know its
21217
+ * own thread id, so the caller is the one that stamps the registry.
21218
+ */
21219
+ async getLatestUserMessagePreview() {
21220
+ await this.ensureMigrated();
21221
+ try {
21222
+ const rows = this.ctx.storage.sql.exec(
21223
+ `SELECT content FROM messages
21224
+ WHERE role = 'user'
21225
+ AND content IS NOT NULL AND content != ''
21226
+ AND subagent_id IS NULL
21227
+ AND (silent IS NULL OR silent = 0)
21228
+ ORDER BY created_at DESC LIMIT 1`
21229
+ ).toArray();
21230
+ return rows[0]?.content ?? null;
21231
+ } catch {
21232
+ return null;
21233
+ }
21234
+ }
21211
21235
  /** Arm the standing watchdog for an execution start. One pending row max. */
21212
21236
  async armExecutionWatchdog(threadId) {
21213
21237
  try {
@@ -23191,9 +23215,23 @@ var migration48 = {
23191
23215
  }
23192
23216
  };
23193
23217
 
23218
+ // src/durable-objects/agentbuilder-migrations/0015_clear_envelope_previews.ts
23219
+ var migration49 = {
23220
+ version: 15,
23221
+ async up(sql) {
23222
+ sql.exec(
23223
+ `UPDATE threads SET last_message_preview = NULL
23224
+ WHERE last_message_preview LIKE 'Subagent (reference: %'`
23225
+ );
23226
+ sql.exec(`
23227
+ INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '15')
23228
+ `);
23229
+ }
23230
+ };
23231
+
23194
23232
  // src/durable-objects/agentbuilder-migrations/index.ts
23195
- var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48];
23196
- var LATEST_SCHEMA_VERSION2 = 14;
23233
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49];
23234
+ var LATEST_SCHEMA_VERSION2 = 15;
23197
23235
 
23198
23236
  // src/utils/crypto.ts
23199
23237
  var CryptoUtil = class {
@@ -23394,6 +23432,7 @@ function parseStoredPermissions(value) {
23394
23432
  }
23395
23433
  var EXECUTING_STALE_AFTER_SECONDS = 15 * 60;
23396
23434
  var THREAD_PREVIEW_MAX_CHARS = 140;
23435
+ var isRuntimeSubagentEnvelope = (content) => /^Subagent \(reference: /.test(content.trimStart());
23397
23436
  var buildThreadPreview = (content) => {
23398
23437
  const collapsed = content.replace(/\s+/g, " ").trim();
23399
23438
  if (!collapsed) return null;
@@ -23968,9 +24007,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
23968
24007
  }
23969
24008
  }
23970
24009
  async runMigrations(fromVersion) {
23971
- for (const migration49 of migrations2) {
23972
- if (migration49.version > fromVersion) {
23973
- await migration49.up(this.ctx.storage.sql);
24010
+ for (const migration50 of migrations2) {
24011
+ if (migration50.version > fromVersion) {
24012
+ await migration50.up(this.ctx.storage.sql);
23974
24013
  }
23975
24014
  }
23976
24015
  }
@@ -24286,7 +24325,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24286
24325
  await this.ensureMigrated();
24287
24326
  const now = Math.floor(Date.now() / 1e3);
24288
24327
  const executing = options?.executing;
24289
- const preview = typeof options?.messagePreview === "string" ? buildThreadPreview(options.messagePreview) : void 0;
24328
+ const preview = typeof options?.messagePreview === "string" && !isRuntimeSubagentEnvelope(options.messagePreview) ? buildThreadPreview(options.messagePreview) : void 0;
24290
24329
  await this.ctx.storage.sql.exec(
24291
24330
  `UPDATE threads
24292
24331
  SET last_activity_at = ?
@@ -24328,6 +24367,26 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24328
24367
  ...preview !== void 0 ? { last_message_preview: preview } : {}
24329
24368
  });
24330
24369
  }
24370
+ /**
24371
+ * Fill in previews for threads that predate preview tracking. Callers read
24372
+ * each thread's newest user message and stamp the results here in one batch.
24373
+ *
24374
+ * A thread with no user message is stamped with an empty string rather than
24375
+ * left NULL: NULL means "not looked at yet", so without the sentinel an
24376
+ * empty thread would be re-read on every list request forever.
24377
+ */
24378
+ async backfillThreadPreviews(entries) {
24379
+ if (entries.length === 0) return;
24380
+ await this.ensureMigrated();
24381
+ for (const entry of entries) {
24382
+ const preview = typeof entry.preview === "string" && !isRuntimeSubagentEnvelope(entry.preview) ? buildThreadPreview(entry.preview) ?? "" : "";
24383
+ await this.ctx.storage.sql.exec(
24384
+ `UPDATE threads SET last_message_preview = ? WHERE id = ? AND last_message_preview IS NULL`,
24385
+ preview,
24386
+ entry.id
24387
+ );
24388
+ }
24389
+ }
24331
24390
  /**
24332
24391
  * Delete a thread from the registry.
24333
24392
  */