chore: rebuild CentOS7 release package

This commit is contained in:
shiyue
2026-06-25 21:52:09 +08:00
parent 04dd48deb2
commit c387c92e4b
11 changed files with 924 additions and 34 deletions

View File

@@ -89,6 +89,8 @@ function ensureThread(threadId, params = {}) {
activeTurnId: null,
timer: null,
steers: [],
capacityRetryAttempts: new Map(),
reconnectRetryAttempts: new Map(),
goal: null,
});
}
@@ -463,6 +465,60 @@ function completeMcpToolTurn(thread, turnId) {
completeTurn(thread, turnId, `mcp result: ${JSON.stringify(payload)}`);
}
function emitCapacityError(thread, turnId) {
send({
method: 'error',
params: {
threadId: thread.id,
turnId,
type: 'error',
error: {
type: 'service_unavailable_error',
code: 'server_is_overloaded',
message: 'Our servers are currently overloaded. Please try again later.',
param: null,
},
sequence_number: 2,
},
});
thread.activeTurnId = null;
}
function emitPartialCapacityOutput(thread, turnId) {
send({
method: 'item/agentMessage/delta',
params: {
threadId: thread.id,
turnId,
itemId: 'agent-msg',
delta: 'partial capacity output before retry',
},
});
send({
method: 'item/started',
params: {
threadId: thread.id,
turnId,
startedAtMs: Date.now(),
item: {
id: 'capacity-tool',
type: 'commandExecution',
command: '/bin/bash -lc echo capacity',
status: 'inProgress',
},
},
});
send({
method: 'item/commandExecution/outputDelta',
params: {
threadId: thread.id,
turnId,
itemId: 'capacity-tool',
delta: 'capacity tool output\n',
},
});
}
function completeGuidedInputTurn(thread, turnId) {
requestClient('item/tool/requestUserInput', {
threadId: thread.id,
@@ -566,6 +622,34 @@ function startTurn(params) {
}
}
if (/codexapp capacity retry/i.test(text)) {
const attempts = (thread.capacityRetryAttempts.get(text) || 0) + 1;
thread.capacityRetryAttempts.set(text, attempts);
if (attempts <= 2) {
if (attempts === 2) emitPartialCapacityOutput(thread, turnId);
emitCapacityError(thread, turnId);
return { turn: { id: turnId, status: 'running', items: [] } };
}
}
if (/codexapp reconnect retry/i.test(text)) {
const attempts = (thread.reconnectRetryAttempts.get(text) || 0) + 1;
thread.reconnectRetryAttempts.set(text, attempts);
if (attempts === 1) {
emitPartialCapacityOutput(thread, turnId);
send({
method: 'error',
params: {
threadId: thread.id,
turnId,
message: 'Reconnecting... 1/5',
},
});
thread.activeTurnId = null;
return { turn: { id: turnId, status: 'running', items: [] } };
}
}
if (/collaboration/i.test(text)) {
completeTurn(thread, turnId, `collaboration mode: ${collaborationSummary(params)}`);
return { turn: { id: turnId, status: 'running', items: [] } };