@howaboua/pi-durable-code 0.0.0-stage → 0.10.0

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +251 -0
  3. package/README.md +93 -2
  4. package/dist/activation.js +4759 -0
  5. package/dist/code/src/activation.d.ts +5 -0
  6. package/dist/code/src/binary.d.ts +6 -0
  7. package/dist/code/src/cell-output.d.ts +33 -0
  8. package/dist/code/src/engine.d.ts +16 -0
  9. package/dist/code/src/history.d.ts +6 -0
  10. package/dist/code/src/host-assets.d.ts +4 -0
  11. package/dist/code/src/host-connection.d.ts +29 -0
  12. package/dist/code/src/host-process.d.ts +21 -0
  13. package/dist/code/src/host-protocol.d.ts +54 -0
  14. package/dist/code/src/host-runtime.d.ts +21 -0
  15. package/dist/code/src/host-session.d.ts +24 -0
  16. package/dist/code/src/index.d.ts +32 -0
  17. package/dist/code/src/install-host.d.ts +7 -0
  18. package/dist/code/src/presentation.d.ts +22 -0
  19. package/dist/code/src/result.d.ts +4 -0
  20. package/dist/code/src/runtime-contract.d.ts +24 -0
  21. package/dist/code/src/runtime-response.d.ts +2 -0
  22. package/dist/code/src/runtime-tools.d.ts +7 -0
  23. package/dist/execution/src/cell-contract.d.ts +49 -0
  24. package/dist/execution/src/cell-observation.d.ts +7 -0
  25. package/dist/execution/src/cell-progress.d.ts +4 -0
  26. package/dist/execution/src/cell-task.d.ts +17 -0
  27. package/dist/execution/src/cell-tools.d.ts +8 -0
  28. package/dist/execution/src/cells.d.ts +14 -0
  29. package/dist/execution/src/command-backend.d.ts +22 -0
  30. package/dist/execution/src/controls.d.ts +3 -0
  31. package/dist/execution/src/custom-command-config.d.ts +21 -0
  32. package/dist/execution/src/custom-commands.d.ts +62 -0
  33. package/dist/execution/src/exec-source.d.ts +21 -0
  34. package/dist/execution/src/forwarded-tools.d.ts +21 -0
  35. package/dist/execution/src/forwarding-hook.d.ts +6 -0
  36. package/dist/execution/src/forwarding.d.ts +15 -0
  37. package/dist/execution/src/history.d.ts +14 -0
  38. package/dist/execution/src/index.d.ts +6 -0
  39. package/dist/execution/src/invocation-state.d.ts +26 -0
  40. package/dist/execution/src/invocation.d.ts +35 -0
  41. package/dist/execution/src/native-tools.d.ts +11 -0
  42. package/dist/execution/src/nested-call.d.ts +26 -0
  43. package/dist/execution/src/nested-result.d.ts +8 -0
  44. package/dist/execution/src/nested.d.ts +3 -0
  45. package/dist/execution/src/output.d.ts +48 -0
  46. package/dist/execution/src/presentation.d.ts +59 -0
  47. package/dist/execution/src/progress.d.ts +23 -0
  48. package/dist/execution/src/projection.d.ts +5 -0
  49. package/dist/execution/src/shell/backend.d.ts +28 -0
  50. package/dist/execution/src/shell/format.d.ts +2 -0
  51. package/dist/execution/src/shell/node-backend.d.ts +9 -0
  52. package/dist/execution/src/shell/output.d.ts +19 -0
  53. package/dist/execution/src/shell/process-session.d.ts +50 -0
  54. package/dist/execution/src/shell/results.d.ts +14 -0
  55. package/dist/execution/src/shell/session-manager.d.ts +46 -0
  56. package/dist/execution/src/shell/session-store.d.ts +53 -0
  57. package/dist/execution/src/shell/shell-args.d.ts +4 -0
  58. package/dist/execution/src/shell/shell.d.ts +14 -0
  59. package/dist/execution/src/shell/wait.d.ts +7 -0
  60. package/dist/execution/src/shell.d.ts +14 -0
  61. package/dist/execution/src/tool-contract.d.ts +34 -0
  62. package/dist/execution/src/tool-origin.d.ts +11 -0
  63. package/dist/execution/src/tool-source.d.ts +6 -0
  64. package/dist/execution/src/tool-value.d.ts +3 -0
  65. package/dist/execution/src/wait-session.d.ts +6 -0
  66. package/dist/history.js +315 -0
  67. package/dist/index.js +5063 -0
  68. package/dist/presentation.js +198 -0
  69. package/package.json +77 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Igor Warzocha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,251 @@
