@standardagents/builder 0.34.0 → 0.35.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 (41) hide show
  1. package/dist/built-in-routes.js +490 -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 +52 -16
  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 +50 -16
  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,9 +23238,27 @@ 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];
23243
- var LATEST_SCHEMA_VERSION2 = 15;
23257
+ var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49, migration50];
23258
+ var LATEST_SCHEMA_VERSION2 = migrations2.reduce(
23259
+ (max, migration51) => Math.max(max, migration51.version),
23260
+ 0
23261
+ );
23244
23262
 
23245
23263
  // src/utils/crypto.ts
23246
23264
  var CryptoUtil = class {
@@ -24016,9 +24034,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24016
24034
  }
24017
24035
  }
24018
24036
  async runMigrations(fromVersion) {
24019
- for (const migration50 of migrations2) {
24020
- if (migration50.version > fromVersion) {
24021
- await migration50.up(this.ctx.storage.sql);
24037
+ for (const migration51 of migrations2) {
24038
+ if (migration51.version > fromVersion) {
24039
+ await migration51.up(this.ctx.storage.sql);
24022
24040
  }
24023
24041
  }
24024
24042
  }
@@ -24060,10 +24078,11 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24060
24078
  const encryptedEnv = await this.encryptEnvRecord(env);
24061
24079
  const properties = this.withEnvTypeRecord(params.properties ?? null, envTypes);
24062
24080
  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, ?, ?)`,
24081
+ `INSERT INTO threads (id, agent_name, origin_agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
24082
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
24065
24083
  id,
24066
24084
  params.agent_name,
24085
+ params.agent_name,
24067
24086
  params.user_id || null,
24068
24087
  params.tags ? JSON.stringify(params.tags) : null,
24069
24088
  encryptedEnv,
@@ -24076,6 +24095,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24076
24095
  const thread = {
24077
24096
  id,
24078
24097
  agent_name: params.agent_name,
24098
+ origin_agent_name: params.agent_name,
24079
24099
  user_id: params.user_id || null,
24080
24100
  tags: params.tags || null,
24081
24101
  env,
@@ -24143,7 +24163,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24143
24163
  async getThread(id) {
24144
24164
  await this.ensureMigrated();
24145
24165
  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 = ?`,
24166
+ `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
24167
  id
24148
24168
  );
24149
24169
  const rows = cursor.toArray();
@@ -24157,6 +24177,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24157
24177
  return {
24158
24178
  id: row.id,
24159
24179
  agent_name: row.agent_name,
24180
+ origin_agent_name: row.origin_agent_name,
24160
24181
  user_id: row.user_id,
24161
24182
  tags: row.tags ? JSON.parse(row.tags) : null,
24162
24183
  env,
@@ -24219,16 +24240,16 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24219
24240
  if (params.include_children) {
24220
24241
  whereClauses.push(`id IN (
24221
24242
  WITH RECURSIVE descendants(id) AS (
24222
- SELECT id FROM threads WHERE agent_name = ?
24243
+ SELECT id FROM threads WHERE agent_name = ? OR origin_agent_name = ?
24223
24244
  UNION ALL
24224
24245
  SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
24225
24246
  )
24226
24247
  SELECT id FROM descendants
24227
24248
  )`);
24228
- args.push(params.agent_name);
24249
+ args.push(params.agent_name, params.agent_name);
24229
24250
  } else {
24230
- whereClauses.push("agent_name = ?");
24231
- args.push(params.agent_name);
24251
+ whereClauses.push("(agent_name = ? OR origin_agent_name = ?)");
24252
+ args.push(params.agent_name, params.agent_name);
24232
24253
  }
24233
24254
  }
24234
24255
  if (params?.user_id) {
@@ -24270,7 +24291,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24270
24291
  const offset = params?.offset ?? 0;
24271
24292
  const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
24272
24293
  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
24294
+ `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
24295
  ${whereClause}
24275
24296
  ORDER BY ${orderByClause}
24276
24297
  LIMIT ? OFFSET ?`,
@@ -24281,6 +24302,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24281
24302
  const threads = cursor.toArray().map((row) => ({
24282
24303
  id: row.id,
24283
24304
  agent_name: row.agent_name,
24305
+ origin_agent_name: row.origin_agent_name,
24284
24306
  user_id: row.user_id,
24285
24307
  tags: row.tags ? JSON.parse(row.tags) : null,
24286
24308
  env: null,
@@ -24448,6 +24470,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24448
24470
  }
24449
24471
  /**
24450
24472
  * Update a thread's agent_name (used during agent handoff).
24473
+ * origin_agent_name is deliberately untouched — it pins the thread to the
24474
+ * agent page it started on. Broadcasts thread_updated so connected clients
24475
+ * re-render the row immediately instead of on the next activity tick
24476
+ * (which is when handed-off threads used to silently vanish mid-watch).
24451
24477
  */
24452
24478
  async updateThreadAgent(id, agent_name) {
24453
24479
  await this.ensureMigrated();
@@ -24456,6 +24482,14 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
24456
24482
  agent_name,
24457
24483
  id
24458
24484
  );
24485
+ try {
24486
+ const updated = await this.getThread(id);
24487
+ if (updated) {
24488
+ const eventThread = await this.toThreadEventPayload(updated);
24489
+ this.broadcastEvent({ type: "thread_updated", thread: eventThread });
24490
+ }
24491
+ } catch {
24492
+ }
24459
24493
  return true;
24460
24494
  }
24461
24495
  /**