@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/README.md +6 -5
- package/dist/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -28
- package/dist/index.d.ts +28 -28
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`@janole/ai-sdk-provider-codex-asp` is a [Vercel AI SDK](https://ai-sdk.dev/) v6 custom provider for the Codex App Server Protocol.
|
|
4
4
|
|
|
5
|
-
Status: POC feature-complete for language model usage. Currently tested with [codex-cli](https://github.com/openai/codex/releases/tag/rust-v0.
|
|
5
|
+
Status: POC feature-complete for language model usage. Currently tested with [codex-cli](https://github.com/openai/codex/releases/tag/rust-v0.117.0) 0.117.0.
|
|
6
6
|
|
|
7
7
|
- `LanguageModelV3` provider implementation
|
|
8
8
|
- Streaming (`streamText`) and non-streaming (`generateText`)
|
|
@@ -159,11 +159,12 @@ const codex = createCodexAppServer({
|
|
|
159
159
|
await streamText({
|
|
160
160
|
model: codex("gpt-5.3-codex"),
|
|
161
161
|
prompt: "Delete the old generated protocol files under src/protocol/app-server-protocol if they are no longer referenced, then regenerate the current ones.",
|
|
162
|
-
providerOptions: {
|
|
163
|
-
"
|
|
164
|
-
|
|
162
|
+
providerOptions: codexCallOptions({
|
|
163
|
+
approvalsReviewer: "user",
|
|
164
|
+
approvals: {
|
|
165
|
+
onCommandApproval: async () => "decline",
|
|
165
166
|
},
|
|
166
|
-
},
|
|
167
|
+
}),
|
|
167
168
|
});
|
|
168
169
|
```
|
|
169
170
|
|
package/dist/index.cjs
CHANGED
|
@@ -935,7 +935,7 @@ var DynamicToolsDispatcher = class {
|
|
|
935
935
|
// package.json
|
|
936
936
|
var package_default = {
|
|
937
937
|
name: "@janole/ai-sdk-provider-codex-asp",
|
|
938
|
-
version: "0.4.
|
|
938
|
+
version: "0.4.4"};
|
|
939
939
|
|
|
940
940
|
// src/package-info.ts
|
|
941
941
|
var PACKAGE_NAME = package_default.name;
|
|
@@ -1769,6 +1769,12 @@ function sdkToolsToCodexDynamicTools(tools) {
|
|
|
1769
1769
|
inputSchema: t.inputSchema
|
|
1770
1770
|
}));
|
|
1771
1771
|
}
|
|
1772
|
+
function resolveApprovalHandlers(providerSettings, callOptions) {
|
|
1773
|
+
return stripUndefined({
|
|
1774
|
+
onCommandApproval: callOptions?.approvals?.onCommandApproval ?? providerSettings.approvals?.onCommandApproval,
|
|
1775
|
+
onFileChangeApproval: callOptions?.approvals?.onFileChangeApproval ?? providerSettings.approvals?.onFileChangeApproval
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1772
1778
|
function isPassThroughContentPart(part) {
|
|
1773
1779
|
switch (part.type) {
|
|
1774
1780
|
case "tool-call":
|
|
@@ -1924,6 +1930,8 @@ var CodexLanguageModel = class {
|
|
|
1924
1930
|
let activeThreadId;
|
|
1925
1931
|
let activeTurnId;
|
|
1926
1932
|
let session;
|
|
1933
|
+
let detachApprovals;
|
|
1934
|
+
let detachDynamicTools;
|
|
1927
1935
|
const interruptTimeoutMs = this.config.providerSettings.interruptTimeoutMs ?? 1e4;
|
|
1928
1936
|
const interruptTurnIfPossible = async () => {
|
|
1929
1937
|
if (!activeThreadId || !activeTurnId) {
|
|
@@ -1950,6 +1958,10 @@ var CodexLanguageModel = class {
|
|
|
1950
1958
|
try {
|
|
1951
1959
|
controller.close();
|
|
1952
1960
|
} finally {
|
|
1961
|
+
detachDynamicTools?.();
|
|
1962
|
+
detachDynamicTools = void 0;
|
|
1963
|
+
detachApprovals?.();
|
|
1964
|
+
detachApprovals = void 0;
|
|
1953
1965
|
await fileResolver.cleanup();
|
|
1954
1966
|
await client.disconnect();
|
|
1955
1967
|
}
|
|
@@ -1963,6 +1975,10 @@ var CodexLanguageModel = class {
|
|
|
1963
1975
|
try {
|
|
1964
1976
|
controller.close();
|
|
1965
1977
|
} finally {
|
|
1978
|
+
detachDynamicTools?.();
|
|
1979
|
+
detachDynamicTools = void 0;
|
|
1980
|
+
detachApprovals?.();
|
|
1981
|
+
detachApprovals = void 0;
|
|
1966
1982
|
await fileResolver.cleanup();
|
|
1967
1983
|
await client.disconnect();
|
|
1968
1984
|
}
|
|
@@ -2024,11 +2040,10 @@ var CodexLanguageModel = class {
|
|
|
2024
2040
|
pendingToolCall.threadId,
|
|
2025
2041
|
closeSuccessfully
|
|
2026
2042
|
);
|
|
2027
|
-
const approvalsDispatcher2 = new ApprovalsDispatcher(
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
approvalsDispatcher2.attach(client);
|
|
2043
|
+
const approvalsDispatcher2 = new ApprovalsDispatcher(
|
|
2044
|
+
resolveApprovalHandlers(this.config.providerSettings, callOptions)
|
|
2045
|
+
);
|
|
2046
|
+
detachApprovals = approvalsDispatcher2.attach(client);
|
|
2032
2047
|
const result = toolResult ?? {
|
|
2033
2048
|
success: false,
|
|
2034
2049
|
contentItems: [{
|
|
@@ -2056,13 +2071,12 @@ var CodexLanguageModel = class {
|
|
|
2056
2071
|
timeoutMs: this.config.providerSettings.toolTimeoutMs,
|
|
2057
2072
|
onDebugEvent: toolLogger
|
|
2058
2073
|
}));
|
|
2059
|
-
dispatcher.attach(client);
|
|
2074
|
+
detachDynamicTools = dispatcher.attach(client);
|
|
2060
2075
|
}
|
|
2061
|
-
const approvalsDispatcher = new ApprovalsDispatcher(
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
approvalsDispatcher.attach(client);
|
|
2076
|
+
const approvalsDispatcher = new ApprovalsDispatcher(
|
|
2077
|
+
resolveApprovalHandlers(this.config.providerSettings, callOptions)
|
|
2078
|
+
);
|
|
2079
|
+
detachApprovals = approvalsDispatcher.attach(client);
|
|
2066
2080
|
client.onAnyNotification((method, params) => {
|
|
2067
2081
|
const parts = mapper.map({ method, params });
|
|
2068
2082
|
const mappedTurnId = mapper.getTurnId();
|