@astralyn/pi 0.85.2 → 0.85.3

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/bundle/chunks/anthropic-messages-IHRRITCV.js +6 -0
  3. package/dist/bundle/chunks/anthropic.js +75 -0
  4. package/dist/bundle/chunks/azure-openai-responses-QXBIDYXO.js +2 -0
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +78 -0
  6. package/dist/bundle/chunks/chunk-37ATLPRE.js +2 -0
  7. package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
  8. package/dist/bundle/chunks/chunk-5B3S5DVL.js +4 -0
  9. package/dist/bundle/chunks/chunk-5FDOJRDS.js +2 -0
  10. package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
  11. package/dist/bundle/chunks/chunk-7LO5Z4WE.js +2 -0
  12. package/dist/bundle/chunks/chunk-APKJ4JGA.js +2 -0
  13. package/dist/bundle/chunks/chunk-EDBLK2JQ.js +2 -0
  14. package/dist/bundle/chunks/chunk-FEZ5RM2B.js +2 -0
  15. package/dist/bundle/chunks/chunk-JEIV47WR.js +2 -0
  16. package/dist/bundle/chunks/chunk-JSJPY26N.js +2 -0
  17. package/dist/bundle/chunks/chunk-KI6LC764.js +42 -0
  18. package/dist/bundle/chunks/chunk-LB4P77SH.js +1688 -0
  19. package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
  20. package/dist/bundle/chunks/chunk-O36ZMA3U.js +2 -0
  21. package/dist/bundle/chunks/chunk-OWESLY5T.js +11 -0
  22. package/dist/bundle/chunks/chunk-RRBI7OUG.js +50 -0
  23. package/dist/bundle/chunks/chunk-S2DJQQI2.js +2 -0
  24. package/dist/bundle/chunks/chunk-UP6RLTHQ.js +2 -0
  25. package/dist/bundle/chunks/chunk-UUSTLCVC.js +2 -0
  26. package/dist/bundle/chunks/chunk-WWBSZG5V.js +2 -0
  27. package/dist/bundle/chunks/chunk-YZJWMPUI.js +2 -0
  28. package/dist/bundle/chunks/github-copilot.js +2 -0
  29. package/dist/bundle/chunks/google-generative-ai-NBOR3IQR.js +2 -0
  30. package/dist/bundle/chunks/google-vertex-VTHX3SUB.js +2 -0
  31. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
  32. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  33. package/dist/bundle/chunks/kimi-coding.js +2 -0
  34. package/dist/bundle/chunks/mistral-conversations-NO4ANAA5.js +5 -0
  35. package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
  36. package/dist/bundle/chunks/node-7L5OTM6S.js +2 -0
  37. package/dist/bundle/chunks/node-G4XOIDPH.js +16 -0
  38. package/dist/bundle/chunks/openai-codex-responses-5S3T3HMA.js +10 -0
  39. package/dist/bundle/chunks/openai-codex.js +75 -0
  40. package/dist/bundle/chunks/openai-completions-CXRRTRWE.js +7 -0
  41. package/dist/bundle/chunks/openai-responses-CV3MH6VP.js +2 -0
  42. package/dist/bundle/chunks/openrouter-images-6XDE2CEW.js +2 -0
  43. package/dist/bundle/chunks/openrouter.js +75 -0
  44. package/dist/bundle/chunks/pi-messages-PE6B42TG.js +8 -0
  45. package/dist/bundle/chunks/radius.js +75 -0
  46. package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
  47. package/dist/bundle/chunks/xai.js +2 -0
  48. package/dist/bundle/cli.js +3 -0
  49. package/dist/bundle/index.js +2 -0
  50. package/dist/bundle/rpc-entry.js +3 -0
  51. package/dist/cli.js +5 -2472
  52. package/dist/core/agent-session.d.ts.map +1 -1
  53. package/dist/core/agent-session.js +0 -4
  54. package/dist/core/agent-session.js.map +1 -1
  55. package/dist/core/extensions/index.d.ts +1 -1
  56. package/dist/core/extensions/index.d.ts.map +1 -1
  57. package/dist/core/extensions/index.js.map +1 -1
  58. package/dist/core/extensions/runner.d.ts +0 -1
  59. package/dist/core/extensions/runner.d.ts.map +1 -1
  60. package/dist/core/extensions/runner.js +0 -6
  61. package/dist/core/extensions/runner.js.map +1 -1
  62. package/dist/core/extensions/types.d.ts +0 -11
  63. package/dist/core/extensions/types.d.ts.map +1 -1
  64. package/dist/core/extensions/types.js.map +1 -1
  65. package/dist/core/tools/bash.d.ts +3 -9
  66. package/dist/core/tools/bash.d.ts.map +1 -1
  67. package/dist/core/tools/bash.js +2 -7
  68. package/dist/core/tools/bash.js.map +1 -1
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/rpc-entry.js +10 -2472
  73. package/docs/development.md +1 -1
  74. package/docs/extensions.md +0 -13
  75. package/npm-shrinkwrap.json +4 -4
  76. package/package.json +6 -5
  77. package/dist/image-resize-worker.js +0 -2
