Skip to content

Commit 37acb69

Browse files
authored
Merge pull request #41 from githubnext/rig-sampler/17-refactor-plan-7688776237fb1195
[rig-sampler] docs(rig): add JSDoc to configureAgent
2 parents bfcd69d + c757438 commit 37acb69

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

skills/rig/rig.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,22 @@ function withOptions<T extends Omit<Partial<PromptIntent>, "__rig" | "id" | "mod
16011601
return options ? { ...value, options: stripSignal(options) } : value;
16021602
}
16031603

1604+
/**
1605+
* Replaces the global `AgentFactory` used by all subsequent `agent()` calls.
1606+
*
1607+
* Call this once at program startup (before invoking any agent) to swap in a
1608+
* custom or mocked engine. The harness itself calls it internally via
1609+
* `launchRigProgram` / `runLauncherCli`; most application code does not need
1610+
* to call it directly.
1611+
*
1612+
* @example
1613+
* // Use a custom engine for all agents in this module:
1614+
* configureAgent(copilotEngine({ server: true }));
1615+
*
1616+
* @example
1617+
* // Inject a stub engine in tests:
1618+
* configureAgent(() => ({ ask: async () => '{"ok":true}', close: async () => {} }));
1619+
*/
16041620
export function configureAgent(factory: AgentFactory): void {
16051621
currentAgentFactory = factory;
16061622
}

0 commit comments

Comments
 (0)