MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / openStream

Function openStream

services/cloud-agent-next/test/e2e/client.ts:430–528  ·  view source on GitHub ↗
(
  config: DriverConfig,
  cloudAgentSessionId: string,
  options: StreamOptions = {}
)

Source from the content-addressed store, hash-verified

428 {
429 sourceKiloSessionId: input.sourceKiloSessionId,
430 sourceCloudAgentSessionId: input.sourceCloudAgentSessionId,
431 operationKey: input.operationKey ?? randomUUID(),
432 clientProvenance: 'browser',
433 ...(config.kilocodeOrganizationId
434 ? { kilocodeOrganizationId: config.kilocodeOrganizationId }
435 : {}),
436 },
437 { internalApiSecret: config.internalApiSecret, signal }
438 );
439 // Success only, matching the legacy/unified start pattern.
440 config.onSessionCreated?.(created.cloudAgentSessionId, created.kiloSessionId);
441 return created;
442}
443
444/**
445 * Set or clear the callback target of an existing session through the internal
446 * `updateSession` endpoint.
447 *
448 * The public grouped `start` schema rejects `callbackTarget`, so the new plane's
449 * callback harness registers the sink after `start` through the same endpoint
450 * `services/code-review-infra` uses on session continuations. Internal-API
451 * authenticated.
452 */
453export async function updateSessionCallbackTarget(
454 config: DriverConfig,
455 cloudAgentSessionId: string,
456 callbackTarget: CallbackTarget | null,
457 signal?: AbortSignal
458): Promise<{ success: boolean }> {
459 return trpcCall<{ success: boolean }>(
460 config,
461 'updateSession',
462 { cloudAgentSessionId, callbackTarget },
463 { internalApiSecret: config.internalApiSecret, ...(signal ? { signal } : {}) }
464 );
465}
466
467export type SessionSnapshot = {
468 sessionId: string;
469 kiloSessionId?: string;
470 userId: string;
471 orgId?: string;
472 sandboxId?: string;
473 githubRepo?: string;
474 gitUrl?: string;
475 platform?: string;
476 upstreamBranch?: string;
477 autoCommit?: boolean;
478 worktreeId?: string | null;
479 parentSessionId?: string | null;
480 cloudAgentSessionScopeId?: string | null;
481 cloudAgentWorktreeId?: string;
482 initialMessageId?: string;
483 latestEventId?: number | null;
484 execution: { id: string; status: string } | null;
485};
486
487export async function getSessionSnapshot(

Callers 15

lifecycleColdFunction · 0.85
lifecycleHotFunction · 0.85
lifecycleColdHotFunction · 0.85
lifecycleExternalKillFunction · 0.85
lifecycleKillMidFlightFunction · 0.85
lifecycleQueueWhileBusyFunction · 0.85
lifecycleQueueOverflowFunction · 0.85
lifecycleLlmErrorFunction · 0.85
lifecycleEmptyResponseFunction · 0.85

Calls 9

mintStreamTicketFunction · 0.85
pushMethod · 0.80
hasMethod · 0.80
waitForFunction · 0.70
replaceMethod · 0.65
setMethod · 0.65
toStringMethod · 0.65
errorMethod · 0.65
onMethod · 0.45

Tested by

no test coverage detected