@janole/ai-sdk-provider-codex-asp 0.4.2 → 0.4.4

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
@@ -69,24 +69,6 @@ type AdditionalFileSystemPermissions = {
69
69
  write: Array<AbsolutePathBuf> | null;
70
70
  };
71
71
 
72
- type MacOsAutomationPermission = "none" | "all" | {
73
- "bundle_ids": Array<string>;
74
- };
75
-
76
- type MacOsContactsPermission = "none" | "read_only" | "read_write";
77
-
78
- type MacOsPreferencesPermission = "none" | "read_only" | "read_write";
79
-
80
- type AdditionalMacOsPermissions = {
81
- preferences: MacOsPreferencesPermission;
82
- automations: MacOsAutomationPermission;
83
- launchServices: boolean;
84
- accessibility: boolean;
85
- calendar: boolean;
86
- reminders: boolean;
87
- contacts: MacOsContactsPermission;
88
- };
89
-
90
72
  type AdditionalNetworkPermissions = {
91
73
  enabled: boolean | null;
92
74
  };
@@ -94,7 +76,6 @@ type AdditionalNetworkPermissions = {
94
76
  type AdditionalPermissionProfile = {
95
77
  network: AdditionalNetworkPermissions | null;
96
78
  fileSystem: AdditionalFileSystemPermissions | null;
97
- macos: AdditionalMacOsPermissions | null;
98
79
  };
99
80
 
100
81
  type CommandAction = {
@@ -116,10 +97,6 @@ type CommandAction = {
116
97
  command: string;
117
98
  };
118
99
 
119
- type CommandExecutionRequestApprovalSkillMetadata = {
120
- pathToSkillsMd: string;
121
- };
122
-
123
100
  type NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp";
124
101
 
125
102
  type NetworkApprovalContext = {
@@ -165,10 +142,6 @@ type CommandExecutionRequestApprovalParams = {
165
142
  * Optional additional permissions requested for this command.
166
143
  */
167
144
  additionalPermissions?: AdditionalPermissionProfile | null;
168
- /**
169
- * Optional skill metadata when the approval was triggered by a skill script.
170
- */
171
- skillMetadata?: CommandExecutionRequestApprovalSkillMetadata | null;
172
145
  /**
173
146
  * Optional proposed execpolicy amendment to allow similar commands without prompting.
174
147
  */
@@ -262,6 +235,8 @@ type CollabAgentTool = "spawnAgent" | "sendInput" | "resumeAgent" | "wait" | "cl
262
235
 
263
236
  type CollabAgentToolCallStatus = "inProgress" | "completed" | "failed";
264
237
 
238
+ type CommandExecutionSource = "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction";
239
+
265
240
  type CommandExecutionStatus = "inProgress" | "completed" | "failed" | "declined";
266
241
 
267
242
  type DynamicToolCallOutputContentItem = {
@@ -289,6 +264,11 @@ type FileUpdateChange = {
289
264
  diff: string;
290
265
  };
291
266
 
267
+ type HookPromptFragment = {
268
+ text: string;
269
+ hookRunId: string;
270
+ };
271
+
292
272
  type McpToolCallError = {
293
273
  message: string;
294
274
  };
@@ -372,6 +352,10 @@ type ThreadItem = {
372
352
  "type": "userMessage";
373
353
  id: string;
374
354
  content: Array<UserInput>;
355
+ } | {
356
+ "type": "hookPrompt";
357
+ id: string;
358
+ fragments: Array<HookPromptFragment>;
375
359
  } | {
376
360
  "type": "agentMessage";
377
361
  id: string;
@@ -402,6 +386,7 @@ type ThreadItem = {
402
386
  * Identifier for the underlying PTY process (when available).
403
387
  */
404
388
  processId: string | null;
389
+ source: CommandExecutionSource;
405
390
  status: CommandExecutionStatus;
406
391
  /**
407
392
  * A best-effort parsing of the command to understand the action(s) it will perform.
@@ -507,6 +492,7 @@ type ThreadItem = {
507
492
  status: string;
508
493
  revisedPrompt: string | null;
509
494
  result: string;
495
+ savedPath?: string;
510
496
  } | {
511
497
  "type": "enteredReviewMode";
512
498
  id: string;
@@ -735,12 +721,15 @@ type GitInfo = {
735
721
  originUrl: string | null;
736
722
  };
737
723
 
724
+ type AgentPath = string;
725
+
738
726
  type ThreadId = string;
739
727
 
740
728
  type SubAgentSource = "review" | "compact" | {
741
729
  "thread_spawn": {
742
730
  parent_thread_id: ThreadId;
743
731
  depth: number;
732
+ agent_path: AgentPath | null;
744
733
  agent_nickname: string | null;
745
734
  agent_role: string | null;
746
735
  };
@@ -767,6 +756,8 @@ type ThreadStatus = {
767
756
  activeFlags: Array<ThreadActiveFlag>;
768
757
  };
769
758
 
759
+ type NonSteerableTurnKind = "review" | "compact";
760
+
770
761
  /**
771
762
  * This translation layer make sure that we expose codex error code in camel case.
772
763
  *
@@ -789,6 +780,10 @@ type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOv
789
780
  "responseTooManyFailedAttempts": {
790
781
  httpStatusCode: number | null;
791
782
  };
783
+ } | {
784
+ "activeTurnNotSteerable": {
785
+ turnKind: NonSteerableTurnKind;
786
+ };
792
787
  } | "other";
793
788
 
794
789
  type TurnError = {
@@ -1468,6 +1463,11 @@ interface CodexCallOptions {
1468
1463
  sandboxPolicy?: SandboxPolicy;
1469
1464
  /** Controls turn summary generation. */
1470
1465
  summary?: "auto" | "concise" | "detailed" | "none";
1466
+ /** Approval callbacks for this call; falls back to provider-level `approvals`. */
1467
+ approvals?: {
1468
+ onCommandApproval?: CommandApprovalHandler;
1469
+ onFileChangeApproval?: FileChangeApprovalHandler;
1470
+ };
1471
1471
  }
1472
1472
  interface CodexCompactionSettings {
1473
1473
  /**
@@ -1562,7 +1562,7 @@ interface CodexProviderSettings {
1562
1562
  persistent?: {
1563
1563
  /** Number of worker processes to keep in the pool. */
1564
1564
  poolSize?: number;
1565
- /** Time (ms) before an idle worker is shut down. */
1565
+ /** Time (ms) before an idle worker is shut down. Set to `0` to disable (worker stays alive indefinitely). */
1566
1566
  idleTimeoutMs?: number;
1567
1567
  /** `"provider"` = pool per provider instance; `"global"` = shared across all instances. */
1568
1568
  scope?: "provider" | "global";
package/dist/index.d.ts CHANGED
@@ -69,24 +69,6 @@ type AdditionalFileSystemPermissions = {
69
69
  write: Array<AbsolutePathBuf> | null;
70
70
  };
71
71
 
72
- type MacOsAutomationPermission = "none" | "all" | {
73
- "bundle_ids": Array<string>;
74
- };
75
-
76
- type MacOsContactsPermission = "none" | "read_only" | "read_write";
77
-
78
- type MacOsPreferencesPermission = "none" | "read_only" | "read_write";
79
-
80
- type AdditionalMacOsPermissions = {
81
- preferences: MacOsPreferencesPermission;
82
- automations: MacOsAutomationPermission;
83
- launchServices: boolean;
84
- accessibility: boolean;
85
- calendar: boolean;
86
- reminders: boolean;
87
- contacts: MacOsContactsPermission;
88
- };
89
-
90
72
  type AdditionalNetworkPermissions = {
91
73
  enabled: boolean | null;
92
74
  };
@@ -94,7 +76,6 @@ type AdditionalNetworkPermissions = {
94
76
  type AdditionalPermissionProfile = {
95
77
  network: AdditionalNetworkPermissions | null;
96
78
  fileSystem: AdditionalFileSystemPermissions | null;
97
- macos: AdditionalMacOsPermissions | null;
98
79
  };
99
80
 
100
81
  type CommandAction = {
@@ -116,10 +97,6 @@ type CommandAction = {
116
97
  command: string;
117
98
  };
118
99
 
119
- type CommandExecutionRequestApprovalSkillMetadata = {
120
- pathToSkillsMd: string;
121
- };
122
-
123
100
  type NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp";
124
101
 
125
102
  type NetworkApprovalContext = {
@@ -165,10 +142,6 @@ type CommandExecutionRequestApprovalParams = {
165
142
  * Optional additional permissions requested for this command.
166
143
  */
167
144
  additionalPermissions?: AdditionalPermissionProfile | null;
168
- /**
169
- * Optional skill metadata when the approval was triggered by a skill script.
170
- */
171
- skillMetadata?: CommandExecutionRequestApprovalSkillMetadata | null;
172
145
  /**
173
146
  * Optional proposed execpolicy amendment to allow similar commands without prompting.
174
147
  */
@@ -262,6 +235,8 @@ type CollabAgentTool = "spawnAgent" | "sendInput" | "resumeAgent" | "wait" | "cl
262
235
 
263
236
  type CollabAgentToolCallStatus = "inProgress" | "completed" | "failed";
264
237
 
238
+ type CommandExecutionSource = "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction";
239
+
265
240
  type CommandExecutionStatus = "inProgress" | "completed" | "failed" | "declined";
266
241
 
267
242
  type DynamicToolCallOutputContentItem = {
@@ -289,6 +264,11 @@ type FileUpdateChange = {
289
264
  diff: string;
290
265
  };
291
266
 
267
+ type HookPromptFragment = {
268
+ text: string;
269
+ hookRunId: string;
270
+ };
271
+
292
272
  type McpToolCallError = {
293
273
  message: string;
294
274
  };
@@ -372,6 +352,10 @@ type ThreadItem = {
372
352
  "type": "userMessage";
373
353
  id: string;
374
354
  content: Array<UserInput>;
355
+ } | {
356
+ "type": "hookPrompt";
357
+ id: string;
358
+ fragments: Array<HookPromptFragment>;
375
359
  } | {
376
360
  "type": "agentMessage";
377
361
  id: string;
@@ -402,6 +386,7 @@ type ThreadItem = {
402
386
  * Identifier for the underlying PTY process (when available).
403
387
  */
404
388
  processId: string | null;
389
+ source: CommandExecutionSource;
405
390
  status: CommandExecutionStatus;
406
391
  /**
407
392
  * A best-effort parsing of the command to understand the action(s) it will perform.
@@ -507,6 +492,7 @@ type ThreadItem = {
507
492
  status: string;
508
493
  revisedPrompt: string | null;
509
494
  result: string;
495
+ savedPath?: string;
510
496
  } | {
511
497
  "type": "enteredReviewMode";
512
498
  id: string;
@@ -735,12 +721,15 @@ type GitInfo = {
735
721
  originUrl: string | null;
736
722
  };
737
723
 
724
+ type AgentPath = string;
725
+
738
726
  type ThreadId = string;
739
727
 
740
728
  type SubAgentSource = "review" | "compact" | {
741
729
  "thread_spawn": {
742
730
  parent_thread_id: ThreadId;
743
731
  depth: number;
732
+ agent_path: AgentPath | null;
744
733
  agent_nickname: string | null;
745
734
  agent_role: string | null;
746
735
  };
@@ -767,6 +756,8 @@ type ThreadStatus = {
767
756
  activeFlags: Array<ThreadActiveFlag>;
768
757
  };
769
758
 
759
+ type NonSteerableTurnKind = "review" | "compact";
760
+
770
761
  /**
771
762
  * This translation layer make sure that we expose codex error code in camel case.
772
763
  *
@@ -789,6 +780,10 @@ type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOv
789
780
  "responseTooManyFailedAttempts": {
790
781
  httpStatusCode: number | null;
791
782
  };
783
+ } | {
784
+ "activeTurnNotSteerable": {
785
+ turnKind: NonSteerableTurnKind;
786
+ };
792
787
  } | "other";
793
788
 
794
789
  type TurnError = {
@@ -1468,6 +1463,11 @@ interface CodexCallOptions {
1468
1463
  sandboxPolicy?: SandboxPolicy;
1469
1464
  /** Controls turn summary generation. */
1470
1465
  summary?: "auto" | "concise" | "detailed" | "none";
1466
+ /** Approval callbacks for this call; falls back to provider-level `approvals`. */
1467
+ approvals?: {
1468
+ onCommandApproval?: CommandApprovalHandler;
1469
+ onFileChangeApproval?: FileChangeApprovalHandler;
1470
+ };
1471
1471
  }
1472
1472
  interface CodexCompactionSettings {
1473
1473
  /**
@@ -1562,7 +1562,7 @@ interface CodexProviderSettings {
1562
1562
  persistent?: {
1563
1563
  /** Number of worker processes to keep in the pool. */
1564
1564
  poolSize?: number;
1565
- /** Time (ms) before an idle worker is shut down. */
1565
+ /** Time (ms) before an idle worker is shut down. Set to `0` to disable (worker stays alive indefinitely). */
1566
1566
  idleTimeoutMs?: number;
1567
1567
  /** `"provider"` = pool per provider instance; `"global"` = shared across all instances. */
1568
1568
  scope?: "provider" | "global";
package/dist/index.js CHANGED
@@ -933,7 +933,7 @@ var DynamicToolsDispatcher = class {
933
933
  // package.json
934
934
  var package_default = {
935
935
  name: "@janole/ai-sdk-provider-codex-asp",
936
- version: "0.4.2"};
936
+ version: "0.4.4"};
937
937
 
938
938
  // src/package-info.ts
939
939
  var PACKAGE_NAME = package_default.name;
@@ -1767,6 +1767,12 @@ function sdkToolsToCodexDynamicTools(tools) {
1767
1767
  inputSchema: t.inputSchema
1768
1768
  }));
1769
1769
  }
1770
+ function resolveApprovalHandlers(providerSettings, callOptions) {
1771
+ return stripUndefined({
1772
+ onCommandApproval: callOptions?.approvals?.onCommandApproval ?? providerSettings.approvals?.onCommandApproval,
1773
+ onFileChangeApproval: callOptions?.approvals?.onFileChangeApproval ?? providerSettings.approvals?.onFileChangeApproval
1774
+ });
1775
+ }
1770
1776
  function isPassThroughContentPart(part) {
1771
1777
  switch (part.type) {
1772
1778
  case "tool-call":
@@ -1922,6 +1928,8 @@ var CodexLanguageModel = class {
1922
1928
  let activeThreadId;
1923
1929
  let activeTurnId;
1924
1930
  let session;
1931
+ let detachApprovals;
1932
+ let detachDynamicTools;
1925
1933
  const interruptTimeoutMs = this.config.providerSettings.interruptTimeoutMs ?? 1e4;
1926
1934
  const interruptTurnIfPossible = async () => {
1927
1935
  if (!activeThreadId || !activeTurnId) {
@@ -1948,6 +1956,10 @@ var CodexLanguageModel = class {
1948
1956
  try {
1949
1957
  controller.close();
1950
1958
  } finally {
1959
+ detachDynamicTools?.();
1960
+ detachDynamicTools = void 0;
1961
+ detachApprovals?.();
1962
+ detachApprovals = void 0;
1951
1963
  await fileResolver.cleanup();
1952
1964
  await client.disconnect();
1953
1965
  }
@@ -1961,6 +1973,10 @@ var CodexLanguageModel = class {
1961
1973
  try {
1962
1974
  controller.close();
1963
1975
  } finally {
1976
+ detachDynamicTools?.();
1977
+ detachDynamicTools = void 0;
1978
+ detachApprovals?.();
1979
+ detachApprovals = void 0;
1964
1980
  await fileResolver.cleanup();
1965
1981
  await client.disconnect();
1966
1982
  }
@@ -2022,11 +2038,10 @@ var CodexLanguageModel = class {
2022
2038
  pendingToolCall.threadId,
2023
2039
  closeSuccessfully
2024
2040
  );
2025
- const approvalsDispatcher2 = new ApprovalsDispatcher(stripUndefined({
2026
- onCommandApproval: this.config.providerSettings.approvals?.onCommandApproval,
2027
- onFileChangeApproval: this.config.providerSettings.approvals?.onFileChangeApproval
2028
- }));
2029
- approvalsDispatcher2.attach(client);
2041
+ const approvalsDispatcher2 = new ApprovalsDispatcher(
2042
+ resolveApprovalHandlers(this.config.providerSettings, callOptions)
2043
+ );
2044
+ detachApprovals = approvalsDispatcher2.attach(client);
2030
2045
  const result = toolResult ?? {
2031
2046
  success: false,
2032
2047
  contentItems: [{
@@ -2054,13 +2069,12 @@ var CodexLanguageModel = class {
2054
2069
  timeoutMs: this.config.providerSettings.toolTimeoutMs,
2055
2070
  onDebugEvent: toolLogger
2056
2071
  }));
2057
- dispatcher.attach(client);
2072
+ detachDynamicTools = dispatcher.attach(client);
2058
2073
  }
2059
- const approvalsDispatcher = new ApprovalsDispatcher(stripUndefined({
2060
- onCommandApproval: this.config.providerSettings.approvals?.onCommandApproval,
2061
- onFileChangeApproval: this.config.providerSettings.approvals?.onFileChangeApproval
2062
- }));
2063
- approvalsDispatcher.attach(client);
2074
+ const approvalsDispatcher = new ApprovalsDispatcher(
2075
+ resolveApprovalHandlers(this.config.providerSettings, callOptions)
2076
+ );
2077
+ detachApprovals = approvalsDispatcher.attach(client);
2064
2078
  client.onAnyNotification((method, params) => {
2065
2079
  const parts = mapper.map({ method, params });
2066
2080
  const mappedTurnId = mapper.getTurnId();