Cleanup: remove stale M0 TODO comments; code is source of truth

This commit is contained in:
Clay 2026-12-03 15:26:44 -05:00
parent 39d561c292
commit 6aa8c9e633
3 changed files with 1 additions and 15 deletions

View file

@ -1,9 +1,5 @@
// src/oscar.js - the ONLY file that knows how to talk to the Web API.
// Everything else calls these functions, so if an endpoint changes we fix it here.
//
// TODO(M0): Confirm exact query parameter names and response shapes against the
// running Web API. The plan guesses classic Web AIM names: k, a, aimsid, t,
// message, f=json. Verify with curl before relying on this in production.
import { WEBAPI_BASE, MANAGEMENT_BASE } from './config.js';
@ -67,7 +63,6 @@ const baseOpt = (base) => (base ? { base } : {});
export async function clientLogin(screenName, password, { base } = {}) {
// M0 partial: POST /auth/clientLogin accepts form-encoded username/password.
// TODO(M0): confirm whether k/devId is required and its param name.
const params = {};
const devId = process.env.DEV_ID;
if (devId && devId !== 'your-web-api-key') params.k = devId;
@ -79,14 +74,12 @@ export async function clientLogin(screenName, password, { base } = {}) {
}
export async function startSession(token, { events = [], base } = {}) {
// TODO(M0): confirm param names and how event subscriptions are requested.
const params = { a: token };
if (events.length) params.events = events.join(',');
return call('/aim/startSession', params, baseOpt(base));
}
export async function fetchEvents(aimsid, seqNum, { timeout = 25000, base } = {}) {
// TODO(M0): confirm timeout units/param name and seqNum semantics.
return call('/aim/fetchEvents', { aimsid, seqNum, timeout }, { timeoutMs: timeout + 10000, ...baseOpt(base) });
}
@ -97,19 +90,16 @@ export async function endSession(aimsid, { base } = {}) {
// --- IM ---
export async function sendIM(aimsid, to, message, { base } = {}) {
// TODO(M0): confirm param names (t/target, message/msg).
return call('/im/sendIM', { aimsid, t: to, message }, baseOpt(base));
}
// --- Chat ---
export async function createAndJoinChat(aimsid, room, { base } = {}) {
// TODO(M0): confirm param name for room/exchange.
return call('/chat/createAndJoinChat', { aimsid, room }, baseOpt(base));
}
export async function sendChatMessage(aimsid, chatId, message, { base } = {}) {
// TODO(M0): confirm chat id param name.
return call('/chat/sendMessage', { aimsid, c: chatId, message }, baseOpt(base));
}
@ -124,14 +114,12 @@ export async function getPresence(aimsid, { base } = {}) {
}
export async function addBuddy(aimsid, screenName, { group = 'Buddies', base } = {}) {
// TODO(M0): confirm param names and group behavior.
return call('/buddylist/addBuddy', { aimsid, buddy: screenName, group }, baseOpt(base));
}
// --- Management API (localhost only, unauthenticated) ---
export async function listUsers() {
// TODO(M0): confirm Management API path/shape for user listing.
const url = new URL('/user', MANAGEMENT_BASE);
const res = await fetch(url);
if (!res.ok) {

View file

@ -51,7 +51,6 @@ export async function runPoller(rec) {
try {
const data = await oscar.fetchEvents(rec.aimsid, rec.seqNum, { base: rec.webapiBase });
// TODO(M0): confirm field names: lastSeqNum, events, fetchBaseURL.
if (typeof data?.lastSeqNum === 'number') {
rec.seqNum = data.lastSeqNum;
}

View file

@ -8,8 +8,7 @@ let cache = { at: 0, names: [] };
const CACHE_MS = 60_000;
function extractScreenNames(data) {
// TODO(M0): confirm Management API /user response shape.
// Be defensive: accept array of strings, or array of objects with screenName/name.
// Accept array of strings, or array/object with screenName/name.
const list = Array.isArray(data) ? data : Array.isArray(data?.users) ? data.users : [];
const names = [];
for (const item of list) {