@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,21 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI
|
|
2
|
+
* OpenAI SDK spawn provider — Vercel AI SDK edition.
|
|
3
|
+
*
|
|
4
|
+
* Implements `AdapterSpawnProvider` using the Vercel AI SDK
|
|
5
|
+
* (`ai` v6 + `@ai-sdk/openai`) instead of the legacy `@openai/agents`. CLEO
|
|
6
|
+
* retains its own orchestration (handoff topology, guardrails, tracing); the
|
|
7
|
+
* SDK is strictly the LLM bridge.
|
|
3
8
|
*
|
|
4
|
-
* Implements `AdapterSpawnProvider` using the `@openai/agents` SDK runner.
|
|
5
9
|
* Unlike the Claude Code provider (detached fire-and-forget), this provider
|
|
6
|
-
* awaits the run and returns `status: 'completed'` or `status: 'failed'`
|
|
7
|
-
*
|
|
10
|
+
* awaits the run and returns `status: 'completed'` or `status: 'failed'` so
|
|
11
|
+
* the orchestrator receives rich output immediately.
|
|
8
12
|
*
|
|
9
13
|
* Key features:
|
|
10
14
|
* - Tier-based model selection (lead → gpt-4.1, worker → gpt-4.1-mini)
|
|
11
|
-
* - Handoff topology built from `SpawnContext.options.handoffs`
|
|
12
|
-
* - CLEO path ACL guardrails
|
|
15
|
+
* - Handoff topology built from `SpawnContext.options.handoffs` (CLEO-native)
|
|
16
|
+
* - CLEO path ACL guardrails evaluated before the model call
|
|
13
17
|
* - Default-on tracing via `CleoConduitTraceProcessor`
|
|
14
18
|
* - CANT prompt enrichment (best-effort, same as Claude Code provider)
|
|
15
19
|
*
|
|
16
|
-
* @task T582
|
|
20
|
+
* @task T582 (original)
|
|
21
|
+
* @task T933 (SDK consolidation — Vercel AI SDK migration)
|
|
22
|
+
* @see ADR-052 — SDK consolidation decision
|
|
17
23
|
*/
|
|
18
24
|
import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/contracts';
|
|
25
|
+
import type { CleoTraceProcessor } from './tracing.js';
|
|
19
26
|
/**
|
|
20
27
|
* OpenAI SDK-specific spawn options carried in `SpawnContext.options`.
|
|
21
28
|
*
|
|
@@ -52,7 +59,7 @@ export interface OpenAiSdkSpawnOptions {
|
|
|
52
59
|
allowedGlobs?: string[];
|
|
53
60
|
/**
|
|
54
61
|
* Tool name allowlist. Tools not in this list are documented but not enforced
|
|
55
|
-
* (enforcement is structural via
|
|
62
|
+
* (enforcement is structural via CLEO orchestration).
|
|
56
63
|
*
|
|
57
64
|
* @defaultValue `[]` (all tools allowed)
|
|
58
65
|
*/
|
|
@@ -69,18 +76,44 @@ export interface OpenAiSdkSpawnOptions {
|
|
|
69
76
|
agentName?: string;
|
|
70
77
|
}
|
|
71
78
|
/**
|
|
72
|
-
*
|
|
79
|
+
* Register a CLEO trace processor. Mirrors `addTraceProcessor` from the
|
|
80
|
+
* legacy `@openai/agents` surface so existing consumers continue to work.
|
|
81
|
+
*
|
|
82
|
+
* @param processor - Processor to register.
|
|
83
|
+
*/
|
|
84
|
+
export declare function registerTraceProcessor(processor: CleoTraceProcessor): void;
|
|
85
|
+
/**
|
|
86
|
+
* Remove a previously registered trace processor.
|
|
87
|
+
*
|
|
88
|
+
* @param processor - Processor to remove.
|
|
89
|
+
*/
|
|
90
|
+
export declare function unregisterTraceProcessor(processor: CleoTraceProcessor): void;
|
|
91
|
+
/**
|
|
92
|
+
* Enable or disable global tracing. Equivalent to `setTracingDisabled` from
|
|
93
|
+
* the legacy `@openai/agents` surface.
|
|
94
|
+
*
|
|
95
|
+
* @param disabled - When true, no spans are emitted.
|
|
96
|
+
*/
|
|
97
|
+
export declare function setTracingDisabled(disabled: boolean): void;
|
|
98
|
+
/**
|
|
99
|
+
* Spawn provider for the Vercel AI SDK (OpenAI flavour).
|
|
73
100
|
*
|
|
74
|
-
* Spawns SDK-backed agent runs for a given `SpawnContext`. The run is
|
|
75
|
-
*
|
|
76
|
-
* `status: 'completed'` or `status: 'failed'`. In-flight runs are tracked
|
|
77
|
-
*
|
|
101
|
+
* Spawns SDK-backed agent runs for a given `SpawnContext`. The run is awaited
|
|
102
|
+
* synchronously and the result mapped to a `SpawnResult` with
|
|
103
|
+
* `status: 'completed'` or `status: 'failed'`. In-flight runs are tracked by
|
|
104
|
+
* instance ID so `listRunning()` and `terminate()` work correctly.
|
|
78
105
|
*
|
|
79
106
|
* @remarks
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
107
|
+
* Handoff topology is resolved by this provider, not the SDK. When the entry
|
|
108
|
+
* agent is a lead with workers, the provider:
|
|
109
|
+
*
|
|
110
|
+
* 1. Runs the lead agent's `generateText` with the enriched prompt.
|
|
111
|
+
* 2. For each worker listed in handoffs, runs a sequential `generateText`
|
|
112
|
+
* using the worker's archetype model, passing the lead's output as the
|
|
113
|
+
* worker prompt. Results are concatenated.
|
|
114
|
+
*
|
|
115
|
+
* This preserves the visible behaviour of the legacy `@openai/agents` runner
|
|
116
|
+
* while keeping CLEO as the orchestration owner.
|
|
84
117
|
*
|
|
85
118
|
* @example
|
|
86
119
|
* ```typescript
|
|
@@ -105,7 +138,7 @@ export declare class OpenAiSdkSpawnProvider implements AdapterSpawnProvider {
|
|
|
105
138
|
*/
|
|
106
139
|
canSpawn(): Promise<boolean>;
|
|
107
140
|
/**
|
|
108
|
-
* Spawn a subagent via the
|
|
141
|
+
* Spawn a subagent via the Vercel AI SDK.
|
|
109
142
|
*
|
|
110
143
|
* Awaits the run to completion and returns a fully-resolved `SpawnResult`.
|
|
111
144
|
*
|
|
@@ -122,9 +155,9 @@ export declare class OpenAiSdkSpawnProvider implements AdapterSpawnProvider {
|
|
|
122
155
|
/**
|
|
123
156
|
* Terminate a running spawn by instance ID.
|
|
124
157
|
*
|
|
125
|
-
* The
|
|
126
|
-
*
|
|
127
|
-
* no longer appear in `listRunning()`.
|
|
158
|
+
* The Vercel AI SDK does not support external termination of in-flight
|
|
159
|
+
* requests; this method removes the instance from the tracking set so it
|
|
160
|
+
* will no longer appear in `listRunning()`.
|
|
128
161
|
*
|
|
129
162
|
* @param instanceId - ID of the spawn instance to terminate.
|
|
130
163
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/spawn.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAK3F,OAAO,KAAK,EAAY,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOjE;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,cAAc,CAAC;IAE1C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE1D;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IAEtD;;;;;;OAMG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC;;;;;;;OAOG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAwFxD;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAU3C;;;;;;;;OAQG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlD;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAwBpB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -1,24 +1,90 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CLEO trace processor that writes spans to conduit.db.
|
|
3
3
|
*
|
|
4
|
-
* `CleoConduitTraceProcessor` implements
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `CleoConduitTraceProcessor` implements a CLEO-native tracing processor
|
|
5
|
+
* interface that records spans emitted by the OpenAI SDK adapter. Post T933
|
|
6
|
+
* (ADR-052 — Vercel AI SDK consolidation) the processor no longer implements
|
|
7
|
+
* `@openai/agents` type surfaces; instead it consumes `CleoSpan` events
|
|
8
|
+
* produced by `OpenAiSdkSpawnProvider` during a run.
|
|
7
9
|
*
|
|
8
10
|
* Tracing is on by default for all OpenAI SDK spawns. Set
|
|
9
11
|
* `options.tracingDisabled = true` in `SpawnContext.options` to opt out when
|
|
10
12
|
* conduit is unavailable.
|
|
11
13
|
*
|
|
12
|
-
* @task T582
|
|
14
|
+
* @task T582 (original)
|
|
15
|
+
* @task T933 (SDK consolidation — provider-neutral rewrite)
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
/** Span category emitted by the OpenAI SDK adapter. */
|
|
18
|
+
export type CleoSpanKind = 'agent' | 'handoff' | 'function' | 'model' | 'custom';
|
|
15
19
|
/**
|
|
16
|
-
* CLEO
|
|
20
|
+
* CLEO-native span payload produced by the OpenAI SDK adapter.
|
|
17
21
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
+
* @remarks
|
|
23
|
+
* Intentionally mirrors the subset of `@openai/agents` span data CLEO
|
|
24
|
+
* actually consumed, rebuilt as a provider-neutral record.
|
|
25
|
+
*/
|
|
26
|
+
export interface CleoSpan {
|
|
27
|
+
/** Deterministic span identifier. */
|
|
28
|
+
spanId: string;
|
|
29
|
+
/** ISO timestamp when the span started. */
|
|
30
|
+
startedAt?: string;
|
|
31
|
+
/** ISO timestamp when the span ended. */
|
|
32
|
+
endedAt?: string;
|
|
33
|
+
/** Structured span data (type discriminates payload shape). */
|
|
34
|
+
spanData?: CleoSpanData;
|
|
35
|
+
}
|
|
36
|
+
/** Agent-kind span payload. */
|
|
37
|
+
export interface CleoAgentSpanData {
|
|
38
|
+
type: 'agent';
|
|
39
|
+
name: string;
|
|
40
|
+
}
|
|
41
|
+
/** Handoff-kind span payload (agent delegation). */
|
|
42
|
+
export interface CleoHandoffSpanData {
|
|
43
|
+
type: 'handoff';
|
|
44
|
+
from_agent?: string;
|
|
45
|
+
to_agent?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Function-kind span payload (tool invocation). */
|
|
48
|
+
export interface CleoFunctionSpanData {
|
|
49
|
+
type: 'function';
|
|
50
|
+
name: string;
|
|
51
|
+
}
|
|
52
|
+
/** Catch-all for future span kinds. */
|
|
53
|
+
export interface CleoGenericSpanData {
|
|
54
|
+
type: Exclude<CleoSpanKind, 'agent' | 'handoff' | 'function'>;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
/** Tagged union of all span payloads. */
|
|
58
|
+
export type CleoSpanData = CleoAgentSpanData | CleoHandoffSpanData | CleoFunctionSpanData | CleoGenericSpanData;
|
|
59
|
+
/** CLEO-native trace envelope — currently opaque to the processor. */
|
|
60
|
+
export interface CleoTrace {
|
|
61
|
+
/** Trace identifier. */
|
|
62
|
+
traceId?: string;
|
|
63
|
+
/** Free-form metadata. */
|
|
64
|
+
metadata?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* CLEO-native trace processor contract.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* Replaces `TracingProcessor` from `@openai/agents`. The shape is compatible
|
|
71
|
+
* with the legacy interface so downstream consumers can continue to invoke
|
|
72
|
+
* the same methods.
|
|
73
|
+
*/
|
|
74
|
+
export interface CleoTraceProcessor {
|
|
75
|
+
onTraceStart(trace: CleoTrace): Promise<void>;
|
|
76
|
+
onTraceEnd(trace: CleoTrace): Promise<void>;
|
|
77
|
+
onSpanStart(span: CleoSpan): Promise<void>;
|
|
78
|
+
onSpanEnd(span: CleoSpan): Promise<void>;
|
|
79
|
+
shutdown(timeout?: number): Promise<void>;
|
|
80
|
+
forceFlush(): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* CLEO trace processor that persists OpenAI SDK adapter spans to conduit.db.
|
|
84
|
+
*
|
|
85
|
+
* Each `onSpanEnd` call extracts span metadata and enqueues a write to conduit
|
|
86
|
+
* via the shared `conduit-trace-writer` module. Writes are fire-and-forget —
|
|
87
|
+
* failures are logged but never propagated to the caller.
|
|
22
88
|
*
|
|
23
89
|
* @remarks
|
|
24
90
|
* `onTraceEnd` performs a batch flush of any buffered spans. Individual
|
|
@@ -27,14 +93,14 @@ import type { Span, SpanData, Trace, TracingProcessor } from '@openai/agents';
|
|
|
27
93
|
*
|
|
28
94
|
* @example
|
|
29
95
|
* ```typescript
|
|
30
|
-
* import {
|
|
96
|
+
* import { registerTraceProcessor } from './spawn.js';
|
|
31
97
|
* import { CleoConduitTraceProcessor } from './tracing.js';
|
|
32
98
|
*
|
|
33
99
|
* const processor = new CleoConduitTraceProcessor('T582');
|
|
34
|
-
*
|
|
100
|
+
* registerTraceProcessor(processor);
|
|
35
101
|
* ```
|
|
36
102
|
*/
|
|
37
|
-
export declare class CleoConduitTraceProcessor implements
|
|
103
|
+
export declare class CleoConduitTraceProcessor implements CleoTraceProcessor {
|
|
38
104
|
/** CLEO task ID included in every span event for correlation. */
|
|
39
105
|
private readonly taskId;
|
|
40
106
|
/** Pending span events buffered within the current trace. */
|
|
@@ -48,25 +114,25 @@ export declare class CleoConduitTraceProcessor implements TracingProcessor {
|
|
|
48
114
|
*
|
|
49
115
|
* @param _trace - The trace that just started (unused).
|
|
50
116
|
*/
|
|
51
|
-
onTraceStart(_trace:
|
|
117
|
+
onTraceStart(_trace: CleoTrace): Promise<void>;
|
|
52
118
|
/**
|
|
53
119
|
* Called when a trace ends. Flushes all pending span events to conduit.
|
|
54
120
|
*
|
|
55
121
|
* @param _trace - The trace that just ended (unused — spans were captured via `onSpanEnd`).
|
|
56
122
|
*/
|
|
57
|
-
onTraceEnd(_trace:
|
|
123
|
+
onTraceEnd(_trace: CleoTrace): Promise<void>;
|
|
58
124
|
/**
|
|
59
125
|
* Called when a new span starts. No-op — we capture on end to have full timing.
|
|
60
126
|
*
|
|
61
127
|
* @param _span - The span that just started (unused).
|
|
62
128
|
*/
|
|
63
|
-
onSpanStart(_span:
|
|
129
|
+
onSpanStart(_span: CleoSpan): Promise<void>;
|
|
64
130
|
/**
|
|
65
131
|
* Called when a span ends. Serialises and writes the span to conduit.
|
|
66
132
|
*
|
|
67
|
-
* @param span - The completed span from the
|
|
133
|
+
* @param span - The completed span from the adapter.
|
|
68
134
|
*/
|
|
69
|
-
onSpanEnd(span:
|
|
135
|
+
onSpanEnd(span: CleoSpan): Promise<void>;
|
|
70
136
|
/**
|
|
71
137
|
* Called during graceful shutdown. Flushes any remaining pending events.
|
|
72
138
|
*
|
|
@@ -78,10 +144,10 @@ export declare class CleoConduitTraceProcessor implements TracingProcessor {
|
|
|
78
144
|
*/
|
|
79
145
|
forceFlush(): Promise<void>;
|
|
80
146
|
/**
|
|
81
|
-
* Extract a {@link ConduitSpanEvent} from an
|
|
147
|
+
* Extract a {@link ConduitSpanEvent} from an adapter span, or `null` if the
|
|
82
148
|
* span cannot be meaningfully serialised.
|
|
83
149
|
*
|
|
84
|
-
* @param span - The
|
|
150
|
+
* @param span - The adapter span to serialise.
|
|
85
151
|
* @returns A conduit span event or `null`.
|
|
86
152
|
*/
|
|
87
153
|
private extractSpanEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/tracing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,+BAA+B;AAC/B,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IAC9D,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,yCAAyC;AACzC,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,CAAC;AAExB,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB;IAClE,iEAAiE;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,6DAA6D;IAC7D,OAAO,CAAC,aAAa,CAA0B;IAE/C;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlD;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;;;OAIG;IACG,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9C;;;;OAIG;IACG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAWjC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;CAuCzB"}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared SDK result mapper for CLEO spawn providers.
|
|
3
3
|
*
|
|
4
|
-
* Normalises provider-specific run results
|
|
4
|
+
* Normalises provider-specific run results from the Vercel AI SDK bridge
|
|
5
5
|
* into the canonical {@link SpawnResult} contract used by CLEO orchestration.
|
|
6
6
|
*
|
|
7
|
-
* Both
|
|
8
|
-
* mapping logic stays DRY.
|
|
7
|
+
* Both the Claude SDK provider (T581) and the OpenAI SDK provider (T582)
|
|
8
|
+
* import from this module so the mapping logic stays DRY.
|
|
9
9
|
*
|
|
10
|
-
* @task T582
|
|
10
|
+
* @task T582 (original)
|
|
11
|
+
* @task T933 (SDK consolidation — Vercel AI SDK migration)
|
|
11
12
|
*/
|
|
12
13
|
import type { SpawnResult } from '@cleocode/contracts';
|
|
13
14
|
/**
|
|
14
15
|
* Raw run outcome from any SDK provider, normalised before mapping.
|
|
15
16
|
*
|
|
16
17
|
* @remarks
|
|
17
|
-
* Both `@
|
|
18
|
-
* `
|
|
19
|
-
* minimal shared shape so the mapper stays
|
|
18
|
+
* Both `@ai-sdk/anthropic` and `@ai-sdk/openai` (via Vercel AI SDK
|
|
19
|
+
* `generateText`) surface a `text` string plus an optional error. This
|
|
20
|
+
* interface captures the minimal shared shape so the mapper stays
|
|
21
|
+
* provider-agnostic.
|
|
20
22
|
*/
|
|
21
23
|
export interface RawSdkRunOutcome {
|
|
22
24
|
/** Final text produced by the agent run. Empty string when the run failed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-result-mapper.d.ts","sourceRoot":"","sources":["../../../src/providers/shared/sdk-result-mapper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sdk-result-mapper.d.ts","sourceRoot":"","sources":["../../../src/providers/shared/sdk-result-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,GACxB,WAAW,CAwBb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/adapters",
|
|
3
|
-
"version": "2026.4.
|
|
3
|
+
"version": "2026.4.94",
|
|
4
4
|
"description": "Unified provider adapters for CLEO (Claude Code, OpenCode, Cursor)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@openai
|
|
17
|
-
"
|
|
18
|
-
"@cleocode/
|
|
15
|
+
"@ai-sdk/anthropic": "^3.0.69",
|
|
16
|
+
"@ai-sdk/openai": "^2.0.53",
|
|
17
|
+
"ai": "^6.0.168",
|
|
18
|
+
"@cleocode/caamp": "2026.4.94",
|
|
19
|
+
"@cleocode/contracts": "2026.4.94"
|
|
19
20
|
},
|
|
20
21
|
"license": "MIT",
|
|
21
22
|
"engines": {
|