@cleocode/adapters 2026.4.47 → 2026.4.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19562 -372
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code/adapter.d.ts +12 -6
- package/dist/providers/claude-code/adapter.d.ts.map +1 -1
- package/dist/providers/claude-sdk/index.d.ts +18 -0
- package/dist/providers/claude-sdk/index.d.ts.map +1 -0
- package/dist/providers/claude-sdk/mcp-registry.d.ts +40 -0
- package/dist/providers/claude-sdk/mcp-registry.d.ts.map +1 -0
- package/dist/providers/claude-sdk/session-store.d.ts +78 -0
- package/dist/providers/claude-sdk/session-store.d.ts.map +1 -0
- package/dist/providers/claude-sdk/spawn.d.ts +79 -0
- package/dist/providers/claude-sdk/spawn.d.ts.map +1 -0
- package/dist/providers/claude-sdk/tool-bridge.d.ts +38 -0
- package/dist/providers/claude-sdk/tool-bridge.d.ts.map +1 -0
- package/dist/providers/openai-sdk/adapter.d.ts +77 -0
- package/dist/providers/openai-sdk/adapter.d.ts.map +1 -0
- package/dist/providers/openai-sdk/guardrails.d.ts +67 -0
- package/dist/providers/openai-sdk/guardrails.d.ts.map +1 -0
- package/dist/providers/openai-sdk/handoff.d.ts +94 -0
- package/dist/providers/openai-sdk/handoff.d.ts.map +1 -0
- package/dist/providers/openai-sdk/index.d.ts +39 -0
- package/dist/providers/openai-sdk/index.d.ts.map +1 -0
- package/dist/providers/openai-sdk/install.d.ts +61 -0
- package/dist/providers/openai-sdk/install.d.ts.map +1 -0
- package/dist/providers/openai-sdk/spawn.d.ts +146 -0
- package/dist/providers/openai-sdk/spawn.d.ts.map +1 -0
- package/dist/providers/openai-sdk/tracing.d.ts +89 -0
- package/dist/providers/openai-sdk/tracing.d.ts.map +1 -0
- package/dist/providers/shared/conduit-trace-writer.d.ts +72 -0
- package/dist/providers/shared/conduit-trace-writer.d.ts.map +1 -0
- package/dist/providers/shared/sdk-result-mapper.d.ts +51 -0
- package/dist/providers/shared/sdk-result-mapper.d.ts.map +1 -0
- package/package.json +5 -3
- package/src/index.ts +8 -0
- package/src/providers/claude-code/adapter.ts +41 -4
- package/src/providers/claude-sdk/__tests__/spawn.test.ts +448 -0
- package/src/providers/claude-sdk/index.ts +18 -0
- package/src/providers/claude-sdk/mcp-registry.ts +96 -0
- package/src/providers/claude-sdk/session-store.ts +103 -0
- package/src/providers/claude-sdk/spawn.ts +242 -0
- package/src/providers/claude-sdk/tool-bridge.ts +51 -0
- package/src/providers/openai-sdk/__tests__/openai-sdk-spawn.test.ts +716 -0
- package/src/providers/openai-sdk/adapter.ts +138 -0
- package/src/providers/openai-sdk/guardrails.ts +158 -0
- package/src/providers/openai-sdk/handoff.ts +187 -0
- package/src/providers/openai-sdk/index.ts +55 -0
- package/src/providers/openai-sdk/install.ts +135 -0
- package/src/providers/openai-sdk/manifest.json +45 -0
- package/src/providers/openai-sdk/spawn.ts +300 -0
- package/src/providers/openai-sdk/tracing.ts +175 -0
- package/src/providers/shared/conduit-trace-writer.ts +101 -0
- package/src/providers/shared/sdk-result-mapper.ts +83 -0
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @task T5240
|
|
8
8
|
*/
|
|
9
|
-
import type { AdapterCapabilities, AdapterHealthStatus, CLEOProviderAdapter } from '@cleocode/contracts';
|
|
9
|
+
import type { AdapterCapabilities, AdapterHealthStatus, AdapterSpawnProvider, CLEOProviderAdapter } from '@cleocode/contracts';
|
|
10
10
|
import { ClaudeCodeContextMonitorProvider } from './context-monitor.js';
|
|
11
11
|
import { ClaudeCodeHookProvider } from './hooks.js';
|
|
12
12
|
import { ClaudeCodeInstallProvider } from './install.js';
|
|
13
13
|
import { ClaudeCodePathProvider } from './paths.js';
|
|
14
|
-
import { ClaudeCodeSpawnProvider } from './spawn.js';
|
|
15
14
|
import { ClaudeCodeTaskSyncProvider } from './task-sync.js';
|
|
16
15
|
import { ClaudeCodeTransportProvider } from './transport.js';
|
|
17
16
|
/**
|
|
@@ -40,8 +39,14 @@ export declare class ClaudeCodeAdapter implements CLEOProviderAdapter {
|
|
|
40
39
|
capabilities: AdapterCapabilities;
|
|
41
40
|
/** Hook provider for CAAMP event mapping and registration. */
|
|
42
41
|
hooks: ClaudeCodeHookProvider;
|
|
43
|
-
/**
|
|
44
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Spawn provider for launching subagent processes.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `ClaudeCodeSpawnProvider` (CLI mode). When
|
|
46
|
+
* `provider.claude.mode === 'sdk'` is set in CLEO config, the adapter
|
|
47
|
+
* swaps this for `ClaudeSDKSpawnProvider` at initialization time.
|
|
48
|
+
*/
|
|
49
|
+
spawn: AdapterSpawnProvider;
|
|
45
50
|
/** Install provider for managing instruction files and plugin registration. */
|
|
46
51
|
install: ClaudeCodeInstallProvider;
|
|
47
52
|
/** Path provider for resolving Claude Code directory locations. */
|
|
@@ -60,8 +65,9 @@ export declare class ClaudeCodeAdapter implements CLEOProviderAdapter {
|
|
|
60
65
|
/**
|
|
61
66
|
* Initialize the adapter for a given project directory.
|
|
62
67
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
68
|
+
* Reads the CLEO config to determine the spawn mode and swaps the spawn
|
|
69
|
+
* provider to `ClaudeSDKSpawnProvider` when `provider.claude.mode === 'sdk'`.
|
|
70
|
+
* Defaults to `ClaudeCodeSpawnProvider` (CLI) for backwards compatibility.
|
|
65
71
|
*
|
|
66
72
|
* @param projectDir - Root directory of the project
|
|
67
73
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAI7D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAkB,YAAW,mBAAmB;IAC3D,kCAAkC;IAClC,QAAQ,CAAC,EAAE,iBAAiB;IAC5B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,8BAA8B;IAC9B,QAAQ,CAAC,OAAO,WAAW;IAE3B,+CAA+C;IAC/C,YAAY,EAAE,mBAAmB,CA6B/B;IAEF,8DAA8D;IAC9D,KAAK,EAAE,sBAAsB,CAAC;IAC9B;;;;;;OAMG;IACH,KAAK,EAAE,oBAAoB,CAAC;IAC5B,+EAA+E;IAC/E,OAAO,EAAE,yBAAyB,CAAC;IACnC,mEAAmE;IACnE,KAAK,EAAE,sBAAsB,CAAC;IAC9B,+EAA+E;IAC/E,cAAc,EAAE,gCAAgC,CAAC;IACjD,wDAAwD;IACxD,SAAS,EAAE,2BAA2B,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,EAAE,0BAA0B,CAAC;IAErC,oEAAoE;IACpE,OAAO,CAAC,UAAU,CAAuB;IACzC,kDAAkD;IAClD,OAAO,CAAC,WAAW,CAAS;;IAY5B;;;;;;;;OAQG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCnD;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAyCjD;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;CAG/B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Claude Agent SDK spawn provider for CLEO.
|
|
5
|
+
* Uses `@anthropic-ai/claude-agent-sdk` instead of the CLI for programmatic
|
|
6
|
+
* subagent execution with structured output and session tracking.
|
|
7
|
+
*
|
|
8
|
+
* Enabled via `provider.claude.mode = 'sdk'` in CLEO config.
|
|
9
|
+
*
|
|
10
|
+
* @task T581
|
|
11
|
+
*/
|
|
12
|
+
export type { McpServerMap, McpStdioConfig } from './mcp-registry.js';
|
|
13
|
+
export { getServers } from './mcp-registry.js';
|
|
14
|
+
export type { SessionEntry } from './session-store.js';
|
|
15
|
+
export { SessionStore } from './session-store.js';
|
|
16
|
+
export { ClaudeSDKSpawnProvider } from './spawn.js';
|
|
17
|
+
export { DEFAULT_TOOLS, resolveTools } from './tool-bridge.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Registry for Claude SDK Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Resolves available CLEO MCP servers and returns their configurations in the
|
|
5
|
+
* format expected by the SDK's `mcpServers` option. Each server is represented
|
|
6
|
+
* as an `McpStdioServerConfig` (command + optional args/env).
|
|
7
|
+
*
|
|
8
|
+
* Resolution is best-effort: if a server binary cannot be found in PATH or
|
|
9
|
+
* `node_modules/.bin/`, it is silently omitted from the returned map. This
|
|
10
|
+
* ensures agents always spawn even when some MCP servers are unavailable.
|
|
11
|
+
*
|
|
12
|
+
* @task T581
|
|
13
|
+
*/
|
|
14
|
+
/** Minimal stdio MCP server configuration understood by the SDK. */
|
|
15
|
+
export interface McpStdioConfig {
|
|
16
|
+
type?: 'stdio';
|
|
17
|
+
command: string;
|
|
18
|
+
args?: string[];
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** Map of server name to its stdio configuration. */
|
|
22
|
+
export type McpServerMap = Record<string, McpStdioConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve available CLEO MCP servers for the given working directory.
|
|
25
|
+
*
|
|
26
|
+
* Checks each known CLEO MCP server candidate against `node_modules/.bin/`
|
|
27
|
+
* in the provided directory. Only servers whose binary can be located are
|
|
28
|
+
* included in the returned map.
|
|
29
|
+
*
|
|
30
|
+
* @param workingDirectory - Project root directory for binary resolution
|
|
31
|
+
* @returns Map of available server name to stdio config (may be empty)
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const servers = getServers('/path/to/project');
|
|
36
|
+
* // { brain: { type: 'stdio', command: '/path/to/project/node_modules/.bin/cleo-mcp-brain' } }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function getServers(workingDirectory: string): McpServerMap;
|
|
40
|
+
//# sourceMappingURL=mcp-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-registry.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/mcp-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,qDAAqD;AACrD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAsC1D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY,CAejE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Store for Claude SDK Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Maintains an in-memory map of active SDK sessions keyed by instanceId.
|
|
5
|
+
* Each entry records the session ID returned by the SDK, the task ID, and
|
|
6
|
+
* the start time. Session IDs can be used with `options: { resume: sessionId }`
|
|
7
|
+
* in subsequent `query()` calls for multi-turn continuations.
|
|
8
|
+
*
|
|
9
|
+
* Persistence to conduit.db is intentionally deferred: the in-memory store
|
|
10
|
+
* is sufficient for single-process lifetimes and avoids coupling the spawn
|
|
11
|
+
* provider to the conduit subsystem at construction time.
|
|
12
|
+
*
|
|
13
|
+
* @task T581
|
|
14
|
+
*/
|
|
15
|
+
/** A single tracked SDK session entry. */
|
|
16
|
+
export interface SessionEntry {
|
|
17
|
+
/** Unique instance ID assigned at spawn time. */
|
|
18
|
+
instanceId: string;
|
|
19
|
+
/** Claude SDK session ID returned in the first SDK message (if captured). */
|
|
20
|
+
sessionId: string | undefined;
|
|
21
|
+
/** CLEO task ID this session is executing. */
|
|
22
|
+
taskId: string;
|
|
23
|
+
/** ISO timestamp when the session was created. */
|
|
24
|
+
startTime: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* In-memory store for active Claude SDK sessions.
|
|
28
|
+
*
|
|
29
|
+
* Provides CRUD operations over a `Map<instanceId, SessionEntry>`.
|
|
30
|
+
* Thread-safe within a single Node.js process (single-threaded event loop).
|
|
31
|
+
*/
|
|
32
|
+
export declare class SessionStore {
|
|
33
|
+
private readonly store;
|
|
34
|
+
/**
|
|
35
|
+
* Register a new session entry.
|
|
36
|
+
*
|
|
37
|
+
* @param entry - The session entry to add
|
|
38
|
+
*/
|
|
39
|
+
add(entry: SessionEntry): void;
|
|
40
|
+
/**
|
|
41
|
+
* Update the SDK session ID for an existing entry once it is received
|
|
42
|
+
* from the first SDK message.
|
|
43
|
+
*
|
|
44
|
+
* No-op if the instanceId is not found.
|
|
45
|
+
*
|
|
46
|
+
* @param instanceId - ID of the spawn instance
|
|
47
|
+
* @param sessionId - SDK-assigned session identifier
|
|
48
|
+
*/
|
|
49
|
+
setSessionId(instanceId: string, sessionId: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieve an entry by instance ID.
|
|
52
|
+
*
|
|
53
|
+
* @param instanceId - ID of the spawn instance
|
|
54
|
+
* @returns The session entry, or undefined if not found
|
|
55
|
+
*/
|
|
56
|
+
get(instanceId: string): SessionEntry | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Remove an entry by instance ID.
|
|
59
|
+
*
|
|
60
|
+
* @param instanceId - ID of the spawn instance to remove
|
|
61
|
+
*/
|
|
62
|
+
remove(instanceId: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* List all active session entries.
|
|
65
|
+
*
|
|
66
|
+
* @returns Array of all tracked session entries
|
|
67
|
+
*/
|
|
68
|
+
listActive(): SessionEntry[];
|
|
69
|
+
/**
|
|
70
|
+
* Return the number of tracked sessions.
|
|
71
|
+
*/
|
|
72
|
+
size(): number;
|
|
73
|
+
/**
|
|
74
|
+
* Clear all tracked sessions. Intended for testing only.
|
|
75
|
+
*/
|
|
76
|
+
clear(): void;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=session-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IAEzD;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAI9B;;;;;;;;OAQG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAOzD;;;;;OAKG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIjD;;;;OAIG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;OAIG;IACH,UAAU,IAAI,YAAY,EAAE;IAI5B;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude SDK Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Implements `AdapterSpawnProvider` using the `@anthropic-ai/claude-agent-sdk`
|
|
5
|
+
* programmatic API instead of shelling out to the `claude` CLI.
|
|
6
|
+
*
|
|
7
|
+
* Differences from `ClaudeCodeSpawnProvider`:
|
|
8
|
+
* - Uses SDK `query()` instead of a detached child process
|
|
9
|
+
* - Awaits full completion before returning (synchronous output capture)
|
|
10
|
+
* - Session IDs from the SDK enable future multi-turn resumption
|
|
11
|
+
* - No temp files, no OS PIDs — tracking is purely in-memory session IDs
|
|
12
|
+
* - `canSpawn()` checks for `ANTHROPIC_API_KEY` rather than CLI availability
|
|
13
|
+
*
|
|
14
|
+
* CANT enrichment is identical to the CLI provider: `buildCantEnrichedPrompt()`
|
|
15
|
+
* is called before `query()` and the result is passed as the SDK prompt string.
|
|
16
|
+
*
|
|
17
|
+
* @task T581
|
|
18
|
+
*/
|
|
19
|
+
import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/contracts';
|
|
20
|
+
/**
|
|
21
|
+
* Spawn provider that uses the Anthropic Claude Agent SDK for programmatic
|
|
22
|
+
* subagent execution.
|
|
23
|
+
*
|
|
24
|
+
* Each call to `spawn()` runs a full SDK `query()` to completion and
|
|
25
|
+
* captures the output. Sessions are tracked in `SessionStore` so callers
|
|
26
|
+
* can inspect active sessions via `listRunning()` and cancel them via
|
|
27
|
+
* `terminate()`.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* The `permissionMode: 'bypassPermissions'` + `allowDangerouslySkipPermissions: true`
|
|
31
|
+
* combination mirrors the `--dangerously-skip-permissions` flag used by
|
|
32
|
+
* the CLI provider. Both are required by the SDK when bypassing all tool
|
|
33
|
+
* permission prompts.
|
|
34
|
+
*/
|
|
35
|
+
export declare class ClaudeSDKSpawnProvider implements AdapterSpawnProvider {
|
|
36
|
+
/** In-memory session registry. */
|
|
37
|
+
private readonly sessions;
|
|
38
|
+
/**
|
|
39
|
+
* Check whether the SDK can be used in the current environment.
|
|
40
|
+
*
|
|
41
|
+
* Returns `true` if `ANTHROPIC_API_KEY` is set. No binary check is needed
|
|
42
|
+
* because the SDK manages the Claude Code subprocess internally.
|
|
43
|
+
*
|
|
44
|
+
* @returns `true` when an API key is present
|
|
45
|
+
*/
|
|
46
|
+
canSpawn(): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Spawn a subagent using the Claude Agent SDK.
|
|
49
|
+
*
|
|
50
|
+
* Enriches the prompt via CANT context, runs the SDK `query()` to
|
|
51
|
+
* completion, captures all assistant text output, and returns a
|
|
52
|
+
* `SpawnResult` with the final output and exit code.
|
|
53
|
+
*
|
|
54
|
+
* @param context - Spawn context with taskId, prompt, options
|
|
55
|
+
* @returns Resolved spawn result (status: 'completed' or 'failed')
|
|
56
|
+
*/
|
|
57
|
+
spawn(context: SpawnContext): Promise<SpawnResult>;
|
|
58
|
+
/**
|
|
59
|
+
* List sessions currently tracked as active (spawned but not yet completed).
|
|
60
|
+
*
|
|
61
|
+
* Because SDK sessions run to completion inside `spawn()`, this list is
|
|
62
|
+
* typically empty unless concurrent spawns are in flight.
|
|
63
|
+
*
|
|
64
|
+
* @returns Array of in-flight spawn results
|
|
65
|
+
*/
|
|
66
|
+
listRunning(): Promise<SpawnResult[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a session from tracking.
|
|
69
|
+
*
|
|
70
|
+
* The underlying SDK query runs inside `spawn()` and cannot be cancelled
|
|
71
|
+
* externally once the async iterator is in flight. Removing the entry from
|
|
72
|
+
* the store prevents it from appearing in `listRunning()` but does not
|
|
73
|
+
* interrupt the in-progress HTTP request.
|
|
74
|
+
*
|
|
75
|
+
* @param instanceId - ID of the spawn instance to terminate
|
|
76
|
+
*/
|
|
77
|
+
terminate(instanceId: string): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=spawn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAS3F;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE,kCAAkC;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAE/C;;;;;;;OAOG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC;;;;;;;;;OASG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IA6IxD;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAU3C;;;;;;;;;OASG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Bridge for Claude SDK Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Maps CLEO's tool allowlist (string names) to the SDK's `allowedTools`
|
|
5
|
+
* option format. The SDK accepts plain tool name strings such as
|
|
6
|
+
* `"Read"`, `"Bash"`, `"Edit"` for built-in Claude Code tools and
|
|
7
|
+
* `"mcp__<server>__<tool>"` for MCP-backed tools.
|
|
8
|
+
*
|
|
9
|
+
* @task T581
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Default CLEO tool set passed to the SDK when no explicit allowlist
|
|
13
|
+
* is provided in `SpawnContext.options.toolAllowlist`.
|
|
14
|
+
*
|
|
15
|
+
* Mirrors the standard agent tool surface used by the Claude Code CLI
|
|
16
|
+
* `--dangerously-skip-permissions` mode.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_TOOLS: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a CLEO tool allowlist to the SDK `allowedTools` array.
|
|
21
|
+
*
|
|
22
|
+
* When `allowlist` is undefined or empty, the default CLEO tool set is
|
|
23
|
+
* returned. When an explicit list is provided, it is returned as-is so
|
|
24
|
+
* callers can pass MCP tool strings (`mcp__server__tool`) alongside
|
|
25
|
+
* built-in names without transformation.
|
|
26
|
+
*
|
|
27
|
+
* @param allowlist - Optional array of tool names from `SpawnContext.options`
|
|
28
|
+
* @returns Array of SDK-compatible tool name strings
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* resolveTools(); // ['Read', 'Write', 'Edit', 'Bash', 'Glob', 'Grep']
|
|
33
|
+
* resolveTools(['Read', 'Bash']); // ['Read', 'Bash']
|
|
34
|
+
* resolveTools(['mcp__brain__search']); // ['mcp__brain__search']
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveTools(allowlist?: string[]): string[];
|
|
38
|
+
//# sourceMappingURL=tool-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-bridge.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/tool-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAOjC,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAK3D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Agents SDK Adapter.
|
|
3
|
+
*
|
|
4
|
+
* Main `CLEOProviderAdapter` implementation for the OpenAI Agents SDK.
|
|
5
|
+
* Provides spawn and install capabilities. Hooks are not supported (the
|
|
6
|
+
* SDK does not expose a CLI hook system equivalent to Claude Code's).
|
|
7
|
+
*
|
|
8
|
+
* @task T582
|
|
9
|
+
*/
|
|
10
|
+
import type { AdapterCapabilities, AdapterHealthStatus, CLEOProviderAdapter } from '@cleocode/contracts';
|
|
11
|
+
import { OpenAiSdkInstallProvider } from './install.js';
|
|
12
|
+
import { OpenAiSdkSpawnProvider } from './spawn.js';
|
|
13
|
+
/**
|
|
14
|
+
* CLEO provider adapter for the OpenAI Agents SDK.
|
|
15
|
+
*
|
|
16
|
+
* Bridges CLEO's adapter system with the `@openai/agents` SDK:
|
|
17
|
+
* - Spawn: Launches agents via the SDK runner with handoff topology
|
|
18
|
+
* - Install: Manages AGENTS.md @-references and .openai/ config directory
|
|
19
|
+
* - Tracing: Default-on conduit span persistence via `CleoConduitTraceProcessor`
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* This adapter is the only CLEO provider with first-class handoff support.
|
|
23
|
+
* Team Lead → Worker topology is declared in `SpawnContext.options.handoffs`
|
|
24
|
+
* and wired directly to SDK `Agent.handoffs`. The SDK handles routing
|
|
25
|
+
* internally without any CLEO glue code.
|
|
26
|
+
*
|
|
27
|
+
* This is also the only provider supporting 100+ LLMs via the Vercel AI SDK
|
|
28
|
+
* bridge (capability flag: `supportsMultiModel`).
|
|
29
|
+
*/
|
|
30
|
+
export declare class OpenAiSdkAdapter implements CLEOProviderAdapter {
|
|
31
|
+
/** Unique provider identifier. */
|
|
32
|
+
readonly id = "openai-sdk";
|
|
33
|
+
/** Human-readable provider name. */
|
|
34
|
+
readonly name = "OpenAI Agents SDK";
|
|
35
|
+
/** Adapter version string. */
|
|
36
|
+
readonly version = "1.0.0";
|
|
37
|
+
/** Declared capabilities for this provider. */
|
|
38
|
+
capabilities: AdapterCapabilities;
|
|
39
|
+
/** Spawn provider for SDK-backed agent runs with handoff topology. */
|
|
40
|
+
spawn: OpenAiSdkSpawnProvider;
|
|
41
|
+
/** Install provider for AGENTS.md and .openai/ config directory management. */
|
|
42
|
+
install: OpenAiSdkInstallProvider;
|
|
43
|
+
/** Project directory this adapter was initialized with, or null. */
|
|
44
|
+
private projectDir;
|
|
45
|
+
/** Whether {@link initialize} has been called. */
|
|
46
|
+
private initialized;
|
|
47
|
+
constructor();
|
|
48
|
+
/**
|
|
49
|
+
* Initialize the adapter for a given project directory.
|
|
50
|
+
*
|
|
51
|
+
* @param projectDir - Root directory of the project.
|
|
52
|
+
*/
|
|
53
|
+
initialize(projectDir: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Dispose the adapter and release all resources.
|
|
56
|
+
*/
|
|
57
|
+
dispose(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Run a health check to verify the OpenAI SDK is usable.
|
|
60
|
+
*
|
|
61
|
+
* Checks:
|
|
62
|
+
* 1. Adapter has been initialized
|
|
63
|
+
* 2. `OPENAI_API_KEY` is set in the environment
|
|
64
|
+
*
|
|
65
|
+
* @returns Health status with details about each check.
|
|
66
|
+
*/
|
|
67
|
+
healthCheck(): Promise<AdapterHealthStatus>;
|
|
68
|
+
/**
|
|
69
|
+
* Check whether the adapter has been initialized.
|
|
70
|
+
*/
|
|
71
|
+
isInitialized(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Get the project directory this adapter was initialized with.
|
|
74
|
+
*/
|
|
75
|
+
getProjectDir(): string | null;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,YAAW,mBAAmB;IAC1D,kCAAkC;IAClC,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,uBAAuB;IACpC,8BAA8B;IAC9B,QAAQ,CAAC,OAAO,WAAW;IAE3B,+CAA+C;IAC/C,YAAY,EAAE,mBAAmB,CAa/B;IAEF,sEAAsE;IACtE,KAAK,EAAE,sBAAsB,CAAC;IAC9B,+EAA+E;IAC/E,OAAO,EAAE,wBAAwB,CAAC;IAElC,oEAAoE;IACpE,OAAO,CAAC,UAAU,CAAuB;IACzC,kDAAkD;IAClD,OAAO,CAAC,WAAW,CAAS;;IAO5B;;;;OAIG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B;;;;;;;;OAQG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAuBjD;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;CAG/B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLEO permission rules mapped to OpenAI Agents SDK guardrails.
|
|
3
|
+
*
|
|
4
|
+
* CLEO ACLs (file-glob path allowlists, tool allowlists) are expressed as
|
|
5
|
+
* `InputGuardrail` instances that run before agent execution. A path that
|
|
6
|
+
* falls outside the allowed glob list causes the guardrail to trip and
|
|
7
|
+
* the agent run is rejected.
|
|
8
|
+
*
|
|
9
|
+
* @task T582
|
|
10
|
+
*/
|
|
11
|
+
import type { InputGuardrail } from '@openai/agents';
|
|
12
|
+
/**
|
|
13
|
+
* Check whether a file-system path is covered by at least one glob pattern.
|
|
14
|
+
*
|
|
15
|
+
* @param path - The absolute or relative path to test.
|
|
16
|
+
* @param allowedGlobs - Array of glob patterns (supports `*` and `**`).
|
|
17
|
+
* @returns `true` when the path matches at least one pattern.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isPathAllowed(path: string, allowedGlobs: string[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Build an input guardrail that enforces CLEO file-glob path ACLs.
|
|
22
|
+
*
|
|
23
|
+
* Inspects the serialised agent input for embedded `"path":"..."` fields
|
|
24
|
+
* and rejects the run when a path falls outside the allowlist. This provides
|
|
25
|
+
* an early-exit safety fence before the agent starts consuming model tokens.
|
|
26
|
+
*
|
|
27
|
+
* @param allowedGlobs - Glob patterns that tool path arguments must match.
|
|
28
|
+
* Pass an empty array to allow all paths (permissive mode).
|
|
29
|
+
* @returns An {@link InputGuardrail} ready to attach to an `Agent`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const guard = buildPathGuardrail(['/mnt/projects/**', '/tmp/**']);
|
|
34
|
+
* const agent = new Agent({ ..., inputGuardrails: [guard] });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildPathGuardrail(allowedGlobs: string[]): InputGuardrail;
|
|
38
|
+
/**
|
|
39
|
+
* Build an input guardrail that documents the tool allowlist for audit purposes.
|
|
40
|
+
*
|
|
41
|
+
* In the OpenAI Agents SDK, tool-name enforcement is primarily structural —
|
|
42
|
+
* agents only receive the tools attached to their `tools` array. This guardrail
|
|
43
|
+
* provides an additional audit layer that records the active allowlist in the
|
|
44
|
+
* span metadata.
|
|
45
|
+
*
|
|
46
|
+
* @param allowedTools - Exact tool names permitted for this agent.
|
|
47
|
+
* Pass an empty array to allow all tools (permissive mode).
|
|
48
|
+
* @returns An {@link InputGuardrail} ready to attach to an `Agent`.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const guard = buildToolAllowlistGuardrail(['read', 'write']);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildToolAllowlistGuardrail(allowedTools: string[]): InputGuardrail;
|
|
56
|
+
/**
|
|
57
|
+
* Build the default CLEO guardrail set from spawn options.
|
|
58
|
+
*
|
|
59
|
+
* Combines path ACL and tool allowlist guards into a single array ready to
|
|
60
|
+
* pass as `inputGuardrails` on an `Agent` or `RunConfig`.
|
|
61
|
+
*
|
|
62
|
+
* @param allowedGlobs - File-path glob allowlist.
|
|
63
|
+
* @param allowedTools - Tool name allowlist.
|
|
64
|
+
* @returns Array of input guardrails to attach to the agent.
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildDefaultGuardrails(allowedGlobs: string[], allowedTools: string[]): InputGuardrail[];
|
|
67
|
+
//# sourceMappingURL=guardrails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrails.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA8B,MAAM,gBAAgB,CAAC;AAwBjF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAG3E;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,cAAc,CA6BzE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,cAAc,CAclF;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,MAAM,EAAE,GACrB,cAAc,EAAE,CAYlB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLEO Team topology → OpenAI Agents SDK handoff mapping.
|
|
3
|
+
*
|
|
4
|
+
* CLEO agents are organised in a Lead → Worker hierarchy. This module maps
|
|
5
|
+
* that topology to the SDK's first-class `handoffs` graph:
|
|
6
|
+
*
|
|
7
|
+
* - A Team Lead becomes an `Agent` whose `handoffs` array lists its workers.
|
|
8
|
+
* - Each Worker archetype (read-only, write, bash) is declared in
|
|
9
|
+
* `WORKER_ARCHETYPES` and built on demand.
|
|
10
|
+
* - The mapping is driven by `SpawnContext.options.handoffs`, which is an
|
|
11
|
+
* array of worker archetype names.
|
|
12
|
+
*
|
|
13
|
+
* @task T582
|
|
14
|
+
*/
|
|
15
|
+
import type { InputGuardrail } from '@openai/agents';
|
|
16
|
+
import { Agent } from '@openai/agents';
|
|
17
|
+
/**
|
|
18
|
+
* Descriptor for a pre-configured worker agent archetype.
|
|
19
|
+
*
|
|
20
|
+
* Archetypes are declarative templates. `buildWorkerAgent` inflates them into
|
|
21
|
+
* live SDK `Agent` instances.
|
|
22
|
+
*/
|
|
23
|
+
export interface WorkerArchetype {
|
|
24
|
+
/** Archetype identifier (also used as SDK agent name). */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Short description passed as the SDK agent instructions. */
|
|
27
|
+
instructions: string;
|
|
28
|
+
/** Preferred model for this archetype. */
|
|
29
|
+
model: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Registry of built-in CLEO worker archetypes.
|
|
33
|
+
*
|
|
34
|
+
* Callers reference these by name in `SpawnContext.options.handoffs`.
|
|
35
|
+
* New archetypes can be added here without changing the spawn provider.
|
|
36
|
+
*/
|
|
37
|
+
export declare const WORKER_ARCHETYPES: Record<string, WorkerArchetype>;
|
|
38
|
+
/**
|
|
39
|
+
* Build a worker `Agent` instance from a named archetype.
|
|
40
|
+
*
|
|
41
|
+
* @param archetypeName - Key in {@link WORKER_ARCHETYPES}.
|
|
42
|
+
* @param guardrails - Input guardrails to attach to the worker agent.
|
|
43
|
+
* @returns A configured SDK `Agent` or `null` when the archetype is unknown.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildWorkerAgent(archetypeName: string, guardrails: InputGuardrail[]): Agent | null;
|
|
46
|
+
/**
|
|
47
|
+
* Build a team lead `Agent` whose `handoffs` reference the given workers.
|
|
48
|
+
*
|
|
49
|
+
* @param leadInstructions - System instructions for the lead agent.
|
|
50
|
+
* @param leadModel - Model to use for the lead agent.
|
|
51
|
+
* @param workers - Worker agents this lead can hand off to.
|
|
52
|
+
* @param guardrails - Input guardrails to attach to the lead agent.
|
|
53
|
+
* @returns A configured lead SDK `Agent`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildLeadAgent(leadInstructions: string, leadModel: string, workers: Agent[], guardrails: InputGuardrail[]): Agent;
|
|
56
|
+
/**
|
|
57
|
+
* Build a simple single-tier agent (no handoffs) from prompt and model.
|
|
58
|
+
*
|
|
59
|
+
* Used when `SpawnContext.options.tier` is `'worker'` or when no handoff
|
|
60
|
+
* names are provided.
|
|
61
|
+
*
|
|
62
|
+
* @param instructions - Agent system instructions.
|
|
63
|
+
* @param model - Model identifier.
|
|
64
|
+
* @param guardrails - Input guardrails.
|
|
65
|
+
* @returns A configured SDK `Agent`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildStandaloneAgent(instructions: string, model: string, guardrails: InputGuardrail[]): Agent;
|
|
68
|
+
/** Options for building the agent topology from a spawn context. */
|
|
69
|
+
export interface TopologyOptions {
|
|
70
|
+
/** Prompt / instructions for the entry-point agent. */
|
|
71
|
+
instructions: string;
|
|
72
|
+
/** Model to use for the lead / standalone agent. */
|
|
73
|
+
model: string;
|
|
74
|
+
/** Agent tier determines whether workers and handoffs are wired. */
|
|
75
|
+
tier: 'lead' | 'worker' | 'orchestrator';
|
|
76
|
+
/** Names of worker archetypes to create and attach as handoffs. */
|
|
77
|
+
handoffNames: string[];
|
|
78
|
+
/** Input guardrails shared across all agents in the topology. */
|
|
79
|
+
guardrails: InputGuardrail[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Build the entry-point agent and its worker topology from spawn options.
|
|
83
|
+
*
|
|
84
|
+
* - `tier === 'lead'` or `tier === 'orchestrator'`: creates a lead agent with
|
|
85
|
+
* worker handoffs derived from `handoffNames`.
|
|
86
|
+
* - `tier === 'worker'`: creates a standalone agent with no handoffs.
|
|
87
|
+
*
|
|
88
|
+
* Unknown archetype names in `handoffNames` are silently skipped.
|
|
89
|
+
*
|
|
90
|
+
* @param options - Topology build options.
|
|
91
|
+
* @returns The entry-point agent to pass to `runner.run()`.
|
|
92
|
+
*/
|
|
93
|
+
export declare function buildAgentTopology(options: TopologyOptions): Agent;
|
|
94
|
+
//# sourceMappingURL=handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAMvC;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAmB7D,CAAC;AAMF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,cAAc,EAAE,GAC3B,KAAK,GAAG,IAAI,CAUd;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,KAAK,EAAE,EAChB,UAAU,EAAE,cAAc,EAAE,GAC3B,KAAK,CAQP;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,cAAc,EAAE,GAC3B,KAAK,CAOP;AAMD,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,cAAc,CAAC;IACzC,mEAAmE;IACnE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iEAAiE;IACjE,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,KAAK,CAkBlE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* CLEO provider adapter for the OpenAI Agents SDK.
|
|
5
|
+
* Default export is the adapter class for dynamic loading by AdapterManager.
|
|
6
|
+
*
|
|
7
|
+
* @task T582
|
|
8
|
+
*/
|
|
9
|
+
import { OpenAiSdkAdapter } from './adapter.js';
|
|
10
|
+
export { OpenAiSdkAdapter } from './adapter.js';
|
|
11
|
+
export { buildDefaultGuardrails, buildPathGuardrail, buildToolAllowlistGuardrail, isPathAllowed, } from './guardrails.js';
|
|
12
|
+
export type { TopologyOptions, WorkerArchetype } from './handoff.js';
|
|
13
|
+
export { buildAgentTopology, buildLeadAgent, buildStandaloneAgent, buildWorkerAgent, WORKER_ARCHETYPES, } from './handoff.js';
|
|
14
|
+
export { OpenAiSdkInstallProvider } from './install.js';
|
|
15
|
+
export type { OpenAiSdkSpawnOptions } from './spawn.js';
|
|
16
|
+
export { OpenAiSdkSpawnProvider } from './spawn.js';
|
|
17
|
+
export { CleoConduitTraceProcessor } from './tracing.js';
|
|
18
|
+
export default OpenAiSdkAdapter;
|
|
19
|
+
/**
|
|
20
|
+
* Factory function for creating adapter instances.
|
|
21
|
+
* Used by AdapterManager's dynamic import fallback.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This is the primary entry point for dynamic adapter loading.
|
|
25
|
+
* AdapterManager calls this function when it resolves the openai-sdk
|
|
26
|
+
* provider via its import-based discovery mechanism.
|
|
27
|
+
*
|
|
28
|
+
* @returns A new {@link OpenAiSdkAdapter} instance ready for initialization.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { createAdapter } from '@cleocode/adapters/providers/openai-sdk';
|
|
33
|
+
*
|
|
34
|
+
* const adapter = createAdapter();
|
|
35
|
+
* await adapter.initialize('/path/to/project');
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function createAdapter(): OpenAiSdkAdapter;
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,2BAA2B,EAC3B,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,eAAe,gBAAgB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,IAAI,gBAAgB,CAEhD"}
|