@sentry/junior 0.316.0 → 0.317.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/{admin-QYiDMnsu.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-AjrEV6Qe.js} +13438 -13149
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-B_YIZcgf.js} +5 -5
- package/dist/api/schema.d.ts +558 -102
- package/dist/api/schema.js +6 -6
- package/dist/api.js +230 -213
- package/dist/{app-BhvzRD__.d.ts → app-MoNAsVV5.d.ts} +34 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +167 -122
- package/dist/catalog-runtime-DfSpJZdY.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-Bref7aPI.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.js → chat-core-engine-aH85nEHv.js} +4 -3
- package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +1 -1
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -4
- package/dist/cli/snapshot-create.js +5 -2
- package/dist/cli/upgrade.js +5 -3
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed--9S0_PXL.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-BUE_7xaN.js} +99 -76
- package/dist/{create-DUJBXr6E.js → create-DoDIYgtZ.js} +12 -9
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DhzvUY23.js → db-BFmyYZtJ.js} +20265 -27551
- package/dist/{deployment-BhvrhQeh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-CgQ7mlHt.js} +264 -47
- package/dist/{html-B_12WjKT.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-A1lCkybD.js} +391 -24
- package/dist/{lineage-D3AZAJVe.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-Bxvg5wXf.js} +224 -544
- package/dist/{logging-B8KEJegM.js → logging--smS7XRK.js} +2 -2
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-uSXhUFc9.js} +4747 -7039
- package/dist/{message-B5fKDYzz.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-CuMWy37l.js → model-input-BReSnwHp.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +20 -6
- package/dist/{oauth-callback-server-B3Vvlydo.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{list-mkB_GU8R.js → parent-result-Ck1rFYRQ.js} +107 -92
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-CCi7323k.js → prompt-Dv7gkpD6.js} +97 -103
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-iXMT5Jmh.js +3279 -0
- package/dist/reports-WKHfGTsU.js +195 -0
- package/dist/{resolve-D5JVvv6A.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-Bta_dlWa.js} +25 -116
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-BzAES5W3.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-DfqrHACA.js} +48 -86
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-CiXy0eNR.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-C9Yc2_ae.js} +20 -46
- package/dist/{thread-context-fiMNylbg.js → thread-context-CqZDKErp.js} +6 -6
- package/dist/topics-SRN7IVX-.js +24 -0
- package/dist/turn-membership-CENFf3kI.js +856 -0
- package/dist/{turn-wake-BjDW7x-5.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-BebquhET.js → types-C4iC-IMC.js} +801 -771
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-BqMQQNRk.js} +5 -4
- package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
- package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
- package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
- package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
- package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
- package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
- package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
- package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
- package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
- package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
- package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
- package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
- package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
- package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
- package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
- package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
- package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
- package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
- package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
- package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
- package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
- package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
- package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
- package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
- package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
- package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
- package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
- package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
- package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
- package/package.json +5 -5
- package/dist/people-CUtFApfL.js +0 -81
- package/dist/start-conversation-B-LIqqNi.js +0 -162
- package/dist/turn-session-routing-D15orfwy.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as messageChildAgent } from "./create-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
// src/chat/
|
|
2
|
+
import { F as AgentMessageTargetError, b as actorFromRun } from "./agent-runner-AjrEV6Qe.js";
|
|
3
|
+
import { Pt as PARENT_AGENT_TARGET, Sr as readConversationAccessFromSql, a as getDb, hr as canAccessConversation, i as getConversationStore, jt as findChildAgentConversationId, oc as SYSTEM_IDENTITY_ID } from "./db-BFmyYZtJ.js";
|
|
4
|
+
import { m as readChildConversationSender } from "./parent-result-Ck1rFYRQ.js";
|
|
5
|
+
import { n as enqueueAgentMessageToParent } from "./result-Bta_dlWa.js";
|
|
6
|
+
import { t as messageChildAgent } from "./create-DoDIYgtZ.js";
|
|
7
|
+
import { O as EVENT_WAIT_MS, U as enqueueAutomatedInput } from "./mailbox-turn-uSXhUFc9.js";
|
|
8
|
+
import { U as renderDataTag } from "./prompt-Dv7gkpD6.js";
|
|
9
|
+
import { Dn as TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE } from "./types-C4iC-IMC.js";
|
|
10
|
+
// src/chat/child-agents/top-level-message.ts
|
|
11
11
|
const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
|
|
12
|
-
/** Event type of a message from another top-level agent. */
|
|
13
|
-
const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
|
|
14
12
|
/**
|
|
15
13
|
* Check that a top-level agent can message another top-level agent under
|
|
16
14
|
* `policies/conversation-access.md`. Public agents can message each other.
|
|
17
15
|
* A private agent can message only agents at its own Destination, such as
|
|
18
|
-
* another thread in the same private Slack channel
|
|
19
|
-
* Space. A Space's Lead messages a root outside its Space only when the
|
|
20
|
-
* member who asked is a Participant of that root.
|
|
16
|
+
* another thread in the same private Slack channel.
|
|
21
17
|
* Every target that the sender cannot reach gets the same error, so the
|
|
22
18
|
* error does not show that a private Conversation exists.
|
|
23
19
|
*/
|
|
@@ -35,12 +31,7 @@ async function requireTopLevelAgentAccess(args) {
|
|
|
35
31
|
requester: sender,
|
|
36
32
|
target: receiver
|
|
37
33
|
})) throw notReachable;
|
|
38
|
-
if (receiver.visibility === "public" && sender.visibility !== "public") throw new AgentMessageTargetError(`"${args.to}" is a public conversation and this conversation is private. A private conversation can message only conversations in its own channel
|
|
39
|
-
const leadSpaceId = (await readLeadSpace(args.senderConversationId))?.id;
|
|
40
|
-
if (leadSpaceId && target.spaceId !== leadSpaceId) {
|
|
41
|
-
const person = args.askingActor ? (await readActorIdentity(args.askingActor))?.user : void 0;
|
|
42
|
-
if (!(person ? (await readConversationAccessFromSql(getDb(), [args.to], person)).get(args.to) : void 0)?.isParticipant) throw new AgentMessageTargetError(`"${args.to}" is outside this Space. You can message a conversation outside this Space only for a member who takes part in it and asked for this Turn`);
|
|
43
|
-
}
|
|
34
|
+
if (receiver.visibility === "public" && sender.visibility !== "public") throw new AgentMessageTargetError(`"${args.to}" is a public conversation and this conversation is private. A private conversation can message only conversations in its own channel or DM`);
|
|
44
35
|
}
|
|
45
36
|
function renderTopLevelMessageInput(args) {
|
|
46
37
|
return renderDataTag("agent-message", {
|
|
@@ -93,7 +84,7 @@ async function enqueueTopLevelAgentMessage(args) {
|
|
|
93
84
|
state: args.state
|
|
94
85
|
});
|
|
95
86
|
}
|
|
96
|
-
// src/chat/
|
|
87
|
+
// src/chat/child-agents/message.ts
|
|
97
88
|
var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
|
|
98
89
|
/**
|
|
99
90
|
* Bind a Run's Actor and credentials to messages for its parent and child
|
|
@@ -129,7 +120,6 @@ function bindMessageAgent(run, options) {
|
|
|
129
120
|
});
|
|
130
121
|
if (!childConversationId) {
|
|
131
122
|
await enqueueTopLevelAgentMessage({
|
|
132
|
-
askingActor: isPersonInput(run.source.kind) ? actor : void 0,
|
|
133
123
|
messageKey: `${run.turnId}:${call.toolCallId}`,
|
|
134
124
|
queue,
|
|
135
125
|
senderConversationId: run.conversationId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { o as getSqlExecutor } from "./db-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { o as getSqlExecutor } from "./db-BFmyYZtJ.js";
|
|
3
|
+
import { o as detectImageMediaType, s as isVisionImageMediaType } from "./user-customization-CvfuY9Eo.js";
|
|
4
|
+
import { d as readLiveAttachment } from "./turn-membership-CENFf3kI.js";
|
|
5
5
|
import { escapeTagText, renderTag } from "@sentry/junior-plugin-api";
|
|
6
6
|
// src/chat/attachments/model-input.ts
|
|
7
7
|
var model_input_exports = /* @__PURE__ */ __exportAll({ loadInputAttachments: () => loadInputAttachments });
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as JuniorPluginSet } from "./plugins-fBrz8PCV.js";
|
|
2
|
-
import { r as JuniorDashboardOptions } from "./app-
|
|
2
|
+
import { r as JuniorDashboardOptions } from "./app-MoNAsVV5.js";
|
|
3
3
|
import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
|
|
4
4
|
type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
|
|
5
5
|
type SentryNitroOptions = NonNullable<Parameters<typeof withSentryConfig$1>[1]>;
|
package/dist/nitro.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as resolveConversationWorkQueueTopic, i as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, n as CACHE_WARMUP_QUEUE_TOPIC, o as toOptionalTrimmed, r as PLUGIN_TASK_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./topics-SRN7IVX-.js";
|
|
2
2
|
import { t as startLocalVercelQueueServer } from "./local-server-CpnGhYml.js";
|
|
3
3
|
import { n as TURN_STEP_TOPIC, t as DELIVERY_TOPIC } from "./topic-CRYYBYp-.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_HEARTBEAT_ROUTE, d as JUNIOR_RETENTION_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, g as getDeploymentServiceVersion, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_DELIVERY_CALLBACK_ROUTE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, s as JUNIOR_HEARTBEAT_CRON_SCHEDULE, t as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, u as JUNIOR_RETENTION_CRON_SCHEDULE } from "./deployment-DXq9ZLU4.js";
|
|
5
|
+
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DD9vencX.js";
|
|
6
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-D_Ru4CWc.js";
|
|
6
7
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
|
|
7
8
|
import path from "node:path";
|
|
8
9
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
@@ -58,7 +59,7 @@ const LOCAL_CONSUMER_GROUP = "local";
|
|
|
58
59
|
* server.
|
|
59
60
|
*/
|
|
60
61
|
async function startDevQueue(nitro) {
|
|
61
|
-
if (
|
|
62
|
+
if (toOptionalTrimmed(process.env["JUNIOR_QUEUE_API_URL"])) return;
|
|
62
63
|
const appUrl = `http://localhost:${nitro.options.devServer.port ?? (process.env["PORT"]?.trim() || 3e3)}`;
|
|
63
64
|
const server = await startLocalVercelQueueServer({ consumers: queueCallbackRoutes().map(({ route, topic }) => ({
|
|
64
65
|
consumerGroup: LOCAL_CONSUMER_GROUP,
|
|
@@ -252,11 +253,24 @@ function injectVirtualConfig(nitro, options) {
|
|
|
252
253
|
*/
|
|
253
254
|
function injectVirtualSystemPrompts(nitro, options) {
|
|
254
255
|
nitro.options.virtual["#junior/system-prompts"] = async () => {
|
|
255
|
-
const { buildSystemPromptTable } = await import("./system-prompt-table-
|
|
256
|
+
const { buildSystemPromptTable } = await import("./system-prompt-table-CiXy0eNR.js").then((n) => n.r);
|
|
256
257
|
const table = await buildSystemPromptTable(await options.loadPlugins(), options.botName);
|
|
257
258
|
return `export const systemPrompts = ${JSON.stringify(table)};`;
|
|
258
259
|
};
|
|
259
260
|
}
|
|
261
|
+
// src/chat/bot-name.ts
|
|
262
|
+
/**
|
|
263
|
+
* Resolve the name Junior uses for itself: `name`, then `JUNIOR_BOT_NAME`,
|
|
264
|
+
* then `junior`. A build passes `juniorNitro({ botName })` as `name`.
|
|
265
|
+
*/
|
|
266
|
+
function resolveBotName(name, env) {
|
|
267
|
+
if (name !== void 0) {
|
|
268
|
+
const trimmed = toOptionalTrimmed(name);
|
|
269
|
+
if (!trimmed) throw new Error("botName must not be empty");
|
|
270
|
+
return trimmed;
|
|
271
|
+
}
|
|
272
|
+
return toOptionalTrimmed(env["JUNIOR_BOT_NAME"]) ?? "junior";
|
|
273
|
+
}
|
|
260
274
|
// src/nitro.ts
|
|
261
275
|
/**
|
|
262
276
|
* Sentry's Nitro config wrapper: source map upload and Nitro request hooks.
|
|
@@ -272,7 +286,7 @@ function withSentryConfig(config, options = {}) {
|
|
|
272
286
|
return withSentryConfig$1(config, {
|
|
273
287
|
...options,
|
|
274
288
|
release: {
|
|
275
|
-
name: getDeploymentServiceVersion(),
|
|
289
|
+
name: getDeploymentServiceVersion(process.env),
|
|
276
290
|
...options.release
|
|
277
291
|
}
|
|
278
292
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
2
|
-
import {
|
|
1
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BJOqGnjV.js";
|
|
2
|
+
import { A as createUserTokenStore } from "./profile-BQ-iBDsZ.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
// src/chat/local/oauth-callback-server.ts
|
|
5
5
|
const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as getChatConfig } from "./config-CHQ8X251.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { SignJWT, jwtVerify } from "jose";
|
|
@@ -17,7 +17,7 @@ const localOAuthRelayPayloadSchema = z.object({
|
|
|
17
17
|
}).strict();
|
|
18
18
|
/** Derive the HMAC key used only for signed local OAuth relay state. */
|
|
19
19
|
function relayKey() {
|
|
20
|
-
const secret =
|
|
20
|
+
const secret = getChatConfig().secrets.juniorSecret;
|
|
21
21
|
if (!secret) throw new Error("Local OAuth requires JUNIOR_SECRET");
|
|
22
22
|
return new TextEncoder().encode(secret);
|
|
23
23
|
}
|
|
@@ -3,55 +3,6 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs, { statSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
// src/chat/optional-string.ts
|
|
7
|
-
/**
|
|
8
|
-
* Normalize optional env-style strings so blank values do not masquerade as
|
|
9
|
-
* configured inputs.
|
|
10
|
-
*/
|
|
11
|
-
function toOptionalTrimmed(value) {
|
|
12
|
-
if (!value) return;
|
|
13
|
-
const trimmed = value.trim();
|
|
14
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
15
|
-
}
|
|
16
|
-
// src/chat/bot-name.ts
|
|
17
|
-
/**
|
|
18
|
-
* Resolve the name Junior uses for itself: `name`, then `JUNIOR_BOT_NAME`,
|
|
19
|
-
* then `junior`. A build passes `juniorNitro({ botName })` as `name`.
|
|
20
|
-
*/
|
|
21
|
-
function resolveBotName(name, env) {
|
|
22
|
-
if (name !== void 0) {
|
|
23
|
-
const trimmed = toOptionalTrimmed(name);
|
|
24
|
-
if (!trimmed) throw new Error("botName must not be empty");
|
|
25
|
-
return trimmed;
|
|
26
|
-
}
|
|
27
|
-
return toOptionalTrimmed(env["JUNIOR_BOT_NAME"]) ?? "junior";
|
|
28
|
-
}
|
|
29
|
-
// src/chat/queue/config.ts
|
|
30
|
-
function readApiUrl(value) {
|
|
31
|
-
const raw = toOptionalTrimmed(value);
|
|
32
|
-
if (raw === void 0) return;
|
|
33
|
-
const protocol = URL.parse(raw)?.protocol;
|
|
34
|
-
if (protocol !== "http:" && protocol !== "https:") throw new Error("JUNIOR_QUEUE_API_URL must be an http or https URL");
|
|
35
|
-
return raw;
|
|
36
|
-
}
|
|
37
|
-
/** Read queue settings from environment variables. */
|
|
38
|
-
function readQueueConfig(env) {
|
|
39
|
-
const apiUrl = readApiUrl(env["JUNIOR_QUEUE_API_URL"]);
|
|
40
|
-
return apiUrl ? { apiUrl } : {};
|
|
41
|
-
}
|
|
42
|
-
// src/chat/queue/topics.ts
|
|
43
|
-
/**
|
|
44
|
-
* Queue topic names. Vercel queue wiring uses them at build, so keep them
|
|
45
|
-
* stable, and keep this module free of runtime configuration.
|
|
46
|
-
*/
|
|
47
|
-
const CACHE_WARMUP_QUEUE_TOPIC = "junior_cache_warmups";
|
|
48
|
-
const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
|
|
49
|
-
const WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC = "junior_workspace_snapshots";
|
|
50
|
-
const BACKGROUND_COMPACTION_QUEUE_TOPIC = "junior_context_compaction";
|
|
51
|
-
/** Resolve the Vercel Queue topic used for conversation wake-up nudges. */
|
|
52
|
-
function resolveConversationWorkQueueTopic(options = {}) {
|
|
53
|
-
return options.topic?.trim() || process.env["JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC"]?.trim() || "junior_conversation_work";
|
|
54
|
-
}
|
|
55
6
|
// src/package-resolution.ts
|
|
56
7
|
function isDirectory$1(targetPath) {
|
|
57
8
|
try {
|
|
@@ -496,4 +447,4 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
496
447
|
tracingIncludes: uniqueStringsInOrder(tracingIncludes)
|
|
497
448
|
};
|
|
498
449
|
}
|
|
499
|
-
export {
|
|
450
|
+
export { listReferenceFiles as a, soulPathCandidates as c, resolvePackageDir as d, homeDir as i, worldPathCandidates as l, normalizePluginPackageNames as n, pluginRoots as o, discovery_exports as r, skillRoots as s, discoverInstalledPluginPackageContent as t, isValidPackageName as u };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Gd as juniorAgentBindings, Mn as readParentMessage, Nn as readInboundMessageSender, Pn as isEventMailboxMetadata, Qd as juniorConversationEvents, V as conversationLastTurnOutcomeSql, fs as conversationSubtree, i as getConversationStore, in as getConversationWorkStates, lf as juniorConversations, n as getConversationEventStore, nu as isPersonInput, o as getSqlExecutor, ps as conversationSubtreeColumns, rn as getConversationWorkState } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
|
|
3
|
+
import { kn as isAgentUpdateEventType } from "./types-C4iC-IMC.js";
|
|
4
|
+
import { Or as TURN_OUTCOME_STATUSES, Rt as buildDeterministicTurnId, W as getConversationStoppedAtMs, Xn as EVENT_SYSTEM_ACTOR, _ as readChildOfStoredParent, b as readAgentConfig, i as listActiveMailboxTurns, r as listActiveMailboxTurnSources } from "./mailbox-turn-uSXhUFc9.js";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
import pLimit from "p-limit";
|
|
7
6
|
import { and, desc, eq, inArray, isNotNull, ne, sql } from "drizzle-orm";
|
|
8
7
|
import { alias } from "drizzle-orm/pg-core";
|
|
9
|
-
|
|
8
|
+
import pLimit from "p-limit";
|
|
9
|
+
// src/chat/child-agents/child-input.ts
|
|
10
10
|
function childAgentInputKind(namespace, eventType, watchId) {
|
|
11
11
|
if (namespace !== "junior" || !eventType) return;
|
|
12
12
|
if (eventType === "agent.message") return "message";
|
|
@@ -23,6 +23,15 @@ function childAgentInput(message) {
|
|
|
23
23
|
} : void 0;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
+
* Whether one input is the `stopped` result that the stop of its sender
|
|
27
|
+
* sends. Only a stop reports `stopped`, so the stored status tells this
|
|
28
|
+
* result from the reply of a Turn.
|
|
29
|
+
*/
|
|
30
|
+
function isStopResult(message) {
|
|
31
|
+
const metadata = message.input.metadata;
|
|
32
|
+
return isEventMailboxMetadata(metadata) && metadata.event.namespace === "junior" && isAgentUpdateEventType(metadata.event.eventType) && metadata.event.status === "stopped";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
26
35
|
* Whether the saved Event fields of a Turn's input Message name a child
|
|
27
36
|
* agent's reply or message. A new and a resumed Turn read the same fields.
|
|
28
37
|
*/
|
|
@@ -60,7 +69,7 @@ async function isDroppedChildInput(message) {
|
|
|
60
69
|
*/
|
|
61
70
|
async function isSkippedReply(message) {
|
|
62
71
|
const sender = readInboundMessageSender(message);
|
|
63
|
-
if (!sender ||
|
|
72
|
+
if (!sender || isStopResult(message)) return false;
|
|
64
73
|
const senderStoppedAtMs = await getConversationStoppedAtMs(sender.conversationId);
|
|
65
74
|
return senderStoppedAtMs !== void 0 && message.createdAtMs >= senderStoppedAtMs;
|
|
66
75
|
}
|
|
@@ -73,99 +82,27 @@ async function readChildConversationSender(childConversationId) {
|
|
|
73
82
|
const [row] = await getSqlExecutor().db().select({
|
|
74
83
|
agentName: juniorAgentBindings.name,
|
|
75
84
|
parentConversationId: parent.conversationId,
|
|
85
|
+
parentKind: parent.kind,
|
|
76
86
|
title: juniorConversations.title
|
|
77
87
|
}).from(juniorConversations).innerJoin(parent, eq(parent.conversationId, juniorConversations.parentConversationId)).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(eq(juniorConversations.conversationId, childConversationId));
|
|
78
88
|
return row ? {
|
|
79
89
|
...row.agentName ? { agentName: row.agentName } : void 0,
|
|
80
90
|
childConversationId,
|
|
81
91
|
parentConversationId: row.parentConversationId,
|
|
92
|
+
...row.parentKind ? { parentKind: row.parentKind } : void 0,
|
|
82
93
|
...row.title ? { title: row.title } : void 0
|
|
83
94
|
} : void 0;
|
|
84
95
|
}
|
|
85
96
|
/**
|
|
86
97
|
* Read the sender of one reply or message, when it is a child of the
|
|
87
98
|
* Conversation that received it. Otherwise the input has no child sender,
|
|
88
|
-
* such as one that an
|
|
99
|
+
* such as one that an earlier release sent.
|
|
89
100
|
*/
|
|
90
101
|
async function getChildAgentInputSender(message, input) {
|
|
91
102
|
const sender = await readChildConversationSender(input.senderId);
|
|
92
103
|
return sender?.parentConversationId === message.conversationId ? sender : void 0;
|
|
93
104
|
}
|
|
94
|
-
// src/chat/
|
|
95
|
-
const SUBAGENT_KIND = "agent";
|
|
96
|
-
const SUBAGENT_STARTED_KEY_PREFIX = "subagent_started:";
|
|
97
|
-
const SUBAGENT_ENDED_KEY_PREFIX = "subagent_ended:";
|
|
98
|
-
/**
|
|
99
|
-
* Record in the parent Conversation that a child agent got one task or
|
|
100
|
-
* message. Write it before the input reaches the child's mailbox, so the
|
|
101
|
-
* child cannot end first.
|
|
102
|
-
*/
|
|
103
|
-
async function recordSubagentStartedMarker(start) {
|
|
104
|
-
await getConversationEventStore().append(start.parentConversationId, [{
|
|
105
|
-
idempotencyKey: `${SUBAGENT_STARTED_KEY_PREFIX}${start.markerId}`,
|
|
106
|
-
data: {
|
|
107
|
-
type: "subagent_started",
|
|
108
|
-
subagentInvocationId: start.markerId,
|
|
109
|
-
subagentKind: SUBAGENT_KIND,
|
|
110
|
-
childConversationId: start.childConversationId,
|
|
111
|
-
...start.agentName ? { agentName: start.agentName } : void 0,
|
|
112
|
-
parentToolCallId: start.parentToolCallId,
|
|
113
|
-
task: start.input,
|
|
114
|
-
...start.title ? { title: start.title } : void 0,
|
|
115
|
-
...start.reasoningLevel ? { reasoningLevel: start.reasoningLevel } : void 0
|
|
116
|
-
},
|
|
117
|
-
createdAtMs: start.createdAtMs
|
|
118
|
-
}]);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Record in the parent Conversation how the work of a child agent ended.
|
|
122
|
-
* Each parent message has its own `subagent_started` marker, named by the
|
|
123
|
-
* message id, and each one that the child already took ends with `outcome`.
|
|
124
|
-
* A parent message that still waits in the child's mailbox stays open,
|
|
125
|
-
* because later work reads it, unless `includeWaiting` is set, as for a stop
|
|
126
|
-
* that skips it. Write it before the child's result reaches the parent.
|
|
127
|
-
*/
|
|
128
|
-
async function recordChildAgentEnded(childConversationId, outcome, options = {}) {
|
|
129
|
-
if (!await readAgentConfig(childConversationId)) return;
|
|
130
|
-
const work = await getConversationWorkState({
|
|
131
|
-
conversationId: childConversationId,
|
|
132
|
-
state: options.state
|
|
133
|
-
});
|
|
134
|
-
const running = new Set(work?.runningInboundMessageIds);
|
|
135
|
-
const waiting = new Set(options.includeWaiting ? [] : (work?.messages ?? []).map((message) => message.inboundMessageId).filter((id) => !running.has(id)));
|
|
136
|
-
const taken = (work?.execution.inboundMessageIds ?? []).filter((id) => !waiting.has(id));
|
|
137
|
-
if (taken.length === 0) return;
|
|
138
|
-
const sender = await readChildConversationSender(childConversationId);
|
|
139
|
-
if (!sender) return;
|
|
140
|
-
const keys = await getSqlExecutor().db().select({ idempotencyKey: juniorConversationEvents.idempotencyKey }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, sender.parentConversationId), inArray(juniorConversationEvents.idempotencyKey, taken.flatMap((id) => [`${SUBAGENT_STARTED_KEY_PREFIX}${id}`, `${SUBAGENT_ENDED_KEY_PREFIX}${id}`]))));
|
|
141
|
-
const found = new Set(keys.map((row) => row.idempotencyKey));
|
|
142
|
-
const open = taken.filter((id) => found.has(`${SUBAGENT_STARTED_KEY_PREFIX}${id}`) && !found.has(`${SUBAGENT_ENDED_KEY_PREFIX}${id}`));
|
|
143
|
-
if (open.length > 0) await appendSubagentEnded(sender.parentConversationId, open, outcome, options.nowMs ?? Date.now());
|
|
144
|
-
}
|
|
145
|
-
async function appendSubagentEnded(parentConversationId, markerIds, outcome, createdAtMs) {
|
|
146
|
-
await getConversationEventStore().append(parentConversationId, markerIds.map((id) => ({
|
|
147
|
-
idempotencyKey: `${SUBAGENT_ENDED_KEY_PREFIX}${id}`,
|
|
148
|
-
data: {
|
|
149
|
-
type: "subagent_ended",
|
|
150
|
-
subagentInvocationId: id,
|
|
151
|
-
outcome
|
|
152
|
-
},
|
|
153
|
-
createdAtMs
|
|
154
|
-
})));
|
|
155
|
-
}
|
|
156
|
-
// src/chat/agent-invocations/parent-result.ts
|
|
157
|
-
/**
|
|
158
|
-
* Return the Actor that a child Turn's update carries to its parent, whose
|
|
159
|
-
* Turn for it runs as that Actor. Only a Turn that agent work started, a
|
|
160
|
-
* parent message or an Event such as a child result, keeps its Actor. Any
|
|
161
|
-
* other Turn, such as a person's Turn in a Thread or a saved Turn with no
|
|
162
|
-
* Source, reports as the Event system Actor, so the parent never gets a
|
|
163
|
-
* person's access.
|
|
164
|
-
*/
|
|
165
|
-
function parentResultActor(actor, source) {
|
|
166
|
-
return source === "parent_message" || source === "event" ? actor : EVENT_SYSTEM_ACTOR;
|
|
167
|
-
}
|
|
168
|
-
// src/chat/agent-invocations/list.ts
|
|
105
|
+
// src/chat/child-agents/list.ts
|
|
169
106
|
const childConversationKindSchema = z.enum(["thread", "task"]);
|
|
170
107
|
/** Bound the child agents that one listing reads. */
|
|
171
108
|
const CHILD_AGENT_LIST_LIMIT = 200;
|
|
@@ -174,21 +111,24 @@ const CHILD_AGENT_LIST_LIMIT = 200;
|
|
|
174
111
|
* activity first. The state comes from each child's Turns and mailbox, not
|
|
175
112
|
* from model output. Each child agent stores its agent config, so older
|
|
176
113
|
* children of a parent, such as ones that a removed feature created, are not
|
|
177
|
-
* listed. A child is `running` while a Turn or
|
|
178
|
-
* parent is open,
|
|
179
|
-
*
|
|
180
|
-
*
|
|
114
|
+
* listed. A child is `stopped` while stopped, `running` while a Turn or
|
|
115
|
+
* mailbox input that answers its parent is open, `failed` when its stored
|
|
116
|
+
* execution failed, such as when its worker gave up and no Turn ended, and
|
|
117
|
+
* else `idle`.
|
|
118
|
+
* `lastResult` is how its newest finished Turn that was not stopped ended:
|
|
119
|
+
* the status that `readTurnUpdate` gives it, or `failed`.
|
|
181
120
|
*/
|
|
182
121
|
async function listChildAgents(parentConversationId) {
|
|
183
122
|
const rows = await getSqlExecutor().db().select({
|
|
184
123
|
agentName: juniorAgentBindings.name,
|
|
185
124
|
archivedAt: juniorConversations.archivedAt,
|
|
186
125
|
conversationId: juniorConversations.conversationId,
|
|
126
|
+
executionStatus: juniorConversations.executionStatus,
|
|
187
127
|
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
188
128
|
kind: juniorConversations.kind,
|
|
129
|
+
lastTurnOutcome: conversationLastTurnOutcomeSql(juniorConversations),
|
|
189
130
|
stoppedAt: juniorConversations.stoppedAt,
|
|
190
131
|
title: juniorConversations.title,
|
|
191
|
-
turnFailed: conversationTurnFailedSql(juniorConversations),
|
|
192
132
|
updatedAt: juniorConversations.updatedAt
|
|
193
133
|
}).from(juniorConversations).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(and(eq(juniorConversations.parentConversationId, parentConversationId), isNotNull(juniorConversations.agentConfig))).orderBy(desc(sql`coalesce(${juniorConversations.executionUpdatedAt}, ${juniorConversations.updatedAt})`)).limit(CHILD_AGENT_LIST_LIMIT);
|
|
194
134
|
const ids = rows.map((row) => row.conversationId);
|
|
@@ -198,14 +138,15 @@ async function listChildAgents(parentConversationId) {
|
|
|
198
138
|
const kind = childConversationKindSchema.parse(row.kind);
|
|
199
139
|
const stoppedAtMs = row.stoppedAt?.getTime();
|
|
200
140
|
const running = stoppedAtMs === void 0 && await limit(() => runsOnConversationLoop(workStates.get(row.conversationId)?.execution.pendingMessages ?? [], mailboxTurnSources.get(row.conversationId) ?? []));
|
|
141
|
+
const outcome = row.lastTurnOutcome;
|
|
142
|
+
const lastResult = outcome === "failed" ? "failed" : outcome ? TURN_OUTCOME_STATUSES[outcome] : void 0;
|
|
201
143
|
return {
|
|
202
144
|
...row.agentName ? { agentName: row.agentName } : void 0,
|
|
203
145
|
...row.archivedAt ? { archivedAtMs: row.archivedAt.getTime() } : void 0,
|
|
204
146
|
childConversationId: row.conversationId,
|
|
205
147
|
kind,
|
|
206
|
-
...
|
|
207
|
-
status: stoppedAtMs !== void 0 ? "stopped" : running ? "running" : row.
|
|
208
|
-
task: row.title ?? "",
|
|
148
|
+
...lastResult ? { lastResult } : void 0,
|
|
149
|
+
status: stoppedAtMs !== void 0 ? "stopped" : running ? "running" : row.executionStatus === "failed" ? "failed" : "idle",
|
|
209
150
|
...row.title ? { title: row.title } : void 0,
|
|
210
151
|
updatedAtMs: (row.executionUpdatedAt ?? row.updatedAt).getTime()
|
|
211
152
|
};
|
|
@@ -292,4 +233,78 @@ async function listAgentRelatives(input) {
|
|
|
292
233
|
siblings: family.filter((agent) => agent.childConversationId !== conversationId)
|
|
293
234
|
};
|
|
294
235
|
}
|
|
295
|
-
|
|
236
|
+
// src/chat/child-agents/markers.ts
|
|
237
|
+
const SUBAGENT_KIND = "agent";
|
|
238
|
+
const SUBAGENT_STARTED_KEY_PREFIX = "subagent_started:";
|
|
239
|
+
const SUBAGENT_ENDED_KEY_PREFIX = "subagent_ended:";
|
|
240
|
+
/**
|
|
241
|
+
* Record in the parent Conversation that a child agent got one task or
|
|
242
|
+
* message. Write it before the input reaches the child's mailbox, so the
|
|
243
|
+
* child cannot end first.
|
|
244
|
+
*/
|
|
245
|
+
async function recordSubagentStartedMarker(start) {
|
|
246
|
+
await getConversationEventStore().append(start.parentConversationId, [{
|
|
247
|
+
idempotencyKey: `${SUBAGENT_STARTED_KEY_PREFIX}${start.markerId}`,
|
|
248
|
+
data: {
|
|
249
|
+
type: "subagent_started",
|
|
250
|
+
subagentInvocationId: start.markerId,
|
|
251
|
+
subagentKind: SUBAGENT_KIND,
|
|
252
|
+
childConversationId: start.childConversationId,
|
|
253
|
+
...start.agentName ? { agentName: start.agentName } : void 0,
|
|
254
|
+
parentToolCallId: start.parentToolCallId,
|
|
255
|
+
task: start.input,
|
|
256
|
+
...start.title ? { title: start.title } : void 0,
|
|
257
|
+
...start.reasoningLevel ? { reasoningLevel: start.reasoningLevel } : void 0
|
|
258
|
+
},
|
|
259
|
+
createdAtMs: start.createdAtMs
|
|
260
|
+
}]);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Record in the parent Conversation how the work of a child agent ended.
|
|
264
|
+
* Each parent message has its own `subagent_started` marker, named by the
|
|
265
|
+
* message id, and each one that the child already took ends with `outcome`.
|
|
266
|
+
* A parent message that still waits in the child's mailbox stays open,
|
|
267
|
+
* because later work reads it, unless `includeWaiting` is set, as for a stop
|
|
268
|
+
* that skips it. Write it before the child's result reaches the parent.
|
|
269
|
+
*/
|
|
270
|
+
async function recordChildAgentEnded(childConversationId, outcome, options = {}) {
|
|
271
|
+
if (!await readAgentConfig(childConversationId)) return;
|
|
272
|
+
const work = await getConversationWorkState({
|
|
273
|
+
conversationId: childConversationId,
|
|
274
|
+
state: options.state
|
|
275
|
+
});
|
|
276
|
+
const running = new Set(work?.runningInboundMessageIds);
|
|
277
|
+
const waiting = new Set(options.includeWaiting ? [] : (work?.messages ?? []).map((message) => message.inboundMessageId).filter((id) => !running.has(id)));
|
|
278
|
+
const taken = (work?.execution.inboundMessageIds ?? []).filter((id) => !waiting.has(id));
|
|
279
|
+
if (taken.length === 0) return;
|
|
280
|
+
const sender = await readChildConversationSender(childConversationId);
|
|
281
|
+
if (!sender) return;
|
|
282
|
+
const keys = await getSqlExecutor().db().select({ idempotencyKey: juniorConversationEvents.idempotencyKey }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, sender.parentConversationId), inArray(juniorConversationEvents.idempotencyKey, taken.flatMap((id) => [`${SUBAGENT_STARTED_KEY_PREFIX}${id}`, `${SUBAGENT_ENDED_KEY_PREFIX}${id}`]))));
|
|
283
|
+
const found = new Set(keys.map((row) => row.idempotencyKey));
|
|
284
|
+
const open = taken.filter((id) => found.has(`${SUBAGENT_STARTED_KEY_PREFIX}${id}`) && !found.has(`${SUBAGENT_ENDED_KEY_PREFIX}${id}`));
|
|
285
|
+
if (open.length > 0) await appendSubagentEnded(sender.parentConversationId, open, outcome, options.nowMs ?? Date.now());
|
|
286
|
+
}
|
|
287
|
+
async function appendSubagentEnded(parentConversationId, markerIds, outcome, createdAtMs) {
|
|
288
|
+
await getConversationEventStore().append(parentConversationId, markerIds.map((id) => ({
|
|
289
|
+
idempotencyKey: `${SUBAGENT_ENDED_KEY_PREFIX}${id}`,
|
|
290
|
+
data: {
|
|
291
|
+
type: "subagent_ended",
|
|
292
|
+
subagentInvocationId: id,
|
|
293
|
+
outcome
|
|
294
|
+
},
|
|
295
|
+
createdAtMs
|
|
296
|
+
})));
|
|
297
|
+
}
|
|
298
|
+
// src/chat/child-agents/parent-result.ts
|
|
299
|
+
/**
|
|
300
|
+
* Return the Actor that a child Turn's update carries to its parent, whose
|
|
301
|
+
* Turn for it runs as that Actor. Only a Turn that agent work started, a
|
|
302
|
+
* parent message or an Event such as a child result, keeps its Actor. Any
|
|
303
|
+
* other Turn, such as a person's Turn in a Thread or a saved Turn with no
|
|
304
|
+
* Source, reports as the Event system Actor, so the parent never gets a
|
|
305
|
+
* person's access.
|
|
306
|
+
*/
|
|
307
|
+
function parentResultActor(actor, source) {
|
|
308
|
+
return source === "parent_message" || source === "event" ? actor : EVENT_SYSTEM_ACTOR;
|
|
309
|
+
}
|
|
310
|
+
export { listChildAgents as a, listUnreportedSiblingAgents as c, isChildAgentEvent as d, isDroppedChildInput as f, listAgentRelatives as i, childAgentInput as l, readChildConversationSender as m, recordChildAgentEnded as n, listDescendantAgents as o, isStopResult as p, recordSubagentStartedMarker as r, listOpenChildAgents as s, parentResultActor as t, getChildAgentInputSender as u };
|
|
@@ -89,7 +89,7 @@ function pluginCatalogConfigFromEnv(env = process.env) {
|
|
|
89
89
|
}
|
|
90
90
|
/** Return registrations that expose in-process runtime code. */
|
|
91
91
|
function pluginRuntimeRegistrationsFromPluginSet(pluginSet) {
|
|
92
|
-
return pluginSet?.registrations.filter((plugin) => plugin.codeLinks || plugin.hooks || plugin.images || plugin.tasks || plugin.userPages?.length || plugin.objectLinks?.length) ?? [];
|
|
92
|
+
return pluginSet?.registrations.filter((plugin) => plugin.codeLinks || plugin.hooks || plugin.images || plugin.tasks || plugin.userPages?.length || plugin.objectLinks?.length || plugin.inboxSubjects?.length) ?? [];
|
|
93
93
|
}
|
|
94
94
|
/** Return registrations that expose host CLI commands. */
|
|
95
95
|
function pluginCliRegistrationsFromPluginSet(pluginSet) {
|