doer-agent 0.7.4 → 0.7.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.
|
@@ -62,6 +62,9 @@ function normalizeCodexAppRpcRequest(args) {
|
|
|
62
62
|
const requestAgentId = typeof args.request.agentId === "string" ? args.request.agentId.trim() : "";
|
|
63
63
|
const actionRaw = typeof args.request.action === "string" ? args.request.action.trim() : "";
|
|
64
64
|
const method = typeof args.request.method === "string" ? args.request.method.trim() : "";
|
|
65
|
+
const timeoutMs = typeof args.request.timeoutMs === "number" && Number.isFinite(args.request.timeoutMs)
|
|
66
|
+
? Math.min(180_000, Math.max(1_000, Math.trunc(args.request.timeoutMs)))
|
|
67
|
+
: undefined;
|
|
65
68
|
if (!requestId || !requestAgentId || requestAgentId !== args.agentId || actionRaw !== "request" || !method) {
|
|
66
69
|
throw new Error("invalid codex app rpc request");
|
|
67
70
|
}
|
|
@@ -70,6 +73,7 @@ function normalizeCodexAppRpcRequest(args) {
|
|
|
70
73
|
action: "request",
|
|
71
74
|
method,
|
|
72
75
|
params: args.request.params,
|
|
76
|
+
timeoutMs,
|
|
73
77
|
};
|
|
74
78
|
}
|
|
75
79
|
async function handleCodexAppRpcMessage(args) {
|
|
@@ -78,7 +82,7 @@ async function handleCodexAppRpcMessage(args) {
|
|
|
78
82
|
const payload = JSON.parse(codexAppRpcCodec.decode(args.msg.data));
|
|
79
83
|
const request = normalizeCodexAppRpcRequest({ request: payload, agentId: args.agentId });
|
|
80
84
|
requestId = request.requestId;
|
|
81
|
-
const result = applyCodexAppRpcOmitRules(request.method, await args.manager.request(request.method, request.params));
|
|
85
|
+
const result = applyCodexAppRpcOmitRules(request.method, await args.manager.request(request.method, request.params, request.timeoutMs));
|
|
82
86
|
args.msg.respond(codexAppRpcCodec.encode(JSON.stringify({
|
|
83
87
|
requestId,
|
|
84
88
|
ok: true,
|
|
@@ -22,9 +22,9 @@ export class CodexAppServerClient {
|
|
|
22
22
|
constructor(options) {
|
|
23
23
|
this.options = options;
|
|
24
24
|
}
|
|
25
|
-
async request(method, params) {
|
|
25
|
+
async request(method, params, timeoutMs) {
|
|
26
26
|
await this.start();
|
|
27
|
-
return await this.requestStarted(method, params);
|
|
27
|
+
return await this.requestStarted(method, params, timeoutMs);
|
|
28
28
|
}
|
|
29
29
|
async notify(method, params) {
|
|
30
30
|
await this.start();
|
|
@@ -92,14 +92,14 @@ export class CodexAppServerClient {
|
|
|
92
92
|
});
|
|
93
93
|
await this.notify("initialized");
|
|
94
94
|
}
|
|
95
|
-
async requestStarted(method, params) {
|
|
95
|
+
async requestStarted(method, params, timeoutMsOverride) {
|
|
96
96
|
const child = this.child;
|
|
97
97
|
if (!child || child.killed) {
|
|
98
98
|
throw new Error("Codex app-server is not running");
|
|
99
99
|
}
|
|
100
100
|
const id = this.nextRequestId++;
|
|
101
101
|
const payload = params === undefined ? { id, method } : { id, method, params };
|
|
102
|
-
const timeoutMs = this.options.requestTimeoutMs ?? 30_000;
|
|
102
|
+
const timeoutMs = timeoutMsOverride ?? this.options.requestTimeoutMs ?? 30_000;
|
|
103
103
|
return await new Promise((resolve, reject) => {
|
|
104
104
|
const timer = setTimeout(() => {
|
|
105
105
|
this.pending.delete(id);
|
|
@@ -117,9 +117,9 @@ export function createCodexAppServerManager(args) {
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
return {
|
|
120
|
-
async request(method, params) {
|
|
120
|
+
async request(method, params, timeoutMs) {
|
|
121
121
|
const activeClient = await getClient();
|
|
122
|
-
return await activeClient.request(method, params);
|
|
122
|
+
return await activeClient.request(method, params, timeoutMs);
|
|
123
123
|
},
|
|
124
124
|
async restart(reason) {
|
|
125
125
|
generation += 1;
|