siluzan-tso-cli 1.1.30-beta.9 → 1.1.31-beta.1
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 -1
- package/dist/index.js +98 -9
- package/dist/skill/_meta.json +2 -2
- package/dist/skill/scripts/install.ps1 +1 -1
- package/dist/skill/scripts/install.sh +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
|
|
|
51
51
|
siluzan-tso init --force # 强制覆盖已存在文件
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
> **注意**:当前为测试版(1.1.
|
|
54
|
+
> **注意**:当前为测试版(1.1.31-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
|
|
55
55
|
|
|
56
56
|
| 助手 | 建议 `--ai` |
|
|
57
57
|
| ----------------------- | ------------------------------------ |
|
package/dist/index.js
CHANGED
|
@@ -2119,6 +2119,61 @@ function validateBaseUrl(raw) {
|
|
|
2119
2119
|
}
|
|
2120
2120
|
return null;
|
|
2121
2121
|
}
|
|
2122
|
+
function isIdFieldName(key) {
|
|
2123
|
+
if (!key) return false;
|
|
2124
|
+
if (EXACT_ID_FIELD_NAMES.has(key)) return true;
|
|
2125
|
+
if (/Ids$/.test(key)) return true;
|
|
2126
|
+
if (/Id$/.test(key)) return true;
|
|
2127
|
+
return false;
|
|
2128
|
+
}
|
|
2129
|
+
function numberToIdString(n) {
|
|
2130
|
+
if (!Number.isFinite(n)) return String(n);
|
|
2131
|
+
if (Number.isInteger(n)) {
|
|
2132
|
+
return n.toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 0 });
|
|
2133
|
+
}
|
|
2134
|
+
return String(n);
|
|
2135
|
+
}
|
|
2136
|
+
function scalarToIdString(value) {
|
|
2137
|
+
if (typeof value === "string") return value;
|
|
2138
|
+
if (typeof value === "bigint") return value.toString();
|
|
2139
|
+
if (typeof value === "number") return numberToIdString(value);
|
|
2140
|
+
return String(value);
|
|
2141
|
+
}
|
|
2142
|
+
function normalizeIdFieldValue(value) {
|
|
2143
|
+
if (value === null || value === void 0) return value;
|
|
2144
|
+
if (Array.isArray(value)) {
|
|
2145
|
+
return value.map(
|
|
2146
|
+
(item) => typeof item === "number" || typeof item === "bigint" ? scalarToIdString(item) : stringifyIdsDeep(item)
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
if (typeof value === "number" || typeof value === "bigint") {
|
|
2150
|
+
return scalarToIdString(value);
|
|
2151
|
+
}
|
|
2152
|
+
if (typeof value === "string") return value;
|
|
2153
|
+
return stringifyIdsDeep(value);
|
|
2154
|
+
}
|
|
2155
|
+
function stringifyIdsDeep(value) {
|
|
2156
|
+
if (value === null || value === void 0) return value;
|
|
2157
|
+
if (typeof value !== "object") return value;
|
|
2158
|
+
if (Array.isArray(value)) {
|
|
2159
|
+
return value.map((item) => stringifyIdsDeep(item));
|
|
2160
|
+
}
|
|
2161
|
+
const out = {};
|
|
2162
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
2163
|
+
if (raw === void 0) continue;
|
|
2164
|
+
out[key] = isIdFieldName(key) ? normalizeIdFieldValue(raw) : stringifyIdsDeep(raw);
|
|
2165
|
+
}
|
|
2166
|
+
return out;
|
|
2167
|
+
}
|
|
2168
|
+
function jsonParseReviverStringifyIds(key, value) {
|
|
2169
|
+
if (key && isIdFieldName(key) && typeof value === "number" && Number.isFinite(value)) {
|
|
2170
|
+
return numberToIdString(value);
|
|
2171
|
+
}
|
|
2172
|
+
return value;
|
|
2173
|
+
}
|
|
2174
|
+
function parseJsonWithStringIds(text) {
|
|
2175
|
+
return JSON.parse(text, jsonParseReviverStringifyIds);
|
|
2176
|
+
}
|
|
2122
2177
|
function hasSiluzanAgentCredentials() {
|
|
2123
2178
|
const apiKey = process.env.SILUZAN_API_KEY?.trim();
|
|
2124
2179
|
const authToken = process.env.SILUZAN_AUTH_TOKEN?.trim();
|
|
@@ -2348,7 +2403,7 @@ async function apiFetch(url, config, options = {}, verbose = false) {
|
|
|
2348
2403
|
}
|
|
2349
2404
|
if (!text.trim()) return null;
|
|
2350
2405
|
try {
|
|
2351
|
-
return
|
|
2406
|
+
return parseJsonWithStringIds(text);
|
|
2352
2407
|
} catch {
|
|
2353
2408
|
if (verbose) {
|
|
2354
2409
|
console.error(` \u26A0\uFE0F \u54CD\u5E94\u975E JSON\uFF0C\u539F\u59CB\u5185\u5BB9\uFF1A${redactSensitive(text).slice(0, 200)}`);
|
|
@@ -2378,7 +2433,7 @@ async function apiFetchWithHeaders(url, config, options = {}, verbose = false) {
|
|
|
2378
2433
|
data = null;
|
|
2379
2434
|
} else {
|
|
2380
2435
|
try {
|
|
2381
|
-
data =
|
|
2436
|
+
data = parseJsonWithStringIds(text);
|
|
2382
2437
|
} catch {
|
|
2383
2438
|
data = text;
|
|
2384
2439
|
}
|
|
@@ -2809,13 +2864,14 @@ async function writeCliJsonSnapshot(params) {
|
|
|
2809
2864
|
}
|
|
2810
2865
|
const writtenAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2811
2866
|
const absFilePath = path4.join(absDir, fileName);
|
|
2812
|
-
|
|
2867
|
+
const normalizedPayload = stringifyIdsDeep(params.payload);
|
|
2868
|
+
await fs4.writeFile(absFilePath, `${JSON.stringify(normalizedPayload, null, 2)}
|
|
2813
2869
|
`, "utf8");
|
|
2814
2870
|
const outlineFileName = snapshotOutlineFileName(fileName);
|
|
2815
2871
|
if (outlineFileName.toLowerCase() === manifestFile.toLowerCase()) {
|
|
2816
2872
|
throw new Error(`\u975E\u6CD5\u8F93\u51FA\uFF1A${outlineFileName} \u4E0E\u6E05\u5355\u6587\u4EF6\u540D\u51B2\u7A81`);
|
|
2817
2873
|
}
|
|
2818
|
-
const outlineBody = formatOutlineFileBody(fileName,
|
|
2874
|
+
const outlineBody = formatOutlineFileBody(fileName, normalizedPayload);
|
|
2819
2875
|
await fs4.writeFile(path4.join(absDir, outlineFileName), `${outlineBody}
|
|
2820
2876
|
`, "utf8");
|
|
2821
2877
|
const existing = await readCliManifestIfExists(absDir, idSlug || void 0);
|
|
@@ -2831,7 +2887,7 @@ async function writeCliJsonSnapshot(params) {
|
|
|
2831
2887
|
});
|
|
2832
2888
|
await fs4.writeFile(
|
|
2833
2889
|
path4.join(absDir, manifestFile),
|
|
2834
|
-
`${JSON.stringify(merged, null, 2)}
|
|
2890
|
+
`${JSON.stringify(stringifyIdsDeep(merged), null, 2)}
|
|
2835
2891
|
`,
|
|
2836
2892
|
"utf8"
|
|
2837
2893
|
);
|
|
@@ -3599,7 +3655,7 @@ async function issueApiKeyWithPhoneCode(opts) {
|
|
|
3599
3655
|
});
|
|
3600
3656
|
return apiKey;
|
|
3601
3657
|
}
|
|
3602
|
-
var import_semver, SILUZAN_DIR, CONFIG_FILE, inProcessLockChain, ALLOWED_HOSTNAME_SUFFIXES, DEFAULT_TIMEOUT_MS, MAX_RESPONSE_BYTES, httpsAgent, httpAgent, PERF_PREFIX, ASCII_TABLE_CHARS, CLI_SNAPSHOT_MANIFEST_FILE, SCHEMA_VERSION, FALLBACK_FIELD_GUIDE_REFS, _cliPackage, _resolveCliVersion, _fieldGuideRefs, OUTLINE_AGENT_HINT, TS_LIKE_ARRAY_SAMPLE_MAX, MAX_INVOCATION_CHARS, currentInvocation, MAX_COMMIT_CHARS, cliCommitOverride, WRITE_AUDIT_SCHEMA_VERSION, MUTATING, BEIJING_TZ, AUDIT_LOG_FILENAME_RE, DEFAULT_MAX_FILE_MB, MIN_SEGMENT_BYTES, MAX_SEGMENT_BYTES, DEFAULT_RETENTION_DAYS, MIN_RETENTION_DAYS, MAX_RETENTION_DAYS, PRUNE_THROTTLE_MS, lastPruneAtMs, MAX_BODY_CHARS, MAX_ERROR_CHARS, DEFAULT_FIND_AUDIT_MAX_DAYS, MAX_SNAPSHOT_FILE_BYTES, API_KEY_SERVICE_VALUES;
|
|
3658
|
+
var import_semver, SILUZAN_DIR, CONFIG_FILE, inProcessLockChain, ALLOWED_HOSTNAME_SUFFIXES, EXACT_ID_FIELD_NAMES, DEFAULT_TIMEOUT_MS, MAX_RESPONSE_BYTES, httpsAgent, httpAgent, PERF_PREFIX, ASCII_TABLE_CHARS, CLI_SNAPSHOT_MANIFEST_FILE, SCHEMA_VERSION, FALLBACK_FIELD_GUIDE_REFS, _cliPackage, _resolveCliVersion, _fieldGuideRefs, OUTLINE_AGENT_HINT, TS_LIKE_ARRAY_SAMPLE_MAX, MAX_INVOCATION_CHARS, currentInvocation, MAX_COMMIT_CHARS, cliCommitOverride, WRITE_AUDIT_SCHEMA_VERSION, MUTATING, BEIJING_TZ, AUDIT_LOG_FILENAME_RE, DEFAULT_MAX_FILE_MB, MIN_SEGMENT_BYTES, MAX_SEGMENT_BYTES, DEFAULT_RETENTION_DAYS, MIN_RETENTION_DAYS, MAX_RETENTION_DAYS, PRUNE_THROTTLE_MS, lastPruneAtMs, MAX_BODY_CHARS, MAX_ERROR_CHARS, DEFAULT_FIND_AUDIT_MAX_DAYS, MAX_SNAPSHOT_FILE_BYTES, API_KEY_SERVICE_VALUES;
|
|
3603
3659
|
var init_dist = __esm({
|
|
3604
3660
|
"../common/dist/index.js"() {
|
|
3605
3661
|
"use strict";
|
|
@@ -3613,6 +3669,38 @@ var init_dist = __esm({
|
|
|
3613
3669
|
/** Google / TikTok / Facebook 等媒体网关域名(TSO 专用,CSO 不会主动产生但兼容写入) */
|
|
3614
3670
|
"mysiluzan.com"
|
|
3615
3671
|
];
|
|
3672
|
+
EXACT_ID_FIELD_NAMES = /* @__PURE__ */ new Set([
|
|
3673
|
+
"id",
|
|
3674
|
+
"entityId",
|
|
3675
|
+
"mediaCustomerId",
|
|
3676
|
+
"mediaAccountId",
|
|
3677
|
+
"mediaAccountGroupId",
|
|
3678
|
+
"loginCustomerId",
|
|
3679
|
+
"customerId",
|
|
3680
|
+
"accountId",
|
|
3681
|
+
"ownerAdvertiserId",
|
|
3682
|
+
"advertiserId",
|
|
3683
|
+
"agencyClientId",
|
|
3684
|
+
"externalMediaAccountTokenId",
|
|
3685
|
+
"shortId",
|
|
3686
|
+
"websiteDiagnoseId",
|
|
3687
|
+
"invitationId",
|
|
3688
|
+
"ruleId",
|
|
3689
|
+
"bcId",
|
|
3690
|
+
"bmId",
|
|
3691
|
+
"tradeNo",
|
|
3692
|
+
"billNo",
|
|
3693
|
+
"payNo",
|
|
3694
|
+
"checkingNo",
|
|
3695
|
+
"rechargeNo",
|
|
3696
|
+
"orderNo",
|
|
3697
|
+
"magKey",
|
|
3698
|
+
"managedByStewardId",
|
|
3699
|
+
"relyCustomerId",
|
|
3700
|
+
"createdBy",
|
|
3701
|
+
"lastChangedBy",
|
|
3702
|
+
"userId"
|
|
3703
|
+
]);
|
|
3616
3704
|
DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
3617
3705
|
MAX_RESPONSE_BYTES = 50 * 1024 * 1024;
|
|
3618
3706
|
httpsAgent = new https.Agent({
|
|
@@ -5231,12 +5319,13 @@ async function writeGoogleAnalysisSnapshot(params) {
|
|
|
5231
5319
|
params.section,
|
|
5232
5320
|
params.payload
|
|
5233
5321
|
);
|
|
5234
|
-
const
|
|
5322
|
+
const normalizedWrapped = stringifyIdsDeep(wrapped);
|
|
5323
|
+
const body = JSON.stringify(normalizedWrapped, null, 2);
|
|
5235
5324
|
await fs7.writeFile(path11.join(absDir, fileName), `${body}
|
|
5236
5325
|
`, "utf8");
|
|
5237
5326
|
const outlineFileName = snapshotOutlineFileName(fileName);
|
|
5238
5327
|
const outlineExtra = buildOutlineHints(params.section);
|
|
5239
|
-
const outlineBody = formatOutlineFileBody(fileName,
|
|
5328
|
+
const outlineBody = formatOutlineFileBody(fileName, normalizedWrapped, outlineExtra);
|
|
5240
5329
|
await fs7.writeFile(path11.join(absDir, outlineFileName), `${outlineBody}
|
|
5241
5330
|
`, "utf8");
|
|
5242
5331
|
const existing = await readManifestIfExists(absDir, accountSlug || void 0);
|
|
@@ -5255,7 +5344,7 @@ async function writeGoogleAnalysisSnapshot(params) {
|
|
|
5255
5344
|
const manifestFile = googleAnalysisManifestFile(accountSlug || void 0);
|
|
5256
5345
|
await fs7.writeFile(
|
|
5257
5346
|
path11.join(absDir, manifestFile),
|
|
5258
|
-
`${JSON.stringify(merged, null, 2)}
|
|
5347
|
+
`${JSON.stringify(stringifyIdsDeep(merged), null, 2)}
|
|
5259
5348
|
`,
|
|
5260
5349
|
"utf8"
|
|
5261
5350
|
);
|
package/dist/skill/_meta.json
CHANGED
|
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
|
|
|
9
9
|
# -- Package info (injected at build time) ------------------------------------
|
|
10
10
|
$PKG_NAME = 'siluzan-tso-cli'
|
|
11
11
|
# PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
|
|
12
|
-
$PKG_VERSION = '1.1.
|
|
12
|
+
$PKG_VERSION = '1.1.31-beta.1'
|
|
13
13
|
$CLI_BIN = 'siluzan-tso'
|
|
14
14
|
$SKILL_LABEL = 'Siluzan TSO'
|
|
15
15
|
$INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
|
|
@@ -9,7 +9,7 @@ set -euo pipefail
|
|
|
9
9
|
# -- Package info (injected at build time) ------------------------------------
|
|
10
10
|
readonly PKG_NAME="siluzan-tso-cli"
|
|
11
11
|
# PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
|
|
12
|
-
readonly PKG_VERSION="1.1.
|
|
12
|
+
readonly PKG_VERSION="1.1.31-beta.1"
|
|
13
13
|
readonly CLI_BIN="siluzan-tso"
|
|
14
14
|
readonly SKILL_LABEL="Siluzan TSO"
|
|
15
15
|
readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
|