37 lines
2.5 KiB
Markdown
37 lines
2.5 KiB
Markdown
# Active Context
|
|
|
|
## Current Focus
|
|
Docs directory created with 4 files (PRD.md, Architecture.md, API.md, Discoveries.md). All source files previously 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. [x] Create workspace helper module (src/workspace.ts) with ensureWorkspace() and syncTemplates()
|
|
2. [x] Create onboard command (src/cli/onboard.ts) with path argument and directory-not-empty guard
|
|
3. [x] Update src/cli/commands.ts to use ensureWorkspace() instead of inline mkdirSync
|
|
4. [x] Typecheck and lint pass (0 errors)
|
|
5. [x] Runtime smoke test: `bun run nanobot --help`
|
|
6. [x] Test onboard command: `bun run nanobot onboard [path]`
|
|
7. [ ] Test with a real Mattermost config (optional — user can do this)
|
|
|
|
## 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
|