@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.
- package/dist/built-in-routes.js +24 -11
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/{ApiKeysView-Bv8qoGeD.js → ApiKeysView-Dmq8ljTo.js} +1 -1
- package/dist/client/{CenteredContentView-BVJCN57C.js → CenteredContentView-DM7LkIKF.js} +1 -1
- package/dist/client/CompositionView-CCW3XCKA.js +32 -0
- 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
- 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
- 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
- package/dist/client/{JsonViewer-UqksKmyo.js → JsonViewer-BCNJYUIz.js} +1 -1
- package/dist/client/{LoginView-D2kAR5Tu.js → LoginView-BHA2IKoE.js} +1 -1
- package/dist/client/{MarketplaceView-SIE1hoDP.js → MarketplaceView-BaYCbQeY.js} +1 -1
- 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
- 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
- package/dist/client/{ModelsView-BpR8UKW2.js → ModelsView-CapeJwZE.js} +1 -1
- package/dist/client/{PromptEditView-DIavw2J0.js → PromptEditView-DhGDru6i.js} +1 -1
- package/dist/client/{PromptModal-Dg39Yq2j.js → PromptModal-Dy7ZLTrD.js} +1 -1
- package/dist/client/{PromptsView-Ba1UL0TN.js → PromptsView-DzyP3URp.js} +1 -1
- package/dist/client/{ProvidersView-cMELUEfj.js → ProvidersView-CEM2pkVl.js} +1 -1
- 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
- package/dist/client/{ThreadsView-BldKUFh8.js → ThreadsView-DeQ1mZp6.js} +1 -1
- package/dist/client/{ToolsView-ug4WlvVe.js → ToolsView--_ivoaJq.js} +1 -1
- package/dist/client/{UsersView-Dcs0DUTh.js → UsersView-CHVGj7RB.js} +1 -1
- package/dist/client/{VariablesView-DyIy7q3P.js → VariablesView-Ey6egYHo.js} +1 -1
- package/dist/client/assets/{CompositionView-CWFus-Gl.css → CompositionView-eTR5Ewx2.css} +1 -1
- package/dist/client/assets/{ThreadInspectorPane-B2xKm6jM.css → ThreadInspectorPane-B9HsKfCN.css} +1 -1
- package/dist/client/assets/{index-DBe2myN2.css → index-CPBDhUF1.css} +1 -1
- package/dist/client/index-oR3Tbjo6.js +6 -0
- package/dist/client/index.html +2 -2
- package/dist/{index-CqhPhqAI.d.ts → index-D7luZUMB.d.ts} +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +67 -25
- package/dist/index.js.map +1 -1
- package/dist/packing.js +2 -2
- package/dist/packing.js.map +1 -1
- package/dist/plugin.js +4 -2
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +20 -2
- package/dist/runtime.js +63 -23
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
- package/dist/client/CompositionView-XRs1hJPR.js +0 -32
- package/dist/client/index-C8NBza63.js +0 -6
package/dist/client/index.html
CHANGED
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
27
27
|
<link rel="icon" type="image/svg+xml" href="/agents/assets/img/favicon-9uH1rb2F.svg">
|
|
28
28
|
<title>AgentBuilder Admin</title>
|
|
29
|
-
<script type="module" crossorigin src="/agents/index-
|
|
29
|
+
<script type="module" crossorigin src="/agents/index-oR3Tbjo6.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/agents/formkit-DcZQH9-p.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/agents/vendor-TPZjEwCU.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/agents/syntax-D-ZcovVx.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/agents/vue-KXHVRwln.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/agents/monaco-DI2r3M8m.js">
|
|
35
35
|
<link rel="stylesheet" crossorigin href="/agents/assets/monaco-DbLkoLD4.css">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/agents/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/agents/assets/index-CPBDhUF1.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="app"></div>
|
|
@@ -271,6 +271,7 @@ interface Message {
|
|
|
271
271
|
reasoning_details?: string | null;
|
|
272
272
|
parent_id?: string | null;
|
|
273
273
|
depth?: number;
|
|
274
|
+
prompt?: string | null;
|
|
274
275
|
attachments?: string | null;
|
|
275
276
|
metadata?: Record<string, unknown>;
|
|
276
277
|
subagent_id?: string | null;
|
|
@@ -1407,6 +1408,8 @@ interface DurableUserHubRpc {
|
|
|
1407
1408
|
interface ThreadRegistryEntry {
|
|
1408
1409
|
id: string;
|
|
1409
1410
|
agent_name: string;
|
|
1411
|
+
/** Agent the thread was created on — never changed by handoffs. */
|
|
1412
|
+
origin_agent_name?: string | null;
|
|
1410
1413
|
user_id: string | null;
|
|
1411
1414
|
tags: string[] | null;
|
|
1412
1415
|
env?: Record<string, string> | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModelDefinition, AgentDefinition } from './runtime.js';
|
|
2
2
|
export { AgentBuilderEnv, AuthContext, AuthUser, BroadcastOptions, CodeExecutionBridge, DurableAgentBuilder, DurableThread, DurableUserHub, FlowStateSdk, FlowStateWithSdk, HubClientInfo, ImageContextConfig, InjectMessageOptions, LLMProviderInterface, NamespaceResolutionError, PromptContent, PromptDefinition, PromptIncludePart, PromptPart, PromptToolConfig, Provider, ProviderContentPart, ProviderFilePart, ProviderImagePart, ProviderRegistry, ProviderTextPart, SessionToolBinding, SessionToolConfig, SideConfig, SubagentToolConfig, SubpromptConfig, ThreadRegistryEntry, ThreadWatchdog, ThreadWatchdogState, ToolConfig, UpdateThreadParams, User, WatchdogCheckin, WatchdogProbeResult, authenticate, buildImageDescription, cat, createNamespaceContext, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateImageDescription, getFileStats, getMessages, getMessagesToSummarize, getShortName, getThumbnail, getUnsummarizedImageAttachments, getVisibleAgentNames, getVisibleModelNames, getVisiblePromptNames, getVisibleToolNames, grep, hasImageAttachments, head, injectMessage, isQualifiedName, linkFile, mkdir, move, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, rename, replaceImagesWithDescriptions, requireAdmin, requireAuth, resolveAgent, resolveHook, resolveModel, resolvePrompt, resolveTool, rmdir, stat, tail, unlink, updateThread, writeFile, writeImage } from './runtime.js';
|
|
3
3
|
export { AgentPluginOptions, agentbuilder, builder } from './plugin.js';
|
|
4
|
-
export { A as Agent, x as AttachmentRef, f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, m as ClientStreamRequest, n as ClientStreamResponse, k as ClientToolRequest, l as ClientToolResponse, B as Controller, a as ControllerContext, E as Env, w as FileRecord, y as FileStats, u as FlowResult, F as FlowState, G as GrepResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, J as MessageContent, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, e as ThreadEnv, q as ThreadInstance, r as ThreadMetadata, T as ToolCall, t as ToolResult, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-
|
|
4
|
+
export { A as Agent, x as AttachmentRef, f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, m as ClientStreamRequest, n as ClientStreamResponse, k as ClientToolRequest, l as ClientToolResponse, B as Controller, a as ControllerContext, E as Env, w as FileRecord, y as FileStats, u as FlowResult, F as FlowState, G as GrepResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, M as Message, J as MessageContent, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, e as ThreadEnv, q as ThreadInstance, r as ThreadMetadata, T as ToolCall, t as ToolResult, 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';
|
|
5
5
|
export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderConfigSlot, ProviderConfigSlots, ProviderConfigValueSource, ProviderDefinition, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ProviderMethodOverrides, ModelCapabilities as ProviderModelCapabilities, ProviderOverride, ProviderOverrideContext, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSyncOverride, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineProvider, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue } from '@standardagents/spec';
|
|
6
6
|
export { C as ConstituentItem, D as DiscoveredPackage, N as NamespacedRegistry, P as PackingAnalysis, a as PackingOptions, b as PackingResult, c as UnpackOptions, d as UnpackResult } from './types-Bpe7IANZ.js';
|
|
7
7
|
export { D as DiscoveryConfig, P as PackageDiscoveryService, d as discoverPackages } from './discovery-DiMJWisl.js';
|
package/dist/index.js
CHANGED
|
@@ -8390,22 +8390,29 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
8390
8390
|
messageToAdd.attachments = providerAttachments;
|
|
8391
8391
|
}
|
|
8392
8392
|
}
|
|
8393
|
-
|
|
8393
|
+
const reasoningAuthoredByCurrentPrompt = !msg.prompt || msg.prompt === promptName;
|
|
8394
|
+
if (includeReasoning && reasoningAuthoredByCurrentPrompt) {
|
|
8394
8395
|
const reasoningDetailsArray = [];
|
|
8395
|
-
|
|
8396
|
-
reasoningDetailsArray.push({
|
|
8397
|
-
type: "reasoning.text",
|
|
8398
|
-
text: msg.reasoning_content
|
|
8399
|
-
});
|
|
8400
|
-
}
|
|
8396
|
+
const seenDetailTexts = /* @__PURE__ */ new Set();
|
|
8401
8397
|
if (msg.reasoning_details) {
|
|
8402
8398
|
try {
|
|
8403
8399
|
const parsedDetails = JSON.parse(msg.reasoning_details);
|
|
8404
|
-
|
|
8400
|
+
for (const detail of parsedDetails) {
|
|
8401
|
+
reasoningDetailsArray.push(detail);
|
|
8402
|
+
if (typeof detail?.text === "string") {
|
|
8403
|
+
seenDetailTexts.add(detail.text);
|
|
8404
|
+
}
|
|
8405
|
+
}
|
|
8405
8406
|
} catch (e) {
|
|
8406
8407
|
console.error(`[FlowEngine] Failed to parse reasoning_details for message ${msg.id}:`, e);
|
|
8407
8408
|
}
|
|
8408
8409
|
}
|
|
8410
|
+
if (msg.reasoning_content && !seenDetailTexts.has(msg.reasoning_content)) {
|
|
8411
|
+
reasoningDetailsArray.push({
|
|
8412
|
+
type: "reasoning.text",
|
|
8413
|
+
text: msg.reasoning_content
|
|
8414
|
+
});
|
|
8415
|
+
}
|
|
8409
8416
|
if (reasoningDetailsArray.length > 0) {
|
|
8410
8417
|
messageToAdd.reasoning_details = reasoningDetailsArray;
|
|
8411
8418
|
}
|
|
@@ -10450,6 +10457,7 @@ ${lines.join("\n\n")}`
|
|
|
10450
10457
|
"silent",
|
|
10451
10458
|
"parent_id",
|
|
10452
10459
|
"depth",
|
|
10460
|
+
"prompt",
|
|
10453
10461
|
"reasoning_content",
|
|
10454
10462
|
"reasoning_details"
|
|
10455
10463
|
];
|
|
@@ -10484,6 +10492,7 @@ ${lines.join("\n\n")}`
|
|
|
10484
10492
|
tool_status: row.tool_status,
|
|
10485
10493
|
parent_id: row.parent_id,
|
|
10486
10494
|
depth: row.depth,
|
|
10495
|
+
prompt: row.prompt,
|
|
10487
10496
|
reasoning_content: row.reasoning_content,
|
|
10488
10497
|
reasoning_details: row.reasoning_details
|
|
10489
10498
|
}));
|
|
@@ -14882,6 +14891,8 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
14882
14891
|
export interface ThreadRegistryEntry {
|
|
14883
14892
|
id: string;
|
|
14884
14893
|
agent_name: string;
|
|
14894
|
+
/** Agent the thread was created on \u2014 never changed by handoffs. */
|
|
14895
|
+
origin_agent_name?: string | null;
|
|
14885
14896
|
user_id: string | null;
|
|
14886
14897
|
tags: string[] | null;
|
|
14887
14898
|
env?: Record<string, string> | null;
|
|
@@ -18323,10 +18334,10 @@ async function extractPromptIncludes(sourceCode) {
|
|
|
18323
18334
|
let includeName = null;
|
|
18324
18335
|
for (const prop of element.properties) {
|
|
18325
18336
|
if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
|
|
18326
|
-
if (prop.name.text === "type" && ts.isStringLiteral(prop.initializer) && prop.initializer.text === "include") {
|
|
18337
|
+
if (prop.name.text === "type" && ts.isStringLiteral(prop.initializer) && (prop.initializer.text === "include" || prop.initializer.text === "prompt")) {
|
|
18327
18338
|
hasIncludeType = true;
|
|
18328
18339
|
}
|
|
18329
|
-
if (prop.name.text === "name" && ts.isStringLiteral(prop.initializer)) {
|
|
18340
|
+
if ((prop.name.text === "prompt" || prop.name.text === "name" || prop.name.text === "id") && ts.isStringLiteral(prop.initializer)) {
|
|
18330
18341
|
includeName = prop.initializer.text;
|
|
18331
18342
|
}
|
|
18332
18343
|
}
|
|
@@ -26201,9 +26212,9 @@ var DurableThread = class _DurableThread extends DurableObject {
|
|
|
26201
26212
|
* Each migration is run in order, starting from the current version + 1.
|
|
26202
26213
|
*/
|
|
26203
26214
|
async runMigrations(fromVersion) {
|
|
26204
|
-
for (const
|
|
26205
|
-
if (
|
|
26206
|
-
await
|
|
26215
|
+
for (const migration51 of migrations) {
|
|
26216
|
+
if (migration51.version > fromVersion) {
|
|
26217
|
+
await migration51.up(this.ctx.storage.sql);
|
|
26207
26218
|
}
|
|
26208
26219
|
}
|
|
26209
26220
|
}
|
|
@@ -31637,8 +31648,23 @@ var migration49 = {
|
|
|
31637
31648
|
}
|
|
31638
31649
|
};
|
|
31639
31650
|
|
|
31651
|
+
// src/durable-objects/agentbuilder-migrations/0016_add_origin_agent.ts
|
|
31652
|
+
var migration50 = {
|
|
31653
|
+
version: 16,
|
|
31654
|
+
async up(sql) {
|
|
31655
|
+
sql.exec(`ALTER TABLE threads ADD COLUMN origin_agent_name TEXT`);
|
|
31656
|
+
sql.exec(
|
|
31657
|
+
`CREATE INDEX IF NOT EXISTS idx_threads_origin_agent_name ON threads(origin_agent_name)`
|
|
31658
|
+
);
|
|
31659
|
+
sql.exec(`UPDATE threads SET origin_agent_name = agent_name`);
|
|
31660
|
+
sql.exec(`
|
|
31661
|
+
INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '16')
|
|
31662
|
+
`);
|
|
31663
|
+
}
|
|
31664
|
+
};
|
|
31665
|
+
|
|
31640
31666
|
// src/durable-objects/agentbuilder-migrations/index.ts
|
|
31641
|
-
var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49];
|
|
31667
|
+
var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46, migration47, migration48, migration49, migration50];
|
|
31642
31668
|
var LATEST_SCHEMA_VERSION2 = 15;
|
|
31643
31669
|
|
|
31644
31670
|
// src/utils/crypto.ts
|
|
@@ -32415,9 +32441,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32415
32441
|
}
|
|
32416
32442
|
}
|
|
32417
32443
|
async runMigrations(fromVersion) {
|
|
32418
|
-
for (const
|
|
32419
|
-
if (
|
|
32420
|
-
await
|
|
32444
|
+
for (const migration51 of migrations2) {
|
|
32445
|
+
if (migration51.version > fromVersion) {
|
|
32446
|
+
await migration51.up(this.ctx.storage.sql);
|
|
32421
32447
|
}
|
|
32422
32448
|
}
|
|
32423
32449
|
}
|
|
@@ -32459,10 +32485,11 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32459
32485
|
const encryptedEnv = await this.encryptEnvRecord(env);
|
|
32460
32486
|
const properties = this.withEnvTypeRecord(params.properties ?? null, envTypes);
|
|
32461
32487
|
await this.ctx.storage.sql.exec(
|
|
32462
|
-
`INSERT INTO threads (id, agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
|
|
32463
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
|
|
32488
|
+
`INSERT INTO threads (id, agent_name, origin_agent_name, user_id, tags, env, tenvs, properties, parent, terminated, created_at, last_activity_at)
|
|
32489
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)`,
|
|
32464
32490
|
id,
|
|
32465
32491
|
params.agent_name,
|
|
32492
|
+
params.agent_name,
|
|
32466
32493
|
params.user_id || null,
|
|
32467
32494
|
params.tags ? JSON.stringify(params.tags) : null,
|
|
32468
32495
|
encryptedEnv,
|
|
@@ -32475,6 +32502,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32475
32502
|
const thread = {
|
|
32476
32503
|
id,
|
|
32477
32504
|
agent_name: params.agent_name,
|
|
32505
|
+
origin_agent_name: params.agent_name,
|
|
32478
32506
|
user_id: params.user_id || null,
|
|
32479
32507
|
tags: params.tags || null,
|
|
32480
32508
|
env,
|
|
@@ -32542,7 +32570,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32542
32570
|
async getThread(id) {
|
|
32543
32571
|
await this.ensureMigrated();
|
|
32544
32572
|
const cursor = await this.ctx.storage.sql.exec(
|
|
32545
|
-
`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 = ?`,
|
|
32573
|
+
`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 = ?`,
|
|
32546
32574
|
id
|
|
32547
32575
|
);
|
|
32548
32576
|
const rows = cursor.toArray();
|
|
@@ -32556,6 +32584,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32556
32584
|
return {
|
|
32557
32585
|
id: row.id,
|
|
32558
32586
|
agent_name: row.agent_name,
|
|
32587
|
+
origin_agent_name: row.origin_agent_name,
|
|
32559
32588
|
user_id: row.user_id,
|
|
32560
32589
|
tags: row.tags ? JSON.parse(row.tags) : null,
|
|
32561
32590
|
env,
|
|
@@ -32618,16 +32647,16 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32618
32647
|
if (params.include_children) {
|
|
32619
32648
|
whereClauses.push(`id IN (
|
|
32620
32649
|
WITH RECURSIVE descendants(id) AS (
|
|
32621
|
-
SELECT id FROM threads WHERE agent_name = ?
|
|
32650
|
+
SELECT id FROM threads WHERE agent_name = ? OR origin_agent_name = ?
|
|
32622
32651
|
UNION ALL
|
|
32623
32652
|
SELECT t.id FROM threads t JOIN descendants d ON t.parent = d.id
|
|
32624
32653
|
)
|
|
32625
32654
|
SELECT id FROM descendants
|
|
32626
32655
|
)`);
|
|
32627
|
-
args.push(params.agent_name);
|
|
32656
|
+
args.push(params.agent_name, params.agent_name);
|
|
32628
32657
|
} else {
|
|
32629
|
-
whereClauses.push("agent_name = ?");
|
|
32630
|
-
args.push(params.agent_name);
|
|
32658
|
+
whereClauses.push("(agent_name = ? OR origin_agent_name = ?)");
|
|
32659
|
+
args.push(params.agent_name, params.agent_name);
|
|
32631
32660
|
}
|
|
32632
32661
|
}
|
|
32633
32662
|
if (params?.user_id) {
|
|
@@ -32669,7 +32698,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32669
32698
|
const offset = params?.offset ?? 0;
|
|
32670
32699
|
const orderByClause = params?.sort === "created" ? "created_at DESC" : params?.sort === "oldest" ? "created_at ASC" : "last_activity_at DESC, created_at DESC";
|
|
32671
32700
|
const cursor = await this.ctx.storage.sql.exec(
|
|
32672
|
-
`SELECT id, agent_name, user_id, tags, properties, parent, terminated, created_at, last_activity_at, executing_since, last_message_preview FROM threads
|
|
32701
|
+
`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
|
|
32673
32702
|
${whereClause}
|
|
32674
32703
|
ORDER BY ${orderByClause}
|
|
32675
32704
|
LIMIT ? OFFSET ?`,
|
|
@@ -32680,6 +32709,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32680
32709
|
const threads = cursor.toArray().map((row) => ({
|
|
32681
32710
|
id: row.id,
|
|
32682
32711
|
agent_name: row.agent_name,
|
|
32712
|
+
origin_agent_name: row.origin_agent_name,
|
|
32683
32713
|
user_id: row.user_id,
|
|
32684
32714
|
tags: row.tags ? JSON.parse(row.tags) : null,
|
|
32685
32715
|
env: null,
|
|
@@ -32847,6 +32877,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32847
32877
|
}
|
|
32848
32878
|
/**
|
|
32849
32879
|
* Update a thread's agent_name (used during agent handoff).
|
|
32880
|
+
* origin_agent_name is deliberately untouched — it pins the thread to the
|
|
32881
|
+
* agent page it started on. Broadcasts thread_updated so connected clients
|
|
32882
|
+
* re-render the row immediately instead of on the next activity tick
|
|
32883
|
+
* (which is when handed-off threads used to silently vanish mid-watch).
|
|
32850
32884
|
*/
|
|
32851
32885
|
async updateThreadAgent(id, agent_name) {
|
|
32852
32886
|
await this.ensureMigrated();
|
|
@@ -32855,6 +32889,14 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32855
32889
|
agent_name,
|
|
32856
32890
|
id
|
|
32857
32891
|
);
|
|
32892
|
+
try {
|
|
32893
|
+
const updated = await this.getThread(id);
|
|
32894
|
+
if (updated) {
|
|
32895
|
+
const eventThread = await this.toThreadEventPayload(updated);
|
|
32896
|
+
this.broadcastEvent({ type: "thread_updated", thread: eventThread });
|
|
32897
|
+
}
|
|
32898
|
+
} catch {
|
|
32899
|
+
}
|
|
32858
32900
|
return true;
|
|
32859
32901
|
}
|
|
32860
32902
|
/**
|