@sentry/junior 0.244.0 → 0.246.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-CF9lQg0M.js → admin-Bh-MYw-j.js} +1 -1
- package/dist/{agent-hooks-Cj_rSeWd.js → agent-hooks-DpklSWZg.js} +10 -10
- package/dist/{agent-runner-DtEtbaOb.js → agent-runner-DSKpHjHW.js} +568 -191
- package/dist/api/schema.d.ts +86 -3
- package/dist/api/schema.js +3 -3
- package/dist/api.js +372 -245
- package/dist/{app-DRLh-8zs.d.ts → app-BYB7szGb.d.ts} +2 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +179 -146
- package/dist/{briefs-BMzTiGJO.js → briefs-cZ5vWqP_.js} +4 -4
- package/dist/{catalog-runtime-CpxhLwZG.js → catalog-runtime-CTaQXYqS.js} +1 -1
- package/dist/cli/chat.js +17 -13
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-BVaGEb1-.js → client--xtsAxKP.js} +2 -2
- package/dist/{config-q9xXVN_5.js → config-BK53Ip5C.js} +11 -2
- package/dist/{conversation-BxvgH64Q.js → conversation-CvBG57Io.js} +11 -1
- package/dist/{conversation-privacy-Dyh_63Ee.js → conversation-privacy-BDBFw6Ws.js} +1 -1
- package/dist/{credential-sync-Bsn-6m16.js → credential-sync-BiuhC9Ds.js} +14 -14
- package/dist/{executor-DA7eHhmC.js → executor-bmmuRY-w.js} +2 -2
- package/dist/{images-CvMreau5.js → images-DZliDtSH.js} +3 -3
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-mVyF9jgv.js → job-queue-Cz3M7gg4.js} +1 -1
- package/dist/{logging-z7_w-KN_.js → logging-DVtMYOdD.js} +1 -1
- package/dist/message-BSN-Ma5f.js +317 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-authorization-Db1yGVvG.js → oauth-authorization-By_MVRDC.js} +1 -1
- package/dist/{oauth-callback-server-_MfOtSxS.js → oauth-callback-server-BrUo6w1e.js} +2 -2
- package/dist/{pending-auth-OndKPW4M.js → pending-auth-BuQLZ6dK.js} +2 -2
- package/dist/{profile-yeKVNECl.js → profile-BevMNSlr.js} +4 -4
- package/dist/{prompt-CX36ZlbV.js → prompt-C9Q9cjD3.js} +1 -1
- package/dist/{registry-DvzzL8-v.js → registry-C2rSEio1.js} +1 -1
- package/dist/{resolve-4u5gEU04.js → resolve-qPhrznTf.js} +2 -2
- package/dist/{runner-Y6A6pww4.js → runner-CNh5eMWx.js} +10 -10
- package/dist/{sandbox-egress-signals-D7AOkuoe.js → sandbox-egress-signals-BnDEKu8d.js} +1 -1
- package/dist/{schema-Dyyi9oRc.js → schema-BWMRg8JS.js} +28 -4
- package/dist/{skills-DFduSvuO.js → skills-C6zJbudq.js} +2 -2
- package/dist/{spawn-DYg7jhhR.js → spawn-C3efZSx3.js} +2 -2
- package/dist/{task-queue-BQ0vnumm.js → task-queue-BX4vG6uA.js} +3 -3
- package/dist/{task-runner-D4jvUpFV.js → task-runner-T51kll0U.js} +10 -10
- package/dist/{tasks-DBZAgTx7.js → tasks-B9OIjl2K.js} +82 -11
- package/dist/{thread-state-hj70P2Cp.js → thread-state-AGZtVyXp.js} +6 -6
- package/dist/{turn-failure-response-S2pwtR8b.js → turn-failure-response-DJ8KU2bo.js} +9 -9
- package/dist/{turn-lifecycle-CNFOMAJq.js → turn-lifecycle-DZJkJ95q.js} +1 -1
- package/dist/{turn-session-routing-1eTgv6ns.js → turn-session-routing-mRqLbMZW.js} +1 -1
- package/dist/{validation-DcsBjzdi.js → validation-Dg0Ihxzo.js} +1 -1
- package/dist/{version-DVCHJYcY.js → version-Deub4try.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-BBnCMR1g.js → viewer-D5hbx6TE.js} +3 -3
- package/dist/{web-authorization-CTltRLsB.js → web-authorization-DCxixz5S.js} +6 -6
- package/dist/{web-input-CIsRGF07.js → web-input-0sorYVLh.js} +74 -187
- package/dist/{work-fje9VXgQ.js → work-rm2X7jj4.js} +13 -6
- package/dist/{worker-Byd2Et9r.js → worker-bnGsAOP3.js} +5 -5
- package/package.json +4 -4
|
@@ -766,7 +766,17 @@ const forkConversationBodySchema = z.object({
|
|
|
766
766
|
idempotencyKey: z.string().trim().min(1).max(200)
|
|
767
767
|
}).strict();
|
|
768
768
|
const forkConversationResponseSchema = z.object({ conversationId: z.string() }).strict();
|
|
769
|
+
/** One Conversation in the agent tree of a child Conversation. */
|
|
770
|
+
const conversationAgentTreeNodeSchema = z.object({
|
|
771
|
+
conversationId: z.string().min(1),
|
|
772
|
+
label: z.string().min(1)
|
|
773
|
+
}).strict();
|
|
769
774
|
const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
775
|
+
/**
|
|
776
|
+
* The parent chain of a child Conversation, root first, with this
|
|
777
|
+
* Conversation last. Root Conversations omit it.
|
|
778
|
+
*/
|
|
779
|
+
agentTree: z.array(conversationAgentTreeNodeSchema).min(2).optional(),
|
|
770
780
|
/** The viewer can fork this conversation from an assistant reply. */
|
|
771
781
|
canFork: z.boolean().optional(),
|
|
772
782
|
forkedFromConversationId: z.string().optional(),
|
|
@@ -858,4 +868,4 @@ const conversationStatsReportSchema = z.object({
|
|
|
858
868
|
windowStart: z.string()
|
|
859
869
|
}).strict();
|
|
860
870
|
//#endregion
|
|
861
|
-
export {
|
|
871
|
+
export { forkConversationBodySchema as A, conversationBriefSchema as B, conversationReportEventSchema as C, conversationUsageSchema as D, conversationSummaryReportSchema as E, INPUT_IMAGE_TYPES as F, readMessageCardRefs as G, annotationCard as H, isVisionImageMediaType as I, removedCardSchema as K, briefCodeChangeSchema as L, MAX_INPUT_IMAGES as M, MAX_INPUT_IMAGE_BYTES as N, createConversationBodySchema as O, readMessageAttachments as P, briefLinkSchema as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, messageCardRef as U, parseBriefInput as V, messageCardText as W, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, forkConversationResponseSchema as j, createConversationMessageBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, resolveMessageCards as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, briefOutcomeStatusSchema as z };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { _ as resolvePluginOAuthAccount,
|
|
2
|
-
import { f as escapeXml } from "./client
|
|
3
|
-
import { d as logException, h as runBestEffort, p as logWarn } from "./logging-
|
|
4
|
-
import { a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
1
|
+
import { Sn as createUserTokenStore, _ as resolvePluginOAuthAccount, bn as resolveBaseUrl, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, gt as getMcpProviderErrorAttributes, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, vn as formatProviderLabel, x as lookupSlackUserProfile, yn as parseOAuthStatePayload } from "./agent-runner-DSKpHjHW.js";
|
|
2
|
+
import { f as escapeXml } from "./client--xtsAxKP.js";
|
|
3
|
+
import { d as logException, h as runBestEffort, p as logWarn } from "./logging-DVtMYOdD.js";
|
|
4
|
+
import { a as getRuntimeMetadata, n as botConfig } from "./config-BK53Ip5C.js";
|
|
5
5
|
import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
|
|
6
|
-
import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-
|
|
6
|
+
import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-D5hbx6TE.js";
|
|
7
7
|
import { i as homeDir } from "./package-discovery-BVvSnQBB.js";
|
|
8
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { t as discoverSkills } from "./skills-
|
|
11
|
-
import {
|
|
12
|
-
import { zt as getSlackClient } from "./agent-hooks-
|
|
13
|
-
import { E as acquireActiveLock, w as getStateAdapter } from "./profile-
|
|
14
|
-
import { i as getConversationPendingAuth } from "./pending-auth-
|
|
15
|
-
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
16
|
-
import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-C2rSEio1.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CTaQXYqS.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-C6zJbudq.js";
|
|
11
|
+
import { Nt as recordAuthenticationLinked, Pt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-B9OIjl2K.js";
|
|
12
|
+
import { zt as getSlackClient } from "./agent-hooks-DpklSWZg.js";
|
|
13
|
+
import { E as acquireActiveLock, w as getStateAdapter } from "./profile-BevMNSlr.js";
|
|
14
|
+
import { i as getConversationPendingAuth } from "./pending-auth-BuQLZ6dK.js";
|
|
15
|
+
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-AGZtVyXp.js";
|
|
16
|
+
import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-DCxixz5S.js";
|
|
17
17
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { z } from "zod";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as logException } from "./logging-
|
|
1
|
+
import { d as logException } from "./logging-DVtMYOdD.js";
|
|
2
2
|
import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
|
|
3
|
-
import "./config-
|
|
3
|
+
import "./config-BK53Ip5C.js";
|
|
4
4
|
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BO6ddZax.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { sql } from "drizzle-orm";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-
|
|
3
|
-
import { f as getSqlExecutor } from "./viewer-
|
|
4
|
-
import "./conversation-
|
|
2
|
+
import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-DSKpHjHW.js";
|
|
3
|
+
import { f as getSqlExecutor } from "./viewer-D5hbx6TE.js";
|
|
4
|
+
import "./conversation-CvBG57Io.js";
|
|
5
5
|
//#region src/chat/attachments/images.ts
|
|
6
6
|
var images_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
decodeInputImages: () => decodeInputImages,
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-
|
|
1
|
+
import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-DVtMYOdD.js";
|
|
2
2
|
import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
|
|
3
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
3
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BDBFw6Ws.js";
|
|
4
4
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
|
|
5
5
|
//#region src/chat/sentry-payload-filter.ts
|
|
6
6
|
const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
1
|
+
import { i as getChatConfig } from "./config-BK53Ip5C.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException, y as withScope } from "./sentry-CgWZM_kV.js";
|
|
2
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { t as JUNIOR_VERSION } from "./version-Deub4try.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
+
import { $ as getAgentInvocationIdForMessage, At as appendAndEnqueueInboundMessage, En as toolInvocationDestination, J as createAgentInvocationForMessage, Q as getAgentInvocation, Tn as actorFromRun, X as findChildAgentConversationId, Y as createAgentInvocationFromLatest, Z as getActiveAgentInvocationForConversation, at as getLatestAgentInvocationForConversation, bt as isEventMailboxMetadata, et as getAgentInvocationIdForResult, ht as PARENT_AGENT_TARGET, mt as AgentMessageTargetError, nt as getAgentInvocationResultMessageId, ot as isTerminalAgentInvocation, ut as markAgentInvocationParentMailboxAppended, yt as EVENT_WAIT_MS } from "./agent-runner-DSKpHjHW.js";
|
|
3
|
+
import { r as enqueueAgentInvocation } from "./work-rm2X7jj4.js";
|
|
4
|
+
//#region src/chat/agent-invocations/result.ts
|
|
5
|
+
const AGENT_INVOCATION_EVENT_NAMESPACE = "junior";
|
|
6
|
+
const AGENT_INVOCATION_EVENT_TYPE_PREFIX = "agent_invocation.";
|
|
7
|
+
const AGENT_INVOCATION_RESULT_MAX_LENGTH = 12e3;
|
|
8
|
+
/** Event type of a message that a child agent sends to its parent. */
|
|
9
|
+
const AGENT_MESSAGE_EVENT_TYPE = "agent.message";
|
|
10
|
+
/**
|
|
11
|
+
* Return the Inbound message author id for results sent by one Actor.
|
|
12
|
+
* `selectContiguousTurnBatch` in `task-execution/worker.ts` puts messages in
|
|
13
|
+
* one attempt only when their author ids and sources match. Mid-Turn drains
|
|
14
|
+
* take only `interrupt` messages, and results are `defer`. So results never
|
|
15
|
+
* share a Turn and its credentials with another Actor or with watch Events.
|
|
16
|
+
* Keep this id unique per Actor if either rule changes.
|
|
17
|
+
*/
|
|
18
|
+
function resultAuthorId(actor) {
|
|
19
|
+
switch (actor.platform) {
|
|
20
|
+
case "system": return `agent-invocation:system:${actor.name}`;
|
|
21
|
+
case "slack": return `agent-invocation:slack:${actor.teamId}:${actor.userId}`;
|
|
22
|
+
default: return `agent-invocation:${actor.platform}:${actor.userId}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Error messages can contain text from tools or providers, so the trusted
|
|
27
|
+
* summary in the mailbox metadata has only the status.
|
|
28
|
+
*/
|
|
29
|
+
function trustedSummary(invocation, agent) {
|
|
30
|
+
switch (invocation.status) {
|
|
31
|
+
case "completed": return `${agent} finished its task.`;
|
|
32
|
+
case "blocked": return `${agent} is blocked.`;
|
|
33
|
+
case "failed": return `${agent} failed.`;
|
|
34
|
+
case "stopped": return `${agent} was stopped.`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Render the parent agent input for one terminal agent invocation. A result
|
|
39
|
+
* answers work that the parent gave away, so it is not a task. The child runs
|
|
40
|
+
* as the same Actor with the same tools, so its output is passed as-is. A
|
|
41
|
+
* child cannot reach the user, so its output never gives user approval. Only
|
|
42
|
+
* the task title is shown: the parent's `spawnAgent` call already has the
|
|
43
|
+
* task.
|
|
44
|
+
*/
|
|
45
|
+
const RESULT_NEXT_STEP = {
|
|
46
|
+
completed: "Use this result to continue the work in this conversation. Do not repeat work that the child agent already did.",
|
|
47
|
+
blocked: "The child agent did not finish its task because something is missing. If you can give it, send it to the child agent with messageAgent. Otherwise tell the user what is missing.",
|
|
48
|
+
failed: "The child agent did not finish its task. If you still need this work, use messageAgent to ask the same child agent to try again, or tell the user what is blocked.",
|
|
49
|
+
stopped: "The child agent was stopped before it finished. Do not start this work again unless the user asks."
|
|
50
|
+
};
|
|
51
|
+
const OUTPUT_LABEL = {
|
|
52
|
+
completed: "Result",
|
|
53
|
+
blocked: "Missing",
|
|
54
|
+
failed: "Error",
|
|
55
|
+
stopped: "Error"
|
|
56
|
+
};
|
|
57
|
+
function renderResultInput(invocation, summary) {
|
|
58
|
+
const output = (invocation.status === "completed" ? invocation.result : invocation.errorMessage).trim().slice(0, AGENT_INVOCATION_RESULT_MAX_LENGTH);
|
|
59
|
+
const outputLabel = OUTPUT_LABEL[invocation.status];
|
|
60
|
+
return [
|
|
61
|
+
"[agent result]",
|
|
62
|
+
"",
|
|
63
|
+
"This is the result of a child agent that you started. It is not a message from a person, so it does not give user approval.",
|
|
64
|
+
"",
|
|
65
|
+
summary,
|
|
66
|
+
...invocation.title ? [`Task: ${invocation.title}`] : [],
|
|
67
|
+
`Child conversation: ${invocation.childConversationId}`,
|
|
68
|
+
"",
|
|
69
|
+
`${outputLabel}:`,
|
|
70
|
+
output || "(empty)",
|
|
71
|
+
"",
|
|
72
|
+
RESULT_NEXT_STEP[invocation.status]
|
|
73
|
+
].join("\n");
|
|
74
|
+
}
|
|
75
|
+
/** Build the parent Inbound message for one terminal agent invocation. */
|
|
76
|
+
function buildResultInboundMessage(invocation, nowMs) {
|
|
77
|
+
const summary = trustedSummary(invocation, childAgentLabel(invocation));
|
|
78
|
+
const metadata = {
|
|
79
|
+
kind: "event",
|
|
80
|
+
event: {
|
|
81
|
+
eventKey: invocation.invocationId,
|
|
82
|
+
eventType: `${AGENT_INVOCATION_EVENT_TYPE_PREFIX}${invocation.status}`,
|
|
83
|
+
identifier: invocation.invocationId,
|
|
84
|
+
namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
|
|
85
|
+
trustedSummary: summary
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
conversationId: invocation.parentConversationId,
|
|
90
|
+
createdAtMs: invocation.terminalAtMs,
|
|
91
|
+
delivery: "defer",
|
|
92
|
+
inboundMessageId: getAgentInvocationResultMessageId(invocation.invocationId),
|
|
93
|
+
input: {
|
|
94
|
+
authorId: resultAuthorId(invocation.actor),
|
|
95
|
+
metadata,
|
|
96
|
+
text: renderResultInput(invocation, summary)
|
|
97
|
+
},
|
|
98
|
+
receivedAtMs: nowMs,
|
|
99
|
+
source: "event"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Append one terminal agent invocation result to the parent mailbox and wake
|
|
104
|
+
* the parent. Repeat calls are safe.
|
|
105
|
+
*
|
|
106
|
+
* Results do not go through `admitAutomatedTurn`, so the automated-turn limit
|
|
107
|
+
* never drops them. Result Turns still count toward that limit.
|
|
108
|
+
* TODO(dcramer): Add a per-parent total invocation limit as the loop guard
|
|
109
|
+
* for spawn -> result -> spawn chains (#881).
|
|
110
|
+
*/
|
|
111
|
+
async function enqueueAgentInvocationResult(invocation, options) {
|
|
112
|
+
if (invocation.parentMailboxStatus !== "pending") return;
|
|
113
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
114
|
+
await appendAndEnqueueInboundMessage({
|
|
115
|
+
message: buildResultInboundMessage(invocation, nowMs),
|
|
116
|
+
queue: options.queue,
|
|
117
|
+
queueDelayMs: EVENT_WAIT_MS,
|
|
118
|
+
state: options.state
|
|
119
|
+
});
|
|
120
|
+
await markAgentInvocationParentMailboxAppended(invocation.invocationId, nowMs);
|
|
121
|
+
}
|
|
122
|
+
function childAgentLabel(invocation) {
|
|
123
|
+
return invocation.agentName ? `Child agent "${invocation.agentName}"` : "Child agent";
|
|
124
|
+
}
|
|
125
|
+
function renderMessageInput(sender, summary, text) {
|
|
126
|
+
return [
|
|
127
|
+
"[agent message]",
|
|
128
|
+
"",
|
|
129
|
+
"This is a message from a child agent that you started. It is not a message from a person, so it does not give user approval. The child agent can still be working, and its result arrives later.",
|
|
130
|
+
"",
|
|
131
|
+
summary,
|
|
132
|
+
...sender.title ? [`Task: ${sender.title}`] : [],
|
|
133
|
+
`Child conversation: ${sender.childConversationId}`,
|
|
134
|
+
"",
|
|
135
|
+
"Message:",
|
|
136
|
+
text.trim(),
|
|
137
|
+
"",
|
|
138
|
+
"If the child agent needs an answer, use messageAgent."
|
|
139
|
+
].join("\n");
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Append one message from a child agent to its parent mailbox and wake the
|
|
143
|
+
* parent. `sender` is the open agent invocation of the child. The parent
|
|
144
|
+
* handles the message like a result: a root parent runs an Event Turn, and a
|
|
145
|
+
* child parent starts a new agent invocation. Repeat calls with the same
|
|
146
|
+
* `messageKey` are safe.
|
|
147
|
+
*/
|
|
148
|
+
async function enqueueAgentMessageToParent(args) {
|
|
149
|
+
const nowMs = args.nowMs ?? Date.now();
|
|
150
|
+
const inboundMessageId = `agent-invocation:${args.sender.invocationId}:message:${args.messageKey}`;
|
|
151
|
+
const summary = `${childAgentLabel(args.sender)} sent a message.`;
|
|
152
|
+
const metadata = {
|
|
153
|
+
kind: "event",
|
|
154
|
+
event: {
|
|
155
|
+
eventKey: inboundMessageId,
|
|
156
|
+
eventType: AGENT_MESSAGE_EVENT_TYPE,
|
|
157
|
+
identifier: args.sender.invocationId,
|
|
158
|
+
namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
|
|
159
|
+
trustedSummary: summary
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
await appendAndEnqueueInboundMessage({
|
|
163
|
+
message: {
|
|
164
|
+
conversationId: args.sender.parentConversationId,
|
|
165
|
+
createdAtMs: nowMs,
|
|
166
|
+
delivery: "defer",
|
|
167
|
+
inboundMessageId,
|
|
168
|
+
input: {
|
|
169
|
+
authorId: resultAuthorId(args.sender.actor),
|
|
170
|
+
metadata,
|
|
171
|
+
text: renderMessageInput(args.sender, summary, args.text)
|
|
172
|
+
},
|
|
173
|
+
receivedAtMs: nowMs,
|
|
174
|
+
source: "event"
|
|
175
|
+
},
|
|
176
|
+
queue: args.queue,
|
|
177
|
+
queueDelayMs: EVENT_WAIT_MS,
|
|
178
|
+
state: args.state
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Read the agent invocation that one result or message Event refers to: the
|
|
183
|
+
* finished child work for a result, or the open sender work for a message.
|
|
184
|
+
*/
|
|
185
|
+
function childAgentInput(message) {
|
|
186
|
+
const metadata = message.input.metadata;
|
|
187
|
+
if (!isEventMailboxMetadata(metadata) || metadata.event.namespace !== AGENT_INVOCATION_EVENT_NAMESPACE) return;
|
|
188
|
+
if (metadata.event.eventType === AGENT_MESSAGE_EVENT_TYPE) return {
|
|
189
|
+
invocationId: metadata.event.identifier,
|
|
190
|
+
kind: "message"
|
|
191
|
+
};
|
|
192
|
+
return metadata.event.eventType.startsWith(AGENT_INVOCATION_EVENT_TYPE_PREFIX) ? {
|
|
193
|
+
invocationId: metadata.event.identifier,
|
|
194
|
+
kind: "result"
|
|
195
|
+
} : void 0;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Read the agent invocation of one result or message and check that it
|
|
199
|
+
* belongs to a child of the Conversation that received it.
|
|
200
|
+
*/
|
|
201
|
+
async function getChildAgentInputInvocation(message, input) {
|
|
202
|
+
const invocation = await getAgentInvocation(input.invocationId);
|
|
203
|
+
if (!invocation || input.kind === "result" && !isTerminalAgentInvocation(invocation) || invocation.parentConversationId !== message.conversationId) throw new Error(`Agent invocation ${input.kind} ${input.invocationId} does not belong to ${message.conversationId}`);
|
|
204
|
+
return invocation;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Give agent invocation results and messages that reach a child Conversation
|
|
208
|
+
* to that child. A child Conversation has no Location, so it cannot run an
|
|
209
|
+
* Event Turn. Each result or message starts a new agent invocation on the
|
|
210
|
+
* child instead, and that invocation reports to the child's parent. Returns
|
|
211
|
+
* undefined for work that is not a result or message for a child
|
|
212
|
+
* Conversation.
|
|
213
|
+
*/
|
|
214
|
+
async function startAgentInvocationsForChildResults(context, options) {
|
|
215
|
+
const messages = context.attempt.messages;
|
|
216
|
+
const inputs = messages.map(childAgentInput);
|
|
217
|
+
if (messages.length === 0 || inputs.some((input) => !input)) return;
|
|
218
|
+
const latest = await getLatestAgentInvocationForConversation(context.conversationId);
|
|
219
|
+
if (!latest) return;
|
|
220
|
+
if (latest.status === "stopped" || isTerminalAgentInvocation(latest) && latest.parentMailboxStatus === "skipped") {
|
|
221
|
+
await context.attempt.ack();
|
|
222
|
+
return { status: "completed" };
|
|
223
|
+
}
|
|
224
|
+
for (const [index, message] of messages.entries()) {
|
|
225
|
+
const input = inputs[index];
|
|
226
|
+
const source = await getChildAgentInputInvocation(message, input);
|
|
227
|
+
if (input.kind === "result" && isTerminalAgentInvocation(source) && source.parentMailboxStatus === "skipped") continue;
|
|
228
|
+
const invocation = await createAgentInvocationFromLatest({
|
|
229
|
+
input: message.input.text.trim(),
|
|
230
|
+
invocationId: input.kind === "result" ? getAgentInvocationIdForResult(source.invocationId) : getAgentInvocationIdForMessage(message.inboundMessageId),
|
|
231
|
+
latest
|
|
232
|
+
});
|
|
233
|
+
await enqueueAgentInvocation(invocation, options);
|
|
234
|
+
}
|
|
235
|
+
await context.attempt.ack();
|
|
236
|
+
return { status: "completed" };
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Run each agent invocation result or message as the Actor that triggered the
|
|
240
|
+
* child, user or system. This is on purpose: the result continues that
|
|
241
|
+
* Actor's work. The Actor comes from SQL, not from mailbox metadata, so the
|
|
242
|
+
* parent Turn has the same authority it had at spawn time.
|
|
243
|
+
*
|
|
244
|
+
* TODO(dcramer): Pass the delegated credential subject of a system Actor, such
|
|
245
|
+
* as a timer watch Turn, when system Turns can spawn children that need it.
|
|
246
|
+
*/
|
|
247
|
+
async function withAgentInvocationResultActors(work) {
|
|
248
|
+
if (work.kind !== "mailbox") return work;
|
|
249
|
+
return {
|
|
250
|
+
kind: "mailbox",
|
|
251
|
+
batch: await Promise.all(work.batch.map(async (entry) => {
|
|
252
|
+
const input = childAgentInput(entry.message);
|
|
253
|
+
if (!input) return entry;
|
|
254
|
+
const invocation = await getChildAgentInputInvocation(entry.message, input);
|
|
255
|
+
return {
|
|
256
|
+
...entry,
|
|
257
|
+
actor: invocation.actor
|
|
258
|
+
};
|
|
259
|
+
}))
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/chat/agent-invocations/message.ts
|
|
264
|
+
var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
|
|
265
|
+
/**
|
|
266
|
+
* Bind a Run's Actor and credentials to messages for its parent and child
|
|
267
|
+
* agents. A message to a child continues that child. A message to the parent
|
|
268
|
+
* wakes the parent like a result.
|
|
269
|
+
*/
|
|
270
|
+
function bindMessageAgent(run, options) {
|
|
271
|
+
const actor = actorFromRun(run);
|
|
272
|
+
if (!actor) return;
|
|
273
|
+
return async (input, call) => {
|
|
274
|
+
call.signal?.throwIfAborted();
|
|
275
|
+
const queue = typeof options.queue === "function" ? options.queue() : options.queue;
|
|
276
|
+
if (input.to === "parent") {
|
|
277
|
+
const sender = await getActiveAgentInvocationForConversation(run.conversationId);
|
|
278
|
+
if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
|
|
279
|
+
await enqueueAgentMessageToParent({
|
|
280
|
+
messageKey: `${run.turnId}:${call.toolCallId}`,
|
|
281
|
+
queue,
|
|
282
|
+
sender,
|
|
283
|
+
state: options.state,
|
|
284
|
+
text: input.text
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
conversationId: sender.parentConversationId,
|
|
288
|
+
delivery: "queued"
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const childConversationId = await findChildAgentConversationId({
|
|
292
|
+
parentConversationId: run.conversationId,
|
|
293
|
+
target: input.to
|
|
294
|
+
});
|
|
295
|
+
if (!childConversationId) throw new AgentMessageTargetError(`"${input.to}" is not "${PARENT_AGENT_TARGET}" or a child agent of this conversation`);
|
|
296
|
+
const { invocation, queued } = await createAgentInvocationForMessage({
|
|
297
|
+
actor,
|
|
298
|
+
childConversationId,
|
|
299
|
+
...run.credentialContext ? { credentialContext: run.credentialContext } : void 0,
|
|
300
|
+
destination: toolInvocationDestination(run),
|
|
301
|
+
idempotencyKey: `${run.turnId}:${call.toolCallId}`,
|
|
302
|
+
input: input.text,
|
|
303
|
+
parentConversationId: run.conversationId,
|
|
304
|
+
parentToolCallId: call.toolCallId
|
|
305
|
+
});
|
|
306
|
+
await enqueueAgentInvocation(invocation, {
|
|
307
|
+
...options,
|
|
308
|
+
queue
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
conversationId: childConversationId,
|
|
312
|
+
delivery: queued ? "queued" : "started"
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
export { withAgentInvocationResultActors as a, startAgentInvocationsForChildResults as i, message_exports as n, enqueueAgentInvocationResult as r, bindMessageAgent as t };
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as JuniorDashboardOptions } from "./app-
|
|
1
|
+
import { r as JuniorDashboardOptions } from "./app-BYB7szGb.js";
|
|
2
2
|
import { n as JuniorPluginSet } from "./plugins-CjfUP5gJ.js";
|
|
3
3
|
//#region src/nitro.d.ts
|
|
4
4
|
export type JuniorNitroDashboardOptions = JuniorDashboardOptions;
|
package/dist/nitro.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as JUNIOR_RETENTION_ROUTE, D as JUNIOR_HEARTBEAT_ROUTE, E as JUNIOR_HEARTBEAT_CRON_SCHEDULE, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, k as JUNIOR_RETENTION_CRON_SCHEDULE } from "./logging-
|
|
1
|
+
import { A as JUNIOR_RETENTION_ROUTE, D as JUNIOR_HEARTBEAT_ROUTE, E as JUNIOR_HEARTBEAT_CRON_SCHEDULE, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, k as JUNIOR_RETENTION_CRON_SCHEDULE } from "./logging-DVtMYOdD.js";
|
|
2
2
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-BVvSnQBB.js";
|
|
3
|
-
import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-
|
|
3
|
+
import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-Cz3M7gg4.js";
|
|
4
4
|
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
|
|
5
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-
|
|
5
|
+
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BX4vG6uA.js";
|
|
6
6
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-CVvEUSMH.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ot as extractAssistantText } from "./tasks-B9OIjl2K.js";
|
|
2
2
|
//#region src/chat/runtime/turn.ts
|
|
3
3
|
/** Classified Slack turn failure carrying the owning Sentry capture outward. */
|
|
4
4
|
var ConversationTurnBoundaryError = class extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
1
|
+
import { Sn as createUserTokenStore } from "./agent-runner-DSKpHjHW.js";
|
|
2
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BiuhC9Ds.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
//#region src/chat/local/oauth-callback-server.ts
|
|
5
5
|
const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as isProviderRetryError } from "./client
|
|
2
|
-
import {
|
|
1
|
+
import { v as isProviderRetryError } from "./client--xtsAxKP.js";
|
|
2
|
+
import { Y as abandonTurnRecord, sn as estimateTextTokens } from "./tasks-B9OIjl2K.js";
|
|
3
3
|
import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/chat/state/turn-id.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as toOptionalTrimmed } from "./client
|
|
2
|
-
import { v as setSpanAttributes, y as setSpanStatus } from "./logging-
|
|
3
|
-
import { i as getChatConfig } from "./config-
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
1
|
+
import { S as toOptionalTrimmed } from "./client--xtsAxKP.js";
|
|
2
|
+
import { v as setSpanAttributes, y as setSpanStatus } from "./logging-DVtMYOdD.js";
|
|
3
|
+
import { i as getChatConfig } from "./config-BK53Ip5C.js";
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CTaQXYqS.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
7
7
|
import { createRedisState } from "@chat-adapter/state-redis";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { B as conversationBriefSchema, V as parseBriefInput, z as briefOutcomeStatusSchema } from "./conversation-CvBG57Io.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/chat/briefs/generate.ts
|
|
4
4
|
const MAX_INPUT_CHARS = 6e4;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-
|
|
1
|
+
import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-DVtMYOdD.js";
|
|
2
2
|
import { o as parseActorUserId } from "./actor-BTtLaeWy.js";
|
|
3
3
|
import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-BVvSnQBB.js";
|
|
4
4
|
import path from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as setSpanAttributes, w as withSpan } from "./logging-
|
|
2
|
-
import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-
|
|
1
|
+
import { v as setSpanAttributes, w as withSpan } from "./logging-DVtMYOdD.js";
|
|
2
|
+
import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-BevMNSlr.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { FileSystem, Sandbox } from "@vercel/sandbox";
|
|
5
5
|
//#region src/chat/sandbox/resources.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as withLogContext, b as setTags, d as logException } from "./logging-
|
|
2
|
-
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-
|
|
3
|
-
import { d as credentialContextForActor } from "./registry-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-
|
|
7
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
8
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
9
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
10
|
-
import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-
|
|
1
|
+
import { C as withLogContext, b as setTags, d as logException } from "./logging-DVtMYOdD.js";
|
|
2
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-D5hbx6TE.js";
|
|
3
|
+
import { d as credentialContextForActor } from "./registry-C2rSEio1.js";
|
|
4
|
+
import { Dt as loadProjection, Ht as hydrateConversationMessages, J as saveTurnCheckpoint, Pt as recordAuthorizationCompleted, St as commitAcceptedReply, Ut as persistConversationMessages, Zt as buildConversationContext, in as recordDeliveredAssistantMessage, nn as markConversationMessage, on as upsertConversationMessage, rn as normalizeConversationText, tt as persistWithRetry } from "./tasks-B9OIjl2K.js";
|
|
5
|
+
import { W as messageCardText } from "./conversation-CvBG57Io.js";
|
|
6
|
+
import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-By_MVRDC.js";
|
|
7
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-T51kll0U.js";
|
|
8
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DZJkJ95q.js";
|
|
9
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-AGZtVyXp.js";
|
|
10
|
+
import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-DJ8KU2bo.js";
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
12
12
|
import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
|
|
13
13
|
//#region src/chat/local/runner.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _n as sandboxEgressSignalsResponseSchema } from "./agent-runner-DSKpHjHW.js";
|
|
2
2
|
//#region src/chat/local/sandbox-egress-signals.ts
|
|
3
3
|
const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
|
|
4
4
|
const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-BO6ddZax.js";
|
|
2
|
-
import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-
|
|
2
|
+
import { D as conversationUsageSchema, E as conversationSummaryReportSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-CvBG57Io.js";
|
|
3
3
|
import "./automation-gznOMaQ2.js";
|
|
4
4
|
import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-xPI_EFSC.js";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -8,15 +8,39 @@ import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
|
|
|
8
8
|
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
9
9
|
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
10
10
|
//#endregion
|
|
11
|
+
//#region src/api/schema/conversation-stop.ts
|
|
12
|
+
/** One queued web message from the viewer that a stop removed. */
|
|
13
|
+
const stoppedConversationMessageSchema = z.object({
|
|
14
|
+
inboundMessageId: z.string().min(1),
|
|
15
|
+
text: z.string().min(1)
|
|
16
|
+
}).strict();
|
|
17
|
+
/**
|
|
18
|
+
* Result of stopping the active Turn.
|
|
19
|
+
*
|
|
20
|
+
* `stoppedInboundMessageIds` lists every queued human message the stop
|
|
21
|
+
* removes. `stoppedMessages` holds only the viewer's own web text, so the
|
|
22
|
+
* dashboard can return it to the composer.
|
|
23
|
+
*/
|
|
24
|
+
const stopConversationTurnResponseSchema = z.object({
|
|
25
|
+
conversationId: z.string().min(1),
|
|
26
|
+
status: z.enum(["no_work", "requested"]),
|
|
27
|
+
stoppedInboundMessageIds: z.array(z.string().min(1)),
|
|
28
|
+
stoppedMessages: z.array(stoppedConversationMessageSchema)
|
|
29
|
+
}).strict();
|
|
30
|
+
//#endregion
|
|
11
31
|
//#region src/api/schema/child-agent.ts
|
|
12
32
|
/**
|
|
13
33
|
* One direct child agent of a Conversation, from agent invocation records.
|
|
14
34
|
*
|
|
15
|
-
* Viewers who cannot see private content get the status and
|
|
16
|
-
* name, task, title, or error.
|
|
35
|
+
* Viewers who cannot see private content get the status, time, and usage, but
|
|
36
|
+
* not the name, task, title, or error. Usage covers the child Conversation
|
|
37
|
+
* only, like the detail of that child Conversation.
|
|
17
38
|
*/
|
|
18
39
|
const conversationChildAgentSchema = z.object({
|
|
40
|
+
auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
|
|
19
41
|
conversationId: z.string().min(1),
|
|
42
|
+
cumulativeDurationMs: z.number(),
|
|
43
|
+
cumulativeUsage: conversationUsageSchema.optional(),
|
|
20
44
|
error: z.string().min(1).optional(),
|
|
21
45
|
name: z.string().min(1).optional(),
|
|
22
46
|
redacted: z.literal(true).optional(),
|
|
@@ -375,4 +399,4 @@ const statsReportSchema = z.object({
|
|
|
375
399
|
windowStart: z.string()
|
|
376
400
|
}).strict();
|
|
377
401
|
//#endregion
|
|
378
|
-
export { codeChangeSummarySchema as A, locationParamsSchema as C, dailyConversationActivitySchema as D, activitySixHours as E, codeRepositorySummarySchema as F, conversationChildAgentSchema as I, conversationChildAgentsReportSchema as L, codePersonReportSchema as M, codeRepositoryParamsSchema as N, codeActivityDaySchema as O, codeRepositoryReportSchema as P,
|
|
402
|
+
export { codeChangeSummarySchema as A, locationParamsSchema as C, dailyConversationActivitySchema as D, activitySixHours as E, codeRepositorySummarySchema as F, conversationChildAgentSchema as I, conversationChildAgentsReportSchema as L, codePersonReportSchema as M, codeRepositoryParamsSchema as N, codeActivityDaySchema as O, codeRepositoryReportSchema as P, stopConversationTurnResponseSchema as R, locationDirectoryReportSchema as S, activityHours as T, actorProfileReportSchema as _, workspaceBodySchema as a, locationActivityDayReportSchema as b, workspaceRepoSchema as c, createdPersonalTokenSchema as d, personalTokenListSchema as f, actorDirectoryReportSchema as g, revokePersonalTokenResponseSchema as h, deleteWorkspaceResponseSchema as i, codeOverviewReportSchema as j, codeChangeSummaryReportSchema as k, workspaceSchema as l, personalTokenParamsSchema as m, statsReportSchema as n, workspaceListSchema as o, personalTokenMetadataSchema as p, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, createPersonalTokenBodySchema as u, personParamsSchema as v, activityDays as w, locationDetailReportSchema as x, personalSpendReportSchema as y, apiErrorSchema as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { p as logWarn } from "./logging-
|
|
2
|
+
import { p as logWarn } from "./logging-DVtMYOdD.js";
|
|
3
3
|
import { s as skillRoots } from "./package-discovery-BVvSnQBB.js";
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CTaQXYqS.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|