{"_id":"@99percentpeople/pi-workspace-files","_rev":"2-59b8b00c6f6cda1671153a27aad45a55","name":"@99percentpeople/pi-workspace-files","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@99percentpeople/pi-workspace-files","version":"0.1.0","keywords":["pi","coding-agent","workspace","filesystem","extensions"],"author":{"name":"99percentpeople"},"license":"MIT","_id":"@99percentpeople/pi-workspace-files@0.1.0","maintainers":[{"name":"99percentpeople","email":"myzzzyearz@outlook.com"}],"homepage":"https://github.com/99percentpeople/pi-extensions#readme","bugs":{"url":"https://github.com/99percentpeople/pi-extensions/issues"},"dist":{"shasum":"b4e92a371e620265c94b90a141e0e1f3f9588450","tarball":"https://registry.npmjs.org/@99percentpeople/pi-workspace-files/-/pi-workspace-files-0.1.0.tgz","fileCount":7,"integrity":"sha512-dVHp2gx52im4Z+IHEgE80N/0uqnRZO/0nkJKndcTw2ZzVHuWy6Yk5gBWqNx05QWJ+4fx9S7S7hsLaT4hAdDRUg==","signatures":[{"sig":"MEUCIQCt8CJxHi4PE4/KFGAqmQpYiNH2o5rw0jyXBmpgg94bVwIgRLAgUc0Cc5AbPfpgRapAqT5Nezi6s83SyJDUXjG+5B0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22263},"main":"./dist/index.ts","type":"module","types":"./dist/index.d.ts","gitHead":"8e807d48d1d05b29c0517900c8d0a3962693f808","scripts":{"build":"bun run ../../scripts/build-package.ts && tsc -p tsconfig.build.json","prepack":"bun run build","prepublishOnly":"bun run --cwd ../.. check"},"_npmUser":{"name":"99percentpeople","email":"myzzzyearz@outlook.com"},"repository":{"url":"git+https://github.com/99percentpeople/pi-extensions.git","type":"git","directory":"packages/workspace-files"},"_npmVersion":"11.11.0","description":"Composable binary workspace file-system protocol for Pi extensions","directories":{},"_nodeVersion":"24.18.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-workspace-files_0.1.0_1785590416011_0.11964847002512746","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@99percentpeople/pi-workspace-files","version":"0.1.1","description":"Composable binary workspace file-system protocol for Pi extensions","type":"module","main":"./index.min.js","types":"./index.d.ts","keywords":["pi","coding-agent","workspace","filesystem","extensions"],"author":{"name":"99percentpeople"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/99percentpeople/pi-extensions.git","directory":"packages/workspace-files"},"bugs":{"url":"https://github.com/99percentpeople/pi-extensions/issues"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"gitHead":"e9fb82fa5b14fd22f55feb487bbb814e1ab45206","_id":"@99percentpeople/pi-workspace-files@0.1.1","homepage":"https://github.com/99percentpeople/pi-extensions#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-Ku1fowoPnreGp3MacDcXqsDZFvX1pCFsc2Ao3/nD/sMSXw4S6sxsw06wQzd77ClRn14VbjFL12rWT2tzYtv1YQ==","shasum":"83939f80d301c7006a05233af0134d169aea019a","tarball":"https://registry.npmjs.org/@99percentpeople/pi-workspace-files/-/pi-workspace-files-0.1.1.tgz","fileCount":6,"unpackedSize":17991,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@99percentpeople%2fpi-workspace-files@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIH665LbtjzM5rD68SsvVS+B3/H5czHvi/3ONsbw6Dbd/AiBNAyUewUc+3oJKbZ4uqLWQ8XwADY6YBcpvl2FXoHOyQw=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:17aa202d-3abf-4dd9-9a6b-9e3e690908c6"}},"directories":{},"maintainers":[{"name":"99percentpeople","email":"myzzzyearz@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-workspace-files_0.1.1_1786198969001_0.617997193867404"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-01T13:20:15.837Z","modified":"2026-08-08T14:22:49.476Z","0.1.0":"2026-08-01T13:20:16.161Z","0.1.1":"2026-08-08T14:22:49.162Z"},"bugs":{"url":"https://github.com/99percentpeople/pi-extensions/issues"},"author":{"name":"99percentpeople"},"license":"MIT","homepage":"https://github.com/99percentpeople/pi-extensions#readme","keywords":["pi","coding-agent","workspace","filesystem","extensions"],"repository":{"type":"git","url":"git+https://github.com/99percentpeople/pi-extensions.git","directory":"packages/workspace-files"},"description":"Composable binary workspace file-system protocol for Pi extensions","maintainers":[{"name":"99percentpeople","email":"myzzzyearz@outlook.com"}],"readme":"# @99percentpeople/pi-workspace-files\n\nComposable binary workspace file-system protocol for Pi extensions.\n\nA consumer requests the active workspace backend. If no extension claims the\nrequest, the package returns a local Node.js file system constrained to Pi's\ncurrent workspace. Providers such as `@99percentpeople/pi-ssh-remote` can claim\nthe request and route the same operations to Unix or Windows workspaces.\n\nThe interface supports:\n\n- platform-aware path resolution, extension lookup, and parent directories;\n- buffered or streaming binary reads and writes through the same methods;\n- recursive directory creation;\n- existence checks for overwrite protection;\n- `AbortSignal` propagation;\n- rejection when multiple providers claim one workspace.\n\n## Consumer\n\n```ts\nimport {\n  collectWorkspaceFile,\n  resolveWorkspaceFiles,\n} from \"@99percentpeople/pi-workspace-files\";\n\nconst files = resolveWorkspaceFiles(pi, ctx.cwd);\nconst output = files.resolvePath(\"output/image.png\");\nconst options = { signal };\nif (await files.exists(output, options)) throw new Error(\"Already exists\");\nawait files.mkdir(files.dirname(output), options);\n\n// Buffer/Uint8Array and AsyncIterable<Uint8Array> use the same method.\nawait files.writeFile(output, pngBytesOrChunks, options);\n\n// Consumers that need a Buffer can collect either provider representation.\nconst bytes = await collectWorkspaceFile(\n  await files.readFile(output, options),\n  options,\n);\n```\n\n## Provider\n\n```ts\nimport {\n  registerWorkspaceFileProvider,\n  type WorkspaceFileSystem,\n} from \"@99percentpeople/pi-workspace-files\";\n\nregisterWorkspaceFileProvider(pi, \"my-remote-extension\", ({ cwd }) => {\n  if (!remoteIsActive()) return undefined;\n  return createRemoteFiles(cwd) satisfies WorkspaceFileSystem;\n});\n```\n\n`readFile` and `writeFile` deliberately cover both buffered and streaming data;\nproviders do not need separate stream-specific methods. Existing providers may\nreturn `Uint8Array`, while large-file providers can return an\n`AsyncIterable<Uint8Array>`. Cancellation and future transfer controls live in\none optional `WorkspaceFileOptions` object instead of positional parameters.\n\nThis package is installed automatically as a dependency. It is not a Pi\nextension and does not declare a `pi.extensions` entry.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}