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
2 changes: 1 addition & 1 deletion cockpit/langgraph/interrupts/angular/prompts/interrupts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This capability demonstrates human-in-the-loop interrupt handling using LangGraph's `interrupt()` primitive and the `@cacheplane/chat` Angular component library. When the graph pauses at an interrupt node, the `<chat-interrupt-panel>` surfaces the pending decision to the user; their response is submitted back to the graph via `agent`'s `resume` helper.

Key components used: `<chat>`, `<chat-interrupt-panel>`. The interrupt panel renders inside the chat host and becomes visible automatically whenever the underlying stream resource detects a pending interrupt in the thread state.
Key components used: `<chat>`, `<chat-interrupt-panel>`. The interrupt panel renders inside the chat host and becomes visible automatically whenever the underlying agent detects a pending interrupt in the thread state.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class TimeTravelComponent {
/** Index of the currently selected checkpoint in the sidebar. */
protected readonly selectedIndex = signal<number>(-1);

/** Checkpoint history derived from the stream resource. */
/** Checkpoint history derived from the agent. */
protected readonly checkpoints = computed(
(): ThreadState<any>[] => this.stream.history(),
);
Expand Down
4 changes: 2 additions & 2 deletions libs/agent/src/lib/agent.fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
inject, DestroyRef, computed,
isSignal, Signal,
} from '@angular/core';
import { STREAM_RESOURCE_CONFIG } from './agent.provider';
import { AGENT_CONFIG } from './agent.provider';
import { toSignal, toObservable } from '@angular/core/rxjs-interop';
import {
BehaviorSubject, Subject, of,
Expand Down Expand Up @@ -58,7 +58,7 @@ export function agent<
): AgentRef<T, InferBag<T, Bag>> {
// Injection context required
const destroyRef = inject(DestroyRef);
const globalConfig = inject(STREAM_RESOURCE_CONFIG, { optional: true });
const globalConfig = inject(AGENT_CONFIG, { optional: true });
const destroy$ = new Subject<void>();
destroyRef.onDestroy(() => { destroy$.next(); destroy$.complete(); });

Expand Down
8 changes: 4 additions & 4 deletions libs/agent/src/lib/agent.provider.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { describe, it, expect } from 'vitest';
import { TestBed } from '@angular/core/testing';
import { provideAgent, STREAM_RESOURCE_CONFIG } from './agent.provider';
import { provideAgent, AGENT_CONFIG } from './agent.provider';
import { MockAgentTransport } from './transport/mock-stream.transport';

describe('provideAgent', () => {
it('provides STREAM_RESOURCE_CONFIG token', () => {
it('provides AGENT_CONFIG token', () => {
TestBed.configureTestingModule({
providers: [provideAgent({ apiUrl: 'https://api.example.com' })],
});
const config = TestBed.inject(STREAM_RESOURCE_CONFIG);
const config = TestBed.inject(AGENT_CONFIG);
expect(config.apiUrl).toBe('https://api.example.com');
});

Expand All @@ -17,7 +17,7 @@ describe('provideAgent', () => {
TestBed.configureTestingModule({
providers: [provideAgent({ apiUrl: '', transport })],
});
const config = TestBed.inject(STREAM_RESOURCE_CONFIG);
const config = TestBed.inject(AGENT_CONFIG);
expect(config.transport).toBe(transport);
});
});
6 changes: 3 additions & 3 deletions libs/agent/src/lib/agent.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export interface AgentConfig {
transport?: AgentTransport;
}

export const STREAM_RESOURCE_CONFIG =
new InjectionToken<AgentConfig>('STREAM_RESOURCE_CONFIG');
export const AGENT_CONFIG =
new InjectionToken<AgentConfig>('AGENT_CONFIG');

/**
* Angular provider factory that registers global defaults for all
Expand All @@ -37,7 +37,7 @@ export const STREAM_RESOURCE_CONFIG =
*/
export function provideAgent(config: AgentConfig): Provider {
return {
provide: STREAM_RESOURCE_CONFIG,
provide: AGENT_CONFIG,
useValue: config,
};
}
2 changes: 1 addition & 1 deletion libs/agent/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export { agent } from './lib/agent.fn';

// Provider
export { provideAgent, STREAM_RESOURCE_CONFIG } from './lib/agent.provider';
export { provideAgent, AGENT_CONFIG } from './lib/agent.provider';
export type { AgentConfig } from './lib/agent.provider';

// Public types
Expand Down
Loading