@ccpocket/bridge 1.81.1 → 1.81.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/dist/codex-process.d.ts +4 -1
- package/dist/codex-process.js +18 -15
- package/dist/codex-process.js.map +1 -1
- package/dist/session.js +27 -21
- package/dist/session.js.map +1 -1
- package/dist/usage.d.ts +9 -9
- package/dist/usage.js +40 -148
- package/dist/usage.js.map +1 -1
- package/dist/websocket.js +3 -2
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/dist/codex-process.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import type { CodexGoal, CodexGoalStatus, ServerMessage, ProcessStatus } from "./parser.js";
|
|
3
3
|
import { buildCodexSpawnSpec } from "./codex-transport.js";
|
|
4
|
+
import type { CodexRateLimitsResponse } from "./usage.js";
|
|
4
5
|
export { buildCodexSpawnSpec };
|
|
5
6
|
export interface CodexStartOptions {
|
|
6
7
|
threadId?: string;
|
|
@@ -245,7 +246,8 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
|
|
|
245
246
|
listAvailableModels(): Promise<string[]>;
|
|
246
247
|
listAvailableModelMetadata(): Promise<CodexModelMetadata[]>;
|
|
247
248
|
start(projectPath: string, options?: CodexStartOptions): void;
|
|
248
|
-
initializeOnly(projectPath: string): Promise<void>;
|
|
249
|
+
initializeOnly(projectPath: string, timeoutMs?: number): Promise<void>;
|
|
250
|
+
readRateLimits(timeoutMs?: number): Promise<CodexRateLimitsResponse>;
|
|
249
251
|
waitUntilReady(): Promise<void>;
|
|
250
252
|
stop(): void;
|
|
251
253
|
private prepareLaunch;
|
|
@@ -367,5 +369,6 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
|
|
|
367
369
|
private extractToolUseId;
|
|
368
370
|
private handleServerRequestResolved;
|
|
369
371
|
}
|
|
372
|
+
export declare function normalizeCodexReasoningEffortForModel(model: unknown, value: CodexStartOptions["modelReasoningEffort"]): CodexStartOptions["modelReasoningEffort"];
|
|
370
373
|
/** Validate the app-server ThreadGoal payload at the process boundary. */
|
|
371
374
|
export declare function parseCodexGoal(value: unknown): CodexGoal;
|
package/dist/codex-process.js
CHANGED
|
@@ -179,9 +179,9 @@ export class CodexProcess extends EventEmitter {
|
|
|
179
179
|
this._runtimeModel = sanitizedModel;
|
|
180
180
|
this.startModel = sanitizedModel;
|
|
181
181
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
const requestedReasoningEffort = modelReasoningEffort ?? this._runtimeModelReasoningEffort;
|
|
183
|
+
if (requestedReasoningEffort !== undefined) {
|
|
184
|
+
this._runtimeModelReasoningEffort = normalizeCodexReasoningEffortForModel(this.model, requestedReasoningEffort);
|
|
185
185
|
}
|
|
186
186
|
console.log(`[codex-process] Model changed to: ${this.model}` +
|
|
187
187
|
(this._runtimeModelReasoningEffort
|
|
@@ -415,7 +415,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
415
415
|
this.launchAppServer(projectPath, options);
|
|
416
416
|
void this.bootstrap(projectPath, options);
|
|
417
417
|
}
|
|
418
|
-
async initializeOnly(projectPath) {
|
|
418
|
+
async initializeOnly(projectPath, timeoutMs) {
|
|
419
419
|
if (this.transport) {
|
|
420
420
|
this.stop();
|
|
421
421
|
}
|
|
@@ -423,7 +423,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
423
423
|
try {
|
|
424
424
|
this.prepareLaunch(projectPath);
|
|
425
425
|
this.launchAppServer(projectPath);
|
|
426
|
-
await this.initializeRpcConnection();
|
|
426
|
+
await this.initializeRpcConnection(timeoutMs);
|
|
427
427
|
this.setStatus("idle");
|
|
428
428
|
this.resolveReadiness();
|
|
429
429
|
}
|
|
@@ -432,6 +432,9 @@ export class CodexProcess extends EventEmitter {
|
|
|
432
432
|
throw error;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
+
async readRateLimits(timeoutMs = 10_000) {
|
|
436
|
+
return (await this.request("account/rateLimits/read", undefined, timeoutMs));
|
|
437
|
+
}
|
|
435
438
|
waitUntilReady() {
|
|
436
439
|
if (this.readiness === "ready")
|
|
437
440
|
return Promise.resolve();
|
|
@@ -473,7 +476,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
473
476
|
this.lastTokenUsage = null;
|
|
474
477
|
this.startModel = sanitizeCodexModel(options?.model);
|
|
475
478
|
this._runtimeModel = undefined;
|
|
476
|
-
this._runtimeModelReasoningEffort = options?.modelReasoningEffort;
|
|
479
|
+
this._runtimeModelReasoningEffort = normalizeCodexReasoningEffortForModel(this.startModel, options?.modelReasoningEffort);
|
|
477
480
|
this._runtimeServiceTier =
|
|
478
481
|
options?.serviceTier === undefined
|
|
479
482
|
? undefined
|
|
@@ -1014,9 +1017,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
1014
1017
|
}
|
|
1015
1018
|
const threadConfig = {};
|
|
1016
1019
|
const requestedModel = sanitizeCodexModel(options?.model);
|
|
1017
|
-
const requestedReasoningEffort = options?.modelReasoningEffort
|
|
1018
|
-
? normalizeReasoningEffort(options.modelReasoningEffort)
|
|
1019
|
-
: undefined;
|
|
1020
|
+
const requestedReasoningEffort = normalizeCodexReasoningEffortForModel(requestedModel, options?.modelReasoningEffort);
|
|
1020
1021
|
if (requestedModel)
|
|
1021
1022
|
threadParams.model = requestedModel;
|
|
1022
1023
|
if (options?.serviceTier !== undefined) {
|
|
@@ -1177,7 +1178,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
1177
1178
|
});
|
|
1178
1179
|
return extractPermissionsFromConfigRead(response, projectLookupPaths, this.platform, profile);
|
|
1179
1180
|
}
|
|
1180
|
-
async initializeRpcConnection() {
|
|
1181
|
+
async initializeRpcConnection(timeoutMs) {
|
|
1181
1182
|
await this.request("initialize", {
|
|
1182
1183
|
clientInfo: {
|
|
1183
1184
|
name: "ccpocket_bridge",
|
|
@@ -1187,7 +1188,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
1187
1188
|
capabilities: {
|
|
1188
1189
|
experimentalApi: true,
|
|
1189
1190
|
},
|
|
1190
|
-
});
|
|
1191
|
+
}, timeoutMs);
|
|
1191
1192
|
this.notify("initialized", {});
|
|
1192
1193
|
}
|
|
1193
1194
|
async readProfileConfig(cwd) {
|
|
@@ -1429,9 +1430,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
1429
1430
|
const requestedModel = sanitizeCodexModel(this._runtimeModel) ??
|
|
1430
1431
|
sanitizeCodexModel(options?.model);
|
|
1431
1432
|
const requestedReasoningEffort = this._runtimeModelReasoningEffort ??
|
|
1432
|
-
(options?.modelReasoningEffort
|
|
1433
|
-
? normalizeReasoningEffort(options.modelReasoningEffort)
|
|
1434
|
-
: undefined);
|
|
1433
|
+
normalizeCodexReasoningEffortForModel(requestedModel, options?.modelReasoningEffort);
|
|
1435
1434
|
if (requestedModel)
|
|
1436
1435
|
params.model = requestedModel;
|
|
1437
1436
|
if (requestedReasoningEffort) {
|
|
@@ -2878,7 +2877,11 @@ function normalizeSandboxMode(value) {
|
|
|
2878
2877
|
return "workspace-write";
|
|
2879
2878
|
}
|
|
2880
2879
|
}
|
|
2881
|
-
function
|
|
2880
|
+
export function normalizeCodexReasoningEffortForModel(model, value) {
|
|
2881
|
+
if (sanitizeCodexModel(model) === "gpt-6-astra" &&
|
|
2882
|
+
(value === "none" || value === "minimal")) {
|
|
2883
|
+
return "low";
|
|
2884
|
+
}
|
|
2882
2885
|
return value;
|
|
2883
2886
|
}
|
|
2884
2887
|
function extractReasoningEfforts(raw) {
|