@sentry/junior 0.298.0 → 0.299.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/{actor-6jsm_v96.js → actor-D2iXzvlN.js} +2 -1
- package/dist/{state-CSuA2J1V.js → adapter-AgCNqqsG.js} +49 -133
- package/dist/{admin-BF3DbYGf.js → admin-1VwEXztm.js} +2 -2
- package/dist/{agent-runner-Q9GkoerG.js → agent-runner-Ciet8_nn.js} +977 -1316
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +8 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +125 -43
- package/dist/{app-DOg_mCtV.d.ts → app--ky-Eu33.d.ts} +6 -4
- package/dist/app.d.ts +1 -1
- package/dist/app.js +126 -299
- package/dist/{automation-Cn8qmbdr.js → automation-M3RFJUBf.js} +1 -1
- package/dist/{background-compaction-queue-BZhGFOK6.js → background-compaction-queue-CnimvRdk.js} +4 -4
- package/dist/{briefs-CQrCRF6-.js → briefs-CwzvgdCa.js} +4 -4
- package/dist/{catalog-runtime-DZeD2WbL.js → catalog-runtime-DaBaHY7u.js} +1 -1
- package/dist/cli/chat.js +17 -17
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{config-BOByVnxe.js → config-CAXIpWQb.js} +80 -6
- package/dist/{connections-BNN5cJam.js → connections-Dy0hPdUq.js} +6 -6
- package/dist/continue-in-slack-DIOjFj76.js +176 -0
- package/dist/{conversation-DCkzvxqB.js → conversation-fCWD9Az3.js} +24 -12
- package/dist/{conversation-feed-CMA12Rjs.js → conversation-feed-BPK8vkkZ.js} +88 -3
- package/dist/{conversation-privacy-C0eRxsgb.js → conversation-privacy-DUgtRkf8.js} +1 -1
- package/dist/{conversation-turn-D9qvcDX6.js → conversation-turn-DkJB6yMF.js} +85 -68
- package/dist/{credential-sync-B_iUpxGL.js → credential-sync-RX24Y8aY.js} +18 -18
- package/dist/{db-DoMcnYol.d.ts → db-B07FtU9g.d.ts} +1 -1
- package/dist/{db-CoMNr2Zm.js → db-COYOGzYS.js} +171 -12
- package/dist/{executor-C-m8VrzX.js → executor-BWmAgSyi.js} +40 -11
- package/dist/{media-BepyEUNm.js → history-IjdmO_r6.js} +1 -85
- package/dist/instrumentation.js +2 -2
- package/dist/lineage-D-5jm_oj.js +37 -0
- package/dist/{logging-CJTi5niy.js → logging-DPLEa8Bn.js} +1 -1
- package/dist/media-BAHvgkok.js +85 -0
- package/dist/{message-Q6_5DAWR.js → message-BIHR1yRk.js} +9 -10
- package/dist/model-input-BPZYH8Nd.js +82 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +17 -9
- package/dist/{oauth-callback-server-CH5XAyo-.js → oauth-callback-server-R7qvSzFG.js} +2 -2
- package/dist/{plugins-HYh_JOdw.js → plugins-CBW2Prb_.js} +1 -1
- package/dist/{projection-BgwEE36_.js → projection-DEdP1q6f.js} +261 -36
- package/dist/{prompt-DXc9DYT9.js → prompt-4M98h_tC.js} +4 -4
- package/dist/{registry-9XwqSnM-.js → registry-BTKmKM-r.js} +3 -3
- package/dist/{resolve-DUIAbcRL.js → resolve-B8hXNVZ3.js} +3 -3
- package/dist/{result-C2Vn8QGn.js → result-g-XAaOj6.js} +158 -69
- package/dist/{runner-CXGtw-Mc.js → runner-BlPSA5A8.js} +9 -9
- package/dist/{sandbox-egress-signals-Di3S_dO7.js → sandbox-egress-signals-Pai-MzEY.js} +1 -1
- package/dist/{schema-Dyp7racy.js → schema-BNnY_trV.js} +47 -7
- package/dist/{schema-BnbZ-rKv.d.ts → schema-DbuWR-DN.d.ts} +657 -346
- package/dist/{service-account-GzAMUQ8a.js → service-account-9OLNQMyz.js} +4 -4
- package/dist/{service-account-DM3KBBeG.js → service-account-BYGZ08DQ.js} +3 -3
- package/dist/session-stop-2XJrcNCy.js +3356 -0
- package/dist/{skills-DCK9SD_l.js → skills-DpBQoeHV.js} +3 -3
- package/dist/slack-conversation-unfurl-BcDIWo67.js +370 -0
- package/dist/spawn-09GssFod.js +73 -0
- package/dist/state-Cufq0_rH.js +132 -0
- package/dist/{user-input-request-CXNIov9n.js → statuses-B8mUfghF.js} +30 -25
- package/dist/{stop-Dh2DfwpK.js → stop-U7iUrR1g.js} +6008 -5772
- package/dist/{store-B1zepKG8.js → store-BHiaHCQu.js} +24 -4
- package/dist/{store-DrA17Fbz.js → store-CSgUTMdv.js} +10 -10
- package/dist/{task-queue-D1rXWfFN.js → task-queue-bMNq0clp.js} +4 -4
- package/dist/{task-runner-CT4M8oDz.js → task-runner-B__rxwxU.js} +10 -10
- package/dist/{thread-context-DnqUkbzN.js → thread-context-d0ceWbVT.js} +18 -18
- package/dist/{turn-session-routing-VXDVXLRl.js → turn-session-routing-BVZHBFCF.js} +5 -5
- package/dist/turn-user-message-BEw7acTP.js +355 -0
- package/dist/users-BK3dbxZL.js +424 -0
- package/dist/{validation-zxAJBDDy.js → validation-BDVJjO2E.js} +1 -1
- package/dist/{version-DcZ40a0g.js → version-DQgZoQ3D.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CgiGjW10.js → viewer-CAWfFo29.js} +25 -54
- package/dist/{warmup-CwKbxQLl.js → warmup-9ySPacF9.js} +1137 -144
- package/dist/{worker-CbDUzaBA.js → worker-D8jJO-WO.js} +8 -7
- package/migrations/0104_code_change_draft.sql +1 -0
- package/migrations/0105_attachment_uploads.sql +14 -0
- package/migrations/0106_conversation_agent_config.sql +1 -0
- package/migrations/meta/0104_snapshot.json +4516 -0
- package/migrations/meta/0105_snapshot.json +4611 -0
- package/migrations/meta/0106_snapshot.json +4617 -0
- package/migrations/meta/_journal.json +21 -0
- package/package.json +4 -4
- package/dist/attempt-selection-ClP3MMPr.js +0 -61
- package/dist/locks-D-0h111u.js +0 -48
- package/dist/notification-Bv25xbj0.js +0 -1284
- package/dist/prompt-input-BUr4J9RO.js +0 -1424
- package/dist/session-stop-D4i7e6iT.js +0 -181
- package/dist/spawn-6cX6xE9G.js +0 -80
- package/dist/turn-cancel-l460pfGW.js +0 -201
- package/dist/turn-user-message-BSPmkm7X.js +0 -608
- package/dist/turn-wake-DVFVXyhX.js +0 -161
- package/dist/{oauth-relay-CsfIazeF.js → oauth-relay-DRzq73b6.js} +1 -1
package/dist/cli/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
1
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-Ciet8_nn.js";
|
|
2
2
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -98,11 +98,11 @@ async function loadLocalPluginSet() {
|
|
|
98
98
|
/** Configure plugin hooks after local chat has selected its state adapter. */
|
|
99
99
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
100
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
101
|
-
import("../plugins-
|
|
102
|
-
import("../projection-
|
|
103
|
-
import("../catalog-runtime-
|
|
104
|
-
import("../validation-
|
|
105
|
-
import("../db-
|
|
101
|
+
import("../plugins-CBW2Prb_.js").then((n) => n.o),
|
|
102
|
+
import("../projection-DEdP1q6f.js").then((n) => n.nr),
|
|
103
|
+
import("../catalog-runtime-DaBaHY7u.js").then((n) => n.t),
|
|
104
|
+
import("../validation-BDVJjO2E.js").then((n) => n.r),
|
|
105
|
+
import("../db-COYOGzYS.js").then((n) => n.n)
|
|
106
106
|
]);
|
|
107
107
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
108
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -152,19 +152,19 @@ function localDevServerUrl() {
|
|
|
152
152
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
153
153
|
defaultStateAdapterForLocalChat();
|
|
154
154
|
await configureLocalChatPlugins(pluginSet);
|
|
155
|
-
const { setBriefsConfig } = await import("../projection-
|
|
155
|
+
const { setBriefsConfig } = await import("../projection-DEdP1q6f.js").then((n) => n.hr);
|
|
156
156
|
setBriefsConfig({ enabled: true });
|
|
157
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
158
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
159
|
-
const { createLocalOAuthState } = await import("../oauth-relay-
|
|
160
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
161
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
162
|
-
const { bindMessageAgent } = await import("../message-
|
|
163
|
-
const { createChildConversationWorker, createDeliverToParent } = await import("../result-
|
|
164
|
-
const { createConversationTurnWorker } = await import("../conversation-turn-
|
|
165
|
-
const { skipInputAfterConversationStop } = await import("../session-stop-
|
|
157
|
+
const { runLocalAgentTurn } = await import("../runner-BlPSA5A8.js");
|
|
158
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-R7qvSzFG.js");
|
|
159
|
+
const { createLocalOAuthState } = await import("../oauth-relay-DRzq73b6.js").then((n) => n.t);
|
|
160
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-Pai-MzEY.js");
|
|
161
|
+
const { bindSpawnAgent } = await import("../spawn-09GssFod.js").then((n) => n.n);
|
|
162
|
+
const { bindMessageAgent } = await import("../message-BIHR1yRk.js").then((n) => n.n);
|
|
163
|
+
const { createChildConversationWorker, createDeliverToParent } = await import("../result-g-XAaOj6.js").then((n) => n.o);
|
|
164
|
+
const { createConversationTurnWorker } = await import("../conversation-turn-DkJB6yMF.js").then((n) => n.t);
|
|
165
|
+
const { skipInputAfterConversationStop } = await import("../session-stop-2XJrcNCy.js").then((n) => n.a);
|
|
166
166
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
167
|
-
const { processConversationWork } = await import("../worker-
|
|
167
|
+
const { processConversationWork } = await import("../worker-D8jJO-WO.js").then((n) => n.n);
|
|
168
168
|
let agentRunner;
|
|
169
169
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
170
170
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
2
|
-
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-
|
|
3
|
-
import { i as parseSkillFile } from "../skills-
|
|
1
|
+
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DPLEa8Bn.js";
|
|
2
|
+
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-BTKmKM-r.js";
|
|
3
|
+
import { i as parseSkillFile } from "../skills-DpBQoeHV.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
package/dist/cli/main.js
CHANGED
|
@@ -45,13 +45,13 @@ 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-1VwEXztm.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-BYGZ08DQ.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-
|
|
54
|
+
return await (await import("../briefs-CwzvgdCa.js")).runBriefs(argv);
|
|
55
55
|
}
|
|
56
56
|
function topLevelCommand(argv) {
|
|
57
57
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as getDb } from "../db-
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
5
|
-
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-
|
|
1
|
+
import { Oo as createPluginLogger, fr as setPlugins, pr as validatePlugins } from "../projection-DEdP1q6f.js";
|
|
2
|
+
import { o as getDb } from "../db-COYOGzYS.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-DaBaHY7u.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BDVJjO2E.js";
|
|
5
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-CBW2Prb_.js";
|
|
6
6
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
8
8
|
import { createJiti } from "jiti";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as resolve } from "../resolve-
|
|
1
|
+
import { Qi as create, so as SANDBOX_RUNTIME } from "../projection-DEdP1q6f.js";
|
|
2
|
+
import { t as disconnectStateAdapter } from "../adapter-AgCNqqsG.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-DaBaHY7u.js";
|
|
4
|
+
import { n as resolve } from "../resolve-B8hXNVZ3.js";
|
|
5
5
|
// src/cli/snapshot-create.ts
|
|
6
6
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
7
7
|
function progressMessage(phase) {
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
3
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
4
|
-
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-
|
|
1
|
+
import { i as getChatConfig } from "../config-CAXIpWQb.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-BWmAgSyi.js";
|
|
3
|
+
import { t as createPluginCatalogRuntime } from "../registry-BTKmKM-r.js";
|
|
4
|
+
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-CBW2Prb_.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
3
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
2
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DPLEa8Bn.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-DUgtRkf8.js";
|
|
4
4
|
import { AwsClient } from "aws4fetch";
|
|
5
|
-
import { del, get, put } from "@vercel/blob";
|
|
5
|
+
import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
|
|
6
|
+
import * as z from "zod";
|
|
6
7
|
import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
|
|
7
8
|
import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
8
9
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
9
10
|
import { getVercelOidcToken } from "@vercel/oidc";
|
|
10
11
|
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject, rerank } from "ai";
|
|
11
12
|
import { createHash } from "node:crypto";
|
|
12
|
-
import * as z from "zod";
|
|
13
13
|
// src/chat/optional-string.ts
|
|
14
14
|
/**
|
|
15
15
|
* Normalize optional env-style strings so blank values do not masquerade as
|
|
@@ -50,6 +50,16 @@ function createMemoryAttachmentStorage() {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
// src/chat/attachments/vercel.ts
|
|
53
|
+
const BLOB_API_VERSION = "12";
|
|
54
|
+
const delegationPayloadSchema = z.object({ storeId: z.string().min(1) });
|
|
55
|
+
/**
|
|
56
|
+
* Read the store id from a delegation token, as the SDK does for its own
|
|
57
|
+
* presigned requests. The token payload is base64url JSON before the dot.
|
|
58
|
+
*/
|
|
59
|
+
function delegationStoreId(delegationToken) {
|
|
60
|
+
const { storeId } = delegationPayloadSchema.parse(JSON.parse(Buffer.from(delegationToken.split(".")[0] ?? "", "base64url").toString()));
|
|
61
|
+
return storeId.replace(/^store_/, "");
|
|
62
|
+
}
|
|
53
63
|
/** Store private conversation attachments in Vercel Blob. */
|
|
54
64
|
function createVercelAttachmentStorage() {
|
|
55
65
|
return {
|
|
@@ -62,6 +72,36 @@ function createVercelAttachmentStorage() {
|
|
|
62
72
|
contentType: input.contentType
|
|
63
73
|
});
|
|
64
74
|
},
|
|
75
|
+
async createUploadTarget(input) {
|
|
76
|
+
const limits = {
|
|
77
|
+
allowedContentTypes: [input.contentType],
|
|
78
|
+
maximumSizeInBytes: input.bytes,
|
|
79
|
+
validUntil: input.expiresAtMs
|
|
80
|
+
};
|
|
81
|
+
const token = await issueSignedToken({
|
|
82
|
+
...limits,
|
|
83
|
+
operations: ["put"],
|
|
84
|
+
pathname: input.key
|
|
85
|
+
});
|
|
86
|
+
const { presignedUrl } = await presignUrl(token, {
|
|
87
|
+
...limits,
|
|
88
|
+
access: "private",
|
|
89
|
+
addRandomSuffix: false,
|
|
90
|
+
allowOverwrite: false,
|
|
91
|
+
operation: "put",
|
|
92
|
+
pathname: input.key
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
headers: {
|
|
96
|
+
"x-api-version": BLOB_API_VERSION,
|
|
97
|
+
"x-content-type": input.contentType,
|
|
98
|
+
"x-vercel-blob-access": "private",
|
|
99
|
+
"x-vercel-blob-store-id": delegationStoreId(token.delegationToken)
|
|
100
|
+
},
|
|
101
|
+
method: "PUT",
|
|
102
|
+
url: presignedUrl
|
|
103
|
+
};
|
|
104
|
+
},
|
|
65
105
|
async get(key, range) {
|
|
66
106
|
const result = await get(key, {
|
|
67
107
|
access: "private",
|
|
@@ -168,6 +208,29 @@ function createS3AttachmentStorage(config) {
|
|
|
168
208
|
method: "PUT"
|
|
169
209
|
}), "put");
|
|
170
210
|
},
|
|
211
|
+
async createUploadTarget(input) {
|
|
212
|
+
const url = new URL(objectUrl(config, input.key));
|
|
213
|
+
url.searchParams.set("X-Amz-Expires", String(Math.max(1, Math.ceil((input.expiresAtMs - Date.now()) / 1e3))));
|
|
214
|
+
const browserHeaders = {
|
|
215
|
+
"content-type": input.contentType,
|
|
216
|
+
"if-none-match": "*"
|
|
217
|
+
};
|
|
218
|
+
return {
|
|
219
|
+
headers: browserHeaders,
|
|
220
|
+
method: "PUT",
|
|
221
|
+
url: (await client.sign(url.toString(), {
|
|
222
|
+
aws: {
|
|
223
|
+
allHeaders: true,
|
|
224
|
+
signQuery: true
|
|
225
|
+
},
|
|
226
|
+
headers: {
|
|
227
|
+
...browserHeaders,
|
|
228
|
+
"content-length": String(input.bytes)
|
|
229
|
+
},
|
|
230
|
+
method: "PUT"
|
|
231
|
+
})).url
|
|
232
|
+
};
|
|
233
|
+
},
|
|
171
234
|
async get(key, range) {
|
|
172
235
|
const response = await client.fetch(objectUrl(config, key), range ? { headers: { range: rangeHeader(range) } } : void 0);
|
|
173
236
|
if (response.status === 404) {
|
|
@@ -1220,6 +1283,16 @@ function bestEffortObjectCompletionCost(modelId, usage) {
|
|
|
1220
1283
|
return;
|
|
1221
1284
|
}
|
|
1222
1285
|
}
|
|
1286
|
+
/**
|
|
1287
|
+
* Keep only the fixed message and stack of a failed structured output. The SDK
|
|
1288
|
+
* error's `text` and its parse or validation cause hold the raw model output.
|
|
1289
|
+
*/
|
|
1290
|
+
function structuredOutputErrorCause(error) {
|
|
1291
|
+
const cause = new Error(error.message);
|
|
1292
|
+
cause.name = error.name;
|
|
1293
|
+
cause.stack = error.stack;
|
|
1294
|
+
return cause;
|
|
1295
|
+
}
|
|
1223
1296
|
/** Execute a schema-constrained completion using the AI SDK structured output path. */
|
|
1224
1297
|
async function completeObject(params) {
|
|
1225
1298
|
const credential = await resolveGatewayCredential();
|
|
@@ -1253,10 +1326,11 @@ async function completeObject(params) {
|
|
|
1253
1326
|
...params.maxTokens !== void 0 ? { "gen_ai.request.max_tokens": params.maxTokens } : void 0
|
|
1254
1327
|
});
|
|
1255
1328
|
} catch (error) {
|
|
1256
|
-
throw createProviderError(error, {
|
|
1257
|
-
|
|
1329
|
+
if (NoObjectGeneratedError.isInstance(error)) throw createProviderError(structuredOutputErrorCause(error), {
|
|
1330
|
+
kind: "invalid_response",
|
|
1258
1331
|
modelId: params.modelId
|
|
1259
1332
|
});
|
|
1333
|
+
throw createProviderError(error, { modelId: params.modelId });
|
|
1260
1334
|
}
|
|
1261
1335
|
const costUsd = bestEffortObjectCompletionCost(params.modelId, result.usage);
|
|
1262
1336
|
return {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-
|
|
1
|
+
import { la as startOAuthFlow } from "./projection-DEdP1q6f.js";
|
|
2
|
+
import { n as botConfig } from "./config-CAXIpWQb.js";
|
|
3
|
+
import { F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-COYOGzYS.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-BTKmKM-r.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
|
|
6
|
+
import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-Ciet8_nn.js";
|
|
7
7
|
import { randomBytes } from "node:crypto";
|
|
8
8
|
// src/handlers/oauth-html.ts
|
|
9
9
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Lt as moveIdleConversationDestination, Oi as getDashboardConversationLink, Vo as readLatestConversationBrief, ba as getSlackMessagePermalink, da as escapeSlackMrkdwnText, fa as formatSlackLink, wa as postSlackMessage, ya as deleteSlackMessage } from "./projection-DEdP1q6f.js";
|
|
2
|
+
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
3
|
+
import { G as claimProviderConversation, K as getConversationIdByProviderConversation, a as getConversationStore, k as setFirstConversationLocation, o as getDb, s as getSqlExecutor, x as withConversationMutationLock } from "./db-COYOGzYS.js";
|
|
4
|
+
import { P as juniorDestinations } from "./executor-BWmAgSyi.js";
|
|
5
|
+
import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
|
|
6
|
+
import "./store-BHiaHCQu.js";
|
|
7
|
+
import { c as joinPublicChannelForRead, s as checkSlackChannelReadAccess } from "./users-BK3dbxZL.js";
|
|
8
|
+
import { and, eq } from "drizzle-orm";
|
|
9
|
+
// src/chat/slack/continue-in-slack.ts
|
|
10
|
+
/** Refusal for a move that cannot wait for the active Run. */
|
|
11
|
+
const BUSY = "Wait for Junior to finish, then try again.";
|
|
12
|
+
const THREAD_TAKEN = "This thread already has a Junior conversation.";
|
|
13
|
+
const MOVED_ELSEWHERE = /* @__PURE__ */ new Error("Conversation already has a Location");
|
|
14
|
+
/**
|
|
15
|
+
* Return whether a Conversation can still move to a Slack thread.
|
|
16
|
+
*
|
|
17
|
+
* Only a dashboard root with no Location qualifies. The move is one-way, so
|
|
18
|
+
* a Conversation that has a Location never qualifies again.
|
|
19
|
+
*/
|
|
20
|
+
function isMovableToSlack(conversation) {
|
|
21
|
+
return conversation.conversationId.startsWith("local:web:") && !conversation.location && !conversation.parentConversationId;
|
|
22
|
+
}
|
|
23
|
+
/** Return whether a viewer can move this public Conversation to Slack. */
|
|
24
|
+
function canContinueInSlack(conversation, access) {
|
|
25
|
+
return access?.isParticipant === true && access.visibility === "public" && isMovableToSlack(conversation);
|
|
26
|
+
}
|
|
27
|
+
/** Text for the first message of the Conversation in Slack. */
|
|
28
|
+
async function movedMessageText(conversation, actorName) {
|
|
29
|
+
const title = conversation.title ?? "Junior conversation";
|
|
30
|
+
const url = getDashboardConversationLink(conversation.conversationId);
|
|
31
|
+
const brief = await readLatestConversationBrief(getDb(), conversation.conversationId);
|
|
32
|
+
return [
|
|
33
|
+
`*${url ? formatSlackLink(url, title) : escapeSlackMrkdwnText(title)}*`,
|
|
34
|
+
...brief ? [`> ${escapeSlackMrkdwnText(brief.content.summary)}`] : [],
|
|
35
|
+
`${escapeSlackMrkdwnText(actorName)} moved this conversation here from the dashboard. Mention me in this thread to continue.`
|
|
36
|
+
].join("\n");
|
|
37
|
+
}
|
|
38
|
+
/** Make sure Junior can post in a public channel, then post there. */
|
|
39
|
+
async function postMovedMessage(channel, text, threadTs) {
|
|
40
|
+
const access = await checkSlackChannelReadAccess({
|
|
41
|
+
currentChannelIds: [],
|
|
42
|
+
targetChannelId: channel.channelId,
|
|
43
|
+
teamId: channel.teamId
|
|
44
|
+
});
|
|
45
|
+
if (!access.allowed) return { refused: access.reason === "private" ? "Only a public channel can be chosen." : access.error };
|
|
46
|
+
const channelName = access.channelName ?? channel.channelName;
|
|
47
|
+
if (access.isMember !== true) {
|
|
48
|
+
const joined = await joinPublicChannelForRead({
|
|
49
|
+
targetChannelId: channel.channelId,
|
|
50
|
+
...channelName ? { channelName } : void 0
|
|
51
|
+
});
|
|
52
|
+
if (!joined.ok) return { refused: joined.error };
|
|
53
|
+
}
|
|
54
|
+
const posted = await postSlackMessage({
|
|
55
|
+
channelId: channel.channelId,
|
|
56
|
+
includePermalink: true,
|
|
57
|
+
text,
|
|
58
|
+
...threadTs ? { threadTs } : void 0
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
...channelName ? { channelName } : void 0,
|
|
62
|
+
...posted.permalink ? { permalink: posted.permalink } : void 0,
|
|
63
|
+
ts: posted.ts
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function readChannelLocationId(channel) {
|
|
67
|
+
const [row] = await getDb().select({ id: juniorDestinations.id }).from(juniorDestinations).where(and(eq(juniorDestinations.provider, "slack"), eq(juniorDestinations.providerTenantId, channel.teamId), eq(juniorDestinations.providerDestinationId, channel.channelId)));
|
|
68
|
+
if (!row) throw new Error("Slack channel Location was not stored");
|
|
69
|
+
return row.id;
|
|
70
|
+
}
|
|
71
|
+
/** Say which Slack thread a Conversation that already moved continues in. */
|
|
72
|
+
async function alreadyContinuesInSlackMessage(conversation) {
|
|
73
|
+
const { location } = conversation;
|
|
74
|
+
const channelId = location?.provider === "slack" ? parseSlackChannelId(location.channelId) : void 0;
|
|
75
|
+
const threadTs = parseSlackMessageTs(location?.provider === "slack" ? location.threadTs : void 0);
|
|
76
|
+
const url = channelId && threadTs ? await getSlackMessagePermalink({
|
|
77
|
+
channelId,
|
|
78
|
+
messageTs: threadTs
|
|
79
|
+
}) : void 0;
|
|
80
|
+
const place = conversation.channelName ? `#${conversation.channelName}` : "Slack";
|
|
81
|
+
return url ? `This conversation already continues in ${place}: ${url}` : `This conversation already continues in ${place}.`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Move a qualifying dashboard Conversation to a public Slack channel thread.
|
|
85
|
+
*
|
|
86
|
+
* With `threadTs`, Junior replies in that existing thread. Without it, Junior
|
|
87
|
+
* starts a new thread. The thread then becomes the Conversation Location and
|
|
88
|
+
* its replies reach this Conversation. Dashboard Messages still get no Slack
|
|
89
|
+
* Delivery. The caller checks who may move it, and runs this inside the
|
|
90
|
+
* Slack installation of `channel.teamId`.
|
|
91
|
+
*/
|
|
92
|
+
async function continueConversationInSlack(args) {
|
|
93
|
+
const { channel, conversation } = args;
|
|
94
|
+
const conversationId = conversation.conversationId;
|
|
95
|
+
if (conversation.execution.status === "running" || conversation.execution.status === "paused") return { status: "busy" };
|
|
96
|
+
const executor = getSqlExecutor();
|
|
97
|
+
const binding = (threadTs) => ({
|
|
98
|
+
provider: "slack",
|
|
99
|
+
providerDestinationId: channel.channelId,
|
|
100
|
+
providerTenantId: channel.teamId,
|
|
101
|
+
providerConversationId: threadTs
|
|
102
|
+
});
|
|
103
|
+
if (args.threadTs && await getConversationIdByProviderConversation(executor, binding(args.threadTs))) return {
|
|
104
|
+
message: THREAD_TAKEN,
|
|
105
|
+
status: "refused"
|
|
106
|
+
};
|
|
107
|
+
const posted = await postMovedMessage(channel, await movedMessageText(conversation, args.actorName), args.threadTs);
|
|
108
|
+
if ("refused" in posted) return {
|
|
109
|
+
message: posted.refused,
|
|
110
|
+
status: "refused"
|
|
111
|
+
};
|
|
112
|
+
const threadTs = args.threadTs ?? posted.ts;
|
|
113
|
+
const destination = {
|
|
114
|
+
platform: "slack",
|
|
115
|
+
teamId: channel.teamId,
|
|
116
|
+
channelId: channel.channelId
|
|
117
|
+
};
|
|
118
|
+
await getConversationStore().recordDestinationVisibility({
|
|
119
|
+
destination,
|
|
120
|
+
...posted.channelName ? { channelName: posted.channelName } : void 0,
|
|
121
|
+
visibility: "public"
|
|
122
|
+
});
|
|
123
|
+
const locationId = await readChannelLocationId(channel);
|
|
124
|
+
let threadTaken = false;
|
|
125
|
+
const moved = await moveIdleConversationDestination({
|
|
126
|
+
conversationId,
|
|
127
|
+
destination,
|
|
128
|
+
move: async () => {
|
|
129
|
+
try {
|
|
130
|
+
return await withConversationMutationLock(executor, conversationId, async () => {
|
|
131
|
+
if (!await claimProviderConversation(executor, {
|
|
132
|
+
conversationId,
|
|
133
|
+
...binding(threadTs)
|
|
134
|
+
})) {
|
|
135
|
+
threadTaken = true;
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (!await setFirstConversationLocation(executor, {
|
|
139
|
+
...posted.channelName ? { channelName: posted.channelName } : void 0,
|
|
140
|
+
conversationId,
|
|
141
|
+
location: {
|
|
142
|
+
id: locationId,
|
|
143
|
+
provider: "slack",
|
|
144
|
+
teamId: channel.teamId,
|
|
145
|
+
channelId: channel.channelId,
|
|
146
|
+
threadTs
|
|
147
|
+
}
|
|
148
|
+
})) throw MOVED_ELSEWHERE;
|
|
149
|
+
return true;
|
|
150
|
+
});
|
|
151
|
+
} catch (error) {
|
|
152
|
+
if (error === MOVED_ELSEWHERE) return false;
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
if (moved !== "moved") {
|
|
158
|
+
await deleteSlackMessage({
|
|
159
|
+
channelId: channel.channelId,
|
|
160
|
+
timestamp: posted.ts
|
|
161
|
+
});
|
|
162
|
+
if (moved === "busy") return { status: "busy" };
|
|
163
|
+
const current = await getConversationStore().get({ conversationId });
|
|
164
|
+
return {
|
|
165
|
+
message: threadTaken ? THREAD_TAKEN : await alreadyContinuesInSlackMessage(current ?? conversation),
|
|
166
|
+
status: "refused"
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
await getStateAdapter().subscribe(`slack:${channel.channelId}:${threadTs}`);
|
|
170
|
+
return {
|
|
171
|
+
...posted.channelName ? { channelName: posted.channelName } : void 0,
|
|
172
|
+
...posted.permalink ? { locationUrl: posted.permalink } : void 0,
|
|
173
|
+
status: "moved"
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export { isMovableToSlack as a, continueConversationInSlack as i, alreadyContinuesInSlackMessage as n, canContinueInSlack as r, BUSY as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-IjdmO_r6.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
// src/chat/briefs/schema.ts
|
|
@@ -132,14 +132,21 @@ function parseBriefInput(input) {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
// src/chat/attachments/input.ts
|
|
135
|
-
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Largest file that a web Message can carry.
|
|
137
|
+
*
|
|
138
|
+
* `loadAttachment` reads the whole file into memory before it writes the file
|
|
139
|
+
* to the sandbox, and the message request reads each upload once to check it.
|
|
140
|
+
* Keep this well below function memory.
|
|
141
|
+
*/
|
|
142
|
+
const MAX_INPUT_ATTACHMENT_BYTES = 26214400;
|
|
143
|
+
/** Most files on one web Message, as in one Slack message. */
|
|
144
|
+
const MAX_INPUT_ATTACHMENTS = 10;
|
|
145
|
+
/** File facts that a browser declares before it uploads the bytes. */
|
|
146
|
+
const inputFileSchema = z.object({
|
|
140
147
|
filename: z.string().trim().min(1).max(255),
|
|
141
|
-
contentType: z.
|
|
142
|
-
|
|
148
|
+
contentType: z.string().trim().toLowerCase().max(127).regex(/^[a-z0-9][\w.+-]*\/[a-z0-9][\w.+-]*$/),
|
|
149
|
+
bytes: z.number().int().min(1).max(MAX_INPUT_ATTACHMENT_BYTES)
|
|
143
150
|
}).strict();
|
|
144
151
|
/** Safe attachment facts shared by mailbox input and transcript messages. */
|
|
145
152
|
const messageAttachmentSchema = z.object({
|
|
@@ -400,14 +407,19 @@ const conversationEventsQuerySchema = z.union([
|
|
|
400
407
|
const conversationFeedQuerySchema = z.object({
|
|
401
408
|
actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional(),
|
|
402
409
|
codeRepositoryId: z.string().uuid().optional(),
|
|
410
|
+
/** `nextCursor` from the previous page of the same feed. */
|
|
411
|
+
cursor: z.string().min(1).max(500).optional(),
|
|
403
412
|
q: z.string().trim().max(200).optional(),
|
|
404
413
|
status: z.enum(["active", "archived"]).default("active")
|
|
405
414
|
}).strict();
|
|
415
|
+
/** Client key that makes a retried send the same Message. */
|
|
416
|
+
const idempotencyKeySchema = z.string().trim().min(1).max(200);
|
|
406
417
|
const createConversationMessageBodySchema = z.object({
|
|
407
|
-
idempotencyKey:
|
|
418
|
+
idempotencyKey: idempotencyKeySchema,
|
|
408
419
|
message: z.string().trim().max(32e3),
|
|
409
|
-
|
|
410
|
-
|
|
420
|
+
/** Uploads from `POST /api/conversations/attachment-uploads`. */
|
|
421
|
+
uploadIds: z.array(z.string().min(1).max(64)).max(10).optional()
|
|
422
|
+
}).strict().refine((body) => Boolean(body.message || body.uploadIds?.length), "Add a message or a file.");
|
|
411
423
|
const createConversationBodySchema = createConversationMessageBodySchema.safeExtend({
|
|
412
424
|
/** Saved title. Title generation runs only when it is omitted. */
|
|
413
425
|
title: conversationTitleSchema.optional(),
|
|
@@ -991,4 +1003,4 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
991
1003
|
sentryConversationUrl: z.string().optional(),
|
|
992
1004
|
sourceTask: conversationSourceTaskSchema.optional()
|
|
993
1005
|
}).strict().superRefine(validateConversationEvents);
|
|
994
|
-
export {
|
|
1006
|
+
export { conversationBriefSchema as $, agentTypeSchema as A, messageCardText as B, createConversationMessageBodySchema as C, conversationChildAgentTotalsSchema as D, idempotencyKeySchema as E, renameConversationResponseSchema as F, MAX_INPUT_ATTACHMENT_BYTES as G, removedCardSchema as H, conversationReadPositionSchema as I, readMessageAttachments as J, inputFileSchema as K, reviewItemChangeRecordSchema as L, CONVERSATION_TITLE_MAX_LENGTH as M, conversationTitleSchema as N, AGENT_TYPES as O, renameConversationBodySchema as P, briefResourceLabel as Q, annotationCard as R, createConversationBodySchema as S, forkConversationResponseSchema as T, resolveMessageCards as U, readMessageCardRefs as V, MAX_INPUT_ATTACHMENTS as W, briefLinkSchema as X, briefCodeChangeSchema as Y, briefOutcomeStatusSchema as Z, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, parseBriefInput as et, conversationEventsQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, formatAgentTypes as j, agentTypeInstructions as k, conversationDetailReportSchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, messageAttachmentSchema as q, acceptedConversationMessageSchema as r, conversationAuxiliaryCostsSchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, parseStoredBrief as tt, conversationEventHistorySchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, messageCardRef as z };
|
|
@@ -1,5 +1,88 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as reviewItemChangeRecordSchema, Z as briefOutcomeStatusSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, q as messageAttachmentSchema, y as conversationSummaryReportSchema } from "./conversation-fCWD9Az3.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
|
+
active: "running",
|
|
8
|
+
completed: "idle",
|
|
9
|
+
failed: "failed",
|
|
10
|
+
stopped: "stopped"
|
|
11
|
+
};
|
|
12
|
+
function personName(person) {
|
|
13
|
+
return person.fullName ?? person.slackUserName ?? person.email;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build the card of one Conversation that the viewer may read. Give `brief`
|
|
17
|
+
* only when the viewer may see the Brief.
|
|
18
|
+
*/
|
|
19
|
+
function conversationObjectCard(args) {
|
|
20
|
+
const { summary } = args;
|
|
21
|
+
const participants = args.participants.flatMap((person) => personName(person)?.slice(0, MAX_FACT_CHARS) ?? []).slice(0, 5);
|
|
22
|
+
return {
|
|
23
|
+
kind: "object",
|
|
24
|
+
objectType: "conversation",
|
|
25
|
+
key: summary.conversationId.slice(0, 256),
|
|
26
|
+
label: summary.displayTitle.slice(0, MAX_LABEL_CHARS),
|
|
27
|
+
title: summary.displayTitle.slice(0, 512),
|
|
28
|
+
url: args.url,
|
|
29
|
+
status: summary.archivedAt ? "archived" : conversationStates[summary.status],
|
|
30
|
+
...args.brief ? { description: args.brief.slice(0, 4e3) } : void 0,
|
|
31
|
+
facts: {
|
|
32
|
+
type: "conversation",
|
|
33
|
+
...participants.length > 0 ? { participants } : void 0,
|
|
34
|
+
lastActivityAt: summary.lastSeenAt
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Build the card of one known person from what the People pages show. */
|
|
39
|
+
function personObjectCard(args) {
|
|
40
|
+
const { person } = args;
|
|
41
|
+
const name = personName(person) ?? person.email;
|
|
42
|
+
return {
|
|
43
|
+
kind: "object",
|
|
44
|
+
objectType: "person",
|
|
45
|
+
key: person.email.toLowerCase().slice(0, 256),
|
|
46
|
+
label: name.slice(0, MAX_LABEL_CHARS),
|
|
47
|
+
title: name.slice(0, 512),
|
|
48
|
+
url: args.url,
|
|
49
|
+
facts: {
|
|
50
|
+
type: "person",
|
|
51
|
+
email: person.email.slice(0, MAX_FACT_CHARS),
|
|
52
|
+
...person.slackUserName ? { slackHandle: person.slackUserName.slice(0, MAX_FACT_CHARS) } : void 0,
|
|
53
|
+
...args.githubHandle ? { githubHandle: args.githubHandle } : void 0,
|
|
54
|
+
...person.avatarUrl ? { avatarUrl: person.avatarUrl } : void 0
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const MAX_SNIPPET_CHARS = 280;
|
|
59
|
+
const MAX_TITLE_CHARS = 100;
|
|
60
|
+
function truncate(text, max) {
|
|
61
|
+
return text.length > max ? `${text.slice(0, max - 1).trimEnd()}…` : text;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Build the card of one chat message. Give `text` only when the viewer may
|
|
65
|
+
* read the message: the card shows a short snippet of it, never all of it.
|
|
66
|
+
*/
|
|
67
|
+
function messageObjectCard(args) {
|
|
68
|
+
const snippet = args.text?.replace(/\s+/g, " ").trim();
|
|
69
|
+
const title = snippet ? truncate(snippet, MAX_TITLE_CHARS) : `Message in ${args.channel}`;
|
|
70
|
+
return {
|
|
71
|
+
kind: "object",
|
|
72
|
+
objectType: "message",
|
|
73
|
+
key: args.key.slice(0, 256),
|
|
74
|
+
label: args.channel.slice(0, MAX_LABEL_CHARS),
|
|
75
|
+
title,
|
|
76
|
+
url: args.url,
|
|
77
|
+
...snippet && snippet.length > title.length ? { description: truncate(snippet, MAX_SNIPPET_CHARS) } : void 0,
|
|
78
|
+
facts: {
|
|
79
|
+
type: "message",
|
|
80
|
+
channel: args.channel.slice(0, MAX_FACT_CHARS),
|
|
81
|
+
...args.author ? { author: args.author.slice(0, MAX_FACT_CHARS) } : void 0,
|
|
82
|
+
...args.sentAt ? { sentAt: args.sentAt } : void 0
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
3
86
|
// src/reporting-schema.ts
|
|
4
87
|
const healthReportSchema = z.object({
|
|
5
88
|
status: z.literal("ok"),
|
|
@@ -201,6 +284,8 @@ const conversationFeedItemSchema = conversationSummaryReportSchema.extend({
|
|
|
201
284
|
const conversationFeedSchema = z.object({
|
|
202
285
|
conversations: z.array(conversationFeedItemSchema),
|
|
203
286
|
source: z.literal("conversation_index"),
|
|
204
|
-
generatedAt: z.string()
|
|
287
|
+
generatedAt: z.string(),
|
|
288
|
+
/** Present when older conversations follow this page. */
|
|
289
|
+
nextCursor: z.string().optional()
|
|
205
290
|
}).strict();
|
|
206
|
-
export { skillReportsSchema as C, skillReportSchema as S, pluginPackageContentReportSchema as _, conversationDetailWithMailboxReportSchema as a, runtimeInfoReportSchema as b, conversationPendingMessageSchema as c, steerConversationPendingMessagesBodySchema as d, steerConversationPendingMessagesResponseSchema as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, cancelConversationPendingMessagesResponseSchema as i, conversationPendingMessagesReportSchema as l, pluginOperationalReportFeedSchema as m, conversationFeedSchema as n, conversationPendingAuthorizationSchema as o, healthReportSchema as p, cancelConversationPendingMessagesBodySchema as r, conversationPendingMessageDeliverySchema as s, conversationFeedBriefSchema as t, conversationUnchangedDetailWithMailboxSchema as u, pluginSchema as v, skillDetailReportSchema as x, pluginsSchema as y };
|
|
291
|
+
export { skillReportsSchema as C, personObjectCard as E, skillReportSchema as S, messageObjectCard as T, pluginPackageContentReportSchema as _, conversationDetailWithMailboxReportSchema as a, runtimeInfoReportSchema as b, conversationPendingMessageSchema as c, steerConversationPendingMessagesBodySchema as d, steerConversationPendingMessagesResponseSchema as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, cancelConversationPendingMessagesResponseSchema as i, conversationPendingMessagesReportSchema as l, pluginOperationalReportFeedSchema as m, conversationFeedSchema as n, conversationPendingAuthorizationSchema as o, healthReportSchema as p, cancelConversationPendingMessagesBodySchema as r, conversationPendingMessageDeliverySchema as s, conversationFeedBriefSchema as t, conversationUnchangedDetailWithMailboxSchema as u, pluginSchema as v, conversationObjectCard as w, skillDetailReportSchema as x, pluginsSchema as y };
|