@rivus/agent 0.8.3 → 0.8.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/dist/index.d.ts +1 -0
- package/dist/index.js +12 -1
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -139,18 +139,29 @@ function createFeishuCardDeliveryReconciler(options) {
|
|
|
139
139
|
const terminalByRun = /* @__PURE__ */ new Map();
|
|
140
140
|
for (const event of options.events) for (const action of projector.apply(event)) if (action.type !== "update_text" && action.type !== "handoff") terminalByRun.set(action.runId, action);
|
|
141
141
|
let repaired = 0;
|
|
142
|
+
let skipped = 0;
|
|
142
143
|
for (const [runId, action] of terminalByRun) {
|
|
143
144
|
if (options.ledger.isTerminalPublished(runId)) continue;
|
|
144
|
-
yield* options.publish(action)
|
|
145
|
+
yield* options.publish(action).pipe(Effect.catchAll((error) => {
|
|
146
|
+
if (isMissingPresentationError(error)) {
|
|
147
|
+
skipped += 1;
|
|
148
|
+
return Effect.void;
|
|
149
|
+
}
|
|
150
|
+
return Effect.fail(error);
|
|
151
|
+
}));
|
|
145
152
|
yield* options.ledger.markTerminal(runId);
|
|
146
153
|
repaired += 1;
|
|
147
154
|
}
|
|
148
155
|
return {
|
|
149
156
|
repaired,
|
|
157
|
+
skipped,
|
|
150
158
|
terminalRuns: terminalByRun.size
|
|
151
159
|
};
|
|
152
160
|
}) };
|
|
153
161
|
}
|
|
162
|
+
function isMissingPresentationError(error) {
|
|
163
|
+
return error !== null && typeof error === "object" && error.name === "FeishuCardTargetNotFound";
|
|
164
|
+
}
|
|
154
165
|
function initialRecord(runId) {
|
|
155
166
|
return {
|
|
156
167
|
revision: 0,
|
package/dist/mcp.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ interface BackgroundSessionControlHttpServerOptions {
|
|
|
69
69
|
readonly control: BackgroundSessionControl;
|
|
70
70
|
readonly host?: string;
|
|
71
71
|
readonly port: number;
|
|
72
|
+
readonly status?: () => unknown;
|
|
72
73
|
readonly token: string;
|
|
73
74
|
}
|
|
74
75
|
interface BackgroundSessionControlHttpServer {
|
package/dist/mcp.js
CHANGED
|
@@ -338,6 +338,14 @@ function createBackgroundSessionControlHttpServer(options) {
|
|
|
338
338
|
const serverHandle = createServer((request, response) => {
|
|
339
339
|
(async () => {
|
|
340
340
|
try {
|
|
341
|
+
if (request.method === "GET" && request.url === "/background-sessions/status") {
|
|
342
|
+
if (request.headers.authorization !== `Bearer ${options.token}`) throw new BackgroundSessionControlHttpError(401, "unauthorized");
|
|
343
|
+
respond(response, 200, {
|
|
344
|
+
ok: true,
|
|
345
|
+
result: options.status?.() ?? null
|
|
346
|
+
});
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
341
349
|
if (request.method !== "POST" || request.url !== "/background-sessions") throw new BackgroundSessionControlHttpError(404, "not found");
|
|
342
350
|
if (request.headers.authorization !== `Bearer ${options.token}`) throw new BackgroundSessionControlHttpError(401, "unauthorized");
|
|
343
351
|
const envelope = parseEnvelope(await readBody(request, 64 * 1024));
|