@raindrop-ai/claude-code 0.0.8 → 0.0.9
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/cli.js +21 -16
- package/dist/index.cjs +19 -16
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1010,12 +1010,13 @@ function readTimestamp(key) {
|
|
|
1010
1010
|
return Number.isFinite(ts) ? ts : void 0;
|
|
1011
1011
|
}
|
|
1012
1012
|
async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
1013
|
-
var _a;
|
|
1014
|
-
const convoId = payload.session_id;
|
|
1013
|
+
var _a, _b;
|
|
1014
|
+
const convoId = (_a = config.convoId) != null ? _a : payload.session_id;
|
|
1015
1015
|
const baseProperties = {
|
|
1016
1016
|
...config.customProperties,
|
|
1017
1017
|
cwd: payload.cwd,
|
|
1018
1018
|
permission_mode: payload.permission_mode,
|
|
1019
|
+
claude_code_session_id: payload.session_id,
|
|
1019
1020
|
plugin_version: PACKAGE_VERSION,
|
|
1020
1021
|
sdk: PACKAGE_NAME,
|
|
1021
1022
|
sdk_version: PACKAGE_VERSION,
|
|
@@ -1024,7 +1025,7 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1024
1025
|
};
|
|
1025
1026
|
switch (payload.hook_event_name) {
|
|
1026
1027
|
case "SessionStart":
|
|
1027
|
-
writeState(`model_${payload.session_id}`, (
|
|
1028
|
+
writeState(`model_${payload.session_id}`, (_b = payload.model) != null ? _b : "");
|
|
1028
1029
|
tryCaptureAppendSystemPrompt(payload.session_id);
|
|
1029
1030
|
break;
|
|
1030
1031
|
case "UserPromptSubmit":
|
|
@@ -1040,10 +1041,10 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1040
1041
|
handlePostToolUseFailure(payload, getCurrentEventId(payload.session_id), traceShipper);
|
|
1041
1042
|
break;
|
|
1042
1043
|
case "Stop":
|
|
1043
|
-
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper, traceShipper);
|
|
1044
|
+
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper, traceShipper);
|
|
1044
1045
|
break;
|
|
1045
1046
|
case "StopFailure":
|
|
1046
|
-
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper, traceShipper, {
|
|
1047
|
+
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper, traceShipper, {
|
|
1047
1048
|
error: payload.error,
|
|
1048
1049
|
error_details: payload.error_details
|
|
1049
1050
|
});
|
|
@@ -1061,10 +1062,10 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1061
1062
|
handleInstructionsLoaded(payload);
|
|
1062
1063
|
break;
|
|
1063
1064
|
case "PostCompact":
|
|
1064
|
-
await handlePostCompact(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper);
|
|
1065
|
+
await handlePostCompact(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper);
|
|
1065
1066
|
break;
|
|
1066
1067
|
case "SessionEnd":
|
|
1067
|
-
await handleSessionEnd(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper);
|
|
1068
|
+
await handleSessionEnd(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper);
|
|
1068
1069
|
deleteState(turnEventKey(payload.session_id));
|
|
1069
1070
|
deleteState(rootSpanKey(payload.session_id));
|
|
1070
1071
|
deleteState(`model_${payload.session_id}`);
|
|
@@ -1214,11 +1215,11 @@ function handlePermissionDenied(payload, eventId, traceShipper) {
|
|
|
1214
1215
|
}
|
|
1215
1216
|
});
|
|
1216
1217
|
}
|
|
1217
|
-
async function handlePostCompact(payload, eventId, config, properties, eventShipper) {
|
|
1218
|
+
async function handlePostCompact(payload, eventId, convoId, config, properties, eventShipper) {
|
|
1218
1219
|
await eventShipper.patch(eventId, {
|
|
1219
1220
|
isPending: true,
|
|
1220
1221
|
userId: config.userId,
|
|
1221
|
-
convoId
|
|
1222
|
+
convoId,
|
|
1222
1223
|
eventName: config.eventName,
|
|
1223
1224
|
properties: {
|
|
1224
1225
|
...properties,
|
|
@@ -1508,7 +1509,7 @@ function buildStopOutput(summary, lastAssistantMessage) {
|
|
|
1508
1509
|
}
|
|
1509
1510
|
return finalMessage;
|
|
1510
1511
|
}
|
|
1511
|
-
async function handleStopOrFailure(payload, eventId, config, properties, eventShipper, traceShipper, extraProperties) {
|
|
1512
|
+
async function handleStopOrFailure(payload, eventId, convoId, config, properties, eventShipper, traceShipper, extraProperties) {
|
|
1512
1513
|
const { summary, props: transcriptProps } = enrichFromTranscript(payload, eventId, traceShipper);
|
|
1513
1514
|
const instructions = gatherInstructions(payload.session_id);
|
|
1514
1515
|
const appendSysPrompt = readAppendSystemPrompt(payload.session_id);
|
|
@@ -1516,7 +1517,7 @@ async function handleStopOrFailure(payload, eventId, config, properties, eventSh
|
|
|
1516
1517
|
await eventShipper.patch(eventId, {
|
|
1517
1518
|
isPending: false,
|
|
1518
1519
|
userId: config.userId,
|
|
1519
|
-
convoId
|
|
1520
|
+
convoId,
|
|
1520
1521
|
eventName: config.eventName,
|
|
1521
1522
|
output,
|
|
1522
1523
|
...(summary == null ? void 0 : summary.model) ? { model: summary.model } : {},
|
|
@@ -1529,10 +1530,11 @@ async function handleStopOrFailure(payload, eventId, config, properties, eventSh
|
|
|
1529
1530
|
}
|
|
1530
1531
|
});
|
|
1531
1532
|
}
|
|
1532
|
-
async function handleSessionEnd(payload, eventId, config, properties, eventShipper) {
|
|
1533
|
+
async function handleSessionEnd(payload, eventId, convoId, config, properties, eventShipper) {
|
|
1533
1534
|
await eventShipper.patch(eventId, {
|
|
1534
1535
|
isPending: false,
|
|
1535
1536
|
userId: config.userId,
|
|
1537
|
+
convoId,
|
|
1536
1538
|
eventName: config.eventName,
|
|
1537
1539
|
properties: {
|
|
1538
1540
|
...properties,
|
|
@@ -1547,7 +1549,7 @@ import { homedir, userInfo } from "os";
|
|
|
1547
1549
|
import { dirname, join as join2 } from "path";
|
|
1548
1550
|
var CONFIG_PATH = join2(homedir(), ".config", "raindrop", "config.json");
|
|
1549
1551
|
function loadConfig() {
|
|
1550
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1552
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1551
1553
|
let file = {};
|
|
1552
1554
|
try {
|
|
1553
1555
|
if (existsSync3(CONFIG_PATH)) {
|
|
@@ -1588,9 +1590,10 @@ function loadConfig() {
|
|
|
1588
1590
|
writeKey: (_c = (_b = process.env["RAINDROP_WRITE_KEY"]) != null ? _b : file.write_key) != null ? _c : "",
|
|
1589
1591
|
endpoint: (_e = (_d = process.env["RAINDROP_API_URL"]) != null ? _d : file.api_url) != null ? _e : "https://api.raindrop.ai/v1",
|
|
1590
1592
|
userId: (_g = (_f = process.env["RAINDROP_USER_ID"]) != null ? _f : file.user_id) != null ? _g : systemUser,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1593
|
+
convoId: ((_h = process.env["RAINDROP_CONVO_ID"]) == null ? void 0 : _h.trim()) || void 0,
|
|
1594
|
+
debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_i = file.debug) != null ? _i : false,
|
|
1595
|
+
enabled: (_j = file.enabled) != null ? _j : true,
|
|
1596
|
+
eventName: (_l = (_k = process.env["RAINDROP_EVENT_NAME"]) != null ? _k : file.event_name) != null ? _l : "claude_code_session",
|
|
1594
1597
|
customProperties,
|
|
1595
1598
|
selfDiagnostics
|
|
1596
1599
|
};
|
|
@@ -1763,6 +1766,7 @@ async function handleHook() {
|
|
|
1763
1766
|
}
|
|
1764
1767
|
const mapperConfig = {
|
|
1765
1768
|
userId: config.userId,
|
|
1769
|
+
convoId: config.convoId,
|
|
1766
1770
|
debug: config.debug,
|
|
1767
1771
|
eventName: config.eventName,
|
|
1768
1772
|
customProperties: config.customProperties
|
|
@@ -2494,6 +2498,7 @@ async function main() {
|
|
|
2494
2498
|
Environment:
|
|
2495
2499
|
RAINDROP_WRITE_KEY API write key (alternative to --write-key or config file)
|
|
2496
2500
|
RAINDROP_USER_ID User ID override
|
|
2501
|
+
RAINDROP_CONVO_ID Conversation/thread ID override
|
|
2497
2502
|
RAINDROP_EVENT_NAME Custom event name (default: "claude_code_session")
|
|
2498
2503
|
RAINDROP_PROPERTIES JSON object merged into every event's properties
|
|
2499
2504
|
RAINDROP_API_URL Custom API endpoint
|
package/dist/index.cjs
CHANGED
|
@@ -733,7 +733,7 @@ var import_node_os = require("os");
|
|
|
733
733
|
var import_node_path = require("path");
|
|
734
734
|
var CONFIG_PATH = (0, import_node_path.join)((0, import_node_os.homedir)(), ".config", "raindrop", "config.json");
|
|
735
735
|
function loadConfig() {
|
|
736
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
736
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
737
737
|
let file = {};
|
|
738
738
|
try {
|
|
739
739
|
if ((0, import_node_fs.existsSync)(CONFIG_PATH)) {
|
|
@@ -774,9 +774,10 @@ function loadConfig() {
|
|
|
774
774
|
writeKey: (_c = (_b = process.env["RAINDROP_WRITE_KEY"]) != null ? _b : file.write_key) != null ? _c : "",
|
|
775
775
|
endpoint: (_e = (_d = process.env["RAINDROP_API_URL"]) != null ? _d : file.api_url) != null ? _e : "https://api.raindrop.ai/v1",
|
|
776
776
|
userId: (_g = (_f = process.env["RAINDROP_USER_ID"]) != null ? _f : file.user_id) != null ? _g : systemUser,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
777
|
+
convoId: ((_h = process.env["RAINDROP_CONVO_ID"]) == null ? void 0 : _h.trim()) || void 0,
|
|
778
|
+
debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_i = file.debug) != null ? _i : false,
|
|
779
|
+
enabled: (_j = file.enabled) != null ? _j : true,
|
|
780
|
+
eventName: (_l = (_k = process.env["RAINDROP_EVENT_NAME"]) != null ? _k : file.event_name) != null ? _l : "claude_code_session",
|
|
780
781
|
customProperties,
|
|
781
782
|
selfDiagnostics
|
|
782
783
|
};
|
|
@@ -1123,12 +1124,13 @@ function readTimestamp(key) {
|
|
|
1123
1124
|
return Number.isFinite(ts) ? ts : void 0;
|
|
1124
1125
|
}
|
|
1125
1126
|
async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
1126
|
-
var _a;
|
|
1127
|
-
const convoId = payload.session_id;
|
|
1127
|
+
var _a, _b;
|
|
1128
|
+
const convoId = (_a = config.convoId) != null ? _a : payload.session_id;
|
|
1128
1129
|
const baseProperties = {
|
|
1129
1130
|
...config.customProperties,
|
|
1130
1131
|
cwd: payload.cwd,
|
|
1131
1132
|
permission_mode: payload.permission_mode,
|
|
1133
|
+
claude_code_session_id: payload.session_id,
|
|
1132
1134
|
plugin_version: PACKAGE_VERSION,
|
|
1133
1135
|
sdk: PACKAGE_NAME,
|
|
1134
1136
|
sdk_version: PACKAGE_VERSION,
|
|
@@ -1137,7 +1139,7 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1137
1139
|
};
|
|
1138
1140
|
switch (payload.hook_event_name) {
|
|
1139
1141
|
case "SessionStart":
|
|
1140
|
-
writeState(`model_${payload.session_id}`, (
|
|
1142
|
+
writeState(`model_${payload.session_id}`, (_b = payload.model) != null ? _b : "");
|
|
1141
1143
|
tryCaptureAppendSystemPrompt(payload.session_id);
|
|
1142
1144
|
break;
|
|
1143
1145
|
case "UserPromptSubmit":
|
|
@@ -1153,10 +1155,10 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1153
1155
|
handlePostToolUseFailure(payload, getCurrentEventId(payload.session_id), traceShipper);
|
|
1154
1156
|
break;
|
|
1155
1157
|
case "Stop":
|
|
1156
|
-
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper, traceShipper);
|
|
1158
|
+
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper, traceShipper);
|
|
1157
1159
|
break;
|
|
1158
1160
|
case "StopFailure":
|
|
1159
|
-
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper, traceShipper, {
|
|
1161
|
+
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper, traceShipper, {
|
|
1160
1162
|
error: payload.error,
|
|
1161
1163
|
error_details: payload.error_details
|
|
1162
1164
|
});
|
|
@@ -1174,10 +1176,10 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1174
1176
|
handleInstructionsLoaded(payload);
|
|
1175
1177
|
break;
|
|
1176
1178
|
case "PostCompact":
|
|
1177
|
-
await handlePostCompact(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper);
|
|
1179
|
+
await handlePostCompact(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper);
|
|
1178
1180
|
break;
|
|
1179
1181
|
case "SessionEnd":
|
|
1180
|
-
await handleSessionEnd(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper);
|
|
1182
|
+
await handleSessionEnd(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper);
|
|
1181
1183
|
deleteState(turnEventKey(payload.session_id));
|
|
1182
1184
|
deleteState(rootSpanKey(payload.session_id));
|
|
1183
1185
|
deleteState(`model_${payload.session_id}`);
|
|
@@ -1327,11 +1329,11 @@ function handlePermissionDenied(payload, eventId, traceShipper) {
|
|
|
1327
1329
|
}
|
|
1328
1330
|
});
|
|
1329
1331
|
}
|
|
1330
|
-
async function handlePostCompact(payload, eventId, config, properties, eventShipper) {
|
|
1332
|
+
async function handlePostCompact(payload, eventId, convoId, config, properties, eventShipper) {
|
|
1331
1333
|
await eventShipper.patch(eventId, {
|
|
1332
1334
|
isPending: true,
|
|
1333
1335
|
userId: config.userId,
|
|
1334
|
-
convoId
|
|
1336
|
+
convoId,
|
|
1335
1337
|
eventName: config.eventName,
|
|
1336
1338
|
properties: {
|
|
1337
1339
|
...properties,
|
|
@@ -1621,7 +1623,7 @@ function buildStopOutput(summary, lastAssistantMessage) {
|
|
|
1621
1623
|
}
|
|
1622
1624
|
return finalMessage;
|
|
1623
1625
|
}
|
|
1624
|
-
async function handleStopOrFailure(payload, eventId, config, properties, eventShipper, traceShipper, extraProperties) {
|
|
1626
|
+
async function handleStopOrFailure(payload, eventId, convoId, config, properties, eventShipper, traceShipper, extraProperties) {
|
|
1625
1627
|
const { summary, props: transcriptProps } = enrichFromTranscript(payload, eventId, traceShipper);
|
|
1626
1628
|
const instructions = gatherInstructions(payload.session_id);
|
|
1627
1629
|
const appendSysPrompt = readAppendSystemPrompt(payload.session_id);
|
|
@@ -1629,7 +1631,7 @@ async function handleStopOrFailure(payload, eventId, config, properties, eventSh
|
|
|
1629
1631
|
await eventShipper.patch(eventId, {
|
|
1630
1632
|
isPending: false,
|
|
1631
1633
|
userId: config.userId,
|
|
1632
|
-
convoId
|
|
1634
|
+
convoId,
|
|
1633
1635
|
eventName: config.eventName,
|
|
1634
1636
|
output,
|
|
1635
1637
|
...(summary == null ? void 0 : summary.model) ? { model: summary.model } : {},
|
|
@@ -1642,10 +1644,11 @@ async function handleStopOrFailure(payload, eventId, config, properties, eventSh
|
|
|
1642
1644
|
}
|
|
1643
1645
|
});
|
|
1644
1646
|
}
|
|
1645
|
-
async function handleSessionEnd(payload, eventId, config, properties, eventShipper) {
|
|
1647
|
+
async function handleSessionEnd(payload, eventId, convoId, config, properties, eventShipper) {
|
|
1646
1648
|
await eventShipper.patch(eventId, {
|
|
1647
1649
|
isPending: false,
|
|
1648
1650
|
userId: config.userId,
|
|
1651
|
+
convoId,
|
|
1649
1652
|
eventName: config.eventName,
|
|
1650
1653
|
properties: {
|
|
1651
1654
|
...properties,
|
package/dist/index.d.cts
CHANGED
|
@@ -244,6 +244,7 @@ interface RaindropConfig {
|
|
|
244
244
|
writeKey: string;
|
|
245
245
|
endpoint: string;
|
|
246
246
|
userId: string;
|
|
247
|
+
convoId?: string;
|
|
247
248
|
debug: boolean;
|
|
248
249
|
enabled: boolean;
|
|
249
250
|
eventName: string;
|
|
@@ -292,6 +293,7 @@ interface HookPayload {
|
|
|
292
293
|
}
|
|
293
294
|
interface MapperConfig {
|
|
294
295
|
userId: string;
|
|
296
|
+
convoId?: string;
|
|
295
297
|
debug: boolean;
|
|
296
298
|
eventName: string;
|
|
297
299
|
customProperties: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -244,6 +244,7 @@ interface RaindropConfig {
|
|
|
244
244
|
writeKey: string;
|
|
245
245
|
endpoint: string;
|
|
246
246
|
userId: string;
|
|
247
|
+
convoId?: string;
|
|
247
248
|
debug: boolean;
|
|
248
249
|
enabled: boolean;
|
|
249
250
|
eventName: string;
|
|
@@ -292,6 +293,7 @@ interface HookPayload {
|
|
|
292
293
|
}
|
|
293
294
|
interface MapperConfig {
|
|
294
295
|
userId: string;
|
|
296
|
+
convoId?: string;
|
|
295
297
|
debug: boolean;
|
|
296
298
|
eventName: string;
|
|
297
299
|
customProperties: Record<string, unknown>;
|
package/dist/index.js
CHANGED
|
@@ -688,7 +688,7 @@ import { homedir, userInfo } from "os";
|
|
|
688
688
|
import { dirname, join } from "path";
|
|
689
689
|
var CONFIG_PATH = join(homedir(), ".config", "raindrop", "config.json");
|
|
690
690
|
function loadConfig() {
|
|
691
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
691
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
692
692
|
let file = {};
|
|
693
693
|
try {
|
|
694
694
|
if (existsSync(CONFIG_PATH)) {
|
|
@@ -729,9 +729,10 @@ function loadConfig() {
|
|
|
729
729
|
writeKey: (_c = (_b = process.env["RAINDROP_WRITE_KEY"]) != null ? _b : file.write_key) != null ? _c : "",
|
|
730
730
|
endpoint: (_e = (_d = process.env["RAINDROP_API_URL"]) != null ? _d : file.api_url) != null ? _e : "https://api.raindrop.ai/v1",
|
|
731
731
|
userId: (_g = (_f = process.env["RAINDROP_USER_ID"]) != null ? _f : file.user_id) != null ? _g : systemUser,
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
732
|
+
convoId: ((_h = process.env["RAINDROP_CONVO_ID"]) == null ? void 0 : _h.trim()) || void 0,
|
|
733
|
+
debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_i = file.debug) != null ? _i : false,
|
|
734
|
+
enabled: (_j = file.enabled) != null ? _j : true,
|
|
735
|
+
eventName: (_l = (_k = process.env["RAINDROP_EVENT_NAME"]) != null ? _k : file.event_name) != null ? _l : "claude_code_session",
|
|
735
736
|
customProperties,
|
|
736
737
|
selfDiagnostics
|
|
737
738
|
};
|
|
@@ -1078,12 +1079,13 @@ function readTimestamp(key) {
|
|
|
1078
1079
|
return Number.isFinite(ts) ? ts : void 0;
|
|
1079
1080
|
}
|
|
1080
1081
|
async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
1081
|
-
var _a;
|
|
1082
|
-
const convoId = payload.session_id;
|
|
1082
|
+
var _a, _b;
|
|
1083
|
+
const convoId = (_a = config.convoId) != null ? _a : payload.session_id;
|
|
1083
1084
|
const baseProperties = {
|
|
1084
1085
|
...config.customProperties,
|
|
1085
1086
|
cwd: payload.cwd,
|
|
1086
1087
|
permission_mode: payload.permission_mode,
|
|
1088
|
+
claude_code_session_id: payload.session_id,
|
|
1087
1089
|
plugin_version: PACKAGE_VERSION,
|
|
1088
1090
|
sdk: PACKAGE_NAME,
|
|
1089
1091
|
sdk_version: PACKAGE_VERSION,
|
|
@@ -1092,7 +1094,7 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1092
1094
|
};
|
|
1093
1095
|
switch (payload.hook_event_name) {
|
|
1094
1096
|
case "SessionStart":
|
|
1095
|
-
writeState(`model_${payload.session_id}`, (
|
|
1097
|
+
writeState(`model_${payload.session_id}`, (_b = payload.model) != null ? _b : "");
|
|
1096
1098
|
tryCaptureAppendSystemPrompt(payload.session_id);
|
|
1097
1099
|
break;
|
|
1098
1100
|
case "UserPromptSubmit":
|
|
@@ -1108,10 +1110,10 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1108
1110
|
handlePostToolUseFailure(payload, getCurrentEventId(payload.session_id), traceShipper);
|
|
1109
1111
|
break;
|
|
1110
1112
|
case "Stop":
|
|
1111
|
-
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper, traceShipper);
|
|
1113
|
+
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper, traceShipper);
|
|
1112
1114
|
break;
|
|
1113
1115
|
case "StopFailure":
|
|
1114
|
-
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper, traceShipper, {
|
|
1116
|
+
await handleStopOrFailure(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper, traceShipper, {
|
|
1115
1117
|
error: payload.error,
|
|
1116
1118
|
error_details: payload.error_details
|
|
1117
1119
|
});
|
|
@@ -1129,10 +1131,10 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
|
|
|
1129
1131
|
handleInstructionsLoaded(payload);
|
|
1130
1132
|
break;
|
|
1131
1133
|
case "PostCompact":
|
|
1132
|
-
await handlePostCompact(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper);
|
|
1134
|
+
await handlePostCompact(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper);
|
|
1133
1135
|
break;
|
|
1134
1136
|
case "SessionEnd":
|
|
1135
|
-
await handleSessionEnd(payload, getCurrentEventId(payload.session_id), config, baseProperties, eventShipper);
|
|
1137
|
+
await handleSessionEnd(payload, getCurrentEventId(payload.session_id), convoId, config, baseProperties, eventShipper);
|
|
1136
1138
|
deleteState(turnEventKey(payload.session_id));
|
|
1137
1139
|
deleteState(rootSpanKey(payload.session_id));
|
|
1138
1140
|
deleteState(`model_${payload.session_id}`);
|
|
@@ -1282,11 +1284,11 @@ function handlePermissionDenied(payload, eventId, traceShipper) {
|
|
|
1282
1284
|
}
|
|
1283
1285
|
});
|
|
1284
1286
|
}
|
|
1285
|
-
async function handlePostCompact(payload, eventId, config, properties, eventShipper) {
|
|
1287
|
+
async function handlePostCompact(payload, eventId, convoId, config, properties, eventShipper) {
|
|
1286
1288
|
await eventShipper.patch(eventId, {
|
|
1287
1289
|
isPending: true,
|
|
1288
1290
|
userId: config.userId,
|
|
1289
|
-
convoId
|
|
1291
|
+
convoId,
|
|
1290
1292
|
eventName: config.eventName,
|
|
1291
1293
|
properties: {
|
|
1292
1294
|
...properties,
|
|
@@ -1576,7 +1578,7 @@ function buildStopOutput(summary, lastAssistantMessage) {
|
|
|
1576
1578
|
}
|
|
1577
1579
|
return finalMessage;
|
|
1578
1580
|
}
|
|
1579
|
-
async function handleStopOrFailure(payload, eventId, config, properties, eventShipper, traceShipper, extraProperties) {
|
|
1581
|
+
async function handleStopOrFailure(payload, eventId, convoId, config, properties, eventShipper, traceShipper, extraProperties) {
|
|
1580
1582
|
const { summary, props: transcriptProps } = enrichFromTranscript(payload, eventId, traceShipper);
|
|
1581
1583
|
const instructions = gatherInstructions(payload.session_id);
|
|
1582
1584
|
const appendSysPrompt = readAppendSystemPrompt(payload.session_id);
|
|
@@ -1584,7 +1586,7 @@ async function handleStopOrFailure(payload, eventId, config, properties, eventSh
|
|
|
1584
1586
|
await eventShipper.patch(eventId, {
|
|
1585
1587
|
isPending: false,
|
|
1586
1588
|
userId: config.userId,
|
|
1587
|
-
convoId
|
|
1589
|
+
convoId,
|
|
1588
1590
|
eventName: config.eventName,
|
|
1589
1591
|
output,
|
|
1590
1592
|
...(summary == null ? void 0 : summary.model) ? { model: summary.model } : {},
|
|
@@ -1597,10 +1599,11 @@ async function handleStopOrFailure(payload, eventId, config, properties, eventSh
|
|
|
1597
1599
|
}
|
|
1598
1600
|
});
|
|
1599
1601
|
}
|
|
1600
|
-
async function handleSessionEnd(payload, eventId, config, properties, eventShipper) {
|
|
1602
|
+
async function handleSessionEnd(payload, eventId, convoId, config, properties, eventShipper) {
|
|
1601
1603
|
await eventShipper.patch(eventId, {
|
|
1602
1604
|
isPending: false,
|
|
1603
1605
|
userId: config.userId,
|
|
1606
|
+
convoId,
|
|
1604
1607
|
eventName: config.eventName,
|
|
1605
1608
|
properties: {
|
|
1606
1609
|
...properties,
|
package/package.json
CHANGED