@herbertgao/pi-extensions 2026.8.9 → 2026.8.11

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 (194) hide show
  1. package/README.md +4 -2
  2. package/node_modules/@herbertgao/resume-from/LICENSE +21 -0
  3. package/node_modules/@herbertgao/resume-from/README.md +163 -0
  4. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/adapter.d.ts +25 -0
  5. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/adapter.js +60 -0
  6. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/contract.d.ts +8 -0
  7. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/contract.js +4 -0
  8. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/entries.d.ts +30 -0
  9. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/entries.js +107 -0
  10. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/index.d.ts +3 -0
  11. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/index.js +2 -0
  12. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/layout.d.ts +29 -0
  13. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/layout.js +80 -0
  14. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/readback.d.ts +9 -0
  15. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/readback.js +39 -0
  16. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/reader.d.ts +37 -0
  17. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/reader.js +424 -0
  18. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/redaction.d.ts +26 -0
  19. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/redaction.js +132 -0
  20. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/validation.d.ts +4 -0
  21. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/validation.js +39 -0
  22. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/writer.d.ts +23 -0
  23. package/node_modules/@herbertgao/resume-from/dist/adapters/claude-code/writer.js +306 -0
  24. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/contract.d.ts +15 -0
  25. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/contract.js +4 -0
  26. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/index.d.ts +6 -0
  27. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/index.js +44 -0
  28. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/read.d.ts +28 -0
  29. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/read.js +270 -0
  30. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/readback.d.ts +9 -0
  31. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/readback.js +47 -0
  32. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/redaction.d.ts +26 -0
  33. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/redaction.js +132 -0
  34. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/rollout.d.ts +75 -0
  35. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/rollout.js +185 -0
  36. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/validation.d.ts +7 -0
  37. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/validation.js +78 -0
  38. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/write.d.ts +17 -0
  39. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/write.js +141 -0
  40. package/node_modules/@herbertgao/resume-from/dist/adapters/contract.d.ts +74 -0
  41. package/node_modules/@herbertgao/resume-from/dist/adapters/contract.js +4 -0
  42. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/adapter.d.ts +15 -0
  43. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/adapter.js +209 -0
  44. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/contract.d.ts +24 -0
  45. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/contract.js +4 -0
  46. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/format.d.ts +162 -0
  47. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/format.js +223 -0
  48. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/index.d.ts +7 -0
  49. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/index.js +10 -0
  50. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/parse.d.ts +41 -0
  51. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/parse.js +371 -0
  52. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/redaction.d.ts +26 -0
  53. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/redaction.js +132 -0
  54. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/serialize.d.ts +22 -0
  55. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/serialize.js +87 -0
  56. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/validate.d.ts +14 -0
  57. package/node_modules/@herbertgao/resume-from/dist/adapters/pi/validate.js +134 -0
  58. package/node_modules/@herbertgao/resume-from/dist/bin.d.ts +35 -0
  59. package/node_modules/@herbertgao/resume-from/dist/bin.js +135 -0
  60. package/node_modules/@herbertgao/resume-from/dist/contract.d.ts +10 -0
  61. package/node_modules/@herbertgao/resume-from/dist/contract.js +4 -0
  62. package/node_modules/@herbertgao/resume-from/dist/host/agents.d.ts +29 -0
  63. package/node_modules/@herbertgao/resume-from/dist/host/agents.js +20 -0
  64. package/node_modules/@herbertgao/resume-from/dist/host/cli/args.d.ts +21 -0
  65. package/node_modules/@herbertgao/resume-from/dist/host/cli/args.js +187 -0
  66. package/node_modules/@herbertgao/resume-from/dist/host/cli/contract.d.ts +27 -0
  67. package/node_modules/@herbertgao/resume-from/dist/host/cli/contract.js +4 -0
  68. package/node_modules/@herbertgao/resume-from/dist/host/cli/index.d.ts +2 -0
  69. package/node_modules/@herbertgao/resume-from/dist/host/cli/index.js +1 -0
  70. package/node_modules/@herbertgao/resume-from/dist/host/cli/presentation.d.ts +2 -0
  71. package/node_modules/@herbertgao/resume-from/dist/host/cli/presentation.js +11 -0
  72. package/node_modules/@herbertgao/resume-from/dist/host/cli/render.d.ts +3 -0
  73. package/node_modules/@herbertgao/resume-from/dist/host/cli/render.js +70 -0
  74. package/node_modules/@herbertgao/resume-from/dist/host/cli/runner.d.ts +8 -0
  75. package/node_modules/@herbertgao/resume-from/dist/host/cli/runner.js +125 -0
  76. package/node_modules/@herbertgao/resume-from/dist/host/contract.d.ts +42 -0
  77. package/node_modules/@herbertgao/resume-from/dist/host/contract.js +4 -0
  78. package/node_modules/@herbertgao/resume-from/dist/host/entry.d.ts +52 -0
  79. package/node_modules/@herbertgao/resume-from/dist/host/entry.js +91 -0
  80. package/node_modules/@herbertgao/resume-from/dist/host/index.d.ts +11 -0
  81. package/node_modules/@herbertgao/resume-from/dist/host/index.js +10 -0
  82. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/command.d.ts +18 -0
  83. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/command.js +103 -0
  84. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/contract.d.ts +34 -0
  85. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/contract.js +4 -0
  86. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/index.d.ts +6 -0
  87. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/index.js +4 -0
  88. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/picker.d.ts +16 -0
  89. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/picker.js +35 -0
  90. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/presentation.d.ts +2 -0
  91. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/presentation.js +11 -0
  92. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/register.d.ts +25 -0
  93. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/register.js +11 -0
  94. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/ui.d.ts +20 -0
  95. package/node_modules/@herbertgao/resume-from/dist/host/pi-extension/ui.js +1 -0
  96. package/node_modules/@herbertgao/resume-from/dist/host/profile.d.ts +8 -0
  97. package/node_modules/@herbertgao/resume-from/dist/host/profile.js +31 -0
  98. package/node_modules/@herbertgao/resume-from/dist/host/registry.d.ts +8 -0
  99. package/node_modules/@herbertgao/resume-from/dist/host/registry.js +33 -0
  100. package/node_modules/@herbertgao/resume-from/dist/host/wiring.d.ts +41 -0
  101. package/node_modules/@herbertgao/resume-from/dist/host/wiring.js +67 -0
  102. package/node_modules/@herbertgao/resume-from/dist/import/confirmation.d.ts +6 -0
  103. package/node_modules/@herbertgao/resume-from/dist/import/confirmation.js +27 -0
  104. package/node_modules/@herbertgao/resume-from/dist/import/contract.d.ts +41 -0
  105. package/node_modules/@herbertgao/resume-from/dist/import/contract.js +4 -0
  106. package/node_modules/@herbertgao/resume-from/dist/import/discovery/contract.d.ts +58 -0
  107. package/node_modules/@herbertgao/resume-from/dist/import/discovery/contract.js +4 -0
  108. package/node_modules/@herbertgao/resume-from/dist/import/discovery/errors.d.ts +9 -0
  109. package/node_modules/@herbertgao/resume-from/dist/import/discovery/errors.js +12 -0
  110. package/node_modules/@herbertgao/resume-from/dist/import/discovery/finder.d.ts +10 -0
  111. package/node_modules/@herbertgao/resume-from/dist/import/discovery/finder.js +129 -0
  112. package/node_modules/@herbertgao/resume-from/dist/import/discovery/homes.d.ts +23 -0
  113. package/node_modules/@herbertgao/resume-from/dist/import/discovery/homes.js +83 -0
  114. package/node_modules/@herbertgao/resume-from/dist/import/discovery/index.d.ts +2 -0
  115. package/node_modules/@herbertgao/resume-from/dist/import/discovery/index.js +2 -0
  116. package/node_modules/@herbertgao/resume-from/dist/import/discovery/ordering.d.ts +3 -0
  117. package/node_modules/@herbertgao/resume-from/dist/import/discovery/ordering.js +21 -0
  118. package/node_modules/@herbertgao/resume-from/dist/import/errors.d.ts +22 -0
  119. package/node_modules/@herbertgao/resume-from/dist/import/errors.js +20 -0
  120. package/node_modules/@herbertgao/resume-from/dist/import/index.d.ts +3 -0
  121. package/node_modules/@herbertgao/resume-from/dist/import/index.js +5 -0
  122. package/node_modules/@herbertgao/resume-from/dist/import/landing/contract.d.ts +44 -0
  123. package/node_modules/@herbertgao/resume-from/dist/import/landing/contract.js +4 -0
  124. package/node_modules/@herbertgao/resume-from/dist/import/landing/errors.d.ts +15 -0
  125. package/node_modules/@herbertgao/resume-from/dist/import/landing/errors.js +15 -0
  126. package/node_modules/@herbertgao/resume-from/dist/import/landing/handover.d.ts +5 -0
  127. package/node_modules/@herbertgao/resume-from/dist/import/landing/handover.js +12 -0
  128. package/node_modules/@herbertgao/resume-from/dist/import/landing/index.d.ts +4 -0
  129. package/node_modules/@herbertgao/resume-from/dist/import/landing/index.js +4 -0
  130. package/node_modules/@herbertgao/resume-from/dist/import/landing/lander.d.ts +7 -0
  131. package/node_modules/@herbertgao/resume-from/dist/import/landing/lander.js +133 -0
  132. package/node_modules/@herbertgao/resume-from/dist/import/landing/marker.d.ts +9 -0
  133. package/node_modules/@herbertgao/resume-from/dist/import/landing/marker.js +46 -0
  134. package/node_modules/@herbertgao/resume-from/dist/import/pipeline.d.ts +17 -0
  135. package/node_modules/@herbertgao/resume-from/dist/import/pipeline.js +134 -0
  136. package/node_modules/@herbertgao/resume-from/dist/import/preview/builder.d.ts +6 -0
  137. package/node_modules/@herbertgao/resume-from/dist/import/preview/builder.js +76 -0
  138. package/node_modules/@herbertgao/resume-from/dist/import/preview/contract.d.ts +39 -0
  139. package/node_modules/@herbertgao/resume-from/dist/import/preview/contract.js +4 -0
  140. package/node_modules/@herbertgao/resume-from/dist/import/preview/format.d.ts +19 -0
  141. package/node_modules/@herbertgao/resume-from/dist/import/preview/format.js +45 -0
  142. package/node_modules/@herbertgao/resume-from/dist/import/preview/index.d.ts +2 -0
  143. package/node_modules/@herbertgao/resume-from/dist/import/preview/index.js +1 -0
  144. package/node_modules/@herbertgao/resume-from/dist/import/preview/warnings.d.ts +11 -0
  145. package/node_modules/@herbertgao/resume-from/dist/import/preview/warnings.js +80 -0
  146. package/node_modules/@herbertgao/resume-from/dist/import/transfer/contract.d.ts +48 -0
  147. package/node_modules/@herbertgao/resume-from/dist/import/transfer/contract.js +4 -0
  148. package/node_modules/@herbertgao/resume-from/dist/import/transfer/index.d.ts +2 -0
  149. package/node_modules/@herbertgao/resume-from/dist/import/transfer/index.js +1 -0
  150. package/node_modules/@herbertgao/resume-from/dist/import/transfer/rules.d.ts +3 -0
  151. package/node_modules/@herbertgao/resume-from/dist/import/transfer/rules.js +228 -0
  152. package/node_modules/@herbertgao/resume-from/dist/import/wiring.d.ts +24 -0
  153. package/node_modules/@herbertgao/resume-from/dist/import/wiring.js +27 -0
  154. package/node_modules/@herbertgao/resume-from/dist/index.d.ts +36 -0
  155. package/node_modules/@herbertgao/resume-from/dist/index.js +36 -0
  156. package/node_modules/@herbertgao/resume-from/dist/platform/config/contract.d.ts +35 -0
  157. package/node_modules/@herbertgao/resume-from/dist/platform/config/contract.js +4 -0
  158. package/node_modules/@herbertgao/resume-from/dist/platform/config/defaults.d.ts +16 -0
  159. package/node_modules/@herbertgao/resume-from/dist/platform/config/defaults.js +22 -0
  160. package/node_modules/@herbertgao/resume-from/dist/platform/config/errors.d.ts +9 -0
  161. package/node_modules/@herbertgao/resume-from/dist/platform/config/errors.js +12 -0
  162. package/node_modules/@herbertgao/resume-from/dist/platform/config/index.d.ts +5 -0
  163. package/node_modules/@herbertgao/resume-from/dist/platform/config/index.js +6 -0
  164. package/node_modules/@herbertgao/resume-from/dist/platform/config/loader.d.ts +10 -0
  165. package/node_modules/@herbertgao/resume-from/dist/platform/config/loader.js +47 -0
  166. package/node_modules/@herbertgao/resume-from/dist/platform/config/paths.d.ts +13 -0
  167. package/node_modules/@herbertgao/resume-from/dist/platform/config/paths.js +37 -0
  168. package/node_modules/@herbertgao/resume-from/dist/platform/config/validate.d.ts +9 -0
  169. package/node_modules/@herbertgao/resume-from/dist/platform/config/validate.js +117 -0
  170. package/node_modules/@herbertgao/resume-from/dist/platform/repo/contract.d.ts +30 -0
  171. package/node_modules/@herbertgao/resume-from/dist/platform/repo/contract.js +4 -0
  172. package/node_modules/@herbertgao/resume-from/dist/platform/repo/git.d.ts +21 -0
  173. package/node_modules/@herbertgao/resume-from/dist/platform/repo/git.js +74 -0
  174. package/node_modules/@herbertgao/resume-from/dist/platform/repo/index.d.ts +2 -0
  175. package/node_modules/@herbertgao/resume-from/dist/platform/repo/index.js +1 -0
  176. package/node_modules/@herbertgao/resume-from/dist/platform/repo/reader.d.ts +8 -0
  177. package/node_modules/@herbertgao/resume-from/dist/platform/repo/reader.js +130 -0
  178. package/node_modules/@herbertgao/resume-from/dist/platform/store/contract.d.ts +31 -0
  179. package/node_modules/@herbertgao/resume-from/dist/platform/store/contract.js +4 -0
  180. package/node_modules/@herbertgao/resume-from/dist/platform/store/file-committer.d.ts +3 -0
  181. package/node_modules/@herbertgao/resume-from/dist/platform/store/file-committer.js +391 -0
  182. package/node_modules/@herbertgao/resume-from/dist/platform/store/index.d.ts +2 -0
  183. package/node_modules/@herbertgao/resume-from/dist/platform/store/index.js +2 -0
  184. package/node_modules/@herbertgao/resume-from/dist/platform/tokens/contract.d.ts +12 -0
  185. package/node_modules/@herbertgao/resume-from/dist/platform/tokens/contract.js +4 -0
  186. package/node_modules/@herbertgao/resume-from/dist/platform/tokens/estimator.d.ts +12 -0
  187. package/node_modules/@herbertgao/resume-from/dist/platform/tokens/estimator.js +111 -0
  188. package/node_modules/@herbertgao/resume-from/dist/platform/tokens/index.d.ts +2 -0
  189. package/node_modules/@herbertgao/resume-from/dist/platform/tokens/index.js +1 -0
  190. package/node_modules/@herbertgao/resume-from/dist/session/contract.d.ts +109 -0
  191. package/node_modules/@herbertgao/resume-from/dist/session/contract.js +4 -0
  192. package/node_modules/@herbertgao/resume-from/package.json +94 -0
  193. package/node_modules/@herbertgao/resume-from/shims/pi/extensions/resume-from.js +118 -0
  194. package/package.json +6 -2
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@herbertgao/resume-from",
3
+ "version": "0.2.0",
4
+ "description": "Continue a coding session in a different agent, or a different profile.",
5
+ "keywords": [
6
+ "pi-package",
7
+ "coding-agent",
8
+ "session-handoff",
9
+ "claude-code",
10
+ "codex"
11
+ ],
12
+ "type": "module",
13
+ "license": "MIT",
14
+ "author": "Herbert Gao",
15
+ "contributors": [
16
+ "Alexei Led"
17
+ ],
18
+ "engines": {
19
+ "node": ">=24"
20
+ },
21
+ "bin": {
22
+ "resume-from": "./dist/bin.js"
23
+ },
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./pi-extension": {
31
+ "types": "./dist/host/pi-extension/index.d.ts",
32
+ "import": "./dist/host/pi-extension/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "shims/pi",
38
+ "README.md",
39
+ "LICENSE"
40
+ ],
41
+ "scripts": {
42
+ "build": "node scripts/clean-dist.mjs && tsc -p tsconfig.build.json",
43
+ "typecheck": "tsc --noEmit",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "format": "biome format --write .",
47
+ "format:check": "biome format .",
48
+ "lint": "biome check . && eslint . --cache --cache-strategy content",
49
+ "lint:fix": "biome check --write .",
50
+ "pack:dry": "npm pack --dry-run",
51
+ "prepack": "npm run build",
52
+ "postpack": "node scripts/clean-dist.mjs"
53
+ },
54
+ "devDependencies": {
55
+ "@biomejs/biome": "2.5.7",
56
+ "@eslint/js": "^10.0.1",
57
+ "@types/node": "^24.13.3",
58
+ "esbuild": "0.28.1",
59
+ "eslint": "^10.8.0",
60
+ "globals": "^17.9.0",
61
+ "typescript": "^7.0.2",
62
+ "typescript-compiler-api": "npm:typescript@6.0.3",
63
+ "vitest": "^4.1.10"
64
+ },
65
+ "dependencies": {
66
+ "@earendil-works/pi-tui": "^0.84.1",
67
+ "gpt-tokenizer": "^3.4.0"
68
+ },
69
+ "pi": {
70
+ "extensions": [
71
+ "./shims/pi/extensions/resume-from.js"
72
+ ],
73
+ "image": "https://raw.githubusercontent.com/alexei-led/resume-from/fa0bfa778b52c64accc53155f12f3b895476ea08/assets/resume-from-card.png"
74
+ },
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "git+https://github.com/HerbertGao/pi-extensions.git",
78
+ "directory": "packages/resume-from"
79
+ },
80
+ "homepage": "https://github.com/HerbertGao/pi-extensions/tree/master/packages/resume-from#readme",
81
+ "bugs": {
82
+ "url": "https://github.com/HerbertGao/pi-extensions/issues"
83
+ },
84
+ "publishConfig": {
85
+ "access": "public",
86
+ "provenance": true
87
+ },
88
+ "x-upstream": {
89
+ "package": "resume-from",
90
+ "version": "0.2.0",
91
+ "repository": "https://github.com/alexei-led/resume-from",
92
+ "commit": "e1dad0dd4ae5fb6a5a50b905dd4359a29fd0910e"
93
+ }
94
+ }
@@ -0,0 +1,118 @@
1
+ import { homedir } from "node:os";
2
+ import { isAbsolute, join, resolve } from "node:path";
3
+ import { truncateToWidth } from "@earendil-works/pi-tui";
4
+ import { activatePiExtension } from "@herbertgao/resume-from";
5
+ import { formatRow, safeLines, safeText } from "@herbertgao/resume-from/pi-extension";
6
+
7
+ const COMMAND_NAME = "resume-from";
8
+ const DESCRIPTION =
9
+ "Continue another session. Use /resume-from --help for accepted arguments.";
10
+ const PROVENANCE_CUSTOM_TYPE = "resume-from-provenance";
11
+
12
+ function provenanceLines(data) {
13
+ const lines = data?.lines;
14
+ return Array.isArray(lines) && lines.every((line) => typeof line === "string")
15
+ ? lines
16
+ : null;
17
+ }
18
+
19
+ function renderProvenance(entry, { expanded }, theme) {
20
+ const lines = provenanceLines(entry.data);
21
+ const visible =
22
+ lines === null
23
+ ? ["Imported session"]
24
+ : expanded
25
+ ? lines
26
+ : [`${lines[0] ?? "Imported session"} · ${lines.at(-1) ?? ""}`];
27
+ return {
28
+ render(width) {
29
+ return visible.map((line) =>
30
+ theme.bg("customMessageBg", truncateToWidth(safeText(line), Math.max(0, width), "")),
31
+ );
32
+ },
33
+ invalidate() {},
34
+ };
35
+ }
36
+
37
+ function agentHome() {
38
+ const configured = process.env.PI_CODING_AGENT_DIR;
39
+ if (configured === undefined) return join(homedir(), ".pi", "agent");
40
+ return isAbsolute(configured) ? configured : resolve(configured);
41
+ }
42
+
43
+ function commandArgs(raw) {
44
+ const trimmed = raw.trim();
45
+ return trimmed === "" ? [] : [trimmed];
46
+ }
47
+
48
+ function uiFor(context) {
49
+ return {
50
+ show(lines) {
51
+ context.ui.notify(safeLines(lines).join("\n"), "info");
52
+ },
53
+ async confirm(question) {
54
+ return (await context.ui.confirm("Resume session", safeText(question)))
55
+ ? "selected"
56
+ : "cancelled";
57
+ },
58
+ };
59
+ }
60
+
61
+ function pickerFor(context) {
62
+ return {
63
+ async pick(listing) {
64
+ if (!context.hasUI) return { choice: "cancelled", selected: null };
65
+
66
+ const options = listing.rows.map((row, index) =>
67
+ safeText(`${index + 1}. ${formatRow(row)}`),
68
+ );
69
+ const selected = await context.ui.select(
70
+ "Select a session to import",
71
+ options,
72
+ );
73
+ const row =
74
+ listing.rows[selected === undefined ? -1 : options.indexOf(selected)];
75
+ return row === undefined
76
+ ? { choice: "cancelled", selected: null }
77
+ : { choice: "selected", selected: row };
78
+ },
79
+ };
80
+ }
81
+
82
+ export default function resumeFrom(pi) {
83
+ // Provenance is already persisted as a custom entry. Render it in the transcript,
84
+ // not as a widget, so it scrolls away and never occupies the footer/editor area.
85
+ pi.registerEntryRenderer(PROVENANCE_CUSTOM_TYPE, renderProvenance);
86
+
87
+ pi.registerCommand(COMMAND_NAME, {
88
+ description: DESCRIPTION,
89
+ async handler(rawArgs, context) {
90
+ const home = agentHome();
91
+ let command;
92
+ await activatePiExtension({
93
+ agent: "pi",
94
+ registrar: { registerCommand: (definition) => (command = definition) },
95
+ ui: uiFor(context),
96
+ picker: pickerFor(context),
97
+ home,
98
+ cwd: context.cwd,
99
+ });
100
+
101
+ if (command === undefined) {
102
+ throw new Error(
103
+ "resume-from: extension activation did not register /resume-from.",
104
+ );
105
+ }
106
+
107
+ await command.run(
108
+ {
109
+ cwd: context.cwd,
110
+ home,
111
+ switchSession: (path, options) =>
112
+ context.switchSession(path, options),
113
+ },
114
+ commandArgs(rawArgs),
115
+ );
116
+ },
117
+ });
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-extensions",
3
- "version": "2026.8.9",
3
+ "version": "2026.8.11",
4
4
  "description": "Aggregate installer for HerbertGao-maintained Pi extensions.",
5
5
  "keywords": [
6
6
  "extensions",
@@ -53,6 +53,7 @@
53
53
  "@herbertgao/pi-stash": "0.1.2",
54
54
  "@herbertgao/pi-subagents": "0.16.1",
55
55
  "@herbertgao/pi-titlebar-spinner": "0.1.3",
56
+ "@herbertgao/resume-from": "0.2.0",
56
57
  "@juicesharp/rpiv-ask-user-question": "2.7.0",
57
58
  "@juicesharp/rpiv-config": "^2.7.0",
58
59
  "@modelcontextprotocol/client": "2.0.0",
@@ -73,6 +74,7 @@
73
74
  "croner": "^10.0.1",
74
75
  "cross-spawn": "^7.0.6",
75
76
  "effect": "4.0.0-beta.103",
77
+ "gpt-tokenizer": "^3.4.0",
76
78
  "grok-mermaid": "0.2.2",
77
79
  "jiti": "^2.7.0",
78
80
  "js-yaml": "^5.2.2",
@@ -117,6 +119,7 @@
117
119
  "@herbertgao/pi-stash",
118
120
  "@herbertgao/pi-subagents",
119
121
  "@herbertgao/pi-titlebar-spinner",
122
+ "@herbertgao/resume-from",
120
123
  "@juicesharp/rpiv-ask-user-question",
121
124
  "@narumitw/pi-btw",
122
125
  "@pi-plugins/fast-mode",
@@ -127,13 +130,14 @@
127
130
  "remote-pi"
128
131
  ],
129
132
  "engines": {
130
- "node": ">=22.19.0"
133
+ "node": ">=24"
131
134
  },
132
135
  "pi": {
133
136
  "extensions": [
134
137
  "./node_modules/@dietrichgebert/ponytail/pi-extension/index.js",
135
138
  "./node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts",
136
139
  "./node_modules/@herbertgao/pi-copy-response/src/index.ts",
140
+ "./node_modules/@herbertgao/resume-from/shims/pi/extensions/resume-from.js",
137
141
  "./node_modules/@herbertgao/pi-handoff/src/index.ts",
138
142
  "./node_modules/@herbertgao/pi-handoff/src/session-query.ts",
139
143
  "./node_modules/@herbertgao/pi-inline-skills/src/index.ts",