Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/qoder/runtime/custom-spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/unit/qoder/runtime/custom-spawn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
});

Expand Down
Loading