claudeSdkPipeline.ts ×17

Frontier kind: Code frontier

unlabeled · c_3385c62e5777

116 tests · 28933 LOC · 127 files · introduces 0 tests · 46 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges46 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2548 ranges28933 lines · 127 files · Browse complete extent
All tests (intent)
116 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 46 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/claude/claudeSdkPipeline.ts 46 introduced LOC · 17 ranges

Open complete file

177 */
178 private _bindWarmQuery(): Query {
179 > const query = this._warm.query(this._queue.iterable); claudeSdkPipeline.ts
180 > this._query = query;
181 > return query;
182 > }
183
184 /**
401 await this._rebindQuery('recover');
402 }
403 > if (this._abortController.signal.aborted) { claudeSdkPipeline.ts
404 throw new CancellationError();
405 }
406 > if (!this._query) { claudeSdkPipeline.ts
407 this._bindWarmQuery();
408 await this._replayCurrentConfig();
409 }
410 > this._ensureConsumerLoop(); claudeSdkPipeline.ts
411 > const entry: IPendingSdkMessage = {
412 > sdkMessage: prompt,
413 sdkUuid: typeof prompt.uuid === 'string' ? prompt.uuid : turnId,
414 turnId,
499
500 private _ensureConsumerLoop(): void {
501 > if (this._consumerLoopRunning) { claudeSdkPipeline.ts
502 return;
503 }
504 > this._consumerLoopRunning = true; claudeSdkPipeline.ts
505 > this._runConsumerLoop();
506 > }
507
508 /**
521 */
522 private _runConsumerLoop(): void {
523 > const boundQuery = this._query; claudeSdkPipeline.ts
524 > void this._processMessages()
525 > .catch(err => this._logService.error(`[ClaudeSdkPipeline:${this.sessionId}] _processMessages crashed: ${err}`))
526 > .finally(() => {
527 > if (!this._store.isDisposed && this._query && this._query !== boundQuery) {
528 this._runConsumerLoop();
529 > } else { claudeSdkPipeline.ts
530 > this._consumerLoopRunning = false;
531 > }
532 > });
533 > }
534
535 /**
539 */
540 private async _replayCurrentConfig(): Promise<void> {
541 > try { claudeSdkPipeline.ts
542 > if (this._currentModel !== undefined && this._currentModel !== this._appliedModel) {
543 await this._query?.setModel(this._currentModel);
544 this._appliedModel = this._currentModel;
545 }
546 > if (this._currentEffort !== undefined && this._currentEffort !== this._appliedEffort) { claudeSdkPipeline.ts
547 await this._query?.applyFlagSettings({ effortLevel: this._currentEffort });
548 this._appliedEffort = this._currentEffort;
549 }
550 > if (this._currentPermissionMode !== undefined && this._currentPermissionMode !== this._appliedPermissionMode) { claudeSdkPipeline.ts
551 await this._query?.setPermissionMode(this._currentPermissionMode);
552 this._appliedPermissionMode = this._currentPermissionMode;
553 }
554 > } catch (err) { claudeSdkPipeline.ts
555 this._logService.warn(`[ClaudeSdkPipeline:${this.sessionId}] _replayCurrentConfig failed: ${err}`);
556 }
558
559 /**
630 */
631 private async _processMessages(): Promise<void> {
632 > const query = this._query; claudeSdkPipeline.ts
633 > if (!query) {
634 throw new Error('ClaudeSdkPipeline._processMessages called before query was bound');
635 }
636 > try { claudeSdkPipeline.ts
637 > for await (const message of query) {
638 if (this._abortController.signal.aborted) {
639 throw new CancellationError();
686 }
687 throw new Error('Claude SDK stream ended without a result message');
688 > } catch (err) { claudeSdkPipeline.ts
689 > const fatal = err instanceof Error ? err : new Error(String(err));
690 > // Only the loop that still owns the live query reacts: a later
691 > // unwinding pass whose query was already swapped by a rebind must
692 > // not clobber the fresh one. Mark unhealthy (keep the handle for
693 > // teardown); the next `send` rebinds.
694 > if (this._query === query) {
695 > this._queue.failAll(fatal);
696 > this._needsRebind = true;
697 > }
698 > if (!isCancellationError(fatal)) {
699 throw fatal;
700 }
702 > }
703 }