Split monolithic kernel_commands.rs (2185 lines) and pipeline_commands.rs (1391 lines) into focused sub-modules under kernel_commands/ and pipeline_commands/ directories. Add gateway module (commands, config, io, runtime), health_check, and 15 new TypeScript client libraries for SaaS relay, auth, admin, telemetry, and kernel sub-systems (a2a, agent, chat, hands, skills, triggers). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
/**
|
|
* SaaS Telemetry Methods — Mixin
|
|
*
|
|
* Installs telemetry reporting methods onto SaaSClient.prototype.
|
|
* Uses the same mixin pattern as gateway-api.ts.
|
|
*/
|
|
|
|
export function installTelemetryMethods(ClientClass: { prototype: any }): void {
|
|
const proto = ClientClass.prototype;
|
|
|
|
/** Report anonymous usage telemetry (token counts only, no content) */
|
|
proto.reportTelemetry = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, data: {
|
|
device_id: string;
|
|
app_version: string;
|
|
entries: Array<{
|
|
model_id: string;
|
|
input_tokens: number;
|
|
output_tokens: number;
|
|
latency_ms?: number;
|
|
success: boolean;
|
|
error_type?: string;
|
|
timestamp: string;
|
|
connection_mode: string;
|
|
}>;
|
|
}): Promise<{ accepted: number; rejected: number }> {
|
|
return this.request<{ accepted: number; rejected: number }>(
|
|
'POST', '/api/v1/telemetry/report', data,
|
|
);
|
|
};
|
|
|
|
/** Report audit log summary (action types and counts only, no content) */
|
|
proto.reportAuditSummary = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, data: {
|
|
device_id: string;
|
|
entries: Array<{
|
|
action: string;
|
|
target: string;
|
|
result: string;
|
|
timestamp: string;
|
|
}>;
|
|
}): Promise<{ accepted: number; total: number }> {
|
|
return this.request<{ accepted: number; total: number }>(
|
|
'POST', '/api/v1/telemetry/audit', data,
|
|
);
|
|
};
|
|
}
|