@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/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,7 @@ type AskForApproval = "untrusted" | "on-failure" | "on-request" | {
|
|
|
19
19
|
"reject": {
|
|
20
20
|
sandbox_approval: boolean;
|
|
21
21
|
rules: boolean;
|
|
22
|
+
request_permissions: boolean;
|
|
22
23
|
mcp_elicitations: boolean;
|
|
23
24
|
};
|
|
24
25
|
} | "never";
|
|
@@ -58,15 +59,17 @@ type AdditionalFileSystemPermissions = {
|
|
|
58
59
|
write: Array<AbsolutePathBuf> | null;
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
type
|
|
62
|
+
type MacOsAutomationPermission = "none" | "all" | {
|
|
63
|
+
"bundle_ids": Array<string>;
|
|
64
|
+
};
|
|
62
65
|
|
|
63
|
-
type
|
|
66
|
+
type MacOsPreferencesPermission = "none" | "read_only" | "read_write";
|
|
64
67
|
|
|
65
68
|
type AdditionalMacOsPermissions = {
|
|
66
|
-
preferences:
|
|
67
|
-
automations:
|
|
68
|
-
accessibility: boolean
|
|
69
|
-
calendar: boolean
|
|
69
|
+
preferences: MacOsPreferencesPermission;
|
|
70
|
+
automations: MacOsAutomationPermission;
|
|
71
|
+
accessibility: boolean;
|
|
72
|
+
calendar: boolean;
|
|
70
73
|
};
|
|
71
74
|
|
|
72
75
|
type AdditionalNetworkPermissions = {
|
|
@@ -98,6 +101,10 @@ type CommandAction = {
|
|
|
98
101
|
command: string;
|
|
99
102
|
};
|
|
100
103
|
|
|
104
|
+
type CommandExecutionRequestApprovalSkillMetadata = {
|
|
105
|
+
pathToSkillsMd: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
101
108
|
type NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp";
|
|
102
109
|
|
|
103
110
|
type NetworkApprovalContext = {
|
|
@@ -143,6 +150,10 @@ type CommandExecutionRequestApprovalParams = {
|
|
|
143
150
|
* Optional additional permissions requested for this command.
|
|
144
151
|
*/
|
|
145
152
|
additionalPermissions?: AdditionalPermissionProfile | null;
|
|
153
|
+
/**
|
|
154
|
+
* Optional skill metadata when the approval was triggered by a skill script.
|
|
155
|
+
*/
|
|
156
|
+
skillMetadata?: CommandExecutionRequestApprovalSkillMetadata | null;
|
|
146
157
|
/**
|
|
147
158
|
* Optional proposed execpolicy amendment to allow similar commands without prompting.
|
|
148
159
|
*/
|
|
@@ -900,7 +911,8 @@ type TurnStartParams = {
|
|
|
900
911
|
*/
|
|
901
912
|
personality?: Personality | null;
|
|
902
913
|
/**
|
|
903
|
-
* Optional JSON Schema used to constrain the final assistant message for
|
|
914
|
+
* Optional JSON Schema used to constrain the final assistant message for
|
|
915
|
+
* this turn.
|
|
904
916
|
*/
|
|
905
917
|
outputSchema?: JsonValue | null;
|
|
906
918
|
/**
|
|
@@ -1170,27 +1182,8 @@ declare class AppServerClient {
|
|
|
1170
1182
|
private handleInboundRequest;
|
|
1171
1183
|
}
|
|
1172
1184
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
turnId: string;
|
|
1176
|
-
itemId: string;
|
|
1177
|
-
approvalId?: string | null;
|
|
1178
|
-
reason?: string | null;
|
|
1179
|
-
networkApprovalContext?: CommandExecutionRequestApprovalParams["networkApprovalContext"];
|
|
1180
|
-
command?: string | null;
|
|
1181
|
-
cwd?: string | null;
|
|
1182
|
-
commandActions?: CommandExecutionRequestApprovalParams["commandActions"];
|
|
1183
|
-
additionalPermissions?: CommandExecutionRequestApprovalParams["additionalPermissions"];
|
|
1184
|
-
proposedExecpolicyAmendment?: CommandExecutionRequestApprovalParams["proposedExecpolicyAmendment"];
|
|
1185
|
-
proposedNetworkPolicyAmendments?: CommandExecutionRequestApprovalParams["proposedNetworkPolicyAmendments"];
|
|
1186
|
-
}
|
|
1187
|
-
interface CodexFileChangeApprovalRequest {
|
|
1188
|
-
threadId: string;
|
|
1189
|
-
turnId: string;
|
|
1190
|
-
itemId: string;
|
|
1191
|
-
reason?: string | null;
|
|
1192
|
-
grantRoot?: string | null;
|
|
1193
|
-
}
|
|
1185
|
+
type CodexCommandApprovalRequest = CommandExecutionRequestApprovalParams;
|
|
1186
|
+
type CodexFileChangeApprovalRequest = FileChangeRequestApprovalParams;
|
|
1194
1187
|
type CommandApprovalHandler = (request: CodexCommandApprovalRequest) => CommandExecutionApprovalDecision | Promise<CommandExecutionApprovalDecision>;
|
|
1195
1188
|
type FileChangeApprovalHandler = (request: CodexFileChangeApprovalRequest) => FileChangeApprovalDecision | Promise<FileChangeApprovalDecision>;
|
|
1196
1189
|
interface ApprovalsDispatcherSettings {
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ type AskForApproval = "untrusted" | "on-failure" | "on-request" | {
|
|
|
19
19
|
"reject": {
|
|
20
20
|
sandbox_approval: boolean;
|
|
21
21
|
rules: boolean;
|
|
22
|
+
request_permissions: boolean;
|
|
22
23
|
mcp_elicitations: boolean;
|
|
23
24
|
};
|
|
24
25
|
} | "never";
|
|
@@ -58,15 +59,17 @@ type AdditionalFileSystemPermissions = {
|
|
|
58
59
|
write: Array<AbsolutePathBuf> | null;
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
type
|
|
62
|
+
type MacOsAutomationPermission = "none" | "all" | {
|
|
63
|
+
"bundle_ids": Array<string>;
|
|
64
|
+
};
|
|
62
65
|
|
|
63
|
-
type
|
|
66
|
+
type MacOsPreferencesPermission = "none" | "read_only" | "read_write";
|
|
64
67
|
|
|
65
68
|
type AdditionalMacOsPermissions = {
|
|
66
|
-
preferences:
|
|
67
|
-
automations:
|
|
68
|
-
accessibility: boolean
|
|
69
|
-
calendar: boolean
|
|
69
|
+
preferences: MacOsPreferencesPermission;
|
|
70
|
+
automations: MacOsAutomationPermission;
|
|
71
|
+
accessibility: boolean;
|
|
72
|
+
calendar: boolean;
|
|
70
73
|
};
|
|
71
74
|
|
|
72
75
|
type AdditionalNetworkPermissions = {
|
|
@@ -98,6 +101,10 @@ type CommandAction = {
|
|
|
98
101
|
command: string;
|
|
99
102
|
};
|
|
100
103
|
|
|
104
|
+
type CommandExecutionRequestApprovalSkillMetadata = {
|
|
105
|
+
pathToSkillsMd: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
101
108
|
type NetworkApprovalProtocol = "http" | "https" | "socks5Tcp" | "socks5Udp";
|
|
102
109
|
|
|
103
110
|
type NetworkApprovalContext = {
|
|
@@ -143,6 +150,10 @@ type CommandExecutionRequestApprovalParams = {
|
|
|
143
150
|
* Optional additional permissions requested for this command.
|
|
144
151
|
*/
|
|
145
152
|
additionalPermissions?: AdditionalPermissionProfile | null;
|
|
153
|
+
/**
|
|
154
|
+
* Optional skill metadata when the approval was triggered by a skill script.
|
|
155
|
+
*/
|
|
156
|
+
skillMetadata?: CommandExecutionRequestApprovalSkillMetadata | null;
|
|
146
157
|
/**
|
|
147
158
|
* Optional proposed execpolicy amendment to allow similar commands without prompting.
|
|
148
159
|
*/
|
|
@@ -900,7 +911,8 @@ type TurnStartParams = {
|
|
|
900
911
|
*/
|
|
901
912
|
personality?: Personality | null;
|
|
902
913
|
/**
|
|
903
|
-
* Optional JSON Schema used to constrain the final assistant message for
|
|
914
|
+
* Optional JSON Schema used to constrain the final assistant message for
|
|
915
|
+
* this turn.
|
|
904
916
|
*/
|
|
905
917
|
outputSchema?: JsonValue | null;
|
|
906
918
|
/**
|
|
@@ -1170,27 +1182,8 @@ declare class AppServerClient {
|
|
|
1170
1182
|
private handleInboundRequest;
|
|
1171
1183
|
}
|
|
1172
1184
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
turnId: string;
|
|
1176
|
-
itemId: string;
|
|
1177
|
-
approvalId?: string | null;
|
|
1178
|
-
reason?: string | null;
|
|
1179
|
-
networkApprovalContext?: CommandExecutionRequestApprovalParams["networkApprovalContext"];
|
|
1180
|
-
command?: string | null;
|
|
1181
|
-
cwd?: string | null;
|
|
1182
|
-
commandActions?: CommandExecutionRequestApprovalParams["commandActions"];
|
|
1183
|
-
additionalPermissions?: CommandExecutionRequestApprovalParams["additionalPermissions"];
|
|
1184
|
-
proposedExecpolicyAmendment?: CommandExecutionRequestApprovalParams["proposedExecpolicyAmendment"];
|
|
1185
|
-
proposedNetworkPolicyAmendments?: CommandExecutionRequestApprovalParams["proposedNetworkPolicyAmendments"];
|
|
1186
|
-
}
|
|
1187
|
-
interface CodexFileChangeApprovalRequest {
|
|
1188
|
-
threadId: string;
|
|
1189
|
-
turnId: string;
|
|
1190
|
-
itemId: string;
|
|
1191
|
-
reason?: string | null;
|
|
1192
|
-
grantRoot?: string | null;
|
|
1193
|
-
}
|
|
1185
|
+
type CodexCommandApprovalRequest = CommandExecutionRequestApprovalParams;
|
|
1186
|
+
type CodexFileChangeApprovalRequest = FileChangeRequestApprovalParams;
|
|
1194
1187
|
type CommandApprovalHandler = (request: CodexCommandApprovalRequest) => CommandExecutionApprovalDecision | Promise<CommandExecutionApprovalDecision>;
|
|
1195
1188
|
type FileChangeApprovalHandler = (request: CodexFileChangeApprovalRequest) => FileChangeApprovalDecision | Promise<FileChangeApprovalDecision>;
|
|
1196
1189
|
interface ApprovalsDispatcherSettings {
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,6 @@ import { join } from 'path';
|
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
7
7
|
import { NoSuchModelError } from '@ai-sdk/provider';
|
|
8
8
|
|
|
9
|
-
// src/utils/object.ts
|
|
10
|
-
function stripUndefined(obj) {
|
|
11
|
-
return Object.fromEntries(
|
|
12
|
-
Object.entries(obj).filter(([, value]) => value !== void 0)
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
9
|
// src/approvals.ts
|
|
17
10
|
var ApprovalsDispatcher = class {
|
|
18
11
|
onCommandApproval;
|
|
@@ -25,37 +18,14 @@ var ApprovalsDispatcher = class {
|
|
|
25
18
|
const unsubCommand = client.onRequest(
|
|
26
19
|
"item/commandExecution/requestApproval",
|
|
27
20
|
async (params, _request) => {
|
|
28
|
-
const
|
|
29
|
-
const request = stripUndefined({
|
|
30
|
-
threadId: p.threadId,
|
|
31
|
-
turnId: p.turnId,
|
|
32
|
-
itemId: p.itemId,
|
|
33
|
-
approvalId: p.approvalId,
|
|
34
|
-
reason: p.reason,
|
|
35
|
-
networkApprovalContext: p.networkApprovalContext,
|
|
36
|
-
command: p.command,
|
|
37
|
-
cwd: p.cwd,
|
|
38
|
-
commandActions: p.commandActions,
|
|
39
|
-
additionalPermissions: p.additionalPermissions,
|
|
40
|
-
proposedExecpolicyAmendment: p.proposedExecpolicyAmendment,
|
|
41
|
-
proposedNetworkPolicyAmendments: p.proposedNetworkPolicyAmendments
|
|
42
|
-
});
|
|
43
|
-
const decision = await this.onCommandApproval(request);
|
|
21
|
+
const decision = await this.onCommandApproval(params);
|
|
44
22
|
return { decision };
|
|
45
23
|
}
|
|
46
24
|
);
|
|
47
25
|
const unsubFileChange = client.onRequest(
|
|
48
26
|
"item/fileChange/requestApproval",
|
|
49
27
|
async (params, _request) => {
|
|
50
|
-
const
|
|
51
|
-
const request = stripUndefined({
|
|
52
|
-
threadId: p.threadId,
|
|
53
|
-
turnId: p.turnId,
|
|
54
|
-
itemId: p.itemId,
|
|
55
|
-
reason: p.reason,
|
|
56
|
-
grantRoot: p.grantRoot
|
|
57
|
-
});
|
|
58
|
-
const decision = await this.onFileChangeApproval(request);
|
|
28
|
+
const decision = await this.onFileChangeApproval(params);
|
|
59
29
|
return { decision };
|
|
60
30
|
}
|
|
61
31
|
);
|
|
@@ -80,6 +50,13 @@ var CodexNotImplementedError = class extends CodexProviderError {
|
|
|
80
50
|
}
|
|
81
51
|
};
|
|
82
52
|
|
|
53
|
+
// src/utils/object.ts
|
|
54
|
+
function stripUndefined(obj) {
|
|
55
|
+
return Object.fromEntries(
|
|
56
|
+
Object.entries(obj).filter(([, value]) => value !== void 0)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
83
60
|
// src/client/app-server-client.ts
|
|
84
61
|
var JsonRpcError = class extends CodexProviderError {
|
|
85
62
|
code;
|
|
@@ -956,7 +933,7 @@ var DynamicToolsDispatcher = class {
|
|
|
956
933
|
// package.json
|
|
957
934
|
var package_default = {
|
|
958
935
|
name: "@janole/ai-sdk-provider-codex-asp",
|
|
959
|
-
version: "0.3.
|
|
936
|
+
version: "0.3.5"};
|
|
960
937
|
|
|
961
938
|
// src/package-info.ts
|
|
962
939
|
var PACKAGE_NAME = package_default.name;
|
|
@@ -1859,16 +1836,28 @@ function extractToolResults(prompt, callId) {
|
|
|
1859
1836
|
if (callId && part.toolCallId !== callId) {
|
|
1860
1837
|
continue;
|
|
1861
1838
|
}
|
|
1862
|
-
if (part.output.type === "text") {
|
|
1839
|
+
if (part.output.type === "text" || part.output.type === "error-text") {
|
|
1863
1840
|
contentItems.push({ type: "inputText", text: part.output.value });
|
|
1864
|
-
|
|
1841
|
+
if (part.output.type === "error-text") {
|
|
1842
|
+
success = false;
|
|
1843
|
+
}
|
|
1844
|
+
} else if (part.output.type === "json" || part.output.type === "error-json") {
|
|
1865
1845
|
contentItems.push({ type: "inputText", text: JSON.stringify(part.output.value) });
|
|
1846
|
+
if (part.output.type === "error-json") {
|
|
1847
|
+
success = false;
|
|
1848
|
+
}
|
|
1866
1849
|
} else if (part.output.type === "execution-denied") {
|
|
1867
1850
|
success = false;
|
|
1868
1851
|
contentItems.push({
|
|
1869
1852
|
type: "inputText",
|
|
1870
1853
|
text: part.output.reason ?? "Tool execution was denied."
|
|
1871
1854
|
});
|
|
1855
|
+
} else if (part.output.type === "content") {
|
|
1856
|
+
for (const item of part.output.value) {
|
|
1857
|
+
if (item.type === "text") {
|
|
1858
|
+
contentItems.push({ type: "inputText", text: item.text });
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1872
1861
|
}
|
|
1873
1862
|
}
|
|
1874
1863
|
}
|