@dianshuv/copilot-api 0.4.1 → 0.4.2
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 +1 -0
- package/dist/main.mjs +18 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ copilot-api start
|
|
|
65
65
|
| `--compress-tool-results` | Compress old tool results before truncating | false |
|
|
66
66
|
| `--redirect-anthropic` | Force Anthropic through OpenAI translation | false |
|
|
67
67
|
| `--no-rewrite-anthropic-tools` | Don't rewrite server-side tools | false |
|
|
68
|
+
| `--timezone-offset` | Timezone offset in hours from UTC for log timestamps (e.g., +8, -5, 0) | +8 |
|
|
68
69
|
|
|
69
70
|
### Patch-Claude Command Options
|
|
70
71
|
|
package/dist/main.mjs
CHANGED
|
@@ -52,6 +52,7 @@ const state = {
|
|
|
52
52
|
redirectAnthropic: false,
|
|
53
53
|
rewriteAnthropicTools: true,
|
|
54
54
|
staleRequestMaxAge: 600,
|
|
55
|
+
timezoneOffset: 8,
|
|
55
56
|
shutdownGracefulWait: 60,
|
|
56
57
|
shutdownAbortWait: 120
|
|
57
58
|
};
|
|
@@ -1020,7 +1021,7 @@ const patchClaude = defineCommand({
|
|
|
1020
1021
|
|
|
1021
1022
|
//#endregion
|
|
1022
1023
|
//#region package.json
|
|
1023
|
-
var version = "0.4.
|
|
1024
|
+
var version = "0.4.2";
|
|
1024
1025
|
|
|
1025
1026
|
//#endregion
|
|
1026
1027
|
//#region src/lib/adaptive-rate-limiter.ts
|
|
@@ -2199,7 +2200,8 @@ function setupShutdownHandlers() {
|
|
|
2199
2200
|
//#region src/lib/tui/console-renderer.ts
|
|
2200
2201
|
const CLEAR_LINE = "\x1B[2K\r";
|
|
2201
2202
|
function formatTime(date = /* @__PURE__ */ new Date()) {
|
|
2202
|
-
|
|
2203
|
+
const adjusted = new Date(date.getTime() + state.timezoneOffset * 60 * 60 * 1e3);
|
|
2204
|
+
return `${String(adjusted.getUTCHours()).padStart(2, "0")}:${String(adjusted.getUTCMinutes()).padStart(2, "0")}:${String(adjusted.getUTCSeconds()).padStart(2, "0")}`;
|
|
2203
2205
|
}
|
|
2204
2206
|
function formatDuration(ms) {
|
|
2205
2207
|
if (ms < 1e3) return `${ms}ms`;
|
|
@@ -7815,6 +7817,7 @@ async function runServer(options) {
|
|
|
7815
7817
|
state.compressToolResults = options.compressToolResults;
|
|
7816
7818
|
state.redirectAnthropic = options.redirectAnthropic;
|
|
7817
7819
|
state.rewriteAnthropicTools = options.rewriteAnthropicTools;
|
|
7820
|
+
state.timezoneOffset = options.timezoneOffset;
|
|
7818
7821
|
if (options.rateLimit) initAdaptiveRateLimiter({
|
|
7819
7822
|
baseRetryIntervalSeconds: options.retryInterval,
|
|
7820
7823
|
requestIntervalSeconds: options.requestInterval,
|
|
@@ -7879,6 +7882,12 @@ async function runServer(options) {
|
|
|
7879
7882
|
hostname: options.host
|
|
7880
7883
|
}));
|
|
7881
7884
|
}
|
|
7885
|
+
function parseTimezoneOffset(value) {
|
|
7886
|
+
if (typeof value !== "string") return 8;
|
|
7887
|
+
const n = Number(value);
|
|
7888
|
+
if (!Number.isFinite(n)) return 8;
|
|
7889
|
+
return n;
|
|
7890
|
+
}
|
|
7882
7891
|
const start = defineCommand({
|
|
7883
7892
|
meta: {
|
|
7884
7893
|
name: "start",
|
|
@@ -7988,6 +7997,11 @@ const start = defineCommand({
|
|
|
7988
7997
|
type: "boolean",
|
|
7989
7998
|
default: false,
|
|
7990
7999
|
description: "Don't rewrite Anthropic server-side tools (web_search, etc.) to custom tool format"
|
|
8000
|
+
},
|
|
8001
|
+
"timezone-offset": {
|
|
8002
|
+
type: "string",
|
|
8003
|
+
default: "+8",
|
|
8004
|
+
description: "Timezone offset in hours from UTC for log timestamps (e.g., +8, -5, 0)"
|
|
7991
8005
|
}
|
|
7992
8006
|
},
|
|
7993
8007
|
run({ args }) {
|
|
@@ -8011,7 +8025,8 @@ const start = defineCommand({
|
|
|
8011
8025
|
autoTruncate: !args["no-auto-truncate"],
|
|
8012
8026
|
compressToolResults: args["compress-tool-results"],
|
|
8013
8027
|
redirectAnthropic: args["redirect-anthropic"],
|
|
8014
|
-
rewriteAnthropicTools: !args["no-rewrite-anthropic-tools"]
|
|
8028
|
+
rewriteAnthropicTools: !args["no-rewrite-anthropic-tools"],
|
|
8029
|
+
timezoneOffset: parseTimezoneOffset(args["timezone-offset"])
|
|
8015
8030
|
});
|
|
8016
8031
|
}
|
|
8017
8032
|
});
|