@e4779/pi-fabric 0.109.4-fork.24 → 0.116.0-fork.26

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 (283) hide show
  1. package/README.md +3 -1
  2. package/THIRD_PARTY_NOTICES.md +7 -0
  3. package/dist/agents/completion-inbox.d.ts.map +1 -1
  4. package/dist/agents/handoff.d.ts +1 -1
  5. package/dist/agents/handoff.d.ts.map +1 -1
  6. package/dist/agents/manager.d.ts +8 -0
  7. package/dist/agents/manager.d.ts.map +1 -1
  8. package/dist/agents/provider-bridge.d.ts +64 -0
  9. package/dist/agents/provider-bridge.d.ts.map +1 -0
  10. package/dist/agents/provider-bridge.js +117 -0
  11. package/dist/agents/provider-bridge.js.map +7 -0
  12. package/dist/agents/runner-registry.d.ts +3 -0
  13. package/dist/agents/runner-registry.d.ts.map +1 -1
  14. package/dist/agents/trace-context-request.d.ts +4 -0
  15. package/dist/agents/trace-context-request.d.ts.map +1 -0
  16. package/dist/agents/trace-context.d.ts +31 -0
  17. package/dist/agents/trace-context.d.ts.map +1 -0
  18. package/dist/agents/types.d.ts +13 -0
  19. package/dist/agents/types.d.ts.map +1 -1
  20. package/dist/agents.js +5 -5
  21. package/dist/audit/details.d.ts +5 -2
  22. package/dist/audit/details.d.ts.map +1 -1
  23. package/dist/capture/interceptor.d.ts.map +1 -1
  24. package/dist/chunks/{chunk-WHBJDTCR.js → chunk-4GGBND7V.js} +37 -10
  25. package/dist/chunks/chunk-4GGBND7V.js.map +7 -0
  26. package/dist/chunks/{chunk-N2VKKA7O.js → chunk-4GNFBZPR.js} +2 -2
  27. package/dist/chunks/{chunk-J2HUD36Z.js → chunk-5X35KXBV.js} +14 -2
  28. package/dist/chunks/{chunk-J2HUD36Z.js.map → chunk-5X35KXBV.js.map} +2 -2
  29. package/dist/chunks/{chunk-K7LQIEJY.js → chunk-6EVAHJAR.js} +5 -5
  30. package/dist/chunks/{chunk-ST36EYHN.js → chunk-6QVQXGMR.js} +1 -1
  31. package/dist/chunks/chunk-6QVQXGMR.js.map +7 -0
  32. package/dist/chunks/chunk-7C5IEIQK.js +157 -0
  33. package/dist/chunks/chunk-7C5IEIQK.js.map +7 -0
  34. package/dist/chunks/{chunk-LQSICKDK.js → chunk-A5XF3ZPJ.js} +18 -1
  35. package/dist/chunks/chunk-A5XF3ZPJ.js.map +7 -0
  36. package/dist/chunks/{chunk-CZPQTISQ.js → chunk-BQWJ5ZR7.js} +10 -6
  37. package/dist/chunks/chunk-BQWJ5ZR7.js.map +7 -0
  38. package/dist/chunks/{chunk-JJQECUUA.js → chunk-DONS3EZH.js} +2 -2
  39. package/dist/chunks/{chunk-W5CHVJBR.js → chunk-EQYQICUY.js} +54 -8
  40. package/dist/chunks/chunk-EQYQICUY.js.map +7 -0
  41. package/dist/chunks/{chunk-67RXNJLG.js → chunk-HITKWKYD.js} +6 -4
  42. package/dist/chunks/chunk-HITKWKYD.js.map +7 -0
  43. package/dist/chunks/{chunk-COQPGIBO.js → chunk-HZGQ7XYM.js} +2 -2
  44. package/dist/chunks/chunk-IQXNJNDI.js +854 -0
  45. package/dist/chunks/chunk-IQXNJNDI.js.map +7 -0
  46. package/dist/chunks/{chunk-7OFAO4HK.js → chunk-MOJBW5X2.js} +41 -2
  47. package/dist/chunks/chunk-MOJBW5X2.js.map +7 -0
  48. package/dist/chunks/{chunk-ACGEYOXM.js → chunk-O7IREHJI.js} +102 -44
  49. package/dist/chunks/chunk-O7IREHJI.js.map +7 -0
  50. package/dist/chunks/{chunk-RG2VFKR3.js → chunk-ODYU3IJU.js} +80 -17
  51. package/dist/chunks/chunk-ODYU3IJU.js.map +7 -0
  52. package/dist/chunks/{chunk-PXAICAUT.js → chunk-PBDDXBHY.js} +2 -1
  53. package/dist/chunks/chunk-PBDDXBHY.js.map +7 -0
  54. package/dist/chunks/{chunk-B54Z662X.js → chunk-PTZ5DKAB.js} +25 -5
  55. package/dist/chunks/chunk-PTZ5DKAB.js.map +7 -0
  56. package/dist/chunks/{chunk-RUO6L7RM.js → chunk-Q2JQ3RYZ.js} +3 -1
  57. package/dist/chunks/chunk-Q2JQ3RYZ.js.map +7 -0
  58. package/dist/chunks/{chunk-YKT5VLLQ.js → chunk-QCCPR3U5.js} +3 -3
  59. package/dist/chunks/{chunk-GYPDGW27.js → chunk-QGP7AY2R.js} +4 -2
  60. package/dist/chunks/{chunk-GYPDGW27.js.map → chunk-QGP7AY2R.js.map} +2 -2
  61. package/dist/chunks/chunk-QRN433TI.js +19 -0
  62. package/dist/chunks/chunk-QRN433TI.js.map +7 -0
  63. package/dist/chunks/{chunk-CXTTLBUV.js → chunk-R2XQ6AHT.js} +2 -2
  64. package/dist/chunks/{chunk-DV2JZSCI.js → chunk-SPCJXN4K.js} +14 -4
  65. package/dist/chunks/{chunk-DV2JZSCI.js.map → chunk-SPCJXN4K.js.map} +2 -2
  66. package/dist/chunks/{chunk-I5ENWRUJ.js → chunk-TNPZBMYC.js} +31 -7
  67. package/dist/chunks/chunk-TNPZBMYC.js.map +7 -0
  68. package/dist/chunks/{chunk-5SU3YXBS.js → chunk-UGYCAG6O.js} +1 -1
  69. package/dist/chunks/{chunk-5SU3YXBS.js.map → chunk-UGYCAG6O.js.map} +1 -1
  70. package/dist/chunks/{chunk-QSXZPS7F.js → chunk-V2IV4LYW.js} +2 -2
  71. package/dist/chunks/chunk-WJJXODAB.js +82 -0
  72. package/dist/chunks/chunk-WJJXODAB.js.map +7 -0
  73. package/dist/chunks/{chunk-RFOQPXKN.js → chunk-WQ6LC2KK.js} +2 -2
  74. package/dist/chunks/{chunk-3DUKKQHN.js → chunk-ZQMBS5SH.js} +5 -5
  75. package/dist/commands/fabric.d.ts +1 -1
  76. package/dist/commands/fabric.d.ts.map +1 -1
  77. package/dist/compaction/hook.d.ts +1 -1
  78. package/dist/compaction/hook.d.ts.map +1 -1
  79. package/dist/compaction/hook.js +1 -1
  80. package/dist/compaction/owner.js +2 -2
  81. package/dist/components/configuration.js +4 -4
  82. package/dist/config.d.ts +2 -0
  83. package/dist/config.d.ts.map +1 -1
  84. package/dist/core/action-registry.d.ts.map +1 -1
  85. package/dist/core/action-registry.js +3 -3
  86. package/dist/core/action-result.d.ts +10 -0
  87. package/dist/core/action-result.d.ts.map +1 -1
  88. package/dist/core/agent-dir.d.ts +1 -0
  89. package/dist/core/agent-dir.d.ts.map +1 -1
  90. package/dist/core/fabric-state-paths.d.ts.map +1 -1
  91. package/dist/core/host-sdk-runtime.d.ts +8 -0
  92. package/dist/core/host-sdk-runtime.d.ts.map +1 -0
  93. package/dist/core/host-sdk.d.ts +28 -0
  94. package/dist/core/host-sdk.d.ts.map +1 -0
  95. package/dist/core/host-sdk.js +11 -0
  96. package/dist/core/host-sdk.js.map +7 -0
  97. package/dist/core/session-context.d.ts +5 -0
  98. package/dist/core/session-context.d.ts.map +1 -1
  99. package/dist/core/shell-inbox.d.ts.map +1 -1
  100. package/dist/core/shell-jobs.d.ts +2 -0
  101. package/dist/core/shell-jobs.d.ts.map +1 -1
  102. package/dist/core/tool-ownership.d.ts.map +1 -1
  103. package/dist/core/tool-result-proxy.d.ts +2 -0
  104. package/dist/core/tool-result-proxy.d.ts.map +1 -1
  105. package/dist/durable/agent.d.ts +6 -0
  106. package/dist/durable/agent.d.ts.map +1 -1
  107. package/dist/durable/worker-host.d.ts.map +1 -1
  108. package/dist/durable/worker-host.js +48 -10
  109. package/dist/durable/worker-host.js.map +2 -2
  110. package/dist/durable.js +2 -2
  111. package/dist/durable.js.map +1 -1
  112. package/dist/extension-bootstrap.js +11 -11
  113. package/dist/fabric-runtime-state.d.ts +2 -0
  114. package/dist/fabric-runtime-state.d.ts.map +1 -1
  115. package/dist/fabric-runtime-state.js +343 -83
  116. package/dist/fabric-runtime-state.js.map +4 -4
  117. package/dist/fabric-state.d.ts +2 -0
  118. package/dist/fabric-state.d.ts.map +1 -1
  119. package/dist/index.js +13 -11
  120. package/dist/index.js.map +1 -1
  121. package/dist/jev/auth.d.ts +2 -0
  122. package/dist/jev/auth.d.ts.map +1 -1
  123. package/dist/jev/client.d.ts.map +1 -1
  124. package/dist/jev/client.js +3 -3
  125. package/dist/jev/config.d.ts +5 -0
  126. package/dist/jev/config.d.ts.map +1 -1
  127. package/dist/jev/decision-profiles.d.ts +8 -0
  128. package/dist/jev/decision-profiles.d.ts.map +1 -0
  129. package/dist/jev/decision-schema.d.ts +35 -0
  130. package/dist/jev/decision-schema.d.ts.map +1 -0
  131. package/dist/jev/decision-types.d.ts +139 -0
  132. package/dist/jev/decision-types.d.ts.map +1 -0
  133. package/dist/jev/decisions.d.ts +27 -0
  134. package/dist/jev/decisions.d.ts.map +1 -0
  135. package/dist/jev/guest-types.d.ts +1 -1
  136. package/dist/jev/guest-types.d.ts.map +1 -1
  137. package/dist/jev/manager.d.ts +7 -0
  138. package/dist/jev/manager.d.ts.map +1 -1
  139. package/dist/jev/model-key.d.ts +3 -2
  140. package/dist/jev/model-key.d.ts.map +1 -1
  141. package/dist/jev/observation.js +4 -4
  142. package/dist/jev/routes.d.ts +11 -1
  143. package/dist/jev/routes.d.ts.map +1 -1
  144. package/dist/jev/types.d.ts +3 -2
  145. package/dist/jev/types.d.ts.map +1 -1
  146. package/dist/jev/validation.d.ts +34 -0
  147. package/dist/jev/validation.d.ts.map +1 -1
  148. package/dist/jev-fabric/resolve.d.ts +4 -0
  149. package/dist/jev-fabric/resolve.d.ts.map +1 -1
  150. package/dist/jev-fabric/resolve.js +1 -0
  151. package/dist/jev-fabric/resolve.js.map +2 -2
  152. package/dist/jev-fabric/serve.d.ts +5 -15
  153. package/dist/jev-fabric/serve.d.ts.map +1 -1
  154. package/dist/jev-fabric/serve.js +87 -56
  155. package/dist/jev-fabric/serve.js.map +2 -2
  156. package/dist/jev.d.ts +6 -2
  157. package/dist/jev.d.ts.map +1 -1
  158. package/dist/jev.js +33 -11
  159. package/dist/memory/extractive-history.d.ts +3 -0
  160. package/dist/memory/extractive-history.d.ts.map +1 -1
  161. package/dist/memory/extractive-history.js +36 -7
  162. package/dist/memory/extractive-history.js.map +3 -3
  163. package/dist/memory/extractive-index.d.ts.map +1 -1
  164. package/dist/protocol.d.ts +3 -0
  165. package/dist/protocol.d.ts.map +1 -1
  166. package/dist/protocol.js +3 -1
  167. package/dist/providers/agents-provider.d.ts.map +1 -1
  168. package/dist/providers/captured-tools-provider.d.ts.map +1 -1
  169. package/dist/providers/jev-provider.d.ts +2 -0
  170. package/dist/providers/jev-provider.d.ts.map +1 -1
  171. package/dist/providers/jev-provider.js +8 -8
  172. package/dist/providers/pi-bash-cwd.d.ts +1 -1
  173. package/dist/providers/pi-bash-cwd.d.ts.map +1 -1
  174. package/dist/providers/pi-tools-provider.d.ts.map +1 -1
  175. package/dist/providers/write-preview.d.ts +1 -1
  176. package/dist/providers/write-preview.d.ts.map +1 -1
  177. package/dist/residency/host.js +10 -8
  178. package/dist/residency/pi-entry.js +10 -8
  179. package/dist/residency/pi-entry.js.map +1 -1
  180. package/dist/runners.js +1 -1
  181. package/dist/runtime/core-override-guest-types.js +2 -2
  182. package/dist/runtime/guest-types.d.ts +1 -1
  183. package/dist/runtime/guest-types.d.ts.map +1 -1
  184. package/dist/runtime/guest-types.js +1 -1
  185. package/dist/runtime/monty-runtime.js +3 -3
  186. package/dist/runtime/node-process-runtime.js +3 -3
  187. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  188. package/dist/runtime/quickjs-runtime.js +2 -2
  189. package/dist/runtime/typescript-kernel.js +5 -5
  190. package/dist/storage/retention.d.ts.map +1 -1
  191. package/dist/topology/peer-presence.d.ts +56 -0
  192. package/dist/topology/peer-presence.d.ts.map +1 -0
  193. package/dist/type-error-guidance.js +1 -1
  194. package/dist/ui/controller.d.ts.map +1 -1
  195. package/dist/ui/conversation-chrome.js +2 -2
  196. package/dist/ui/conversation-host.js +1 -1
  197. package/dist/ui/conversation-native-reader.js +1 -1
  198. package/dist/ui/conversation.js +6 -6
  199. package/dist/ui/dashboard.js +3 -3
  200. package/dist/ui/settings-decision-profiles.d.ts +24 -0
  201. package/dist/ui/settings-decision-profiles.d.ts.map +1 -0
  202. package/dist/ui/settings-section-context.d.ts +1 -1
  203. package/dist/ui/settings-section-context.d.ts.map +1 -1
  204. package/dist/ui/settings-sections-agents.d.ts.map +1 -1
  205. package/dist/ui/settings-sections-decisions.d.ts +4 -0
  206. package/dist/ui/settings-sections-decisions.d.ts.map +1 -0
  207. package/dist/ui/settings-sections-lifecycle.d.ts.map +1 -1
  208. package/dist/ui/settings-sections.d.ts +1 -1
  209. package/dist/ui/settings-sections.d.ts.map +1 -1
  210. package/dist/ui/settings-submenus.d.ts +3 -1
  211. package/dist/ui/settings-submenus.d.ts.map +1 -1
  212. package/dist/ui/settings-values.d.ts.map +1 -1
  213. package/dist/ui/settings.d.ts.map +1 -1
  214. package/dist/ui/settings.js +224 -45
  215. package/dist/ui/settings.js.map +4 -4
  216. package/dist/worker/options.d.ts.map +1 -1
  217. package/dist/worker/options.js +15 -0
  218. package/dist/worker/options.js.map +2 -2
  219. package/dist/worker.js +11 -1
  220. package/dist/worker.js.map +2 -2
  221. package/docs/agents.md +49 -0
  222. package/docs/architecture.md +1 -1
  223. package/docs/audit-trace.md +3 -1
  224. package/docs/background-tasks.md +4 -0
  225. package/docs/compaction.md +1 -1
  226. package/docs/configuration.md +91 -8
  227. package/docs/decision-profiles.schema.json +52 -0
  228. package/docs/decision-test-coverage.md +77 -0
  229. package/docs/durable-pi.md +9 -2
  230. package/docs/extractive-history.md +17 -2
  231. package/docs/jev-decisions.md +150 -0
  232. package/docs/jev.md +18 -5
  233. package/docs/prompt-cache.md +1 -1
  234. package/docs/providers.md +4 -1
  235. package/node_modules/pi-coralbricks-provider/LICENSE +21 -0
  236. package/node_modules/pi-coralbricks-provider/README.md +306 -0
  237. package/node_modules/pi-coralbricks-provider/auth.ts +30 -0
  238. package/node_modules/pi-coralbricks-provider/custom-models.json +1 -0
  239. package/node_modules/pi-coralbricks-provider/deprecated-models.json +1 -0
  240. package/node_modules/pi-coralbricks-provider/guard.ts +155 -0
  241. package/node_modules/pi-coralbricks-provider/index.ts +662 -0
  242. package/node_modules/pi-coralbricks-provider/models.json +88 -0
  243. package/node_modules/pi-coralbricks-provider/package.json +74 -0
  244. package/node_modules/pi-coralbricks-provider/park.ts +122 -0
  245. package/node_modules/pi-coralbricks-provider/patch.json +34 -0
  246. package/node_modules/pi-coralbricks-provider/scripts/update-models.js +658 -0
  247. package/node_modules/pi-coralbricks-provider/settings.ts +143 -0
  248. package/node_modules/pi-coralbricks-provider/sync-policy.ts +309 -0
  249. package/package.json +18 -13
  250. package/skillsets/python/fabric-exec/SKILL.md +1 -1
  251. package/skillsets/python/fabric-exec/references/agents.md +1 -1
  252. package/skillsets/python/fabric-foreman/SKILL.md +1 -1
  253. package/skillsets/python/fabric-jev/SKILL.md +2 -2
  254. package/skillsets/typescript/fabric-exec/SKILL.md +1 -1
  255. package/skillsets/typescript/fabric-exec/references/agents.md +1 -0
  256. package/skillsets/typescript/fabric-foreman/SKILL.md +1 -1
  257. package/skillsets/typescript/fabric-jev/SKILL.md +2 -2
  258. package/dist/chunks/chunk-67RXNJLG.js.map +0 -7
  259. package/dist/chunks/chunk-7OFAO4HK.js.map +0 -7
  260. package/dist/chunks/chunk-ACGEYOXM.js.map +0 -7
  261. package/dist/chunks/chunk-B54Z662X.js.map +0 -7
  262. package/dist/chunks/chunk-CZPQTISQ.js.map +0 -7
  263. package/dist/chunks/chunk-I5ENWRUJ.js.map +0 -7
  264. package/dist/chunks/chunk-IAFI4A2I.js +0 -92
  265. package/dist/chunks/chunk-IAFI4A2I.js.map +0 -7
  266. package/dist/chunks/chunk-LQSICKDK.js.map +0 -7
  267. package/dist/chunks/chunk-PXAICAUT.js.map +0 -7
  268. package/dist/chunks/chunk-QSL5UXNW.js +0 -515
  269. package/dist/chunks/chunk-QSL5UXNW.js.map +0 -7
  270. package/dist/chunks/chunk-RG2VFKR3.js.map +0 -7
  271. package/dist/chunks/chunk-RUO6L7RM.js.map +0 -7
  272. package/dist/chunks/chunk-ST36EYHN.js.map +0 -7
  273. package/dist/chunks/chunk-W5CHVJBR.js.map +0 -7
  274. package/dist/chunks/chunk-WHBJDTCR.js.map +0 -7
  275. /package/dist/chunks/{chunk-N2VKKA7O.js.map → chunk-4GNFBZPR.js.map} +0 -0
  276. /package/dist/chunks/{chunk-K7LQIEJY.js.map → chunk-6EVAHJAR.js.map} +0 -0
  277. /package/dist/chunks/{chunk-JJQECUUA.js.map → chunk-DONS3EZH.js.map} +0 -0
  278. /package/dist/chunks/{chunk-COQPGIBO.js.map → chunk-HZGQ7XYM.js.map} +0 -0
  279. /package/dist/chunks/{chunk-YKT5VLLQ.js.map → chunk-QCCPR3U5.js.map} +0 -0
  280. /package/dist/chunks/{chunk-CXTTLBUV.js.map → chunk-R2XQ6AHT.js.map} +0 -0
  281. /package/dist/chunks/{chunk-QSXZPS7F.js.map → chunk-V2IV4LYW.js.map} +0 -0
  282. /package/dist/chunks/{chunk-RFOQPXKN.js.map → chunk-WQ6LC2KK.js.map} +0 -0
  283. /package/dist/chunks/{chunk-3DUKKQHN.js.map → chunk-ZQMBS5SH.js.map} +0 -0