@@ -29,7 +29,7 @@ npm run test:isolated -- test/model-selector.test.ts
29
29
  npm run test:isolated -- test/model-selector.test.ts -t "configured save binding"
30
30
  ```
31
31
 
32
- The build emits the stable SDK and type declarations, then bundles the CLI, RPC entrypoint, and image-resize worker. Run the resulting CLI with `node dist/cli.js`. After deleting sources or changing build exclusions, run `npm run clean` before building.
32
+ The build emits the stable SDK and type declarations, then bundles the Node entrypoints with shared chunks and separately loaded OAuth, Bedrock, and image-worker modules under `dist/bundle/`. Run the resulting CLI with `node dist/bundle/cli.js`. After deleting sources or changing build exclusions, run `npm run clean` before building.
33
33
 
34
34
  Installed dependency versions are checked before npm builds/tests and repository checks. For a complete suite, omit the isolated runner's arguments:
35
35
 
@@ -1223,19 +1223,6 @@ ctx.compact({
1223
1223
  });
1224
1224
  ```
1225
1225
 
1226
- ### ctx.getShellSettings()
1227
-
1228
- Returns the session's shell settings (`shellPath`, `commandPrefix`) exactly as the built-in bash tool uses them. Returns `undefined` on hosts that do not provide shell settings; fall back to reading settings from disk if your extension must. Optional on `ExtensionContext` for the same reason.
1229
-
1230
- ```typescript
1231
- pi.on("session_start", (_event, ctx) => {
1232
- const shell = ctx.getShellSettings?.();
1233
- if (shell?.commandPrefix) {
1234
- // Commands spawned by this extension should honor the same prefix as bash.
1235
- }
1236
- });
1237
- ```
1238
-
1239
1226
  ### ctx.getSystemPrompt()
1240
1227
 
1241
1228
  Returns Pi's current system prompt string.
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@astralyn/pi",
3
- "version": "0.85.2",
3
+ "version": "0.85.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@astralyn/pi",
9
- "version": "0.85.2",
9
+ "version": "0.85.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
+ "@earendil-works/chord": "0.85.1",
12
13
  "@earendil-works/pi-agent-core": "0.85.1",
13
14
  "@earendil-works/pi-ai": "0.85.1",
14
15
  "@earendil-works/pi-tui": "0.85.1",
@@ -29,13 +30,12 @@
29
30
  "yaml": "2.9.0"
30
31
  },
31
32
  "bin": {
32
- "pi": "dist/cli.js"
33
+ "pi": "dist/bundle/cli.js"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@anthropic-ai/sandbox-runtime": "0.0.26",
36
37
  "@anthropic-ai/sdk": "0.52.0",
37
38
  "@biomejs/biome": "2.3.5",
38
- "@earendil-works/chord": "0.85.1",
39
39
  "@earendil-works/pi-client": "0.85.1",
40
40
  "@earendil-works/pi-protocol": "0.85.1",
41
41
  "@earendil-works/pi-server": "0.85.1",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@astralyn/pi",
3
- "version": "0.85.2",
3
+ "version": "0.85.3",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
7
7
  "configDir": ".pi"
8
8
  },
9
9
  "bin": {
10
- "pi": "dist/cli.js"
10
+ "pi": "dist/bundle/cli.js"
11
11
  },
12
12
  "main": "./dist/index.js",
13
13
  "types": "./dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "import": "./dist/index.js"
18
18
  },
