@janole/ai-sdk-provider-codex-asp 0.4.1 → 0.4.3

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.cts CHANGED
@@ -15,10 +15,20 @@ type JsonValue = number | string | boolean | Array<JsonValue> | {
15
15
  [key in string]?: JsonValue;
16
16
  } | null;
17
17
 
18
+ /**
19
+ * Configures who approval requests are routed to for review. Examples
20
+ * include sandbox escapes, blocked network access, MCP approval prompts, and
21
+ * ARC escalations. Defaults to `user`. `guardian_subagent` uses a carefully
22
+ * prompted subagent to gather relevant context and apply a risk-based
23
+ * decision framework before approving or denying the request.
24
+ */
25
+ type ApprovalsReviewer = "user" | "guardian_subagent";
26
+
18
27
  type AskForApproval = "untrusted" | "on-failure" | "on-request" | {
19
- "reject": {
28
+ "granular": {
20
29
  sandbox_approval: boolean;
21
30
  rules: boolean;
31
+ skill_approval: boolean;
22
32
  request_permissions: boolean;
23
33
  mcp_elicitations: boolean;
24
34
  };
@@ -63,13 +73,18 @@ type MacOsAutomationPermission = "none" | "all" | {
63
73
  "bundle_ids": Array<string>;
64
74
  };
65
75
 
76
+ type MacOsContactsPermission = "none" | "read_only" | "read_write";
77
+
66
78
  type MacOsPreferencesPermission = "none" | "read_only" | "read_write";
67
79
 
68
80
  type AdditionalMacOsPermissions = {
69
81
  preferences: MacOsPreferencesPermission;
70
82
  automations: MacOsAutomationPermission;
83
+ launchServices: boolean;
71
84
  accessibility: boolean;
72
85
  calendar: boolean;
86
+ reminders: boolean;
87
+ contacts: MacOsContactsPermission;
73
88
  };
74
89
 
75
90
  type AdditionalNetworkPermissions = {
@@ -231,7 +246,12 @@ type SandboxPolicy = {
231
246
  */
232
247
  type MessagePhase = "commentary" | "final_answer";
233
248
 
234
- type CollabAgentStatus = "pendingInit" | "running" | "completed" | "errored" | "shutdown" | "notFound";
249
+ /**
250
+ * See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning
251
+ */
252
+ type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
253
+
254
+ type CollabAgentStatus = "pendingInit" | "running" | "interrupted" | "completed" | "errored" | "shutdown" | "notFound";
235
255
 
236
256
  type CollabAgentState = {
237
257
  status: CollabAgentStatus;
@@ -242,6 +262,8 @@ type CollabAgentTool = "spawnAgent" | "sendInput" | "resumeAgent" | "wait" | "cl
242
262
 
243
263
  type CollabAgentToolCallStatus = "inProgress" | "completed" | "failed";
244
264
 
265
+ type CommandExecutionSource = "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction";
266
+
245
267
  type CommandExecutionStatus = "inProgress" | "completed" | "failed" | "declined";
246
268
 
247
269
  type DynamicToolCallOutputContentItem = {
@@ -269,6 +291,11 @@ type FileUpdateChange = {
269
291
  diff: string;
270
292
  };
271
293
 
294
+ type HookPromptFragment = {
295
+ text: string;
296
+ hookRunId: string;
297
+ };
298
+
272
299
  type McpToolCallError = {
273
300
  message: string;
274
301
  };
@@ -280,6 +307,18 @@ type McpToolCallResult = {
280
307
 
281
308
  type McpToolCallStatus = "inProgress" | "completed" | "failed";
282
309
 
310
+ type MemoryCitationEntry = {
311
+ path: string;
312
+ lineStart: number;
313
+ lineEnd: number;
314
+ note: string;
315
+ };
316
+
317
+ type MemoryCitation = {
318
+ entries: Array<MemoryCitationEntry>;
319
+ threadIds: Array<string>;
320
+ };
321
+
283
322
  type PatchApplyStatus = "inProgress" | "completed" | "failed" | "declined";
284
323
 
285
324
  type ByteRange = {
@@ -340,11 +379,16 @@ type ThreadItem = {
340
379
  "type": "userMessage";
341
380
  id: string;
342
381
  content: Array<UserInput>;
382
+ } | {
383
+ "type": "hookPrompt";
384
+ id: string;
385
+ fragments: Array<HookPromptFragment>;
343
386
  } | {
344
387
  "type": "agentMessage";
345
388
  id: string;
346
389
  text: string;
347
390
  phase: MessagePhase | null;
391
+ memoryCitation: MemoryCitation | null;
348
392
  } | {
349
393
  "type": "plan";
350
394
  id: string;
@@ -369,6 +413,7 @@ type ThreadItem = {
369
413
  * Identifier for the underlying PTY process (when available).
370
414
  */
371
415
  processId: string | null;
416
+ source: CommandExecutionSource;
372
417
  status: CommandExecutionStatus;
373
418
  /**
374
419
  * A best-effort parsing of the command to understand the action(s) it will perform.
@@ -445,6 +490,14 @@ type ThreadItem = {
445
490
  * Prompt text sent as part of the collab tool call, when available.
446
491
  */
447
492
  prompt: string | null;
493
+ /**
494
+ * Model requested for the spawned agent, when applicable.
495
+ */
496
+ model: string | null;
497
+ /**
498
+ * Reasoning effort requested for the spawned agent, when applicable.
499
+ */
500
+ reasoningEffort: ReasoningEffort | null;
448
501
  /**
449
502
  * Last known status of the target agents, when available.
450
503
  */
@@ -466,6 +519,7 @@ type ThreadItem = {
466
519
  status: string;
467
520
  revisedPrompt: string | null;
468
521
  result: string;
522
+ savedPath?: string;
469
523
  } | {
470
524
  "type": "enteredReviewMode";
471
525
  id: string;
@@ -509,17 +563,6 @@ type FunctionCallOutputContentItem = {
509
563
 
510
564
  type FunctionCallOutputBody = string | Array<FunctionCallOutputContentItem>;
511
565
 
512
- /**
513
- * The payload we send back to OpenAI when reporting a tool call result.
514
- *
515
- * `body` serializes directly as the wire value for `function_call_output.output`.
516
- * `success` remains internal metadata for downstream handling.
517
- */
518
- type FunctionCallOutputPayload = {
519
- body: FunctionCallOutputBody;
520
- success: boolean | null;
521
- };
522
-
523
566
  /**
524
567
  * Details of a ghost commit created from a repository state.
525
568
  */
@@ -596,12 +639,19 @@ type ResponseItem = {
596
639
  } | {
597
640
  "type": "function_call";
598
641
  name: string;
642
+ namespace?: string;
599
643
  arguments: string;
600
644
  call_id: string;
645
+ } | {
646
+ "type": "tool_search_call";
647
+ call_id: string | null;
648
+ status?: string;
649
+ execution: string;
650
+ arguments: unknown;
601
651
  } | {
602
652
  "type": "function_call_output";
603
653
  call_id: string;
604
- output: FunctionCallOutputPayload;
654
+ output: FunctionCallOutputBody;
605
655
  } | {
606
656
  "type": "custom_tool_call";
607
657
  status?: string;
@@ -611,7 +661,14 @@ type ResponseItem = {
611
661
  } | {
612
662
  "type": "custom_tool_call_output";
613
663
  call_id: string;
614
- output: FunctionCallOutputPayload;
664
+ name?: string;
665
+ output: FunctionCallOutputBody;
666
+ } | {
667
+ "type": "tool_search_output";
668
+ call_id: string | null;
669
+ status: string;
670
+ execution: string;
671
+ tools: unknown[];
615
672
  } | {
616
673
  "type": "web_search_call";
617
674
  status?: string;
@@ -666,6 +723,11 @@ type ThreadResumeParams = {
666
723
  serviceTier?: ServiceTier | null | null;
667
724
  cwd?: string | null;
668
725
  approvalPolicy?: AskForApproval | null;
726
+ /**
727
+ * Override where approval requests are routed for review on this thread
728
+ * and subsequent turns.
729
+ */
730
+ approvalsReviewer?: ApprovalsReviewer | null;
669
731
  sandbox?: SandboxMode | null;
670
732
  config?: {
671
733
  [key in string]?: JsonValue;
@@ -680,23 +742,21 @@ type ThreadResumeParams = {
680
742
  persistExtendedHistory: boolean;
681
743
  };
682
744
 
683
- /**
684
- * See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning
685
- */
686
- type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
687
-
688
745
  type GitInfo = {
689
746
  sha: string | null;
690
747
  branch: string | null;
691
748
  originUrl: string | null;
692
749
  };
693
750
 
751
+ type AgentPath = string;
752
+
694
753
  type ThreadId = string;
695
754
 
696
755
  type SubAgentSource = "review" | "compact" | {
697
756
  "thread_spawn": {
698
757
  parent_thread_id: ThreadId;
699
758
  depth: number;
759
+ agent_path: AgentPath | null;
700
760
  agent_nickname: string | null;
701
761
  agent_role: string | null;
702
762
  };
@@ -705,6 +765,8 @@ type SubAgentSource = "review" | "compact" | {
705
765
  };
706
766
 
707
767
  type SessionSource = "cli" | "vscode" | "exec" | "appServer" | {
768
+ "custom": string;
769
+ } | {
708
770
  "subAgent": SubAgentSource;
709
771
  } | "unknown";
710
772
 
@@ -721,6 +783,8 @@ type ThreadStatus = {
721
783
  activeFlags: Array<ThreadActiveFlag>;
722
784
  };
723
785
 
786
+ type NonSteerableTurnKind = "review" | "compact";
787
+
724
788
  /**
725
789
  * This translation layer make sure that we expose codex error code in camel case.
726
790
  *
@@ -743,6 +807,10 @@ type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOv
743
807
  "responseTooManyFailedAttempts": {
744
808
  httpStatusCode: number | null;
745
809
  };
810
+ } | {
811
+ "activeTurnNotSteerable": {
812
+ turnKind: NonSteerableTurnKind;
813
+ };
746
814
  } | "other";
747
815
 
748
816
  type TurnError = {
@@ -842,6 +910,10 @@ type ThreadResumeResponse = {
842
910
  serviceTier: ServiceTier | null;
843
911
  cwd: string;
844
912
  approvalPolicy: AskForApproval;
913
+ /**
914
+ * Reviewer currently used for approval requests on this thread.
915
+ */
916
+ approvalsReviewer: ApprovalsReviewer;
845
917
  sandbox: SandboxPolicy;
846
918
  reasoningEffort: ReasoningEffort | null;
847
919
  };
@@ -886,6 +958,11 @@ type TurnStartParams = {
886
958
  * Override the approval policy for this turn and subsequent turns.
887
959
  */
888
960
  approvalPolicy?: AskForApproval | null;
961
+ /**
962
+ * Override where approval requests are routed for review on this turn and
963
+ * subsequent turns.
964
+ */
965
+ approvalsReviewer?: ApprovalsReviewer | null;
889
966
  /**
890
967
  * Override the sandbox policy for this turn and subsequent turns.
891
968
  */
@@ -1026,6 +1103,7 @@ interface CodexThreadStartParams {
1026
1103
  model?: string;
1027
1104
  cwd?: string;
1028
1105
  approvalPolicy?: AskForApproval;
1106
+ approvalsReviewer?: ApprovalsReviewer;
1029
1107
  sandbox?: SandboxMode;
1030
1108
  config?: Record<string, JsonValue | undefined>;
1031
1109
  dynamicTools?: CodexDynamicToolDefinition[];
@@ -1366,8 +1444,10 @@ interface TransportContext {
1366
1444
  interface CodexThreadDefaults {
1367
1445
  /** Working directory for the thread. */
1368
1446
  cwd?: string;
1369
- /** Tool-use approval policy — `"never"` | `"on-failure"` | `"on-request"` | `"untrusted"` | `{ reject: … }`. See {@link AskForApproval}. */
1447
+ /** Tool-use approval policy — `"never"` | `"on-failure"` | `"on-request"` | `"untrusted"` | `{ granular: … }`. See {@link AskForApproval}. */
1370
1448
  approvalPolicy?: AskForApproval;
1449
+ /** Routes approval requests for the thread to `"user"` or `"guardian_subagent"`. */
1450
+ approvalsReviewer?: ApprovalsReviewer;
1371
1451
  /** Sandbox mode — `"read-only"` | `"workspace-write"` | `"danger-full-access"`. See {@link SandboxMode}. */
1372
1452
  sandbox?: SandboxMode;
1373
1453
  }
@@ -1377,6 +1457,8 @@ interface CodexTurnDefaults {
1377
1457
  cwd?: string;
1378
1458
  /** Tool-use approval policy for this turn. */
1379
1459
  approvalPolicy?: AskForApproval;
1460
+ /** Routes approval requests for this turn to `"user"` or `"guardian_subagent"`. */
1461
+ approvalsReviewer?: ApprovalsReviewer;
1380
1462
  /** Fine-grained sandbox policy — `{ type: "dangerFullAccess" }` | `{ type: "readOnly", … }` | `{ type: "workspaceWrite", … }` | `{ type: "externalSandbox", … }`. See {@link SandboxPolicy}. */
1381
1463
  sandboxPolicy?: SandboxPolicy;
1382
1464
  /** Model to use for this turn (overrides provider-level `defaultModel`). */
@@ -1394,8 +1476,10 @@ interface CodexTurnDefaults {
1394
1476
  interface CodexCallOptions {
1395
1477
  /** Working directory for this call. Also sent as turn-level `cwd`. */
1396
1478
  cwd?: string;
1397
- /** Tool-use approval policy — `"never"` | `"on-failure"` | `"on-request"` | `"untrusted"` | `{ reject: … }`. See {@link AskForApproval}. */
1479
+ /** Tool-use approval policy — `"never"` | `"on-failure"` | `"on-request"` | `"untrusted"` | `{ granular: … }`. See {@link AskForApproval}. */
1398
1480
  approvalPolicy?: AskForApproval;
1481
+ /** Routes approval requests to `"user"` or `"guardian_subagent"`. */
1482
+ approvalsReviewer?: ApprovalsReviewer;
1399
1483
  /** Sandbox mode — `"read-only"` | `"workspace-write"` | `"danger-full-access"`. See {@link SandboxMode}. */
1400
1484
  sandbox?: SandboxMode;
1401
1485
  /** How much effort the model should spend on the response. */
@@ -1406,6 +1490,11 @@ interface CodexCallOptions {
1406
1490
  sandboxPolicy?: SandboxPolicy;
1407
1491
  /** Controls turn summary generation. */
1408
1492
  summary?: "auto" | "concise" | "detailed" | "none";
1493
+ /** Approval callbacks for this call; falls back to provider-level `approvals`. */
1494
+ approvals?: {
1495
+ onCommandApproval?: CommandApprovalHandler;
1496
+ onFileChangeApproval?: FileChangeApprovalHandler;
1497
+ };
1409
1498
  }
1410
1499
  interface CodexCompactionSettings {
1411
1500
  /**
@@ -1500,7 +1589,7 @@ interface CodexProviderSettings {
1500
1589
  persistent?: {
1501
1590
  /** Number of worker processes to keep in the pool. */
1502
1591
  poolSize?: number;
1503
- /** Time (ms) before an idle worker is shut down. */
1592
+ /** Time (ms) before an idle worker is shut down. Set to `0` to disable (worker stays alive indefinitely). */
1504
1593
  idleTimeoutMs?: number;
1505
1594
  /** `"provider"` = pool per provider instance; `"global"` = shared across all instances. */
1506
1595
  scope?: "provider" | "global";
@@ -1752,4 +1841,4 @@ declare class PromptFileResolver {
1752
1841
  private resolveFresh;
1753
1842
  }
1754
1843
 
1755
- export { type AgentMessageDeltaNotification, AppServerClient, type AppServerClientSettings, ApprovalsDispatcher, type ApprovalsDispatcherSettings, type AskForApproval, CODEX_PROVIDER_ID, type CodexCallOptions, type CodexCommandApprovalRequest, type CodexDynamicToolDefinition, CodexEventMapper, type CodexEventMapperInput, type CodexEventMapperOptions, type CodexFileChangeApprovalRequest, type CodexInitializeParams, type CodexInitializeResult, type CodexInitializedNotification, CodexLanguageModel, type CodexLanguageModelSettings, type Model as CodexModel, type CodexModelConfig, CodexNotImplementedError, type CodexNotification, type CodexProvider, CodexProviderError, type CodexProviderSettings, type CodexSession, type CodexThreadDefaults, type CodexThreadResumeParams, type CodexThreadResumeResult, type CodexThreadStartParams, type CodexThreadStartResult, type CodexToolCallDeltaNotification, type CodexToolCallFinishedNotification, type CodexToolCallRequestParams, type CodexToolCallResult, type CodexToolCallStartedNotification, type CodexToolResultContentItem, type CodexTransport, type CodexTransportEventMap, type CodexTurnInputImage, type CodexTurnInputItem, type CodexTurnInputLocalImage, type CodexTurnInputMention, type CodexTurnInputSkill, type CodexTurnInputText, type CodexTurnStartParams, type CodexTurnStartResult, CodexWorker, CodexWorkerPool, type CodexWorkerPoolSettings, type CodexWorkerSettings, type CommandApprovalHandler, type CommandExecutionApprovalDecision, type CommandExecutionRequestApprovalParams, type CommandExecutionRequestApprovalResponse, type DynamicToolDefinition, type DynamicToolExecutionContext, type DynamicToolHandler, DynamicToolsDispatcher, type DynamicToolsDispatcherSettings, type FileChangeApprovalDecision, type FileChangeApprovalHandler, type FileChangeRequestApprovalParams, type FileChangeRequestApprovalResponse, type FileWriter, type ItemCompletedNotification, type ItemStartedNotification, JsonRpcError, type JsonRpcErrorResponse, type JsonRpcId, type JsonRpcMessage, type JsonRpcMessageBase, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccessResponse, LocalFileWriter, type McpServerConfig, PACKAGE_NAME, PACKAGE_VERSION, type PendingToolCall, PersistentTransport, type PersistentTransportSettings, PromptFileResolver, type SandboxMode, StdioTransport, type StdioTransportSettings, type ThreadItem, type ThreadTokenUsageUpdatedNotification, type TransportContext, type TurnCompletedNotification, type TurnStartedNotification, WebSocketTransport, type WebSocketTransportSettings, codexAppServer, codexCallOptions, codexProviderMetadata, createCodexAppServer, createCodexProvider, mapSystemPrompt, withProviderMetadata };
1844
+ export { type AgentMessageDeltaNotification, AppServerClient, type AppServerClientSettings, ApprovalsDispatcher, type ApprovalsDispatcherSettings, type ApprovalsReviewer, type AskForApproval, CODEX_PROVIDER_ID, type CodexCallOptions, type CodexCommandApprovalRequest, type CodexDynamicToolDefinition, CodexEventMapper, type CodexEventMapperInput, type CodexEventMapperOptions, type CodexFileChangeApprovalRequest, type CodexInitializeParams, type CodexInitializeResult, type CodexInitializedNotification, CodexLanguageModel, type CodexLanguageModelSettings, type Model as CodexModel, type CodexModelConfig, CodexNotImplementedError, type CodexNotification, type CodexProvider, CodexProviderError, type CodexProviderSettings, type CodexSession, type CodexThreadDefaults, type CodexThreadResumeParams, type CodexThreadResumeResult, type CodexThreadStartParams, type CodexThreadStartResult, type CodexToolCallDeltaNotification, type CodexToolCallFinishedNotification, type CodexToolCallRequestParams, type CodexToolCallResult, type CodexToolCallStartedNotification, type CodexToolResultContentItem, type CodexTransport, type CodexTransportEventMap, type CodexTurnInputImage, type CodexTurnInputItem, type CodexTurnInputLocalImage, type CodexTurnInputMention, type CodexTurnInputSkill, type CodexTurnInputText, type CodexTurnStartParams, type CodexTurnStartResult, CodexWorker, CodexWorkerPool, type CodexWorkerPoolSettings, type CodexWorkerSettings, type CommandApprovalHandler, type CommandExecutionApprovalDecision, type CommandExecutionRequestApprovalParams, type CommandExecutionRequestApprovalResponse, type DynamicToolDefinition, type DynamicToolExecutionContext, type DynamicToolHandler, DynamicToolsDispatcher, type DynamicToolsDispatcherSettings, type FileChangeApprovalDecision, type FileChangeApprovalHandler, type FileChangeRequestApprovalParams, type FileChangeRequestApprovalResponse, type FileWriter, type ItemCompletedNotification, type ItemStartedNotification, JsonRpcError, type JsonRpcErrorResponse, type JsonRpcId, type JsonRpcMessage, type JsonRpcMessageBase, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccessResponse, LocalFileWriter, type McpServerConfig, PACKAGE_NAME, PACKAGE_VERSION, type PendingToolCall, PersistentTransport, type PersistentTransportSettings, PromptFileResolver, type SandboxMode, StdioTransport, type StdioTransportSettings, type ThreadItem, type ThreadTokenUsageUpdatedNotification, type TransportContext, type TurnCompletedNotification, type TurnStartedNotification, WebSocketTransport, type WebSocketTransportSettings, codexAppServer, codexCallOptions, codexProviderMetadata, createCodexAppServer, createCodexProvider, mapSystemPrompt, withProviderMetadata };