@raindrop-ai/pi-agent 0.0.3 → 0.0.5
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/README.md +13 -4
- package/dist/{chunk-MHIMKMK7.js → chunk-2NGOEVWI.js} +488 -75
- package/dist/extension.cjs +501 -79
- package/dist/extension.d.cts +2 -2
- package/dist/extension.d.ts +2 -2
- package/dist/extension.js +16 -5
- package/dist/index.cjs +491 -78
- package/dist/index.d-CRPiWjXE.d.cts +369 -0
- package/dist/index.d-CRPiWjXE.d.ts +369 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -4
- package/package.json +7 -7
- package/dist/index.d-CtwaEReY.d.cts +0 -228
- package/dist/index.d-CtwaEReY.d.ts +0 -228
package/dist/extension.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExtensionAPI } from '@
|
|
2
|
-
import { E as EventShipper$1, T as TraceShipper$1, O as OtlpSpan } from './index.d-
|
|
1
|
+
import { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { E as EventShipper$1, T as TraceShipper$1, O as OtlpSpan } from './index.d-CRPiWjXE.cjs';
|
|
3
3
|
|
|
4
4
|
interface EventMetadata {
|
|
5
5
|
userId?: string;
|
package/dist/extension.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExtensionAPI } from '@
|
|
2
|
-
import { E as EventShipper$1, T as TraceShipper$1, O as OtlpSpan } from './index.d-
|
|
1
|
+
import { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { E as EventShipper$1, T as TraceShipper$1, O as OtlpSpan } from './index.d-CRPiWjXE.js';
|
|
3
3
|
|
|
4
4
|
interface EventMetadata {
|
|
5
5
|
userId?: string;
|
package/dist/extension.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
TraceShipper,
|
|
4
4
|
attrInt,
|
|
5
5
|
attrString,
|
|
6
|
+
capText,
|
|
6
7
|
extractAssistantText,
|
|
7
8
|
formatToolSpanName,
|
|
8
9
|
generateId,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
resolveLocalDebuggerBaseUrl,
|
|
14
15
|
safeStringify,
|
|
15
16
|
truncate
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2NGOEVWI.js";
|
|
17
18
|
|
|
18
19
|
// src/internal/config.ts
|
|
19
20
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -78,6 +79,15 @@ function safeParsArgs(argsStr) {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
var MAX_SYSTEM_PROMPT_LENGTH = 32768;
|
|
82
|
+
var ERROR_LOG_INTERVAL_MS = 3e4;
|
|
83
|
+
var lastErrorLogAt = /* @__PURE__ */ new Map();
|
|
84
|
+
function rateLimitedErrorLog(key, message) {
|
|
85
|
+
const now = Date.now();
|
|
86
|
+
const last = lastErrorLogAt.get(key);
|
|
87
|
+
if (last !== void 0 && now - last < ERROR_LOG_INTERVAL_MS) return;
|
|
88
|
+
lastErrorLogAt.set(key, now);
|
|
89
|
+
console.log(message);
|
|
90
|
+
}
|
|
81
91
|
function createSessionState(sessionId) {
|
|
82
92
|
return {
|
|
83
93
|
sessionId,
|
|
@@ -142,7 +152,8 @@ function getState(stateRef, ctx) {
|
|
|
142
152
|
function registerTracing(pi, config, eventShipper, traceShipper) {
|
|
143
153
|
const stateRef = {};
|
|
144
154
|
function logError(hook, err) {
|
|
145
|
-
|
|
155
|
+
rateLimitedErrorLog(
|
|
156
|
+
hook,
|
|
146
157
|
`[raindrop-ai/pi-agent] [error] Error in ${hook}: ${err instanceof Error ? err.message : String(err)}`
|
|
147
158
|
);
|
|
148
159
|
}
|
|
@@ -195,7 +206,7 @@ function registerTracing(pi, config, eventShipper, traceShipper) {
|
|
|
195
206
|
}
|
|
196
207
|
state.toolSpanStarts.clear();
|
|
197
208
|
state.toolCallToLlmParent.clear();
|
|
198
|
-
state.currentInput = event.prompt;
|
|
209
|
+
state.currentInput = capText(event.prompt);
|
|
199
210
|
state.turnNumber = 0;
|
|
200
211
|
state.currentSystemPrompt = config.captureSystemPrompt ? truncateSystemPrompt(event.systemPrompt) : void 0;
|
|
201
212
|
state.currentEventRequestId = generateId();
|
|
@@ -216,7 +227,7 @@ function registerTracing(pi, config, eventShipper, traceShipper) {
|
|
|
216
227
|
userId: getUserId(state, config.eventMetadata),
|
|
217
228
|
convoId: state.sessionId,
|
|
218
229
|
eventName: getEventName(config),
|
|
219
|
-
input:
|
|
230
|
+
input: state.currentInput,
|
|
220
231
|
...attachments.length > 0 ? { attachments } : {},
|
|
221
232
|
properties: getBaseProperties(config, ctx)
|
|
222
233
|
});
|
|
@@ -267,7 +278,7 @@ function registerTracing(pi, config, eventShipper, traceShipper) {
|
|
|
267
278
|
const modelId = (_c = message.model) != null ? _c : "";
|
|
268
279
|
const modelName = provider && modelId ? `${provider}/${modelId}` : modelId || "llm";
|
|
269
280
|
const errorForSpan = getAssistantError(message);
|
|
270
|
-
const outputText = getAssistantText(message);
|
|
281
|
+
const outputText = capText(getAssistantText(message));
|
|
271
282
|
const inputTokens = (_d = message.usage) == null ? void 0 : _d.input;
|
|
272
283
|
const outputTokens = (_e = message.usage) == null ? void 0 : _e.output;
|
|
273
284
|
const cacheReadTokens = (_f = message.usage) == null ? void 0 : _f.cacheRead;
|