@howaboua/pi-durable-context 0.10.0 → 0.13.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.
- package/NOTICE +4 -0
- package/README.md +8 -4
- package/dist/activation.js +563 -128
- package/dist/index.js +548 -127
- package/dist/internal/context-visibility.d.ts +1 -1
- package/dist/packages/context/src/activation.d.ts +4 -1
- package/dist/packages/context/src/admission.d.ts +3 -0
- package/dist/packages/context/src/deferred-rollover.d.ts +30 -0
- package/dist/packages/context/src/history-archive.d.ts +1 -1
- package/dist/packages/context/src/history.d.ts +22 -6
- package/dist/packages/context/src/index.d.ts +10 -1
- package/dist/packages/context/src/input-placement.d.ts +1 -1
- package/dist/packages/context/src/instruction-run.d.ts +1 -1
- package/dist/packages/context/src/lifecycle.d.ts +1 -1
- package/dist/packages/context/src/model-roles.d.ts +2 -2
- package/dist/packages/context/src/note-store.d.ts +15 -1
- package/dist/packages/context/src/notes.d.ts +22 -5
- package/dist/packages/context/src/policy.d.ts +3 -2
- package/dist/packages/context/src/remote.d.ts +1 -1
- package/dist/packages/context/src/rollover-preparation.d.ts +1 -1
- package/dist/packages/context/src/rollover-tail.d.ts +12 -0
- package/dist/packages/context/src/rollover.d.ts +3 -2
- package/dist/packages/context/src/tool-contract.d.ts +8 -4
- package/dist/packages/context/src/tool-rollover.d.ts +12 -4
- package/dist/packages/context/src/usage.d.ts +1 -1
- package/dist/packages/context/src/window-state.d.ts +1 -0
- package/dist/packages/execution/src/tool-origin.d.ts +19 -0
- package/package.json +7 -7
package/NOTICE
CHANGED
|
@@ -61,3 +61,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
61
61
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
62
62
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
63
|
SOFTWARE.
|
|
64
|
+
|
|
65
|
+
Selected changes adapted from IgorWarzocha/howaboua-agent-stuff,
|
|
66
|
+
packages/pi-agent-comms at e1730759db35bf454d0c86c34a80e63129dd929f.
|
|
67
|
+
See docs/parity.md for the scope of this source sync.
|
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Continue long conversations through saved notes and clean context windows. Notes, retained history, pending input and rollover progress live in the same SQLite database as your Durable conversation. No Codex account or provider-specific storage is required.
|
|
4
4
|
|
|
5
|
-
Requires Node 22.19 or newer and Durable 1.
|
|
5
|
+
Requires Node 22.19 or newer and Durable 1.8.0.
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install
|
|
8
|
+
npm install @howaboua/pi-durable-context@0.13.0
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Connect your host
|
|
@@ -38,13 +38,13 @@ const receipt = await harness.waitForTask(task, ctx);
|
|
|
38
38
|
|
|
39
39
|
The receipt uses Durable's normal task outcomes. A completed input result contains `status`, the native `submission` ID and either the final `answer` entry ID or an unanswered reason. A `new_context` tool call keeps the original native input open until the final answer. Delegation, watches and direct submission waits therefore see the same completion, without a Context-specific connector. Reusing a `requestId` returns the original task without admitting the input twice.
|
|
40
40
|
|
|
41
|
-
With Code or Notebook, also call `code.bind(harness)` or `notebook.bind(harness)`.
|
|
41
|
+
With Code or Notebook, also call `code.bind(harness)` or `notebook.bind(harness)`. `new_context` stays on the native model surface. A foreground execution cell can also call `await tools.new_context({})` after an awaited note write in that same cell. It is not listed in the cell inventory. The rollover waits for the cell, request and model tool round to finish successfully.
|
|
42
42
|
|
|
43
43
|
## What happens during a conversation
|
|
44
44
|
|
|
45
45
|
- `notes` reads and writes virtual paths under `/notes`. Relative paths resolve there. Notes are not workspace files. Each file is limited to 1 MB. Reads return the full selected lines by default. Optional `limit_chars` and `offset_chars` provide character paging. Search returns full matching lines. Supply `target` with another conversation's numeric ID as a string to read its notes when both conversations share a Context visibility group. Writes can only target the calling conversation.
|
|
46
46
|
- `history` searches retained entries by window and item ID, with bounded retrieval. Its optional `target` selects another conversation in the same storage and Context visibility group. Searches default to case-sensitive literal matches. Old history is never automatically reinserted into the prompt. Conversations without Context windows use `conversation:<id>` as their window ID.
|
|
47
|
-
- `new_context`
|
|
47
|
+
- `new_context` needs a fresh checkpoint and a tool round with no sibling calls. Without a qualifying save it returns `checkpoint_required`. Once the round completes, it cuts the context and continues within the same native input. If queued input or other foreground work prevents a safe immediate cut, the model receives a skipped-rollover message and the window stays intact. The prompt lists recent note paths, not their contents.
|
|
48
48
|
- `newContextRequests` controls agent-requested windows: `unrestricted` (the source default) permits a new window at any history size, `off` removes the tool and its rollover reminders, and `pi-limits` requires eligible history. Supply the read-only `hasEligibleContextHistory(conversationId, context)` host signal for `pi-limits`; false leaves the window unchanged, and callback errors fail closed. The source mode invokes Pi compaction to determine eligibility; Durable uses this explicit host signal and does not emulate Pi compaction. The host's `management.newContext` API remains available in every mode.
|
|
49
49
|
- At 85% and 90% context usage, advisory reminders ask for a checkpoint. An optional token budget suggests finishing the current task and starting a fresh window before the next task. `get_context_remaining` reports provider usage plus an estimated tail, or explicitly reports an unknown budget.
|
|
50
50
|
- Automatic idle rollover defaults off. Enable it with `createContextManagement({ models, automaticIdleRollover: true })`. After 25 minutes of observed inactivity, the next managed input rolls only if the latest completed run saved fresh notes. Otherwise it is admitted normally, without a synthetic checkpoint. Its content, attachments and busy policy remain intact.
|
|
@@ -71,6 +71,10 @@ Unassigned conversations in the same storage remain readable, including legacy c
|
|
|
71
71
|
|
|
72
72
|
Normal threshold and manual compaction are declined. Overflow compaction remains an emergency fallback using the configured model, within the same logical window. For a host-initiated rollover, call `management.newContext(conversation.id, ctx)` and await its task. It requests a checkpoint through native instructions when needed, without inventing a user message or sending an extra continuation after the cut. Rollover instructions remain chronological system messages in Durable, projected to developer messages by providers that support that role. User and peer messages retain their original roles.
|
|
73
73
|
|
|
74
|
+
Set `rolloverTail` to `"conversation"` to keep the dialogue after the completed save during manual and idle rollovers, or `"full"` to keep complete tool rounds as well. The default, `"off"`, keeps no tail. A missing eligible tail leaves the current window intact. Older entries remain accessible through history.
|
|
75
|
+
|
|
76
|
+
Set `taskCompletionRollover: true` to let the model save its notes and call `new_context({ resume: false })`. It finishes the current reply in the old window and opens a fresh one without starting another turn. Queued input is placed after the cut. This option is off by default.
|
|
77
|
+
|
|
74
78
|
## Model roles
|
|
75
79
|
|
|
76
80
|
Supply `modelRoles(conversationId, context)` to expose user-configured roles authorised for that conversation. Each role has `id`, `description`, `provider`, `model` and `reasoning`. The host owns configuration storage and access policy. The agent sees only IDs, descriptions and guidance to switch for sustained scope changes rather than brief specialist detours.
|