@janole/ai-sdk-provider-codex-asp 0.1.7 → 0.2.0
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 +13 -4
- package/dist/index.cjs +33 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -3
- package/dist/index.d.ts +105 -3
- package/dist/index.js +33 -6
- 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.105.0) 0.105.0.
|
|
6
6
|
|
|
7
7
|
- `LanguageModelV3` provider implementation
|
|
8
8
|
- Streaming (`streamText`) and non-streaming (`generateText`)
|
|
@@ -111,7 +111,7 @@ const codex = createCodexAppServer({
|
|
|
111
111
|
clientInfo?: { name, version, title? }, // defaults to package.json
|
|
112
112
|
transport?: { type: 'stdio' | 'websocket', stdio?, websocket? },
|
|
113
113
|
persistent?: { poolSize?, idleTimeoutMs?, scope?, key? },
|
|
114
|
-
compaction?: {
|
|
114
|
+
compaction?: { shouldCompactOnResume?, strict? }, // optional thread/compact/start before resumed turns
|
|
115
115
|
debug?: { logPackets?, logger? }, // packet-level JSON-RPC debug logging
|
|
116
116
|
defaultThreadSettings?: { cwd?, approvalPolicy?, sandbox? },
|
|
117
117
|
defaultTurnSettings?: { cwd?, approvalPolicy?, sandboxPolicy?, model?, effort?, summary? },
|
|
@@ -171,6 +171,8 @@ npx tsx examples/stream-text.ts
|
|
|
171
171
|
- Empty generated text:
|
|
172
172
|
- Verify Codex emits `item/agentMessage/delta` and `turn/completed` notifications.
|
|
173
173
|
- Compaction fails on resumed threads:
|
|
174
|
+
- Set `compaction.shouldCompactOnResume: true` to always compact resumed threads.
|
|
175
|
+
- Or provide `compaction.shouldCompactOnResume: (ctx) => boolean | Promise<boolean>` for dynamic decisions.
|
|
174
176
|
- Leave `compaction.strict` unset/false to continue the turn when `thread/compact/start` fails.
|
|
175
177
|
- Set `compaction.strict: true` if you want compaction failures to fail fast.
|
|
176
178
|
|
|
@@ -184,8 +186,10 @@ npm run qa # lint + typecheck + test (all-in-one)
|
|
|
184
186
|
|
|
185
187
|
### Generated Protocol Types
|
|
186
188
|
|
|
187
|
-
`src/protocol/app-server-protocol/` is gitignored, but selected generated files are intentionally tracked
|
|
188
|
-
|
|
189
|
+
`src/protocol/app-server-protocol/` is gitignored, but selected generated files are intentionally tracked with `git add -f` so protocol shape changes stay visible in PRs.
|
|
190
|
+
|
|
191
|
+
Important: for every tracked generated file, all imported generated type dependencies (direct + transitive) must also be tracked.
|
|
192
|
+
Use the local skill `.codex/skills/codex-protocol-type-upgrade/SKILL.md` for the exact workflow.
|
|
189
193
|
|
|
190
194
|
When protocol shapes change, clean and regenerate:
|
|
191
195
|
|
|
@@ -194,6 +198,11 @@ rm -rf src/protocol/app-server-protocol
|
|
|
194
198
|
npm run codex:generate-types
|
|
195
199
|
```
|
|
196
200
|
|
|
201
|
+
Then follow the skill workflow to:
|
|
202
|
+
- adapt runtime mappings if needed
|
|
203
|
+
- add missing generated dependencies with `git add -f`
|
|
204
|
+
- run `npm run typecheck` (and focused tests)
|
|
205
|
+
|
|
197
206
|
## License
|
|
198
207
|
|
|
199
208
|
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -15,8 +15,8 @@ var ApprovalsDispatcher = class {
|
|
|
15
15
|
onCommandApproval;
|
|
16
16
|
onFileChangeApproval;
|
|
17
17
|
constructor(settings = {}) {
|
|
18
|
-
this.onCommandApproval = settings.onCommandApproval ?? (() => "
|
|
19
|
-
this.onFileChangeApproval = settings.onFileChangeApproval ?? (() => "
|
|
18
|
+
this.onCommandApproval = settings.onCommandApproval ?? (() => "decline");
|
|
19
|
+
this.onFileChangeApproval = settings.onFileChangeApproval ?? (() => "decline");
|
|
20
20
|
}
|
|
21
21
|
attach(client) {
|
|
22
22
|
const unsubCommand = client.onRequest(
|
|
@@ -29,8 +29,13 @@ var ApprovalsDispatcher = class {
|
|
|
29
29
|
itemId: p.itemId,
|
|
30
30
|
approvalId: p.approvalId,
|
|
31
31
|
reason: p.reason,
|
|
32
|
+
networkApprovalContext: p.networkApprovalContext,
|
|
32
33
|
command: p.command,
|
|
33
|
-
cwd: p.cwd
|
|
34
|
+
cwd: p.cwd,
|
|
35
|
+
commandActions: p.commandActions,
|
|
36
|
+
additionalPermissions: p.additionalPermissions,
|
|
37
|
+
proposedExecpolicyAmendment: p.proposedExecpolicyAmendment,
|
|
38
|
+
proposedNetworkPolicyAmendments: p.proposedNetworkPolicyAmendments
|
|
34
39
|
});
|
|
35
40
|
const decision = await this.onCommandApproval(request);
|
|
36
41
|
return { decision };
|
|
@@ -881,7 +886,7 @@ var DynamicToolsDispatcher = class {
|
|
|
881
886
|
// package.json
|
|
882
887
|
var package_default = {
|
|
883
888
|
name: "@janole/ai-sdk-provider-codex-asp",
|
|
884
|
-
version: "0.
|
|
889
|
+
version: "0.2.0"};
|
|
885
890
|
|
|
886
891
|
// src/package-info.ts
|
|
887
892
|
var PACKAGE_NAME = package_default.name;
|
|
@@ -1634,10 +1639,32 @@ var CodexLanguageModel = class {
|
|
|
1634
1639
|
resumeParams
|
|
1635
1640
|
);
|
|
1636
1641
|
threadId = resumeResult.thread.id;
|
|
1637
|
-
|
|
1642
|
+
const strictCompaction = this.config.providerSettings.compaction?.strict === true;
|
|
1643
|
+
const shouldCompactOnResume = this.config.providerSettings.compaction?.shouldCompactOnResume;
|
|
1644
|
+
let shouldCompact = false;
|
|
1645
|
+
if (typeof shouldCompactOnResume === "boolean") {
|
|
1646
|
+
shouldCompact = shouldCompactOnResume;
|
|
1647
|
+
} else if (typeof shouldCompactOnResume === "function") {
|
|
1648
|
+
const compactionContext = {
|
|
1649
|
+
threadId,
|
|
1650
|
+
resumeThreadId,
|
|
1651
|
+
resumeResult,
|
|
1652
|
+
prompt: options.prompt
|
|
1653
|
+
};
|
|
1654
|
+
try {
|
|
1655
|
+
shouldCompact = await shouldCompactOnResume(compactionContext);
|
|
1656
|
+
} catch (error) {
|
|
1657
|
+
debugLog?.("inbound", "thread/compact/start:decision-error", {
|
|
1658
|
+
message: error instanceof Error ? error.message : String(error)
|
|
1659
|
+
});
|
|
1660
|
+
if (strictCompaction) {
|
|
1661
|
+
throw error;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
if (shouldCompact) {
|
|
1638
1666
|
const compactParams = { threadId };
|
|
1639
1667
|
debugLog?.("outbound", "thread/compact/start", compactParams);
|
|
1640
|
-
const strictCompaction = this.config.providerSettings.compaction.strict === true;
|
|
1641
1668
|
if (strictCompaction) {
|
|
1642
1669
|
await client.request(
|
|
1643
1670
|
"thread/compact/start",
|