@janole/ai-sdk-provider-codex-asp 0.3.3 → 0.3.5
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 +5 -0
- package/dist/index.cjs +24 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -28
- package/dist/index.d.ts +21 -28
- package/dist/index.js +24 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,6 +126,11 @@ codex.chat(modelId) // explicit alias
|
|
|
126
126
|
codex.shutdown() // clean up persistent workers
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
Approval callback notes:
|
|
130
|
+
|
|
131
|
+
- `approvals.onCommandApproval(request)` receives the raw generated Codex protocol payload: `CommandExecutionRequestApprovalParams`.
|
|
132
|
+
- `approvals.onFileChangeApproval(request)` receives the raw generated Codex protocol payload: `FileChangeRequestApprovalParams`.
|
|
133
|
+
|
|
129
134
|
Rich sandbox policy example (turn-level):
|
|
130
135
|
|
|
131
136
|
```ts
|
package/dist/index.cjs
CHANGED
|
@@ -8,13 +8,6 @@ var path = require('path');
|
|
|
8
8
|
var url = require('url');
|
|
9
9
|
var provider = require('@ai-sdk/provider');
|
|
10
10
|
|
|
11
|
-
// src/utils/object.ts
|
|
12
|
-
function stripUndefined(obj) {
|
|
13
|
-
return Object.fromEntries(
|
|
14
|
-
Object.entries(obj).filter(([, value]) => value !== void 0)
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
// src/approvals.ts
|
|
19
12
|
var ApprovalsDispatcher = class {
|
|
20
13
|
onCommandApproval;
|
|
@@ -27,37 +20,14 @@ var ApprovalsDispatcher = class {
|
|
|
27
20
|
const unsubCommand = client.onRequest(
|
|
28
21
|
"item/commandExecution/requestApproval",
|
|
29
22
|
async (params, _request) => {
|
|
30
|
-
const
|
|
31
|
-
const request = stripUndefined({
|
|
32
|
-
threadId: p.threadId,
|
|
33
|
-
turnId: p.turnId,
|
|
34
|
-
itemId: p.itemId,
|
|
35
|
-
approvalId: p.approvalId,
|
|
36
|
-
reason: p.reason,
|
|
37
|
-
networkApprovalContext: p.networkApprovalContext,
|
|
38
|
-
command: p.command,
|
|
39
|
-
cwd: p.cwd,
|
|
40
|
-
commandActions: p.commandActions,
|
|
41
|
-
additionalPermissions: p.additionalPermissions,
|
|
42
|
-
proposedExecpolicyAmendment: p.proposedExecpolicyAmendment,
|
|
43
|
-
proposedNetworkPolicyAmendments: p.proposedNetworkPolicyAmendments
|
|
44
|
-
});
|
|
45
|
-
const decision = await this.onCommandApproval(request);
|
|
23
|
+
const decision = await this.onCommandApproval(params);
|
|
46
24
|
return { decision };
|
|
47
25
|
}
|
|
48
26
|
);
|
|
49
27
|
const unsubFileChange = client.onRequest(
|
|
50
28
|
"item/fileChange/requestApproval",
|
|
51
29
|
async (params, _request) => {
|
|
52
|
-
const
|
|
53
|
-
const request = stripUndefined({
|
|
54
|
-
threadId: p.threadId,
|
|
55
|
-
turnId: p.turnId,
|
|
56
|
-
itemId: p.itemId,
|
|
57
|
-
reason: p.reason,
|
|
58
|
-
grantRoot: p.grantRoot
|
|
59
|
-
});
|
|
60
|
-
const decision = await this.onFileChangeApproval(request);
|
|
30
|
+
const decision = await this.onFileChangeApproval(params);
|
|
61
31
|
return { decision };
|
|
62
32
|
}
|
|
63
33
|
);
|
|
@@ -82,6 +52,13 @@ var CodexNotImplementedError = class extends CodexProviderError {
|
|
|
82
52
|
}
|
|
83
53
|
};
|
|
84
54
|
|
|
55
|
+
// src/utils/object.ts
|
|
56
|
+
function stripUndefined(obj) {
|
|
57
|
+
return Object.fromEntries(
|
|
58
|
+
Object.entries(obj).filter(([, value]) => value !== void 0)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
85
62
|
// src/client/app-server-client.ts
|
|
86
63
|
var JsonRpcError = class extends CodexProviderError {
|
|
87
64
|
code;
|
|
@@ -958,7 +935,7 @@ var DynamicToolsDispatcher = class {
|
|
|
958
935
|
// package.json
|
|
959
936
|
var package_default = {
|
|
960
937
|
name: "@janole/ai-sdk-provider-codex-asp",
|
|
961
|
-
version: "0.3.
|
|
938
|
+
version: "0.3.5"};
|
|
962
939
|
|
|
963
940
|
// src/package-info.ts
|
|
964
941
|
var PACKAGE_NAME = package_default.name;
|
|
@@ -1861,16 +1838,28 @@ function extractToolResults(prompt, callId) {
|
|
|
1861
1838
|
if (callId && part.toolCallId !== callId) {
|
|
1862
1839
|
continue;
|
|
1863
1840
|
}
|
|
1864
|
-
if (part.output.type === "text") {
|
|
1841
|
+
if (part.output.type === "text" || part.output.type === "error-text") {
|
|
1865
1842
|
contentItems.push({ type: "inputText", text: part.output.value });
|
|
1866
|
-
|
|
1843
|
+
if (part.output.type === "error-text") {
|
|
1844
|
+
success = false;
|
|
1845
|
+
}
|
|
1846
|
+
} else if (part.output.type === "json" || part.output.type === "error-json") {
|
|
1867
1847
|
contentItems.push({ type: "inputText", text: JSON.stringify(part.output.value) });
|
|
1848
|
+
if (part.output.type === "error-json") {
|
|
1849
|
+
success = false;
|
|
1850
|
+
}
|
|
1868
1851
|
} else if (part.output.type === "execution-denied") {
|
|
1869
1852
|
success = false;
|
|
1870
1853
|
contentItems.push({
|
|
1871
1854
|
type: "inputText",
|
|
1872
1855
|
text: part.output.reason ?? "Tool execution was denied."
|
|
1873
1856
|
});
|
|
1857
|
+
} else if (part.output.type === "content") {
|
|
1858
|
+
for (const item of part.output.value) {
|
|
1859
|
+
if (item.type === "text") {
|
|
1860
|
+
contentItems.push({ type: "inputText", text: item.text });
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1874
1863
|
}
|
|
1875
1864
|
}
|
|
1876
1865
|
}
|