@sentry/junior 0.315.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-5jUYY46p.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-C7GNLRB6.js → agent-runner-AjrEV6Qe.js} +13532 -12811
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-B_YIZcgf.js} +10 -37
- package/dist/api/schema.d.ts +609 -104
- package/dist/api/schema.js +6 -6
- package/dist/api.js +373 -469
- package/dist/{app-D_bAXRDe.d.ts → app-MoNAsVV5.d.ts} +52 -28
- package/dist/app.d.ts +1 -1
- package/dist/app.js +177 -132
- 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-BlSGE44V.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-CxkwRpn9.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 +27 -5
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed--9S0_PXL.js} +9 -4
- package/dist/{proxy-path-Dc-0jXGi.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-BUE_7xaN.js} +102 -172
- package/dist/{create-BOycVH9h.js → create-DoDIYgtZ.js} +12 -10
- package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DXTOYRzR.js → db-BFmyYZtJ.js} +20276 -27398
- package/dist/{deployment-CG3TchWh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-dyWlfNdD.js → engine-context-CgQ7mlHt.js} +264 -50
- package/dist/{html-CfXEwl_h.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-CySgpi9v.js → job-runner-A1lCkybD.js} +397 -22
- package/dist/{lineage-tRTOcrsL.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-DXBz8SYL.js → list-Bxvg5wXf.js} +260 -698
- package/dist/{logging-czs0nqLC.js → logging--smS7XRK.js} +2 -2
- package/dist/{mailbox-turn-79Nv1JXv.js → mailbox-turn-uSXhUFc9.js} +648 -2957
- package/dist/{message-BTox2Cmb.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-IRGa98V7.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-NXK7AlBp.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{parent-result-Dg6P6roR.js → parent-result-Ck1rFYRQ.js} +93 -106
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-BHhJVY0P.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-BUFkmxkT.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-DfATzX77.js → result-Bta_dlWa.js} +42 -117
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-CmKP3inb.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-DrBMdPmv.js → schema-DfqrHACA.js} +67 -84
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-CxTX7nnR.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-BlHUDj7k.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-CfvlFdfz.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-CiXy0eNR.js} +91 -70
- package/dist/{task-runner-DcdQJd9e.js → task-runner-C9Yc2_ae.js} +35 -49
- package/dist/{thread-context-DF5uDcWN.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-um5Ubd4m.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-Cr9pGkzr.js → types-C4iC-IMC.js} +819 -777
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-CJyuOPD2.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-Bhe7RPIe.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-D8PRgUqr.js → worker-BqMQQNRk.js} +5 -4
- package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
- package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
- package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
- package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
- package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
- package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
- package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
- package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
- package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
- package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
- 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/skills/jr-rpc/SKILL.md +3 -5
- package/dist/direct-url-BYgYfuIy.js +0 -22
- package/dist/markers-CE0HMXWT.js +0 -67
- package/dist/people-Cegp1Iwq.js +0 -81
- package/dist/start-conversation-Uh8Sk1EF.js +0 -162
- package/dist/turn-session-routing-GtetHsdO.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,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { G as mapBounded } from "./transcript-BHhJVY0P.js";
|
|
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";
|
|
6
5
|
import * as z from "zod";
|
|
7
|
-
import
|
|
8
|
-
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
9
|
-
import { and, desc, eq, isNotNull, ne, sql } from "drizzle-orm";
|
|
6
|
+
import { and, desc, eq, inArray, isNotNull, ne, sql } from "drizzle-orm";
|
|
10
7
|
import { alias } from "drizzle-orm/pg-core";
|
|
11
|
-
|
|
8
|
+
import pLimit from "p-limit";
|
|
9
|
+
// src/chat/child-agents/child-input.ts
|
|
12
10
|
function childAgentInputKind(namespace, eventType, watchId) {
|
|
13
11
|
if (namespace !== "junior" || !eventType) return;
|
|
14
12
|
if (eventType === "agent.message") return "message";
|
|
@@ -25,6 +23,15 @@ function childAgentInput(message) {
|
|
|
25
23
|
} : void 0;
|
|
26
24
|
}
|
|
27
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
|
+
/**
|
|
28
35
|
* Whether the saved Event fields of a Turn's input Message name a child
|
|
29
36
|
* agent's reply or message. A new and a resumed Turn read the same fields.
|
|
30
37
|
*/
|
|
@@ -62,7 +69,7 @@ async function isDroppedChildInput(message) {
|
|
|
62
69
|
*/
|
|
63
70
|
async function isSkippedReply(message) {
|
|
64
71
|
const sender = readInboundMessageSender(message);
|
|
65
|
-
if (!sender ||
|
|
72
|
+
if (!sender || isStopResult(message)) return false;
|
|
66
73
|
const senderStoppedAtMs = await getConversationStoppedAtMs(sender.conversationId);
|
|
67
74
|
return senderStoppedAtMs !== void 0 && message.createdAtMs >= senderStoppedAtMs;
|
|
68
75
|
}
|
|
@@ -75,62 +82,28 @@ async function readChildConversationSender(childConversationId) {
|
|
|
75
82
|
const [row] = await getSqlExecutor().db().select({
|
|
76
83
|
agentName: juniorAgentBindings.name,
|
|
77
84
|
parentConversationId: parent.conversationId,
|
|
85
|
+
parentKind: parent.kind,
|
|
78
86
|
title: juniorConversations.title
|
|
79
87
|
}).from(juniorConversations).innerJoin(parent, eq(parent.conversationId, juniorConversations.parentConversationId)).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(eq(juniorConversations.conversationId, childConversationId));
|
|
80
88
|
return row ? {
|
|
81
89
|
...row.agentName ? { agentName: row.agentName } : void 0,
|
|
82
90
|
childConversationId,
|
|
83
91
|
parentConversationId: row.parentConversationId,
|
|
92
|
+
...row.parentKind ? { parentKind: row.parentKind } : void 0,
|
|
84
93
|
...row.title ? { title: row.title } : void 0
|
|
85
94
|
} : void 0;
|
|
86
95
|
}
|
|
87
96
|
/**
|
|
88
97
|
* Read the sender of one reply or message, when it is a child of the
|
|
89
98
|
* Conversation that received it. Otherwise the input has no child sender,
|
|
90
|
-
* such as one that an
|
|
99
|
+
* such as one that an earlier release sent.
|
|
91
100
|
*/
|
|
92
101
|
async function getChildAgentInputSender(message, input) {
|
|
93
102
|
const sender = await readChildConversationSender(input.senderId);
|
|
94
103
|
return sender?.parentConversationId === message.conversationId ? sender : void 0;
|
|
95
104
|
}
|
|
96
|
-
// src/chat/
|
|
97
|
-
const
|
|
98
|
-
const agentNameSchema = exactStringSchema.max(64);
|
|
99
|
-
/**
|
|
100
|
-
* Kind of a new child Conversation. A Thread is a child that people can
|
|
101
|
-
* message; a Task is one that only its parent messages.
|
|
102
|
-
*/
|
|
103
|
-
const CHILD_AGENT_KINDS = ["thread", "task"];
|
|
104
|
-
/** `messageAgent` target for the parent of a child agent. */
|
|
105
|
-
const PARENT_AGENT_TARGET = "parent";
|
|
106
|
-
const agentBindingSchema = z.object({
|
|
107
|
-
childConversationId: exactStringSchema,
|
|
108
|
-
name: agentNameSchema,
|
|
109
|
-
parentConversationId: exactStringSchema
|
|
110
|
-
}).strict();
|
|
111
|
-
/** Input of one `startAgent` call that starts a child agent. */
|
|
112
|
-
const spawnChildAgentInputSchema = z.object({
|
|
113
|
-
actor: actorSchema,
|
|
114
|
-
agentName: agentNameSchema.optional(),
|
|
115
|
-
credentialContext: credentialContextSchema.optional(),
|
|
116
|
-
idempotencyKey: exactStringSchema,
|
|
117
|
-
input: exactStringSchema,
|
|
118
|
-
kind: z.enum(CHILD_AGENT_KINDS).default("task"),
|
|
119
|
-
parentConversationId: exactStringSchema,
|
|
120
|
-
parentToolCallId: exactStringSchema,
|
|
121
|
-
agentType: agentTypeSchema.optional(),
|
|
122
|
-
fork: z.literal(true).optional(),
|
|
123
|
-
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
124
|
-
title: exactStringSchema.optional()
|
|
125
|
-
}).strict();
|
|
126
|
-
/** How a finished task of a child agent ended. A stop is not a result. */
|
|
127
|
-
const CHILD_AGENT_RESULTS = [
|
|
128
|
-
"completed",
|
|
129
|
-
"blocked",
|
|
130
|
-
"failed"
|
|
131
|
-
];
|
|
132
|
-
// src/chat/agent-invocations/list.ts
|
|
133
|
-
const childAgentKindSchema = z.enum(CHILD_AGENT_KINDS);
|
|
105
|
+
// src/chat/child-agents/list.ts
|
|
106
|
+
const childConversationKindSchema = z.enum(["thread", "task"]);
|
|
134
107
|
/** Bound the child agents that one listing reads. */
|
|
135
108
|
const CHILD_AGENT_LIST_LIMIT = 200;
|
|
136
109
|
/**
|
|
@@ -138,38 +111,42 @@ const CHILD_AGENT_LIST_LIMIT = 200;
|
|
|
138
111
|
* activity first. The state comes from each child's Turns and mailbox, not
|
|
139
112
|
* from model output. Each child agent stores its agent config, so older
|
|
140
113
|
* children of a parent, such as ones that a removed feature created, are not
|
|
141
|
-
* listed. A child is `running` while a Turn or
|
|
142
|
-
* parent is open,
|
|
143
|
-
*
|
|
144
|
-
*
|
|
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`.
|
|
145
120
|
*/
|
|
146
121
|
async function listChildAgents(parentConversationId) {
|
|
147
122
|
const rows = await getSqlExecutor().db().select({
|
|
148
123
|
agentName: juniorAgentBindings.name,
|
|
149
124
|
archivedAt: juniorConversations.archivedAt,
|
|
150
125
|
conversationId: juniorConversations.conversationId,
|
|
126
|
+
executionStatus: juniorConversations.executionStatus,
|
|
151
127
|
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
152
128
|
kind: juniorConversations.kind,
|
|
129
|
+
lastTurnOutcome: conversationLastTurnOutcomeSql(juniorConversations),
|
|
153
130
|
stoppedAt: juniorConversations.stoppedAt,
|
|
154
131
|
title: juniorConversations.title,
|
|
155
|
-
turnFailed: conversationTurnFailedSql(juniorConversations),
|
|
156
132
|
updatedAt: juniorConversations.updatedAt
|
|
157
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);
|
|
158
134
|
const ids = rows.map((row) => row.conversationId);
|
|
159
135
|
const [workStates, mailboxTurnSources] = await Promise.all([getConversationWorkStates(ids), listActiveMailboxTurnSources(ids)]);
|
|
160
136
|
const limit = pLimit(8);
|
|
161
137
|
return (await Promise.all(rows.map(async (row) => {
|
|
162
|
-
const kind =
|
|
138
|
+
const kind = childConversationKindSchema.parse(row.kind);
|
|
163
139
|
const stoppedAtMs = row.stoppedAt?.getTime();
|
|
164
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;
|
|
165
143
|
return {
|
|
166
144
|
...row.agentName ? { agentName: row.agentName } : void 0,
|
|
167
145
|
...row.archivedAt ? { archivedAtMs: row.archivedAt.getTime() } : void 0,
|
|
168
146
|
childConversationId: row.conversationId,
|
|
169
147
|
kind,
|
|
170
|
-
...
|
|
171
|
-
status: stoppedAtMs !== void 0 ? "stopped" : running ? "running" : row.
|
|
172
|
-
task: row.title ?? "",
|
|
148
|
+
...lastResult ? { lastResult } : void 0,
|
|
149
|
+
status: stoppedAtMs !== void 0 ? "stopped" : running ? "running" : row.executionStatus === "failed" ? "failed" : "idle",
|
|
173
150
|
...row.title ? { title: row.title } : void 0,
|
|
174
151
|
updatedAtMs: (row.executionUpdatedAt ?? row.updatedAt).getTime()
|
|
175
152
|
};
|
|
@@ -191,17 +168,6 @@ async function runsOnConversationLoop(pending, mailboxTurnSources) {
|
|
|
191
168
|
return false;
|
|
192
169
|
}
|
|
193
170
|
/**
|
|
194
|
-
* Return whether input waits in a child's mailbox that will run a later Turn
|
|
195
|
-
* that answers its parent, such as a fired Timer whose Watch is already gone.
|
|
196
|
-
* The input that the running attempt took belongs to its own Turn, which
|
|
197
|
-
* can ack it as late as its end.
|
|
198
|
-
*/
|
|
199
|
-
async function hasWaitingParentWork(conversationId) {
|
|
200
|
-
const work = await getConversationWorkState({ conversationId });
|
|
201
|
-
const running = new Set(work?.runningInboundMessageIds);
|
|
202
|
-
return await runsOnConversationLoop((work?.messages ?? []).filter((message) => !running.has(message.inboundMessageId)), []);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
171
|
* List the ids of a child's open Turns on the Conversation loop. A Turn keeps
|
|
206
172
|
* its input in the mailbox until it commits it, so before its first
|
|
207
173
|
* checkpoint its id comes from its first input. Attempt selection can take
|
|
@@ -267,32 +233,69 @@ async function listAgentRelatives(input) {
|
|
|
267
233
|
siblings: family.filter((agent) => agent.childConversationId !== conversationId)
|
|
268
234
|
};
|
|
269
235
|
}
|
|
270
|
-
// src/chat/
|
|
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:";
|
|
271
240
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
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.
|
|
274
244
|
*/
|
|
275
|
-
async function
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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
|
+
}]);
|
|
283
261
|
}
|
|
284
262
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* parent
|
|
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.
|
|
289
269
|
*/
|
|
290
|
-
async function
|
|
291
|
-
if (
|
|
292
|
-
|
|
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
|
+
})));
|
|
293
297
|
}
|
|
294
|
-
// src/chat/
|
|
295
|
-
var parent_result_exports = /* @__PURE__ */ __exportAll({ childWorkGoesOn: () => childWorkGoesOn });
|
|
298
|
+
// src/chat/child-agents/parent-result.ts
|
|
296
299
|
/**
|
|
297
300
|
* Return the Actor that a child Turn's update carries to its parent, whose
|
|
298
301
|
* Turn for it runs as that Actor. Only a Turn that agent work started, a
|
|
@@ -304,20 +307,4 @@ var parent_result_exports = /* @__PURE__ */ __exportAll({ childWorkGoesOn: () =>
|
|
|
304
307
|
function parentResultActor(actor, source) {
|
|
305
308
|
return source === "parent_message" || source === "event" ? actor : EVENT_SYSTEM_ACTOR;
|
|
306
309
|
}
|
|
307
|
-
|
|
308
|
-
* Return whether the work of a child agent goes on after a Turn ends: one
|
|
309
|
-
* of its own child agents still works, it has an active Watch or Timer, or
|
|
310
|
-
* input waits to run a later Turn. A `noReply` end then has nothing new for
|
|
311
|
-
* the agent that started it, which waits for the child's last word. A root
|
|
312
|
-
* has no starter, so its work never goes on here.
|
|
313
|
-
*/
|
|
314
|
-
async function childWorkGoesOn(conversationId) {
|
|
315
|
-
if (!await readChildConversationSender(conversationId)) return false;
|
|
316
|
-
const [stillWorks, watches, waiting] = await Promise.all([
|
|
317
|
-
childAgentStillWorks(conversationId),
|
|
318
|
-
listWatches({ conversationId }),
|
|
319
|
-
hasWaitingParentWork(conversationId)
|
|
320
|
-
]);
|
|
321
|
-
return stillWorks || watches.length > 0 || waiting;
|
|
322
|
-
}
|
|
323
|
-
export { getChildAgentInputSender as _, listAgentRelatives as a, readChildConversationSender as b, listOpenChildAgents as c, CHILD_AGENT_RESULTS as d, PARENT_AGENT_TARGET as f, childAgentInput as g, spawnChildAgentInputSchema as h, getChildAgentLabel as i, listUnreportedSiblingAgents as l, agentNameSchema as m, parent_result_exports as n, listChildAgents as o, agentBindingSchema as p, childAgentStillWorks as r, listDescendantAgents as s, parentResultActor as t, CHILD_AGENT_KINDS as u, isChildAgentEvent as v, isDroppedChildInput as y };
|
|
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) {
|