diff --git a/src/qoder/runtime/custom-spawn.ts b/src/qoder/runtime/custom-spawn.ts index 0d26ccc..74f053a 100644 --- a/src/qoder/runtime/custom-spawn.ts +++ b/src/qoder/runtime/custom-spawn.ts @@ -15,6 +15,15 @@ import { */ const CUSTOM_PROVIDER_CLI_ENV = { QODER_SDK_CUSTOM_BASE_URL_BYOK: '1' } as const; +/** + * Identifies this host integration to the CLI, which reports it as the + * `integration_id` telemetry attribute. Only a UUIDv4 is accepted; any other + * value is silently dropped. + */ +const INTEGRATION_CLI_ENV = { + QODER_INTEGRATION_ID: '70457212-a449-4ae3-af1e-5fb9e00fafcf', +} as const; + /** * Spawn qodercli in Obsidian's Electron process. * @@ -43,7 +52,7 @@ export function createCustomSpawnFunction( const resolvedSpawnSpec = resolveWindowsCmdShimSpawnSpec({ args, command }); const child = spawn(resolvedSpawnSpec.command, resolvedSpawnSpec.args, { cwd, - env: env ? { ...env, ...CUSTOM_PROVIDER_CLI_ENV } : env, + env: env ? { ...env, ...CUSTOM_PROVIDER_CLI_ENV, ...INTEGRATION_CLI_ENV } : env, // stderr is always piped so host code (e.g. the runtime probe) can read // CLI diagnostics such as "No qodercli login found". A drain listener is // attached below to avoid pipe backpressure when nobody else listens. diff --git a/tests/unit/qoder/runtime/custom-spawn.test.ts b/tests/unit/qoder/runtime/custom-spawn.test.ts index 318f0e7..f743b1c 100644 --- a/tests/unit/qoder/runtime/custom-spawn.test.ts +++ b/tests/unit/qoder/runtime/custom-spawn.test.ts @@ -125,6 +125,7 @@ describe('createCustomSpawnFunction', () => { expect(spawnOptions.env).toEqual({ PATH: '/usr/bin', QODER_SDK_CUSTOM_BASE_URL_BYOK: '1', + QODER_INTEGRATION_ID: '70457212-a449-4ae3-af1e-5fb9e00fafcf', }); });