@raindrop-ai/opencode-plugin 0.1.0 → 0.1.1
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/index.cjs +15 -6
- package/dist/index.js +15 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1296,7 +1296,7 @@ function resolveLocalWorkshopUrl(fileValue) {
|
|
|
1296
1296
|
// package.json
|
|
1297
1297
|
var package_default = {
|
|
1298
1298
|
name: "@raindrop-ai/opencode-plugin",
|
|
1299
|
-
version: "0.1.
|
|
1299
|
+
version: "0.1.1",
|
|
1300
1300
|
description: "Raindrop observability plugin for OpenCode \u2014 automatic session/event/span tracing",
|
|
1301
1301
|
type: "module",
|
|
1302
1302
|
main: "dist/index.js",
|
|
@@ -1576,6 +1576,8 @@ function createSessionState(sessionId) {
|
|
|
1576
1576
|
return {
|
|
1577
1577
|
sessionId,
|
|
1578
1578
|
currentInput: "",
|
|
1579
|
+
turnOutputParts: [],
|
|
1580
|
+
turnOutputTokens: 0,
|
|
1579
1581
|
outputParts: /* @__PURE__ */ new Map(),
|
|
1580
1582
|
reasoningParts: /* @__PURE__ */ new Map(),
|
|
1581
1583
|
toolSpanStarts: /* @__PURE__ */ new Map(),
|
|
@@ -1806,6 +1808,10 @@ function createHooks(config, worktree, directory, eventShipper, traceShipper) {
|
|
|
1806
1808
|
const outputText = state.outputParts.get(messageId);
|
|
1807
1809
|
const reasoningText = state.reasoningParts.get(messageId);
|
|
1808
1810
|
const isToolCallsCompletion = finishReason === "tool-calls";
|
|
1811
|
+
if (outputText !== void 0 && outputText.trim().length > 0) {
|
|
1812
|
+
state.turnOutputParts.push(outputText);
|
|
1813
|
+
}
|
|
1814
|
+
state.turnOutputTokens += outputTokens;
|
|
1809
1815
|
const hasIntermediateReasoning = reasoningText !== void 0 && reasoningText.trim().length > 0;
|
|
1810
1816
|
if (outputText === void 0 && !(isToolCallsCompletion && hasIntermediateReasoning))
|
|
1811
1817
|
return;
|
|
@@ -1860,6 +1866,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1860
1866
|
return;
|
|
1861
1867
|
}
|
|
1862
1868
|
if (outputText === void 0) return;
|
|
1869
|
+
const turnOutputText = capText2(state.turnOutputParts.join("\n\n"));
|
|
1863
1870
|
const rootSpan = state.currentRootSpan;
|
|
1864
1871
|
const isCompaction = state.isCompacting === true;
|
|
1865
1872
|
if (state.parentId) {
|
|
@@ -1871,7 +1878,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1871
1878
|
"ai.prompt.messages",
|
|
1872
1879
|
buildPromptMessages(state.currentSystemPrompt, state.currentInput)
|
|
1873
1880
|
),
|
|
1874
|
-
attrString("ai.response.text",
|
|
1881
|
+
attrString("ai.response.text", turnOutputText),
|
|
1875
1882
|
attrString("gen_ai.system", providerID),
|
|
1876
1883
|
attrString("gen_ai.request.model", modelID),
|
|
1877
1884
|
attrString("gen_ai.response.model", modelID),
|
|
@@ -1923,7 +1930,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1923
1930
|
"ai.prompt.messages",
|
|
1924
1931
|
buildPromptMessages(state.currentSystemPrompt, state.currentInput)
|
|
1925
1932
|
),
|
|
1926
|
-
attrString("ai.response.text",
|
|
1933
|
+
attrString("ai.response.text", turnOutputText),
|
|
1927
1934
|
attrString("gen_ai.system", providerID),
|
|
1928
1935
|
attrString("gen_ai.request.model", modelID),
|
|
1929
1936
|
attrString("gen_ai.response.model", modelID),
|
|
@@ -1952,7 +1959,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1952
1959
|
}
|
|
1953
1960
|
}
|
|
1954
1961
|
state.currentRootSpan = void 0;
|
|
1955
|
-
const hasAssistantResponse =
|
|
1962
|
+
const hasAssistantResponse = turnOutputText.trim().length > 0;
|
|
1956
1963
|
if (!hasAssistantResponse && !msgError) {
|
|
1957
1964
|
await traceShipper.flush();
|
|
1958
1965
|
state.currentEventId = void 0;
|
|
@@ -1962,10 +1969,10 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1962
1969
|
await eventShipper.finish(state.currentEventId, {
|
|
1963
1970
|
userId: (_d = (_c = state.eventMetadata) == null ? void 0 : _c.userId) != null ? _d : state.sessionId,
|
|
1964
1971
|
model: modelID,
|
|
1965
|
-
output: msgError ? void 0 :
|
|
1972
|
+
output: msgError ? void 0 : turnOutputText,
|
|
1966
1973
|
usage: {
|
|
1967
1974
|
promptTokens: inputTokens,
|
|
1968
|
-
completionTokens:
|
|
1975
|
+
completionTokens: state.turnOutputTokens
|
|
1969
1976
|
},
|
|
1970
1977
|
error: msgError ? {
|
|
1971
1978
|
name: msgError.name,
|
|
@@ -2099,6 +2106,8 @@ type: ${errorName != null ? errorName : "UnknownError"}`;
|
|
|
2099
2106
|
};
|
|
2100
2107
|
const userText = capText2(textParts.join("\n"));
|
|
2101
2108
|
state.currentInput = userText;
|
|
2109
|
+
state.turnOutputParts = [];
|
|
2110
|
+
state.turnOutputTokens = 0;
|
|
2102
2111
|
if (state.parentId) {
|
|
2103
2112
|
if (!state.parentTaskSpanIds || !state.parentEventContext) {
|
|
2104
2113
|
return;
|
package/dist/index.js
CHANGED
|
@@ -1277,7 +1277,7 @@ function resolveLocalWorkshopUrl(fileValue) {
|
|
|
1277
1277
|
// package.json
|
|
1278
1278
|
var package_default = {
|
|
1279
1279
|
name: "@raindrop-ai/opencode-plugin",
|
|
1280
|
-
version: "0.1.
|
|
1280
|
+
version: "0.1.1",
|
|
1281
1281
|
description: "Raindrop observability plugin for OpenCode \u2014 automatic session/event/span tracing",
|
|
1282
1282
|
type: "module",
|
|
1283
1283
|
main: "dist/index.js",
|
|
@@ -1557,6 +1557,8 @@ function createSessionState(sessionId) {
|
|
|
1557
1557
|
return {
|
|
1558
1558
|
sessionId,
|
|
1559
1559
|
currentInput: "",
|
|
1560
|
+
turnOutputParts: [],
|
|
1561
|
+
turnOutputTokens: 0,
|
|
1560
1562
|
outputParts: /* @__PURE__ */ new Map(),
|
|
1561
1563
|
reasoningParts: /* @__PURE__ */ new Map(),
|
|
1562
1564
|
toolSpanStarts: /* @__PURE__ */ new Map(),
|
|
@@ -1787,6 +1789,10 @@ function createHooks(config, worktree, directory, eventShipper, traceShipper) {
|
|
|
1787
1789
|
const outputText = state.outputParts.get(messageId);
|
|
1788
1790
|
const reasoningText = state.reasoningParts.get(messageId);
|
|
1789
1791
|
const isToolCallsCompletion = finishReason === "tool-calls";
|
|
1792
|
+
if (outputText !== void 0 && outputText.trim().length > 0) {
|
|
1793
|
+
state.turnOutputParts.push(outputText);
|
|
1794
|
+
}
|
|
1795
|
+
state.turnOutputTokens += outputTokens;
|
|
1790
1796
|
const hasIntermediateReasoning = reasoningText !== void 0 && reasoningText.trim().length > 0;
|
|
1791
1797
|
if (outputText === void 0 && !(isToolCallsCompletion && hasIntermediateReasoning))
|
|
1792
1798
|
return;
|
|
@@ -1841,6 +1847,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1841
1847
|
return;
|
|
1842
1848
|
}
|
|
1843
1849
|
if (outputText === void 0) return;
|
|
1850
|
+
const turnOutputText = capText2(state.turnOutputParts.join("\n\n"));
|
|
1844
1851
|
const rootSpan = state.currentRootSpan;
|
|
1845
1852
|
const isCompaction = state.isCompacting === true;
|
|
1846
1853
|
if (state.parentId) {
|
|
@@ -1852,7 +1859,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1852
1859
|
"ai.prompt.messages",
|
|
1853
1860
|
buildPromptMessages(state.currentSystemPrompt, state.currentInput)
|
|
1854
1861
|
),
|
|
1855
|
-
attrString("ai.response.text",
|
|
1862
|
+
attrString("ai.response.text", turnOutputText),
|
|
1856
1863
|
attrString("gen_ai.system", providerID),
|
|
1857
1864
|
attrString("gen_ai.request.model", modelID),
|
|
1858
1865
|
attrString("gen_ai.response.model", modelID),
|
|
@@ -1904,7 +1911,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1904
1911
|
"ai.prompt.messages",
|
|
1905
1912
|
buildPromptMessages(state.currentSystemPrompt, state.currentInput)
|
|
1906
1913
|
),
|
|
1907
|
-
attrString("ai.response.text",
|
|
1914
|
+
attrString("ai.response.text", turnOutputText),
|
|
1908
1915
|
attrString("gen_ai.system", providerID),
|
|
1909
1916
|
attrString("gen_ai.request.model", modelID),
|
|
1910
1917
|
attrString("gen_ai.response.model", modelID),
|
|
@@ -1933,7 +1940,7 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1933
1940
|
}
|
|
1934
1941
|
}
|
|
1935
1942
|
state.currentRootSpan = void 0;
|
|
1936
|
-
const hasAssistantResponse =
|
|
1943
|
+
const hasAssistantResponse = turnOutputText.trim().length > 0;
|
|
1937
1944
|
if (!hasAssistantResponse && !msgError) {
|
|
1938
1945
|
await traceShipper.flush();
|
|
1939
1946
|
state.currentEventId = void 0;
|
|
@@ -1943,10 +1950,10 @@ type: ${name != null ? name : "UnknownError"}`;
|
|
|
1943
1950
|
await eventShipper.finish(state.currentEventId, {
|
|
1944
1951
|
userId: (_d = (_c = state.eventMetadata) == null ? void 0 : _c.userId) != null ? _d : state.sessionId,
|
|
1945
1952
|
model: modelID,
|
|
1946
|
-
output: msgError ? void 0 :
|
|
1953
|
+
output: msgError ? void 0 : turnOutputText,
|
|
1947
1954
|
usage: {
|
|
1948
1955
|
promptTokens: inputTokens,
|
|
1949
|
-
completionTokens:
|
|
1956
|
+
completionTokens: state.turnOutputTokens
|
|
1950
1957
|
},
|
|
1951
1958
|
error: msgError ? {
|
|
1952
1959
|
name: msgError.name,
|
|
@@ -2080,6 +2087,8 @@ type: ${errorName != null ? errorName : "UnknownError"}`;
|
|
|
2080
2087
|
};
|
|
2081
2088
|
const userText = capText2(textParts.join("\n"));
|
|
2082
2089
|
state.currentInput = userText;
|
|
2090
|
+
state.turnOutputParts = [];
|
|
2091
|
+
state.turnOutputTokens = 0;
|
|
2083
2092
|
if (state.parentId) {
|
|
2084
2093
|
if (!state.parentTaskSpanIds || !state.parentEventContext) {
|
|
2085
2094
|
return;
|