19
19
  "./rpc-entry": {
20
- "import": "./dist/rpc-entry.js"
20
+ "import": "./dist/bundle/rpc-entry.js"
21
21
  },
22
22
  "./client": {
23
23
  "source": "./src/client/index.ts"
@@ -39,7 +39,8 @@
39
39
  "scripts": {
40
40
  "clean": "shx rm -rf dist",
41
41
  "prebuild": "npm run check:installed-deps",
42
- "build": "tsc -p tsconfig.build.json && npm run copy-assets && npm run build:bundle && shx chmod +x dist/cli.js dist/rpc-entry.js",
42
+ "build": "npm run build:unbundled && npm run build:bundle",
43
+ "build:unbundled": "tsc -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js && npm run copy-assets",
43
44
  "build:bundle": "node scripts/build-bundle.mjs",
44
45
  "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
45
46
  "dev": "node scripts/run-source.mjs",
@@ -61,6 +62,7 @@
61
62
  "prepublishOnly": "npm run clean && npm run build"
62
63
  },
63
64
  "dependencies": {
65
+ "@earendil-works/chord": "0.85.1",
64
66
  "@earendil-works/pi-agent-core": "0.85.1",
65
67
  "@earendil-works/pi-ai": "0.85.1",
66
68
  "@earendil-works/pi-tui": "0.85.1",
@@ -87,7 +89,6 @@
87
89
  "@anthropic-ai/sandbox-runtime": "0.0.26",
88
90
  "@anthropic-ai/sdk": "0.52.0",
89
91
  "@biomejs/biome": "2.3.5",
90
- "@earendil-works/chord": "0.85.1",
91
92
  "@earendil-works/pi-client": "0.85.1",
92
93
  "@earendil-works/pi-protocol": "0.85.1",
93
94
  "@earendil-works/pi-server": "0.85.1",
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{parentPort}from"node:worker_threads";function readOrientationFromTiff(bytes,tiffStart){if(tiffStart+8>bytes.length)return 1;let le=(bytes[tiffStart]<<8|bytes[tiffStart+1])===18761,read16=__name(pos=>le?bytes[pos]|bytes[pos+1]<<8:bytes[pos]<<8|bytes[pos+1],"read16"),ifdOffset=__name(pos=>le?bytes[pos]|bytes[pos+1]<<8|bytes[pos+2]<<16|bytes[pos+3]<<24:(bytes[pos]<<24|bytes[pos+1]<<16|bytes[pos+2]<<8|bytes[pos+3])>>>0,"read32")(tiffStart+4),ifdStart=tiffStart+ifdOffset;if(ifdStart+2>bytes.length)return 1;let entryCount=read16(ifdStart);for(let i=0;i<entryCount;i++){let entryPos=ifdStart+2+i*12;if(entryPos+12>bytes.length)return 1;if(read16(entryPos)===274){let value=read16(entryPos+8);return value>=1&&value<=8?value:1}}return 1}__name(readOrientationFromTiff,"readOrientationFromTiff");function findJpegTiffOffset(bytes){let offset=2;for(;offset<bytes.length-1;){if(bytes[offset]!==255)return-1;let marker=bytes[offset+1];if(marker===255){offset++;continue}if(marker===225){if(offset+4>=bytes.length)return-1;let segmentStart=offset+4;if(segmentStart+6>bytes.length)return-1;if(hasExifHeader(bytes,segmentStart))return segmentStart+6}if(offset+4>bytes.length)return-1;let length=bytes[offset+2]<<8|bytes[offset+3];offset+=2+length}return-1}__name(findJpegTiffOffset,"findJpegTiffOffset");function findWebpTiffOffset(bytes){let offset=12;for(;offset+8<=bytes.length;){let chunkId=String.fromCharCode(bytes[offset],bytes[offset+1],bytes[offset+2],bytes[offset+3]),chunkSize=bytes[offset+4]|bytes[offset+5]<<8|bytes[offset+6]<<16|bytes[offset+7]<<24,dataStart=offset+8;if(chunkId==="EXIF")return dataStart+chunkSize>bytes.length?-1:chunkSize>=6&&hasExifHeader(bytes,dataStart)?dataStart+6:dataStart;offset=dataStart+chunkSize+chunkSize%2}return-1}__name(findWebpTiffOffset,"findWebpTiffOffset");function hasExifHeader(bytes,offset){return bytes[offset]===69&&bytes[offset+1]===120&&bytes[offset+2]===105&&bytes[offset+3]===102&&bytes[offset+4]===0&&bytes[offset+5]===0}__name(hasExifHeader,"hasExifHeader");function getExifOrientation(bytes){let tiffOffset=-1;return bytes.length>=2&&bytes[0]===255&&bytes[1]===216?tiffOffset=findJpegTiffOffset(bytes):bytes.length>=12&&bytes[0]===82&&bytes[1]===73&&bytes[2]===70&&bytes[3]===70&&bytes[8]===87&&bytes[9]===69&&bytes[10]===66&&bytes[11]===80&&(tiffOffset=findWebpTiffOffset(bytes)),tiffOffset===-1?1:readOrientationFromTiff(bytes,tiffOffset)}__name(getExifOrientation,"getExifOrientation");function rotate90(photon,image,dstIndex){let w=image.get_width(),h=image.get_height(),src=image.get_raw_pixels(),dst=new Uint8Array(src.length);for(let y=0;y<h;y++)for(let x=0;x<w;x++){let srcIdx=(y*w+x)*4,dstIdx=dstIndex(x,y,w,h)*4;dst[dstIdx]=src[srcIdx],dst[dstIdx+1]=src[srcIdx+1],dst[dstIdx+2]=src[srcIdx+2],dst[dstIdx+3]=src[srcIdx+3]}return new photon.PhotonImage(dst,h,w)}__name(rotate90,"rotate90");function applyExifOrientation(photon,image,originalBytes){let orientation=getExifOrientation(originalBytes);if(orientation===1)return image;switch(orientation){case 2:return photon.fliph(image),image;case 3:return photon.fliph(image),photon.flipv(image),image;case 4:return photon.flipv(image),image;case 5:{let rotated=rotate90(photon,image,(x,y,_w,h)=>x*h+(h-1-y));return photon.fliph(rotated),rotated}case 6:return rotate90(photon,image,(x,y,_w,h)=>x*h+(h-1-y));case 7:{let rotated=rotate90(photon,image,(x,y,w,h)=>(w-1-x)*h+y);return photon.fliph(rotated),rotated}case 8:return rotate90(photon,image,(x,y,w,h)=>(w-1-x)*h+y);default:return image}}__name(applyExifOrientation,"applyExifOrientation");import{createRequire}from"module";import*as path from"path";import{fileURLToPath}from"url";var require2=createRequire(import.meta.url),fs=require2("fs"),WASM_FILENAME="photon_rs_bg.wasm",photonModule=null,loadPromise=null;function pathOrNull(file){return typeof file=="string"?file:file instanceof URL?fileURLToPath(file):null}__name(pathOrNull,"pathOrNull");function getFallbackWasmPaths(){let execDir=path.dirname(process.execPath);return[path.join(execDir,WASM_FILENAME),path.join(execDir,"photon",WASM_FILENAME),path.join(process.cwd(),WASM_FILENAME)]}__name(getFallbackWasmPaths,"getFallbackWasmPaths");function patchPhotonWasmRead(){let originalReadFileSync=fs.readFileSync.bind(fs),fallbackPaths=getFallbackWasmPaths(),mutableFs=fs,patchedReadFileSync=__name(((...args)=>{let[file,options]=args;if(pathOrNull(file)?.endsWith(WASM_FILENAME))try{return originalReadFileSync(...args)}catch(error){let err=error;if(err?.code&&err.code!=="ENOENT")throw error;for(let fallbackPath of fallbackPaths)if(fs.existsSync(fallbackPath))return options===void 0?originalReadFileSync(fallbackPath):originalReadFileSync(fallbackPath,options);throw error}return originalReadFileSync(...args)}),"patchedReadFileSync");try{mutableFs.readFileSync=patchedReadFileSync}catch{Object.defineProperty(fs,"readFileSync",{value:patchedReadFileSync,writable:!0,configurable:!0})}return()=>{try{mutableFs.readFileSync=originalReadFileSync}catch{Object.defineProperty(fs,"readFileSync",{value:originalReadFileSync,writable:!0,configurable:!0})}}}__name(patchPhotonWasmRead,"patchPhotonWasmRead");async function loadPhoton(){return photonModule||loadPromise||(loadPromise=(async()=>{let restoreReadFileSync=patchPhotonWasmRead();try{return photonModule=await import("@silvia-odwyer/photon-node"),photonModule}catch{return photonModule=null,photonModule}finally{restoreReadFileSync()}})(),loadPromise)}__name(loadPhoton,"loadPhoton");var DEFAULT_MAX_BYTES=4.5*1024*1024,DEFAULT_OPTIONS={maxWidth:2e3,maxHeight:2e3,maxBytes:DEFAULT_MAX_BYTES,jpegQuality:80};function encodeCandidate(buffer,mimeType){let data=Buffer.from(buffer).toString("base64");return{data,encodedSize:Buffer.byteLength(data,"utf-8"),mimeType}}__name(encodeCandidate,"encodeCandidate");async function resizeImageInProcess(inputBytes,mimeType,options){let opts={...DEFAULT_OPTIONS,...options},inputBase64Size=Math.ceil(inputBytes.byteLength/3)*4,photon=await loadPhoton();if(!photon)return null;let image;try{let tryEncodings2=function(width,height,jpegQualities){let resized=photon.resize(image,width,height,photon.SamplingFilter.Lanczos3);try{let candidates=[encodeCandidate(resized.get_bytes(),"image/png")];for(let quality of jpegQualities)candidates.push(encodeCandidate(resized.get_bytes_jpeg(quality),"image/jpeg"));return candidates}finally{resized.free()}};var tryEncodings=tryEncodings2;__name(tryEncodings2,"tryEncodings");let rawImage=photon.PhotonImage.new_from_byteslice(inputBytes);image=applyExifOrientation(photon,rawImage,inputBytes),image!==rawImage&&rawImage.free();let originalWidth=image.get_width(),originalHeight=image.get_height(),format=mimeType.split("/")[1]??"png";if(originalWidth<=opts.maxWidth&&originalHeight<=opts.maxHeight&&inputBase64Size<opts.maxBytes)return{data:Buffer.from(inputBytes).toString("base64"),mimeType:mimeType||`image/${format}`,originalWidth,originalHeight,width:originalWidth,height:originalHeight,wasResized:!1};let targetWidth=originalWidth,targetHeight=originalHeight;targetWidth>opts.maxWidth&&(targetHeight=Math.round(targetHeight*opts.maxWidth/targetWidth),targetWidth=opts.maxWidth),targetHeight>opts.maxHeight&&(targetWidth=Math.round(targetWidth*opts.maxHeight/targetHeight),targetHeight=opts.maxHeight);let qualitySteps=Array.from(new Set([opts.jpegQuality,85,70,55,40])),currentWidth=targetWidth,currentHeight=targetHeight;for(;;){let candidates=tryEncodings2(currentWidth,currentHeight,qualitySteps);for(let candidate of candidates)if(candidate.encodedSize<opts.maxBytes)return{data:candidate.data,mimeType:candidate.mimeType,originalWidth,originalHeight,width:currentWidth,height:currentHeight,wasResized:!0};if(currentWidth===1&&currentHeight===1)break;let nextWidth=currentWidth===1?1:Math.max(1,Math.floor(currentWidth*.75)),nextHeight=currentHeight===1?1:Math.max(1,Math.floor(currentHeight*.75));if(nextWidth===currentWidth&&nextHeight===currentHeight)break;currentWidth=nextWidth,currentHeight=nextHeight}return null}catch{return null}finally{image&&image.free()}}__name(resizeImageInProcess,"resizeImageInProcess");function isResizeImageWorkerRequest(value){if(!value||typeof value!="object")return!1;let record=value;return record.inputBytes instanceof Uint8Array&&typeof record.mimeType=="string"}__name(isResizeImageWorkerRequest,"isResizeImageWorkerRequest");var port=parentPort;if(!port)throw new Error("image resize worker requires parentPort");port.once("message",message=>{(async()=>{try{if(!isResizeImageWorkerRequest(message))throw new Error("Invalid image resize worker request");let response={result:await resizeImageInProcess(message.inputBytes,message.mimeType,message.options)};port.postMessage(response)}catch(error){let response={error:error instanceof Error?error.message:String(error)};port.postMessage(response)}})()});