@fangyb/ahchat-bridge 0.1.35 → 0.1.37
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/cli.cjs +968 -184
- package/dist/feedbackWorkerCli.cjs +165 -8
- package/dist/index.js +963 -184
- package/dist/seedanceMcpCli.cjs +53 -7
- package/dist/seedreamMcpCli.cjs +53 -7
- package/package.json +3 -2
package/dist/seedanceMcpCli.cjs
CHANGED
|
@@ -31955,9 +31955,14 @@ ${entry.error.stack}` : ""}`
|
|
|
31955
31955
|
return `${ts} ${level} ${scope} ${entry.msg}${data}${trace}${errPart}`;
|
|
31956
31956
|
};
|
|
31957
31957
|
|
|
31958
|
+
// ../logger/src/fallback.ts
|
|
31959
|
+
init_cjs_shims();
|
|
31960
|
+
|
|
31958
31961
|
// ../logger/src/transports/console.ts
|
|
31959
31962
|
init_cjs_shims();
|
|
31960
31963
|
var protectedStreams = /* @__PURE__ */ new WeakSet();
|
|
31964
|
+
function ignoreWriteError(_error) {
|
|
31965
|
+
}
|
|
31961
31966
|
function defaultStream(kind) {
|
|
31962
31967
|
const maybeGlobal = globalThis;
|
|
31963
31968
|
return maybeGlobal.process?.[kind];
|
|
@@ -31970,12 +31975,13 @@ function safeWriteLine(stream, line, fallback) {
|
|
|
31970
31975
|
if (stream.destroyed || stream.writableEnded) return;
|
|
31971
31976
|
if (typeof stream === "object" && typeof stream.on === "function" && !protectedStreams.has(stream)) {
|
|
31972
31977
|
protectedStreams.add(stream);
|
|
31973
|
-
stream.on("error",
|
|
31978
|
+
stream.on("error", ignoreWriteError);
|
|
31974
31979
|
}
|
|
31975
31980
|
try {
|
|
31976
31981
|
stream.write(`${line}
|
|
31977
|
-
`,
|
|
31978
|
-
} catch {
|
|
31982
|
+
`, ignoreWriteError);
|
|
31983
|
+
} catch (e) {
|
|
31984
|
+
ignoreWriteError(e);
|
|
31979
31985
|
}
|
|
31980
31986
|
}
|
|
31981
31987
|
function consoleTransport(opts) {
|
|
@@ -32610,8 +32616,31 @@ function parseSize(maxSize) {
|
|
|
32610
32616
|
return trimmed;
|
|
32611
32617
|
}
|
|
32612
32618
|
var streamCache = /* @__PURE__ */ new Map();
|
|
32619
|
+
var droppedEntryCount = 0;
|
|
32620
|
+
var lastReportedDroppedTotal = 0;
|
|
32621
|
+
function buildLogDroppedSentinel(fmt, source, droppedTotal) {
|
|
32622
|
+
const entry = {
|
|
32623
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32624
|
+
level: "WARN",
|
|
32625
|
+
source,
|
|
32626
|
+
module: "logger.file",
|
|
32627
|
+
msg: "log_dropped",
|
|
32628
|
+
data: { droppedTotal }
|
|
32629
|
+
};
|
|
32630
|
+
return fmt(entry);
|
|
32631
|
+
}
|
|
32632
|
+
function writeWithDroppedSentinel(stream, fmt, line, source) {
|
|
32633
|
+
stream.write(`${line}
|
|
32634
|
+
`);
|
|
32635
|
+
if (droppedEntryCount > lastReportedDroppedTotal) {
|
|
32636
|
+
lastReportedDroppedTotal = droppedEntryCount;
|
|
32637
|
+
stream.write(`${buildLogDroppedSentinel(fmt, source, droppedEntryCount)}
|
|
32638
|
+
`);
|
|
32639
|
+
}
|
|
32640
|
+
}
|
|
32613
32641
|
function fileTransport(opts) {
|
|
32614
32642
|
const fmt = opts.formatter ?? jsonFormatter;
|
|
32643
|
+
const logSource = opts.source ?? "server";
|
|
32615
32644
|
const resolved = import_node_path.default.resolve(opts.path);
|
|
32616
32645
|
let cached2 = streamCache.get(resolved);
|
|
32617
32646
|
if (!cached2) {
|
|
@@ -32626,11 +32655,14 @@ function fileTransport(opts) {
|
|
|
32626
32655
|
streamCache.set(resolved, cached2);
|
|
32627
32656
|
}
|
|
32628
32657
|
return (entry) => {
|
|
32629
|
-
if (cached2.closed || cached2.stream.destroyed || cached2.stream.writableEnded)
|
|
32658
|
+
if (cached2.closed || cached2.stream.destroyed || cached2.stream.writableEnded) {
|
|
32659
|
+
droppedEntryCount += 1;
|
|
32660
|
+
return;
|
|
32661
|
+
}
|
|
32630
32662
|
try {
|
|
32631
|
-
cached2.stream
|
|
32632
|
-
`);
|
|
32663
|
+
writeWithDroppedSentinel(cached2.stream, fmt, fmt(entry), logSource);
|
|
32633
32664
|
} catch {
|
|
32665
|
+
droppedEntryCount += 1;
|
|
32634
32666
|
}
|
|
32635
32667
|
};
|
|
32636
32668
|
}
|
|
@@ -32650,6 +32682,8 @@ var DEFAULT_QUERY_CONFIG = {
|
|
|
32650
32682
|
maxActive: 5040,
|
|
32651
32683
|
idleTimeoutMs: 6e5,
|
|
32652
32684
|
workingSilenceTimeoutMs: 12e5,
|
|
32685
|
+
replyStallTimeoutMs: 3e5,
|
|
32686
|
+
busySilenceTimeoutMs: 18e5,
|
|
32653
32687
|
evictionIntervalMs: 6e4,
|
|
32654
32688
|
statusReportIntervalMs: 6e4,
|
|
32655
32689
|
allowBuiltinWebSearch: false,
|
|
@@ -32707,6 +32741,14 @@ function mergeQueryConfig(file2) {
|
|
|
32707
32741
|
"AHCHAT_BRIDGE_WORKING_SILENCE_TIMEOUT_MS",
|
|
32708
32742
|
q?.workingSilenceTimeoutMs ?? DEFAULT_QUERY_CONFIG.workingSilenceTimeoutMs
|
|
32709
32743
|
),
|
|
32744
|
+
replyStallTimeoutMs: readEnvInt(
|
|
32745
|
+
"AHCHAT_BRIDGE_REPLY_STALL_TIMEOUT_MS",
|
|
32746
|
+
q?.replyStallTimeoutMs ?? DEFAULT_QUERY_CONFIG.replyStallTimeoutMs
|
|
32747
|
+
),
|
|
32748
|
+
busySilenceTimeoutMs: readEnvInt(
|
|
32749
|
+
"AHCHAT_BRIDGE_BUSY_SILENCE_TIMEOUT_MS",
|
|
32750
|
+
q?.busySilenceTimeoutMs ?? DEFAULT_QUERY_CONFIG.busySilenceTimeoutMs ?? 18e5
|
|
32751
|
+
),
|
|
32710
32752
|
evictionIntervalMs: readEnvInt(
|
|
32711
32753
|
"AHCHAT_BRIDGE_EVICTION_INTERVAL_MS",
|
|
32712
32754
|
q?.evictionIntervalMs ?? DEFAULT_QUERY_CONFIG.evictionIntervalMs
|
|
@@ -32787,7 +32829,11 @@ function loadBridgeConfig(opts) {
|
|
|
32787
32829
|
) || null,
|
|
32788
32830
|
logUploadIntervalMs: readEnvInt(
|
|
32789
32831
|
"AHCHAT_LOG_UPLOAD_INTERVAL_MS",
|
|
32790
|
-
|
|
32832
|
+
// Flush every 60s instead of once a day. Daily flushing let logs pile up for hours,
|
|
32833
|
+
// then dumped tens of thousands of entries in one cycle on the next process start,
|
|
32834
|
+
// blowing past the server's per-minute upload quota (3000 entries / 3MB) and getting
|
|
32835
|
+
// 429'd. Small frequent batches stay well under that ceiling.
|
|
32836
|
+
fileConfig.logUploadIntervalMs ?? 6e4
|
|
32791
32837
|
),
|
|
32792
32838
|
queryConfig: mergeQueryConfig(fileConfig)
|
|
32793
32839
|
};
|
package/dist/seedreamMcpCli.cjs
CHANGED
|
@@ -31955,9 +31955,14 @@ ${entry.error.stack}` : ""}`
|
|
|
31955
31955
|
return `${ts} ${level} ${scope} ${entry.msg}${data}${trace}${errPart}`;
|
|
31956
31956
|
};
|
|
31957
31957
|
|
|
31958
|
+
// ../logger/src/fallback.ts
|
|
31959
|
+
init_cjs_shims();
|
|
31960
|
+
|
|
31958
31961
|
// ../logger/src/transports/console.ts
|
|
31959
31962
|
init_cjs_shims();
|
|
31960
31963
|
var protectedStreams = /* @__PURE__ */ new WeakSet();
|
|
31964
|
+
function ignoreWriteError(_error) {
|
|
31965
|
+
}
|
|
31961
31966
|
function defaultStream(kind) {
|
|
31962
31967
|
const maybeGlobal = globalThis;
|
|
31963
31968
|
return maybeGlobal.process?.[kind];
|
|
@@ -31970,12 +31975,13 @@ function safeWriteLine(stream, line, fallback) {
|
|
|
31970
31975
|
if (stream.destroyed || stream.writableEnded) return;
|
|
31971
31976
|
if (typeof stream === "object" && typeof stream.on === "function" && !protectedStreams.has(stream)) {
|
|
31972
31977
|
protectedStreams.add(stream);
|
|
31973
|
-
stream.on("error",
|
|
31978
|
+
stream.on("error", ignoreWriteError);
|
|
31974
31979
|
}
|
|
31975
31980
|
try {
|
|
31976
31981
|
stream.write(`${line}
|
|
31977
|
-
`,
|
|
31978
|
-
} catch {
|
|
31982
|
+
`, ignoreWriteError);
|
|
31983
|
+
} catch (e) {
|
|
31984
|
+
ignoreWriteError(e);
|
|
31979
31985
|
}
|
|
31980
31986
|
}
|
|
31981
31987
|
function consoleTransport(opts) {
|
|
@@ -32610,8 +32616,31 @@ function parseSize(maxSize) {
|
|
|
32610
32616
|
return trimmed;
|
|
32611
32617
|
}
|
|
32612
32618
|
var streamCache = /* @__PURE__ */ new Map();
|
|
32619
|
+
var droppedEntryCount = 0;
|
|
32620
|
+
var lastReportedDroppedTotal = 0;
|
|
32621
|
+
function buildLogDroppedSentinel(fmt, source, droppedTotal) {
|
|
32622
|
+
const entry = {
|
|
32623
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32624
|
+
level: "WARN",
|
|
32625
|
+
source,
|
|
32626
|
+
module: "logger.file",
|
|
32627
|
+
msg: "log_dropped",
|
|
32628
|
+
data: { droppedTotal }
|
|
32629
|
+
};
|
|
32630
|
+
return fmt(entry);
|
|
32631
|
+
}
|
|
32632
|
+
function writeWithDroppedSentinel(stream, fmt, line, source) {
|
|
32633
|
+
stream.write(`${line}
|
|
32634
|
+
`);
|
|
32635
|
+
if (droppedEntryCount > lastReportedDroppedTotal) {
|
|
32636
|
+
lastReportedDroppedTotal = droppedEntryCount;
|
|
32637
|
+
stream.write(`${buildLogDroppedSentinel(fmt, source, droppedEntryCount)}
|
|
32638
|
+
`);
|
|
32639
|
+
}
|
|
32640
|
+
}
|
|
32613
32641
|
function fileTransport(opts) {
|
|
32614
32642
|
const fmt = opts.formatter ?? jsonFormatter;
|
|
32643
|
+
const logSource = opts.source ?? "server";
|
|
32615
32644
|
const resolved = import_node_path.default.resolve(opts.path);
|
|
32616
32645
|
let cached2 = streamCache.get(resolved);
|
|
32617
32646
|
if (!cached2) {
|
|
@@ -32626,11 +32655,14 @@ function fileTransport(opts) {
|
|
|
32626
32655
|
streamCache.set(resolved, cached2);
|
|
32627
32656
|
}
|
|
32628
32657
|
return (entry) => {
|
|
32629
|
-
if (cached2.closed || cached2.stream.destroyed || cached2.stream.writableEnded)
|
|
32658
|
+
if (cached2.closed || cached2.stream.destroyed || cached2.stream.writableEnded) {
|
|
32659
|
+
droppedEntryCount += 1;
|
|
32660
|
+
return;
|
|
32661
|
+
}
|
|
32630
32662
|
try {
|
|
32631
|
-
cached2.stream
|
|
32632
|
-
`);
|
|
32663
|
+
writeWithDroppedSentinel(cached2.stream, fmt, fmt(entry), logSource);
|
|
32633
32664
|
} catch {
|
|
32665
|
+
droppedEntryCount += 1;
|
|
32634
32666
|
}
|
|
32635
32667
|
};
|
|
32636
32668
|
}
|
|
@@ -32650,6 +32682,8 @@ var DEFAULT_QUERY_CONFIG = {
|
|
|
32650
32682
|
maxActive: 5040,
|
|
32651
32683
|
idleTimeoutMs: 6e5,
|
|
32652
32684
|
workingSilenceTimeoutMs: 12e5,
|
|
32685
|
+
replyStallTimeoutMs: 3e5,
|
|
32686
|
+
busySilenceTimeoutMs: 18e5,
|
|
32653
32687
|
evictionIntervalMs: 6e4,
|
|
32654
32688
|
statusReportIntervalMs: 6e4,
|
|
32655
32689
|
allowBuiltinWebSearch: false,
|
|
@@ -32707,6 +32741,14 @@ function mergeQueryConfig(file2) {
|
|
|
32707
32741
|
"AHCHAT_BRIDGE_WORKING_SILENCE_TIMEOUT_MS",
|
|
32708
32742
|
q?.workingSilenceTimeoutMs ?? DEFAULT_QUERY_CONFIG.workingSilenceTimeoutMs
|
|
32709
32743
|
),
|
|
32744
|
+
replyStallTimeoutMs: readEnvInt(
|
|
32745
|
+
"AHCHAT_BRIDGE_REPLY_STALL_TIMEOUT_MS",
|
|
32746
|
+
q?.replyStallTimeoutMs ?? DEFAULT_QUERY_CONFIG.replyStallTimeoutMs
|
|
32747
|
+
),
|
|
32748
|
+
busySilenceTimeoutMs: readEnvInt(
|
|
32749
|
+
"AHCHAT_BRIDGE_BUSY_SILENCE_TIMEOUT_MS",
|
|
32750
|
+
q?.busySilenceTimeoutMs ?? DEFAULT_QUERY_CONFIG.busySilenceTimeoutMs ?? 18e5
|
|
32751
|
+
),
|
|
32710
32752
|
evictionIntervalMs: readEnvInt(
|
|
32711
32753
|
"AHCHAT_BRIDGE_EVICTION_INTERVAL_MS",
|
|
32712
32754
|
q?.evictionIntervalMs ?? DEFAULT_QUERY_CONFIG.evictionIntervalMs
|
|
@@ -32787,7 +32829,11 @@ function loadBridgeConfig(opts) {
|
|
|
32787
32829
|
) || null,
|
|
32788
32830
|
logUploadIntervalMs: readEnvInt(
|
|
32789
32831
|
"AHCHAT_LOG_UPLOAD_INTERVAL_MS",
|
|
32790
|
-
|
|
32832
|
+
// Flush every 60s instead of once a day. Daily flushing let logs pile up for hours,
|
|
32833
|
+
// then dumped tens of thousands of entries in one cycle on the next process start,
|
|
32834
|
+
// blowing past the server's per-minute upload quota (3000 entries / 3MB) and getting
|
|
32835
|
+
// 429'd. Small frequent batches stay well under that ceiling.
|
|
32836
|
+
fileConfig.logUploadIntervalMs ?? 6e4
|
|
32791
32837
|
),
|
|
32792
32838
|
queryConfig: mergeQueryConfig(fileConfig)
|
|
32793
32839
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fangyb/ahchat-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@anthropic-ai/claude-agent-sdk": "^0.
|
|
23
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.183",
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
25
25
|
"cac": "^6.7.14",
|
|
26
26
|
"officeparser": "7.1.0",
|
|
27
|
+
"pdfjs-dist": "5.6.205",
|
|
27
28
|
"xlsx": "^0.18.5",
|
|
28
29
|
"ws": "^8.18.0",
|
|
29
30
|
"zod": "^4.0.0"
|