opencode-ipynb 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -167,15 +167,19 @@ OpenCode may use a different Python interpreter than the one in your terminal. T
167
167
 
168
168
  ```json
169
169
  {
170
- "plugin": ["opencode-ipynb"],
171
- "ipynb": {
172
- "pythonPath": "C:/Users/Gabriel/miniconda3/envs/data/python.exe",
173
- "preferUv": true,
174
- "defaultTimeoutMs": 120000,
175
- "defaultMaxOutputChars": 6000,
176
- "warmKernel": false,
177
- "allowOutsideWorktree": false
178
- }
170
+ "plugin": [
171
+ [
172
+ "opencode-ipynb",
173
+ {
174
+ "pythonPath": "C:/Users/Gabriel/miniconda3/envs/data/python.exe",
175
+ "preferUv": true,
176
+ "defaultTimeoutMs": 120000,
177
+ "defaultMaxOutputChars": 6000,
178
+ "warmKernel": false,
179
+ "allowOutsideWorktree": false
180
+ }
181
+ ]
182
+ ]
179
183
  }
180
184
  ```
181
185
 
@@ -230,7 +234,7 @@ expected output.
230
234
 
231
235
  ## Release
232
236
 
233
- The published npm tarball contains only the runtime: `dist/`, `python/ipynb_runner.py`, `python/requirements.txt`, `README.md`, and `LICENSE`. Internal developer docs (`AGENTS.md`, `TODO.md`, the helper's dev scripts, the `.github/` workflows) are excluded from the npm package via `.npmignore`, and `AGENTS.md` / `TODO.md` are also gitignored so they are not versioned in this repository. Contributors track their work through GitHub Issues and Discussions.
237
+ The published npm tarball contains only the runtime: `dist/`, `python/ipynb_runner.py`, `python/requirements.txt`, `README.md`, and `LICENSE`. Internal developer docs, helper dev scripts, and `.github/` workflows are excluded from the npm package via `.npmignore` and are also gitignored so they are not versioned in this repository. Contributors track their work through GitHub Issues and Discussions.
234
238
 
235
239
  Cut a release by tagging the commit and pushing the tag, then publish it on GitHub — the workflow runs only on the `published` release event:
236
240
 
@@ -321,16 +325,6 @@ test/
321
325
  unit/ # bun:test suites
322
326
  ```
323
327
 
324
- ## Roadmap
325
-
326
- See `TODO.md` for the full plan and review-fix history (v0.1 → v1.5). Highlights:
327
-
328
- - v0.2: polished `ipynb_outputs` UI, full `ipynb_export` polish.
329
- - v0.3: real `nbclient`-based execution, save outputs, timeout, traceback capture.
330
- - v0.4: image attachments, reproducibility reports.
331
- - v1.0: kernel lifecycle management, cross-platform tests, npm publish.
332
- - v1.1–v1.5: security, Effect, path, packaging, rich-output, and cleanup review fixes.
333
-
334
328
  ## License
335
329
 
336
330
  MIT. See `LICENSE`.
package/dist/index.js CHANGED
@@ -27838,7 +27838,6 @@ import * as fs2 from "fs";
27838
27838
  import * as os from "os";
27839
27839
  import * as path4 from "path";
27840
27840
  import { randomBytes } from "crypto";
27841
- import { pathToFileURL } from "url";
27842
27841
  var EXTENSION_BY_MIME = {
27843
27842
  "image/png": "png",
27844
27843
  "image/jpeg": "jpg",
@@ -27861,12 +27860,16 @@ var saveBase64Image = async (mime, base643, prefix = "img") => {
27861
27860
  await fs2.promises.writeFile(filePath, buffer);
27862
27861
  return { path: filePath, mime, bytes: buffer.length, filename };
27863
27862
  };
27864
- var formatAttachment = (a) => ({
27865
- type: "file",
27866
- mime: a.mime,
27867
- url: pathToFileURL(a.path).toString(),
27868
- filename: a.filename
27869
- });
27863
+ var formatAttachment = async (a) => {
27864
+ const buffer = await fs2.promises.readFile(a.path);
27865
+ const data = buffer.toString("base64");
27866
+ return {
27867
+ type: "file",
27868
+ mime: a.mime,
27869
+ url: `data:${a.mime};base64,${data}`,
27870
+ filename: a.filename
27871
+ };
27872
+ };
27870
27873
 
27871
27874
  // src/domain/output.ts
27872
27875
  var StreamOutputSchema = exports_external.object({
@@ -27968,10 +27971,10 @@ var formatDisplayWithAttachments = async (data, opts, optsInput, collector) => {
27968
27971
  if (typeof value === "string") {
27969
27972
  if (shouldSaveImage(optsInput)) {
27970
27973
  const saved = await saveBase64Image(mime, value);
27971
- const att = formatAttachment(saved);
27974
+ const att = await formatAttachment(saved);
27972
27975
  collector.attachments.push(att);
27973
27976
  collector.saved.push(saved);
27974
- lines.push(`- ${mime}: (saved ${humanBytes(saved.bytes)} to ${att.url})`);
27977
+ lines.push(`- ${mime}: (saved ${humanBytes(saved.bytes)} as image attachment)`);
27975
27978
  } else {
27976
27979
  lines.push(`- ${imageNotice(mime, value)}`);
27977
27980
  }
@@ -7,5 +7,5 @@ export interface SavedAttachment {
7
7
  }
8
8
  export declare const pickExtensionForMime: (mime: string) => string | undefined;
9
9
  export declare const saveBase64Image: (mime: string, base64: string, prefix?: string) => Promise<SavedAttachment>;
10
- export declare const formatAttachment: (a: SavedAttachment) => ToolAttachment;
10
+ export declare const formatAttachment: (a: SavedAttachment) => Promise<ToolAttachment>;
11
11
  //# sourceMappingURL=attachments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/utils/attachments.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAYD,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SAE5D,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd,SAAQ,MAAc,KACrB,OAAO,CAAC,eAAe,CAazB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,GAAG,eAAe,KAAG,cAKpD,CAAA"}
1
+ {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/utils/attachments.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAYD,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SAE5D,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd,SAAQ,MAAc,KACrB,OAAO,CAAC,eAAe,CAazB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,GAAG,eAAe,KAAG,OAAO,CAAC,cAAc,CASjF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-ipynb",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OpenCode community plugin that adds robust .ipynb (Jupyter Notebook) support: inspect, read, edit, run, outputs, clean, export, reproducibility reports, and warm kernels.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.13",