mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
Fix telemetry and abortable transport checks
This commit is contained in:
@@ -180,8 +180,7 @@ export function track<N extends EventName>(name: N, props: EventProps<N>): boole
|
||||
|
||||
// Read persisted consent live to respect current preferences/env precedence.
|
||||
const settings = storeRef.getSettings()
|
||||
const consent = resolveConsent(settings)
|
||||
if (consent.effective !== 'enabled') {
|
||||
if (resolveConsent(settings).effective !== 'enabled') {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -215,8 +214,9 @@ export function track<N extends EventName>(name: N, props: EventProps<N>): boole
|
||||
? { sample_rate: sampleRate }
|
||||
: {}
|
||||
|
||||
const switchCohort = settings.telemetry?.chatUiSwitchNoteCohort
|
||||
enqueueCapture(name, {
|
||||
chat_ui_switch_note_v1: settings.telemetry?.chatUiSwitchNoteCohort,
|
||||
...(switchCohort && { chat_ui_switch_note_v1: switchCohort }),
|
||||
...result.props,
|
||||
...mainOwnedProps
|
||||
})
|
||||
|
||||
+10
-1
@@ -87,7 +87,16 @@ beforeEach(() => {
|
||||
}))
|
||||
Object.defineProperty(window, 'api', {
|
||||
configurable: true,
|
||||
value: { runtime: { call: saves }, fs: { importExternalPaths: imports } }
|
||||
value: {
|
||||
runtime: {
|
||||
call: saves,
|
||||
subscribe: async (args: unknown, onResponse: (response: unknown) => void) => {
|
||||
void saves(args).then(onResponse)
|
||||
return { unsubscribe: () => {} }
|
||||
}
|
||||
},
|
||||
fs: { importExternalPaths: imports }
|
||||
}
|
||||
})
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
|
||||
@@ -335,7 +335,18 @@ beforeEach(async () => {
|
||||
runtime: {
|
||||
call: ({ method, params }: { method: string; params: unknown }) =>
|
||||
mocks.transport(method, params),
|
||||
subscribe: (_args: unknown, onResponse: (response: unknown) => void) => {
|
||||
subscribe: async (
|
||||
args: { method: string; params: unknown },
|
||||
onResponse: (response: unknown) => void
|
||||
) => {
|
||||
if (['status.get', 'terminal.list', 'terminal.viewClaudeAgent'].includes(args.method)) {
|
||||
void mocks
|
||||
.transport(args.method, args.params)
|
||||
.then(onResponse, (error: Error) =>
|
||||
onResponse({ ok: false, error: { code: 'INTERNAL', message: error.message } })
|
||||
)
|
||||
return { unsubscribe: () => {} }
|
||||
}
|
||||
listeners++
|
||||
const stop = bridge.subscribe((snapshot) => onResponse({ ok: true, result: snapshot }))
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user