@standardagents/builder 0.33.1 → 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 (43) hide show
  1. package/dist/built-in-routes.js +24 -11
  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-CqhPhqAI.d.ts → index-D7luZUMB.d.ts} +3 -0
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +67 -25
  32. package/dist/index.js.map +1 -1
  33. package/dist/packing.js +2 -2
  34. package/dist/packing.js.map +1 -1
  35. package/dist/plugin.js +4 -2
  36. package/dist/plugin.js.map +1 -1
  37. package/dist/runtime.d.ts +20 -2
  38. package/dist/runtime.js +63 -23
  39. package/dist/runtime.js.map +1 -1
  40. package/dist/test.d.ts +1 -1
  41. package/package.json +5 -5
  42. package/dist/client/CompositionView-XRs1hJPR.js +0 -32
  43. package/dist/client/index-C8NBza63.js +0 -6
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-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';
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-D7luZUMB.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-D7luZUMB.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';
@@ -1805,6 +1805,12 @@ interface AgentBuilderEnv {
1805
1805
  interface ThreadRegistryEntry {
1806
1806
  id: string;
1807
1807
  agent_name: string;
1808
+ /**
1809
+ * Agent the thread was CREATED on. Never changed by handoffs
1810
+ * (updateThreadAgent only re-points agent_name), so lists can keep a
1811
+ * handed-off conversation visible on its original agent's page.
1812
+ */
1813
+ origin_agent_name?: string | null;
1808
1814
  user_id: string | null;
1809
1815
  tags: string[] | null;
1810
1816
  env: Record<string, string> | null;
@@ -2114,6 +2120,10 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
2114
2120
  getThreadTreeIds(rootThreadId: string): Promise<string[]>;
2115
2121
  /**
2116
2122
  * Update a thread's agent_name (used during agent handoff).
2123
+ * origin_agent_name is deliberately untouched — it pins the thread to the
2124
+ * agent page it started on. Broadcasts thread_updated so connected clients
2125
+ * re-render the row immediately instead of on the next activity tick
2126
+ * (which is when handed-off threads used to silently vanish mid-watch).
2117
2127
  */
2118
2128
  updateThreadAgent(id: string, agent_name: string): Promise<boolean>;
2119
2129
  /**
@@ -2850,6 +2860,14 @@ interface AgentDefinition<N extends string = string> {
2850
2860
  * @default false
2851
2861
  */
2852
2862
  exposeAsTool?: boolean;
2863
+ /**
2864
+ * Whether this agent is a PRIMARY, user-facing entry point.
2865
+ * Set false on internal handoff targets (e.g. domain-gearbox variants) so
2866
+ * UIs keep them out of top-level agent lists while they stay fully
2867
+ * addressable for handoffs and thread resumption.
2868
+ * @default true
2869
+ */
2870
+ primary?: boolean;
2853
2871
  /** Description shown when agent is used as a tool. */
2854
2872
  toolDescription?: string;
2855
2873
  /**
package/dist/runtime.js CHANGED
@@ -8381,22 +8381,29 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
8381
8381
  messageToAdd.attachments = providerAttachments;
8382
8382
  }
8383
8383
  }
8384
- if (includeReasoning) {
8384
+ const reasoningAuthoredByCurrentPrompt = !msg.prompt || msg.prompt === promptName;
8385
+ if (includeReasoning && reasoningAuthoredByCurrentPrompt) {
8385
8386
  const reasoningDetailsArray = [];
8386
- if (msg.reasoning_content) {
8387
- reasoningDetailsArray.push({
8388
- type: "reasoning.text",
8389
- text: msg.reasoning_content
8390
- });
8391
- }
8387
+ const seenDetailTexts = /* @__PURE__ */ new Set();
8392
8388
  if (msg.reasoning_details) {
8393
8389
  try {
8394
8390
  const parsedDetails = JSON.parse(msg.reasoning_details);
8395
- reasoningDetailsArray.push(...parsedDetails);
8391
+ for (const detail of parsedDetails) {
8392
+ reasoningDetailsArray.push(detail);
8393
+ if (typeof detail?.text === "string") {
8394
+ seenDetailTexts.add(detail.text);
8395
+ }
8396
+ }
8396
8397
  } catch (e) {
8397
8398
  console.error(`[FlowEngine] Failed to parse reasoning_details for message ${msg.id}:`, e);
8398
8399
  }
8399
8400
  }
8401
+ if (msg.reasoning_content && !seenDetailTexts.has(msg.reasoning_content)) {
8402
+ reasoningDetailsArray.push({
8403
+ type: "reasoning.text",
8404
+ text: msg.reasoning_content
8405
+ });
8406
+ }
8400
8407
  if (reasoningDetailsArray.length > 0) {
8401
8408
  messageToAdd.reasoning_details = reasoningDetailsArray;
8402
8409
  }
@@ -10441,6 +10448,7 @@ ${lines.join("\n\n")}`
10441
10448
  "silent",
10442
10449
  "parent_id",
10443
10450
  "depth",
10451
+ "prompt",
10444
10452
  "reasoning_content",
10445
10453
  "reasoning_details"
10446
10454
  ];
@@ -10475,6 +10483,7 @@ ${lines.join("\n\n")}`
10475
10483
  tool_status: row.tool_status,
10476
10484
  parent_id: row.parent_id,
10477
10485
  depth: row.depth,
10486
+ prompt: row.prompt,
10478
10487
  reasoning_content: row.reasoning_content,
10479
10488
  reasoning_details: row.reasoning_details
10480
10489
  }));
