fix: address round-2 review findings
- apply(): only swap the current model when a Nous model was filtered out; a session on another provider is left alone, and the notice names the model actually in use instead of the first catalog hit. - Device-code poll floors the interval at 1s and treats a non-numeric interval as absent, matching pi-ai's own poller; interval: 0 from the server no longer becomes a tight loop. - Drop the provider's own context.publish: createProvider already persists and publishes the fetchModels return value with checkedAt; the extra publish was a second, timestamp-less write each refresh. - tokenRequest tolerates a literal null error body (data.error would have thrown TypeError, masking the HTTP status). - tsconfig: remove allowImportingTsExtensions and baseUrl, both inert. - .editorconfig covers .mjs. - Tests: 14 (was 8). tokenRequest is exported and its HTML/null error paths are pinned; the no-credential test now sets NOUS_API_KEY so it fails if an env fallback returns; the slash commands are driven through a recording pi (switch/notice semantics, and persist-before- mutate on a failed flag write). Stub returns a private mkdtemp dir. - CHANGELOG: /nous-catalog entry states the switch semantics.
This commit is contained in:
1 parent
00d50e10de
commit
b9065d409c
7 files changed
+117
-26
No files matched your search
+10
-3
@@ -1,6 +1,13 @@
|
||||
// Minimal stand-in for the host-injected @earendil-works/* packages; only what index.ts touches at module load.
|
||||
// Minimal stand-in for the host-injected @earendil-works/* packages; only what index.ts imports.
|
||||
import { mkdtempSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
export const envApiKeyAuth = (name, envVars) => ({ name, envVars });
|
||||
export const createProvider = (input) => input;
|
||||
export const openAICompletionsApi = () => ({ stream() {}, streamSimple() {} });
|
||||
// Used only when a test drives the default export (nousPortal), which resolves the catalog flag path at load.
|
||||
export const getAgentDir = () => "/tmp";
|
||||
// getAgentDir is called by the default export to locate the catalog flag, so tests that drive the slash
|
||||
// commands need a real, writable dir: one private dir per run, never /tmp directly. Shared through
|
||||
// globalThis because jiti evaluates this file as a separate instance from a native import.
|
||||
export const agentDir = (globalThis.__nousStubAgentDir ??= mkdtempSync(join(tmpdir(), "nous-portal-stub-")));
|
||||
export const getAgentDir = () => agentDir;
|
||||
Reference in new issue
Block a user