@cleocode/adapters 2026.4.92 → 2026.4.94
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.js +40795 -18064
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-sdk/index.d.ts +10 -4
- package/dist/providers/claude-sdk/index.d.ts.map +1 -1
- package/dist/providers/claude-sdk/spawn.d.ts +29 -28
- package/dist/providers/claude-sdk/spawn.d.ts.map +1 -1
- package/dist/providers/openai-sdk/adapter.d.ts +18 -17
- package/dist/providers/openai-sdk/adapter.d.ts.map +1 -1
- package/dist/providers/openai-sdk/guardrails.d.ts +71 -18
- package/dist/providers/openai-sdk/guardrails.d.ts.map +1 -1
- package/dist/providers/openai-sdk/handoff.d.ts +51 -21
- package/dist/providers/openai-sdk/handoff.d.ts.map +1 -1
- package/dist/providers/openai-sdk/index.d.ts +8 -5
- package/dist/providers/openai-sdk/index.d.ts.map +1 -1
- package/dist/providers/openai-sdk/install.d.ts +1 -1
- package/dist/providers/openai-sdk/spawn.d.ts +54 -21
- package/dist/providers/openai-sdk/spawn.d.ts.map +1 -1
- package/dist/providers/openai-sdk/tracing.d.ts +87 -21
- package/dist/providers/openai-sdk/tracing.d.ts.map +1 -1
- package/dist/providers/shared/sdk-result-mapper.d.ts +9 -7
- package/dist/providers/shared/sdk-result-mapper.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/__tests__/harness-interop.test.ts +451 -0
- package/src/providers/claude-sdk/__tests__/spawn.test.ts +100 -265
- package/src/providers/claude-sdk/index.ts +10 -4
- package/src/providers/claude-sdk/spawn.ts +69 -106
- package/src/providers/openai-sdk/__tests__/openai-sdk-spawn.test.ts +134 -103
- package/src/providers/openai-sdk/adapter.ts +19 -18
- package/src/providers/openai-sdk/guardrails.ts +106 -25
- package/src/providers/openai-sdk/handoff.ts +73 -37
- package/src/providers/openai-sdk/index.ts +28 -4
- package/src/providers/openai-sdk/install.ts +1 -1
- package/src/providers/openai-sdk/manifest.json +4 -4
- package/src/providers/openai-sdk/spawn.ts +213 -48
- package/src/providers/openai-sdk/tracing.ts +105 -22
- package/src/providers/shared/sdk-result-mapper.ts +9 -7
|
@@ -1,15 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CLEO permission rules
|
|
2
|
+
* CLEO permission rules for the OpenAI SDK adapter.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Historically these rules were expressed as `InputGuardrail` instances from
|
|
5
|
+
* `@openai/agents`. Post T933 (ADR-052 — Vercel AI SDK consolidation) they
|
|
6
|
+
* are CLEO-native objects with the same shape so provider code that relies on
|
|
7
|
+
* their behaviour does not need to change. The Vercel AI SDK does not ship an
|
|
8
|
+
* equivalent guardrail abstraction — CLEO implements its own path ACL and
|
|
9
|
+
* tool allowlist enforcement here.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
11
|
+
* A guardrail evaluates the serialised agent input before the request is sent
|
|
12
|
+
* to the model. A path that falls outside the allowed glob list causes the
|
|
13
|
+
* guardrail to trip and the run is rejected.
|
|
14
|
+
*
|
|
15
|
+
* @task T582 (original)
|
|
16
|
+
* @task T933 (SDK consolidation — provider-neutral rewrite)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// CLEO-native guardrail contract
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
/** Arguments passed to a CLEO input guardrail. */
|
|
24
|
+
export interface CleoInputGuardrailFunctionArgs {
|
|
25
|
+
/** The agent being invoked. Opaque to guardrails. */
|
|
26
|
+
agent: unknown;
|
|
27
|
+
/** Serialised input to scan — may be a string or arbitrary JSON value. */
|
|
28
|
+
input: unknown;
|
|
29
|
+
/** Per-run context (opaque). */
|
|
30
|
+
context: unknown;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Result of evaluating a CLEO input guardrail. */
|
|
34
|
+
export interface CleoGuardrailResult {
|
|
35
|
+
/** When true, the guardrail has tripped and the run MUST be rejected. */
|
|
36
|
+
tripwireTriggered: boolean;
|
|
37
|
+
/** Free-form diagnostic payload for logging and trace spans. */
|
|
38
|
+
outputInfo: unknown;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* CLEO-native replacement for `InputGuardrail` from `@openai/agents`.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* The shape is identical to the legacy SDK contract so downstream consumers
|
|
46
|
+
* do not require changes. CLEO enforces these guardrails in-process before
|
|
47
|
+
* dispatching a prompt to the Vercel AI SDK.
|
|
10
48
|
*/
|
|
49
|
+
export interface CleoInputGuardrail {
|
|
50
|
+
/** Stable guardrail identifier for logs and trace metadata. */
|
|
51
|
+
name: string;
|
|
52
|
+
/** Execute the guardrail against the current run arguments. */
|
|
53
|
+
execute(args: CleoInputGuardrailFunctionArgs): Promise<CleoGuardrailResult>;
|
|
54
|
+
}
|
|
11
55
|
|
|
12
|
-
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Use {@link CleoInputGuardrail}. Kept as a named alias for
|
|
58
|
+
* callers that previously imported the legacy `InputGuardrail` name from
|
|
59
|
+
* this module. Removed in a future major.
|
|
60
|
+
*/
|
|
61
|
+
export type InputGuardrail = CleoInputGuardrail;
|
|
13
62
|
|
|
14
63
|
// ---------------------------------------------------------------------------
|
|
15
64
|
// Helpers
|
|
@@ -58,20 +107,18 @@ export function isPathAllowed(path: string, allowedGlobs: string[]): boolean {
|
|
|
58
107
|
*
|
|
59
108
|
* @param allowedGlobs - Glob patterns that tool path arguments must match.
|
|
60
109
|
* Pass an empty array to allow all paths (permissive mode).
|
|
61
|
-
* @returns
|
|
110
|
+
* @returns A {@link CleoInputGuardrail} ready to attach to an agent.
|
|
62
111
|
*
|
|
63
112
|
* @example
|
|
64
113
|
* ```typescript
|
|
65
114
|
* const guard = buildPathGuardrail(['/mnt/projects/**', '/tmp/**']);
|
|
66
|
-
* const agent =
|
|
115
|
+
* const agent = buildStandaloneAgent('...', 'gpt-4.1', [guard]);
|
|
67
116
|
* ```
|
|
68
117
|
*/
|
|
69
|
-
export function buildPathGuardrail(allowedGlobs: string[]):
|
|
118
|
+
export function buildPathGuardrail(allowedGlobs: string[]): CleoInputGuardrail {
|
|
70
119
|
return {
|
|
71
120
|
name: 'cleo_path_acl',
|
|
72
|
-
execute: async (
|
|
73
|
-
args: InputGuardrailFunctionArgs,
|
|
74
|
-
): Promise<{ tripwireTriggered: boolean; outputInfo: unknown }> => {
|
|
121
|
+
execute: async (args: CleoInputGuardrailFunctionArgs): Promise<CleoGuardrailResult> => {
|
|
75
122
|
// Serialise input to a string for heuristic path scanning.
|
|
76
123
|
const inputStr = typeof args.input === 'string' ? args.input : JSON.stringify(args.input);
|
|
77
124
|
|
|
@@ -100,26 +147,23 @@ export function buildPathGuardrail(allowedGlobs: string[]): InputGuardrail {
|
|
|
100
147
|
/**
|
|
101
148
|
* Build an input guardrail that documents the tool allowlist for audit purposes.
|
|
102
149
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* span metadata.
|
|
150
|
+
* Tool-name enforcement is primarily structural — agents only receive the
|
|
151
|
+
* tools declared by CLEO orchestration. This guardrail provides an additional
|
|
152
|
+
* audit layer that records the active allowlist in the span metadata.
|
|
107
153
|
*
|
|
108
154
|
* @param allowedTools - Exact tool names permitted for this agent.
|
|
109
155
|
* Pass an empty array to allow all tools (permissive mode).
|
|
110
|
-
* @returns
|
|
156
|
+
* @returns A {@link CleoInputGuardrail} ready to attach to an agent.
|
|
111
157
|
*
|
|
112
158
|
* @example
|
|
113
159
|
* ```typescript
|
|
114
160
|
* const guard = buildToolAllowlistGuardrail(['read', 'write']);
|
|
115
161
|
* ```
|
|
116
162
|
*/
|
|
117
|
-
export function buildToolAllowlistGuardrail(allowedTools: string[]):
|
|
163
|
+
export function buildToolAllowlistGuardrail(allowedTools: string[]): CleoInputGuardrail {
|
|
118
164
|
return {
|
|
119
165
|
name: 'cleo_tool_allowlist',
|
|
120
|
-
execute: async (
|
|
121
|
-
_args: InputGuardrailFunctionArgs,
|
|
122
|
-
): Promise<{ tripwireTriggered: boolean; outputInfo: unknown }> => {
|
|
166
|
+
execute: async (_args: CleoInputGuardrailFunctionArgs): Promise<CleoGuardrailResult> => {
|
|
123
167
|
// Structural enforcement: only listed tools are attached to the agent.
|
|
124
168
|
// This guardrail records the allowlist for audit and always passes.
|
|
125
169
|
return {
|
|
@@ -134,7 +178,7 @@ export function buildToolAllowlistGuardrail(allowedTools: string[]): InputGuardr
|
|
|
134
178
|
* Build the default CLEO guardrail set from spawn options.
|
|
135
179
|
*
|
|
136
180
|
* Combines path ACL and tool allowlist guards into a single array ready to
|
|
137
|
-
* pass as `inputGuardrails` on an
|
|
181
|
+
* pass as `inputGuardrails` on an agent topology build.
|
|
138
182
|
*
|
|
139
183
|
* @param allowedGlobs - File-path glob allowlist.
|
|
140
184
|
* @param allowedTools - Tool name allowlist.
|
|
@@ -143,8 +187,8 @@ export function buildToolAllowlistGuardrail(allowedTools: string[]): InputGuardr
|
|
|
143
187
|
export function buildDefaultGuardrails(
|
|
144
188
|
allowedGlobs: string[],
|
|
145
189
|
allowedTools: string[],
|
|
146
|
-
):
|
|
147
|
-
const guards:
|
|
190
|
+
): CleoInputGuardrail[] {
|
|
191
|
+
const guards: CleoInputGuardrail[] = [];
|
|
148
192
|
|
|
149
193
|
if (allowedGlobs.length > 0) {
|
|
150
194
|
guards.push(buildPathGuardrail(allowedGlobs));
|
|
@@ -156,3 +200,40 @@ export function buildDefaultGuardrails(
|
|
|
156
200
|
|
|
157
201
|
return guards;
|
|
158
202
|
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Evaluate a set of CLEO input guardrails against an input payload.
|
|
206
|
+
*
|
|
207
|
+
* Runs every guardrail in sequence and returns the first tripwire result.
|
|
208
|
+
* When no guardrail trips, returns a passing result with diagnostic data
|
|
209
|
+
* aggregated from each guardrail's `outputInfo`.
|
|
210
|
+
*
|
|
211
|
+
* @param guardrails - Guardrails to evaluate.
|
|
212
|
+
* @param input - The input string to test (typically the enriched prompt).
|
|
213
|
+
* @returns Aggregated guardrail result.
|
|
214
|
+
*/
|
|
215
|
+
export async function evaluateGuardrails(
|
|
216
|
+
guardrails: CleoInputGuardrail[],
|
|
217
|
+
input: string,
|
|
218
|
+
): Promise<CleoGuardrailResult> {
|
|
219
|
+
const aggregate: Array<{ name: string; outputInfo: unknown }> = [];
|
|
220
|
+
|
|
221
|
+
for (const guard of guardrails) {
|
|
222
|
+
const result = await guard.execute({
|
|
223
|
+
agent: null,
|
|
224
|
+
input,
|
|
225
|
+
context: null,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
if (result.tripwireTriggered) {
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
aggregate.push({ name: guard.name, outputInfo: result.outputInfo });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
tripwireTriggered: false,
|
|
237
|
+
outputInfo: aggregate,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
@@ -1,20 +1,56 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CLEO Team topology →
|
|
2
|
+
* CLEO Team topology → lead/worker agent descriptors.
|
|
3
3
|
*
|
|
4
|
-
* CLEO agents are organised in a Lead → Worker hierarchy.
|
|
5
|
-
*
|
|
4
|
+
* CLEO agents are organised in a Lead → Worker hierarchy. Historically this
|
|
5
|
+
* was wired into the `@openai/agents` first-class `handoffs` graph. Post T933
|
|
6
|
+
* (ADR-052 — Vercel AI SDK consolidation) CLEO owns the topology entirely:
|
|
6
7
|
*
|
|
7
|
-
* - A Team Lead
|
|
8
|
+
* - A Team Lead is a {@link CleoAgent} whose `handoffs` array lists its workers.
|
|
8
9
|
* - Each Worker archetype (read-only, write, bash) is declared in
|
|
9
10
|
* `WORKER_ARCHETYPES` and built on demand.
|
|
10
11
|
* - The mapping is driven by `SpawnContext.options.handoffs`, which is an
|
|
11
12
|
* array of worker archetype names.
|
|
13
|
+
* - When a lead agent needs to delegate, the spawn provider runs a separate
|
|
14
|
+
* `generateText` call for the selected worker and injects the result back
|
|
15
|
+
* into the lead's context.
|
|
12
16
|
*
|
|
13
|
-
* @task T582
|
|
17
|
+
* @task T582 (original)
|
|
18
|
+
* @task T933 (SDK consolidation — CLEO-native topology)
|
|
14
19
|
*/
|
|
15
20
|
|
|
16
|
-
import type {
|
|
17
|
-
|
|
21
|
+
import type { CleoInputGuardrail } from './guardrails.js';
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// CLEO-native agent shape
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Agent descriptor used by the CLEO OpenAI adapter.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Intentionally mirrors the subset of `@openai/agents`'s `Agent` that CLEO
|
|
32
|
+
* actually consumed. The Vercel AI SDK delivers model inference via
|
|
33
|
+
* `generateText` / `streamText`; handoffs are orchestrated by the spawn
|
|
34
|
+
* provider using this descriptor as input.
|
|
35
|
+
*/
|
|
36
|
+
export interface CleoAgent {
|
|
37
|
+
/** Agent identifier surfaced in trace spans. */
|
|
38
|
+
name: string;
|
|
39
|
+
/** System-level instructions fed to the model. */
|
|
40
|
+
instructions: string;
|
|
41
|
+
/** Vercel AI SDK model identifier (e.g. `gpt-4.1`, `gpt-4.1-mini`). */
|
|
42
|
+
model: string;
|
|
43
|
+
/** Workers this agent may delegate to. Undefined when the agent is a leaf. */
|
|
44
|
+
handoffs?: CleoAgent[];
|
|
45
|
+
/** Input guardrails evaluated before the model call. */
|
|
46
|
+
inputGuardrails?: CleoInputGuardrail[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Use {@link CleoAgent}. Legacy alias for callers that imported
|
|
51
|
+
* the `Agent` type from this module. Removed in a future major.
|
|
52
|
+
*/
|
|
53
|
+
export type Agent = CleoAgent;
|
|
18
54
|
|
|
19
55
|
// ---------------------------------------------------------------------------
|
|
20
56
|
// Worker archetypes
|
|
@@ -24,12 +60,12 @@ import { Agent } from '@openai/agents';
|
|
|
24
60
|
* Descriptor for a pre-configured worker agent archetype.
|
|
25
61
|
*
|
|
26
62
|
* Archetypes are declarative templates. `buildWorkerAgent` inflates them into
|
|
27
|
-
* live
|
|
63
|
+
* live {@link CleoAgent} instances.
|
|
28
64
|
*/
|
|
29
65
|
export interface WorkerArchetype {
|
|
30
|
-
/** Archetype identifier (also used as
|
|
66
|
+
/** Archetype identifier (also used as agent name). */
|
|
31
67
|
name: string;
|
|
32
|
-
/** Short description passed as the
|
|
68
|
+
/** Short description passed as the agent instructions. */
|
|
33
69
|
instructions: string;
|
|
34
70
|
/** Preferred model for this archetype. */
|
|
35
71
|
model: string;
|
|
@@ -67,49 +103,49 @@ export const WORKER_ARCHETYPES: Record<string, WorkerArchetype> = {
|
|
|
67
103
|
// ---------------------------------------------------------------------------
|
|
68
104
|
|
|
69
105
|
/**
|
|
70
|
-
* Build a worker
|
|
106
|
+
* Build a worker {@link CleoAgent} from a named archetype.
|
|
71
107
|
*
|
|
72
108
|
* @param archetypeName - Key in {@link WORKER_ARCHETYPES}.
|
|
73
109
|
* @param guardrails - Input guardrails to attach to the worker agent.
|
|
74
|
-
* @returns A configured
|
|
110
|
+
* @returns A configured agent descriptor or `null` when the archetype is unknown.
|
|
75
111
|
*/
|
|
76
112
|
export function buildWorkerAgent(
|
|
77
113
|
archetypeName: string,
|
|
78
|
-
guardrails:
|
|
79
|
-
):
|
|
114
|
+
guardrails: CleoInputGuardrail[],
|
|
115
|
+
): CleoAgent | null {
|
|
80
116
|
const archetype = WORKER_ARCHETYPES[archetypeName];
|
|
81
117
|
if (!archetype) return null;
|
|
82
118
|
|
|
83
|
-
return
|
|
119
|
+
return {
|
|
84
120
|
name: archetype.name,
|
|
85
121
|
instructions: archetype.instructions,
|
|
86
122
|
model: archetype.model,
|
|
87
|
-
|
|
88
|
-
}
|
|
123
|
+
...(guardrails.length > 0 ? { inputGuardrails: guardrails } : {}),
|
|
124
|
+
};
|
|
89
125
|
}
|
|
90
126
|
|
|
91
127
|
/**
|
|
92
|
-
* Build a team lead
|
|
128
|
+
* Build a team lead {@link CleoAgent} whose `handoffs` reference the given workers.
|
|
93
129
|
*
|
|
94
130
|
* @param leadInstructions - System instructions for the lead agent.
|
|
95
131
|
* @param leadModel - Model to use for the lead agent.
|
|
96
132
|
* @param workers - Worker agents this lead can hand off to.
|
|
97
133
|
* @param guardrails - Input guardrails to attach to the lead agent.
|
|
98
|
-
* @returns A configured lead
|
|
134
|
+
* @returns A configured lead agent descriptor.
|
|
99
135
|
*/
|
|
100
136
|
export function buildLeadAgent(
|
|
101
137
|
leadInstructions: string,
|
|
102
138
|
leadModel: string,
|
|
103
|
-
workers:
|
|
104
|
-
guardrails:
|
|
105
|
-
):
|
|
106
|
-
return
|
|
139
|
+
workers: CleoAgent[],
|
|
140
|
+
guardrails: CleoInputGuardrail[],
|
|
141
|
+
): CleoAgent {
|
|
142
|
+
return {
|
|
107
143
|
name: 'cleo-lead',
|
|
108
144
|
instructions: leadInstructions,
|
|
109
145
|
model: leadModel,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
146
|
+
...(workers.length > 0 ? { handoffs: workers } : {}),
|
|
147
|
+
...(guardrails.length > 0 ? { inputGuardrails: guardrails } : {}),
|
|
148
|
+
};
|
|
113
149
|
}
|
|
114
150
|
|
|
115
151
|
/**
|
|
@@ -121,19 +157,19 @@ export function buildLeadAgent(
|
|
|
121
157
|
* @param instructions - Agent system instructions.
|
|
122
158
|
* @param model - Model identifier.
|
|
123
159
|
* @param guardrails - Input guardrails.
|
|
124
|
-
* @returns A configured
|
|
160
|
+
* @returns A configured agent descriptor.
|
|
125
161
|
*/
|
|
126
162
|
export function buildStandaloneAgent(
|
|
127
163
|
instructions: string,
|
|
128
164
|
model: string,
|
|
129
|
-
guardrails:
|
|
130
|
-
):
|
|
131
|
-
return
|
|
165
|
+
guardrails: CleoInputGuardrail[],
|
|
166
|
+
): CleoAgent {
|
|
167
|
+
return {
|
|
132
168
|
name: 'cleo-worker',
|
|
133
169
|
instructions,
|
|
134
170
|
model,
|
|
135
|
-
|
|
136
|
-
}
|
|
171
|
+
...(guardrails.length > 0 ? { inputGuardrails: guardrails } : {}),
|
|
172
|
+
};
|
|
137
173
|
}
|
|
138
174
|
|
|
139
175
|
// ---------------------------------------------------------------------------
|
|
@@ -151,7 +187,7 @@ export interface TopologyOptions {
|
|
|
151
187
|
/** Names of worker archetypes to create and attach as handoffs. */
|
|
152
188
|
handoffNames: string[];
|
|
153
189
|
/** Input guardrails shared across all agents in the topology. */
|
|
154
|
-
guardrails:
|
|
190
|
+
guardrails: CleoInputGuardrail[];
|
|
155
191
|
}
|
|
156
192
|
|
|
157
193
|
/**
|
|
@@ -164,9 +200,9 @@ export interface TopologyOptions {
|
|
|
164
200
|
* Unknown archetype names in `handoffNames` are silently skipped.
|
|
165
201
|
*
|
|
166
202
|
* @param options - Topology build options.
|
|
167
|
-
* @returns The entry-point agent
|
|
203
|
+
* @returns The entry-point agent descriptor.
|
|
168
204
|
*/
|
|
169
|
-
export function buildAgentTopology(options: TopologyOptions):
|
|
205
|
+
export function buildAgentTopology(options: TopologyOptions): CleoAgent {
|
|
170
206
|
const { instructions, model, tier, handoffNames, guardrails } = options;
|
|
171
207
|
|
|
172
208
|
if (tier === 'worker') {
|
|
@@ -174,9 +210,9 @@ export function buildAgentTopology(options: TopologyOptions): Agent {
|
|
|
174
210
|
}
|
|
175
211
|
|
|
176
212
|
// Build worker agents from archetype names; skip unknown names.
|
|
177
|
-
const workers:
|
|
213
|
+
const workers: CleoAgent[] = handoffNames
|
|
178
214
|
.map((name) => buildWorkerAgent(name, guardrails))
|
|
179
|
-
.filter((a): a is
|
|
215
|
+
.filter((a): a is CleoAgent => a !== null);
|
|
180
216
|
|
|
181
217
|
if (workers.length === 0) {
|
|
182
218
|
// Lead with no workers — still usable as a standalone agent.
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
*
|
|
4
|
-
* CLEO provider adapter for the OpenAI
|
|
4
|
+
* CLEO provider adapter for the OpenAI provider, backed by the Vercel AI SDK.
|
|
5
5
|
* Default export is the adapter class for dynamic loading by AdapterManager.
|
|
6
6
|
*
|
|
7
|
-
* @task T582
|
|
7
|
+
* @task T582 (original)
|
|
8
|
+
* @task T933 (SDK consolidation — Vercel AI SDK migration)
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import { OpenAiSdkAdapter } from './adapter.js';
|
|
11
12
|
|
|
12
13
|
export { OpenAiSdkAdapter } from './adapter.js';
|
|
14
|
+
export type {
|
|
15
|
+
CleoGuardrailResult,
|
|
16
|
+
CleoInputGuardrail,
|
|
17
|
+
CleoInputGuardrailFunctionArgs,
|
|
18
|
+
InputGuardrail,
|
|
19
|
+
} from './guardrails.js';
|
|
13
20
|
export {
|
|
14
21
|
buildDefaultGuardrails,
|
|
15
22
|
buildPathGuardrail,
|
|
16
23
|
buildToolAllowlistGuardrail,
|
|
24
|
+
evaluateGuardrails,
|
|
17
25
|
isPathAllowed,
|
|
18
26
|
} from './guardrails.js';
|
|
19
|
-
export type { TopologyOptions, WorkerArchetype } from './handoff.js';
|
|
27
|
+
export type { Agent, CleoAgent, TopologyOptions, WorkerArchetype } from './handoff.js';
|
|
20
28
|
export {
|
|
21
29
|
buildAgentTopology,
|
|
22
30
|
buildLeadAgent,
|
|
@@ -26,7 +34,23 @@ export {
|
|
|
26
34
|
} from './handoff.js';
|
|
27
35
|
export { OpenAiSdkInstallProvider } from './install.js';
|
|
28
36
|
export type { OpenAiSdkSpawnOptions } from './spawn.js';
|
|
29
|
-
export {
|
|
37
|
+
export {
|
|
38
|
+
OpenAiSdkSpawnProvider,
|
|
39
|
+
registerTraceProcessor,
|
|
40
|
+
setTracingDisabled,
|
|
41
|
+
unregisterTraceProcessor,
|
|
42
|
+
} from './spawn.js';
|
|
43
|
+
export type {
|
|
44
|
+
CleoAgentSpanData,
|
|
45
|
+
CleoFunctionSpanData,
|
|
46
|
+
CleoGenericSpanData,
|
|
47
|
+
CleoHandoffSpanData,
|
|
48
|
+
CleoSpan,
|
|
49
|
+
CleoSpanData,
|
|
50
|
+
CleoSpanKind,
|
|
51
|
+
CleoTrace,
|
|
52
|
+
CleoTraceProcessor,
|
|
53
|
+
} from './tracing.js';
|
|
30
54
|
export { CleoConduitTraceProcessor } from './tracing.js';
|
|
31
55
|
|
|
32
56
|
export default OpenAiSdkAdapter;
|
|
@@ -16,7 +16,7 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
|
|
|
16
16
|
const INSTRUCTION_REFERENCES = ['@~/.cleo/templates/CLEO-INJECTION.md', '@.cleo/memory-bridge.md'];
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Install provider for the OpenAI
|
|
19
|
+
* Install provider for the OpenAI SDK adapter (Vercel AI SDK).
|
|
20
20
|
*
|
|
21
21
|
* Manages CLEO's integration with OpenAI SDK projects by:
|
|
22
22
|
* 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "openai-sdk",
|
|
3
|
-
"name": "OpenAI
|
|
4
|
-
"version": "
|
|
5
|
-
"description": "CLEO adapter for the
|
|
3
|
+
"name": "OpenAI SDK (Vercel AI SDK)",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"description": "CLEO adapter for OpenAI via the Vercel AI SDK with CLEO-native handoffs and multi-model support",
|
|
6
6
|
"provider": "openai-sdk",
|
|
7
7
|
"entryPoint": "src/providers/openai-sdk/index.ts",
|
|
8
8
|
"capabilities": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"provider.openai.tracingEnabled": {
|
|
36
36
|
"type": "boolean",
|
|
37
37
|
"default": true,
|
|
38
|
-
"description": "Whether to write
|
|
38
|
+
"description": "Whether to write adapter span events to conduit.db"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"detectionPatterns": [
|