Improve WeChat MP replies and ship MindSpace/H5 production updates.
Add WeChat service account routing with sync acks, connectivity tests, and context isolation; document deploy runbooks; and bundle related MindSpace, voice, Plaza, and server gateway changes for production rollout. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+29
-8
@@ -67,24 +67,45 @@ async function readJson(upstream) {
|
||||
return text ? JSON.parse(text) : null;
|
||||
}
|
||||
|
||||
function isInvalidDirectoryPathError(err) {
|
||||
return err instanceof Error && /Invalid directory path/i.test(err.message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-apply H5 session policy after resume so stale extension sets cannot bypass capability limits.
|
||||
*/
|
||||
export async function reconcileAgentSession(
|
||||
apiFetch,
|
||||
sessionId,
|
||||
{ workingDir, sessionPolicy, sandboxConstraints = null, userContext = null },
|
||||
{
|
||||
workingDir,
|
||||
sessionPolicy,
|
||||
sandboxConstraints = null,
|
||||
userContext = null,
|
||||
tolerateInvalidWorkingDir = false,
|
||||
},
|
||||
) {
|
||||
if (sessionPolicy?.unrestricted) return;
|
||||
|
||||
const session = await readJson(await apiFetch(`/sessions/${sessionId}`));
|
||||
if (!samePath(session?.working_dir, workingDir)) {
|
||||
await readJson(
|
||||
await apiFetch('/agent/update_working_dir', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ session_id: sessionId, working_dir: workingDir }),
|
||||
}),
|
||||
);
|
||||
if (workingDir && !samePath(session?.working_dir, workingDir)) {
|
||||
try {
|
||||
await readJson(
|
||||
await apiFetch('/agent/update_working_dir', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ session_id: sessionId, working_dir: workingDir }),
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
if (!(tolerateInvalidWorkingDir && isInvalidDirectoryPathError(err))) {
|
||||
throw err;
|
||||
}
|
||||
console.warn(
|
||||
`[session-reconcile] skip invalid working_dir during resume for session ${sessionId}: ${
|
||||
err.message
|
||||
}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionPolicy?.gooseMode) {
|
||||
|
||||
Reference in New Issue
Block a user