@@ -17793,9 +17802,9 @@ var DurableThread = class _DurableThread extends DurableObject {
17793
17802
  * Each migration is run in order, starting from the current version + 1.
17794
17803
  */
17795
17804
  async runMigrations(fromVersion) {
17796
- for (const migration50 of migrations) {
17797
- if (migration50.version > fromVersion) {
17798
- await migration50.up(this.ctx.storage.sql);
17805
+ for (const migration51 of migrations) {
17806
+ if (migration51.version > fromVersion) {
17807
+ await migration51.up(this.ctx.storage.sql);
17799
17808
  }
17800
17809
  }
17801
17810
  }
@@ -23229,8 +23238,23 @@ var migration49 = {
23229
23238
  }
23230
23239
  };
23231
23240
 
23241
+ // src/durable-objects/agentbuilder-migrations/0016_add_origin_agent.ts
23242
+ var migration50 = {
23243
+ version: 16,
23244
+ async up(sql) {
23245
+ sql.exec(`ALTER TABLE threads ADD COLUMN origin_agent_name TEXT`);
23246
+ sql.exec(
23247
+ `CREATE INDEX IF NOT EXISTS idx_threads_origin_agent_name ON threads(origin_agent_name)`
23248
+ );
23249
+ sql.exec(`UPDATE threads SET origin_agent_name = agent_name`);
23250
+ sql.exec(`
23251
+ INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '16')
23252
+ `);
23253
+ }
23254
+ };
23255
+
23232
23256
  // src/durable-objects/agentbuilder-migrations/index.ts
23233
- var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49];
23257
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49, migration50];
23234
23258
  var LATEST_SCHEMA_VERSION2 = 15;
23235
23259
 
23236
23260
  // src/utils/crypto.ts
@@ -24007,9 +24031,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24007
24031
  }
24008
24032
  }
