@sentry/junior 0.310.0 → 0.312.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/{adapter-context-BhKpjpGD.js → adapter-context-BRjEWRy1.js} +2 -2
- package/dist/adapter-iIq7ihf7.js +259 -0
- package/dist/{admin-tgZEZAk2.js → admin-DhInw5K9.js} +1 -2
- package/dist/{agent-runner-D9cvNlQl.js → agent-runner-C9iDurwX.js} +6507 -7721
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -6
- package/dist/api.d.ts +21 -3
- package/dist/api.js +1625 -535
- package/dist/{app-B_7Wn0en.d.ts → app-DRFrC8Mw.d.ts} +14 -10
- package/dist/app.d.ts +2 -2
- package/dist/app.js +454 -994
- package/dist/{background-compaction-queue-BGHqkhkY.js → background-compaction-queue-DrKi7w3d.js} +10 -85
- package/dist/callback-mFlTUWWx.js +75 -0
- package/dist/{catalog-runtime-BxwzbLKY.js → catalog-runtime-D7xapBAX.js} +1 -1
- package/dist/channel-access-CJGfNTdn.js +221 -0
- package/dist/child-message-DcsritGf.js +179 -0
- package/dist/cli/chat.js +18 -19
- package/dist/cli/check.js +23 -29
- package/dist/cli/init.js +1 -7
- package/dist/cli/main.js +3 -7
- package/dist/cli/plugins.js +8 -7
- package/dist/cli/run.d.ts +1 -2
- package/dist/cli/run.js +1 -2
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-Dkt2Le2b.js → config-kXB2Y5tl.js} +294 -28
- package/dist/{continue-in-slack-BWVwePKD.js → continue-in-slack-O6pV5004.js} +7 -7
- package/dist/{conversation-feed-Ci6YD1N-.js → conversation-feed-uNOv_x68.js} +87 -24
- package/dist/{conversation-privacy-C39g8BY4.js → conversation-privacy-L4ja1_W6.js} +1 -1
- package/dist/{conversation-turn-CBlZIH02.js → conversation-turn-CeLbHqdw.js} +56 -49
- package/dist/{credential-sync-vGnrB0BY.js → credential-sync-I8VBGk05.js} +16 -16
- package/dist/{projection-jZSlEAXG.js → credentialed-Cb6E2phL.js} +16268 -16821
- package/dist/{db-B4Hjxr-u.d.ts → db-BbC5stfa.d.ts} +13 -6
- package/dist/{db-CFZggNoy.js → db-LAyyX8tk.js} +1698 -1046
- package/dist/{executor-BPkZDx5-.js → executor-SCub-fAq.js} +552 -181
- package/dist/{html-2r2KmLwi.js → html-BCZ3Xtb_.js} +6 -6
- package/dist/{session-stop-BfY4rhJs.js → ingest-BDf3D50j.js} +2134 -2553
- package/dist/{install-C-oE6C_u.js → install-DCFJFkC0.js} +2 -2
- package/dist/instrumentation.js +4 -4
- package/dist/{lineage-CsvrEFQe.js → lineage-B_m-4TJw.js} +2 -2
- package/dist/{stop-DYzjRf2U.js → list-CN2QA2R9.js} +1656 -685
- package/dist/{logging-D5gkyvnK.js → logging-dQ9ZRGQ8.js} +47 -9
- package/dist/media-CYm1QD8T.js +2356 -0
- package/dist/{message-DwvJ-I3w.js → message-DSXGj1hM.js} +19 -29
- package/dist/{model-input-MAq2881y.js → model-input--TrP9hYV.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -3
- package/dist/{oauth-callback-server-DIF6Li06.js → oauth-callback-server-DHCZC6B4.js} +2 -2
- package/dist/{oauth-relay-DPE-wrwO.js → oauth-relay-pPMGnDZt.js} +1 -1
- package/dist/{registry-BBkWFCl8.js → registry-CZOzddwu.js} +5 -8
- package/dist/{resolve-B38MkHXE.js → resolve-cKOQ14Dh.js} +3 -3
- package/dist/{result-BaqSZcJb.js → result-DcvEOe1r.js} +119 -93
- package/dist/result-event-type-BdIJuZxg.js +48 -0
- package/dist/rule-DAxQY-1h.js +20 -0
- package/dist/{runner-11h8PrHh.js → runner-DBfUW44l.js} +14 -16
- package/dist/{sandbox-egress-signals-CTcACAtJ.js → sandbox-egress-signals-BVF_xAm1.js} +1 -1
- package/dist/{schema-DriSvB40.d.ts → schema-BEHKxr4I.d.ts} +861 -298
- package/dist/{schema-obw5jvR4.js → schema-Bk9Nm2E8.js} +344 -153
- package/dist/{service-account-Bx93N1n1.js → service-account-CVYsFjty.js} +3 -3
- package/dist/{service-account-Zc5bUcIJ.js → service-account-Ts4ulcrV.js} +68 -68
- package/dist/{skills-C8Npu5zO.js → skills-VTnhAJWm.js} +2 -2
- package/dist/{slack-conversation-unfurl-DlRVA02H.js → slack-conversation-unfurl-fuLnF1jE.js} +9 -11
- package/dist/{spawn-CXr58R0x.js → spawn-vxAarlX5.js} +6 -6
- package/dist/start-conversation-CEn2KH1A.js +941 -0
- package/dist/{state-CGrGVeQC.js → state-C1P3_Ywk.js} +4 -4
- package/dist/statuses-_cRJHXK7.js +150 -0
- package/dist/store-DFZaN-Ix.js +492 -0
- package/dist/task-queue-Cx4Lmjyk.js +90 -0
- package/dist/task-runner-CbTwFA6k.js +1432 -0
- package/dist/{thread-context-Dyj1KWaY.js → thread-context-BkAZDTX2.js} +13 -11
- package/dist/thread-state-DhPndWi1.js +5625 -0
- package/dist/{validation-DxVNIxA0.js → validation-nIzMtAVJ.js} +1 -1
- package/dist/{task-queue-CaZffYaH.js → vercel-queue-hW90XzbG.js} +93 -172
- package/dist/{version-Cr7Z71yG.js → version-Brbtz4Qf.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-C6LOZ2d2.js → warmup-BDA5myRK.js} +5832 -4567
- package/dist/web-message-id-C6P83ans.js +10 -0
- package/dist/{worker-CUBtu1Li.js → worker-D63RcaVD.js} +20 -8
- package/migrations/0126_artifact_drop_public.sql +8 -0
- package/migrations/0127_artifact_path.sql +4 -0
- package/migrations/0128_artifact_path_index.sql +1 -0
- package/migrations/0129_review_item_answered_index.sql +1 -0
- package/migrations/0130_review_item_status_index.sql +1 -0
- package/migrations/0131_brief_outcome_status.sql +1 -0
- package/migrations/0132_brief_outcome_status_backfill.sql +7 -0
- package/migrations/0133_brief_created_at_index.sql +1 -0
- package/migrations/0134_slack_person_search_index.sql +1 -0
- package/migrations/0135_code_change_size.sql +3 -0
- package/migrations/0136_merge_conflict_notice_dismiss.sql +16 -0
- package/migrations/0137_inbox_snoozes.sql +27 -0
- package/migrations/0138_code_change_search_index.sql +2 -0
- package/migrations/0139_review_item_owner.sql +22 -0
- package/migrations/0140_review_item_owner_index.sql +1 -0
- package/migrations/0141_memory_core_adoption.sql +89 -0
- package/migrations/0142_memory_core_indexes.sql +17 -0
- package/migrations/0143_todos.sql +14 -0
- package/migrations/0144_inbox_items.sql +32 -0
- package/migrations/0145_todo_changed_by_agent.sql +1 -0
- package/migrations/0146_inbox_item_subject_title_parts.sql +1 -0
- package/migrations/0147_inbox_snooze_wake_reason.sql +1 -0
- package/migrations/0148_authorization_request_index.sql +1 -0
- package/migrations/0149_conversation_metadata.sql +10 -0
- package/migrations/0150_conversation_metadata_fill.sql +39 -0
- package/migrations/0151_conversation_search_index.sql +1 -0
- package/migrations/0152_inbox_item_legacy_automation_keys.sql +21 -0
- package/migrations/0153_artifact_expiry.sql +1 -0
- package/migrations/0154_artifact_permanent_sha_index.sql +1 -0
- package/migrations/0155_artifact_drop_public_sha_index.sql +3 -0
- package/migrations/0156_conversation_kind_lead.sql +6 -0
- package/migrations/0157_conversation_lead_actor_index.sql +1 -0
- package/migrations/meta/0126_snapshot.json +5488 -0
- package/migrations/meta/0127_snapshot.json +5519 -0
- package/migrations/meta/0128_snapshot.json +5519 -0
- package/migrations/meta/0129_snapshot.json +5547 -0
- package/migrations/meta/0130_snapshot.json +5563 -0
- package/migrations/meta/0131_snapshot.json +5569 -0
- package/migrations/meta/0132_snapshot.json +5569 -0
- package/migrations/meta/0133_snapshot.json +5590 -0
- package/migrations/meta/0134_snapshot.json +5606 -0
- package/migrations/meta/0135_snapshot.json +5624 -0
- package/migrations/meta/0136_snapshot.json +5624 -0
- package/migrations/meta/0137_snapshot.json +5864 -0
- package/migrations/meta/0138_snapshot.json +5894 -0
- package/migrations/meta/0139_snapshot.json +5898 -0
- package/migrations/meta/0140_snapshot.json +5919 -0
- package/migrations/meta/0141_snapshot.json +6429 -0
- package/migrations/meta/0142_snapshot.json +6457 -0
- package/migrations/meta/0143_snapshot.json +6434 -0
- package/migrations/meta/0144_snapshot.json +6434 -0
- package/migrations/meta/0145_snapshot.json +6440 -0
- package/migrations/meta/0146_snapshot.json +6446 -0
- package/migrations/meta/0147_snapshot.json +6452 -0
- package/migrations/meta/0148_snapshot.json +6474 -0
- package/migrations/meta/0149_snapshot.json +6490 -0
- package/migrations/meta/0150_snapshot.json +6490 -0
- package/migrations/meta/0151_snapshot.json +6505 -0
- package/migrations/meta/0152_snapshot.json +6505 -0
- package/migrations/meta/0153_snapshot.json +6511 -0
- package/migrations/meta/0154_snapshot.json +6533 -0
- package/migrations/meta/0155_snapshot.json +6511 -0
- package/migrations/meta/0156_snapshot.json +6511 -0
- package/migrations/meta/0157_snapshot.json +6527 -0
- package/migrations/meta/_journal.json +224 -0
- package/package.json +7 -8
- package/skills/design-automation-skill/SKILL.md +108 -0
- package/dist/briefs-DKxkoruh.js +0 -395
- package/dist/conversation-M9KZ5JxF.js +0 -1024
- package/dist/prompt-CaMyeCpA.js +0 -910
- package/dist/schedule-DWxZ3kja.js +0 -1146
- package/dist/store-D4FQ1Nml.js +0 -335
- package/dist/task-runner-Dm7BHbGp.js +0 -287
- package/dist/turn-session-routing-CD0BRCex.js +0 -263
- package/dist/turn-user-message-9IxeEv5v.js +0 -364
- package/dist/users-CaUAYMb3.js +0 -181
- package/dist/viewer-AHldghAD.js +0 -212
- package/dist/web-message-id-BT8Mg8LL.js +0 -418
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as enqueueAgentMessageToParent } from "./result-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-D4FQ1Nml.js";
|
|
2
|
+
import { A as actorFromRun, j as toolInvocationDestination } from "./agent-runner-C9iDurwX.js";
|
|
3
|
+
import { $t as createAgentInvocationForMessage, Et as getActiveAgentInvocationForConversation, Zt as enqueueAgentInvocation, an as PARENT_AGENT_TARGET, kt as getLatestAgentInvocationForConversation, nn as AgentMessageTargetError, rn as findChildAgentConversationId, zt as readChildConversationSender } from "./warmup-BDA5myRK.js";
|
|
4
|
+
import { a as enqueueAgentMessageToParent } from "./result-DcvEOe1r.js";
|
|
5
|
+
import { Qt as SYSTEM_IDENTITY_ID, a as getConversationStore, mn as canAccessConversation, o as getDb, yn as readConversationAccessFromSql } from "./db-LAyyX8tk.js";
|
|
6
|
+
import { E as enqueueAutomatedInput, p as EVENT_WAIT_MS } from "./ingest-BDf3D50j.js";
|
|
7
|
+
import { it as renderUntrustedTag } from "./config-kXB2Y5tl.js";
|
|
8
|
+
import { i as leadPersonParticipates } from "./start-conversation-CEn2KH1A.js";
|
|
10
9
|
// src/chat/agent-invocations/top-level-message.ts
|
|
11
10
|
const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
|
|
12
11
|
/** Event type of a message from another top-level agent. */
|
|
@@ -15,7 +14,9 @@ const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
|
|
|
15
14
|
* Check that a top-level agent can message another top-level agent under
|
|
16
15
|
* `policies/conversation-access.md`. Public agents can message each other.
|
|
17
16
|
* A private agent can message only agents at its own Destination, such as
|
|
18
|
-
* another thread in the same private Slack channel.
|
|
17
|
+
* another thread in the same private Slack channel. A Lead can also message
|
|
18
|
+
* a public root where its person is a Participant, so it can steer the
|
|
19
|
+
* person's work.
|
|
19
20
|
* Every target that the sender cannot reach gets the same error, so the
|
|
20
21
|
* error does not show that a private Conversation exists.
|
|
21
22
|
*/
|
|
@@ -33,7 +34,10 @@ async function requireTopLevelAgentAccess(args) {
|
|
|
33
34
|
requester: sender,
|
|
34
35
|
target: receiver
|
|
35
36
|
})) throw notReachable;
|
|
36
|
-
if (receiver.visibility === "public" && sender.visibility !== "public"
|
|
37
|
+
if (receiver.visibility === "public" && sender.visibility !== "public" && !await leadPersonParticipates({
|
|
38
|
+
leadConversationId: args.senderConversationId,
|
|
39
|
+
rootConversationId: args.to
|
|
40
|
+
})) 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`);
|
|
37
41
|
}
|
|
38
42
|
function renderTopLevelMessageInput(args) {
|
|
39
43
|
return renderUntrustedTag("agent-message", {
|
|
@@ -43,28 +47,14 @@ function renderTopLevelMessageInput(args) {
|
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
49
|
* Send one message from a top-level agent to another top-level agent and
|
|
46
|
-
* wake the target. The access check runs on each call. A
|
|
47
|
-
*
|
|
48
|
-
* other running. Repeat calls with the same
|
|
50
|
+
* wake the target. The access check runs on each call. A stopped target
|
|
51
|
+
* holds the message, so once the automated-turn limit stops one of two
|
|
52
|
+
* agents, they cannot keep each other running. Repeat calls with the same
|
|
53
|
+
* `messageKey` are safe.
|
|
49
54
|
*/
|
|
50
55
|
async function enqueueTopLevelAgentMessage(args) {
|
|
51
56
|
await requireTopLevelAgentAccess(args);
|
|
52
57
|
const nowMs = args.nowMs ?? Date.now();
|
|
53
|
-
const maxTurns = botConfig.maxConsecutiveAutomatedTurns;
|
|
54
|
-
const decision = await admitAutomatedTurn({
|
|
55
|
-
conversationId: args.to,
|
|
56
|
-
maxTurns,
|
|
57
|
-
nowMs,
|
|
58
|
-
state: args.state
|
|
59
|
-
});
|
|
60
|
-
if (decision.status === "paused") {
|
|
61
|
-
if (decision.shouldPostNotice) await postAutomatedTurnLimitNoticeForConversation({
|
|
62
|
-
conversationId: args.to,
|
|
63
|
-
maxTurns,
|
|
64
|
-
nowMs
|
|
65
|
-
});
|
|
66
|
-
throw new AgentMessagePausedError(args.to);
|
|
67
|
-
}
|
|
68
58
|
const inboundMessageId = `agent-message:${args.senderConversationId}:${args.messageKey}`;
|
|
69
59
|
const summary = `Top-level agent ${args.senderConversationId} sent a message.`;
|
|
70
60
|
const metadata = {
|
|
@@ -77,7 +67,7 @@ async function enqueueTopLevelAgentMessage(args) {
|
|
|
77
67
|
trustedSummary: summary
|
|
78
68
|
}
|
|
79
69
|
};
|
|
80
|
-
await
|
|
70
|
+
await enqueueAutomatedInput({
|
|
81
71
|
message: {
|
|
82
72
|
conversationId: args.to,
|
|
83
73
|
createdAtMs: nowMs,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { s as getSqlExecutor } from "./db-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { s as getSqlExecutor } from "./db-LAyyX8tk.js";
|
|
3
|
+
import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-CYm1QD8T.js";
|
|
4
|
+
import { i as readLiveAttachment } from "./store-DFZaN-Ix.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 { i as JuniorDashboardOptions } from "./app-
|
|
2
|
+
import { i as JuniorDashboardOptions } from "./app-DRFrC8Mw.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
1
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DD9vencX.js";
|
|
2
2
|
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-Bkk0XRo2.js";
|
|
3
|
-
import { a as CACHE_WARMUP_QUEUE_TOPIC,
|
|
4
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-
|
|
5
|
-
import {
|
|
3
|
+
import { a as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./background-compaction-queue-DrKi7w3d.js";
|
|
4
|
+
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Cx4Lmjyk.js";
|
|
5
|
+
import { n as resolveConversationWorkQueueTopic } from "./vercel-queue-hW90XzbG.js";
|
|
6
|
+
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, B as getDeploymentServiceVersion, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./logging-dQ9ZRGQ8.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";
|
|
@@ -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-I8VBGk05.js";
|
|
2
|
+
import { r as createUserTokenStore } from "./credentialed-Cb6E2phL.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 { f as readJuniorSecret } from "./vercel-queue-hW90XzbG.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { SignJWT, jwtVerify } from "jose";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DD9vencX.js";
|
|
2
|
-
import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-
|
|
2
|
+
import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-dQ9ZRGQ8.js";
|
|
3
3
|
import { o as isUserActor, s as parseActorUserId } from "./actor-BsBdxDXQ.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import path from "node:path";
|
|
@@ -10,9 +10,6 @@ import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
|
10
10
|
function setDefined$1(target, key, value) {
|
|
11
11
|
if (value !== void 0) target[key] = value;
|
|
12
12
|
}
|
|
13
|
-
function isRecord(value) {
|
|
14
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
15
|
-
}
|
|
16
13
|
function unqualifyManifestToken(name, value) {
|
|
17
14
|
if (typeof name === "string" && typeof value === "string" && value.startsWith(`${name}.`)) return value.slice(name.length + 1);
|
|
18
15
|
return value;
|
|
@@ -22,7 +19,7 @@ function inlineTokenListSource(name, values) {
|
|
|
22
19
|
return values.map((value) => unqualifyManifestToken(name, value));
|
|
23
20
|
}
|
|
24
21
|
function inlineCredentialsSource(credentials) {
|
|
25
|
-
if (credentials ===
|
|
22
|
+
if (typeof credentials !== "object" || credentials === null || Array.isArray(credentials)) return credentials;
|
|
26
23
|
const result = {};
|
|
27
24
|
setDefined$1(result, "type", credentials.type);
|
|
28
25
|
setDefined$1(result, "domains", credentials.domains);
|
|
@@ -57,7 +54,7 @@ function accountsSource(accounts) {
|
|
|
57
54
|
return result;
|
|
58
55
|
}
|
|
59
56
|
function inlineMcpSource(mcp) {
|
|
60
|
-
if (mcp ===
|
|
57
|
+
if (typeof mcp !== "object" || mcp === null || Array.isArray(mcp)) return mcp;
|
|
61
58
|
const result = {};
|
|
62
59
|
setDefined$1(result, "transport", mcp.transport);
|
|
63
60
|
setDefined$1(result, "url", mcp.url);
|
|
@@ -69,7 +66,7 @@ function inlineMcpSource(mcp) {
|
|
|
69
66
|
return result;
|
|
70
67
|
}
|
|
71
68
|
function inlineOauthSource(oauth) {
|
|
72
|
-
if (oauth ===
|
|
69
|
+
if (typeof oauth !== "object" || oauth === null || Array.isArray(oauth)) return oauth;
|
|
73
70
|
const result = {};
|
|
74
71
|
setDefined$1(result, "client-id-env", oauth.clientIdEnv);
|
|
75
72
|
setDefined$1(result, "client-secret-env", oauth.clientSecretEnv);
|
|
@@ -83,7 +80,7 @@ function inlineOauthSource(oauth) {
|
|
|
83
80
|
return result;
|
|
84
81
|
}
|
|
85
82
|
function inlineTargetSource(name, target) {
|
|
86
|
-
if (target ===
|
|
83
|
+
if (typeof target !== "object" || target === null || Array.isArray(target)) return target;
|
|
87
84
|
const result = {};
|
|
88
85
|
setDefined$1(result, "type", target.type);
|
|
89
86
|
setDefined$1(result, "config-key", unqualifyManifestToken(name, target.configKey));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as trace, n as postinstall, o as getSandboxResources, t as dependencies } from "./install-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as trace, n as postinstall, o as getSandboxResources, t as dependencies } from "./install-DCFJFkC0.js";
|
|
2
|
+
import { Jt as create, Qt as getSandboxProvider, Xt as isStale, zo as sleep } from "./credentialed-Cb6E2phL.js";
|
|
3
|
+
import { i as getStateAdapter } from "./adapter-iIq7ihf7.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
// src/chat/sandbox/snapshot/resolve.ts
|
|
6
6
|
const SNAPSHOT_CACHE_PREFIX = "junior:sandbox_snapshot_profile:v2";
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
2
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { p as credentialContextForActor } from "./registry-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
3
|
+
import { F as turnBehavior, Qt as SYSTEM_IDENTITY_ID, a as getConversationStore, s as getSqlExecutor } from "./db-LAyyX8tk.js";
|
|
4
|
+
import { $ as eventInboxItemInputs, D as getConversationStoppedAtMs, E as enqueueAutomatedInput, _ as timerWatchCredentialSubject, a as getEventBatchDelayMs, c as parseEventMessages, g as renderEventBatchInputs, ht as closeOpenTodosOfChild, l as resolveMailboxTurnWork, m as eventBatchMessageMeta, p as EVENT_WAIT_MS, s as listActiveMailboxTurns } from "./ingest-BDf3D50j.js";
|
|
5
|
+
import { L as buildDeterministicTurnId, w as getConversationWorkState, xt as EVENT_SYSTEM_ACTOR } from "./thread-state-DhPndWi1.js";
|
|
6
|
+
import { p as credentialContextForActor } from "./registry-CZOzddwu.js";
|
|
7
|
+
import { At as isTerminalAgentInvocation, Bt as routeChildInput, Ct as NON_TERMINAL_AGENT_INVOCATION_STATUSES, Ft as reportReplacedWithoutOpenWork, Gt as parentMessageText, It as sendsResultToParent, Kt as readParentMessage, Lt as childAgentInput, Pt as markAgentInvocationParentMailboxAppended, Qt as resolveAgentInvocationId, Rt as getChildAgentInputSender, St as listUnreportedSiblingAgents, Tt as childAgentStillWorks, Wt as logDroppedParentMessage, Xt as endAgentInvocationsOfStoppedWork, Yt as endActiveAgentInvocations, Zt as enqueueAgentInvocation, en as createAgentInvocationFromLatest, jt as listAgentInvocationsForConversation, kt as getLatestAgentInvocationForConversation, qt as createAgentInvocationWorker, wt as TERMINAL_AGENT_INVOCATION_STATUSES, zt as readChildConversationSender } from "./warmup-BDA5myRK.js";
|
|
8
|
+
import { a as ownAgentInvocation, d as getAgentInvocationIdForResult, h as getAgentReplyMessageId, i as listChildMessages, l as getAgentInvocationIdForEvents, m as getAgentInvocationTurnId, n as hasAgentInvocationReply, p as getAgentInvocationResultMessageId, t as childMessageSenderMetadata, u as getAgentInvocationIdForMessage, v as getTurnReplyKey } from "./child-message-DcsritGf.js";
|
|
9
|
+
import { it as renderUntrustedTag } from "./config-kXB2Y5tl.js";
|
|
10
|
+
import { a as agentInvocationResultEventType, i as AGENT_REPLY_EVENT_TYPE, n as AGENT_MESSAGE_EVENT_TYPE, t as AGENT_INVOCATION_EVENT_NAMESPACE } from "./result-event-type-BdIJuZxg.js";
|
|
11
|
+
import * as z from "zod";
|
|
12
12
|
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
13
|
-
// src/chat/agent-invocations/result.ts
|
|
14
|
-
|
|
15
|
-
createChildConversationWorker: () => createChildConversationWorker,
|
|
16
|
-
createDeliverToParent: () => createDeliverToParent
|
|
17
|
-
});
|
|
18
|
-
const AGENT_INVOCATION_RESULT_MAX_LENGTH = 12e3;
|
|
13
|
+
// src/chat/agent-invocations/result-actors.ts
|
|
14
|
+
const senderActorMetadataSchema = z.object({ actor: actorSchema });
|
|
19
15
|
/**
|
|
20
16
|
* Return the Inbound message author id for results sent by one Actor.
|
|
21
17
|
* `selectContiguousTurnBatch` in `task-execution/worker.ts` puts messages in
|
|
@@ -31,6 +27,77 @@ function resultAuthorId(actor) {
|
|
|
31
27
|
default: return `agent-invocation:${actor.platform}:${actor.userId}`;
|
|
32
28
|
}
|
|
33
29
|
}
|
|
30
|
+
/** Read the Actor that a reply or message from a child without an Agent invocation carries. */
|
|
31
|
+
function senderActorFromMetadata(metadata) {
|
|
32
|
+
const parsed = senderActorMetadataSchema.safeParse(metadata);
|
|
33
|
+
return parsed.success ? parsed.data.actor : void 0;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Run each agent invocation result or message as the Actor that triggered the
|
|
37
|
+
* child, user or system, with its grants. This is on purpose: the result
|
|
38
|
+
* continues that Actor's work. The Actor comes from SQL when an agent
|
|
39
|
+
* invocation names the child, so the parent Turn has the same authority it
|
|
40
|
+
* had at spawn time. Otherwise the input carries it, and so does a parent
|
|
41
|
+
* task to a child.
|
|
42
|
+
* Input that a child's Turn with another Actor sent runs as the Event system
|
|
43
|
+
* Actor, so it never gets more authority than that Turn. A result that a stop
|
|
44
|
+
* skipped is dropped. Returns undefined when no input is left.
|
|
45
|
+
*/
|
|
46
|
+
async function withAgentInvocationResultActors(work) {
|
|
47
|
+
if (work.kind !== "mailbox") return work;
|
|
48
|
+
const conversationId = work.batch[0]?.message.conversationId;
|
|
49
|
+
const latest = conversationId ? await getLatestAgentInvocationForConversation(conversationId) : void 0;
|
|
50
|
+
const kept = (await mapBounded(work.batch, async (entry) => {
|
|
51
|
+
const parentMessage = readParentMessage(entry.message);
|
|
52
|
+
if (parentMessage) {
|
|
53
|
+
if (await routeChildInput(entry.message, latest) === "dropped") {
|
|
54
|
+
logDroppedParentMessage(entry.message, parentMessage);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const text = await parentMessageText(entry.message, parentMessage);
|
|
58
|
+
return {
|
|
59
|
+
...entry,
|
|
60
|
+
actor: parentMessage.actor,
|
|
61
|
+
requestText: entry.message.input.text.trim(),
|
|
62
|
+
...parentMessage.credentialContext ? { credentialContext: parentMessage.credentialContext } : void 0,
|
|
63
|
+
message: {
|
|
64
|
+
...entry.message,
|
|
65
|
+
input: {
|
|
66
|
+
...entry.message.input,
|
|
67
|
+
text
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const input = childAgentInput(entry.message);
|
|
73
|
+
if (!input) return entry;
|
|
74
|
+
if (await routeChildInput(entry.message, latest) === "dropped") return;
|
|
75
|
+
const { invocation } = await getChildAgentInputSender(entry.message, input);
|
|
76
|
+
const actor = invocation?.actor ?? senderActorFromMetadata(entry.message.input.metadata);
|
|
77
|
+
if (!actor || entry.message.input.authorId !== resultAuthorId(actor)) return {
|
|
78
|
+
...entry,
|
|
79
|
+
actor: EVENT_SYSTEM_ACTOR
|
|
80
|
+
};
|
|
81
|
+
return input.kind === "result" && invocation?.credentialContext ? {
|
|
82
|
+
...entry,
|
|
83
|
+
actor,
|
|
84
|
+
credentialContext: invocation.credentialContext
|
|
85
|
+
} : {
|
|
86
|
+
...entry,
|
|
87
|
+
actor
|
|
88
|
+
};
|
|
89
|
+
})).filter((entry) => entry !== void 0);
|
|
90
|
+
return kept.length > 0 ? {
|
|
91
|
+
kind: "mailbox",
|
|
92
|
+
batch: kept
|
|
93
|
+
} : void 0;
|
|
94
|
+
}
|
|
95
|
+
// src/chat/agent-invocations/result.ts
|
|
96
|
+
var result_exports = /* @__PURE__ */ __exportAll({
|
|
97
|
+
createChildConversationWorker: () => createChildConversationWorker,
|
|
98
|
+
createDeliverToParent: () => createDeliverToParent
|
|
99
|
+
});
|
|
100
|
+
const AGENT_INVOCATION_RESULT_MAX_LENGTH = 12e3;
|
|
34
101
|
/**
|
|
35
102
|
* Error messages can contain text from tools or providers, so the trusted
|
|
36
103
|
* summary in the mailbox metadata has only the status.
|
|
@@ -117,8 +184,8 @@ function buildResultInboundMessage(invocation, nowMs) {
|
|
|
117
184
|
* Append one terminal agent invocation result to the parent mailbox and wake
|
|
118
185
|
* the parent. Repeat calls are safe.
|
|
119
186
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
187
|
+
* A stopped parent holds the result. Result Turns count toward the
|
|
188
|
+
* automated-turn limit.
|
|
122
189
|
* TODO(dcramer): Add a per-parent total invocation limit as the loop guard
|
|
123
190
|
* for spawn -> result -> spawn chains (#881).
|
|
124
191
|
*/
|
|
@@ -132,7 +199,9 @@ async function enqueueAgentInvocationResult(invocation, options) {
|
|
|
132
199
|
if (replaced && isTerminalAgentInvocation(replaced)) await enqueueAgentInvocationResult(replaced, options);
|
|
133
200
|
return;
|
|
134
201
|
}
|
|
135
|
-
|
|
202
|
+
const resultMessageId = getAgentInvocationResultMessageId(invocation.invocationId);
|
|
203
|
+
if (!parentMessages.some((message) => message.inboundMessageId === resultMessageId)) await closeTodosForResult(invocation, invocation.status, nowMs);
|
|
204
|
+
await enqueueAutomatedInput({
|
|
136
205
|
message: buildResultInboundMessage(invocation, nowMs),
|
|
137
206
|
renderText: renderResultUnderLock(invocation, terminalResult(invocation)),
|
|
138
207
|
queue: options.queue,
|
|
@@ -142,6 +211,20 @@ async function enqueueAgentInvocationResult(invocation, options) {
|
|
|
142
211
|
await markAgentInvocationParentMailboxAppended(invocation.invocationId, nowMs);
|
|
143
212
|
}
|
|
144
213
|
/**
|
|
214
|
+
* Close the child's open To-dos of the parent before the parent reads the
|
|
215
|
+
* child's result: done when it completed, dropped when it stopped. A
|
|
216
|
+
* blocked or failed child did not finish that work.
|
|
217
|
+
*/
|
|
218
|
+
async function closeTodosForResult(sender, status, nowMs) {
|
|
219
|
+
if (status !== "completed" && status !== "stopped") return;
|
|
220
|
+
await closeOpenTodosOfChild(getSqlExecutor(), {
|
|
221
|
+
childConversationId: sender.childConversationId,
|
|
222
|
+
nowMs,
|
|
223
|
+
parentConversationId: sender.parentConversationId,
|
|
224
|
+
status: status === "completed" ? "done" : "dropped"
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
145
228
|
* Read every child reply and result that reached the parent's mailbox. A
|
|
146
229
|
* sibling whose `reply` is among them has answered.
|
|
147
230
|
*/
|
|
@@ -170,12 +253,6 @@ function senderEventMetadata(sender, actor, event) {
|
|
|
170
253
|
actor
|
|
171
254
|
};
|
|
172
255
|
}
|
|
173
|
-
/** Read the Actor that a reply or message from a child without an Agent invocation carries. */
|
|
174
|
-
function senderActorFromMetadata(metadata) {
|
|
175
|
-
const actor = metadata?.actor;
|
|
176
|
-
const parsed = actorSchema.safeParse(actor);
|
|
177
|
-
return parsed.success ? parsed.data : void 0;
|
|
178
|
-
}
|
|
179
256
|
function renderMessageInput(sender, text) {
|
|
180
257
|
return renderUntrustedTag("agent-message", {
|
|
181
258
|
conversation_id: sender.childConversationId,
|
|
@@ -202,7 +279,7 @@ async function enqueueAgentMessageToParent(args) {
|
|
|
202
279
|
namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
|
|
203
280
|
trustedSummary: summary
|
|
204
281
|
});
|
|
205
|
-
await
|
|
282
|
+
await enqueueAutomatedInput({
|
|
206
283
|
message: {
|
|
207
284
|
conversationId: args.sender.parentConversationId,
|
|
208
285
|
createdAtMs: nowMs,
|
|
@@ -230,7 +307,8 @@ const RESULT_SUMMARIES = {
|
|
|
230
307
|
/**
|
|
231
308
|
* Append the result of one child agent Turn to its parent mailbox and wake
|
|
232
309
|
* the parent: a `reply`, which the parent reads as a completed
|
|
233
|
-
* `<agent-result
|
|
310
|
+
* `<agent-result>` or, while the child still works, as a message, or a
|
|
311
|
+
* blocked or failed result. `sender` names the child:
|
|
234
312
|
* an agent invocation, open or not, or the child Conversation when none
|
|
235
313
|
* names it. `actor` is the Actor of the child's Turn; the parent never runs
|
|
236
314
|
* with more authority than it. The key of the result, the `reply` tool call
|
|
@@ -249,22 +327,30 @@ async function enqueueChildResultToParent(args) {
|
|
|
249
327
|
output: args.result.text,
|
|
250
328
|
status: args.result.kind
|
|
251
329
|
};
|
|
252
|
-
const
|
|
330
|
+
const replyTurn = {
|
|
253
331
|
...args.sender.invocationId ? { agentInvocationId: args.sender.invocationId } : void 0,
|
|
254
332
|
conversationId: args.sender.childConversationId,
|
|
255
333
|
turnId: args.turnId
|
|
256
334
|
};
|
|
335
|
+
const stillWorks = args.result.kind === "reply" && await childAgentStillWorks(args.sender.childConversationId, ownAgentInvocation(replyTurn));
|
|
336
|
+
const sender = stillWorks ? {
|
|
337
|
+
conversationId: replyTurn.conversationId,
|
|
338
|
+
turnId: replyTurn.turnId
|
|
339
|
+
} : replyTurn;
|
|
340
|
+
const text = stillWorks ? renderMessageInput(args.sender, rendered.output) : renderResultInput(args.sender, rendered, []);
|
|
257
341
|
const metadata = {
|
|
258
342
|
...senderEventMetadata(args.sender, actor, {
|
|
259
343
|
eventKey: inboundMessageId,
|
|
260
344
|
eventType: AGENT_REPLY_EVENT_TYPE,
|
|
261
345
|
identifier: senderId,
|
|
262
346
|
namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
|
|
263
|
-
trustedSummary: `${childAgentLabel(args.sender)} ${RESULT_SUMMARIES[args.result.kind]}`
|
|
347
|
+
trustedSummary: `${childAgentLabel(args.sender)} ${stillWorks ? "sent a message." : RESULT_SUMMARIES[args.result.kind]}`
|
|
264
348
|
}),
|
|
265
349
|
...childMessageSenderMetadata(sender)
|
|
266
350
|
};
|
|
267
|
-
|
|
351
|
+
const replyingInvocationId = args.result.kind === "reply" ? ownAgentInvocation(sender) : void 0;
|
|
352
|
+
if (replyingInvocationId && !hasAgentInvocationReply(await readParentChildMessages(args.sender.parentConversationId, args.state), replyingInvocationId)) await closeTodosForResult(args.sender, "completed", nowMs);
|
|
353
|
+
await enqueueAutomatedInput({
|
|
268
354
|
message: {
|
|
269
355
|
conversationId: args.sender.parentConversationId,
|
|
270
356
|
createdAtMs: nowMs,
|
|
@@ -274,12 +360,12 @@ async function enqueueChildResultToParent(args) {
|
|
|
274
360
|
authorId: resultAuthorId(actor),
|
|
275
361
|
authorIdentityId: SYSTEM_IDENTITY_ID,
|
|
276
362
|
metadata,
|
|
277
|
-
text
|
|
363
|
+
text
|
|
278
364
|
},
|
|
279
365
|
receivedAtMs: nowMs,
|
|
280
366
|
source: "event"
|
|
281
367
|
},
|
|
282
|
-
renderText: async (parentInboundMessageIds, messageSenders) => !ownAgentInvocation(sender) && await getConversationStoppedAtMs(args.sender.childConversationId) !== void 0 ? void 0 : await renderResultUnderLock(args.sender, rendered)(parentInboundMessageIds, messageSenders),
|
|
368
|
+
renderText: async (parentInboundMessageIds, messageSenders) => !ownAgentInvocation(sender) && await getConversationStoppedAtMs(args.sender.childConversationId) !== void 0 ? void 0 : stillWorks ? text : await renderResultUnderLock(args.sender, rendered)(parentInboundMessageIds, messageSenders),
|
|
283
369
|
queue: args.queue,
|
|
284
370
|
queueDelayMs: EVENT_WAIT_MS,
|
|
285
371
|
state: args.state
|
|
@@ -355,8 +441,7 @@ async function startAgentInvocationsForChildInput(context, options) {
|
|
|
355
441
|
const messages = context.attempt.messages;
|
|
356
442
|
const latest = await getLatestAgentInvocationForConversation(context.conversationId);
|
|
357
443
|
if (messages.length === 0 || !latest) return;
|
|
358
|
-
const
|
|
359
|
-
const routes = await mapBounded(messages, (message) => routeChildInput(message, latest, stoppedAtMs));
|
|
444
|
+
const routes = await mapBounded(messages, (message) => routeChildInput(message, latest));
|
|
360
445
|
if (!routes.includes("agent invocation")) return;
|
|
361
446
|
const inputs = messages.map(childAgentInput);
|
|
362
447
|
const isAgentInput = messages.every((message, index) => inputs[index] !== void 0 || readParentMessage(message) !== void 0);
|
|
@@ -370,7 +455,7 @@ async function startAgentInvocationsForChildInput(context, options) {
|
|
|
370
455
|
};
|
|
371
456
|
const { actor, source } = events[0];
|
|
372
457
|
const invocation = await createAgentInvocationFromLatest({
|
|
373
|
-
input: renderEventBatchInputs(messages, await
|
|
458
|
+
input: renderEventBatchInputs(messages, await eventInboxItemInputs(messages)).map((input) => input.text).join("\n\n"),
|
|
374
459
|
invocationId: getAgentInvocationIdForEvents(messages[0].inboundMessageId),
|
|
375
460
|
latest,
|
|
376
461
|
runAs: {
|
|
@@ -486,63 +571,4 @@ async function reportParentWithoutOpenWork(conversationId, options) {
|
|
|
486
571
|
const replaced = sender ? await reportReplacedWithoutOpenWork(sender.parentConversationId) : void 0;
|
|
487
572
|
if (replaced && isTerminalAgentInvocation(replaced)) await enqueueAgentInvocationResult(replaced, options);
|
|
488
573
|
}
|
|
489
|
-
/**
|
|
490
|
-
* Run each agent invocation result or message as the Actor that triggered the
|
|
491
|
-
* child, user or system, with its grants. This is on purpose: the result
|
|
492
|
-
* continues that Actor's work. The Actor comes from SQL when an agent
|
|
493
|
-
* invocation names the child, so the parent Turn has the same authority it
|
|
494
|
-
* had at spawn time. Otherwise the input carries it, and so does a parent
|
|
495
|
-
* task to a child.
|
|
496
|
-
* Input that a child's Turn with another Actor sent runs as the Event system
|
|
497
|
-
* Actor, so it never gets more authority than that Turn. A result that a stop
|
|
498
|
-
* skipped is dropped. Returns undefined when no input is left.
|
|
499
|
-
*/
|
|
500
|
-
async function withAgentInvocationResultActors(work) {
|
|
501
|
-
if (work.kind !== "mailbox") return work;
|
|
502
|
-
const conversationId = work.batch[0]?.message.conversationId;
|
|
503
|
-
const [latest, stoppedAtMs] = conversationId ? await Promise.all([getLatestAgentInvocationForConversation(conversationId), getConversationStoppedAtMs(conversationId)]) : [void 0, void 0];
|
|
504
|
-
const kept = (await mapBounded(work.batch, async (entry) => {
|
|
505
|
-
const parentMessage = readParentMessage(entry.message);
|
|
506
|
-
if (parentMessage) {
|
|
507
|
-
if (await routeChildInput(entry.message, latest, stoppedAtMs) === "dropped") {
|
|
508
|
-
logDroppedParentMessage(entry.message, parentMessage);
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
const text = await parentMessageText(entry.message, parentMessage);
|
|
512
|
-
return {
|
|
513
|
-
...entry,
|
|
514
|
-
actor: parentMessage.actor,
|
|
515
|
-
...parentMessage.credentialContext ? { credentialContext: parentMessage.credentialContext } : void 0,
|
|
516
|
-
message: {
|
|
517
|
-
...entry.message,
|
|
518
|
-
input: {
|
|
519
|
-
...entry.message.input,
|
|
520
|
-
text
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
const input = childAgentInput(entry.message);
|
|
526
|
-
if (!input) return entry;
|
|
527
|
-
if (await routeChildInput(entry.message, latest, stoppedAtMs) === "dropped") return;
|
|
528
|
-
const { invocation } = await getChildAgentInputSender(entry.message, input);
|
|
529
|
-
const actor = invocation?.actor ?? senderActorFromMetadata(entry.message.input.metadata);
|
|
530
|
-
if (!actor || entry.message.input.authorId !== resultAuthorId(actor)) return {
|
|
531
|
-
...entry,
|
|
532
|
-
actor: EVENT_SYSTEM_ACTOR
|
|
533
|
-
};
|
|
534
|
-
return input.kind === "result" && invocation?.credentialContext ? {
|
|
535
|
-
...entry,
|
|
536
|
-
actor,
|
|
537
|
-
credentialContext: invocation.credentialContext
|
|
538
|
-
} : {
|
|
539
|
-
...entry,
|
|
540
|
-
actor
|
|
541
|
-
};
|
|
542
|
-
})).filter((entry) => entry !== void 0);
|
|
543
|
-
return kept.length > 0 ? {
|
|
544
|
-
kind: "mailbox",
|
|
545
|
-
batch: kept
|
|
546
|
-
} : void 0;
|
|
547
|
-
}
|
|
548
574
|
export { enqueueAgentMessageToParent as a, enqueueAgentInvocationResult as i, createDeliverToParent as n, result_exports as o, createEndStoppedChildWork as r, withAgentInvocationResultActors as s, createChildConversationWorker as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
// src/chat/todos/types.ts
|
|
3
|
+
/** Statuses of a To-do. `done` and `dropped` close it. */
|
|
4
|
+
const TODO_STATUSES = [
|
|
5
|
+
"open",
|
|
6
|
+
"in_progress",
|
|
7
|
+
"done",
|
|
8
|
+
"dropped"
|
|
9
|
+
];
|
|
10
|
+
/** Statuses of a To-do that is still work to do. */
|
|
11
|
+
const OPEN_TODO_STATUSES = ["open", "in_progress"];
|
|
12
|
+
/** Whether a To-do with this status is still work to do. */
|
|
13
|
+
function isOpenTodoStatus(status) {
|
|
14
|
+
return status === "open" || status === "in_progress";
|
|
15
|
+
}
|
|
16
|
+
/** Model-facing tool that changes the To-dos. */
|
|
17
|
+
const UPDATE_TODOS_TOOL_NAME = "updateTodos";
|
|
18
|
+
/** Assignee text for the list's own agent, in tool results and blocks. */
|
|
19
|
+
const SELF_TODO_ASSIGNEE = "self";
|
|
20
|
+
// src/api/schema/user-customization.ts
|
|
21
|
+
/** Longest customization text one user can save. */
|
|
22
|
+
const USER_CUSTOMIZATION_MAX_CHARS = 1e3;
|
|
23
|
+
/** Saved customization text. An empty string means none. */
|
|
24
|
+
const userCustomizationTextSchema = z.string().trim().max(USER_CUSTOMIZATION_MAX_CHARS);
|
|
25
|
+
/** Request and response body for the viewer's customization. */
|
|
26
|
+
const userCustomizationSchema = z.object({ customization: userCustomizationTextSchema }).strict();
|
|
27
|
+
// src/chat/agent-invocations/result-event-type.ts
|
|
28
|
+
/** Event namespace of the messages between a parent and its child agents. */
|
|
29
|
+
const AGENT_INVOCATION_EVENT_NAMESPACE = "junior";
|
|
30
|
+
const AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX = "agent_invocation.";
|
|
31
|
+
/** Build the Event type of the parent message for one agent invocation result. */
|
|
32
|
+
function agentInvocationResultEventType(status) {
|
|
33
|
+
return `${AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX}${status}`;
|
|
34
|
+
}
|
|
35
|
+
/** True when an Event type names an agent invocation result. */
|
|
36
|
+
function isAgentInvocationResultEventType(eventType) {
|
|
37
|
+
return eventType.startsWith(AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX);
|
|
38
|
+
}
|
|
39
|
+
/** Event type of the `reply` that ends a child agent's Turn. */
|
|
40
|
+
const AGENT_REPLY_EVENT_TYPE = "agent.reply";
|
|
41
|
+
/** Event type of a message that a child agent sends to its parent. */
|
|
42
|
+
const AGENT_MESSAGE_EVENT_TYPE = "agent.message";
|
|
43
|
+
/**
|
|
44
|
+
* Event type of a parent agent task or message to a child that no agent
|
|
45
|
+
* invocation names.
|
|
46
|
+
*/
|
|
47
|
+
const AGENT_PARENT_MESSAGE_EVENT_TYPE = "agent.parent_message";
|
|
48
|
+
export { agentInvocationResultEventType as a, userCustomizationSchema as c, SELF_TODO_ASSIGNEE as d, TODO_STATUSES as f, AGENT_REPLY_EVENT_TYPE as i, userCustomizationTextSchema as l, isOpenTodoStatus as m, AGENT_MESSAGE_EVENT_TYPE as n, isAgentInvocationResultEventType as o, UPDATE_TODOS_TOOL_NAME as p, AGENT_PARENT_MESSAGE_EVENT_TYPE as r, USER_CUSTOMIZATION_MAX_CHARS as s, AGENT_INVOCATION_EVENT_NAMESPACE as t, OPEN_TODO_STATUSES as u };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/chat/gateway-providers/rule.ts
|
|
2
|
+
/**
|
|
3
|
+
* The routing rule of the "Enabled providers" admin setting.
|
|
4
|
+
*
|
|
5
|
+
* This module imports nothing, so the dashboard client bundle can use it.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Return the AI Gateway `only` list for one model, or undefined to send none.
|
|
9
|
+
*
|
|
10
|
+
* `enabled` is null when every provider is enabled. `served` lists the
|
|
11
|
+
* providers that serve the model. A model that no enabled provider serves
|
|
12
|
+
* stays unfiltered, so unchecking its providers can never break it. A filter
|
|
13
|
+
* that keeps every provider of the model changes nothing, so it is not sent.
|
|
14
|
+
*/
|
|
15
|
+
function gatewayOnlyProviders(enabled, served) {
|
|
16
|
+
if (enabled === null) return void 0;
|
|
17
|
+
const only = served.filter((provider) => enabled.includes(provider));
|
|
18
|
+
return only.length > 0 && only.length < served.length ? only : void 0;
|
|
19
|
+
}
|
|
20
|
+
export { gatewayOnlyProviders as t };
|