@janole/ai-sdk-provider-codex-asp 0.4.2 → 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/README.md +6 -5
- package/dist/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -262,6 +262,8 @@ type CollabAgentTool = "spawnAgent" | "sendInput" | "resumeAgent" | "wait" | "cl
|
|
|
262
262
|
|
|
263
263
|
type CollabAgentToolCallStatus = "inProgress" | "completed" | "failed";
|
|
264
264
|
|
|
265
|
+
type CommandExecutionSource = "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction";
|
|
266
|
+
|
|
265
267
|
type CommandExecutionStatus = "inProgress" | "completed" | "failed" | "declined";
|
|
266
268
|
|
|
267
269
|
type DynamicToolCallOutputContentItem = {
|
|
@@ -289,6 +291,11 @@ type FileUpdateChange = {
|
|
|
289
291
|
diff: string;
|
|
290
292
|
};
|
|
291
293
|
|
|
294
|
+
type HookPromptFragment = {
|
|
295
|
+
text: string;
|
|
296
|
+
hookRunId: string;
|
|
297
|
+
};
|
|
298
|
+
|
|
292
299
|
type McpToolCallError = {
|
|
293
300
|
message: string;
|
|
294
301
|
};
|
|
@@ -372,6 +379,10 @@ type ThreadItem = {
|
|
|
372
379
|
"type": "userMessage";
|
|
373
380
|
id: string;
|
|
374
381
|
content: Array<UserInput>;
|
|
382
|
+
} | {
|
|
383
|
+
"type": "hookPrompt";
|
|
384
|
+
id: string;
|
|
385
|
+
fragments: Array<HookPromptFragment>;
|
|
375
386
|
} | {
|
|
376
387
|
"type": "agentMessage";
|
|
377
388
|
id: string;
|
|
@@ -402,6 +413,7 @@ type ThreadItem = {
|
|
|
402
413
|
* Identifier for the underlying PTY process (when available).
|
|
403
414
|
*/
|
|
404
415
|
processId: string | null;
|
|
416
|
+
source: CommandExecutionSource;
|
|
405
417
|
status: CommandExecutionStatus;
|
|
406
418
|
/**
|
|
407
419
|
* A best-effort parsing of the command to understand the action(s) it will perform.
|
|
@@ -507,6 +519,7 @@ type ThreadItem = {
|
|
|
507
519
|
status: string;
|
|
508
520
|
revisedPrompt: string | null;
|
|
509
521
|
result: string;
|
|
522
|
+
savedPath?: string;
|
|
510
523
|
} | {
|
|
511
524
|
"type": "enteredReviewMode";
|
|
512
525
|
id: string;
|
|
@@ -735,12 +748,15 @@ type GitInfo = {
|
|
|
735
748
|
originUrl: string | null;
|
|
736
749
|
};
|
|
737
750
|
|
|
751
|
+
type AgentPath = string;
|
|
752
|
+
|
|
738
753
|
type ThreadId = string;
|
|
739
754
|
|
|
740
755
|
type SubAgentSource = "review" | "compact" | {
|
|
741
756
|
"thread_spawn": {
|
|
742
757
|
parent_thread_id: ThreadId;
|
|
743
758
|
depth: number;
|
|
759
|
+
agent_path: AgentPath | null;
|
|
744
760
|
agent_nickname: string | null;
|
|
745
761
|
agent_role: string | null;
|
|
746
762
|
};
|
|
@@ -767,6 +783,8 @@ type ThreadStatus = {
|
|
|
767
783
|
activeFlags: Array<ThreadActiveFlag>;
|
|
768
784
|
};
|
|
769
785
|
|
|
786
|
+
type NonSteerableTurnKind = "review" | "compact";
|
|
787
|
+
|
|
770
788
|
/**
|
|
771
789
|
* This translation layer make sure that we expose codex error code in camel case.
|
|
772
790
|
*
|
|
@@ -789,6 +807,10 @@ type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOv
|
|
|
789
807
|
"responseTooManyFailedAttempts": {
|
|
790
808
|
httpStatusCode: number | null;
|
|
791
809
|
};
|
|
810
|
+
} | {
|
|
811
|
+
"activeTurnNotSteerable": {
|
|
812
|
+
turnKind: NonSteerableTurnKind;
|
|
813
|
+
};
|
|
792
814
|
} | "other";
|
|
793
815
|
|
|
794
816
|
type TurnError = {
|
|
@@ -1468,6 +1490,11 @@ interface CodexCallOptions {
|
|
|
1468
1490
|
sandboxPolicy?: SandboxPolicy;
|
|
1469
1491
|
/** Controls turn summary generation. */
|
|
1470
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
|
+
};
|
|
1471
1498
|
}
|
|
1472
1499
|
interface CodexCompactionSettings {
|
|
1473
1500
|
/**
|
|
@@ -1562,7 +1589,7 @@ interface CodexProviderSettings {
|
|
|
1562
1589
|
persistent?: {
|
|
1563
1590
|
/** Number of worker processes to keep in the pool. */
|
|
1564
1591
|
poolSize?: number;
|
|
1565
|
-
/** 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). */
|
|
1566
1593
|
idleTimeoutMs?: number;
|
|
1567
1594
|
/** `"provider"` = pool per provider instance; `"global"` = shared across all instances. */
|
|
1568
1595
|
scope?: "provider" | "global";
|
package/dist/index.d.ts
CHANGED
|
@@ -262,6 +262,8 @@ type CollabAgentTool = "spawnAgent" | "sendInput" | "resumeAgent" | "wait" | "cl
|
|
|
262
262
|
|
|
263
263
|
type CollabAgentToolCallStatus = "inProgress" | "completed" | "failed";
|
|
264
264
|
|
|
265
|
+
type CommandExecutionSource = "agent" | "userShell" | "unifiedExecStartup" | "unifiedExecInteraction";
|
|
266
|
+
|
|
265
267
|
type CommandExecutionStatus = "inProgress" | "completed" | "failed" | "declined";
|
|
266
268
|
|
|
267
269
|
type DynamicToolCallOutputContentItem = {
|
|
@@ -289,6 +291,11 @@ type FileUpdateChange = {
|
|
|
289
291
|
diff: string;
|
|
290
292
|
};
|
|
291
293
|
|
|
294
|
+
type HookPromptFragment = {
|
|
295
|
+
text: string;
|
|
296
|
+
hookRunId: string;
|
|
297
|
+
};
|
|
298
|
+
|
|
292
299
|
type McpToolCallError = {
|
|
293
300
|
message: string;
|
|
294
301
|
};
|
|
@@ -372,6 +379,10 @@ type ThreadItem = {
|
|
|
372
379
|
"type": "userMessage";
|
|
373
380
|
id: string;
|
|
374
381
|
content: Array<UserInput>;
|
|
382
|
+
} | {
|
|
383
|
+
"type": "hookPrompt";
|
|
384
|
+
id: string;
|
|
385
|
+
fragments: Array<HookPromptFragment>;
|
|
375
386
|
} | {
|
|
376
387
|
"type": "agentMessage";
|
|
377
388
|
id: string;
|
|
@@ -402,6 +413,7 @@ type ThreadItem = {
|
|
|
402
413
|
* Identifier for the underlying PTY process (when available).
|
|
403
414
|
*/
|
|
404
415
|
processId: string | null;
|
|
416
|
+
source: CommandExecutionSource;
|
|
405
417
|
status: CommandExecutionStatus;
|
|
406
418
|
/**
|
|
407
419
|
* A best-effort parsing of the command to understand the action(s) it will perform.
|
|
@@ -507,6 +519,7 @@ type ThreadItem = {
|
|
|
507
519
|
status: string;
|
|
508
520
|
revisedPrompt: string | null;
|
|
509
521
|
result: string;
|
|
522
|
+
savedPath?: string;
|
|
510
523
|
} | {
|
|
511
524
|
"type": "enteredReviewMode";
|
|
512
525
|
id: string;
|
|
@@ -735,12 +748,15 @@ type GitInfo = {
|
|
|
735
748
|
originUrl: string | null;
|
|
736
749
|
};
|
|
737
750
|
|
|
751
|
+
type AgentPath = string;
|
|
752
|
+
|
|
738
753
|
type ThreadId = string;
|
|
739
754
|
|
|
740
755
|
type SubAgentSource = "review" | "compact" | {
|
|
741
756
|
"thread_spawn": {
|
|
742
757
|
parent_thread_id: ThreadId;
|
|
743
758
|
depth: number;
|
|
759
|
+
agent_path: AgentPath | null;
|
|
744
760
|
agent_nickname: string | null;
|
|
745
761
|
agent_role: string | null;
|
|
746
762
|
};
|
|
@@ -767,6 +783,8 @@ type ThreadStatus = {
|
|
|
767
783
|
activeFlags: Array<ThreadActiveFlag>;
|
|
768
784
|
};
|
|
769
785
|
|
|
786
|
+
type NonSteerableTurnKind = "review" | "compact";
|
|
787
|
+
|
|
770
788
|
/**
|
|
771
789
|
* This translation layer make sure that we expose codex error code in camel case.
|
|
772
790
|
*
|
|
@@ -789,6 +807,10 @@ type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOv
|
|
|
789
807
|
"responseTooManyFailedAttempts": {
|
|
790
808
|
httpStatusCode: number | null;
|
|
791
809
|
};
|
|
810
|
+
} | {
|
|
811
|
+
"activeTurnNotSteerable": {
|
|
812
|
+
turnKind: NonSteerableTurnKind;
|
|
813
|
+
};
|
|
792
814
|
} | "other";
|
|
793
815
|
|
|
794
816
|
type TurnError = {
|
|
@@ -1468,6 +1490,11 @@ interface CodexCallOptions {
|
|
|
1468
1490
|
sandboxPolicy?: SandboxPolicy;
|
|
1469
1491
|
/** Controls turn summary generation. */
|
|
1470
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
|
+
};
|
|
1471
1498
|
}
|
|
1472
1499
|
interface CodexCompactionSettings {
|
|
1473
1500
|
/**
|
|
@@ -1562,7 +1589,7 @@ interface CodexProviderSettings {
|
|
|
1562
1589
|
persistent?: {
|
|
1563
1590
|
/** Number of worker processes to keep in the pool. */
|
|
1564
1591
|
poolSize?: number;
|
|
1565
|
-
/** 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). */
|
|
1566
1593
|
idleTimeoutMs?: number;
|
|
1567
1594
|
/** `"provider"` = pool per provider instance; `"global"` = shared across all instances. */
|
|
1568
1595
|
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.
|
|
936
|
+
version: "0.4.3"};
|
|
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(
|
|
2026
|
-
|
|
2027
|
-
|
|
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(
|
|
2060
|
-
|
|
2061
|
-
|
|
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();
|