@vibeapi/cli 0.0.166 → 0.0.167
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/brand.json
CHANGED
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
"apiKeyEnv": "VIBEAPI_API_KEY",
|
|
10
10
|
"desktopEntryName": "VibeAPI",
|
|
11
11
|
"packageName": "@vibeapi/api-helper",
|
|
12
|
+
"gatewayProtocol": {
|
|
13
|
+
"clientConfigPath": "/api/platform/vibecode/config",
|
|
14
|
+
"keyInfoPath": "/api/platform/vibecode/key",
|
|
15
|
+
"telemetryPath": "/api/platform/vibecode/telemetry",
|
|
16
|
+
"reportPath": "/api/platform/vibecode/report",
|
|
17
|
+
"clientSection": "vibecli",
|
|
18
|
+
"minClientVersion": "min_vibecli_version",
|
|
19
|
+
"installIdHeader": "X-VibeCLI-Install-Id"
|
|
20
|
+
},
|
|
12
21
|
"gatewayAddresses": [
|
|
13
22
|
{
|
|
14
23
|
"url": "https://www.vibeapi.cn",
|
package/dist/lib/brand.d.ts
CHANGED
|
@@ -12,6 +12,16 @@ export interface BrandPluginMarketplace {
|
|
|
12
12
|
add: string;
|
|
13
13
|
probe: string;
|
|
14
14
|
}
|
|
15
|
+
/** Names on the gateway's API; see src/lib/gateway-protocol.ts. */
|
|
16
|
+
export interface GatewayProtocol {
|
|
17
|
+
clientConfigPath: string;
|
|
18
|
+
keyInfoPath: string;
|
|
19
|
+
telemetryPath: string;
|
|
20
|
+
reportPath: string;
|
|
21
|
+
clientSection: string;
|
|
22
|
+
minClientVersion: string;
|
|
23
|
+
installIdHeader: string;
|
|
24
|
+
}
|
|
15
25
|
export interface Brand {
|
|
16
26
|
id: string;
|
|
17
27
|
/** Provider name shown to users and written into tool configs, e.g. `name = "VibeAPI"` in Codex. */
|
|
@@ -34,6 +44,8 @@ export interface Brand {
|
|
|
34
44
|
desktopEntryName: string;
|
|
35
45
|
/** npm package name used by the update check when package.json is unreadable. */
|
|
36
46
|
packageName: string;
|
|
47
|
+
/** Only the default brand sets this: the names its gateway serves. Everyone else uses the neutral set. */
|
|
48
|
+
gatewayProtocol?: Partial<GatewayProtocol>;
|
|
37
49
|
/** Built-in gateway addresses; the order is the priority (first = main site). */
|
|
38
50
|
gatewayAddresses: BrandGatewayAddress[];
|
|
39
51
|
links: {
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import { type GatewayProtocol } from './brand.js';
|
|
1
2
|
/**
|
|
2
|
-
* Names
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Names on the gateway's API. They come from the brand: a white-label build uses the neutral set below
|
|
4
|
+
* (same values as `NEUTRAL_GATEWAY_PROTOCOL` in scripts/brands.mjs) and the default brand's file keeps the
|
|
5
|
+
* names its old gateway serves. No brand's names may be written in `src/`; the package leak check has no exemptions.
|
|
5
6
|
*/
|
|
7
|
+
export declare const NEUTRAL_GATEWAY_PROTOCOL: GatewayProtocol;
|
|
6
8
|
/** Client configuration for the coding tools (models, defaults, rollout). */
|
|
7
|
-
export declare const CLIENT_CONFIG_PATH
|
|
9
|
+
export declare const CLIENT_CONFIG_PATH: string;
|
|
8
10
|
/** Per-key group and group-model table. */
|
|
9
|
-
export declare const KEY_INFO_PATH
|
|
11
|
+
export declare const KEY_INFO_PATH: string;
|
|
12
|
+
/** Step events. */
|
|
13
|
+
export declare const TELEMETRY_PATH: string;
|
|
14
|
+
/** Diagnostic reports. */
|
|
15
|
+
export declare const REPORT_PATH: string;
|
|
10
16
|
/** Section of the client configuration that belongs to this CLI. */
|
|
11
|
-
export declare const CLIENT_SECTION
|
|
17
|
+
export declare const CLIENT_SECTION: string;
|
|
12
18
|
/** Model-row field: lowest CLI version that may see the row. */
|
|
13
|
-
export declare const MIN_CLIENT_VERSION
|
|
19
|
+
export declare const MIN_CLIENT_VERSION: string;
|
|
14
20
|
/** Request header carrying the install id, so support can match a machine's events and reports. */
|
|
15
|
-
export declare const INSTALL_ID_HEADER
|
|
21
|
+
export declare const INSTALL_ID_HEADER: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
import{brand as t}from"./brand.js";export const NEUTRAL_GATEWAY_PROTOCOL={clientConfigPath:"/api/platform/cli/config",keyInfoPath:"/api/platform/cli/key",telemetryPath:"/api/platform/cli/telemetry",reportPath:"/api/platform/cli/report",clientSection:"cli_client",minClientVersion:"min_cli_version",installIdHeader:"X-CLI-Install-Id"};const e={...NEUTRAL_GATEWAY_PROTOCOL,...t().gatewayProtocol};export const CLIENT_CONFIG_PATH=e.clientConfigPath;export const KEY_INFO_PATH=e.keyInfoPath;export const TELEMETRY_PATH=e.telemetryPath;export const REPORT_PATH=e.reportPath;export const CLIENT_SECTION=e.clientSection;export const MIN_CLIENT_VERSION=e.minClientVersion;export const INSTALL_ID_HEADER=e.installIdHeader;
|
package/dist/lib/telemetry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as e}from"crypto";import{arch as t,homedir as r,release as
|
|
1
|
+
import{randomUUID as e}from"crypto";import{arch as t,homedir as r,release as n}from"os";import{brand as o,brandEnv as s,CLI_NAME as a}from"./brand.js";import{clientVersion as i,installId as c}from"./client-config.js";import{configManager as l}from"./config.js";import{gatewayAddresses as u}from"./gateway-addresses.js";import{INSTALL_ID_HEADER as d,REPORT_PATH as f,TELEMETRY_PATH as p}from"./gateway-protocol.js";const m=e();let g="wizard",h=[];const w=new Set;let y=null,T=_;export function telemetryEnabled(){if(process.env.VITEST&&!S)return!1;const e=s("TELEMETRY")?.trim().toLowerCase();return!("0"===e||"false"===e||"off"===e)}let S=!1;export function setTelemetrySenderForTests(e){T=e??_,S=null!==e,h=[]}export function clientHeaders(){const e=`${a}/${i()} (${process.platform} ${n()}; ${t()}) node/${process.versions.node}`;return telemetryEnabled()?{"User-Agent":e,[d]:c()}:{"User-Agent":e}}export function installClientHeaders(){const e=globalThis.fetch;if(!e||e.gatewayHeaders)return;const t=(t,r)=>{try{const n=new URL("string"==typeof t||t instanceof URL?t.toString():t.url);if(new Set([l.getBaseUrl(),...u().map(e=>e.url)].map(e=>new URL(e).host)).has(n.host)){const n=new Headers(r?.headers??(t instanceof Request?t.headers:void 0));for(const[e,t]of Object.entries(clientHeaders()))n.has(e)||n.set(e,t);return e(t,{...r,headers:n})}}catch{}return e(t,r)};t.gatewayHeaders=!0,globalThis.fetch=t}export function telemetryPending(){return w.size>0}function $(){return{install_id:c(),cli_version:i(),brand:o().id,os:process.platform,os_release:n(),arch:t(),node_version:process.versions.node}}export function maskHome(e){const t=r();if(!t||t.length<2)return e;const n=new Set([t,t.replace(/\\/g,"/")]);let o=e;for(const e of n)o=o.split(e).join("~");return o}export function maskSecrets(e){return maskHome(e).replace(/(sk-[A-Za-z0-9_-]{2})[A-Za-z0-9_-]{8,}([A-Za-z0-9_-]{4})\b/g,"$1…$2").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi,"$1…").replace(/(\b[a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+(?::[^\s/@]*)?@/gi,"$1…@").replace(/\b((?:api[_-]?key|token|password|passwd|secret|auth)\s*[=:]\s*)("?)[^\s"&;,]{6,}\2/gi,"$1$2…$2")}export function setTelemetryCommand(e){g=e}export function track(e,t,r={}){if(!telemetryEnabled())return;const n=void 0===r.error?void 0:maskSecrets(r.error instanceof Error?r.error.message:String(r.error)).slice(0,2e3);h.push({ts:Date.now(),session:m,command:g,step:e,status:t,...void 0!==r.duration_ms?{duration_ms:Math.round(r.duration_ms)}:{},...n?{error:n}:{},...r.detail?{detail:r.detail}:{}}),"start"===t?k():y||(y=setTimeout(k,500),y.unref())}export async function trackStep(e,t,r){const n=Date.now();track(e,"start",r?{detail:r}:{});try{const r=await t();return track(e,"ok",{duration_ms:Date.now()-n}),r}catch(t){throw track(e,"fail",{duration_ms:Date.now()-n,error:t}),t}}function k(){if(y&&(clearTimeout(y),y=null),0===h.length)return;const e=h.splice(0,50),t=T(p,{...$(),events:e},3e3).then(()=>{},()=>{}).finally(()=>w.delete(t));w.add(t),h.length>0&&k()}export async function flushTelemetry(e=1500){k(),0!==w.size&&await Promise.race([Promise.allSettled([...w]),new Promise(t=>setTimeout(t,e).unref())])}export async function uploadReport(e){try{const t=await T(f,{...$(),report:e},2e4),r=t?.data?.code;return"string"==typeof r&&r?r:null}catch{return null}}async function _(e,t,r){const n=l.getApiKey()?.trim(),o=await fetch(new URL(e,l.getBaseUrl()).toString(),{method:"POST",headers:{"Content-Type":"application/json",...clientHeaders(),...n?{Authorization:`Bearer ${n}`}:{}},body:JSON.stringify(t),signal:AbortSignal.timeout(r)});if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json().catch(()=>null)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.167",
|
|
4
4
|
"description": "CLI tool for managing AI coding assistants (Claude Code, Codex, OpenClaw, Hermes, AtomCode, Grok Build) with one unified config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|