GeezerVison is showing github.com — Merge pull request #337 from modelstudioai/feat/rename-call-source · modelstudioai/cli@58789db
File treeExpand file treeCollapse file tree Open diff view settings bailian-finetune/reference bailian-knowledge/reference bailian-managed-agent/reference bailian-sandbox/reference
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and | 10 | 10 |
| 11 | 11 | ### Added | 12 | 12 |
| 13 | | -- **Global `--biz-source` flag**: All commands accept `--biz-source <source>` so callers (skills/agents/products) can declare their business source. The normalized label is reported to AEM as a dedicated flat column `c6` (plus `ext`), enabling per-source PV/UV analysis of command usage (e.g. `flow-agent`). Absent → omitted; blank/invalid → `unknown`. | | 13 | +- **Global `--biz-from` flag**: All commands accept `--biz-from <source>` so callers (skills/agents/products) can declare their business source, enabling per-source usage analysis (PV/UV) of command calls (e.g. `flow-agent`). | 14 | 14 |
| 15 | 15 | ## [2.10.5] - 2026-11-23 | 16 | 16 |
| |
Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.zh.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 |
| 11 | 11 | ### 新增 | 12 | 12 |
| 13 | | -- **全局 `--biz-source` 参数**:所有命令支持 `--biz-source <source>`,调用方(skill/agent/产品)可声明业务来源。归一化后的来源上报到 AEM 专用扁平列 `c6`(及 `ext`),支持按来源统计命令调用(如 `flow-agent`)的 PV/UV。缺省省略;空白/非法 → `unknown`。 | | 13 | +- **全局 `--biz-from` 参数**:所有命令支持 `--biz-from <source>`,调用方(skill/agent/产品)可声明业务来源,便于按来源统计命令调用(如 `flow-agent`)的 PV/UV。 | 14 | 14 |
| 15 | 15 | ## [2.10.5] - 2026-11-23 | 16 | 16 |
| |
Collapse file Copy file name to clipboardExpand all lines: docs/agents/telemetry-change.md +3-3Lines changed: 3 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -99,11 +99,11 @@ source-config 只用于百炼 / DashScope API 侧消费,不发送到通用网 | 99 | 99 | - `authMethod` | 100 | 100 | - `callerType`(必填:`agent` | `script` | `unknown`) | 101 | 101 | - `callerName`:`agent` 与 `script` 时发送(缺省/非法 → `"unknown"`);`skillName` / `skillVersion` 仅 `agent` 时可选发送 | 102 | | -- `bizSource`:全局 `--biz-source` 声明的业务来源(可选);经 `normalizeBizSource` 归一化(缺省省略,空白/非法 → `"unknown"`),与 `callerName` 独立;映射到 AEM `c6` 专用扁平列 | | 102 | +- `bizFrom`:全局 `--biz-from` 声明的业务来源(可选);经 `normalizeBizFrom` 归一化(缺省省略,空白/非法 → `"unknown"`),与 `callerName` 独立;映射到 AEM `c6` 专用扁平列 | 103 | 103 | - 失败时的 `errorMessage`、`exitCode`、`httpStatus`、`requestId` | 104 | 104 | - 安全 allowlist 过滤后的 `params` | 105 | 105 |
| 106 | | -`bizSource` 是调用方(skill/agent/产品)通过全局 `--biz-source` 主动声明的来源标签,用于按来源区分命令调用的 PV/UV。它走 `GLOBAL_FLAGS` → `buildSettings` → `settings.bizSource` → `trackCommandExecution` 读取,不经命令自有 flag,也不进 `PARAM_ALLOWLIST`(c1)。归一化复用 caller 的 `NAME_PATTERN`(小写、空格/下划线转连字符, bounded charset)防 PII。AEM 侧除随 `ext` 上报外,另映射到专用扁平列 `c6`(标量字符串),无需 JSON 解析维度配置即可直接按 `c6` 筛选/分组:PV=事件计数,UV=distinct `uid`;按命令路径(如 `flow-agent *`)过滤即得某命令组的来源 PV/UV。`bizSource` 与 `callerType`/`callerName`(宿主归因)是独立维度,不得混用。 | | 106 | +`bizFrom` 是调用方(skill/agent/产品)通过全局 `--biz-from` 主动声明的来源标签,用于按来源区分命令调用的 PV/UV。它走 `GLOBAL_FLAGS` → `buildSettings` → `settings.bizFrom` → `trackCommandExecution` 读取,不经命令自有 flag,也不进 `PARAM_ALLOWLIST`(c1)。归一化复用 caller 的 `NAME_PATTERN`(小写、空格/下划线转连字符, bounded charset)防 PII。AEM 侧除随 `ext` 上报外,另映射到专用扁平列 `c6`(标量字符串),无需 JSON 解析维度配置即可直接按 `c6` 筛选/分组:PV=事件计数,UV=distinct `uid`;按命令路径(如 `flow-agent *`)过滤即得某命令组的来源 PV/UV。`bizFrom` 与 `callerType`/`callerName`(宿主归因)是独立维度,不得混用。 | 107 | 107 |
| 108 | 108 | 调用方归因只认本次进程的 `BAILIAN_CALLER_*`(由 `readCaller` 归一化后写入事件): | 109 | 109 |
| @@ -158,7 +158,7 @@ AEM 映射: | 158 | 158 | | `c3` | HTTP status | | 159 | 159 | | `c4` | 错误文案,最多 500 字符 | | 160 | 160 | | `c5` | request ID | | 161 | | -| `c6` | `bizSource` 业务来源(全局 `--biz-source`,归一化标量;专用扁平列,直接筛选/分组) | | | 161 | +| `c6` | `bizFrom` 业务来源(全局 `--biz-from`,归一化标量;专用扁平列,直接筛选/分组) | | 162 | 162 |
| 163 | 163 | 远端发送是 best-effort,不得阻塞命令或改变退出码。正常退出最多等待 1 秒,SIGINT 最多等待 500 ms。 | 164 | 164 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/cli/tests/e2e/registry.smoke.e2e.test.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -70,7 +70,7 @@ describe("e2e: bl registry smoke", () => { | 70 | 70 | expect(stderr).toMatch(/--console-region/); | 71 | 71 | expect(stderr).toMatch(/--console-site/); | 72 | 72 | expect(stderr).toMatch(/--console-switch-agent/); | 73 | | - expect(stderr).toMatch(/--biz-source/); | | 73 | + expect(stderr).toMatch(/--biz-from/); | 74 | 74 | expect(stderr).not.toMatch(/^\s*--region\s/m); | 75 | 75 | }); | 76 | 76 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/config/loader.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -338,6 +338,6 @@ export function buildSettings(s: ResolutionSources): Settings { | 338 | 338 | consoleSwitchAgent: flags.consoleSwitchAgent || file.console_switch_agent || undefined, | 339 | 339 | dryRun: flags.dryRun || false, | 340 | 340 | telemetry: env.DO_NOT_TRACK === "1" ? false : (file.telemetry ?? true), | 341 | | - bizSource: flags.bizSource ?? undefined, | | 341 | + bizFrom: flags.bizFrom ?? undefined, | 342 | 342 | }; | 343 | 343 | } |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/config/schema.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -253,6 +253,6 @@ export interface Settings { | 253 | 253 | quiet: boolean; | 254 | 254 | dryRun: boolean; | 255 | 255 | telemetry: boolean; | 256 | | - /** Per-invocation business source label (--biz-source) for usage analytics; not persisted. */ | 257 | | - bizSource?: string; | | 256 | + /** Per-invocation business source label (--biz-from) for usage analytics; not persisted. */ | | 257 | + bizFrom?: string; | 258 | 258 | } |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/telemetry/caller.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,12 +34,12 @@ function normalizeCallerName(raw: string | undefined): string { | 34 | 34 | } | 35 | 35 |
| 36 | 36 | /** | 37 | | - * Normalize a caller-declared business source label (--biz-source) to a stable id. | | 37 | + * Normalize a caller-declared business source label (--biz-from) to a stable id. | 38 | 38 | * Absent (undefined) stays undefined so the event omits the field; a present but | 39 | 39 | * blank/invalid label falls back to `unknown`, mirroring callerName. Reuses the | 40 | 40 | * caller name pattern to keep the value space bounded and free of PII. | 41 | 41 | */ | 42 | | -export function normalizeBizSource(raw: string | undefined): string | undefined { | | 42 | +export function normalizeBizFrom(raw: string | undefined): string | undefined { | 43 | 43 | return raw === undefined ? undefined : normalizeCallerName(raw); | 44 | 44 | } | 45 | 45 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/telemetry/event.ts +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,8 +23,8 @@ export interface TrackingEvent { | 23 | 23 | callerName?: string; | 24 | 24 | skillName?: string; | 25 | 25 | skillVersion?: string; | 26 | | - /** Caller-declared business source (--biz-source), normalized; reported as AEM c6. */ | 27 | | - bizSource?: string; | | 26 | + /** Caller-declared call source (--biz-from), normalized; reported as AEM c6. */ | | 27 | + bizFrom?: string; | 28 | 28 | } | 29 | 29 |
| 30 | 30 | export function createTrackingEvent(opts: { | @@ -36,7 +36,7 @@ export function createTrackingEvent(opts: { | 36 | 36 | authMethod?: AuthRequirement; | 37 | 37 | params?: Record<string, unknown>; | 38 | 38 | caller: CallerAttribution; | 39 | | - bizSource?: string; | | 39 | + bizFrom?: string; | 40 | 40 | }): TrackingEvent { | 41 | 41 | const event: TrackingEvent = { | 42 | 42 | command: opts.command, | @@ -58,8 +58,8 @@ export function createTrackingEvent(opts: { | 58 | 58 | event.callerName = opts.caller.callerName; | 59 | 59 | } | 60 | 60 |
| 61 | | - if (opts.bizSource !== undefined) { | 62 | | - event.bizSource = opts.bizSource; | | 61 | + if (opts.bizFrom !== undefined) { | | 62 | + event.bizFrom = opts.bizFrom; | 63 | 63 | } | 64 | 64 |
| 65 | 65 | if (opts.authMethod) { | @@ -108,8 +108,8 @@ export function buildRemoteAemOptions(event: TrackingEvent): Record<string, unkn | 108 | 108 | opts.c5 = event.requestId; | 109 | 109 | } | 110 | 110 | // Dedicated flat dimension column for the business source (easy AEM filtering). | 111 | | - if (event.bizSource !== undefined) { | 112 | | - opts.c6 = event.bizSource; | | 111 | + if (event.bizFrom !== undefined) { | | 112 | + opts.c6 = event.bizFrom; | 113 | 113 | } | 114 | 114 |
| 115 | 115 | return opts; | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/telemetry/tracker.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import type { Identity, Settings } from "../config/schema.ts"; | 2 | 2 | import { BailianError } from "../errors/base.ts"; | 3 | 3 | import type { AuthRequirement } from "../types/command.ts"; | 4 | | -import { normalizeBizSource, type CallerAttribution } from "./caller.ts"; | | 4 | +import { normalizeBizFrom, type CallerAttribution } from "./caller.ts"; | 5 | 5 | import { createTrackingEvent } from "./event.ts"; | 6 | 6 | import { localSink, remoteSink } from "./sink.ts"; | 7 | 7 |
| @@ -137,7 +137,7 @@ export async function trackCommandExecution( | 137 | 137 | authMethod: deps.authMethod, | 138 | 138 | params: extractParams(flags), | 139 | 139 | caller: deps.caller, | 140 | | - bizSource: normalizeBizSource(deps.settings.bizSource), | | 140 | + bizFrom: normalizeBizFrom(deps.settings.bizFrom), | 141 | 141 | }); | 142 | 142 |
| 143 | 143 | // Fire-and-forget — never block the CLI exit or mask errors | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/types/command.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,7 +114,7 @@ export const GLOBAL_FLAGS = { | 114 | 114 | }, | 115 | 115 | // Caller-declared source for usage attribution. Skills/agents should pass their | 116 | 116 | // own name when invoking commands so PV/UV can be segmented by calling skill/product. | 117 | | - bizSource: { | | 117 | + bizFrom: { | 118 | 118 | type: "string", | 119 | 119 | valueHint: "<source>", | 120 | 120 | description: { | |
|