-
Notifications
You must be signed in to change notification settings - Fork 65
fix(pi-plugin): retrospective provider SessionManager API mismatch #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,71 @@ | ||
| { | ||
| "name": "@cortexkit/pi-magic-context", | ||
| "version": "0.30.1", | ||
| "type": "module", | ||
| "description": "Pi coding agent extension for Magic Context — cross-session memory and context management", | ||
| "main": "dist/index.js", | ||
| "license": "MIT", | ||
| "author": "ualtinok", | ||
| "keywords": [ | ||
| "pi", | ||
| "pi-coding-agent", | ||
| "extension", | ||
| "context", | ||
| "memory", | ||
| "magic-context", | ||
| "ai", | ||
| "llm" | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/cortexkit/magic-context", | ||
| "directory": "packages/pi-plugin" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "README.md" | ||
| ], | ||
| "scripts": { | ||
| "build": "bun build src/index.ts src/subagent-entry.ts --outdir dist --target node --format esm --external @earendil-works/pi-coding-agent --external @earendil-works/pi-tui --external @huggingface/transformers --external node:sqlite", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "bun test", | ||
| "lint": "biome check src", | ||
| "lint:fix": "biome check --write src", | ||
| "format": "biome format --write src", | ||
| "format:check": "biome format src", | ||
| "clean": "rm -rf dist", | ||
| "prepublishOnly": "bun run build" | ||
| }, | ||
| "dependencies": { | ||
| "@huggingface/transformers": "^4.1.0", | ||
| "@jitl/quickjs-singlefile-cjs-release-asyncify": "0.32.0", | ||
| "ai-tokenizer": "^1.0.6", | ||
| "comment-json": "^5.0.0", | ||
| "quickjs-emscripten": "^0.32.0", | ||
| "typebox": "^1.3.1", | ||
| "zod": "^4.1.8" | ||
| }, | ||
| "devDependencies": { | ||
| "@biomejs/biome": "^2.5.1", | ||
| "@earendil-works/pi-coding-agent": "^0.80.2", | ||
| "@earendil-works/pi-tui": "^0.80.2", | ||
| "@types/better-sqlite3": "^7.6.13", | ||
| "@types/bun": "^1.3.10", | ||
| "@types/node": "^22.20.0", | ||
| "typescript": "^5.8.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@earendil-works/pi-coding-agent": "^0.80.2", | ||
| "@earendil-works/pi-tui": "^0.80.2" | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.js" | ||
| } | ||
| }, | ||
| "pi": { | ||
| "extensions": [ | ||
| "./dist/index.js" | ||
| ] | ||
| } | ||
| } | ||
| "name": "@cortexkit/pi-magic-context", | ||
| "version": "0.30.2", | ||
| "type": "module", | ||
| "description": "Pi coding agent extension for Magic Context \u2014 cross-session memory and context management", | ||
| "main": "dist/index.js", | ||
| "license": "MIT", | ||
| "author": "ualtinok", | ||
| "keywords": [ | ||
| "pi", | ||
| "pi-coding-agent", | ||
| "extension", | ||
| "context", | ||
| "memory", | ||
| "magic-context", | ||
| "ai", | ||
| "llm" | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/cortexkit/magic-context", | ||
| "directory": "packages/pi-plugin" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "README.md" | ||
| ], | ||
| "scripts": { | ||
| "build": "bun build src/index.ts src/subagent-entry.ts --outdir dist --target node --format esm --external @earendil-works/pi-coding-agent --external @earendil-works/pi-tui --external @huggingface/transformers --external node:sqlite", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "bun test", | ||
| "lint": "biome check src", | ||
| "lint:fix": "biome check --write src", | ||
| "format": "biome format --write src", | ||
| "format:check": "biome format src", | ||
| "clean": "rm -rf dist", | ||
| "prepublishOnly": "bun run build" | ||
| }, | ||
| "dependencies": { | ||
| "@huggingface/transformers": "^4.1.0", | ||
| "@jitl/quickjs-singlefile-cjs-release-asyncify": "0.32.0", | ||
| "ai-tokenizer": "^1.0.6", | ||
| "comment-json": "^5.0.0", | ||
| "quickjs-emscripten": "^0.32.0", | ||
| "typebox": "^1.3.1", | ||
| "zod": "^4.1.8" | ||
| }, | ||
| "devDependencies": { | ||
| "@biomejs/biome": "^2.5.1", | ||
| "@earendil-works/pi-coding-agent": "^0.80.2", | ||
| "@earendil-works/pi-tui": "^0.80.2", | ||
| "@types/better-sqlite3": "^7.6.13", | ||
| "@types/bun": "^1.3.10", | ||
| "@types/node": "^22.20.0", | ||
| "typescript": "^5.8.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@earendil-works/pi-coding-agent": "^0.80.2", | ||
| "@earendil-works/pi-tui": "^0.80.2" | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.js" | ||
| } | ||
| }, | ||
| "pi": { | ||
| "extensions": [ | ||
| "./dist/index.js" | ||
| ] | ||
| } | ||
| } | ||
|
Comment on lines
+70
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||||||||||
| import { readFileSync } from "node:fs"; | ||||||||||||||||||
| import { resolve } from "node:path"; | ||||||||||||||||||
|
|
||||||||||||||||||
| import type { | ||||||||||||||||||
|
|
@@ -191,20 +192,27 @@ async function loadDefaultPiSessionDeps(): Promise< | |||||||||||||||||
| > { | ||||||||||||||||||
| const mod = (await import(/* @vite-ignore */ PI_CODING_AGENT_MODULE)) as { | ||||||||||||||||||
| SessionManager?: { | ||||||||||||||||||
| listSessions?: (sessionDir?: string) => unknown[] | Promise<unknown[]>; | ||||||||||||||||||
| listAll?: (sessionDir?: string) => unknown[] | Promise<unknown[]>; | ||||||||||||||||||
| }; | ||||||||||||||||||
| loadEntriesFromFile?: (filePath: string) => unknown[] | Promise<unknown[]>; | ||||||||||||||||||
| parseSessionEntries?: (content: string) => unknown[]; | ||||||||||||||||||
| }; | ||||||||||||||||||
| const listSessions = mod.SessionManager?.listSessions; | ||||||||||||||||||
| const loadEntriesFromFile = mod.loadEntriesFromFile; | ||||||||||||||||||
| if ( | ||||||||||||||||||
| typeof listSessions !== "function" || | ||||||||||||||||||
| typeof loadEntriesFromFile !== "function" | ||||||||||||||||||
| ) { | ||||||||||||||||||
| const listSessions = mod.SessionManager?.listAll; | ||||||||||||||||||
| if (typeof listSessions !== "function") { | ||||||||||||||||||
| throw new Error( | ||||||||||||||||||
| "Pi session APIs unavailable: expected SessionManager.listSessions and loadEntriesFromFile", | ||||||||||||||||||
| "Pi session APIs unavailable: expected SessionManager.listAll on pi-coding-agent", | ||||||||||||||||||
| ); | ||||||||||||||||||
| } | ||||||||||||||||||
| // loadEntriesFromFile is NOT part of pi-coding-agent's public API — | ||||||||||||||||||
| // fall back to readFileSync + parseSessionEntries (both exported). | ||||||||||||||||||
| const loadEntriesFromFile: ( | ||||||||||||||||||
| filePath: string, | ||||||||||||||||||
| ) => unknown[] | Promise<unknown[]> = | ||||||||||||||||||
| mod.loadEntriesFromFile ?? | ||||||||||||||||||
| ((filePath: string) => { | ||||||||||||||||||
| const content = readFileSync(filePath, "utf8"); | ||||||||||||||||||
| return mod.parseSessionEntries?.(content) ?? []; | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Silent failure when Prompt for AI agents
Suggested change
|
||||||||||||||||||
| }); | ||||||||||||||||||
|
Comment on lines
+208
to
+215
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The guard now only checks that |
||||||||||||||||||
| return { | ||||||||||||||||||
| listSessions: listSessions.bind(mod.SessionManager), | ||||||||||||||||||
| loadEntriesFromFile, | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: Missing trailing newline at end of file. This will produce a noisy diff when the next change adds one, and most linters (including Biome, which this repo uses) flag it.
Prompt for AI agents