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:
@@ -1,6 +1,10 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { extensionConfigsMatch, extensionsNeedingRefresh } from './session-reconcile.mjs';
|
||||
import {
|
||||
extensionConfigsMatch,
|
||||
extensionsNeedingRefresh,
|
||||
reconcileAgentSession,
|
||||
} from './session-reconcile.mjs';
|
||||
|
||||
test('extensionConfigsMatch compares available_tools', () => {
|
||||
const sessionExt = { name: 'developer', available_tools: ['write', 'edit'] };
|
||||
@@ -43,3 +47,50 @@ test('extensionsNeedingRefresh adds missing extensions', () => {
|
||||
assert.equal(toAdd.length, 1);
|
||||
assert.equal(toAdd[0].name, 'summon');
|
||||
});
|
||||
|
||||
test('reconcileAgentSession tolerates invalid working directory during resume sync', async () => {
|
||||
const calls = [];
|
||||
const apiFetch = async (pathname) => {
|
||||
calls.push(pathname);
|
||||
if (pathname === '/sessions/session-1') {
|
||||
return {
|
||||
ok: true,
|
||||
text: async () => JSON.stringify({ working_dir: '/stale/workspace' }),
|
||||
};
|
||||
}
|
||||
if (pathname === '/agent/update_working_dir') {
|
||||
return {
|
||||
ok: false,
|
||||
status: 400,
|
||||
text: async () => 'Invalid directory path',
|
||||
};
|
||||
}
|
||||
if (pathname === '/sessions/session-1/extensions') {
|
||||
return {
|
||||
ok: true,
|
||||
text: async () => JSON.stringify({ extensions: [] }),
|
||||
};
|
||||
}
|
||||
if (pathname === '/agent/restart') {
|
||||
return {
|
||||
ok: true,
|
||||
text: async () => JSON.stringify({ ok: true }),
|
||||
};
|
||||
}
|
||||
throw new Error(`unexpected path: ${pathname}`);
|
||||
};
|
||||
|
||||
await reconcileAgentSession(apiFetch, 'session-1', {
|
||||
workingDir: '/valid/workspace',
|
||||
sessionPolicy: { extensionOverrides: [] },
|
||||
tolerateInvalidWorkingDir: true,
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
'/sessions/session-1',
|
||||
'/agent/update_working_dir',
|
||||
'/sessions/session-1/extensions',
|
||||
'/sessions/session-1/extensions',
|
||||
'/agent/restart',
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user