@@ -0,0 +1,88 @@
1
+ [
2
+ {
3
+ "id": "deepseek-v4.1-flash-fast",
4
+ "name": "DeepSeek V4.1 Flash",
5
+ "reasoning": false,
6
+ "input": [
7
+ "text",
8
+ "image"
9
+ ],
10
+ "cost": {
11
+ "input": 0.01,
12
+ "output": 1.2,
13
+ "cacheRead": 0,
14
+ "cacheWrite": 0.09
15
+ },
16
+ "contextWindow": 1048576,
17
+ "maxTokens": 32768,
18
+ "compat": {
19
+ "supportsDeveloperRole": false,
20
+ "supportsStore": false,
21
+ "maxTokensField": "max_tokens"
22
+ }
23
+ },
24
+ {
25
+ "id": "deepseek-v4.1-flash-fast-fp4",
26
+ "name": "Deepseek V4.1 Flash Fast Fp4",
27
+ "reasoning": false,
28
+ "input": [
29
+ "text",
30
+ "image"
31
+ ],
32
+ "cost": {
33
+ "input": 0.01,
34
+ "output": 1.2,
35
+ "cacheRead": 0,
36
+ "cacheWrite": 0.09
37
+ },
38
+ "contextWindow": 1048576,
39
+ "maxTokens": 32768,
40
+ "compat": {
41
+ "supportsDeveloperRole": false,
42
+ "supportsStore": false,
43
+ "maxTokensField": "max_tokens"
44
+ }
45
+ },
46
+ {
47
+ "id": "glm-5.3-fast",
48
+ "name": "GLM 5.3",
49
+ "reasoning": false,
50
+ "input": [
51
+ "text"
52
+ ],
53
+ "cost": {
54
+ "input": 1.12,
55
+ "output": 4.4,
56
+ "cacheRead": 0,
57
+ "cacheWrite": 1.68
58
+ },
59
+ "contextWindow": 1048576,
60
+ "maxTokens": 32768,
61
+ "compat": {
62
+ "supportsDeveloperRole": false,
63
+ "supportsStore": false,
64
+ "maxTokensField": "max_tokens"
65
+ }
66
+ },
67
+ {
68
+ "id": "glm-5.3-fp4",
69
+ "name": "Glm 5.3 Fp4",
70
+ "reasoning": false,
71
+ "input": [
72
+ "text"
73
+ ],
74
+ "cost": {
75
+ "input": 1.12,
76
+ "output": 4.4,
77
+ "cacheRead": 0,
78
+ "cacheWrite": 1.68
79
+ },
80
+ "contextWindow": 1048576,
81
+ "maxTokens": 32768,
82
+ "compat": {
83
+ "supportsDeveloperRole": false,
84
+ "supportsStore": false,
85
+ "maxTokensField": "max_tokens"
86
+ }
87
+ }
88
+ ]
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "pi-coralbricks-provider",
3
+ "version": "1.0.32",
4
+ "description": "CoralBricks provider extension for pi - Access GLM 5.3 and DeepSeek V4.1 Flash (FP4 variants included) through the Coral Inference API",
5
+ "author": "monotykamary",
6
+ "homepage": "https://github.com/monotykamary/pi-coralbricks-provider#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/monotykamary/pi-coralbricks-provider.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/monotykamary/pi-coralbricks-provider/issues"
13
+ },
14
+ "type": "module",
15
+ "main": "index.ts",
16
+ "scripts": {
17
+ "clean": "echo 'nothing to clean'",
18
+ "build": "echo 'nothing to build'",
19
+ "check": "tsc --noEmit && vitest run",
20
+ "test": "vitest run",
21
+ "update-models": "node scripts/update-models.js",
22
+ "test:pi": "node scripts/test-pi-compat.mjs"
23
+ },
24
+ "keywords": [
25
+ "pi-package",
26
+ "pi",
27
+ "extension",
28
+ "provider",
29
+ "coralbricks",
30
+ "coral",
31
+ "ai",
32
+ "llm",
33
+ "glm",
34
+ "deepseek",
35
+ "deepseek"
36
+ ],
37
+ "license": "MIT",
38
+ "files": [
39
+ "index.ts",
40
+ "settings.ts",
41
+ "auth.ts",
42
+ "park.ts",
43
+ "guard.ts",
44
+ "sync-policy.ts",
45
+ "models.json",
46
+ "deprecated-models.json",
47
+ "custom-models.json",
48
+ "patch.json",
49
+ "scripts/update-models.js",
50
+ "README.md",
51
+ "LICENSE"
52
+ ],
53
+ "overrides": {
54
+ "brace-expansion": "5.0.12"
55
+ },
56
+ "devDependencies": {
57
+ "@earendil-works/pi-tui": "1.1.0",
58
+ "@types/node": "^22.20.0",
59
+ "typescript": "6.0.3",
60
+ "vitest": "4.1.7",
61
+ "@earendil-works/pi-ai": "1.1.0",
62
+ "@earendil-works/pi-coding-agent": "1.1.0"
63
+ },
64
+ "pi": {
65
+ "extensions": [
66
+ "./index.ts"
67
+ ]
68
+ },
69
+ "peerDependencies": {
70
+ "@earendil-works/pi-tui": "*",
71
+ "@earendil-works/pi-ai": "*",
72
+ "@earendil-works/pi-coding-agent": "*"
73
+ }
74
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Parking: continue Coral Responses turns with `previous_response_id`.
3
+ *
4
+ * pi replays the whole transcript on every request. With parking on, each
5
+ * response is stored on Coral (`store: true`) and the next request sends only
6
+ * the items that came after it (tool results, the next user message). Coral
7
+ * keeps the parked state, sticky-routes the chain to the same replica and
8
+ * bills only the new input.
9
+ *
10
+ * A chain is used only when the full input pi would have sent starts with
11
+ * exactly the input of the parked request, followed by that response's own
12
+ * output items. Anything else (compaction, a model switch, an edited or
13
+ * branched history, a restart) sends the full transcript, which parks again.
14
+ * If Coral no longer has the parent (`previous_response_not_found`), the same
15
+ * request is re-sent once in full.
16
+ */
17
+ import { createHash } from "node:crypto";
18
+
19
+ type Item = Record<string, unknown>;
20
+
21
+ interface ParkedTurn {
22
+ model: string;
23
+ /** Digests of the full input sent with the request that produced this response. */
24
+ input: string[];
25
+ }
26
+
27
+ export interface ParkPlan {
28
+ /** Request body to send. */
29
+ params: Record<string, any>;
30
+ /** Full-transcript body to re-send if the parent is gone; undefined when not chained. */
31
+ fallback?: Record<string, any>;
32
+ /** Digests of the full input, recorded against the response id on success. */
33
+ input: string[];
34
+ }
35
+
36
+ const MAX_PARKED = 256;
37
+ const parked = new Map<string, ParkedTurn>();
38
+
39
+ function digest(item: unknown): string {
40
+ return createHash("sha256").update(JSON.stringify(item)).digest("base64url");
41
+ }
42
+
43
+ function isOutputItem(item: Item): boolean {
44
+ return item.type === "reasoning"
45
+ || item.type === "function_call"
46
+ || item.type === "custom_tool_call"
47
+ || (item.type === "message" && item.role === "assistant");
48
+ }
49
+
50
+ /** The last assistant message, if it is a completed Coral Responses turn from this model. */
51
+ function parentId(messages: any[] | undefined, model: { id: string; provider: string }): string | undefined {
52
+ for (let i = (messages?.length ?? 0) - 1; i >= 0; i--) {
53
+ const msg = messages![i];
54
+ if (msg?.role !== "assistant") continue;
55
+ const ok = typeof msg.responseId === "string"
56
+ && msg.provider === model.provider
57
+ && msg.api === "openai-responses"
58
+ && msg.model === model.id
59
+ && msg.stopReason !== "error"
60
+ && msg.stopReason !== "aborted";
61
+ return ok ? msg.responseId : undefined;
62
+ }
63
+ return undefined;
64
+ }
65
+
66
+ export function planPark(params: Record<string, any>, messages: any[] | undefined, model: { id: string; provider: string }): ParkPlan {
67
+ const full: Item[] = Array.isArray(params.input) ? params.input : [];
68
+ const input = full.map(digest);
69
+ const stored: Record<string, any> = { ...params, store: true };
70
+ delete stored.previous_response_id;
71
+
72
+ const id = parentId(messages, model);
73
+ const turn = id ? parked.get(id) : undefined;
74
+ if (!id || !turn || turn.model !== model.id || turn.input.length > input.length) return { params: stored, input };
75
+ for (let i = 0; i < turn.input.length; i++) {
76
+ if (turn.input[i] !== input[i]) return { params: stored, input };
77
+ }
78
+
79
+ // Skip the parent's own output; Coral already holds it.
80
+ let start = turn.input.length;
81
+ while (start < full.length && isOutputItem(full[start])) start++;
82
+ const delta = full.slice(start);
83
+ if (delta.length === 0 || delta.some(isOutputItem)) return { params: stored, input };
84
+
85
+ return { params: { ...stored, previous_response_id: id, input: delta }, fallback: stored, input };
86
+ }
87
+
88
+ export function park(responseId: string, model: string, input: string[]): void {
89
+ parked.delete(responseId);
90
+ parked.set(responseId, { model, input });
91
+ while (parked.size > MAX_PARKED) parked.delete(parked.keys().next().value!);
92
+ }
93
+
94
+ export function forget(responseId: string): void {
95
+ parked.delete(responseId);
96
+ }
97
+
98
+ export function clearParked(): void {
99
+ parked.clear();
100
+ }
101
+
102
+ export function isParentMissing(status: number, body: string): boolean {
103
+ return (status === 404 || status === 400) && body.includes("previous_response_not_found");
104
+ }
105
+
106
+ /**
107
+ * Wrap fetch so a chained request whose parent Coral no longer has is re-sent
108
+ * once with the full transcript. Every other response passes through untouched.
109
+ */
110
+ export function withParkFallback(base: typeof fetch, plan: () => ParkPlan | undefined): typeof fetch {
111
+ return async (input: any, init?: any) => {
112
+ const response = await base(input, init);
113
+ const current = plan();
114
+ if (response.ok || !current?.fallback) return response;
115
+ const body = await response.clone().text().catch(() => "");
116
+ if (!isParentMissing(response.status, body)) return response;
117
+ forget(current.params.previous_response_id);
118
+ const headers = new Headers(init?.headers);
119
+ headers.delete("content-length");
120
+ return base(input, { ...init, headers, body: JSON.stringify(current.fallback) });
121
+ };
122
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "deepseek-v4.1-flash-fast": {
3
+ "reasoning": true,
4
+ "input": ["text", "image"],
5
+ "thinkingLevelMap": { "off": "none", "minimal": null, "low": "low", "medium": null, "high": "high", "xhigh": null, "max": "max" },
6
+ "cost": { "cacheWrite": 0.09 },
7
+ "compat": { "supportsReasoningEffort": true, "thinkingFormat": "openai" }
8
+ },
9
+ "deepseek-v4.1-flash-fast-fp4": {
10
+ "name": "DeepSeek V4.1 Flash FP4",
11
+ "hidden": true,
12
+ "reasoning": true,
13
+ "input": ["text", "image"],
14
+ "thinkingLevelMap": { "off": "none", "minimal": null, "low": "low", "medium": null, "high": "high", "xhigh": null, "max": "max" },
15
+ "cost": { "cacheWrite": 0.09 },
16
+ "compat": { "supportsReasoningEffort": true, "thinkingFormat": "openai" }
17
+ },
18
+ "glm-5.3-fast": {
19
+ "reasoning": true,
20
+ "thinkingLevelMap": { "off": "none", "minimal": null, "low": "low", "medium": null, "high": "high", "xhigh": null, "max": "max" },
21
+ "maxTokens": 131072,
22
+ "cost": { "cacheWrite": 1.68 },
23
+ "compat": { "supportsReasoningEffort": true, "thinkingFormat": "zai" }
24
+ },
25
+ "glm-5.3-fp4": {
26
+ "name": "GLM 5.3 FP4",
27
+ "hidden": true,
28
+ "reasoning": true,
29
+ "thinkingLevelMap": { "off": "none", "minimal": null, "low": "low", "medium": null, "high": "high", "xhigh": null, "max": "max" },
30
+ "maxTokens": 131072,
31
+ "cost": { "cacheWrite": 1.68 },
32
+ "compat": { "supportsReasoningEffort": true, "thinkingFormat": "zai" }
33
+ }
34
+ }