1
+ Generic truncation recovery guidance follows Pi Stuff merged PR #552
2
+ revision 84bd5bce60a77c4298484d4b7c810d4fe5220a1b, retaining the MIT notices below.
3
+
4
+ Code Mode TypeScript protocol, process, session, installer, grammar, custom
5
+ command configuration and process execution code
6
+ adapted from @howaboua/pi-codex-conversion, revision
7
+ b2006db9def12c373ae48e70044d30f7d6b7e34f.
8
+ Official host assets, cancellation and help-backed discovery refreshed against
9
+ 7f3295e67a8e6146b2a6922b56a06fa4db5c3a32, including local source commits.
10
+ Completed nested-call identities and successful-cell termination follow
11
+ 3d0faf5a6f0bc67c0bd9248d07da6ddfa901b281.
12
+ Source: https://github.com/IgorWarzocha/howaboua-pi-stuff
13
+ Modifications: Durable-native lifecycle, ordinary-tool dispatch, original-name
14
+ projection, Node proxy transport, explicit host paths and cache location,
15
+ trusted-root command loading and namespace-bound command capabilities.
16
+
17
+ MIT License
18
+
19
+ Copyright (c) 2026 Igor Warzocha
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+
39
+ Standalone runtime dependency: OpenAI Codex rust-v0.163.0,
40
+ commit 83086188ae0614bd882818ff1aa23f3194962012.
41
+ Source: https://github.com/openai/codex
42
+ The native host is provisioned separately. Its original notices follow.
43
+
44
+ OpenAI Codex
45
+ Copyright 2025 OpenAI
46
+
47
+ This project includes code derived from [Ratatui](https://github.com/ratatui/ratatui), licensed under the MIT license.
48
+ Copyright (c) 2016-2022 Florian Dehau
49
+ Copyright (c) 2023-2025 The Ratatui Developers
50
+
51
+ Apache License
52
+ Version 2.0, January 2004
53
+ http://www.apache.org/licenses/
54
+
55
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
56
+
57
+ 1. Definitions.
58
+
59
+ "License" shall mean the terms and conditions for use, reproduction,
60
+ and distribution as defined by Sections 1 through 9 of this document.
61
+
62
+ "Licensor" shall mean the copyright owner or entity authorized by
63
+ the copyright owner that is granting the License.
64
+
65
+ "Legal Entity" shall mean the union of the acting entity and all
66
+ other entities that control, are controlled by, or are under common
67
+ control with that entity. For the purposes of this definition,
68
+ "control" means (i) the power, direct or indirect, to cause the
69
+ direction or management of such entity, whether by contract or
70
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
71
+ outstanding shares, or (iii) beneficial ownership of such entity.
72
+
73
+ "You" (or "Your") shall mean an individual or Legal Entity
74
+ exercising permissions granted by this License.
75
+
76
+ "Source" form shall mean the preferred form for making modifications,
77
+ including but not limited to software source code, documentation
78
+ source, and configuration files.
79
+
80
+ "Object" form shall mean any form resulting from mechanical
81
+ transformation or translation of a Source form, including but
82
+ not limited to compiled object code, generated documentation,
83
+ and conversions to other media types.
84
+
85
+ "Work" shall mean the work of authorship, whether in Source or
86
+ Object form, made available under the License, as indicated by a
87
+ copyright notice that is included in or attached to the work
88
+ (an example is provided in the Appendix below).
89
+
90
+ "Derivative Works" shall mean any work, whether in Source or Object
91
+ form, that is based on (or derived from) the Work and for which the
92
+ editorial revisions, annotations, elaborations, or other modifications
93
+ represent, as a whole, an original work of authorship. For the purposes
94
+ of this License, Derivative Works shall not include works that remain
95
+ separable from, or merely link (or bind by name) to the interfaces of,
96
+ the Work and Derivative Works thereof.
97
+
98
+ "Contribution" shall mean any work of authorship, including
99
+ the original version of the Work and any modifications or additions
100
+ to that Work or Derivative Works thereof, that is intentionally
101
+ submitted to Licensor for inclusion in the Work by the copyright owner
102
+ or by an individual or Legal Entity authorized to submit on behalf of
103
+ the copyright owner. For the purposes of this definition, "submitted"
104
+ means any form of electronic, verbal, or written communication sent
105
+ to the Licensor or its representatives, including but not limited to
106
+ communication on electronic mailing lists, source code control systems,
107
+ and issue tracking systems that are managed by, or on behalf of, the
108
+ Licensor for the purpose of discussing and improving the Work, but
109
+ excluding communication that is conspicuously marked or otherwise
110
+ designated in writing by the copyright owner as "Not a Contribution."
111
+
112
+ "Contributor" shall mean Licensor and any individual or Legal Entity
113
+ on behalf of whom a Contribution has been received by Licensor and
114
+ subsequently incorporated within the Work.
115
+
116
+ 2. Grant of Copyright License. Subject to the terms and conditions of
117
+ this License, each Contributor hereby grants to You a perpetual,
118
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
119
+ copyright license to reproduce, prepare Derivative Works of,
120
+ publicly display, publicly perform, sublicense, and distribute the
121
+ Work and such Derivative Works in Source or Object form.
122
+
123
+ 3. Grant of Patent License. Subject to the terms and conditions of
124
+ this License, each Contributor hereby grants to You a perpetual,
125
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
126
+ (except as stated in this section) patent license to make, have made,
127
+ use, offer to sell, sell, import, and otherwise transfer the Work,
128
+ where such license applies only to those patent claims licensable
129
+ by such Contributor that are necessarily infringed by their
130
+ Contribution(s) alone or by combination of their Contribution(s)
131
+ with the Work to which such Contribution(s) was submitted. If You
132
+ institute patent litigation against any entity (including a
133
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
134
+ or a Contribution incorporated within the Work constitutes direct
135
+ or contributory patent infringement, then any patent licenses
136
+ granted to You under this License for that Work shall terminate
137
+ as of the date such litigation is filed.
138
+
139
+ 4. Redistribution. You may reproduce and distribute copies of the
140
+ Work or Derivative Works thereof in any medium, with or without
141
+ modifications, and in Source or Object form, provided that You
142
+ meet the following conditions:
143
+
144
+ (a) You must give any other recipients of the Work or
145
+ Derivative Works a copy of this License; and
146
+
147
+ (b) You must cause any modified files to carry prominent notices
148
+ stating that You changed the files; and
149
+
150
+ (c) You must retain, in the Source form of any Derivative Works
151
+ that You distribute, all copyright, patent, trademark, and
152
+ attribution notices from the Source form of the Work,
153
+ excluding those notices that do not pertain to any part of
154
+ the Derivative Works; and
155
+
156
+ (d) If the Work includes a "NOTICE" text file as part of its
157
+ distribution, then any Derivative Works that You distribute must
158
+ include a readable copy of the attribution notices contained
159
+ within such NOTICE file, excluding those notices that do not
160
+ pertain to any part of the Derivative Works, in at least one
161
+ of the following places: within a NOTICE text file distributed
162
+ as part of the Derivative Works; within the Source form or
163
+ documentation, if provided along with the Derivative Works; or,
164
+ within a display generated by the Derivative Works, if and
165
+ wherever such third-party notices normally appear. The contents
166
+ of the NOTICE file are for informational purposes only and
167
+ do not modify the License. You may add Your own attribution
168
+ notices within Derivative Works that You distribute, alongside
169
+ or as an addendum to the NOTICE text from the Work, provided
170
+ that such additional attribution notices cannot be construed
171
+ as modifying the License.
172
+
173
+ You may add Your own copyright statement to Your modifications and
174
+ may provide additional or different license terms and conditions
175
+ for use, reproduction, or distribution of Your modifications, or
176
+ for any such Derivative Works as a whole, provided Your use,
177
+ reproduction, and distribution of the Work otherwise complies with
178
+ the conditions stated in this License.
179
+
180
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
181
+ any Contribution intentionally submitted for inclusion in the Work
182
+ by You to the Licensor shall be under the terms and conditions of
183
+ this License, without any additional terms or conditions.
184
+ Notwithstanding the above, nothing herein shall supersede or modify
185
+ the terms of any separate license agreement you may have executed
186
+ with Licensor regarding such Contributions.
187
+
188
+ 6. Trademarks. This License does not grant permission to use the trade
189
+ names, trademarks, service marks, or product names of the Licensor,
190
+ except as required for reasonable and customary use in describing the
191
+ origin of the Work and reproducing the content of the NOTICE file.
192
+
193
+ 7. Disclaimer of Warranty. Unless required by applicable law or
194
+ agreed to in writing, Licensor provides the Work (and each
195
+ Contributor provides its Contributions) on an "AS IS" BASIS,
196
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
197
+ implied, including, without limitation, any warranties or conditions
198
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
199
+ PARTICULAR PURPOSE. You are solely responsible for determining the
200
+ appropriateness of using or redistributing the Work and assume any
201
+ risks associated with Your exercise of permissions under this License.
202
+
203
+ 8. Limitation of Liability. In no event and under no legal theory,
204
+ whether in tort (including negligence), contract, or otherwise,
205
+ unless required by applicable law (such as deliberate and grossly
206
+ negligent acts) or agreed to in writing, shall any Contributor be
207
+ liable to You for damages, including any direct, indirect, special,
208
+ incidental, or consequential damages of any character arising as a
209
+ result of this License or out of the use or inability to use the
210
+ Work (including but not limited to damages for loss of goodwill,
211
+ work stoppage, computer failure or malfunction, or any and all
212
+ other commercial damages or losses), even if such Contributor
213
+ has been advised of the possibility of such damages.
214
+
215
+ 9. Accepting Warranty or Additional Liability. While redistributing
216
+ the Work or Derivative Works thereof, You may choose to offer,
217
+ and charge a fee for, acceptance of support, warranty, indemnity,
218
+ or other liability obligations and/or rights consistent with this
219
+ License. However, in accepting such obligations, You may act only
220
+ on Your own behalf and on Your sole responsibility, not on behalf
221
+ of any other Contributor, and only if You agree to indemnify,
222
+ defend, and hold each Contributor harmless for any liability
223
+ incurred by, or claims asserted against, such Contributor by reason
224
+ of your accepting any such warranty or additional liability.
225
+
226
+ END OF TERMS AND CONDITIONS
227
+
228
+ APPENDIX: How to apply the Apache License to your work.
229
+
230
+ To apply the Apache License to your work, attach the following
231
+ boilerplate notice, with the fields enclosed by brackets "[]"
232
+ replaced with your own identifying information. (Don't include
233
+ the brackets!) The text should be enclosed in the appropriate
234
+ comment syntax for the file format. We also recommend that a
235
+ file or class name and description of purpose be included on the
236
+ same "printed page" as the copyright notice for easier
237
+ identification within third-party archives.
238
+
239
+ Copyright 2025 OpenAI
240
+
241
+ Licensed under the Apache License, Version 2.0 (the "License");
242
+ you may not use this file except in compliance with the License.
243
+ You may obtain a copy of the License at
244
+
245
+ http://www.apache.org/licenses/LICENSE-2.0
246
+
247
+ Unless required by applicable law or agreed to in writing, software
248
+ distributed under the License is distributed on an "AS IS" BASIS,
249
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
250
+ See the License for the specific language governing permissions and
251
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,94 @@
1
- # Temporary Holding Version
1
+ # Code Mode for Durable
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run JavaScript that composes ordinary Durable tools. `exec` and `wait` are the model-facing surface. Shell execution and PTY sessions are included.
4
+
5
+ Requires Node 22.19 or newer and Durable 1.4.0.
6
+
7
+ ```sh
8
+ npm install https://github.com/IgorWarzocha/pi-durable-components/releases/download/v0.10.0/howaboua-pi-durable-code-0.10.0.tgz
9
+ ```
10
+
11
+ The shell's native PTY addon requires Python, Make and a C++ compiler on Linux. If install scripts are disabled, run `npm rebuild node-pty` before using interactive shells. Pipe-based commands do not require the addon.
12
+
13
+ Create the component before opening your harness, install its extension, and select that extension in the conversation.
14
+
15
+ ```ts
16
+ import { Harness, createRegistry } from "@earendil-works/pi-durable";
17
+ import { createCodeMode, createNodeShellBackend } from "@howaboua/pi-durable-code";
18
+
19
+ let harness: Harness;
20
+ const code = createCodeMode({
21
+ shell: { backend: createNodeShellBackend({ environmentId: "local" }) },
22
+ cancelTask: (id, context) => harness.abortTask(id, context),
23
+ });
24
+ const registry = createRegistry();
25
+ registry.install(code.extension);
26
+ // Install your other extensions in the same registry.
27
+ harness = await Harness.open(storage, { models, registry, env }, context);
28
+ code.bind(harness);
29
+ const conversation = await harness.root(context, {
30
+ agent: { model, extensions: [code.extension, otherExtension] },
31
+ });
32
+ ```
33
+
34
+ `storage`, `models`, `model`, `env`, and `context` are your normal Durable setup. The shell backend's `environmentId` must equal your execution environment's `id`. A sandbox or remote environment needs a backend for that environment. No operation silently uses local shell execution instead.
35
+
36
+ An agent can now use JavaScript such as `text(await tools.some_tool({ ... }))`. Installed tools need no Code-specific adapter. `ALL_TOOLS` contains their original names, usage, descriptions, and input schemas. Names with punctuation remain callable through `tools[name]`.
37
+
38
+ Registrations with `executionHints.nativeOnly: true` remain native model tools and cannot be called inside cells. Binding the Harness enables this projection using the conversation's selected tools. Context management uses it for `new_context`.
39
+
40
+ Tool results expose meaningful `details` together with their result content. Empty details fall back to parsed JSON text or unchanged text. Images add a base64 `image_url` suitable for `image(result)` and `generatedImage(result)`. Tool failures throw in JavaScript. Durable still owns validation, wrappers, hooks, usage accounting, cancellation, and unsafe-operation recovery.
41
+
42
+ ## Custom commands
43
+
44
+ Existing custom-tool TOML definitions are supported. Supply the directories and their trust decisions explicitly. The package never scans Pi's home directory or enables bundled examples.
45
+
46
+ The same custom-command factories are available from the separate Notebook package. Both packages use one internal implementation and register ordinary Durable tools.
47
+
48
+ ```ts
49
+ import { createCustomCommands, createNodeCommandBackend } from "@howaboua/pi-durable-code";
50
+
51
+ const commands = await createCustomCommands({
52
+ registry,
53
+ files: env,
54
+ backend: createNodeCommandBackend({ environmentId: env.id }),
55
+ roots: [
56
+ { path: globalCommands, trusted: true },
57
+ { path: projectCommands, trusted: projectIsTrusted },
58
+ ],
59
+ onDiscoveryError: error => console.error(error.message),
60
+ }, context);
61
+ // Select commands.extension alongside code.extension in the conversation.
62
+ ```
63
+
64
+ Later trusted directories override earlier ones. Invalid overrides remain disabled instead of falling back to a different global command. Untrusted directories are not read.
65
+
66
+ Each top-level `.toml` filename names a tool. Required fields are `usage` and `command`. Optional fields are `description`, `output`, `args`, `input`, `defer_loading`, and `yield_time_ms`. Every command accepts one string and returns one string. Relative command paths resolve from the TOML directory. Absolute JavaScript files run through the backend's JavaScript launcher. Bare commands resolve through that backend's `PATH`. Commands run directly without shell expansion, in the conversation's working directory.
67
+
68
+ `input` is `"arg"` by default or `"stdin"`. Successful output is stdout with trailing whitespace removed, then stderr when stdout is empty, then `(no output)`. Nonzero exits include stderr. Combined output is capped at 50 KiB. Cancellation drains the owned process group where supported.
69
+
70
+ Definitions are reread before execution. The live loader refreshes ordinary registry registrations before model requests, so additions, removals, and metadata changes appear in `ALL_TOOLS`. `defer_loading = false` promotes only the current usage line into the Code prompt. `yield_time_ms` overrides the initial exec wait when source directly calls that tool. Multiple direct calls use the largest configured value.
71
+
72
+ `loadCustomCommandTools(options, context)` provides a snapshot loader instead when the host wants to publish registry updates itself. `commands.errors` exposes discovery errors. Call `await commands.close()` when removing the live loader.
73
+
74
+ ## Runtime boundaries
75
+
76
+ The component automatically downloads the standalone OpenAI Codex V8 host pinned to `rust-v0.163.0`. Downloads are checksum verified. Supported platforms are Linux, macOS, and Windows on x64 and ARM64. `hostPath` selects an explicitly provisioned compatible host. `cacheDirectory` changes the download cache. Unix automatic installation needs `tar`.
77
+
78
+ Each cell has a fresh isolated V8 context with text, image, notification, timer, yield, and exit helpers. It has no filesystem, network, Node globals, or arbitrary imports. Use ordinary tools for those capabilities. `store(key, value)` and `load(key)` retain serializable data within one conversation's live host session. Lexical bindings do not survive between Code cells. Use the separate Notebook package when you need persistent bindings and imports.
79
+
80
+ Yielded cells remain owned by the conversation. `wait` observes the existing cell. Its output budget applies to that delivery, not the cell's accumulated lifetime. One bounded observation is retained until delivered, then native output collection continues. Termination cancels owned nested calls and interrupts V8. Interrupted work is reported rather than replayed after a process restart. Native host state and PTYs do not survive that restart.
81
+
82
+ Call `await code.close()` when disposing the component, then close your harness. This stops native hosts and shell sessions.
83
+
84
+ If the native host exits unexpectedly, interrupted output remains observable. Recreate the component before running new cells. The package does not silently replace a lost session with an empty one.
85
+
86
+ ## Headless presentations
87
+
88
+ `@howaboua/pi-durable-code/presentation` exports `codeCapability`, `codeSummary` and `codeDetail`. These browser-safe descriptors are structurally compatible with the UI SDK without importing it. They perform no I/O and have no renderer.
89
+
90
+ The host supplies `{cell, result}`. Each field is explicitly nullable. A cell is `{id, status}`, with a canonical positive decimal task ID and the actual coordinator status: `running`, `completed`, `failed`, `aborted` or `interrupted`. Read these from exec/wait receipt details `cellId` and `status`. Do not substitute host request activity for cell lifecycle.
91
+
92
+ `result: null` means output has not been acquired. Otherwise pass the ordinary execution receipt. Parsing retains text, base64 images, `isError`, JSON details and structured diagnostics. Omitted fields normalize to empty content, false, null and empty diagnostics. Usage and controls remain Durable-owned, not presentation actions. Summary selects title, cell identity and status, output availability and nullable `isError`. Detail selects the full validated state. Summary can request detail without acquiring it.
93
+
94
+ The host authorizes `exec` and `wait` through ordinary registrations and publishes acquired receipts on the declared `results` stream. This is host publication, not a new runtime stream or tool bridge. Each receipt is one bounded observation, not cumulative output. Presentation disposal does not terminate cells, roll back effects or authorize replay. Acquisition, binding and cancellation policy belong to the host.