@standardagents/builder 0.34.0 → 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 (41) hide show
  1. package/dist/built-in-routes.js +5 -1
  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-NmFt-OEl.d.ts → index-D7luZUMB.d.ts} +2 -0
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +48 -15
  32. package/dist/index.js.map +1 -1
  33. package/dist/plugin.js +2 -0
  34. package/dist/plugin.js.map +1 -1
  35. package/dist/runtime.d.ts +20 -2
  36. package/dist/runtime.js +46 -15
  37. package/dist/runtime.js.map +1 -1
  38. package/dist/test.d.ts +1 -1
  39. package/package.json +5 -5
  40. package/dist/client/CompositionView-XRs1hJPR.js +0 -32
  41. 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-NmFt-OEl.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-NmFt-OEl.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
@@ -17802,9 +17802,9 @@ var DurableThread = class _DurableThread extends DurableObject {
17802
17802
  * Each migration is run in order, starting from the current version + 1.
17803
17803
  */
17804
17804
  async runMigrations(fromVersion) {
17805
- for (const migration50 of migrations) {
17806
- if (migration50.version > fromVersion) {
17807
- 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);
17808
17808
  }
17809
17809
  }
17810
17810
  }
@@ -23238,8 +23238,23 @@ var migration49 = {
23238
23238
  }
23239
23239
  };
23240
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
+
23241
23256
  // src/durable-objects/agentbuilder-migrations/index.ts
23242
- 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];
23243
23258
  var LATEST_SCHEMA_VERSION2 = 15;
23244
23259
 
23245
23260
  // src/utils/crypto.ts
@@ -24016,9 +24031,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24016
24031
  }
24017
24032
  }
24018
24033
  async runMigrations(fromVersion) {
24019
- for (const migration50 of migrations2) {
24020
- if (migration50.version > fromVersion) {
24021
- 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);
24022
24037
  }
24023
24038
  }
24024
24039
  }
@@ -24060,10 +24075,11 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24060
24075
  const encryptedEnv = await this.encryptEnvRecord(env);
24061
24076
  const properties = this.withEnvTypeRecord(params.properties ?? null, envTypes);
24062
24077
  await this.ctx.storage.sql.exec(
24063
- `INSERT INTO threads (id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
24064
- 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, ?, ?)`,
24065
24080
  id,
24066
24081
  params.agent_name,
24082
+ params.agent_name,
24067
24083
  params.user_id || null,
24068
24084
  params.tags ? JSON.stringify(params.tags) : null,
24069
24085
  encryptedEnv,
@@ -24076,6 +24092,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24076
24092
  const thread = {
24077
24093
  id,
24078
24094
  agent_name: params.agent_name,
24095
+ origin_agent_name: params.agent_name,
24079
24096
  user_id: params.user_id || null,
24080
24097
  tags: params.tags || null,
24081
24098
  env,
@@ -24143,7 +24160,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24143
24160
  async getThread(id) {
24144
24161
  await this.ensureMigrated();
24145
24162
  const cursor = await this.ctx.storage.sql.exec(
24146
- `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 = ?`,
24147
24164
  id
24148
24165
  );
24149
24166
  const rows = cursor.toArray();
@@ -24157,6 +24174,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24157
24174
  return {
24158
24175
  id: row.id,
24159
24176
  agent_name: row.agent_name,
24177
+ origin_agent_name: row.origin_agent_name,
24160
24178
  user_id: row.user_id,
24161
24179
  tags: row.tags ? JSON.parse(row.tags) : null,
24162
24180
  env,
@@ -24219,16 +24237,16 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24219
24237
  if (params.include_children) {
24220
24238
  whereClauses.push(`id IN (
24221
24239
  WITH RECURSIVE descendants(id) AS (
24222
- SELECT id FROM threads WHERE agent_name = ?
24240
+ SELECT id FROM threads WHERE agent_name = ? OR origin_agent_name = ?
24223
24241
  UNION ALL
24224
24242
  SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
24225
24243
  )
24226
24244
  SELECT id FROM descendants
24227
24245
  )`);
24228
- args.push(params.agent_name);
24246
+ args.push(params.agent_name, params.agent_name);
24229
24247
  } else {
24230
- whereClauses.push("agent_name = ?");
24231
- args.push(params.agent_name);
24248
+ whereClauses.push("(agent_name = ? OR origin_agent_name = ?)");
24249
+ args.push(params.agent_name, params.agent_name);
24232
24250
  }
24233
24251
  }
24234
24252
  if (params?.user_id) {
@@ -24270,7 +24288,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24270
24288
  const offset = params?.offset ?? 0;
24271
24289
  const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
24272
24290
  const cursor = await this.ctx.storage.sql.exec(
24273
- `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
24274
24292
  ${whereClause}
24275
24293
  ORDER BY ${orderByClause}
24276
24294
  LIMIT ? OFFSET ?`,
@@ -24281,6 +24299,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24281
24299
  const threads = cursor.toArray().map((row) => ({
24282
24300
  id: row.id,
24283
24301
  agent_name: row.agent_name,
24302
+ origin_agent_name: row.origin_agent_name,
24284
24303
  user_id: row.user_id,
24285
24304
  tags: row.tags ? JSON.parse(row.tags) : null,
24286
24305
  env: null,
@@ -24448,6 +24467,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24448
24467
  }
24449
24468
  /**
24450
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).
24451
24474
  */
24452
24475
  async updateThreadAgent(id, agent_name) {
24453
24476
  await this.ensureMigrated();
@@ -24456,6 +24479,14 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24456
24479
  agent_name,
24457
24480
  id
24458
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
+ }
24459
24490
  return true;
24460
24491
  }
24461
24492
  /**