@ai-sdk/harness-codex 1.0.158 → 1.0.160

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.
@@ -11,7 +11,6 @@ import {
11
11
  type HarnessV1ContinueTurnState,
12
12
  type HarnessV1CredentialForwarding,
13
13
  type HarnessV1MintBridgeTokenCallback,
14
- type HarnessV1Prompt,
15
14
  type HarnessV1PromptControl,
16
15
  type HarnessV1PortEndpoint,
17
16
  type HarnessV1ResumeSessionState,
@@ -32,6 +31,7 @@ import {
32
31
  createBridgeStartupError,
33
32
  experimental_createBridgeUserMessageSubmitter,
34
33
  drainBridgeProcessStream,
34
+ extractHarnessPromptContent,
35
35
  forwardBridgeProcessStream,
36
36
  getRestrictedSandboxSession,
37
37
  markBridgeStarting,
@@ -1028,7 +1028,9 @@ function createSession({
1028
1028
 
1029
1029
  const startMessage = {
1030
1030
  type: 'start' as const,
1031
- prompt: extractUserText(promptOpts.prompt),
1031
+ prompt: extractHarnessPromptContent({
1032
+ prompt: promptOpts.prompt,
1033
+ }),
1032
1034
  tools,
1033
1035
  ...(promptOpts.responseFormat == null
1034
1036
  ? {}
@@ -1372,26 +1374,3 @@ function fingerprintCodexTurnConfiguration({
1372
1374
  );
1373
1375
  return `v2:${createHash('sha256').update(canonical).digest('hex')}`;
1374
1376
  }
1375
-
1376
- /*
1377
- * Reduce a `HarnessV1Prompt` to the plain user text the bridge forwards to
1378
- * Codex. The adapter does not yet map file and image parts into app-server
1379
- * turn input, so throw rather than silently dropping them and producing a
1380
- * truncated prompt.
1381
- */
1382
- function extractUserText(prompt: HarnessV1Prompt): string {
1383
- if (typeof prompt === 'string') return prompt;
1384
- const { content } = prompt;
1385
- if (typeof content === 'string') return content;
1386
- const parts: string[] = [];
1387
- for (const part of content) {
1388
- if (part.type !== 'text') {
1389
- throw new HarnessCapabilityUnsupportedError({
1390
- harnessId: 'codex',
1391
- message: `The codex harness does not yet support user message parts of type '${part.type}'. Pass a string or a user message whose content contains only text parts.`,
1392
- });
1393
- }
1394
- parts.push(part.text);
1395
- }
1396
- return parts.join('\n\n');
1397
- }