Skip to content

Commit 919c509

Browse files
committed
fix: open pricing page when encountered usage limit error
1 parent b50cf48 commit 919c509

File tree

5 files changed

+94
-3
lines changed

5 files changed

+94
-3
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"format": "biome format --write .",
1717
"clean": "rm -rf build",
1818
"prepublishOnly": "npm run clean && npm run build",
19+
"pack": "npm run dxt:pack && npm run mcpb:pack",
1920
"dxt:build": "CLIENT_TYPE=dxt tsup",
2021
"dxt:pack": "npm run dxt:build && dxt pack",
2122
"dxt:dev": "dxt dev",
@@ -38,6 +39,7 @@
3839
"date-fns": "^4.1.0",
3940
"lodash": "^4.17.21",
4041
"mime-types": "^2.1.35",
42+
"open": "^10.2.0",
4143
"p-retry": "^7.0.0",
4244
"pkce-challenge": "^5.0.0",
4345
"zod": "^3.23.8",

pnpm-lock.yaml

Lines changed: 81 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/oauth-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class PageIndexOAuthProvider implements OAuthClientProvider {
197197
resolve(code);
198198

199199
// For DXT builds, redirect directly without showing content
200-
if (__CLIENT_TYPE__ === 'dxt') {
200+
if (['dxt', 'mcpb'].includes(__CLIENT_TYPE__)) {
201201
res.writeHead(302, { Location: 'claude://claude.ai/new' });
202202
res.end();
203203
} else {

src/tools/process-document.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from 'node:fs/promises';
22
import path from 'node:path';
33
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
4+
import open from 'open';
45
import pRetry, { AbortError } from 'p-retry';
56
import { z } from 'zod';
67
import type { PageIndexMcpClient } from '../client/mcp-client.js';
@@ -68,6 +69,15 @@ async function processDocument(
6869
const submitResult = await mcpClient.callTool('submit_document', {
6970
file_name: uploadInfo.file_name,
7071
});
72+
73+
if (submitResult.isError) {
74+
const [content] = submitResult.content || [];
75+
const result = JSON.parse((content?.text as string) || '{}');
76+
if (result.open_url) {
77+
open(result.open_url);
78+
}
79+
}
80+
7181
return submitResult;
7282
} catch (error) {
7383
// Handle PDF validation errors with specific guidance

src/tools/remote-proxy.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ export class RemoteToolsProxy {
2121
getClientInfo(): {
2222
type: 'dxt' | 'npm';
2323
version: string;
24-
isDxt: boolean;
2524
} {
2625
return {
2726
type: __CLIENT_TYPE__,
2827
version: __VERSION__,
29-
isDxt: __CLIENT_TYPE__ === 'dxt',
3028
};
3129
}
3230

0 commit comments

Comments
 (0)