mcp-scraper 0.3.46 → 0.3.47
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/bin/api-server.cjs +46 -14
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +2 -2
- package/dist/bin/mcp-scraper-cli.cjs +1 -1
- package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-install.cjs +1 -1
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +1 -1
- package/dist/bin/mcp-stdio-server.cjs +10 -5
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +2 -2
- package/dist/{chunk-BRVX6RDN.js → chunk-7TFJJAPE.js} +4 -3
- package/dist/chunk-7TFJJAPE.js.map +1 -0
- package/dist/{chunk-SS5YBZVI.js → chunk-A6BAV444.js} +11 -6
- package/dist/chunk-A6BAV444.js.map +1 -0
- package/dist/chunk-NTCAVBHU.js +7 -0
- package/dist/chunk-NTCAVBHU.js.map +1 -0
- package/dist/{server-MGE3GYJW.js → server-H6GAAEQ6.js} +38 -12
- package/dist/{server-MGE3GYJW.js.map → server-H6GAAEQ6.js.map} +1 -1
- package/dist/{worker-4CVMSUZR.js → worker-WY7C45MP.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BRVX6RDN.js.map +0 -1
- package/dist/chunk-SS5YBZVI.js.map +0 -1
- package/dist/chunk-WT6OT2T3.js +0 -7
- package/dist/chunk-WT6OT2T3.js.map +0 -1
- /package/dist/{worker-4CVMSUZR.js.map → worker-WY7C45MP.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = '0.3.47'\n"],"mappings":";AAAO,IAAM,kBAAkB;","names":[]}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
renderLinkReport,
|
|
19
19
|
sanitizeAttempts,
|
|
20
20
|
sanitizeHarvestResult
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-A6BAV444.js";
|
|
22
22
|
import {
|
|
23
23
|
csvRecords,
|
|
24
24
|
listWorkflowDefinitions,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
workflowStepCount,
|
|
32
32
|
workflowSupportsSteps
|
|
33
33
|
} from "./chunk-NNEIXK5L.js";
|
|
34
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-NTCAVBHU.js";
|
|
35
35
|
import {
|
|
36
36
|
BROWSER_OPEN_MIN_BALANCE_MC,
|
|
37
37
|
CONCURRENCY_PRICE_ID,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
harvestProblemResponse,
|
|
55
55
|
insufficientBalanceResponse,
|
|
56
56
|
serializeHarvestProblem
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-7TFJJAPE.js";
|
|
58
58
|
import {
|
|
59
59
|
BrowserDriver,
|
|
60
60
|
MapsSelectors,
|
|
@@ -12078,13 +12078,16 @@ var videoApp = new Hono9();
|
|
|
12078
12078
|
var AnalyzeBodySchema = z17.object({
|
|
12079
12079
|
sourceUrl: z17.string().trim().url("sourceUrl must be a direct video file URL"),
|
|
12080
12080
|
intervalS: z17.number().min(1).max(30).optional(),
|
|
12081
|
-
maxFrames: z17.number().int().min(1).max(
|
|
12081
|
+
maxFrames: z17.number().int().min(1).max(480).optional(),
|
|
12082
12082
|
detail: z17.enum(["fast", "standard", "deep"]).optional(),
|
|
12083
12083
|
vault: z17.string().trim().min(1).optional()
|
|
12084
12084
|
});
|
|
12085
12085
|
function invalidRequest5(message) {
|
|
12086
12086
|
return { error_code: "invalid_request", message };
|
|
12087
12087
|
}
|
|
12088
|
+
function tiersFor(frames) {
|
|
12089
|
+
return Math.ceil(Math.min(Math.max(frames, 1), 480) / 120);
|
|
12090
|
+
}
|
|
12088
12091
|
videoApp.post("/analyze", createApiKeyAuth(), async (c) => {
|
|
12089
12092
|
const parsed = AnalyzeBodySchema.safeParse(await c.req.json().catch(() => ({})));
|
|
12090
12093
|
if (!parsed.success) return c.json(invalidRequest5(parsed.error.issues[0]?.message ?? "invalid request"), 400);
|
|
@@ -12092,21 +12095,24 @@ videoApp.post("/analyze", createApiKeyAuth(), async (c) => {
|
|
|
12092
12095
|
const user = c.get("user");
|
|
12093
12096
|
const { key: memKey, error: memErr } = await getOrCreateUserMemoryKey(user);
|
|
12094
12097
|
if (!memKey) return c.json({ error_code: "memory_unavailable", message: memErr ?? "memory unavailable" }, 502);
|
|
12095
|
-
const
|
|
12096
|
-
|
|
12098
|
+
const requestedFrames = Math.min(Math.max(body.maxFrames ?? 120, 1), 480);
|
|
12099
|
+
const tiers = tiersFor(requestedFrames);
|
|
12100
|
+
const holdMc = tiers * MC_COSTS.video_analysis;
|
|
12101
|
+
const { ok, balance_mc } = await debitMc(user.id, holdMc, LedgerOperation.VIDEO_ANALYSIS, body.sourceUrl);
|
|
12102
|
+
if (!ok) return c.json(insufficientBalanceResponse(balance_mc, holdMc), 402);
|
|
12097
12103
|
const started = await memoryCall(
|
|
12098
12104
|
"videoAnalyzeStartTool",
|
|
12099
12105
|
{
|
|
12100
12106
|
sourceUrl: body.sourceUrl,
|
|
12101
12107
|
intervalS: body.intervalS ?? 2,
|
|
12102
|
-
maxFrames:
|
|
12108
|
+
maxFrames: requestedFrames,
|
|
12103
12109
|
detail: body.detail ?? "standard",
|
|
12104
12110
|
vault: body.vault ?? "Library"
|
|
12105
12111
|
},
|
|
12106
12112
|
memKey
|
|
12107
12113
|
);
|
|
12108
12114
|
if (!started.ok || !started.runId) {
|
|
12109
|
-
await creditMc(user.id,
|
|
12115
|
+
await creditMc(user.id, holdMc, LedgerOperation.VIDEO_ANALYSIS_REFUND, `start-failed:${body.sourceUrl}`);
|
|
12110
12116
|
return c.json({ error_code: "video_start_failed", message: started.error ?? "could not start analysis" }, 502);
|
|
12111
12117
|
}
|
|
12112
12118
|
return c.json({
|
|
@@ -12125,11 +12131,30 @@ videoApp.post("/status", createApiKeyAuth(), async (c) => {
|
|
|
12125
12131
|
if (!memKey) return c.json({ error_code: "memory_unavailable", message: memErr ?? "memory unavailable" }, 502);
|
|
12126
12132
|
const st = await memoryCall("videoAnalyzeStatusTool", { runId }, memKey);
|
|
12127
12133
|
if (!st.ok) return c.json({ error_code: "not_found", message: st.error ?? "run not found" }, 404);
|
|
12134
|
+
const requestedTiers = tiersFor(st.maxFrames ?? 120);
|
|
12135
|
+
let reconciliation = null;
|
|
12128
12136
|
if (st.status === "failed") {
|
|
12137
|
+
const refundMc = requestedTiers * MC_COSTS.video_analysis;
|
|
12129
12138
|
const refundOp = `${LedgerOperation.VIDEO_ANALYSIS_REFUND}:${runId}`;
|
|
12130
12139
|
if (!await ledgerExistsForOperation(user.id, refundOp)) {
|
|
12131
|
-
await creditMc(user.id,
|
|
12140
|
+
await creditMc(user.id, refundMc, refundOp, `run-failed:${runId}`);
|
|
12132
12141
|
}
|
|
12142
|
+
reconciliation = { billedMc: requestedTiers * MC_COSTS.video_analysis, refundedMc: refundMc, effectiveFrames: null };
|
|
12143
|
+
}
|
|
12144
|
+
if (st.status === "done") {
|
|
12145
|
+
const effectiveTiers = tiersFor(st.frameCount ?? 120);
|
|
12146
|
+
const diff = requestedTiers - effectiveTiers;
|
|
12147
|
+
if (diff > 0) {
|
|
12148
|
+
const adjustOp = `${LedgerOperation.VIDEO_ANALYSIS_ADJUST}:${runId}`;
|
|
12149
|
+
if (!await ledgerExistsForOperation(user.id, adjustOp)) {
|
|
12150
|
+
await creditMc(user.id, diff * MC_COSTS.video_analysis, adjustOp, `tier-reconcile:${runId}`);
|
|
12151
|
+
}
|
|
12152
|
+
}
|
|
12153
|
+
reconciliation = {
|
|
12154
|
+
billedMc: requestedTiers * MC_COSTS.video_analysis,
|
|
12155
|
+
refundedMc: Math.max(diff, 0) * MC_COSTS.video_analysis,
|
|
12156
|
+
effectiveFrames: st.frameCount ?? null
|
|
12157
|
+
};
|
|
12133
12158
|
}
|
|
12134
12159
|
return c.json({
|
|
12135
12160
|
ok: true,
|
|
@@ -12138,7 +12163,8 @@ videoApp.post("/status", createApiKeyAuth(), async (c) => {
|
|
|
12138
12163
|
progress: st.progress ?? null,
|
|
12139
12164
|
frameCount: st.frameCount ?? null,
|
|
12140
12165
|
...st.status === "done" ? { artifactPath: st.artifactPath ?? null, report: st.report ?? null } : {},
|
|
12141
|
-
...st.error ? { error: st.error } : {}
|
|
12166
|
+
...st.error ? { error: st.error } : {},
|
|
12167
|
+
...reconciliation ? { reconciliation } : {}
|
|
12142
12168
|
});
|
|
12143
12169
|
});
|
|
12144
12170
|
|
|
@@ -20522,7 +20548,7 @@ app.get("/cron/tick", async (c) => {
|
|
|
20522
20548
|
if (!process.env.CRON_SECRET || secret2 !== `Bearer ${process.env.CRON_SECRET}`) {
|
|
20523
20549
|
return c.json({ error: "Unauthorized" }, 401);
|
|
20524
20550
|
}
|
|
20525
|
-
const { drainQueue } = await import("./worker-
|
|
20551
|
+
const { drainQueue } = await import("./worker-WY7C45MP.js");
|
|
20526
20552
|
const budget = { maxJobs: 10, deadlineMs: Date.now() + 28e4 };
|
|
20527
20553
|
const workflowDispatchResult = await dispatchDueWorkflowSchedules(`${new URL(c.req.url).protocol}//${new URL(c.req.url).host}`);
|
|
20528
20554
|
const [results, sweepResult, reapResult, expiredResult, blobCleanup] = await Promise.all([
|
|
@@ -20675,4 +20701,4 @@ app.get("/blog/:slug/", (c) => {
|
|
|
20675
20701
|
export {
|
|
20676
20702
|
app
|
|
20677
20703
|
};
|
|
20678
|
-
//# sourceMappingURL=server-
|
|
20704
|
+
//# sourceMappingURL=server-H6GAAEQ6.js.map
|