@sentry/junior 0.179.0 → 0.181.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/{agent-hooks-32IDCLMW.js → agent-hooks-IQUW6ERD.js} +16 -18
- package/dist/api/schema/workspace.d.ts +2 -0
- package/dist/api/schema.js +1 -2
- package/dist/api.js +202 -199
- package/dist/app.d.ts +4 -0
- package/dist/app.js +300 -1259
- package/dist/catalog-runtime-PMQWNIXA.js +14 -0
- package/dist/chat/agent/sandbox.d.ts +0 -2
- package/dist/chat/api-turns/routing.d.ts +4 -0
- package/dist/chat/api-turns/work.d.ts +5 -0
- package/dist/chat/config.d.ts +5 -2
- package/dist/chat/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/projection.d.ts +6 -4
- package/dist/chat/ingress/message-router.d.ts +3 -0
- package/dist/chat/model-profile.d.ts +8 -10
- package/dist/chat/pi/conversation-events.d.ts +3 -2
- package/dist/chat/plugins/agent-hooks.d.ts +1 -1
- package/dist/chat/plugins/task-queue.d.ts +40 -3
- package/dist/chat/plugins/task-runner.d.ts +1 -1
- package/dist/chat/queue/callback.d.ts +26 -0
- package/dist/chat/queue/sign.d.ts +30 -0
- package/dist/chat/sandbox/sandbox.d.ts +0 -2
- package/dist/chat/sandbox/session.d.ts +0 -2
- package/dist/chat/sandbox/skill-sync.d.ts +1 -1
- package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
- package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
- package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
- package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
- package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
- package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
- package/dist/chat/services/turn-router.d.ts +4 -3
- package/dist/chat/services/turn-session-routing.d.ts +1 -0
- package/dist/chat/task-execution/queue-signing.d.ts +10 -21
- package/dist/chat/task-execution/state.d.ts +48 -0
- package/dist/chat/task-execution/store.d.ts +28 -2
- package/dist/chat/task-execution/worker.d.ts +4 -1
- package/dist/chat/tools/handoff/tool.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +2 -0
- package/dist/chat/workspaces/types.d.ts +2 -0
- package/dist/{chunk-Q5B3WTGG.js → chunk-3KCQEG6W.js} +42 -41
- package/dist/{chunk-XZY6G5YZ.js → chunk-3KSSALN4.js} +180 -87
- package/dist/{chunk-3AFVR5UC.js → chunk-3X55QRAG.js} +18 -16
- package/dist/{chunk-SLGGOASN.js → chunk-4IX32NSL.js} +46 -46
- package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
- package/dist/chunk-7H2VZTWN.js +103 -0
- package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
- package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
- package/dist/{chunk-TKB25A3L.js → chunk-CZYNWPWD.js} +2 -1
- package/dist/{chunk-3I7XE3PA.js → chunk-D6ZD7VXP.js} +49 -38
- package/dist/chunk-DKIJ2RP5.js +68 -0
- package/dist/{chunk-G2CAC4CV.js → chunk-DSA6WTRP.js} +74 -68
- package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
- package/dist/{chunk-HQNE5APD.js → chunk-EBMRB6Z6.js} +100 -79
- package/dist/{chunk-ZQMG3CL5.js → chunk-EM7EECT5.js} +16 -16
- package/dist/{chunk-XSPSCWLH.js → chunk-ETJTXYHY.js} +4 -4
- package/dist/{chunk-FTGD2FBP.js → chunk-EU7KJDOG.js} +2 -2
- package/dist/{chunk-CJLBLELR.js → chunk-FWILPBVQ.js} +8 -61
- package/dist/{chunk-4GWXAILB.js → chunk-GPA3ZSYY.js} +1 -1
- package/dist/{chunk-U4TKB6F6.js → chunk-GREV5PJK.js} +108 -5
- package/dist/{chunk-KJLHIHFF.js → chunk-GWFRPQNP.js} +43 -230
- package/dist/{chunk-YFNAMRGE.js → chunk-HEBMSITT.js} +1 -1
- package/dist/chunk-HJ27A6YB.js +218 -0
- package/dist/{chunk-R5NWWYIS.js → chunk-HZHUMCNV.js} +5 -5
- package/dist/{chunk-RTRBYSF3.js → chunk-IJ6SS4WB.js} +1 -1
- package/dist/{chunk-B6ECUSVX.js → chunk-IKKETMQC.js} +8 -8
- package/dist/{chunk-R6U7N4FS.js → chunk-KKSVCHDO.js} +10 -3
- package/dist/{chunk-JMJNFEDC.js → chunk-KMBU4PJP.js} +9 -54
- package/dist/chunk-KQZX24QQ.js +164 -0
- package/dist/{chunk-GPLAT6H7.js → chunk-LCNPXLE7.js} +22 -18
- package/dist/{chunk-2HIPYNQI.js → chunk-LG5MYY6U.js} +33 -32
- package/dist/chunk-LZOQFC5F.js +209 -0
- package/dist/chunk-M3QYTBQ6.js +55 -0
- package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
- package/dist/{chunk-FIDMHAO6.js → chunk-NQTA72Q3.js} +84 -274
- package/dist/{chunk-RZRYOLCE.js → chunk-PBKZQAUA.js} +2315 -1150
- package/dist/chunk-PEQXYSSE.js +45 -0
- package/dist/{chunk-3TM3FYLQ.js → chunk-PL57B6NC.js} +1 -1
- package/dist/{chunk-JT4WMD3C.js → chunk-PPYDHUEL.js} +144 -218
- package/dist/{chunk-5IRROPA5.js → chunk-Q2KY27IX.js} +129 -31
- package/dist/{chunk-VP4OVRDD.js → chunk-RNMASWLP.js} +69 -73
- package/dist/{chunk-FAS6AIMF.js → chunk-TDT2R77B.js} +8 -8
- package/dist/{chunk-TIEKUH4Q.js → chunk-TJHSAHQN.js} +4 -3
- package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
- package/dist/chunk-X6GDDWQH.js +60 -0
- package/dist/{chunk-GENV6KF2.js → chunk-XYTJUHRZ.js} +108 -76
- package/dist/cli/chat.js +47 -43
- package/dist/cli/check.js +13 -15
- package/dist/cli/env.js +0 -1
- package/dist/cli/init.js +0 -1
- package/dist/cli/main.js +2 -3
- package/dist/cli/plugins.js +18 -20
- package/dist/cli/run.js +0 -1
- package/dist/cli/snapshot-create.js +14 -16
- package/dist/cli/upgrade.js +16 -18
- package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
- package/dist/db/schema/snapshots.d.ts +17 -0
- package/dist/db/schema.d.ts +17 -0
- package/dist/{db-EJAV7JL6.js → db-QNPVCQPT.js} +8 -10
- package/dist/deployment.d.ts +1 -0
- package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
- package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
- package/dist/instrumentation.js +7 -9
- package/dist/nitro.js +39 -13
- package/dist/{oauth-callback-server-GAVSUBTQ.js → oauth-callback-server-KYMPJOTC.js} +34 -32
- package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
- package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
- package/dist/{runner-34JL64JF.js → runner-3RS2D2ZR.js} +39 -33
- package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
- package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
- package/dist/skills-5B3Y6XX6.js +27 -0
- package/dist/spawn-VYARS3DU.js +37 -0
- package/dist/task-runner-4IXKKZHL.js +32 -0
- package/dist/validation-Q65QD27B.js +17 -0
- package/dist/vercel.js +0 -1
- package/dist/version.js +1 -2
- package/dist/work-DCMQWAAP.js +45 -0
- package/dist/worker-QL3CHLZL.js +22 -0
- package/migrations/0035_workspace_snapshot_size_bytes.sql +2 -0
- package/migrations/meta/0035_snapshot.json +3048 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +7 -6
- package/dist/catalog-runtime-FBVA6WAQ.js +0 -16
- package/dist/chat/plugins/task-callback.d.ts +0 -5
- package/dist/chat/plugins/task-message.d.ts +0 -23
- package/dist/chat/plugins/task-signing.d.ts +0 -31
- package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
- package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
- package/dist/chunk-5I6ORJUY.js +0 -127
- package/dist/chunk-6GWA276C.js +0 -72
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-UT6X7XN7.js +0 -51
- package/dist/chunk-WR76IVA5.js +0 -130
- package/dist/skills-U545HALM.js +0 -29
- package/dist/spawn-I2S4IDUQ.js +0 -37
- package/dist/validation-EVXVGA44.js +0 -19
- package/dist/work-QOAUPDBU.js +0 -45
- package/dist/worker-5GX2IKLZ.js +0 -24
|
@@ -1,15 +1,55 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureException,
|
|
3
|
+
captureMessage,
|
|
3
4
|
getActiveSpan,
|
|
4
|
-
|
|
5
|
+
getTraceData,
|
|
6
|
+
logger,
|
|
5
7
|
setTag,
|
|
6
8
|
setUser,
|
|
9
|
+
spanToJSON,
|
|
7
10
|
startSpan,
|
|
8
11
|
withScope
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PEQXYSSE.js";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
JUNIOR_VERSION
|
|
15
|
+
} from "./chunk-TJHSAHQN.js";
|
|
16
|
+
|
|
17
|
+
// src/deployment.ts
|
|
18
|
+
var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
|
|
19
|
+
var JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
|
|
20
|
+
var JUNIOR_RETENTION_ROUTE = "/api/internal/retention";
|
|
21
|
+
var JUNIOR_RETENTION_CRON_SCHEDULE = "0 4 * * *";
|
|
22
|
+
var JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
|
|
23
|
+
var JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE = "/api/internal/plugin/tasks";
|
|
24
|
+
var JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE = "/api/internal/workspace/snapshots";
|
|
25
|
+
var LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION = "api/internal/agent/continue.ts";
|
|
26
|
+
function toOptionalTrimmed(value) {
|
|
27
|
+
const trimmed = value?.trim();
|
|
28
|
+
return trimmed ? trimmed : void 0;
|
|
29
|
+
}
|
|
30
|
+
function getDeploymentServiceVersion() {
|
|
31
|
+
const configuredRelease = toOptionalTrimmed(process.env.SENTRY_RELEASE);
|
|
32
|
+
if (configuredRelease) {
|
|
33
|
+
return configuredRelease;
|
|
34
|
+
}
|
|
35
|
+
const deploymentRevision = toOptionalTrimmed(
|
|
36
|
+
process.env.VERCEL_GIT_COMMIT_SHA
|
|
37
|
+
);
|
|
38
|
+
return deploymentRevision ? `${JUNIOR_VERSION}+${deploymentRevision}` : void 0;
|
|
39
|
+
}
|
|
40
|
+
function getDeploymentTelemetryAttributes() {
|
|
41
|
+
const attributes = {};
|
|
42
|
+
const serviceVersion = getDeploymentServiceVersion();
|
|
43
|
+
const deploymentId = toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
|
|
44
|
+
attributes["app.junior.version"] = JUNIOR_VERSION;
|
|
45
|
+
if (serviceVersion) {
|
|
46
|
+
attributes["service.version"] = serviceVersion;
|
|
47
|
+
}
|
|
48
|
+
if (deploymentId) {
|
|
49
|
+
attributes["deployment.id"] = deploymentId;
|
|
50
|
+
}
|
|
51
|
+
return attributes;
|
|
52
|
+
}
|
|
13
53
|
|
|
14
54
|
// src/chat/logging.ts
|
|
15
55
|
import path from "path";
|
|
@@ -407,14 +447,10 @@ function contextToAttributes(context) {
|
|
|
407
447
|
return mergeAttributes(logContextToAttributes(context));
|
|
408
448
|
}
|
|
409
449
|
function getTraceCorrelationAttributes() {
|
|
410
|
-
const sentry = sentry_exports;
|
|
411
|
-
if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
|
|
412
|
-
return {};
|
|
413
|
-
}
|
|
414
450
|
try {
|
|
415
|
-
const span =
|
|
451
|
+
const span = getActiveSpan();
|
|
416
452
|
if (!span) return {};
|
|
417
|
-
const json =
|
|
453
|
+
const json = spanToJSON(span);
|
|
418
454
|
const attrs = {};
|
|
419
455
|
if (json.trace_id) attrs.trace_id = json.trace_id;
|
|
420
456
|
if (json.span_id) attrs.span_id = json.span_id;
|
|
@@ -553,37 +589,28 @@ function getLogTapeLogger(category = []) {
|
|
|
553
589
|
if (!rootLogger) {
|
|
554
590
|
throw new Error("LogTape backend is unavailable");
|
|
555
591
|
}
|
|
556
|
-
let
|
|
592
|
+
let logger2 = rootLogger;
|
|
557
593
|
for (const part of category) {
|
|
558
|
-
|
|
594
|
+
logger2 = logger2.getChild(part);
|
|
559
595
|
}
|
|
560
|
-
return
|
|
596
|
+
return logger2;
|
|
561
597
|
}
|
|
562
598
|
function emitSentry(level, body, attributes) {
|
|
563
599
|
if (shouldSuppressInfoLog(level)) {
|
|
564
600
|
return;
|
|
565
601
|
}
|
|
566
|
-
const
|
|
567
|
-
const loggerFn = sentry.logger?.[level];
|
|
602
|
+
const loggerFn = logger?.[level];
|
|
568
603
|
if (typeof loggerFn === "function") {
|
|
569
604
|
loggerFn(body, attributes);
|
|
570
605
|
return;
|
|
571
606
|
}
|
|
572
|
-
const sentryWithScope = sentry.withScope;
|
|
573
|
-
const sentryCaptureMessage = sentry.captureMessage;
|
|
574
607
|
const sentryLevel = level === "warn" ? "warning" : level;
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
});
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
if (typeof sentryCaptureMessage === "function") {
|
|
585
|
-
sentryCaptureMessage(body, sentryLevel);
|
|
586
|
-
}
|
|
608
|
+
withScope((scope) => {
|
|
609
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
610
|
+
scope.setExtra(key, value);
|
|
611
|
+
}
|
|
612
|
+
captureMessage(body, sentryLevel);
|
|
613
|
+
});
|
|
587
614
|
}
|
|
588
615
|
function formatConsoleLevel(level) {
|
|
589
616
|
if (level === "debug") return "DBG";
|
|
@@ -890,7 +917,7 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
|
890
917
|
traceAttributes,
|
|
891
918
|
{
|
|
892
919
|
"event.name": normalizedEventName,
|
|
893
|
-
...source ? { "app.log.source": source } :
|
|
920
|
+
...source ? { "app.log.source": source } : void 0,
|
|
894
921
|
...attrs
|
|
895
922
|
},
|
|
896
923
|
// Deployment identity is process-owned and must win over event-local attrs.
|
|
@@ -900,24 +927,24 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
|
900
927
|
emitDirect(level, normalizedEventName, message, attributes);
|
|
901
928
|
return;
|
|
902
929
|
}
|
|
903
|
-
const
|
|
930
|
+
const logger2 = getLogTapeLogger(category);
|
|
904
931
|
const properties = {
|
|
905
932
|
[LOGTAPE_BODY_KEY]: message,
|
|
906
933
|
...attributes
|
|
907
934
|
};
|
|
908
935
|
if (level === "error") {
|
|
909
|
-
|
|
936
|
+
logger2.error(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
910
937
|
return;
|
|
911
938
|
}
|
|
912
939
|
if (level === "warn") {
|
|
913
|
-
|
|
940
|
+
logger2.warn(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
914
941
|
return;
|
|
915
942
|
}
|
|
916
943
|
if (level === "info") {
|
|
917
|
-
|
|
944
|
+
logger2.info(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
918
945
|
return;
|
|
919
946
|
}
|
|
920
|
-
|
|
947
|
+
logger2.debug(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
921
948
|
}
|
|
922
949
|
function emit(level, eventName, attrs = {}, body) {
|
|
923
950
|
emitRecord([], level, eventName, attrs, body);
|
|
@@ -950,29 +977,18 @@ var log = {
|
|
|
950
977
|
body
|
|
951
978
|
);
|
|
952
979
|
let eventId;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
attrs
|
|
961
|
-
);
|
|
962
|
-
for (const [key, value] of Object.entries(mergedAttributes)) {
|
|
963
|
-
scope.setExtra(key, value);
|
|
964
|
-
if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
965
|
-
scope.setTag(key, value);
|
|
966
|
-
}
|
|
980
|
+
withScope((scope) => {
|
|
981
|
+
setSentryScopeContext(scope, getBoundLogContext());
|
|
982
|
+
const mergedAttributes = mergeAttributes(getBoundLogAttributes(), attrs);
|
|
983
|
+
for (const [key, value] of Object.entries(mergedAttributes)) {
|
|
984
|
+
scope.setExtra(key, value);
|
|
985
|
+
if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
986
|
+
scope.setTag(key, value);
|
|
967
987
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
if (typeof sentryCaptureException === "function") {
|
|
973
|
-
setSentryUser(sentryUserIdentityFromContext(getBoundLogContext()));
|
|
974
|
-
eventId = sentryCaptureException(normalizedError);
|
|
975
|
-
}
|
|
988
|
+
}
|
|
989
|
+
const capturedEventId = captureException(normalizedError);
|
|
990
|
+
eventId = typeof capturedEventId === "string" ? capturedEventId : void 0;
|
|
991
|
+
});
|
|
976
992
|
return eventId;
|
|
977
993
|
}
|
|
978
994
|
};
|
|
@@ -1105,8 +1121,8 @@ function sentryUserIdentityFromContext(context) {
|
|
|
1105
1121
|
const email = normalizeIdentityEmail(context.userEmail);
|
|
1106
1122
|
return {
|
|
1107
1123
|
id: context.userId,
|
|
1108
|
-
...context.userName ? { username: context.userName } :
|
|
1109
|
-
...email ? { email } :
|
|
1124
|
+
...context.userName ? { username: context.userName } : void 0,
|
|
1125
|
+
...email ? { email } : void 0
|
|
1110
1126
|
};
|
|
1111
1127
|
}
|
|
1112
1128
|
return void 0;
|
|
@@ -1115,8 +1131,8 @@ function sentryUserFromIdentity(identity) {
|
|
|
1115
1131
|
return {
|
|
1116
1132
|
id: identity.id,
|
|
1117
1133
|
ip_address: null,
|
|
1118
|
-
...identity.username ? { username: identity.username } :
|
|
1119
|
-
...identity.email ? { email: identity.email } :
|
|
1134
|
+
...identity.username ? { username: identity.username } : void 0,
|
|
1135
|
+
...identity.email ? { email: identity.email } : void 0
|
|
1120
1136
|
};
|
|
1121
1137
|
}
|
|
1122
1138
|
function setSentryUser(identity) {
|
|
@@ -1231,8 +1247,7 @@ async function withSpan(name, op, context, callback, attributes = {}) {
|
|
|
1231
1247
|
});
|
|
1232
1248
|
}
|
|
1233
1249
|
function getTracePropagationHeaders() {
|
|
1234
|
-
const
|
|
1235
|
-
const traceData = sentry.getTraceData?.({ propagateTraceparent: true });
|
|
1250
|
+
const traceData = getTraceData({ propagateTraceparent: true });
|
|
1236
1251
|
if (!traceData) {
|
|
1237
1252
|
return {};
|
|
1238
1253
|
}
|
|
@@ -1262,16 +1277,12 @@ function setSpanStatus(status) {
|
|
|
1262
1277
|
);
|
|
1263
1278
|
}
|
|
1264
1279
|
function getActiveTraceId() {
|
|
1265
|
-
const sentry = sentry_exports;
|
|
1266
|
-
if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
|
|
1267
|
-
return void 0;
|
|
1268
|
-
}
|
|
1269
1280
|
try {
|
|
1270
|
-
const span =
|
|
1281
|
+
const span = getActiveSpan();
|
|
1271
1282
|
if (!span) {
|
|
1272
1283
|
return void 0;
|
|
1273
1284
|
}
|
|
1274
|
-
return toOptionalString(
|
|
1285
|
+
return toOptionalString(spanToJSON(span).trace_id);
|
|
1275
1286
|
} catch {
|
|
1276
1287
|
return void 0;
|
|
1277
1288
|
}
|
|
@@ -1454,17 +1465,17 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1454
1465
|
cacheCreationTokens
|
|
1455
1466
|
);
|
|
1456
1467
|
return {
|
|
1457
|
-
...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } :
|
|
1458
|
-
...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } :
|
|
1468
|
+
...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } : void 0,
|
|
1469
|
+
...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } : void 0,
|
|
1459
1470
|
// OTel has no monetary cost attributes, so report accounting generically.
|
|
1460
|
-
...cachedInputTokens !== void 0 ? { "gen_ai.usage.cache_read.input_tokens": cachedInputTokens } :
|
|
1461
|
-
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.cache_creation.input_tokens": cacheCreationTokens } :
|
|
1462
|
-
...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } :
|
|
1463
|
-
...cost?.input !== void 0 ? { "app.cost.input_usd": cost.input } :
|
|
1464
|
-
...cost?.output !== void 0 ? { "app.cost.output_usd": cost.output } :
|
|
1465
|
-
...cost?.cacheRead !== void 0 ? { "app.cost.cache_read_usd": cost.cacheRead } :
|
|
1466
|
-
...cost?.cacheWrite !== void 0 ? { "app.cost.cache_write_usd": cost.cacheWrite } :
|
|
1467
|
-
...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } :
|
|
1471
|
+
...cachedInputTokens !== void 0 ? { "gen_ai.usage.cache_read.input_tokens": cachedInputTokens } : void 0,
|
|
1472
|
+
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.cache_creation.input_tokens": cacheCreationTokens } : void 0,
|
|
1473
|
+
...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } : void 0,
|
|
1474
|
+
...cost?.input !== void 0 ? { "app.cost.input_usd": cost.input } : void 0,
|
|
1475
|
+
...cost?.output !== void 0 ? { "app.cost.output_usd": cost.output } : void 0,
|
|
1476
|
+
...cost?.cacheRead !== void 0 ? { "app.cost.cache_read_usd": cost.cacheRead } : void 0,
|
|
1477
|
+
...cost?.cacheWrite !== void 0 ? { "app.cost.cache_write_usd": cost.cacheWrite } : void 0,
|
|
1478
|
+
...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
|
|
1468
1479
|
};
|
|
1469
1480
|
}
|
|
1470
1481
|
|
|
@@ -1473,6 +1484,16 @@ export {
|
|
|
1473
1484
|
toOptionalNumber,
|
|
1474
1485
|
isRecord,
|
|
1475
1486
|
normalizeIdentityEmail,
|
|
1487
|
+
JUNIOR_HEARTBEAT_ROUTE,
|
|
1488
|
+
JUNIOR_HEARTBEAT_CRON_SCHEDULE,
|
|
1489
|
+
JUNIOR_RETENTION_ROUTE,
|
|
1490
|
+
JUNIOR_RETENTION_CRON_SCHEDULE,
|
|
1491
|
+
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
1492
|
+
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
|
|
1493
|
+
JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE,
|
|
1494
|
+
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION,
|
|
1495
|
+
getDeploymentServiceVersion,
|
|
1496
|
+
getDeploymentTelemetryAttributes,
|
|
1476
1497
|
normalizeGenAiFinishReason,
|
|
1477
1498
|
summarizeMessageText,
|
|
1478
1499
|
createChatSdkLogger,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
logWarn
|
|
6
|
-
} from "./chunk-HQNE5APD.js";
|
|
3
|
+
} from "./chunk-HEBMSITT.js";
|
|
7
4
|
import {
|
|
8
5
|
skillRoots
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TXKUKMVO.js";
|
|
7
|
+
import {
|
|
8
|
+
logWarn
|
|
9
|
+
} from "./chunk-EBMRB6Z6.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/skills.ts
|
|
12
12
|
import fs from "fs/promises";
|
|
@@ -147,11 +147,11 @@ function parseSkillFile(raw, expectedName) {
|
|
|
147
147
|
name: result.data.name,
|
|
148
148
|
description: result.data.description,
|
|
149
149
|
body: stripFrontmatter(raw),
|
|
150
|
-
...result.data.metadata ? { metadata: result.data.metadata } :
|
|
151
|
-
...result.data.compatibility !== void 0 ? { compatibility: result.data.compatibility } :
|
|
152
|
-
...result.data.license !== void 0 ? { license: result.data.license } :
|
|
153
|
-
...allowedTools ? { allowedTools } :
|
|
154
|
-
...disableModelInvocation ? { disableModelInvocation } :
|
|
150
|
+
...result.data.metadata ? { metadata: result.data.metadata } : void 0,
|
|
151
|
+
...result.data.compatibility !== void 0 ? { compatibility: result.data.compatibility } : void 0,
|
|
152
|
+
...result.data.license !== void 0 ? { license: result.data.license } : void 0,
|
|
153
|
+
...allowedTools ? { allowedTools } : void 0,
|
|
154
|
+
...disableModelInvocation ? { disableModelInvocation } : void 0
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
}
|
|
@@ -235,9 +235,9 @@ async function readSkillDirectory(skillDir) {
|
|
|
235
235
|
name,
|
|
236
236
|
description,
|
|
237
237
|
skillPath: skillDir,
|
|
238
|
-
...plugin ? { pluginProvider: plugin.manifest.name } :
|
|
239
|
-
...allowedTools ? { allowedTools } :
|
|
240
|
-
...disableModelInvocation ? { disableModelInvocation } :
|
|
238
|
+
...plugin ? { pluginProvider: plugin.manifest.name } : void 0,
|
|
239
|
+
...allowedTools ? { allowedTools } : void 0,
|
|
240
|
+
...disableModelInvocation ? { disableModelInvocation } : void 0
|
|
241
241
|
};
|
|
242
242
|
} catch (error) {
|
|
243
243
|
logWarn("skill.directory.read.failed", {
|
|
@@ -364,9 +364,9 @@ async function loadSkillsByName(skillNames, available) {
|
|
|
364
364
|
name: parsed.skill.name,
|
|
365
365
|
description: parsed.skill.description,
|
|
366
366
|
skillPath: meta.skillPath,
|
|
367
|
-
...plugin ? { pluginProvider: plugin.manifest.name } :
|
|
368
|
-
...parsed.skill.allowedTools ? { allowedTools: parsed.skill.allowedTools } :
|
|
369
|
-
...parsed.skill.disableModelInvocation ? { disableModelInvocation: parsed.skill.disableModelInvocation } :
|
|
367
|
+
...plugin ? { pluginProvider: plugin.manifest.name } : void 0,
|
|
368
|
+
...parsed.skill.allowedTools ? { allowedTools: parsed.skill.allowedTools } : void 0,
|
|
369
|
+
...parsed.skill.disableModelInvocation ? { disableModelInvocation: parsed.skill.disableModelInvocation } : void 0
|
|
370
370
|
};
|
|
371
371
|
skills.push({
|
|
372
372
|
...loadedMeta,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logWarn
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EBMRB6Z6.js";
|
|
4
4
|
|
|
5
5
|
// src/chat/conversation-privacy.ts
|
|
6
6
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -49,7 +49,7 @@ function toGenAiPayloadMetadata(payload) {
|
|
|
49
49
|
const keys = payloadKeys(payload);
|
|
50
50
|
return {
|
|
51
51
|
...base,
|
|
52
|
-
...keys ? { keys } :
|
|
52
|
+
...keys ? { keys } : void 0
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
function toGenAiPayloadTraceAttributes(prefix, payload) {
|
|
@@ -180,8 +180,8 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
180
180
|
[`${prefix}.message_count`]: messages.length,
|
|
181
181
|
[`${prefix}.content_chars`]: contentChars,
|
|
182
182
|
[`${prefix}.messages.size`]: contentChars,
|
|
183
|
-
...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } :
|
|
184
|
-
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } :
|
|
183
|
+
...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } : void 0,
|
|
184
|
+
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : void 0
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
persistConversationMessages
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NQTA72Q3.js";
|
|
4
4
|
import {
|
|
5
5
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
6
6
|
} from "./chunk-3Y47VMHV.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RNMASWLP.js";
|
|
10
10
|
import {
|
|
11
11
|
juniorLocationConfigurations
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KKSVCHDO.js";
|
|
13
13
|
import {
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PL57B6NC.js";
|
|
16
16
|
import {
|
|
17
17
|
juniorDestinations
|
|
18
18
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,59 +20,7 @@ import {
|
|
|
20
20
|
isRecord,
|
|
21
21
|
toOptionalNumber,
|
|
22
22
|
toOptionalString
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
|
|
25
|
-
// src/chat/conversations/turn-lifecycle.ts
|
|
26
|
-
var ConversationTurnLifecycleService = class {
|
|
27
|
-
constructor(events) {
|
|
28
|
-
this.events = events;
|
|
29
|
-
}
|
|
30
|
-
events;
|
|
31
|
-
/** Record the turn start once after every input message is durable. */
|
|
32
|
-
async start(input) {
|
|
33
|
-
await this.events.append(input.conversationId, [
|
|
34
|
-
{
|
|
35
|
-
idempotencyKey: `turn:${input.turnId}:started`,
|
|
36
|
-
createdAtMs: input.createdAtMs,
|
|
37
|
-
data: {
|
|
38
|
-
type: "turn_started",
|
|
39
|
-
turnId: input.turnId,
|
|
40
|
-
inputMessageIds: input.inputMessageIds,
|
|
41
|
-
surface: input.surface
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
/** Record successful or intentional-silence completion once. */
|
|
47
|
-
async complete(input) {
|
|
48
|
-
await this.events.append(input.conversationId, [
|
|
49
|
-
{
|
|
50
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
51
|
-
createdAtMs: input.createdAtMs,
|
|
52
|
-
data: {
|
|
53
|
-
type: "turn_completed",
|
|
54
|
-
turnId: input.turnId,
|
|
55
|
-
outcome: input.outcome
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
/** Record a classified failure once without accepting raw error details. */
|
|
61
|
-
async fail(input) {
|
|
62
|
-
await this.events.append(input.conversationId, [
|
|
63
|
-
{
|
|
64
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
65
|
-
createdAtMs: input.createdAtMs,
|
|
66
|
-
data: {
|
|
67
|
-
type: "turn_failed",
|
|
68
|
-
turnId: input.turnId,
|
|
69
|
-
failureCode: input.failureCode,
|
|
70
|
-
...input.eventId ? { eventId: input.eventId } : {}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
]);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
23
|
+
} from "./chunk-EBMRB6Z6.js";
|
|
76
24
|
|
|
77
25
|
// src/chat/state/conversation.ts
|
|
78
26
|
function defaultConversationState() {
|
|
@@ -103,7 +51,7 @@ function coercePendingAuthState(value) {
|
|
|
103
51
|
const base = {
|
|
104
52
|
provider,
|
|
105
53
|
actorId,
|
|
106
|
-
...scope ? { scope } :
|
|
54
|
+
...scope ? { scope } : void 0,
|
|
107
55
|
sessionId,
|
|
108
56
|
linkSentAtMs
|
|
109
57
|
};
|
|
@@ -496,8 +444,8 @@ function getPersistedSandboxState(state) {
|
|
|
496
444
|
const workspaceId = toOptionalString(state.app_sandbox_workspace_id);
|
|
497
445
|
return {
|
|
498
446
|
id,
|
|
499
|
-
...profileHash ? { profileHash } :
|
|
500
|
-
...workspaceId ? { workspaceId } :
|
|
447
|
+
...profileHash ? { profileHash } : void 0,
|
|
448
|
+
...workspaceId ? { workspaceId } : void 0
|
|
501
449
|
};
|
|
502
450
|
}
|
|
503
451
|
async function persistThreadState(thread, patch) {
|
|
@@ -557,7 +505,6 @@ function getLocationConfigurationService(destination) {
|
|
|
557
505
|
}
|
|
558
506
|
|
|
559
507
|
export {
|
|
560
|
-
ConversationTurnLifecycleService,
|
|
561
508
|
configValueSchema,
|
|
562
509
|
coerceThreadConversationState,
|
|
563
510
|
getPersistedSandboxState,
|