Add room skill setting mutations (#133)

* add gated codex goals support

* sync README SDK versions

* bump claude agent sdk

* add codex goals settings toggle

* reuse status dashboard message and simplify settings actions

* refine settings page UX

* fix settings nav hash routing

* add dashboard UX verification

* refine dashboard settings and inbox UX

* remove inbox top-level navigation

* remove dashboard health top-level navigation

* fix: allow runtime image attachment paths

* feat: configure attachment allowlist dirs

* fix: clean duplicate dashboard status messages

* fix: poll dashboard duplicate cleanup between status updates

* fix: delete dashboard duplicates on create

* Refine settings IA with tabbed sections

* Add read-only runtime inventory settings

* Fix runtime inventory MCP JSON parsing

* Add room skill settings inventory

* Add room skill setting mutations
This commit is contained in:
Eyejoker
2026-05-04 03:27:35 +09:00
committed by GitHub
parent e90703d124
commit 85da2b918c
11 changed files with 577 additions and 17 deletions

View File

@@ -25,7 +25,10 @@ import {
} from './runtime-inventory.js';
import {
getRoomSkillSettings,
RoomSkillSettingsError,
updateRoomSkillSetting,
type RoomSkillSettingsSnapshot,
type RoomSkillSettingUpdateInput,
} from './room-skill-settings.js';
import {
checkMoaModel,
@@ -60,6 +63,7 @@ export interface SettingsRouteDependencies {
updateFastMode: typeof updateFastMode;
updateModelConfig: typeof updateModelConfig;
updateMoaSettings: typeof updateMoaSettings;
updateRoomSkillSetting: typeof updateRoomSkillSetting;
}
interface SettingsRouteContext {
@@ -89,6 +93,7 @@ const defaultSettingsRouteDependencies: SettingsRouteDependencies = {
updateFastMode,
updateModelConfig,
updateMoaSettings,
updateRoomSkillSetting,
};
function readMethod(method: string): boolean {
@@ -118,6 +123,19 @@ function errorMessage(err: unknown): string {
return err instanceof Error ? err.message : String(err);
}
function methodNotAllowed(
jsonResponse: JsonResponse,
allowed: string[],
): Response {
return jsonResponse(
{ error: 'Method not allowed' },
{
status: 405,
headers: { Allow: allowed.join(', ') },
},
);
}
async function handleModelSettingsRoute(
request: Request,
jsonResponse: JsonResponse,
@@ -228,13 +246,42 @@ function handleRuntimeInventoryRoute(
return jsonResponse(deps.getRuntimeInventory());
}
function handleRoomSkillsRoute(
async function handleRoomSkillsRoute(
request: Request,
jsonResponse: JsonResponse,
deps: SettingsRouteDependencies,
): Response | null {
if (!readMethod(request.method)) return null;
return jsonResponse(deps.getRoomSkillSettings());
): Promise<Response> {
if (readMethod(request.method)) {
return jsonResponse(deps.getRoomSkillSettings());
}
if (request.method !== 'PATCH' && request.method !== 'PUT') {
return methodNotAllowed(jsonResponse, ['GET', 'HEAD', 'PATCH', 'PUT']);
}
const body = await readJsonObject(request, jsonResponse);
if (body instanceof Response) return body;
const input: RoomSkillSettingUpdateInput = {
roomJid: typeof body.roomJid === 'string' ? body.roomJid : '',
agentType: typeof body.agentType === 'string' ? body.agentType : '',
skillId: typeof body.skillId === 'string' ? body.skillId : '',
enabled: body.enabled === true,
};
if (typeof body.enabled !== 'boolean') {
return jsonResponse(
{ error: 'enabled must be a boolean' },
{ status: 400 },
);
}
try {
return jsonResponse(deps.updateRoomSkillSetting(input));
} catch (err) {
if (err instanceof RoomSkillSettingsError) {
return jsonResponse({ error: err.message }, { status: err.status });
}
return jsonResponse({ error: errorMessage(err) }, { status: 500 });
}
}
async function handleClaudeAccountAddRoute(