Files
nanobot-ts/memory-bank/activeContext.md

33 lines
2.1 KiB
Markdown

# Active Context
## Current Focus
All source files written and verified — typecheck and lint are both clean.
## Session State (as of this writing)
- All source files complete and passing `tsc --noEmit` (0 errors) and `oxlint` (0 errors, 0 warnings)
- `package.json` scripts added: `start`, `dev`, `typecheck`
- Ready for runtime / integration testing
## Key Fixes Applied This Session
- **Zod v4 `.default()`**: nested object schemas need factory functions returning full output types (e.g. `.default(() => ({ field: value, ... }))`)
- **Zod v4 `z.record()`**: requires two args: `z.record(z.string(), z.unknown())`
- **AI SDK v6**: `LanguageModelV2``LanguageModel`; `maxTokens``maxOutputTokens`; `maxSteps``stopWhen: stepCountIs(1)`; usage fields: `inputTokens` / `outputTokens` (not `promptTokens` / `completionTokens`)
- **ollama-ai-provider v1.2.0**: returns `LanguageModelV1` — cast with `as unknown as LanguageModel`
- **`js-tiktoken`**: `get_encoding``getEncoding`
- **`web.ts`**: `Document` global not available in Bun/Node — return `Record<string, unknown>` from `makePseudoDocument`, cast at call site
- **`loop.ts`**: syntax error `ContextBuilder(workspace: ...)``new ContextBuilder(opts.workspace)`
- **lint**: all `${err}` in template literals → `${String(err)}`; `String(args['key'] ?? '')``strArg(args, 'key')` helper; unused `onProgress` param → `_onProgress`; WebSocket `onerror` `err` type is `Event` → use `err.type`
## Work Queue (next steps)
1. [ ] Runtime smoke test: `bun run start --help`
2. [ ] Test with a real Mattermost config (optional — user can do this)
3. [ ] Write sample `~/.nanobot/config.json` in README or docs
## Key Decisions Made
- Mattermost channel uses raw WebSocket + fetch (no mattermostdriver, no SSL hack)
- No MCP support (use shell tools / CLI instead)
- No reasoning/thinking token handling (can add later)
- Config is fresh Zod schema (no migration from Python config needed)
- `ollama-ai-provider` package (not `@ai-sdk/ollama` which 404s on npm)
- `strArg(args, key, fallback?)` helper exported from `agent/tools/base.ts` for safe unknown→string extraction