@sentry/junior 0.317.0 → 0.319.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-8_S6Birm.js +1833 -0
- package/dist/{admin-CAugg87B.js → admin-EsbUON1j.js} +1 -1
- package/dist/{agent-runner-AjrEV6Qe.js → agent-CtzMl32d.js} +19953 -6727
- package/dist/{agent-status-BA5x3Xtp.js → agent-status-Bq_AIpyp.js} +105 -1
- package/dist/{agent-update-delivery-B_YIZcgf.js → agent-update-delivery-pAvsbuGL.js} +4 -5
- package/dist/api/schema.d.ts +85 -51
- package/dist/api/schema.js +4 -4
- package/dist/api.js +81 -94
- package/dist/{app-MoNAsVV5.d.ts → app-tACXxJPI.d.ts} +8 -13
- package/dist/app.d.ts +2 -2
- package/dist/app.js +246 -153
- package/dist/{change-record-BzJgLsv7.d.ts → change-record-K-KsqNhT.d.ts} +9 -5
- package/dist/{channel-access-j-YAVYK4.js → channel-access-DET5hzZM.js} +1 -1
- package/dist/{chat-core-engine-aH85nEHv.js → chat-core-engine-DpM3tMVi.js} +7 -7
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +38 -30
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +8 -8
- package/dist/cli/snapshot-create.js +5 -6
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -4
- package/dist/{continue-in-slack-D-FZ8Fin.js → continue-in-slack-CFzDyxkH.js} +3 -2
- package/dist/{conversation-feed--9S0_PXL.js → conversation-feed-DEUdD7mb.js} +2 -106
- package/dist/{conversation-privacy-B1uXn5sf.js → conversation-privacy-C2vYK55O.js} +1 -1
- package/dist/{create-DoDIYgtZ.js → create-Ta3SEIB5.js} +124 -16
- package/dist/{credential-sync-BJOqGnjV.js → credential-sync-DyRqDmY4.js} +17 -20
- package/dist/{db-BFmyYZtJ.js → db-BCaNWl9p.js} +6536 -1920
- package/dist/{deployment-DXq9ZLU4.js → deployment-CfOew1Tm.js} +3 -3
- package/dist/{engine-context-CgQ7mlHt.js → engine-context-CiExoy1B.js} +181 -155
- package/dist/{html-B3VKTGbJ.js → html-Bb2Si1bR.js} +6 -8
- package/dist/instrumentation.js +7 -23
- package/dist/list-wwDcROh9.js +5007 -0
- package/dist/{logging--smS7XRK.js → logging-BRPTXAdf.js} +10 -81
- package/dist/{mailbox-turn-uSXhUFc9.js → markers-9QoqW5ov.js} +1875 -1458
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +7 -8
- package/dist/{oauth-callback-server-CE4soEIY.js → oauth-callback-server-vhL9b-PZ.js} +2 -2
- package/dist/{oauth-relay-C36gX1gH.js → oauth-relay-CH2v7WiB.js} +1 -1
- package/dist/{plugins-fBrz8PCV.d.ts → plugins-DhGXZjlu.d.ts} +1 -0
- package/dist/{profile-BQ-iBDsZ.js → profile-D9LdwmZi.js} +17 -19
- package/dist/{prompt-Dv7gkpD6.js → prompt-3TqxEOtc.js} +10 -10
- package/dist/{reports-WKHfGTsU.js → reports-K-tbtEyx.js} +2 -2
- package/dist/{resolve-tony4ibz.js → resolve-BBV2qf8A.js} +5 -5
- package/dist/{result-Bta_dlWa.js → result-5IdGJP4M.js} +24 -13
- package/dist/{runner-BstDRbD9.js → runner-BK_joPlM.js} +9 -18
- package/dist/{sandbox-egress-signals-oSJMJOnn.js → sandbox-egress-signals-DXgWXXmm.js} +1 -1
- package/dist/{schema-DfqrHACA.js → schema-zWGG6VC1.js} +13 -7
- package/dist/{service-account-CTV_jaNu.js → service-account-CateFyhw.js} +4 -5
- package/dist/{skills-BCEU41zM.js → skills-Ccjw8h2P.js} +10 -9
- package/dist/{slack-conversation-unfurl-DxVmhbGP.js → slack-conversation-unfurl-ZC_TSpc4.js} +7 -7
- package/dist/storage-C9U7R5rM.js +273 -0
- package/dist/{system-prompt-table-CiXy0eNR.js → system-prompt-table-YBTHIFlP.js} +26 -84
- package/dist/topic-B2EWKKBT.js +6 -0
- package/dist/{package-discovery-DD9vencX.js → topics-DxuKurCX.js} +21 -1
- package/dist/{types-C4iC-IMC.js → types-BNHkJrOP.js} +79 -59
- package/dist/{users-ByG5RCEJ.js → users-CCRAqYb_.js} +1 -1
- package/dist/{validation-8gjfR91V.js → validation-BCUpJa8K.js} +4 -4
- package/dist/{version-BeZhWWBE.js → version-BNm0JYj3.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-BqMQQNRk.js → worker-BhgpZ7_b.js} +5 -5
- package/migrations/20261127002500_turn_discarded_usage/migration.sql +2 -0
- package/migrations/20261127002500_turn_discarded_usage/snapshot.json +73 -0
- package/migrations/20261127052408_space_name_nullable/migration.sql +5 -0
- package/migrations/20261127052408_space_name_nullable/snapshot.json +29 -0
- package/migrations/20261127060000_annotation_object_id_index/migration.sql +1 -0
- package/migrations/20261127060000_annotation_object_id_index/snapshot.json +69 -0
- package/migrations/20261127060001_annotation_subjects/migration.sql +78 -0
- package/migrations/20261127060001_annotation_subjects/snapshot.json +104 -0
- package/migrations/20261127060002_annotation_subject_index/migration.sql +1 -0
- package/migrations/20261127060002_annotation_subject_index/snapshot.json +70 -0
- package/migrations/20261127060003_annotation_title_url/migration.sql +84 -0
- package/migrations/20261127060003_annotation_title_url/snapshot.json +73 -0
- package/package.json +9 -7
- package/dist/catalog-runtime-DfSpJZdY.js +0 -6
- package/dist/child-message-DHjQLEd1.js +0 -19
- package/dist/config-CHQ8X251.js +0 -2422
- package/dist/conversation-turn-BUE_7xaN.js +0 -1157
- package/dist/job-runner-A1lCkybD.js +0 -1506
- package/dist/lineage-Bktb0UcV.js +0 -36
- package/dist/list-Bxvg5wXf.js +0 -12623
- package/dist/message-BNenhsmB.js +0 -154
- package/dist/model-input-BReSnwHp.js +0 -82
- package/dist/parent-result-Ck1rFYRQ.js +0 -310
- package/dist/registry-iXMT5Jmh.js +0 -3279
- package/dist/run-conversation-DL6ru7iW.js +0 -336
- package/dist/sender-actors-CPglLd5R.js +0 -83
- package/dist/spawn-frczVPIr.js +0 -48
- package/dist/task-runner-C9Yc2_ae.js +0 -1526
- package/dist/thread-context-CqZDKErp.js +0 -166
- package/dist/topic-CRYYBYp-.js +0 -7
- package/dist/topics-SRN7IVX-.js +0 -24
- package/dist/turn-membership-CENFf3kI.js +0 -856
- package/dist/turn-wake-BhloiI2h.js +0 -151
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { LiveAnnotation, OwnedObjectAnnotation } from "@sentry/junior-plugin-api";
|
|
3
3
|
/**
|
|
4
4
|
* Largest file that Junior stores from Slack or the web, or loads into the
|
|
5
5
|
* sandbox.
|
|
@@ -179,10 +179,14 @@ declare const messageCardRefSchema: z.ZodObject<{
|
|
|
179
179
|
kind: z.ZodLiteral<"object">;
|
|
180
180
|
}, z.core.$strict>;
|
|
181
181
|
type MessageCardRef = z.output<typeof messageCardRefSchema>;
|
|
182
|
-
/**
|
|
183
|
-
declare function resolveMessageCards(refs: readonly MessageCardRef[], annotations: readonly
|
|
184
|
-
/**
|
|
185
|
-
|
|
182
|
+
/** Match each reference to the Annotation as it was read, in reference order. */
|
|
183
|
+
declare function resolveMessageCards(refs: readonly MessageCardRef[], annotations: readonly LiveAnnotation[]): OwnedObjectAnnotation[];
|
|
184
|
+
/**
|
|
185
|
+
* Return the card of a read Annotation without its timestamps, for Message
|
|
186
|
+
* delivery. An Annotation that shows only its label gets that label as its
|
|
187
|
+
* title.
|
|
188
|
+
*/
|
|
189
|
+
declare function annotationCard(annotation: LiveAnnotation): OwnedObjectAnnotation;
|
|
186
190
|
/** Where a failed turn stopped. */
|
|
187
191
|
declare const conversationTurnFailureCodeSchema: z.ZodEnum<{
|
|
188
192
|
agent_run_failed: "agent_run_failed";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Zs as getSlackClient, ac as withSlackRetries, i as getConversationStore, qs as SlackActionError } from "./db-BCaNWl9p.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/chat/slack/channel.ts
|
|
4
4
|
const replySubtypeSchema = z.object({ subtype: z.string().optional() });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { R as getChatConfig } from "./adapter-8_S6Birm.js";
|
|
2
|
+
import { Ap as juniorTurns, d as createSqlConversationEventStore, i as getConversationStore, yc as SYSTEM_IDENTITY_ID } from "./db-BCaNWl9p.js";
|
|
3
3
|
import { t as startLocalVercelQueueServer } from "./local-server-CpnGhYml.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as TURN_STEP_TOPIC } from "./topic-
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
4
|
+
import { fi as projectConversationEvents } from "./markers-9QoqW5ov.js";
|
|
5
|
+
import { n as TURN_STEP_TOPIC } from "./topic-B2EWKKBT.js";
|
|
6
|
+
import { a as turnStepConsumer, i as createGatewayModelClient, n as turnTools, o as scheduleInput, t as createEngineContext } from "./engine-context-CiExoy1B.js";
|
|
7
|
+
import { eq } from "drizzle-orm";
|
|
8
8
|
import { localDestinationSchema } from "@sentry/junior-plugin-api";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
9
10
|
import { setTimeout } from "node:timers/promises";
|
|
10
|
-
import { eq } from "drizzle-orm";
|
|
11
11
|
// src/turn-steps/group-key.ts
|
|
12
12
|
/** The group key of an input that this Actor Identity sent from this Source. */
|
|
13
13
|
function turnGroupKey(actorIdentityId, source) {
|
package/dist/cli/chat.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JuniorPluginSet } from "../plugins-
|
|
1
|
+
import { n as JuniorPluginSet } from "../plugins-DhGXZjlu.js";
|
|
2
2
|
export declare const CHAT_USAGE = "usage: junior chat\n junior chat -p <message>\n junior chat --engine core -p <message>";
|
|
3
3
|
export type ChatCommandOptions = {
|
|
4
4
|
mode: "interactive";
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
2
|
-
import {
|
|
2
|
+
import { G as loadConfig, W as installChatConfig } from "../adapter-8_S6Birm.js";
|
|
3
|
+
import { on as createAgentRunner, t as executeAgentRun } from "../agent-CtzMl32d.js";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
6
|
import { stderr, stdin, stdout } from "node:process";
|
|
@@ -86,10 +87,19 @@ function writeStream(stream, text) {
|
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Install the config of a local chat run. Local chat is ephemeral by default:
|
|
92
|
+
* it uses the memory state adapter unless `JUNIOR_STATE_ADAPTER` is set, so
|
|
93
|
+
* Redis is opt-in.
|
|
94
|
+
*/
|
|
95
|
+
function installLocalChatConfig(options = {}) {
|
|
96
|
+
installChatConfig(loadConfig({
|
|
97
|
+
env: process.env,
|
|
98
|
+
options: {
|
|
99
|
+
...options,
|
|
100
|
+
state: { adapter: process.env["JUNIOR_STATE_ADAPTER"] ? void 0 : "memory" }
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
93
103
|
}
|
|
94
104
|
/** Load the app plugin module so source-mode local chat matches server wiring. */
|
|
95
105
|
async function loadLocalPluginSet() {
|
|
@@ -97,29 +107,29 @@ async function loadLocalPluginSet() {
|
|
|
97
107
|
}
|
|
98
108
|
/** Configure plugin hooks after local chat has selected its state adapter. */
|
|
99
109
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
|
-
const [pluginsModule,
|
|
110
|
+
const [pluginsModule, appContextModule, validationModule, databaseModule] = await Promise.all([
|
|
101
111
|
import("../plugins-D_Ru4CWc.js").then((n) => n.o),
|
|
102
|
-
import("../db-
|
|
103
|
-
import("../
|
|
104
|
-
import("../
|
|
105
|
-
import("../db-BFmyYZtJ.js").then((n) => n.t)
|
|
112
|
+
import("../db-BCaNWl9p.js").then((n) => n.Nd),
|
|
113
|
+
import("../validation-BCUpJa8K.js").then((n) => n.r),
|
|
114
|
+
import("../db-BCaNWl9p.js").then((n) => n.t)
|
|
106
115
|
]);
|
|
107
116
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
117
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
109
118
|
const pluginConfig = resolvedPluginSet ? pluginsModule.pluginCatalogConfigFromPluginSet(resolvedPluginSet) : pluginsModule.pluginCatalogConfigFromEnv();
|
|
110
119
|
const shouldValidatePluginCatalog = Boolean(pluginConfig) || Boolean(resolvedPluginSet?.registrations.length);
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
const previousAppContext = appContextModule.installAppContext(appContextModule.createAppContext({
|
|
121
|
+
plugins,
|
|
122
|
+
pluginConfig
|
|
123
|
+
}));
|
|
113
124
|
try {
|
|
114
125
|
if (shouldValidatePluginCatalog) {
|
|
115
|
-
|
|
126
|
+
appContextModule.getAppContext().catalog.getSignature();
|
|
116
127
|
validationModule.validatePluginRegistrations(resolvedPluginSet?.registrations ?? []);
|
|
117
128
|
validationModule.validatePluginEgressCredentialHooks(resolvedPluginSet?.registrations ?? []);
|
|
118
129
|
}
|
|
119
130
|
databaseModule.getDb();
|
|
120
|
-
registryModule.setPlugins(plugins);
|
|
121
131
|
} catch (error) {
|
|
122
|
-
|
|
132
|
+
appContextModule.installAppContext(previousAppContext);
|
|
123
133
|
throw error;
|
|
124
134
|
}
|
|
125
135
|
}
|
|
@@ -152,21 +162,19 @@ function localDevServerUrl() {
|
|
|
152
162
|
}
|
|
153
163
|
/** Wire the shared local-turn setup so prompt and interactive runs stay identical. */
|
|
154
164
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
155
|
-
|
|
165
|
+
installLocalChatConfig({ eventEmbeddings: { enabled: true } });
|
|
156
166
|
await configureLocalChatPlugins(pluginSet);
|
|
157
|
-
const {
|
|
158
|
-
|
|
159
|
-
const {
|
|
160
|
-
const {
|
|
161
|
-
const {
|
|
162
|
-
const {
|
|
163
|
-
const {
|
|
164
|
-
const {
|
|
165
|
-
const {
|
|
166
|
-
const { createConversationTurnWorker } = await import("../conversation-turn-BUE_7xaN.js").then((n) => n.t);
|
|
167
|
-
const { resumeForPersonInput } = await import("../mailbox-turn-uSXhUFc9.js").then((n) => n.q);
|
|
167
|
+
const { runLocalAgentTurn } = await import("../runner-BK_joPlM.js");
|
|
168
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-vhL9b-PZ.js");
|
|
169
|
+
const { createLocalOAuthState } = await import("../oauth-relay-CH2v7WiB.js").then((n) => n.t);
|
|
170
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-DXgWXXmm.js");
|
|
171
|
+
const { bindSpawnAgent } = await import("../agent-CtzMl32d.js").then((n) => n.nn);
|
|
172
|
+
const { bindMessageAgent } = await import("../agent-CtzMl32d.js").then((n) => n.an);
|
|
173
|
+
const { runConversation } = await import("../agent-CtzMl32d.js").then((n) => n.Y);
|
|
174
|
+
const { createConversationTurnWorker } = await import("../agent-CtzMl32d.js").then((n) => n.X);
|
|
175
|
+
const { resumeForPersonInput } = await import("../markers-9QoqW5ov.js").then((n) => n.N);
|
|
168
176
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
169
|
-
const { processConversationWork } = await import("../worker-
|
|
177
|
+
const { processConversationWork } = await import("../worker-BhgpZ7_b.js").then((n) => n.n);
|
|
170
178
|
let agentRunner;
|
|
171
179
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
172
180
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
|
@@ -231,9 +239,9 @@ async function runPrompt(options, io, pluginSet) {
|
|
|
231
239
|
}
|
|
232
240
|
}
|
|
233
241
|
async function runCorePrompt(options, io, pluginSet) {
|
|
234
|
-
|
|
242
|
+
installLocalChatConfig();
|
|
235
243
|
await configureLocalChatPlugins(pluginSet);
|
|
236
|
-
const { runCoreEnginePrompt } = await import("../chat-core-engine-
|
|
244
|
+
const { runCoreEnginePrompt } = await import("../chat-core-engine-DpM3tMVi.js");
|
|
237
245
|
const result = await runCoreEnginePrompt({
|
|
238
246
|
conversationId: newRunConversationId(),
|
|
239
247
|
message: options.message
|
package/dist/cli/check.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as parseSkillFile } from "../skills-
|
|
3
|
-
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
4
|
-
import {
|
|
1
|
+
import { G as mapBounded } from "../prompt-3TqxEOtc.js";
|
|
2
|
+
import { a as parseSkillFile } from "../skills-Ccjw8h2P.js";
|
|
3
|
+
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, m as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, s as JUNIOR_HEARTBEAT_ROUTE } from "../deployment-CfOew1Tm.js";
|
|
4
|
+
import { Mf as parseInlinePluginManifest, Nf as parsePluginManifest } from "../db-BCaNWl9p.js";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { mentionsTag } from "@sentry/junior-plugin-api";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
8
9
|
import pLimit from "p-limit";
|
|
9
10
|
import fs from "node:fs/promises";
|
|
10
|
-
import { pathToFileURL } from "node:url";
|
|
11
11
|
// src/cli/check.ts
|
|
12
12
|
const DEFAULT_IO = {
|
|
13
13
|
info: console.log,
|
package/dist/cli/main.js
CHANGED
|
@@ -45,10 +45,10 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-EsbUON1j.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
51
|
+
return await (await import("../service-account-CateFyhw.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
function topLevelCommand(argv) {
|
|
54
54
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JuniorPluginSet } from "../plugins-
|
|
1
|
+
import { n as JuniorPluginSet } from "../plugins-DhGXZjlu.js";
|
|
2
2
|
import { PluginCliIo } from "@sentry/junior-plugin-api";
|
|
3
3
|
export type PluginCommandIo = PluginCliIo;
|
|
4
4
|
export interface CliPluginCommandDispatcher {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as createPluginLogger } from "../prompt-
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-8gjfR91V.js";
|
|
1
|
+
import { At as coreRegistrations, Id as installAppContext, Pd as createAppContext, a as getDb } from "../db-BCaNWl9p.js";
|
|
2
|
+
import { h as createPluginLogger } from "../prompt-3TqxEOtc.js";
|
|
3
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BCUpJa8K.js";
|
|
5
4
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
6
5
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-D_Ru4CWc.js";
|
|
7
6
|
import { Command, CommanderError } from "commander";
|
|
@@ -123,19 +122,20 @@ async function loadPluginRegistrations(args) {
|
|
|
123
122
|
const cliPlugins = [...pluginCliRegistrationsFromPluginSet(pluginSet), ...coreCliPlugins];
|
|
124
123
|
const runtimePlugins = pluginRuntimeRegistrationsFromPluginSet(pluginSet);
|
|
125
124
|
const pluginConfig = pluginCatalogConfigFromPluginSet(pluginSet);
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const previousAppContext = installAppContext(createAppContext({
|
|
126
|
+
plugins: runtimePlugins,
|
|
127
|
+
pluginConfig
|
|
128
|
+
}));
|
|
128
129
|
try {
|
|
129
130
|
validatePluginRegistrations(pluginSet.registrations);
|
|
130
131
|
validatePluginEgressCredentialHooks(pluginSet.registrations);
|
|
131
132
|
args.validateConfiguredCommands?.(cliPlugins);
|
|
132
|
-
setPlugins(runtimePlugins);
|
|
133
133
|
return {
|
|
134
134
|
cliPlugins,
|
|
135
135
|
runtimePlugins
|
|
136
136
|
};
|
|
137
137
|
} catch (error) {
|
|
138
|
-
|
|
138
|
+
installAppContext(previousAppContext);
|
|
139
139
|
throw error;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as resolve } from "../resolve-
|
|
4
|
-
import { t as create, u as SANDBOX_RUNTIME } from "../profile-
|
|
5
|
-
import { Gu as disconnectStateAdapter } from "../db-BFmyYZtJ.js";
|
|
1
|
+
import { R as getChatConfig, n as disconnectStateAdapter } from "../adapter-8_S6Birm.js";
|
|
2
|
+
import { Fd as getAppContext } from "../db-BCaNWl9p.js";
|
|
3
|
+
import { n as resolve } from "../resolve-BBV2qf8A.js";
|
|
4
|
+
import { t as create, u as SANDBOX_RUNTIME } from "../profile-D9LdwmZi.js";
|
|
6
5
|
// src/cli/snapshot-create.ts
|
|
7
6
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
8
7
|
function progressMessage(phase) {
|
|
@@ -16,7 +15,7 @@ function formatList(values) {
|
|
|
16
15
|
return values.length > 0 ? values.join(", ") : "none";
|
|
17
16
|
}
|
|
18
17
|
function logSnapshotProfile(runtime, log) {
|
|
19
|
-
const providers =
|
|
18
|
+
const providers = getAppContext().catalog.getProviders();
|
|
20
19
|
const currentProfile = create(runtime);
|
|
21
20
|
const pluginNames = providers.map((plugin) => plugin.manifest.name).sort();
|
|
22
21
|
const snapshotPluginNames = providers.filter((plugin) => (plugin.manifest.runtimeDependencies?.length ?? 0) > 0 || (plugin.manifest.runtimePostinstall?.length ?? 0) > 0).map((plugin) => plugin.manifest.name).sort();
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as pendingMigrations, l as readMigrationRecords, s as createJuniorSqlExecutor } from "../db-
|
|
1
|
+
import { R as getChatConfig } from "../adapter-8_S6Birm.js";
|
|
2
|
+
import { Ld as createPluginCatalogRuntime, c as pendingMigrations, l as readMigrationRecords, s as createJuniorSqlExecutor } from "../db-BCaNWl9p.js";
|
|
3
3
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
4
|
-
import { t as createPluginCatalogRuntime } from "../registry-iXMT5Jmh.js";
|
|
5
4
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-D_Ru4CWc.js";
|
|
6
5
|
import { t as isMissingVirtualModule } from "../virtual-module-BeKA_EII.js";
|
|
7
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
import { readMigrationFiles } from "drizzle-orm/migrator";
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
11
10
|
import { createJiti } from "jiti";
|
|
12
11
|
// src/chat/conversations/sql/migrations.ts
|
|
13
12
|
/** SQL schema migrations for durable Junior records. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A as setFirstConversationLocation, Cl as getDashboardConversationLink,
|
|
2
|
-
import {
|
|
1
|
+
import { A as setFirstConversationLocation, Ai as postSlackMessage, Cl as getDashboardConversationLink, Ei as getSlackMessagePermalink, En as moveIdleConversationDestination, Li as escapeSlackMrkdwnText, N as claimProviderConversation, O as withConversationMutationLock, P as getConversationIdByProviderConversation, Ri as formatSlackLink, Ti as deleteSlackMessage, a as getDb, i as getConversationStore, o as getSqlExecutor, qp as juniorDestinations } from "./db-BCaNWl9p.js";
|
|
2
|
+
import { E as parseSlackChannelId, P as parseSlackMessageTs, i as getStateAdapter } from "./adapter-8_S6Birm.js";
|
|
3
|
+
import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-DET5hzZM.js";
|
|
3
4
|
import { and, eq } from "drizzle-orm";
|
|
4
5
|
// src/chat/slack/continue-in-slack.ts
|
|
5
6
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -1,109 +1,5 @@
|
|
|
1
|
-
import { F as actorIdentitySchema, Nt as spaceRefSchema, V as conversationDetailReportSchema, X as conversationSummaryReportSchema,
|
|
1
|
+
import { F as actorIdentitySchema, Nt as spaceRefSchema, V as conversationDetailReportSchema, X as conversationSummaryReportSchema, Xt as messageAttachmentSchema, zt as inboxItemChangeRecordSchema } from "./types-BNHkJrOP.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
// src/api/objects/cards.ts
|
|
4
|
-
const MAX_LABEL_CHARS = 256;
|
|
5
|
-
const MAX_FACT_CHARS = 160;
|
|
6
|
-
const conversationStates = {
|
|
7
|
-
done: "done",
|
|
8
|
-
needs_input: "needs input",
|
|
9
|
-
working: "working"
|
|
10
|
-
};
|
|
11
|
-
function personName(person) {
|
|
12
|
-
return person.fullName ?? person.slackUserName ?? person.email;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Build the card of one Conversation that the viewer may read. Give
|
|
16
|
-
* `description` only when the viewer may see private content.
|
|
17
|
-
*/
|
|
18
|
-
function conversationObjectCard(args) {
|
|
19
|
-
const { summary } = args;
|
|
20
|
-
const participants = args.participants.flatMap((person) => personName(person)?.slice(0, MAX_FACT_CHARS) ?? []).slice(0, 5);
|
|
21
|
-
return {
|
|
22
|
-
kind: "object",
|
|
23
|
-
objectType: "conversation",
|
|
24
|
-
key: summary.conversationId.slice(0, 256),
|
|
25
|
-
label: summary.displayTitle.slice(0, MAX_LABEL_CHARS),
|
|
26
|
-
title: summary.displayTitle.slice(0, 512),
|
|
27
|
-
url: args.url,
|
|
28
|
-
status: summary.archivedAt ? "archived" : conversationStates[summary.status],
|
|
29
|
-
...args.description ? { description: args.description.slice(0, 4e3) } : void 0,
|
|
30
|
-
facts: {
|
|
31
|
-
type: "conversation",
|
|
32
|
-
...participants.length > 0 ? { participants } : void 0,
|
|
33
|
-
lastActivityAt: summary.lastSeenAt
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/** Build the card of one known person from what the People pages show. */
|
|
38
|
-
function personObjectCard(args) {
|
|
39
|
-
const { person } = args;
|
|
40
|
-
const name = personName(person) ?? person.email;
|
|
41
|
-
return {
|
|
42
|
-
kind: "object",
|
|
43
|
-
objectType: "person",
|
|
44
|
-
key: person.email.toLowerCase().slice(0, 256),
|
|
45
|
-
label: name.slice(0, MAX_LABEL_CHARS),
|
|
46
|
-
title: name.slice(0, 512),
|
|
47
|
-
url: args.url,
|
|
48
|
-
facts: {
|
|
49
|
-
type: "person",
|
|
50
|
-
email: person.email.slice(0, MAX_FACT_CHARS),
|
|
51
|
-
...person.slackUserName ? { slackHandle: person.slackUserName.slice(0, MAX_FACT_CHARS) } : void 0,
|
|
52
|
-
...args.githubHandle ? { githubHandle: args.githubHandle } : void 0,
|
|
53
|
-
...person.avatarUrl ? { avatarUrl: person.avatarUrl } : void 0
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const MAX_SNIPPET_CHARS = 280;
|
|
58
|
-
const MAX_TITLE_CHARS = 100;
|
|
59
|
-
function truncate(text, max) {
|
|
60
|
-
return text.length > max ? `${text.slice(0, max - 1).trimEnd()}…` : text;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Build the card of one chat message. Give `text` only when the viewer may
|
|
64
|
-
* read the message: the card shows a short snippet of it, never all of it.
|
|
65
|
-
*/
|
|
66
|
-
function messageObjectCard(args) {
|
|
67
|
-
const snippet = args.text?.replace(/\s+/g, " ").trim();
|
|
68
|
-
const title = snippet ? truncate(snippet, MAX_TITLE_CHARS) : `Message in ${args.channel}`;
|
|
69
|
-
return {
|
|
70
|
-
kind: "object",
|
|
71
|
-
objectType: "message",
|
|
72
|
-
key: args.key.slice(0, 256),
|
|
73
|
-
label: args.channel.slice(0, MAX_LABEL_CHARS),
|
|
74
|
-
title,
|
|
75
|
-
url: args.url,
|
|
76
|
-
...snippet && snippet.length > title.length ? { description: truncate(snippet, MAX_SNIPPET_CHARS) } : void 0,
|
|
77
|
-
facts: {
|
|
78
|
-
type: "message",
|
|
79
|
-
channel: args.channel.slice(0, MAX_FACT_CHARS),
|
|
80
|
-
...args.author ? { author: args.author.slice(0, MAX_FACT_CHARS) } : void 0,
|
|
81
|
-
...args.sentAt ? { sentAt: args.sentAt } : void 0
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Build the card of one public web page from its oEmbed fields or meta
|
|
87
|
-
* tags. `thumbnailUrl` must be a Junior image path.
|
|
88
|
-
*/
|
|
89
|
-
function webPageObjectCard(args) {
|
|
90
|
-
return {
|
|
91
|
-
kind: "object",
|
|
92
|
-
objectType: "web_page",
|
|
93
|
-
key: args.url.slice(0, 256),
|
|
94
|
-
label: truncate(args.title, MAX_LABEL_CHARS),
|
|
95
|
-
title: truncate(args.title, 512),
|
|
96
|
-
url: args.url,
|
|
97
|
-
...args.description ? { description: truncate(args.description, MAX_SNIPPET_CHARS) } : void 0,
|
|
98
|
-
facts: {
|
|
99
|
-
type: "web_page",
|
|
100
|
-
...args.siteName ? { siteName: truncate(args.siteName, MAX_FACT_CHARS) } : void 0,
|
|
101
|
-
...args.author ? { author: truncate(args.author, MAX_FACT_CHARS) } : void 0,
|
|
102
|
-
...args.media ? { media: args.media } : void 0,
|
|
103
|
-
...args.thumbnailUrl ? { thumbnailUrl: args.thumbnailUrl } : void 0
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
3
|
// src/reporting-schema.ts
|
|
108
4
|
const healthReportSchema = z.object({
|
|
109
5
|
status: z.literal("ok"),
|
|
@@ -442,4 +338,4 @@ const conversationFeedSchema = z.object({
|
|
|
442
338
|
*/
|
|
443
339
|
waitingRowsTruncated: z.literal(true).optional()
|
|
444
340
|
}).strict();
|
|
445
|
-
export { conversationUnchangedDetailWithMailboxSchema as A, runtimeInfoReportSchema as B, cancelConversationPendingMessagesBodySchema as C, conversationPendingMessageDeliverySchema as D, conversationPendingAuthorizationSchema as E, pluginOperationalReportSchema as F,
|
|
341
|
+
export { conversationUnchangedDetailWithMailboxSchema as A, runtimeInfoReportSchema as B, cancelConversationPendingMessagesBodySchema as C, conversationPendingMessageDeliverySchema as D, conversationPendingAuthorizationSchema as E, pluginOperationalReportSchema as F, skillReportSchema as H, pluginPackageContentItemReportSchema as I, pluginPackageContentReportSchema as L, steerConversationPendingMessagesResponseSchema as M, healthReportSchema as N, conversationPendingMessageSchema as O, pluginOperationalReportFeedSchema as P, pluginSchema as R, conversationAutoArchiveSchema as S, conversationDetailWithMailboxReportSchema as T, skillReportsSchema as U, skillDetailReportSchema as V, reorderPinnedConversationsBodySchema as _, conversationInviteResponseSchema as a, archiveConversationResponseSchema as b, conversationSubscriptionResponseSchema as c, CONVERSATION_TITLE_MAX_LENGTH as d, conversationTitleSchema as f, pinConversationResponseSchema as g, pinConversationBodySchema as h, conversationInviteBodySchema as i, steerConversationPendingMessagesBodySchema as j, conversationPendingMessagesReportSchema as k, setConversationSpaceBodySchema as l, renameConversationResponseSchema as m, conversationFeedSchema as n, conversationLeaveResponseSchema as o, renameConversationBodySchema as p, stopConversationTurnResponseSchema as r, conversationSubscriptionBodySchema as s, conversationFeedQuerySchema as t, setConversationSpaceResponseSchema as u, reorderPinnedConversationsResponseSchema as v, cancelConversationPendingMessagesResponseSchema as w, archiveDoneConversationsResponseSchema as x, archiveConversationBodySchema as y, pluginsSchema as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as logWarn } from "./logging-BRPTXAdf.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
|
|
4
4
|
// src/chat/conversation-privacy.ts
|
|
@@ -1,9 +1,119 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { m as readChildConversationSender, r as recordSubagentStartedMarker, s as listOpenChildAgents } from "./parent-result-Ck1rFYRQ.js";
|
|
4
|
-
import { I as AgentNameInUseError, L as AgentStoppedError, R as ChildAgentLimitError } from "./agent-runner-AjrEV6Qe.js";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
1
|
+
import { Bp as juniorConversations, Ft as getAgentBinding, Sn as hasConversationStop, Sp as juniorAgentBindings, Wf as nextDetailVersion, i as getConversationStore, in as ensureConversationWake, o as getSqlExecutor, on as getConversationWorkState, zt as spawnChildAgentInputSchema } from "./db-BCaNWl9p.js";
|
|
2
|
+
import { A as getConversationStoppedAtMs, E as getSpawnedChildConversationId, Ft as addConversationNote, Nr as loadTurnStart, b as agentConfigSchema, f as readChildConversationSender, m as buildParentMessage, n as recordSubagentStartedMarker, o as listOpenChildAgents, p as appendParentMessage, w as getChildAgentLockName, x as readAgentConfig } from "./markers-9QoqW5ov.js";
|
|
6
3
|
import { eq } from "drizzle-orm";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
// src/chat/agent/types.ts
|
|
6
|
+
/** Resume the agent turn after a transient or ambiguous delivery failure. */
|
|
7
|
+
var RetryableDeliveryError = class extends Error {
|
|
8
|
+
constructor(cause) {
|
|
9
|
+
super("Assistant delivery was transient or ambiguous", { cause });
|
|
10
|
+
this.name = "RetryableDeliveryError";
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
/** Return whether one optional agent capability is disabled for this run. */
|
|
14
|
+
function isAgentRunFeatureDisabled(disabledFeatures, feature) {
|
|
15
|
+
return disabledFeatures?.includes(feature) ?? false;
|
|
16
|
+
}
|
|
17
|
+
/** Resolve the explicit actor, dispatch actor, or credential actor for this run. */
|
|
18
|
+
function actorFromRun(run) {
|
|
19
|
+
if (run.dispatch?.actor) return run.dispatch.actor;
|
|
20
|
+
if (run.actor) return run.actor;
|
|
21
|
+
if (run.credentialContext && !("type" in run.credentialContext.actor)) return run.credentialContext.actor;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reject contradictory provider coordinates before the run touches state.
|
|
25
|
+
* `conversation` comes from the stored Conversation, never from the Run.
|
|
26
|
+
*/
|
|
27
|
+
function assertRunConsistency(run, conversation) {
|
|
28
|
+
const { destination, source } = run;
|
|
29
|
+
switch (source.kind) {
|
|
30
|
+
case "slack":
|
|
31
|
+
if (destination.platform !== "slack") throw new TypeError("Run source and destination platforms do not match");
|
|
32
|
+
if (source.teamId !== destination.teamId) throw new TypeError("Slack source and destination teams do not match");
|
|
33
|
+
break;
|
|
34
|
+
case "local":
|
|
35
|
+
if (destination.platform !== "local") throw new TypeError("Run source and destination platforms do not match");
|
|
36
|
+
if (source.conversationId !== destination.conversationId) throw new TypeError("Source and destination conversation IDs do not match");
|
|
37
|
+
if (run.surface !== "internal" && destination.conversationId !== run.conversationId) throw new TypeError("Source, destination, and run conversation IDs do not match");
|
|
38
|
+
break;
|
|
39
|
+
case "web":
|
|
40
|
+
if (run.surface !== "internal" && source.conversationId !== run.conversationId) throw new TypeError("Web source and run conversation IDs do not match");
|
|
41
|
+
switch (destination.platform) {
|
|
42
|
+
case "local":
|
|
43
|
+
if (conversation?.kind === "thread" && conversation.hasParent) break;
|
|
44
|
+
if (source.conversationId !== destination.conversationId) throw new TypeError("Source and destination conversation IDs do not match");
|
|
45
|
+
if (run.surface !== "internal" && destination.conversationId !== run.conversationId) throw new TypeError("Source, destination, and run conversation IDs do not match");
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
case "event":
|
|
49
|
+
case "scheduled_automation":
|
|
50
|
+
case "event_automation":
|
|
51
|
+
case "plugin_dispatch":
|
|
52
|
+
case "parent_message": return;
|
|
53
|
+
}
|
|
54
|
+
const actor = run.dispatch?.actor ?? run.actor;
|
|
55
|
+
if (!actor || actor.platform === "system") return;
|
|
56
|
+
if (actor.platform !== source.kind) throw new TypeError(`Actor platform "${actor.platform}" does not match Source kind "${source.kind}"`);
|
|
57
|
+
if (actor.platform === "slack" && source.kind === "slack" && actor.teamId !== source.teamId) throw new TypeError("Slack Actor team does not match Source team");
|
|
58
|
+
}
|
|
59
|
+
/** Route tool side effects to the tool channel when one overrides the destination. */
|
|
60
|
+
function toolInvocationDestination(run) {
|
|
61
|
+
if (run.destination.platform !== "slack" || !run.toolChannelId) return run.destination;
|
|
62
|
+
return {
|
|
63
|
+
platform: "slack",
|
|
64
|
+
teamId: run.destination.teamId,
|
|
65
|
+
channelId: run.toolChannelId
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Infer the run surface when the caller did not state one. */
|
|
69
|
+
function surfaceFromRun(run) {
|
|
70
|
+
if (run.surface) return run.surface;
|
|
71
|
+
if (run.source.kind === "slack") return "slack";
|
|
72
|
+
if (run.source.kind === "web") return "api";
|
|
73
|
+
return "internal";
|
|
74
|
+
}
|
|
75
|
+
// src/chat/child-agents/errors.ts
|
|
76
|
+
/** A child agent already uses this name in the parent Conversation. */
|
|
77
|
+
var AgentNameInUseError = class extends Error {
|
|
78
|
+
constructor(name) {
|
|
79
|
+
super(`A child agent named "${name}" already exists`);
|
|
80
|
+
this.name = "AgentNameInUseError";
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/** Parent already has the maximum number of active child agents. */
|
|
84
|
+
var ChildAgentLimitError = class extends Error {
|
|
85
|
+
constructor(limit) {
|
|
86
|
+
super(`Parent already has ${limit} active child agents (limit ${limit})`);
|
|
87
|
+
this.name = "ChildAgentLimitError";
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The Conversation that calls startAgent is too deep to start child agents,
|
|
92
|
+
* or its parent chain does not end at a root.
|
|
93
|
+
*/
|
|
94
|
+
var AgentDepthLimitError = class extends Error {
|
|
95
|
+
constructor(maxAgentDepth) {
|
|
96
|
+
super(`This agent cannot start child agents: only ${maxAgentDepth} level(s) of child agents can start their own`);
|
|
97
|
+
this.name = "AgentDepthLimitError";
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/** A stopped Conversation cannot give work to child agents. */
|
|
101
|
+
var AgentStoppedError = class extends Error {
|
|
102
|
+
constructor() {
|
|
103
|
+
super("This conversation is stopped, so it cannot give work to child agents");
|
|
104
|
+
this.name = "AgentStoppedError";
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* A messageAgent target is not the parent, a child, or a top-level agent that
|
|
109
|
+
* the sender can message.
|
|
110
|
+
*/
|
|
111
|
+
var AgentMessageTargetError = class extends Error {
|
|
112
|
+
constructor(message) {
|
|
113
|
+
super(message);
|
|
114
|
+
this.name = "AgentMessageTargetError";
|
|
115
|
+
}
|
|
116
|
+
};
|
|
7
117
|
/**
|
|
8
118
|
* A stopped child agent cannot start or give work to child agents until its
|
|
9
119
|
* parent gives it new work, which ends the stop. A root Conversation has no
|
|
@@ -14,16 +124,14 @@ async function assertCanGiveChildWork(parentConversationId) {
|
|
|
14
124
|
}
|
|
15
125
|
/**
|
|
16
126
|
* Throw when giving work to one child agent would put its parent over
|
|
17
|
-
* `MAX_ACTIVE_CHILD_AGENTS
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
127
|
+
* `MAX_ACTIVE_CHILD_AGENTS`. A child agent is active while its listing shows
|
|
128
|
+
* open work, so a busy child already counts and messages queued for it do not
|
|
129
|
+
* count again. A new or idle child becomes active. This is the only place the
|
|
130
|
+
* rule for which child agents count lives. `active` is the parent's active
|
|
131
|
+
* children from `listOpenChildAgents`.
|
|
22
132
|
*/
|
|
23
|
-
|
|
133
|
+
function assertChildAgentCapacity(active, childConversationId) {
|
|
24
134
|
if (active.includes(childConversationId) || active.length < 8) return;
|
|
25
|
-
const parent = await getConversationStore().get({ conversationId: parentConversationId });
|
|
26
|
-
if (parent && !capsActiveChildren(parent.kind)) return;
|
|
27
135
|
throw new ChildAgentLimitError(8);
|
|
28
136
|
}
|
|
29
137
|
/**
|
|
@@ -38,7 +146,7 @@ async function createChildAgentConversation(input, childConversationId, nowMs) {
|
|
|
38
146
|
name: input.agentName,
|
|
39
147
|
parentConversationId: input.parentConversationId
|
|
40
148
|
})) throw new AgentNameInUseError(input.agentName);
|
|
41
|
-
|
|
149
|
+
assertChildAgentCapacity(await listOpenChildAgents(input.parentConversationId), childConversationId);
|
|
42
150
|
await getConversationStore().createChild({
|
|
43
151
|
childConversationId,
|
|
44
152
|
kind: input.kind,
|
|
@@ -205,11 +313,11 @@ async function messageChildAgent(input, options, nowMs = Date.now()) {
|
|
|
205
313
|
}
|
|
206
314
|
await assertCanGiveChildWork(input.parentConversationId);
|
|
207
315
|
const active = await listOpenChildAgents(input.parentConversationId);
|
|
208
|
-
|
|
316
|
+
assertChildAgentCapacity(active, input.childConversationId);
|
|
209
317
|
return {
|
|
210
318
|
delivery: "message",
|
|
211
319
|
value: active.includes(input.childConversationId) ? "queued" : "started"
|
|
212
320
|
};
|
|
213
321
|
}) };
|
|
214
322
|
}
|
|
215
|
-
export { spawnChildAgent as n, messageChildAgent as t };
|
|
323
|
+
export { AgentNameInUseError as a, RetryableDeliveryError as c, isAgentRunFeatureDisabled as d, surfaceFromRun as f, AgentMessageTargetError as i, actorFromRun as l, spawnChildAgent as n, AgentStoppedError as o, toolInvocationDestination as p, AgentDepthLimitError as r, ChildAgentLimitError as s, messageChildAgent as t, assertRunConsistency as u };
|