@saltpub/xiaojiu-agent-bridge 0.1.4 → 0.1.6
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/CHANGELOG.md +40 -0
- package/README.md +6 -2
- package/dist/cli.js +2681 -1864
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -10
- package/package.json +8 -9
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -563,13 +563,13 @@ var CREDENTIAL_JSON_FIELD_RE = /("(?:secret|app_secret|appSecret|token|access_to
|
|
|
563
563
|
var ESCAPED_CREDENTIAL_JSON_FIELD_RE = /(\\\"(?:secret|app_secret|appSecret|token|access_token|tenant_access_token|app_access_token|authorization)\\\"\s*:\s*\\\")[^\\]*(\\\")/gi;
|
|
564
564
|
var RESOURCE_JSON_FIELD_RE = /("(?:fileKey|sourceFileKey|file_key|source_file_key|imageKey|image_key|mediaKey|media_key)"\s*:\s*")[^"]*(")/gi;
|
|
565
565
|
var ESCAPED_RESOURCE_JSON_FIELD_RE = /(\\\"(?:fileKey|sourceFileKey|file_key|source_file_key|imageKey|image_key|mediaKey|media_key)\\\"\s*:\s*\\\")[^\\]*(\\\")/gi;
|
|
566
|
-
var EXTERNAL_SANITIZE = { redactIds:
|
|
566
|
+
var EXTERNAL_SANITIZE = { redactIds: false, redactPaths: false };
|
|
567
567
|
function sanitizeLogValue(key, value, options = EXTERNAL_SANITIZE) {
|
|
568
568
|
const normalizedKey = key.startsWith("_") ? key.slice(1) : key;
|
|
569
569
|
if (value === void 0) return void 0;
|
|
570
570
|
if (RAW_PAYLOAD_KEYS.has(normalizedKey)) return "[REDACTED]";
|
|
571
571
|
if (/(?:token(?!s)|secret|authorization)/i.test(normalizedKey)) return "[REDACTED]";
|
|
572
|
-
if (/attachment.*path|media.*path|^(cwd|cwdRealpath|path|absPath)$/i.test(normalizedKey)) {
|
|
572
|
+
if (options.redactPaths !== false && /attachment.*path|media.*path|^(cwd|cwdRealpath|path|absPath)$/i.test(normalizedKey)) {
|
|
573
573
|
return "[REDACTED_PATH]";
|
|
574
574
|
}
|
|
575
575
|
if (RESOURCE_ID_KEYS.has(normalizedKey)) return "[REDACTED_RESOURCE]";
|
|
@@ -585,7 +585,7 @@ function sanitizeLogValue(key, value, options = EXTERNAL_SANITIZE) {
|
|
|
585
585
|
return nested;
|
|
586
586
|
}
|
|
587
587
|
if (typeof value === "string") {
|
|
588
|
-
const redacted = redactDiagnosticText(value);
|
|
588
|
+
const redacted = redactDiagnosticText(value, options.redactPaths !== false);
|
|
589
589
|
if (redacted.length > MAX_LOG_STRING_CHARS) {
|
|
590
590
|
return `${redacted.slice(0, MAX_LOG_STRING_CHARS)}...[truncated]`;
|
|
591
591
|
}
|
|
@@ -598,7 +598,7 @@ function redactId(value) {
|
|
|
598
598
|
if (value.length <= 6) return value;
|
|
599
599
|
return `...${value.slice(-6)}`;
|
|
600
600
|
}
|
|
601
|
-
function redactDiagnosticText(text) {
|
|
601
|
+
function redactDiagnosticText(text, redactPaths = true) {
|
|
602
602
|
let out = redactJsonCredentialText(text);
|
|
603
603
|
out = redactResourceText(out);
|
|
604
604
|
out = out.replace(
|
|
@@ -610,12 +610,14 @@ function redactDiagnosticText(text) {
|
|
|
610
610
|
/\b(access_token|tenant_access_token|app_access_token|app_secret|appSecret|secret|token|doc_token|file_token|authorization)=([^&\s"',}]+)/gi,
|
|
611
611
|
"$1=[REDACTED]"
|
|
612
612
|
);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
613
|
+
if (redactPaths) {
|
|
614
|
+
out = out.replace(
|
|
615
|
+
/(^|[\s"'=])((?:\/(?:Users|home|tmp|var|private|Volumes|opt|workspace|workspaces|mnt|app|srv|root|data)\/[^\s"',)]+))/g,
|
|
616
|
+
"$1[REDACTED_PATH]"
|
|
617
|
+
);
|
|
618
|
+
out = out.replace(/(^|[\s"'=])(~\/[^\s"',)]+)/g, "$1[REDACTED_PATH]");
|
|
619
|
+
out = out.replace(/[A-Za-z]:\\[^\s"',)]+/g, "[REDACTED_PATH]");
|
|
620
|
+
}
|
|
619
621
|
return out;
|
|
620
622
|
}
|
|
621
623
|
function redactJsonCredentialText(text) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltpub/xiaojiu-agent-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Bridge Xiaojiu IM with local CLI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.33.0",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dev": "tsup --watch",
|
|
29
29
|
"cli": "node --import tsx --import ./src/cli/register-html.mjs src/cli/index.ts",
|
|
30
30
|
"build:web": "vite build web",
|
|
31
|
-
"build": "pnpm build:web && tsup",
|
|
32
|
-
"typecheck": "tsc --noEmit",
|
|
31
|
+
"build": "pnpm build:web && tsup && pnpm --filter @saltpub/xiaojiu-bridge-telemetry build",
|
|
32
|
+
"typecheck": "tsc --noEmit && pnpm --filter @saltpub/xiaojiu-bridge-telemetry typecheck",
|
|
33
33
|
"test": "vitest run",
|
|
34
34
|
"test:unit": "vitest run tests/unit --passWithNoTests",
|
|
35
35
|
"test:integration": "vitest run tests/integration --passWithNoTests",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"commander": "^12.1.0",
|
|
52
52
|
"cross-spawn": "^7.0.6",
|
|
53
53
|
"graceful-fs": "^4.2.11",
|
|
54
|
-
"proper-lockfile": "^4.1.2"
|
|
54
|
+
"proper-lockfile": "^4.1.2",
|
|
55
|
+
"@saltpub/xiaojiu-bridge-telemetry": "0.0.2"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@changesets/cli": "2.29.2",
|
|
@@ -111,11 +112,9 @@
|
|
|
111
112
|
"schemaVersion": 1,
|
|
112
113
|
"channel": "stable",
|
|
113
114
|
"highlights": [
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"`/config` 新增「思考强度」档位(跟随默认/低/中/高/超高/最大),按 agent 映射到各自机制:Claude 用 `MAX_THINKING_TOKENS` 环境变量(预算 1k/4k/16k/32k/64k),Codex 用 `model_reasoning_effort`,Pi/OMP 用原生 `--thinking` 参数,OpenCode 拼 `--model provider/id#variant`(档位按模型而异,模型不支持时该次运行会报错)。",
|
|
118
|
-
"引用回复和话题上下文里的图片/文件现在会按附件策略下载,并把本地路径注入 prompt 的 `<quoted_messages>` / `<topic_context>` 段,所有 coding agent(Claude、Codex、Pi、OpenCode、OMP)都能读取被引用的图片;Codex 额外把已接受的引用图片合并进原生 `images` 参数。嵌套引用只取一层。"
|
|
115
|
+
"新增默认开启的 OpenObserve 遥测:内置 `@saltpub/xiaojiu-bridge-telemetry` adapter,启动时自动探测内置 endpoint(健康检查可达性确认),事件/指标/错误经 OTLP 上报到 `xiaojiu_agent_bridge` 流;`XIAOJIU_BRIDGE_TELEMETRY_DISABLED=1` 可完全关闭,`XIAOJIU_BRIDGE_TELEMETRY_MODULE` 仍可指定外部 adapter。无 endpoint 可达时保持静默 noop,不影响 bridge 运行。",
|
|
116
|
+
"Make explicit update checks distinguish registry errors from an up-to-date installation, validate package identity and stable-version selection, and use separate passive/explicit timeouts. Refuse mutating updates from npx or source installations and while the configured home contains live processes using the installation; keep all runtime inspection read-only. Preserve manually specified security-fix and migration metadata while deriving highlights from the exact current changelog section.",
|
|
117
|
+
"Updated dependencies [a887d1c]"
|
|
119
118
|
],
|
|
120
119
|
"breakingChanges": [],
|
|
121
120
|
"securityFix": false,
|