24009
24033
  async runMigrations(fromVersion) {
24010
- for (const migration50 of migrations2) {
24011
- if (migration50.version > fromVersion) {
24012
- await migration50.up(this.ctx.storage.sql);
24034
+ for (const migration51 of migrations2) {
24035
+ if (migration51.version > fromVersion) {
24036
+ await migration51.up(this.ctx.storage.sql);
24013
24037
  }
24014
24038
  }
24015
24039
  }
@@ -24051,10 +24075,11 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24051
24075
  const encryptedEnv = await this.encryptEnvRecord(env);
24052
24076
  const properties = this.withEnvTypeRecord(params.properties ?? null, envTypes);
24053
24077
  await this.ctx.storage.sql.exec(
24054
- `INSERT INTO threads (id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
24055
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
24078
+ `INSERT INTO threads (id, agent_name, origin_agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
24079
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
24056
24080
  id,
24057
24081
  params.agent_name,
24082
+ params.agent_name,
24058
24083
  params.user_id || null,
24059
24084
  params.tags ? JSON.stringify(params.tags) : null,
24060
24085
  encryptedEnv,
@@ -24067,6 +24092,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24067
24092
  const thread = {
24068
24093
  id,
24069
24094
  agent_name: params.agent_name,
24095
+ origin_agent_name: params.agent_name,
24070
24096
  user_id: params.user_id || null,
24071
24097
  tags: params.tags || null,
24072
24098
  env,
@@ -24134,7 +24160,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24134
24160
  async getThread(id) {
24135
24161
  await this.ensureMigrated();
24136
24162
  const cursor = await this.ctx.storage.sql.exec(
24137
- `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 = ?`,
24163
+ `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 = ?`,
24138
24164
  id
24139
24165
  );
24140
24166
  const rows = cursor.toArray();
@@ -24148,6 +24174,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24148
24174
  return {
24149
24175
  id: row.id,
24150
24176
  agent_name: row.agent_name,
24177
+ origin_agent_name: row.origin_agent_name,
24151
24178
  user_id: row.user_id,
24152
24179
  tags: row.tags ? JSON.parse(row.tags) : null,
24153
24180
  env,
@@ -24210,16 +24237,16 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24210
24237
  if (params.include_children) {
24211
24238
  whereClauses.push(`id IN (
24212
24239
  WITH RECURSIVE descendants(id) AS (
24213
- SELECT id FROM threads WHERE agent_name = ?
24240
+ SELECT id FROM threads WHERE agent_name = ? OR origin_agent_name = ?
24214
24241
  UNION ALL
24215
24242
  SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
24216
24243
  )
24217
24244
  SELECT id FROM descendants
24218
24245
  )`);
24219
- args.push(params.agent_name);
24246
+ args.push(params.agent_name, params.agent_name);
24220
24247
  } else {
24221
- whereClauses.push("agent_name = ?");
24222
- args.push(params.agent_name);
24248
+ whereClauses.push("(agent_name = ? OR origin_agent_name = ?)");
24249
+ args.push(params.agent_name, params.agent_name);
24223
24250
  }
24224
24251
  }
24225
24252
  if (params?.user_id) {
@@ -24261,7 +24288,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24261
24288
  const offset = params?.offset ?? 0;
24262
24289
  const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
24263
24290
  const cursor = await this.ctx.storage.sql.exec(
24264
- `SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads
24291
+ `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
24265
24292
  ${whereClause}
24266
24293
  ORDER BY ${orderByClause}
24267
24294
  LIMIT ? OFFSET ?`,
@@ -24272,6 +24299,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24272
24299
  const threads = cursor.toArray().map((row) => ({
24273
24300
  id: row.id,
24274
24301
  agent_name: row.agent_name,
24302
+ origin_agent_name: row.origin_agent_name,
24275
24303
  user_id: row.user_id,
24276
24304
  tags: row.tags ? JSON.parse(row.tags) : null,
24277
24305
  env: null,
@@ -24439,6 +24467,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24439
24467
  }
24440
24468
  /**
24441
24469
  * Update a thread's agent_name (used during agent handoff).
24470
+ * origin_agent_name is deliberately untouched — it pins the thread to the
24471
+ * agent page it started on. Broadcasts thread_updated so connected clients
24472
+ * re-render the row immediately instead of on the next activity tick
24473
+ * (which is when handed-off threads used to silently vanish mid-watch).
24442
24474
  */
24443
24475
  async updateThreadAgent(id, agent_name) {
24444
24476
  await this.ensureMigrated();
@@ -24447,6 +24479,14 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24447
24479
  agent_name,
24448
24480
  id
24449
24481
  );
24482
+ try {
24483
+ const updated = await this.getThread(id);
24484
+ if (updated) {
24485
+ const eventThread = await this.toThreadEventPayload(updated);
24486
+ this.broadcastEvent({ type: "thread_updated", thread: eventThread });
24487
+ }
24488
+ } catch {
24489
+ }
24450
24490
  return true;
24451
24491
  }
24452
24492
  /**